How to use @ovh-ux/ui-kit - 10 common examples

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 / search / src / js / search.controller.js View on Github external
$onInit() {
    // Support presence of attribute 'disabled'
    addBooleanParameter(this, 'disabled');
    addBooleanParameter(this, 'resetOnSubmit');
  }
github ovh-ux / ovh-ui-kit / packages / components / dropdown / src / js / dropdown.controller.js View on Github external
$onInit() {
    this.isDropdownOpen = false;
    this.hasFocus = false;
    this.currentFocusedElement = null;

    addBooleanParameter(this, 'arrow');
    addBooleanParameter(this, 'persistent');
    addDefaultParameter(this, 'placement', 'bottom-start');

    // Use internal id to map trigger and content with aria-label and aria-labelledby.
    this.id = `ouiDropdown${this.$scope.$id}`;

    this.documentClickHandler = (evt) => {
      if ((evt && evt.type === 'click')
        && (!evt.target || !evt.target.getAttribute || evt.target.getAttribute('type') !== 'submit')
        && (
          this.triggerElement.contains(evt.target)
          || (this.persistent && this.popperElement.contains(evt.target))
        )
      ) {
        return;
      }
      this.$scope.$apply(() => this.closeDropdown());
github ovh-ux / ovh-ui-kit / packages / components / timepicker / src / js / timepicker.controller.js View on Github external
$onInit() {
    addDefaultParameter(this, 'id', `ouiTimepicker${this.$id}`);
    addDefaultParameter(this, 'name', `ouiTimepicker${this.$id}`);
    addDefaultParameter(this, 'format', this.options.dateFormat);
    addDefaultParameter(this, 'altFormat', this.format || this.options.dateFormat);

    addBooleanParameter(this, 'appendToBody');
    addBooleanParameter(this, 'disabled');
    addBooleanParameter(this, 'enableSeconds');
    addBooleanParameter(this, 'enableAmPm');
    addBooleanParameter(this, 'inline');
    addBooleanParameter(this, 'required');
    addBooleanParameter(this, 'static');

    this.setOptionsProperty('enableSeconds', this.enableSeconds);
    this.setOptionsProperty('time_24hr', !this.enableAmPm);

    // flatpickr's timepicker need a default value to work in inline mode
    if (this.inline) {
      this.setOptionsProperty('defaultDate', this.model || 'today');
    }
  }
github ovh-ux / ovh-ui-kit / packages / components / timepicker / src / js / timepicker.controller.js View on Github external
$onInit() {
    addDefaultParameter(this, 'id', `ouiTimepicker${this.$id}`);
    addDefaultParameter(this, 'name', `ouiTimepicker${this.$id}`);
    addDefaultParameter(this, 'format', this.options.dateFormat);
    addDefaultParameter(this, 'altFormat', this.format || this.options.dateFormat);

    addBooleanParameter(this, 'appendToBody');
    addBooleanParameter(this, 'disabled');
    addBooleanParameter(this, 'enableSeconds');
    addBooleanParameter(this, 'enableAmPm');
    addBooleanParameter(this, 'inline');
    addBooleanParameter(this, 'required');
    addBooleanParameter(this, 'static');

    this.setOptionsProperty('enableSeconds', this.enableSeconds);
    this.setOptionsProperty('time_24hr', !this.enableAmPm);

    // flatpickr's timepicker need a default value to work in inline mode
    if (this.inline) {
      this.setOptionsProperty('defaultDate', this.model || 'today');
    }
github ovh-ux / ovh-ui-kit / packages / components / criteria / src / js / adder / criteria-adder.controller.js View on Github external
$onInit() {
    addDefaultParameter(this, 'id', `ouiCriteriaAdder${this.$scope.$id}`);
    addDefaultParameter(this, 'name', `ouiCriteriaAdder${this.$scope.$id}`);
    addDefaultParameter(this, 'placement', 'center');

    this.$timeout(() => {
      const { 0: element } = this.$element;
      this.dropdownContent = element;
    });

    // Auto select first column
    if (this.properties) {
      const [properties] = this.properties;
      this.columnModel = properties;
    }

    this.selectableOperators = this.filterSelectableOperators();
    const [selectableOperators] = this.selectableOperators;
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
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);
        }