How to use the text-mask-core/dist/textMaskCore.createTextMaskInputElement function in text-mask-core

To help you get started, we’ve selected a few text-mask-core 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 mariohmol / ng-brazil / ng-brazil / src / angular2TextMask.ts View on Github external
_setupMask(create = false) {
    if (!this.inputElement) {
      if (this._elementRef.nativeElement.tagName.toUpperCase() === 'INPUT') {
        // `textMask` directive is used directly on an input element
        this.inputElement = this._elementRef.nativeElement
      } else {
        // `textMask` directive is used on an abstracted input element, `md-input-container`, etc
        this.inputElement = this._elementRef.nativeElement.getElementsByTagName('INPUT')[0]
      }
    }

    if (this.inputElement && create) {
      this.textMaskInputElement = createTextMaskInputElement(
        Object.assign({ inputElement: this.inputElement }, this.textMaskConfig)
      )
    }

  }
github GetTerminus / terminus-ui / terminus-ui / input / src / input.component.ts View on Github external
private setUpMask(): void {
    // istanbul ignore else
    if (this.inputElement) {
      // tslint:disable-next-line no-any
      const maskOptions: {[key: string]: any} = {
        inputElement: this.inputElement.nativeElement,
        ...this.textMaskConfig,
      };

      // Initialize the mask
      this.textMaskInputElement = createTextMaskInputElement(maskOptions);
    }
  }
github GetTerminus / terminus-ui / terminus-ui / src / mask / mask.directive.ts View on Github external
private setupMask(create?: boolean): void {
    // istanbul ignore else
    if (!this.inputElement) {
      this.inputElement = this.elementRef.nativeElement;
    }

    // istanbul ignore else
    if (this.inputElement && create) {
      const maskOptions = Object.assign({inputElement: this.inputElement}, this.textMaskConfig);
      // Initialize the mask
      this.textMaskInputElement = createTextMaskInputElement(maskOptions);
    }
  }
github mehmet-erim / ngx-performance-ui / projects / core / src / lib / utils / common-utils.ts View on Github external
export function transformByRegex(value: string | number, mask: Mask.Config): string {
  if (typeof value === 'number') value = String(value);

  const inputElement = document.createElement('input');
  inputElement.type = 'text';

  const textMaskInputElement = createTextMaskInputElement({ ...mask, inputElement });
  textMaskInputElement.update(value);

  return inputElement.value;
}

text-mask-core

Core of https://github.com/text-mask/text-mask

Unlicense
Latest version published 6 years ago

Package Health Score

62 / 100
Full package analysis