How to use the @ovh-ux/ui-kit.core/src/js/component-utils.addBooleanParameter 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 / 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 / navbar / src / js / toggler / navbar-toggler.controller.js View on Github external
$onInit() {
    this.hasLinks = !!this.$attrs.links;

    addBooleanParameter(this, 'active');
    addBooleanParameter(this, 'loaded');
  }
github ovh-ux / ovh-ui-kit / packages / components / header / src / js / tabs / item / header-tabs-item.controller.js View on Github external
$onInit() {
    addBooleanParameter(this, 'active');
    addBooleanParameter(this, 'disabled');
    addBooleanParameter(this, 'external');

    if (this.external) {
      this.linkTarget = '_blank';
      this.linkRel = 'noopener';
    }
  }
github ovh-ux / ovh-ui-kit / packages / components / select / src / js / select.controller.js View on Github external
$onInit() {
    addBooleanParameter(this, 'disabled');
    addBooleanParameter(this, 'required');
    addBooleanParameter(this, 'multiple');
    addBooleanParameter(this, 'searchable');
  }
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 / 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();
  }
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');
  }