All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.src.pattern-mixin.js Maven / Gradle / Ivy

There is a newer version: 24.5.4
Show newest version
/**
 * @license
 * Copyright (c) 2021 - 2024 Vaadin Ltd.
 * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
 */
import { InputConstraintsMixin } from './input-constraints-mixin.js';

/**
 * A mixin to provide `pattern` property.
 *
 * @polymerMixin
 * @mixes InputConstraintsMixin
 */
export const PatternMixin = (superclass) =>
  class PatternMixinClass extends InputConstraintsMixin(superclass) {
    static get properties() {
      return {
        /**
         * A regular expression that the value is checked against.
         * The pattern must match the entire value, not just some subset.
         */
        pattern: {
          type: String,
        },
      };
    }

    static get delegateAttrs() {
      return [...super.delegateAttrs, 'pattern'];
    }

    static get constraints() {
      return [...super.constraints, 'pattern'];
    }
  };




© 2015 - 2024 Weber Informatics LLC | Privacy Policy