How to use the @ovh-ux/ui-kit.core/src/js/component-utils.hasAttribute 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 / datagrid / src / js / datagrid-column-builder.service.js View on Github external
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);
        }
      });

      column.filterable = DatagridColumnBuilder.isFilterable(column)
                && hasAttribute(columnElement, 'filterable');
      column.searchable = DatagridColumnBuilder.isSearchable(column)
                && hasAttribute(columnElement, 'searchable');

      if (column['type-options']) {
        column.typeOptions = this.$parse(column['type-options'])($scope);
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')) {
github ovh-ux / ovh-ui-kit / packages / components / datagrid / src / js / datagrid-column-builder.service.js View on Github external
Object.assign(currentSorting, sorting);
        }
      }

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

      copyValueProperties.forEach((propertyName) => {
        if (hasAttribute(columnElement, propertyName)) {
          column[propertyName] = getAttribute(columnElement, propertyName);
        }
      });

      column.filterable = DatagridColumnBuilder.isFilterable(column)
                && hasAttribute(columnElement, 'filterable');
      column.searchable = DatagridColumnBuilder.isSearchable(column)
                && 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')) {
github ovh-ux / ovh-ui-kit / packages / components / datagrid / src / js / datagrid-column-builder.service.js View on Github external
}

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

      copyValueProperties.forEach((propertyName) => {
        if (hasAttribute(columnElement, propertyName)) {
          column[propertyName] = getAttribute(columnElement, propertyName);
        }
      });

      column.filterable = DatagridColumnBuilder.isFilterable(column)
                && hasAttribute(columnElement, 'filterable');
      column.searchable = DatagridColumnBuilder.isSearchable(column)
                && 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');
github ovh-ux / ovh-ui-kit / packages / components / datagrid / src / js / datagrid-column-builder.service.js View on Github external
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) {
        column.template = htmlTemplate;
      }

      if (column.template) {
        column.compiledTemplate = this.getColumnTemplate(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);
        }
      });

      column.filterable = DatagridColumnBuilder.isFilterable(column)
                && hasAttribute(columnElement, 'filterable');
      column.searchable = DatagridColumnBuilder.isSearchable(column)
                && 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;
github ovh-ux / ovh-ui-kit / packages / components / datagrid / src / js / datagrid-column-builder.service.js View on Github external
});

      column.filterable = DatagridColumnBuilder.isFilterable(column)
                && hasAttribute(columnElement, 'filterable');
      column.searchable = DatagridColumnBuilder.isSearchable(column)
                && 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) {
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);
        }
      });