How to use the metal.isBoolean function in metal

To help you get started, we’ve selected a few metal 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 LiferayCloud / marble / packages / marble-autocomplete / src / Autocomplete.js View on Github external
/**
 * State definition.
 * @type {!Object}
 * @static
 */
Autocomplete.STATE = {
  /**
   * Activate or Deactivate the suggestion of the best align region. If true,
   * the component will try to find a better region to align, otherwise,
   * it will keep the position at the bottom.
   * @type {boolean}
   * @default true.
   */
  autoBestAlign: {
    value: true,
    validator: core.isBoolean,
  },

  /**
   * Function that converts a given item to the format that should be used by
   * the autocomplete.
   * @type {!function()}
   */
  format: {
    value: function(item) {
      if (core.isString(item)) {
        item = {
          textPrimary: item,
        };
      }
      if (core.isObject(item) && !item.text) {
        item.text = item.textPrimary;
github LiferayCloud / marble / packages / marble-autocomplete / src / AutocompleteBase.js View on Github external
*   }
   */
  select: {
    value: function(selectedValue) {
      this.inputElement.value = selectedValue.text;
      this.inputElement.focus();
    },
    validator: core.isFunction,
  },

  /**
   * Indicates if the component is visible or not.
   * @type {boolean}
   */
  visible: {
    validator: core.isBoolean,
    value: false,
  },
};

export {AutocompleteBase};
export default AutocompleteBase;
github LiferayCloud / marble / packages / marble-input / src / Input.js View on Github external
* Defines the internal value that controls the related field logic visibility
   * @type {boolean}
   * @default false
   */
  isShowing_: {
    validator: core.isBoolean,
    value: false,
    internal: true,
  },
  /**
   * Defines if this field has a behavior to hide and show the value
   * @type {boolean}
   * @default false
   */
  isTogglePassword: {
    validator: core.isBoolean,
    value: false,
  },
  /**
   * Defines the maximum length for this field.
   * @type {number}
   */
  maxLength: {
    validator: core.isNumber,
  },
  /**
   * Defines the function name to 'oninput' event
   * @type {function}
   */
  onInput: {
    validator: core.isFunction,
  },
github metal / metal.js / packages / metal-component / src / Component.js View on Github external
setUpPortal_(portalElement) {
		if (
			!portalElement ||
			(!isElement(portalElement) &&
				!isString(portalElement) &&
				!isBoolean(portalElement))
		) {
			return;
		} else if (isBoolean(portalElement) && portalElement) {
			portalElement = 'body';
		}

		if (isServerSide()) {
			this.portalElement = true;
			return;
		}

		portalElement = this.getPortalElement_(portalElement);

		if (portalElement) {
			const placeholder = document.createElement('div');

			portalElement.appendChild(placeholder);

			this.element = placeholder;
github metal / metal.js / packages / metal-component / src / Component.js View on Github external
setUpPortal_(portalElement) {
		if (
			!portalElement ||
			(!isElement(portalElement) &&
				!isString(portalElement) &&
				!isBoolean(portalElement))
		) {
			return;
		} else if (isBoolean(portalElement) && portalElement) {
			portalElement = 'body';
		}

		if (isServerSide()) {
			this.portalElement = true;
			return;
		}

		portalElement = this.getPortalElement_(portalElement);

		if (portalElement) {
			const placeholder = document.createElement('div');
github LiferayCloud / marble / packages / marble-input / src / Input.js View on Github external
validator: core.isString,
    value: 'on',
  },
  /**
   * Defines which classes this input field should have
   * @type {string}
   */
  classes: {
    validator: core.isString,
  },
  /**
   * Defines "disabled" html attribute
   * @type {boolean}
   */
  disabled: {
    validator: core.isBoolean,
  },
  /**
   * Defines if while exposed state, the related field shall be editable
   * It only works combined with isTogglePassword
   * @type {boolean}
   */
  editableWhileVisible: {
    validator: core.isBoolean,
    value: false,
  },
  /**
   * Defines the index of the field
   * @type {number}
   */
  fieldIndex: {
    validator: core.isNumber,
github metal / metal.js / packages / metal-incremental-dom / src / render / attributes.js View on Github external
export function applyAttribute(component, element, name, value) {
	const eventName = getEventFromListenerAttr_(name);
	if (eventName) {
		attachEvent_(component, element, name, eventName, value);
		return;
	}

	value = fixCheckedAttr_(name, value);
	setValueAttrAsProperty_(element, name, value);

	if (isBoolean(value)) {
		setBooleanAttr_(element, name, value);
	} else {
		getOriginalFn('attributes')(element, name, value);
	}
}