How to use the @ovh-ux/ui-kit.core/src/js/component-utils.getAttribute function in @ovh-ux/ui-kit

To help you get started, we’ve selected a few @ovh-ux/ui-kit examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ovh-ux / ovh-ui-kit / packages / components / datagrid / src / js / datagrid-column-builder.service.js View on Github external
angular.forEach(columnElements, (columnElement) => {
      const column = {};

      if (hasAttribute(columnElement, 'name')) {
        column.name = getAttribute(columnElement, 'name');
      }

      if (hasAttribute(columnElement, 'property')) {
        const propertyValue = getAttribute(columnElement, 'property');

        column.name = column.name || propertyValue;
        column.getValue = this.$parse(propertyValue);

        // A column can be sorted only if it has a "property" attribute.
        if (hasAttribute(columnElement, 'sortable')) {
          const sortableValue = getAttribute(columnElement, 'sortable');
          column.sortable = !!sortableValue;

          const sorting = DatagridColumnBuilder.defineDefaultSorting(column, sortableValue);
          Object.assign(currentSorting, sorting);
        }
github ovh-ux / ovh-ui-kit / packages / components / field / src / js / field.controller.js View on Github external
.map((control) => {
        // Get all ids available on controls
        if (hasAttributeValue(control, 'id')) {
          this.ids.push(getAttribute(control, 'id'));
        }

        return getAttribute(control, 'name');
      })
      .reduce((_controls_, name) => {
github ovh-ux / ovh-ui-kit / packages / components / datagrid / src / js / datagrid-column-builder.service.js View on Github external
angular.forEach(columnElements, (columnElement) => {
      const column = {};

      if (hasAttribute(columnElement, 'name')) {
        column.name = getAttribute(columnElement, 'name');
      }

      if (hasAttribute(columnElement, 'property')) {
        const propertyValue = getAttribute(columnElement, 'property');

        column.name = column.name || propertyValue;
        column.getValue = this.$parse(propertyValue);

        // A column can be sorted only if it has a "property" attribute.
        if (hasAttribute(columnElement, 'sortable')) {
          const sortableValue = getAttribute(columnElement, 'sortable');
          column.sortable = !!sortableValue;

          const sorting = DatagridColumnBuilder.defineDefaultSorting(column, sortableValue);
          Object.assign(currentSorting, sorting);
        }
      }

      if (!hasAttribute(columnElement, 'type')) {
        column.type = 'string';
      }

      copyValueProperties.forEach((propertyName) => {
        if (hasAttribute(columnElement, propertyName)) {
          column[propertyName] = getAttribute(columnElement, propertyName);
        }
      });
github ovh-ux / ovh-ui-kit / packages / components / datagrid / src / js / datagrid-column-builder.service.js View on Github external
angular.forEach(columnElements, (columnElement) => {
      const column = {};

      if (hasAttribute(columnElement, 'name')) {
        column.name = getAttribute(columnElement, 'name');
      }

      if (hasAttribute(columnElement, 'property')) {
        const propertyValue = getAttribute(columnElement, 'property');

        column.name = column.name || propertyValue;
        column.getValue = this.$parse(propertyValue);

        // A column can be sorted only if it has a "property" attribute.
        if (hasAttribute(columnElement, 'sortable')) {
          const sortableValue = getAttribute(columnElement, 'sortable');
          column.sortable = !!sortableValue;

          const sorting = DatagridColumnBuilder.defineDefaultSorting(column, sortableValue);
          Object.assign(currentSorting, sorting);
        }
      }

      if (!hasAttribute(columnElement, 'type')) {
        column.type = 'string';
github ovh-ux / ovh-ui-kit / packages / components / field / src / js / field.controller.js View on Github external
.map((control) => {
        // Get all ids available on controls
        if (hasAttributeValue(control, 'id')) {
          this.ids.push(getAttribute(control, 'id'));
        }

        return getAttribute(control, 'name');
      })
      .reduce((_controls_, name) => {
github ovh-ux / ovh-ui-kit / packages / components / field / src / js / field.controller.js View on Github external
attributes.forEach((attributeName) => {
        if (hasAttributeValue(controlElement, attributeName)) {
          validationParameters[validationName] = getAttribute(controlElement, attributeName);
        }
      });
    });
github ovh-ux / ovh-ui-kit / packages / components / datagrid / src / js / datagrid-column-builder.service.js View on Github external
&& hasAttribute(columnElement, 'searchable');

      if (column['type-options']) {
        column.typeOptions = this.$parse(column['type-options'])($scope);
      }

      if (hasAttribute(columnElement, 'prevent-customization')) {
        column.preventCustomization = true;
      }

      if (hasAttribute(columnElement, 'hidden')) {
        column.hidden = true;
      }

      if (hasAttribute(columnElement, 'title')) {
        const titleValue = getAttribute(columnElement, 'title');

        column.title = this.buildTitle(titleValue, $scope);
        column.rawTitle = titleValue;
      }

      if (hasAttribute(columnElement, 'footer')) {
        hasFooter = true;
        column.footer = getAttribute(columnElement, 'footer');
      }

      if (!column.sortProperty) {
        column.sortProperty = column.name;
      }

      const htmlTemplate = columnElement.innerHTML.trim();
      if (!column.template && htmlTemplate.length) {
github ovh-ux / ovh-ui-kit / packages / components / datagrid / src / js / datagrid-column-builder.service.js View on Github external
}

      if (hasAttribute(columnElement, 'hidden')) {
        column.hidden = true;
      }

      if (hasAttribute(columnElement, 'title')) {
        const titleValue = getAttribute(columnElement, 'title');

        column.title = this.buildTitle(titleValue, $scope);
        column.rawTitle = titleValue;
      }

      if (hasAttribute(columnElement, 'footer')) {
        hasFooter = true;
        column.footer = getAttribute(columnElement, 'footer');
      }

      if (!column.sortProperty) {
        column.sortProperty = column.name;
      }

      const htmlTemplate = columnElement.innerHTML.trim();
      if (!column.template && htmlTemplate.length) {
        column.template = htmlTemplate;
      }

      if (column.template) {
        column.compiledTemplate = this.getColumnTemplate(column);
      }

      columns.push(column);
github ovh-ux / ovh-ui-kit / packages / components / datagrid / src / js / datagrid-column-builder.service.js View on Github external
copyValueProperties.forEach((propertyName) => {
        if (hasAttribute(columnElement, propertyName)) {
          column[propertyName] = getAttribute(columnElement, propertyName);
        }
      });