How to use the @ovh-ux/ui-kit.core/src/js/component-utils.addDefaultParameter 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 / 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 / password / src / js / password.controller.js View on Github external
$onInit() {
    addBooleanParameter(this, 'disabled');
    addBooleanParameter(this, 'required');

    addDefaultParameter(this, 'id', `ouiPassword${this.$scope.$id}`);
    addDefaultParameter(this, 'name', `ouiPassword${this.$scope.$id}`);

    this.errors = {};
    this.isVisible = false;
  }
github ovh-ux / ovh-ui-kit / packages / components / dual-list / src / js / target / dual-list-target.controller.js View on Github external
$onInit() {
    addDefaultParameter(this, 'heading', this.translations.heading);
    addDefaultParameter(this, 'placeholder', this.translations.placeholder);
    addBooleanParameter(this, 'loading');
    addBooleanParameter(this, 'searchable');

    this.id = `ouiDualListTarget${this.$scope.id}`;
    this.expanded = false;
  }
github ovh-ux / ovh-ui-kit / packages / components / select-picker / src / js / select-picker.controller.js View on Github external
$onInit() {
    addBooleanParameter(this, 'disabled');
    addBooleanParameter(this, 'required');
    addDefaultParameter(this, 'variant', 'default');
    addDefaultParameter(this, 'id', `ouiSelectPicker${this.$scope.$id}`);

    if (this.picture) {
      this.isImgPath = /^data:/.test(this.picture) || /\.(gif|png|jpg|svg)$/.test(this.picture);
    }

    if (this.values) {
      if (this.model && find(this.values, this.model)) {
        this.selectedValue = this.model;
      } else {
        [this.selectedValue] = this.values;
      }
    }


    this.$scope.$watch(() => this.model, (newValue) => {
github ovh-ux / ovh-ui-kit / packages / components / progress / src / js / progress.controller.js View on Github external
$onInit() {
    addBooleanParameter(this, 'compact');
    addDefaultParameter(this, 'minValue', '0');
    addDefaultParameter(this, 'maxValue', '100');
  }
github ovh-ux / ovh-ui-kit / packages / components / checkbox / src / js / checkbox.controller.js View on Github external
$onInit() {
    addBooleanParameter(this, 'disabled');
    addBooleanParameter(this, 'required');
    addBooleanParameter(this, 'thumbnail');
    addDefaultParameter(this, 'id', `ouiCheckbox${this.$scope.$id}`);
    addDefaultParameter(this, 'variant', 'default');
  }
github ovh-ux / ovh-ui-kit / packages / components / progress / src / js / progress.controller.js View on Github external
$onInit() {
    addBooleanParameter(this, 'compact');
    addDefaultParameter(this, 'minValue', '0');
    addDefaultParameter(this, 'maxValue', '100');
  }
github ovh-ux / ovh-ui-kit / packages / components / checkbox / src / js / checkbox.controller.js View on Github external
$onInit() {
    addBooleanParameter(this, 'disabled');
    addBooleanParameter(this, 'required');
    addBooleanParameter(this, 'thumbnail');
    addDefaultParameter(this, 'id', `ouiCheckbox${this.$scope.$id}`);
    addDefaultParameter(this, 'variant', 'default');
  }
github ovh-ux / ovh-ui-kit / packages / components / calendar / src / js / calendar.controller.js View on Github external
$onInit() {
    addBooleanParameter(this, 'appendToBody');
    addBooleanParameter(this, 'disabled');
    addBooleanParameter(this, 'enableTime');
    addBooleanParameter(this, 'inline');
    addBooleanParameter(this, 'noCalendar');
    addBooleanParameter(this, 'required');
    addBooleanParameter(this, 'static');
    addBooleanParameter(this, 'weekNumbers');

    addDefaultParameter(this, 'id', `ouiCalendar${this.$id}`);
    addDefaultParameter(this, 'name', `ouiCalendar${this.$id}`);

    this.initCalendarInstance();
  }