matcha-components 20.42.0 → 20.44.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { EventEmitter, Output, HostBinding, Input, Component, ContentChildren, ElementRef, Renderer2, Inject, PLATFORM_ID, Injectable, ViewChild, ContentChild, HostListener, Directive, forwardRef, ChangeDetectionStrategy, InjectionToken, inject, DOCUMENT, input, output, signal, TemplateRef, Optional, ViewEncapsulation, NgModule, createComponent, Pipe } from '@angular/core';
2
+ import { EventEmitter, Output, HostBinding, Input, Component, ContentChildren, ElementRef, Renderer2, Inject, PLATFORM_ID, Injectable, ViewChild, ContentChild, HostListener, Directive, forwardRef, ChangeDetectionStrategy, InjectionToken, inject, DOCUMENT, TemplateRef, Optional, ViewEncapsulation, NgModule, createComponent, input, output, signal, Pipe } from '@angular/core';
3
3
  import { animation, style, animate, trigger, transition, useAnimation, state, query, stagger, animateChild, sequence, group } from '@angular/animations';
4
4
  import { Subscription, Subject, BehaviorSubject, of, fromEvent } from 'rxjs';
5
5
  import { debounceTime, startWith, map, distinctUntilChanged, takeUntil, filter } from 'rxjs/operators';
@@ -6364,42 +6364,42 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImpor
6364
6364
  type: Injectable
6365
6365
  }] });
6366
6366
 
6367
- class MatchaMaskDirective {
6367
+ class MatchaMaskCompatibleDirective {
6368
6368
  constructor() {
6369
- this.mask = input('', ...(ngDevMode ? [{ debugName: "mask" }] : []));
6370
- this.specialCharacters = input([], ...(ngDevMode ? [{ debugName: "specialCharacters" }] : []));
6371
- this.patterns = input({}, ...(ngDevMode ? [{ debugName: "patterns" }] : []));
6372
- this.prefix = input('', ...(ngDevMode ? [{ debugName: "prefix" }] : []));
6373
- this.suffix = input('', ...(ngDevMode ? [{ debugName: "suffix" }] : []));
6374
- this.thousandSeparator = input(' ', ...(ngDevMode ? [{ debugName: "thousandSeparator" }] : []));
6375
- this.decimalMarker = input('.', ...(ngDevMode ? [{ debugName: "decimalMarker" }] : []));
6376
- this.dropSpecialCharacters = input(null, ...(ngDevMode ? [{ debugName: "dropSpecialCharacters" }] : []));
6377
- this.hiddenInput = input(null, ...(ngDevMode ? [{ debugName: "hiddenInput" }] : []));
6378
- this.showMaskTyped = input(null, ...(ngDevMode ? [{ debugName: "showMaskTyped" }] : []));
6379
- this.placeHolderCharacter = input(null, ...(ngDevMode ? [{ debugName: "placeHolderCharacter" }] : []));
6380
- this.shownMaskExpression = input(null, ...(ngDevMode ? [{ debugName: "shownMaskExpression" }] : []));
6381
- this.clearIfNotMatch = input(null, ...(ngDevMode ? [{ debugName: "clearIfNotMatch" }] : []));
6382
- this.validation = input(null, ...(ngDevMode ? [{ debugName: "validation" }] : []));
6383
- this.separatorLimit = input('', ...(ngDevMode ? [{ debugName: "separatorLimit" }] : []));
6384
- this.allowNegativeNumbers = input(null, ...(ngDevMode ? [{ debugName: "allowNegativeNumbers" }] : []));
6385
- this.leadZeroDateTime = input(null, ...(ngDevMode ? [{ debugName: "leadZeroDateTime" }] : []));
6386
- this.leadZero = input(null, ...(ngDevMode ? [{ debugName: "leadZero" }] : []));
6387
- this.triggerOnMaskChange = input(null, ...(ngDevMode ? [{ debugName: "triggerOnMaskChange" }] : []));
6388
- this.apm = input(null, ...(ngDevMode ? [{ debugName: "apm" }] : []));
6389
- this.inputTransformFn = input(null, ...(ngDevMode ? [{ debugName: "inputTransformFn" }] : []));
6390
- this.outputTransformFn = input(null, ...(ngDevMode ? [{ debugName: "outputTransformFn" }] : []));
6391
- this.keepCharacterPositions = input(null, ...(ngDevMode ? [{ debugName: "keepCharacterPositions" }] : []));
6392
- this.instantPrefix = input(null, ...(ngDevMode ? [{ debugName: "instantPrefix" }] : []));
6393
- this.maskFilled = output();
6394
- this._maskValue = signal('', ...(ngDevMode ? [{ debugName: "_maskValue" }] : []));
6395
- this._inputValue = signal('', ...(ngDevMode ? [{ debugName: "_inputValue" }] : []));
6396
- this._position = signal(null, ...(ngDevMode ? [{ debugName: "_position" }] : []));
6397
- this._code = signal('', ...(ngDevMode ? [{ debugName: "_code" }] : []));
6398
- this._maskExpressionArray = signal([], ...(ngDevMode ? [{ debugName: "_maskExpressionArray" }] : []));
6399
- this._justPasted = signal(false, ...(ngDevMode ? [{ debugName: "_justPasted" }] : []));
6400
- this._isFocused = signal(false, ...(ngDevMode ? [{ debugName: "_isFocused" }] : []));
6369
+ this.mask = '';
6370
+ this.specialCharacters = [];
6371
+ this.patterns = {};
6372
+ this.prefix = '';
6373
+ this.suffix = '';
6374
+ this.thousandSeparator = ' ';
6375
+ this.decimalMarker = '.';
6376
+ this.dropSpecialCharacters = null;
6377
+ this.hiddenInput = null;
6378
+ this.showMaskTyped = null;
6379
+ this.placeHolderCharacter = null;
6380
+ this.shownMaskExpression = null;
6381
+ this.clearIfNotMatch = null;
6382
+ this.validation = null;
6383
+ this.separatorLimit = '';
6384
+ this.allowNegativeNumbers = null;
6385
+ this.leadZeroDateTime = null;
6386
+ this.leadZero = null;
6387
+ this.triggerOnMaskChange = null;
6388
+ this.apm = null;
6389
+ this.inputTransformFn = null;
6390
+ this.outputTransformFn = null;
6391
+ this.keepCharacterPositions = null;
6392
+ this.instantPrefix = null;
6393
+ this.maskFilled = new EventEmitter();
6394
+ this._maskValue = '';
6395
+ this._inputValue = '';
6396
+ this._position = null;
6397
+ this._code = '';
6398
+ this._maskExpressionArray = [];
6399
+ this._justPasted = false;
6400
+ this._isFocused = false;
6401
6401
  /**For IME composition event */
6402
- this._isComposing = signal(false, ...(ngDevMode ? [{ debugName: "_isComposing" }] : []));
6402
+ this._isComposing = false;
6403
6403
  this._maskService = inject(MatchaMaskService, { self: true });
6404
6404
  this.document = inject(DOCUMENT);
6405
6405
  this._config = inject(MATCHA_MASK_CONFIG);
@@ -6411,96 +6411,35 @@ class MatchaMaskDirective {
6411
6411
  ngOnChanges(changes) {
6412
6412
  const { mask, specialCharacters, patterns, prefix, suffix, thousandSeparator, decimalMarker, dropSpecialCharacters, hiddenInput, showMaskTyped, placeHolderCharacter, shownMaskExpression, clearIfNotMatch, validation, separatorLimit, allowNegativeNumbers, leadZeroDateTime, leadZero, triggerOnMaskChange, apm, inputTransformFn, outputTransformFn, keepCharacterPositions, instantPrefix, } = changes;
6413
6413
  if (mask) {
6414
- if (mask.currentValue !== mask.previousValue && !mask.firstChange) {
6415
- this._maskService.maskChanged = true;
6416
- }
6417
- if (mask.currentValue && mask.currentValue.split("||" /* MaskExpression.OR */).length > 1) {
6418
- this._maskExpressionArray.set(mask.currentValue.split("||" /* MaskExpression.OR */).sort((a, b) => {
6419
- return a.length - b.length;
6420
- }));
6421
- this._setMask();
6422
- }
6423
- else {
6424
- this._maskExpressionArray.set([]);
6425
- this._maskValue.set(mask.currentValue || "" /* MaskExpression.EMPTY_STRING */);
6426
- this._maskService.maskExpression = this._maskValue();
6427
- }
6414
+ this._maskValue = mask.currentValue ?? '';
6415
+ this._maskExpressionArray = this._maskValue.split('');
6428
6416
  }
6429
6417
  if (specialCharacters) {
6430
- if (!specialCharacters.currentValue || !Array.isArray(specialCharacters.currentValue)) {
6431
- return;
6432
- }
6433
- else {
6434
- this._maskService.specialCharacters = specialCharacters.currentValue || [];
6435
- }
6436
- }
6437
- if (allowNegativeNumbers) {
6438
- this._maskService.allowNegativeNumbers = allowNegativeNumbers.currentValue;
6439
- if (this._maskService.allowNegativeNumbers) {
6440
- this._maskService.specialCharacters = this._maskService.specialCharacters.filter((c) => c !== "-" /* MaskExpression.MINUS */);
6441
- }
6442
- }
6443
- // Only overwrite the mask available patterns if a pattern has actually been passed in
6444
- if (patterns && patterns.currentValue) {
6445
- this._maskService.patterns = patterns.currentValue;
6446
- }
6447
- if (apm && apm.currentValue) {
6448
- this._maskService.apm = apm.currentValue;
6418
+ this._maskService.specialCharacters = specialCharacters.currentValue ?? [];
6449
6419
  }
6450
- if (instantPrefix) {
6451
- this._maskService.instantPrefix = instantPrefix.currentValue;
6420
+ if (patterns) {
6421
+ this._maskService.patterns = patterns.currentValue ?? {};
6452
6422
  }
6453
6423
  if (prefix) {
6454
- this._maskService.prefix = prefix.currentValue;
6424
+ this._maskService.prefix = prefix.currentValue ?? '';
6455
6425
  }
6456
6426
  if (suffix) {
6457
- this._maskService.suffix = suffix.currentValue;
6427
+ this._maskService.suffix = suffix.currentValue ?? '';
6458
6428
  }
6459
6429
  if (thousandSeparator) {
6460
- this._maskService.thousandSeparator = thousandSeparator.currentValue;
6461
- if (thousandSeparator.previousValue && thousandSeparator.currentValue) {
6462
- const previousDecimalMarker = this._maskService.decimalMarker;
6463
- if (thousandSeparator.currentValue === this._maskService.decimalMarker) {
6464
- this._maskService.decimalMarker =
6465
- thousandSeparator.currentValue === "," /* MaskExpression.COMMA */
6466
- ? "." /* MaskExpression.DOT */
6467
- : "," /* MaskExpression.COMMA */;
6468
- }
6469
- if (this._maskService.dropSpecialCharacters === true) {
6470
- this._maskService.specialCharacters = this._config.specialCharacters;
6471
- }
6472
- if (typeof previousDecimalMarker === 'string' &&
6473
- typeof this._maskService.decimalMarker === 'string') {
6474
- this._inputValue.set(this._inputValue()
6475
- .split(thousandSeparator.previousValue)
6476
- .join('')
6477
- .replace(previousDecimalMarker, this._maskService.decimalMarker));
6478
- this._maskService.actualValue = this._inputValue();
6479
- }
6480
- this._maskService.writingValue = true;
6481
- }
6430
+ this._maskService.thousandSeparator = thousandSeparator.currentValue ?? ' ';
6482
6431
  }
6483
6432
  if (decimalMarker) {
6484
- this._maskService.decimalMarker = decimalMarker.currentValue;
6433
+ this._maskService.decimalMarker = decimalMarker.currentValue ?? '.';
6485
6434
  }
6486
6435
  if (dropSpecialCharacters) {
6487
6436
  this._maskService.dropSpecialCharacters = dropSpecialCharacters.currentValue;
6488
6437
  }
6489
6438
  if (hiddenInput) {
6490
6439
  this._maskService.hiddenInput = hiddenInput.currentValue;
6491
- if (hiddenInput.previousValue === true && hiddenInput.currentValue === false) {
6492
- this._inputValue.set(this._maskService.actualValue);
6493
- }
6494
6440
  }
6495
6441
  if (showMaskTyped) {
6496
6442
  this._maskService.showMaskTyped = showMaskTyped.currentValue;
6497
- if (showMaskTyped.previousValue === false &&
6498
- showMaskTyped.currentValue === true &&
6499
- this._isFocused()) {
6500
- requestAnimationFrame(() => {
6501
- this._maskService._elementRef?.nativeElement.click();
6502
- });
6503
- }
6504
6443
  }
6505
6444
  if (placeHolderCharacter) {
6506
6445
  this._maskService.placeHolderCharacter = placeHolderCharacter.currentValue;
@@ -6515,7 +6454,10 @@ class MatchaMaskDirective {
6515
6454
  this._maskService.validation = validation.currentValue;
6516
6455
  }
6517
6456
  if (separatorLimit) {
6518
- this._maskService.separatorLimit = separatorLimit.currentValue;
6457
+ this._maskService.separatorLimit = separatorLimit.currentValue ?? '';
6458
+ }
6459
+ if (allowNegativeNumbers) {
6460
+ this._maskService.allowNegativeNumbers = allowNegativeNumbers.currentValue;
6519
6461
  }
6520
6462
  if (leadZeroDateTime) {
6521
6463
  this._maskService.leadZeroDateTime = leadZeroDateTime.currentValue;
@@ -6526,6 +6468,9 @@ class MatchaMaskDirective {
6526
6468
  if (triggerOnMaskChange) {
6527
6469
  this._maskService.triggerOnMaskChange = triggerOnMaskChange.currentValue;
6528
6470
  }
6471
+ if (apm) {
6472
+ this._maskService.apm = apm.currentValue;
6473
+ }
6529
6474
  if (inputTransformFn) {
6530
6475
  this._maskService.inputTransformFn = inputTransformFn.currentValue;
6531
6476
  }
@@ -6535,1045 +6480,487 @@ class MatchaMaskDirective {
6535
6480
  if (keepCharacterPositions) {
6536
6481
  this._maskService.keepCharacterPositions = keepCharacterPositions.currentValue;
6537
6482
  }
6538
- this._applyMask();
6539
- }
6540
- validate({ value }) {
6541
- const processedValue = typeof value === 'number' ? String(value) : value;
6542
- const maskValue = this._maskValue();
6543
- if (!this._maskService.validation || !maskValue) {
6544
- return null;
6545
- }
6546
- if (this._maskService.ipError) {
6547
- return this._createValidationError(processedValue);
6548
- }
6549
- if (this._maskService.cpfCnpjError) {
6550
- return this._createValidationError(processedValue);
6551
- }
6552
- if (maskValue.startsWith("separator" /* MaskExpression.SEPARATOR */)) {
6553
- return null;
6554
- }
6555
- if (withoutValidation.includes(maskValue)) {
6556
- return null;
6557
- }
6558
- if (this._maskService.clearIfNotMatch) {
6559
- return null;
6483
+ if (instantPrefix) {
6484
+ this._maskService.instantPrefix = instantPrefix.currentValue;
6560
6485
  }
6561
- if (timeMasks.includes(maskValue)) {
6562
- return this._validateTime(processedValue);
6486
+ }
6487
+ onPaste() {
6488
+ this._justPasted = true;
6489
+ }
6490
+ onFocus(event) {
6491
+ this._isFocused = true;
6492
+ // Implementar lógica de foco se necessário
6493
+ }
6494
+ onModelChange(value) {
6495
+ if (this._maskService.writingValue) {
6496
+ return;
6563
6497
  }
6564
- if (maskValue === "A*@A*.A*" /* MaskExpression.EMAIL_MASK */) {
6565
- const emailPattern = /^[^@]+@[^@]+\.[^@]+$/;
6566
- if (!emailPattern.test(processedValue) && processedValue) {
6567
- return this._createValidationError(processedValue);
6498
+ this._inputValue = value;
6499
+ // Aplicar máscara se definida
6500
+ if (this.mask && this.mask.trim() !== '') {
6501
+ const maskedValue = this._maskService.applyMask(value, this.mask);
6502
+ if (maskedValue !== value) {
6503
+ this._maskService.writingValue = true;
6504
+ this._maskService.onChange(maskedValue);
6505
+ this._maskService.writingValue = false;
6568
6506
  }
6569
6507
  else {
6570
- return null;
6508
+ this._maskService.onChange(value);
6571
6509
  }
6572
6510
  }
6573
- if (processedValue && processedValue.length >= 1) {
6574
- let counterOfOpt = 0;
6575
- if (maskValue.includes("{" /* MaskExpression.CURLY_BRACKETS_LEFT */) &&
6576
- maskValue.includes("}" /* MaskExpression.CURLY_BRACKETS_RIGHT */)) {
6577
- const lengthInsideCurlyBrackets = maskValue.slice(maskValue.indexOf("{" /* MaskExpression.CURLY_BRACKETS_LEFT */) + 1, maskValue.indexOf("}" /* MaskExpression.CURLY_BRACKETS_RIGHT */));
6578
- return lengthInsideCurlyBrackets === String(processedValue.length)
6579
- ? null
6580
- : this._createValidationError(processedValue);
6581
- }
6582
- if (maskValue.startsWith("percent" /* MaskExpression.PERCENT */)) {
6583
- return null;
6584
- }
6585
- for (const key in this._maskService.patterns) {
6586
- if (this._maskService.patterns[key]?.optional) {
6587
- if (maskValue.indexOf(key) !== maskValue.lastIndexOf(key)) {
6588
- const opt = maskValue
6589
- .split("" /* MaskExpression.EMPTY_STRING */)
6590
- .filter((i) => i === key)
6591
- .join("" /* MaskExpression.EMPTY_STRING */);
6592
- counterOfOpt += opt.length;
6593
- }
6594
- else if (maskValue.indexOf(key) !== -1) {
6595
- counterOfOpt++;
6596
- }
6597
- if (maskValue.indexOf(key) !== -1 &&
6598
- processedValue.length >= maskValue.indexOf(key)) {
6599
- return null;
6600
- }
6601
- if (counterOfOpt === maskValue.length) {
6602
- return null;
6603
- }
6604
- }
6605
- }
6606
- if ((maskValue.indexOf("*" /* MaskExpression.SYMBOL_STAR */) > 1 &&
6607
- processedValue.length < maskValue.indexOf("*" /* MaskExpression.SYMBOL_STAR */)) ||
6608
- (maskValue.indexOf("?" /* MaskExpression.SYMBOL_QUESTION */) > 1 &&
6609
- processedValue.length < maskValue.indexOf("?" /* MaskExpression.SYMBOL_QUESTION */))) {
6610
- return this._createValidationError(processedValue);
6611
- }
6612
- if (maskValue.indexOf("*" /* MaskExpression.SYMBOL_STAR */) === -1 ||
6613
- maskValue.indexOf("?" /* MaskExpression.SYMBOL_QUESTION */) === -1) {
6614
- const array = maskValue.split('*');
6615
- const length = this._maskService.dropSpecialCharacters
6616
- ? maskValue.length -
6617
- this._maskService.checkDropSpecialCharAmount(maskValue) -
6618
- counterOfOpt
6619
- : this.prefix()
6620
- ? maskValue.length + this.prefix().length - counterOfOpt
6621
- : maskValue.length - counterOfOpt;
6622
- if (array.length === 1) {
6623
- if (processedValue.length < length) {
6624
- return this._createValidationError(processedValue);
6625
- }
6626
- }
6627
- if (array.length > 1) {
6628
- const lastIndexArray = array[array.length - 1];
6629
- if (lastIndexArray &&
6630
- this._maskService.specialCharacters.includes(lastIndexArray[0]) &&
6631
- String(processedValue).includes(lastIndexArray[0] ?? '') &&
6632
- !this.dropSpecialCharacters()) {
6633
- const special = value.split(lastIndexArray[0]);
6634
- return special[special.length - 1].length === lastIndexArray.length - 1
6635
- ? null
6636
- : this._createValidationError(processedValue);
6637
- }
6638
- else if (((lastIndexArray &&
6639
- !this._maskService.specialCharacters.includes(lastIndexArray[0])) ||
6640
- !lastIndexArray ||
6641
- this._maskService.dropSpecialCharacters) &&
6642
- processedValue.length >= length - 1) {
6643
- return null;
6644
- }
6645
- else {
6646
- return this._createValidationError(processedValue);
6647
- }
6648
- }
6649
- }
6650
- if (maskValue.indexOf("*" /* MaskExpression.SYMBOL_STAR */) === 1 ||
6651
- maskValue.indexOf("?" /* MaskExpression.SYMBOL_QUESTION */) === 1) {
6652
- return null;
6511
+ else {
6512
+ this._maskService.onChange(value);
6513
+ }
6514
+ }
6515
+ onInput(event) {
6516
+ if (this._isComposing) {
6517
+ return;
6518
+ }
6519
+ const target = event.target;
6520
+ const value = target.value;
6521
+ // Aplicar máscara se definida
6522
+ if (this.mask && this.mask.trim() !== '') {
6523
+ const maskedValue = this._maskService.applyMask(value, this.mask);
6524
+ if (maskedValue !== value) {
6525
+ target.value = maskedValue;
6526
+ this._maskService.onChange(maskedValue);
6653
6527
  }
6654
6528
  }
6655
- if (value) {
6656
- this.maskFilled.emit();
6657
- return null;
6529
+ else {
6530
+ this._maskService.onChange(value);
6658
6531
  }
6659
- return null;
6660
6532
  }
6661
- onPaste() {
6662
- this._justPasted.set(true);
6533
+ onCompositionStart(event) {
6534
+ this._isComposing = true;
6663
6535
  }
6664
- onFocus() {
6665
- this._isFocused.set(true);
6536
+ onCompositionEnd(event) {
6537
+ this._isComposing = false;
6538
+ const target = event.target;
6539
+ const value = target.value;
6540
+ this._maskService.onChange(value);
6666
6541
  }
6667
- onModelChange(value) {
6668
- // on form reset we need to update the actualValue
6669
- if ((value === "" /* MaskExpression.EMPTY_STRING */ ||
6670
- value === null ||
6671
- typeof value === 'undefined') &&
6672
- this._maskService.actualValue) {
6673
- this._maskService.actualValue = this._maskService.getActualValue("" /* MaskExpression.EMPTY_STRING */);
6674
- }
6542
+ onBlur(event) {
6543
+ this._isFocused = false;
6544
+ this.onTouch();
6675
6545
  }
6676
- onInput(e) {
6677
- // If IME is composing text, we wait for the composed text.
6678
- if (this._isComposing()) {
6679
- return;
6680
- }
6681
- const el = e.target;
6682
- const transformedValue = this._maskService.inputTransformFn
6683
- ? this._maskService.inputTransformFn(el.value)
6684
- : el.value;
6685
- if (el.type !== 'number') {
6686
- if (typeof transformedValue === 'string' || typeof transformedValue === 'number') {
6687
- el.value = transformedValue.toString();
6688
- this._inputValue.set(el.value);
6689
- this._setMask();
6690
- if (!this._maskValue()) {
6691
- this.onChange(el.value);
6692
- return;
6693
- }
6694
- let position = el.selectionStart === 1
6695
- ? el.selectionStart + this._maskService.prefix.length
6696
- : el.selectionStart;
6697
- if (this.showMaskTyped() &&
6698
- this.keepCharacterPositions() &&
6699
- this._maskService.placeHolderCharacter.length === 1) {
6700
- const suffix = this.suffix();
6701
- const prefix = this.prefix();
6702
- const inputSymbol = el.value.slice(position - 1, position);
6703
- const prefixLength = prefix.length;
6704
- const checkSymbols = this._maskService._checkSymbolMask(inputSymbol, this._maskService.maskExpression[position - 1 - prefixLength] ??
6705
- "" /* MaskExpression.EMPTY_STRING */);
6706
- const checkSpecialCharacter = this._maskService._checkSymbolMask(inputSymbol, this._maskService.maskExpression[position + 1 - prefixLength] ??
6707
- "" /* MaskExpression.EMPTY_STRING */);
6708
- const selectRangeBackspace = this._maskService.selStart === this._maskService.selEnd;
6709
- const selStart = Number(this._maskService.selStart) - prefixLength;
6710
- const selEnd = Number(this._maskService.selEnd) - prefixLength;
6711
- const backspaceOrDelete = this._code() === "Backspace" /* MaskExpression.BACKSPACE */ ||
6712
- this._code() === "Delete" /* MaskExpression.DELETE */;
6713
- if (backspaceOrDelete) {
6714
- if (!selectRangeBackspace) {
6715
- if (this._maskService.selStart === prefixLength) {
6716
- this._maskService.actualValue = `${prefix}${this._maskService.maskIsShown.slice(0, selEnd)}${this._inputValue().split(prefix).join('')}`;
6717
- }
6718
- else if (this._maskService.selStart ===
6719
- this._maskService.maskIsShown.length + prefixLength) {
6720
- this._maskService.actualValue = `${this._inputValue()}${this._maskService.maskIsShown.slice(selStart, selEnd)}`;
6721
- }
6722
- else {
6723
- this._maskService.actualValue = `${prefix}${this._inputValue()
6724
- .split(prefix)
6725
- .join('')
6726
- .slice(0, selStart)}${this._maskService.maskIsShown.slice(selStart, selEnd)}${this._maskService.actualValue.slice(selEnd + prefixLength, this._maskService.maskIsShown.length + prefixLength)}${suffix}`;
6727
- }
6728
- }
6729
- else if (!this._maskService.specialCharacters.includes(this._maskService.maskExpression.slice(position - prefixLength, position + 1 - prefixLength)) &&
6730
- selectRangeBackspace) {
6731
- if (selStart === 1 && prefix) {
6732
- this._maskService.actualValue = `${prefix}${this._maskService.placeHolderCharacter}${el.value
6733
- .split(prefix)
6734
- .join('')
6735
- .split(suffix)
6736
- .join('')}${suffix}`;
6737
- position = position - 1;
6738
- }
6739
- else {
6740
- const part1 = el.value.substring(0, position);
6741
- const part2 = el.value.substring(position);
6742
- this._maskService.actualValue = `${part1}${this._maskService.placeHolderCharacter}${part2}`;
6743
- }
6744
- }
6745
- position = this._code() === "Delete" /* MaskExpression.DELETE */ ? position + 1 : position;
6746
- }
6747
- if (!backspaceOrDelete) {
6748
- if (!checkSymbols && !checkSpecialCharacter && selectRangeBackspace) {
6749
- position = Number(el.selectionStart) - 1;
6750
- }
6751
- else if (this._maskService.specialCharacters.includes(el.value.slice(position, position + 1)) &&
6752
- checkSpecialCharacter &&
6753
- !this._maskService.specialCharacters.includes(el.value.slice(position + 1, position + 2))) {
6754
- this._maskService.actualValue = `${el.value.slice(0, position - 1)}${el.value.slice(position, position + 1)}${inputSymbol}${el.value.slice(position + 2)}`;
6755
- position = position + 1;
6756
- }
6757
- else if (checkSymbols) {
6758
- if (el.value.length === 1 && position === 1) {
6759
- this._maskService.actualValue = `${prefix}${inputSymbol}${this._maskService.maskIsShown.slice(1, this._maskService.maskIsShown.length)}${suffix}`;
6760
- }
6761
- else {
6762
- this._maskService.actualValue = `${el.value.slice(0, position - 1)}${inputSymbol}${el.value
6763
- .slice(position + 1)
6764
- .split(suffix)
6765
- .join('')}${suffix}`;
6766
- }
6767
- }
6768
- else if (prefix &&
6769
- el.value.length === 1 &&
6770
- position - prefixLength === 1 &&
6771
- this._maskService._checkSymbolMask(el.value, this._maskService.maskExpression[position - 1 - prefixLength] ??
6772
- "" /* MaskExpression.EMPTY_STRING */)) {
6773
- this._maskService.actualValue = `${prefix}${el.value}${this._maskService.maskIsShown.slice(1, this._maskService.maskIsShown.length)}${suffix}`;
6774
- }
6775
- }
6776
- }
6777
- let caretShift = 0;
6778
- let backspaceShift = false;
6779
- if (this._code() === "Delete" /* MaskExpression.DELETE */ && "separator" /* MaskExpression.SEPARATOR */) {
6780
- this._maskService.deletedSpecialCharacter = true;
6781
- }
6782
- if (this._inputValue().length >= this._maskService.maskExpression.length - 1 &&
6783
- this._code() !== "Backspace" /* MaskExpression.BACKSPACE */ &&
6784
- this._maskService.maskExpression === "d0/M0/0000" /* MaskExpression.DAYS_MONTHS_YEARS */ &&
6785
- position < 10) {
6786
- const inputSymbol = this._inputValue().slice(position - 1, position);
6787
- el.value =
6788
- this._inputValue().slice(0, position - 1) +
6789
- inputSymbol +
6790
- this._inputValue().slice(position + 1);
6791
- }
6792
- if (this._maskService.maskExpression === "d0/M0/0000" /* MaskExpression.DAYS_MONTHS_YEARS */ &&
6793
- this.leadZeroDateTime()) {
6794
- if ((position < 3 && Number(el.value) > 31 && Number(el.value) < 40) ||
6795
- (position === 5 && Number(el.value.slice(3, 5)) > 12)) {
6796
- position = position + 2;
6797
- }
6798
- }
6799
- if (this._maskService.maskExpression === "Hh:m0:s0" /* MaskExpression.HOURS_MINUTES_SECONDS */ &&
6800
- this.apm()) {
6801
- if (this._justPasted() && el.value.slice(0, 2) === "00" /* MaskExpression.DOUBLE_ZERO */) {
6802
- el.value = el.value.slice(1, 2) + el.value.slice(2, el.value.length);
6803
- }
6804
- el.value =
6805
- el.value === "00" /* MaskExpression.DOUBLE_ZERO */
6806
- ? "0" /* MaskExpression.NUMBER_ZERO */
6807
- : el.value;
6808
- }
6809
- this._maskService.applyValueChanges(position, this._justPasted(), this._code() === "Backspace" /* MaskExpression.BACKSPACE */ ||
6810
- this._code() === "Delete" /* MaskExpression.DELETE */, (shift, _backspaceShift) => {
6811
- this._justPasted.set(false);
6812
- caretShift = shift;
6813
- backspaceShift = _backspaceShift;
6814
- });
6815
- // only set the selection if the element is active
6816
- if (this._getActiveElement() !== el) {
6817
- return;
6818
- }
6819
- if (this._maskService.plusOnePosition) {
6820
- position = position + 1;
6821
- this._maskService.plusOnePosition = false;
6822
- }
6823
- // update position after applyValueChanges to prevent cursor on wrong position when it has an array of maskExpression
6824
- if (this._maskExpressionArray().length) {
6825
- if (this._code() === "Backspace" /* MaskExpression.BACKSPACE */) {
6826
- const specialChartMinusOne = this.specialCharacters().includes(this._maskService.actualValue.slice(position - 1, position));
6827
- const allowFewMaskChangeMask = this._maskService.removeMask(this._inputValue())?.length ===
6828
- this._maskService.removeMask(this._maskService.maskExpression)?.length;
6829
- const specialChartPlusOne = this.specialCharacters().includes(this._maskService.actualValue.slice(position, position + 1));
6830
- if (allowFewMaskChangeMask && !specialChartPlusOne) {
6831
- position = el.selectionStart + 1;
6832
- }
6833
- else {
6834
- position = specialChartMinusOne ? position - 1 : position;
6835
- }
6836
- }
6837
- else {
6838
- position =
6839
- el.selectionStart === 1
6840
- ? el.selectionStart + this._maskService.prefix.length
6841
- : el.selectionStart;
6842
- }
6843
- }
6844
- this._position.set(this._position() === 1 && this._inputValue().length === 1
6845
- ? null
6846
- : this._position());
6847
- let positionToApply = this._position()
6848
- ? this._inputValue().length + position + caretShift
6849
- : position +
6850
- (this._code() === "Backspace" /* MaskExpression.BACKSPACE */ && !backspaceShift
6851
- ? 0
6852
- : caretShift);
6853
- if (positionToApply > this._getActualInputLength()) {
6854
- positionToApply =
6855
- el.value === this._maskService.decimalMarker && el.value.length === 1
6856
- ? this._getActualInputLength() + 1
6857
- : this._getActualInputLength();
6858
- }
6859
- if (positionToApply < 0) {
6860
- positionToApply = 0;
6861
- }
6862
- el.setSelectionRange(positionToApply, positionToApply);
6863
- this._position.set(null);
6864
- }
6865
- else {
6866
- // eslint-disable-next-line no-console
6867
- console.warn('Matcha-mask writeValue work with string | number, your current value:', typeof transformedValue);
6868
- }
6546
+ onClick(event) {
6547
+ // Implementar lógica de clique se necessário
6548
+ }
6549
+ onKeyDown(event) {
6550
+ // Implementar lógica de teclado se necessário
6551
+ }
6552
+ writeValue(value) {
6553
+ this._maskService.writingValue = true;
6554
+ this._inputValue = value;
6555
+ // Aplicar máscara se definida
6556
+ if (this.mask && this.mask.trim() !== '') {
6557
+ const maskedValue = this._maskService.applyMask(value, this.mask);
6558
+ this._maskService.onChange(maskedValue);
6869
6559
  }
6870
6560
  else {
6871
- if (!this._maskValue()) {
6872
- this.onChange(el.value);
6873
- return;
6874
- }
6875
- this._maskService.applyValueChanges(el.value.length, this._justPasted(), this._code() === "Backspace" /* MaskExpression.BACKSPACE */ || this._code() === "Delete" /* MaskExpression.DELETE */);
6561
+ this._maskService.onChange(value);
6876
6562
  }
6563
+ this._maskService.writingValue = false;
6877
6564
  }
6878
- // IME starts
6879
- onCompositionStart() {
6880
- this._isComposing.set(true);
6565
+ registerOnChange(fn) {
6566
+ this.onChange = fn;
6567
+ this._maskService.onChange = fn;
6881
6568
  }
6882
- // IME completes
6883
- onCompositionEnd(e) {
6884
- this._isComposing.set(false);
6885
- this._justPasted.set(true);
6886
- this.onInput(e);
6569
+ registerOnTouched(fn) {
6570
+ this.onTouch = fn;
6887
6571
  }
6888
- onBlur(e) {
6889
- if (this._maskValue()) {
6890
- const el = e.target;
6891
- if (this._maskService.leadZero &&
6892
- el.value.length > 0 &&
6893
- typeof this._maskService.decimalMarker === 'string') {
6894
- const maskExpression = this._maskService.maskExpression;
6895
- const decimalMarker = this._maskService.decimalMarker;
6896
- const suffix = this._maskService.suffix;
6897
- const precision = Number(this._maskService.maskExpression.slice(maskExpression.length - 1, maskExpression.length));
6898
- if (precision > 0) {
6899
- el.value = suffix ? el.value.split(suffix).join('') : el.value;
6900
- const decimalPart = el.value.split(decimalMarker)[1];
6901
- el.value = el.value.includes(decimalMarker)
6902
- ? el.value +
6903
- "0" /* MaskExpression.NUMBER_ZERO */.repeat(precision - decimalPart.length) +
6904
- suffix
6905
- : el.value +
6906
- decimalMarker +
6907
- "0" /* MaskExpression.NUMBER_ZERO */.repeat(precision) +
6908
- suffix;
6909
- this._maskService.actualValue = el.value;
6910
- }
6911
- }
6912
- this._maskService.clearIfNotMatchFn();
6913
- }
6914
- this._isFocused.set(false);
6915
- this.onTouch();
6572
+ setDisabledState(isDisabled) {
6573
+ // Implementar lógica de desabilitar se necessário
6916
6574
  }
6917
- onClick(e) {
6918
- if (!this._maskValue()) {
6919
- return;
6920
- }
6921
- const el = e.target;
6922
- const posStart = 0;
6923
- const posEnd = 0;
6924
- if (el !== null &&
6925
- el.selectionStart !== null &&
6926
- el.selectionStart === el.selectionEnd &&
6927
- el.selectionStart > this._maskService.prefix.length &&
6928
- e.keyCode !== 38) {
6929
- if (this._maskService.showMaskTyped && !this.keepCharacterPositions()) {
6930
- // We are showing the mask in the input
6931
- this._maskService.maskIsShown = this._maskService.showMaskInInput();
6932
- if (el.setSelectionRange &&
6933
- this._maskService.prefix + this._maskService.maskIsShown === el.value) {
6934
- // the input ONLY contains the mask, so position the cursor at the start
6935
- el.focus();
6936
- el.setSelectionRange(posStart, posEnd);
6937
- }
6938
- else {
6939
- // the input contains some characters already
6940
- if (el.selectionStart > this._maskService.actualValue.length) {
6941
- // if the user clicked beyond our value's length, position the cursor at the end of our value
6942
- el.setSelectionRange(this._maskService.actualValue.length, this._maskService.actualValue.length);
6943
- }
6944
- }
6575
+ validate(control) {
6576
+ // Implementar validação se necessário
6577
+ return null;
6578
+ }
6579
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaMaskCompatibleDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
6580
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.0", type: MatchaMaskCompatibleDirective, isStandalone: false, selector: "input[mask], textarea[mask]", inputs: { mask: "mask", specialCharacters: "specialCharacters", patterns: "patterns", prefix: "prefix", suffix: "suffix", thousandSeparator: "thousandSeparator", decimalMarker: "decimalMarker", dropSpecialCharacters: "dropSpecialCharacters", hiddenInput: "hiddenInput", showMaskTyped: "showMaskTyped", placeHolderCharacter: "placeHolderCharacter", shownMaskExpression: "shownMaskExpression", clearIfNotMatch: "clearIfNotMatch", validation: "validation", separatorLimit: "separatorLimit", allowNegativeNumbers: "allowNegativeNumbers", leadZeroDateTime: "leadZeroDateTime", leadZero: "leadZero", triggerOnMaskChange: "triggerOnMaskChange", apm: "apm", inputTransformFn: "inputTransformFn", outputTransformFn: "outputTransformFn", keepCharacterPositions: "keepCharacterPositions", instantPrefix: "instantPrefix" }, outputs: { maskFilled: "maskFilled" }, host: { listeners: { "paste": "onPaste($event)", "focus": "onFocus($event)", "ngModelChange": "onModelChange($event)", "input": "onInput($event)", "compositionstart": "onCompositionStart($event)", "compositionend": "onCompositionEnd($event)", "blur": "onBlur($event)", "click": "onClick($event)", "keydown": "onKeyDown($event)" } }, providers: [
6581
+ {
6582
+ provide: NG_VALUE_ACCESSOR,
6583
+ useExisting: forwardRef(() => MatchaMaskCompatibleDirective),
6584
+ multi: true,
6585
+ },
6586
+ {
6587
+ provide: NG_VALIDATORS,
6588
+ useExisting: forwardRef(() => MatchaMaskCompatibleDirective),
6589
+ multi: true,
6590
+ },
6591
+ MatchaMaskService,
6592
+ ], exportAs: ["mask", "matchaMask"], usesOnChanges: true, ngImport: i0 }); }
6593
+ }
6594
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaMaskCompatibleDirective, decorators: [{
6595
+ type: Directive,
6596
+ args: [{
6597
+ selector: 'input[mask], textarea[mask]',
6598
+ standalone: false,
6599
+ providers: [
6600
+ {
6601
+ provide: NG_VALUE_ACCESSOR,
6602
+ useExisting: forwardRef(() => MatchaMaskCompatibleDirective),
6603
+ multi: true,
6604
+ },
6605
+ {
6606
+ provide: NG_VALIDATORS,
6607
+ useExisting: forwardRef(() => MatchaMaskCompatibleDirective),
6608
+ multi: true,
6609
+ },
6610
+ MatchaMaskService,
6611
+ ],
6612
+ exportAs: 'mask,matchaMask',
6613
+ }]
6614
+ }], propDecorators: { mask: [{
6615
+ type: Input
6616
+ }], specialCharacters: [{
6617
+ type: Input
6618
+ }], patterns: [{
6619
+ type: Input
6620
+ }], prefix: [{
6621
+ type: Input
6622
+ }], suffix: [{
6623
+ type: Input
6624
+ }], thousandSeparator: [{
6625
+ type: Input
6626
+ }], decimalMarker: [{
6627
+ type: Input
6628
+ }], dropSpecialCharacters: [{
6629
+ type: Input
6630
+ }], hiddenInput: [{
6631
+ type: Input
6632
+ }], showMaskTyped: [{
6633
+ type: Input
6634
+ }], placeHolderCharacter: [{
6635
+ type: Input
6636
+ }], shownMaskExpression: [{
6637
+ type: Input
6638
+ }], clearIfNotMatch: [{
6639
+ type: Input
6640
+ }], validation: [{
6641
+ type: Input
6642
+ }], separatorLimit: [{
6643
+ type: Input
6644
+ }], allowNegativeNumbers: [{
6645
+ type: Input
6646
+ }], leadZeroDateTime: [{
6647
+ type: Input
6648
+ }], leadZero: [{
6649
+ type: Input
6650
+ }], triggerOnMaskChange: [{
6651
+ type: Input
6652
+ }], apm: [{
6653
+ type: Input
6654
+ }], inputTransformFn: [{
6655
+ type: Input
6656
+ }], outputTransformFn: [{
6657
+ type: Input
6658
+ }], keepCharacterPositions: [{
6659
+ type: Input
6660
+ }], instantPrefix: [{
6661
+ type: Input
6662
+ }], maskFilled: [{
6663
+ type: Output
6664
+ }], onPaste: [{
6665
+ type: HostListener,
6666
+ args: ['paste', ['$event']]
6667
+ }], onFocus: [{
6668
+ type: HostListener,
6669
+ args: ['focus', ['$event']]
6670
+ }], onModelChange: [{
6671
+ type: HostListener,
6672
+ args: ['ngModelChange', ['$event']]
6673
+ }], onInput: [{
6674
+ type: HostListener,
6675
+ args: ['input', ['$event']]
6676
+ }], onCompositionStart: [{
6677
+ type: HostListener,
6678
+ args: ['compositionstart', ['$event']]
6679
+ }], onCompositionEnd: [{
6680
+ type: HostListener,
6681
+ args: ['compositionend', ['$event']]
6682
+ }], onBlur: [{
6683
+ type: HostListener,
6684
+ args: ['blur', ['$event']]
6685
+ }], onClick: [{
6686
+ type: HostListener,
6687
+ args: ['click', ['$event']]
6688
+ }], onKeyDown: [{
6689
+ type: HostListener,
6690
+ args: ['keydown', ['$event']]
6691
+ }] } });
6692
+
6693
+ /**
6694
+ * Componente MatchaInputPhone
6695
+ *
6696
+ * Componente Angular para entrada de telefone internacional com seleção de país, máscara dinâmica e exibição de bandeira.
6697
+ *
6698
+ * Funcionalidades:
6699
+ * - Seleção de país com dropdown e bandeira.
6700
+ * - Máscara dinâmica de acordo com o país e DDD digitado.
6701
+ * - Suporte a diferentes formatos de telefone (fixo/celular) para o Brasil.
6702
+ * - Emissão de evento ao alterar o valor do telefone.
6703
+ * - Inicialização automática pelo valor informado ou pelo idioma do navegador.
6704
+ *
6705
+ * Inputs:
6706
+ * - fallbackMask: string - Máscara padrão caso não seja encontrada uma específica.
6707
+ * - label: string - Rótulo do campo (padrão: 'Telefone').
6708
+ * - value: string - Valor inicial do telefone (com ou sem DDI).
6709
+ *
6710
+ * Outputs:
6711
+ * - onChange: EventEmitter<string> - Emite o valor do telefone completo (com DDI) ao alterar.
6712
+ *
6713
+ * ViewChild:
6714
+ * - inputSelector: ElementRef - Referência ao container do input (usado para fechar o dropdown).
6715
+ * - phoneRef: ElementRef - Referência ao input do telefone.
6716
+ *
6717
+ * Métodos principais:
6718
+ * - ngOnInit: Inicializa o componente pelo valor ou idioma.
6719
+ * - ngOnChanges: Atualiza o valor ao receber novo input externo.
6720
+ * - initCountryPhone: Inicializa país e máscara pelo valor do telefone.
6721
+ * - selectMaskForDialCode: Seleciona a máscara conforme país e DDD.
6722
+ * - selectCountry: Troca o país selecionado e atualiza máscara.
6723
+ * - onInput: Atualiza máscara e emite evento ao digitar.
6724
+ * - toggleDropdown: Abre/fecha o dropdown de países.
6725
+ */
6726
+ class MatchaInputPhoneComponent {
6727
+ constructor(renderer, cdr) {
6728
+ this.renderer = renderer;
6729
+ this.cdr = cdr;
6730
+ this.fallbackMask = '00 0000 0000';
6731
+ this.onChange = new EventEmitter();
6732
+ this.typeMask = '';
6733
+ this.labelHover = 'su';
6734
+ this.allCountries = getCountryISO2();
6735
+ this.isOpen = false;
6736
+ this.inputValueModel = '';
6737
+ this.clickListener = null;
6738
+ this.isInitialized = false;
6739
+ }
6740
+ ngOnInit() {
6741
+ this.value ? this.initCountryPhone(this.value) : this.initCountrylanguageNavigator();
6742
+ this.cdr.detectChanges();
6743
+ this.isInitialized = true;
6744
+ }
6745
+ ngOnChanges(changes) {
6746
+ if (changes['value'] && !changes['value'].firstChange) {
6747
+ this.value = changes['value'].currentValue;
6748
+ if (!this.value) {
6749
+ this.inputValueModel = this.value ?? '';
6750
+ return;
6945
6751
  }
6752
+ this.initCountryPhone(this.value);
6753
+ this.cdr.detectChanges();
6946
6754
  }
6947
- const nextValue = el &&
6948
- (el.value === this._maskService.prefix
6949
- ? this._maskService.prefix + this._maskService.maskIsShown
6950
- : el.value);
6951
- /** Fix of cursor position jumping to end in most browsers no matter where cursor is inserted onFocus */
6952
- if (el && el.value !== nextValue) {
6953
- el.value = nextValue;
6954
- }
6955
- /** fix of cursor position with prefix when mouse click occur */
6956
- if (el &&
6957
- el.type !== 'number' &&
6958
- (el.selectionStart || el.selectionEnd) <=
6959
- this._maskService.prefix.length) {
6960
- const specialCharactersAtTheStart = this._maskService.maskExpression.match(new RegExp(`^[${this._maskService.specialCharacters.map((c) => `\\${c}`).join('')}]+`))?.[0].length || 0;
6961
- el.selectionStart = this._maskService.prefix.length + specialCharactersAtTheStart;
6755
+ }
6756
+ initCountryPhone(phone) {
6757
+ if (!phone.startsWith('+')) {
6758
+ this.setCountryAndInputValue('br', phone);
6962
6759
  return;
6963
6760
  }
6964
- /** select only inserted text */
6965
- if (el && el.selectionEnd > this._getActualInputLength()) {
6966
- el.selectionEnd = this._getActualInputLength();
6761
+ const phoneWithoutPlus = phone.replace('+', '');
6762
+ const countryDialCode = this.selectedCountry?.dialCode;
6763
+ if (phoneWithoutPlus.startsWith(countryDialCode)) {
6764
+ this.setCountryAndInputValue(this.selectedCountry.iso2, phoneWithoutPlus.replace(countryDialCode, ''));
6765
+ this.inputValueModel = phoneWithoutPlus.replace(countryDialCode, '');
6766
+ }
6767
+ else {
6768
+ this.matchCountryAndSetInputValue(phoneWithoutPlus);
6967
6769
  }
6968
6770
  }
6969
- onKeyDown(e) {
6970
- if (!this._maskValue()) {
6971
- return;
6771
+ setCountryAndInputValue(iso2, phone) {
6772
+ this.selectedCountry = this.allCountries.find((country) => country.iso2 === iso2);
6773
+ this.inputValueModel = phone.startsWith('0') ? phone.slice(1) : phone;
6774
+ this.selectMaskForDialCode(this.selectedCountry.areaCodes ? this.selectedCountry.areaCodes[0] : '000', this.inputValueModel);
6775
+ }
6776
+ matchCountryAndSetInputValue(phoneWithoutPlus) {
6777
+ const matchingCountry = this.getMatchingCountry(phoneWithoutPlus);
6778
+ if (matchingCountry.length === 1) {
6779
+ this.setCountryAndInputValue(matchingCountry[0].iso2, phoneWithoutPlus.replace(matchingCountry[0].dialCode, ''));
6972
6780
  }
6973
- if (this._isComposing()) {
6974
- // User finalize their choice from IME composition, so trigger onInput() for the composed text.
6975
- if (e.key === 'Enter') {
6976
- this.onCompositionEnd(e);
6781
+ else {
6782
+ this.matchAreaCodeAndSetInputValue(phoneWithoutPlus, matchingCountry);
6783
+ }
6784
+ }
6785
+ getMatchingCountry(phoneWithoutPlus) {
6786
+ return this.allCountries.filter((country) => {
6787
+ const dialCode = country.dialCode;
6788
+ return phoneWithoutPlus.startsWith(dialCode);
6789
+ });
6790
+ }
6791
+ matchAreaCodeAndSetInputValue(phoneWithoutPlus, matchingCountry) {
6792
+ const phoneWithoutDialCode = phoneWithoutPlus.replace(matchingCountry[0].dialCode, '');
6793
+ const filterAreaCode = phoneWithoutDialCode.substring(0, 3);
6794
+ const matchingAreaCode = matchingCountry.filter((country) => {
6795
+ if (country.areaCodes) {
6796
+ return country.areaCodes.includes(filterAreaCode);
6977
6797
  }
6978
- return;
6798
+ });
6799
+ if (matchingAreaCode.length === 1) {
6800
+ this.setCountryAndInputValue(matchingAreaCode[0].iso2, phoneWithoutDialCode);
6979
6801
  }
6980
- this._code.set(e.code ? e.code : e.key);
6981
- const el = e.target;
6982
- this._inputValue.set(el.value);
6983
- this._setMask();
6984
- if (el.type !== 'number') {
6985
- if (e.key === "ArrowUp" /* MaskExpression.ARROW_UP */) {
6986
- e.preventDefault();
6802
+ else {
6803
+ const defaultCountry = matchingCountry.find((country) => country.priority === 0);
6804
+ this.setCountryAndInputValue(defaultCountry.iso2, phoneWithoutDialCode);
6805
+ }
6806
+ }
6807
+ selectMaskForDialCode(inputDigits, targetValuePhone) {
6808
+ const previousMask = this.typeMask;
6809
+ const maskArray = this.selectedCountry?.mask;
6810
+ const maskIndex = this.selectedCountry?.areaCodes
6811
+ ? this.selectedCountry.areaCodes.findIndex((code) => inputDigits === code)
6812
+ : -1;
6813
+ if (this.selectedCountry?.iso2 === 'br' && (targetValuePhone && targetValuePhone.length > 2)) {
6814
+ const eventInput = targetValuePhone.substring(2);
6815
+ if (eventInput && eventInput[0] === '9') {
6816
+ this.typeMask = "00 0 0000 0000";
6817
+ this.cdr.detectChanges();
6818
+ return;
6987
6819
  }
6988
- if (e.key === "ArrowLeft" /* MaskExpression.ARROW_LEFT */ ||
6989
- e.key === "Backspace" /* MaskExpression.BACKSPACE */ ||
6990
- e.key === "Delete" /* MaskExpression.DELETE */) {
6991
- if (e.key === "Backspace" /* MaskExpression.BACKSPACE */ && el.value.length === 0) {
6992
- el.selectionStart = el.selectionEnd;
6993
- }
6994
- if (e.key === "Backspace" /* MaskExpression.BACKSPACE */ && el.selectionStart !== 0) {
6995
- const prefixLength = this.prefix().length;
6996
- // If specialChars is false, (shouldn't ever happen) then set to the defaults
6997
- const specialCharacters = this.specialCharacters().length
6998
- ? this.specialCharacters()
6999
- : this._config.specialCharacters;
7000
- if (prefixLength > 1 && el.selectionStart <= prefixLength) {
7001
- el.setSelectionRange(prefixLength, el.selectionEnd);
7002
- }
7003
- else {
7004
- if (this._inputValue().length !== el.selectionStart &&
7005
- el.selectionStart !== 1) {
7006
- while (specialCharacters.includes((this._inputValue()[el.selectionStart - 1] ??
7007
- "" /* MaskExpression.EMPTY_STRING */).toString()) &&
7008
- ((prefixLength >= 1 &&
7009
- el.selectionStart > prefixLength) ||
7010
- prefixLength === 0)) {
7011
- el.setSelectionRange(el.selectionStart - 1, el.selectionEnd);
7012
- }
7013
- }
7014
- }
7015
- }
7016
- this.checkSelectionOnDeletion(el);
7017
- if (this._maskService.prefix.length &&
7018
- el.selectionStart <= this._maskService.prefix.length &&
7019
- el.selectionEnd <= this._maskService.prefix.length) {
7020
- e.preventDefault();
7021
- }
7022
- const cursorStart = el.selectionStart;
7023
- if (e.key === "Backspace" /* MaskExpression.BACKSPACE */ &&
7024
- !el.readOnly &&
7025
- cursorStart === 0 &&
7026
- el.selectionEnd === el.value.length &&
7027
- el.value.length !== 0) {
7028
- this._position.set(this._maskService.prefix ? this._maskService.prefix.length : 0);
7029
- this._maskService.applyMask(this._maskService.prefix, this._maskService.maskExpression, this._position());
7030
- }
7031
- }
7032
- if (!!this.suffix() &&
7033
- this.suffix().length > 1 &&
7034
- this._inputValue().length - this.suffix().length < el.selectionStart) {
7035
- el.setSelectionRange(this._inputValue().length - this.suffix().length, this._inputValue().length);
7036
- }
7037
- else if ((e.code === 'KeyA' && e.ctrlKey) ||
7038
- (e.code === 'KeyA' && e.metaKey) // Cmd + A (Mac)
7039
- ) {
7040
- el.setSelectionRange(0, this._getActualInputLength());
7041
- e.preventDefault();
7042
- }
7043
- this._maskService.selStart = el.selectionStart;
7044
- this._maskService.selEnd = el.selectionEnd;
7045
- }
7046
- }
7047
- /** It writes the value in the input */
7048
- async writeValue(controlValue) {
7049
- let value = controlValue;
7050
- const inputTransformFn = this._maskService.inputTransformFn;
7051
- if (typeof value === 'object' && value !== null && 'value' in value) {
7052
- if ('disable' in value) {
7053
- this.setDisabledState(Boolean(value.disable));
7054
- }
7055
- value = value.value;
7056
- }
7057
- if (value !== null) {
7058
- value = inputTransformFn ? inputTransformFn(value) : value;
7059
6820
  }
7060
- if (typeof value === 'string' ||
7061
- typeof value === 'number' ||
7062
- value === null ||
7063
- typeof value === 'undefined') {
7064
- if (value === null || typeof value === 'undefined' || value === '') {
7065
- this._maskService.currentValue = '';
7066
- this._maskService.previousValue = '';
7067
- }
7068
- let inputValue = value;
7069
- if (typeof inputValue === 'number' ||
7070
- this._maskValue().startsWith("separator" /* MaskExpression.SEPARATOR */)) {
7071
- inputValue = String(inputValue);
7072
- const localeDecimalMarker = this._maskService.currentLocaleDecimalMarker();
7073
- if (!Array.isArray(this._maskService.decimalMarker)) {
7074
- inputValue =
7075
- this._maskService.decimalMarker !== localeDecimalMarker
7076
- ? inputValue.replace(localeDecimalMarker, this._maskService.decimalMarker)
7077
- : inputValue;
7078
- }
7079
- if (this._maskService.leadZero &&
7080
- inputValue &&
7081
- this.mask() &&
7082
- this.dropSpecialCharacters() !== false) {
7083
- inputValue = this._maskService._checkPrecision(this._maskService.maskExpression, inputValue);
7084
- }
7085
- if (this._maskService.decimalMarker === "," /* MaskExpression.COMMA */ ||
7086
- (Array.isArray(this._maskService.decimalMarker) &&
7087
- this._maskService.thousandSeparator === "." /* MaskExpression.DOT */)) {
7088
- inputValue = inputValue
7089
- .toString()
7090
- .replace("." /* MaskExpression.DOT */, "," /* MaskExpression.COMMA */);
7091
- }
7092
- if (this.mask()?.startsWith("separator" /* MaskExpression.SEPARATOR */) && this.leadZero()) {
7093
- requestAnimationFrame(() => {
7094
- this._maskService.applyMask(inputValue?.toString() ?? '', this._maskService.maskExpression);
7095
- });
7096
- }
7097
- this._maskService.isNumberValue = true;
7098
- }
7099
- if (typeof inputValue !== 'string' || value === null || typeof value === 'undefined') {
7100
- inputValue = '';
6821
+ if (Array.isArray(maskArray)) {
6822
+ if (maskIndex !== -1 && maskArray[maskIndex]) {
6823
+ this.typeMask = maskArray[maskIndex];
7101
6824
  }
7102
- this._inputValue.set(inputValue);
7103
- this._setMask();
7104
- if ((inputValue && this._maskService.maskExpression) ||
7105
- (this._maskService.maskExpression &&
7106
- (this._maskService.prefix || this._maskService.showMaskTyped))) {
7107
- // Let the service we know we are writing value so that triggering onChange function won't happen during applyMask
7108
- this._maskService.writingValue = true;
7109
- this._maskService.formElementProperty = [
7110
- 'value',
7111
- this._maskService.applyMask(inputValue, this._maskService.maskExpression),
7112
- ];
7113
- // Let the service know we've finished writing value
7114
- this._maskService.writingValue = false;
6825
+ else if (maskArray[0]) {
6826
+ this.typeMask = maskArray[0];
7115
6827
  }
7116
6828
  else {
7117
- this._maskService.formElementProperty = ['value', inputValue];
6829
+ this.typeMask = this.fallbackMask;
7118
6830
  }
7119
- this._inputValue.set(inputValue);
7120
6831
  }
7121
6832
  else {
7122
- // eslint-disable-next-line no-console
7123
- console.warn('Matcha-mask writeValue work with string | number, your current value:', typeof value);
6833
+ this.typeMask = this.fallbackMask;
7124
6834
  }
6835
+ if (previousMask !== this.typeMask)
6836
+ this.inputValueModel = '';
6837
+ this.cdr.detectChanges();
7125
6838
  }
7126
- registerOnChange(fn) {
7127
- this._maskService.onChange = this.onChange = fn;
7128
- }
7129
- registerOnTouched(fn) {
7130
- this.onTouch = fn;
7131
- }
7132
- _getActiveElement(document = this.document) {
7133
- const shadowRootEl = document?.activeElement?.shadowRoot;
7134
- if (!shadowRootEl?.activeElement) {
7135
- return document.activeElement;
7136
- }
7137
- else {
7138
- return this._getActiveElement(shadowRootEl);
6839
+ initCountrylanguageNavigator() {
6840
+ let lang = navigator.language;
6841
+ if (lang.includes('-')) {
6842
+ const langParts = lang.split('-');
6843
+ lang = langParts[1];
7139
6844
  }
6845
+ this.selectedCountry = this.allCountries.find((country) => country.iso2 === lang.toLocaleLowerCase());
6846
+ this.selectMaskForDialCode(this.selectedCountry.areaCodes ? this.selectedCountry.areaCodes[0] : '000');
7140
6847
  }
7141
- checkSelectionOnDeletion(el) {
7142
- const prefixLength = this.prefix().length;
7143
- const suffixLength = this.suffix().length;
7144
- const inputValueLength = this._inputValue().length;
7145
- el.selectionStart = Math.min(Math.max(prefixLength, el.selectionStart), inputValueLength - suffixLength);
7146
- el.selectionEnd = Math.min(Math.max(prefixLength, el.selectionEnd), inputValueLength - suffixLength);
7147
- }
7148
- /** It disables the input element */
7149
- setDisabledState(isDisabled) {
7150
- this._maskService.formElementProperty = ['disabled', isDisabled];
6848
+ selectCountry(country) {
6849
+ this.selectedCountry = country;
6850
+ this.selectMaskForDialCode(this.selectedCountry.areaCodes ? this.selectedCountry.areaCodes[0] : '000');
6851
+ this.isOpen = false;
6852
+ this.onChange.emit('+' + this.selectedCountry.dialCode + this.inputValueModel);
6853
+ this.removeClickListener();
6854
+ this.cdr.detectChanges();
7151
6855
  }
7152
- _applyMask() {
7153
- this._maskService.maskExpression = this._maskService._repeatPatternSymbols(this._maskValue() || '');
7154
- this._maskService.formElementProperty = [
7155
- 'value',
7156
- this._maskService.applyMask(this._inputValue(), this._maskService.maskExpression),
7157
- ];
6856
+ toggleDropdown() {
6857
+ this.isOpen = !this.isOpen;
6858
+ this.clickListener = this.renderer.listen('window', 'click', (event) => {
6859
+ if (this.isOpen && !this.inputSelector.nativeElement.contains(event.target)) {
6860
+ this.isOpen = false;
6861
+ this.removeClickListener();
6862
+ }
6863
+ });
6864
+ this.cdr.detectChanges();
7158
6865
  }
7159
- _validateTime(value) {
7160
- const rowMaskLen = this._maskValue()
7161
- .split("" /* MaskExpression.EMPTY_STRING */)
7162
- .filter((s) => s !== ':').length;
7163
- if (!value) {
7164
- return null; // Don't validate empty values to allow for optional form control
7165
- }
7166
- if ((+(value[value.length - 1] ?? -1) === 0 && value.length < rowMaskLen) ||
7167
- value.length <= rowMaskLen - 2) {
7168
- return this._createValidationError(value);
6866
+ removeClickListener() {
6867
+ if (this.clickListener) {
6868
+ this.clickListener();
6869
+ this.clickListener = null;
7169
6870
  }
7170
- return null;
7171
6871
  }
7172
- _getActualInputLength() {
7173
- return (this._maskService.actualValue.length ||
7174
- this._maskService.actualValue.length + this._maskService.prefix.length);
6872
+ onInput(event) {
6873
+ this.phoneRef.nativeElement.value = event.target.value.replace(/[^\d\s]/g, '');
6874
+ let targetValuePhone = event.target.value.replace(/\D/g, '');
6875
+ this.onChange.emit('+' + this.selectedCountry.dialCode + this.inputValueModel);
6876
+ const inputDigits = targetValuePhone.substring(0, 3);
6877
+ if (inputDigits) {
6878
+ this.selectMaskForDialCode(inputDigits, targetValuePhone);
6879
+ }
6880
+ this.cdr.detectChanges();
7175
6881
  }
7176
- _createValidationError(actualValue) {
7177
- return {
7178
- mask: {
7179
- requiredMask: this._maskValue(),
7180
- actualValue,
7181
- },
7182
- };
6882
+ ngOnDestroy() {
6883
+ this.removeClickListener();
7183
6884
  }
7184
- _setMask() {
7185
- this._maskExpressionArray().some((mask) => {
7186
- const specialChart = mask
7187
- .split("" /* MaskExpression.EMPTY_STRING */)
7188
- .some((char) => this._maskService.specialCharacters.includes(char));
7189
- if ((specialChart &&
7190
- this._inputValue() &&
7191
- this._areAllCharactersInEachStringSame(this._maskExpressionArray())) ||
7192
- mask.includes("{" /* MaskExpression.CURLY_BRACKETS_LEFT */)) {
7193
- const test = this._maskService.removeMask(this._inputValue())?.length <=
7194
- this._maskService.removeMask(mask)?.length;
7195
- if (test) {
7196
- const maskValue = mask.includes("{" /* MaskExpression.CURLY_BRACKETS_LEFT */)
7197
- ? this._maskService._repeatPatternSymbols(mask)
7198
- : mask;
7199
- this._maskValue.set(maskValue);
7200
- this._maskService.maskExpression = maskValue;
7201
- return test;
7202
- }
7203
- else {
7204
- const expression = this._maskExpressionArray()[this._maskExpressionArray().length - 1] ??
7205
- "" /* MaskExpression.EMPTY_STRING */;
7206
- const maskValue = expression.includes("{" /* MaskExpression.CURLY_BRACKETS_LEFT */)
7207
- ? this._maskService._repeatPatternSymbols(expression)
7208
- : expression;
7209
- this._maskValue.set(maskValue);
7210
- this._maskService.maskExpression = maskValue;
7211
- }
7212
- }
7213
- else {
7214
- const cleanMask = this._maskService.removeMask(mask);
7215
- const check = this._maskService
7216
- .removeMask(this._inputValue())
7217
- ?.split("" /* MaskExpression.EMPTY_STRING */)
7218
- .every((character, index) => {
7219
- const indexMask = cleanMask.charAt(index);
7220
- return this._maskService._checkSymbolMask(character, indexMask);
7221
- });
7222
- if (check || this._justPasted()) {
7223
- this._maskValue.set(mask);
7224
- this._maskService.maskExpression = mask;
7225
- return check;
7226
- }
7227
- }
7228
- });
7229
- }
7230
- _areAllCharactersInEachStringSame(array) {
7231
- const specialCharacters = this._maskService.specialCharacters;
7232
- function removeSpecialCharacters(str) {
7233
- const regex = new RegExp(`[${specialCharacters.map((ch) => `\\${ch}`).join('')}]`, 'g');
7234
- return str.replace(regex, '');
7235
- }
7236
- const processedArr = array.map(removeSpecialCharacters);
7237
- return processedArr.every((str) => {
7238
- const uniqueCharacters = new Set(str);
7239
- return uniqueCharacters.size === 1;
7240
- });
7241
- }
7242
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaMaskDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
7243
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.0", type: MatchaMaskDirective, isStandalone: false, selector: "input[mask], textarea[mask]", inputs: { mask: { classPropertyName: "mask", publicName: "mask", isSignal: true, isRequired: false, transformFunction: null }, specialCharacters: { classPropertyName: "specialCharacters", publicName: "specialCharacters", isSignal: true, isRequired: false, transformFunction: null }, patterns: { classPropertyName: "patterns", publicName: "patterns", isSignal: true, isRequired: false, transformFunction: null }, prefix: { classPropertyName: "prefix", publicName: "prefix", isSignal: true, isRequired: false, transformFunction: null }, suffix: { classPropertyName: "suffix", publicName: "suffix", isSignal: true, isRequired: false, transformFunction: null }, thousandSeparator: { classPropertyName: "thousandSeparator", publicName: "thousandSeparator", isSignal: true, isRequired: false, transformFunction: null }, decimalMarker: { classPropertyName: "decimalMarker", publicName: "decimalMarker", isSignal: true, isRequired: false, transformFunction: null }, dropSpecialCharacters: { classPropertyName: "dropSpecialCharacters", publicName: "dropSpecialCharacters", isSignal: true, isRequired: false, transformFunction: null }, hiddenInput: { classPropertyName: "hiddenInput", publicName: "hiddenInput", isSignal: true, isRequired: false, transformFunction: null }, showMaskTyped: { classPropertyName: "showMaskTyped", publicName: "showMaskTyped", isSignal: true, isRequired: false, transformFunction: null }, placeHolderCharacter: { classPropertyName: "placeHolderCharacter", publicName: "placeHolderCharacter", isSignal: true, isRequired: false, transformFunction: null }, shownMaskExpression: { classPropertyName: "shownMaskExpression", publicName: "shownMaskExpression", isSignal: true, isRequired: false, transformFunction: null }, clearIfNotMatch: { classPropertyName: "clearIfNotMatch", publicName: "clearIfNotMatch", isSignal: true, isRequired: false, transformFunction: null }, validation: { classPropertyName: "validation", publicName: "validation", isSignal: true, isRequired: false, transformFunction: null }, separatorLimit: { classPropertyName: "separatorLimit", publicName: "separatorLimit", isSignal: true, isRequired: false, transformFunction: null }, allowNegativeNumbers: { classPropertyName: "allowNegativeNumbers", publicName: "allowNegativeNumbers", isSignal: true, isRequired: false, transformFunction: null }, leadZeroDateTime: { classPropertyName: "leadZeroDateTime", publicName: "leadZeroDateTime", isSignal: true, isRequired: false, transformFunction: null }, leadZero: { classPropertyName: "leadZero", publicName: "leadZero", isSignal: true, isRequired: false, transformFunction: null }, triggerOnMaskChange: { classPropertyName: "triggerOnMaskChange", publicName: "triggerOnMaskChange", isSignal: true, isRequired: false, transformFunction: null }, apm: { classPropertyName: "apm", publicName: "apm", isSignal: true, isRequired: false, transformFunction: null }, inputTransformFn: { classPropertyName: "inputTransformFn", publicName: "inputTransformFn", isSignal: true, isRequired: false, transformFunction: null }, outputTransformFn: { classPropertyName: "outputTransformFn", publicName: "outputTransformFn", isSignal: true, isRequired: false, transformFunction: null }, keepCharacterPositions: { classPropertyName: "keepCharacterPositions", publicName: "keepCharacterPositions", isSignal: true, isRequired: false, transformFunction: null }, instantPrefix: { classPropertyName: "instantPrefix", publicName: "instantPrefix", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { maskFilled: "maskFilled" }, host: { listeners: { "paste": "onPaste()", "focus": "onFocus($event)", "ngModelChange": "onModelChange($event)", "input": "onInput($event)", "compositionstart": "onCompositionStart($event)", "compositionend": "onCompositionEnd($event)", "blur": "onBlur($event)", "click": "onClick($event)", "keydown": "onKeyDown($event)" } }, providers: [
7244
- {
7245
- provide: NG_VALUE_ACCESSOR,
7246
- useExisting: forwardRef(() => MatchaMaskDirective),
7247
- multi: true,
7248
- },
7249
- {
7250
- provide: NG_VALIDATORS,
7251
- useExisting: forwardRef(() => MatchaMaskDirective),
7252
- multi: true,
7253
- },
7254
- MatchaMaskService,
7255
- ], exportAs: ["mask", "matchaMask"], usesOnChanges: true, ngImport: i0 }); }
6885
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaInputPhoneComponent, deps: [{ token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
6886
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.0", type: MatchaInputPhoneComponent, isStandalone: false, selector: "matcha-input-phone", inputs: { fallbackMask: "fallbackMask", value: "value" }, outputs: { onChange: "onChange" }, viewQueries: [{ propertyName: "inputSelector", first: true, predicate: ["inputSelector"], descendants: true }, { propertyName: "phoneRef", first: true, predicate: ["phoneRef"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "\n<div class=\"flex-row position-relative px-16 gap-8\" #inputSelector>\n <div class=\"min-h-24 radius-8 cursor-pointer d-flex gap-8 flex-align-center fs-16\" (click)=\"toggleDropdown()\">\n <div class=\"d-flex-row flex-align-center\">\n <img alt=\"\" [src]=\"'https://flagcdn.com/16x12/'+ selectedCountry?.iso2?.toLowerCase() + '.png'\"\n height=\"16\">\n </div>\n <span class=\"w-16 fs-16\"\n [ngClass]=\"isOpen ? 'i-matcha-action_arrow_up': 'i-matcha-action_arrow_down'\"></span>\n\n </div>\n <input *ngIf=\"isInitialized\" #phoneRef type=\"text\" placeholder=\"{{ typeMask }}\"\n [(ngModel)]=\"inputValueModel\"\n pattern=\"[0-9]*\" (keyup)=\"onInput($event)\" [mask]=\"typeMask\">\n\n <ng-container *ngIf=\"isOpen\">\n <div class=\"position-absolute z-index-10\">\n <div class=\"grid-1 gap-16 radius-8 z-index-10 p-8 w-300 position-absolute background-surface elevation-z-1\"\n style=\"top: calc(100% + 10px); overflow: hidden; height: 300px; overflow-y: auto;\">\n\n <label *ngFor=\"let country of allCountries; let i = index\"\n class=\"fs-16 lh-18 cursor-pointer d-flex-align-center p-8 ts-300-l\"\n [ngClass]=\"labelHover === i+'bg' ? 'background-bg' : 'background-surface'\"\n (mouseover)=\"labelHover = i+'bg'\" (mouseout)=\"labelHover = i+'su'\"\n (click)=\"selectCountry(country)\">\n <img alt=\"\" class=\"mr-8\"\n [src]=\"'https://flagcdn.com/16x12/'+ country?.iso2?.toLowerCase() + '.png'\" height=\"16\">\n {{country.name}}\n </label>\n </div>\n </div>\n </ng-container>\n</div>\n", dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.PatternValidator, selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", inputs: ["pattern"] }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: MatchaMaskCompatibleDirective, selector: "input[mask], textarea[mask]", inputs: ["mask", "specialCharacters", "patterns", "prefix", "suffix", "thousandSeparator", "decimalMarker", "dropSpecialCharacters", "hiddenInput", "showMaskTyped", "placeHolderCharacter", "shownMaskExpression", "clearIfNotMatch", "validation", "separatorLimit", "allowNegativeNumbers", "leadZeroDateTime", "leadZero", "triggerOnMaskChange", "apm", "inputTransformFn", "outputTransformFn", "keepCharacterPositions", "instantPrefix"], outputs: ["maskFilled"], exportAs: ["mask", "matchaMask"] }] }); }
7256
6887
  }
7257
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaMaskDirective, decorators: [{
7258
- type: Directive,
6888
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaInputPhoneComponent, decorators: [{
6889
+ type: Component,
6890
+ args: [{ selector: 'matcha-input-phone', standalone: false, template: "\n<div class=\"flex-row position-relative px-16 gap-8\" #inputSelector>\n <div class=\"min-h-24 radius-8 cursor-pointer d-flex gap-8 flex-align-center fs-16\" (click)=\"toggleDropdown()\">\n <div class=\"d-flex-row flex-align-center\">\n <img alt=\"\" [src]=\"'https://flagcdn.com/16x12/'+ selectedCountry?.iso2?.toLowerCase() + '.png'\"\n height=\"16\">\n </div>\n <span class=\"w-16 fs-16\"\n [ngClass]=\"isOpen ? 'i-matcha-action_arrow_up': 'i-matcha-action_arrow_down'\"></span>\n\n </div>\n <input *ngIf=\"isInitialized\" #phoneRef type=\"text\" placeholder=\"{{ typeMask }}\"\n [(ngModel)]=\"inputValueModel\"\n pattern=\"[0-9]*\" (keyup)=\"onInput($event)\" [mask]=\"typeMask\">\n\n <ng-container *ngIf=\"isOpen\">\n <div class=\"position-absolute z-index-10\">\n <div class=\"grid-1 gap-16 radius-8 z-index-10 p-8 w-300 position-absolute background-surface elevation-z-1\"\n style=\"top: calc(100% + 10px); overflow: hidden; height: 300px; overflow-y: auto;\">\n\n <label *ngFor=\"let country of allCountries; let i = index\"\n class=\"fs-16 lh-18 cursor-pointer d-flex-align-center p-8 ts-300-l\"\n [ngClass]=\"labelHover === i+'bg' ? 'background-bg' : 'background-surface'\"\n (mouseover)=\"labelHover = i+'bg'\" (mouseout)=\"labelHover = i+'su'\"\n (click)=\"selectCountry(country)\">\n <img alt=\"\" class=\"mr-8\"\n [src]=\"'https://flagcdn.com/16x12/'+ country?.iso2?.toLowerCase() + '.png'\" height=\"16\">\n {{country.name}}\n </label>\n </div>\n </div>\n </ng-container>\n</div>\n" }]
6891
+ }], ctorParameters: () => [{ type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }], propDecorators: { inputSelector: [{
6892
+ type: ViewChild,
6893
+ args: ['inputSelector']
6894
+ }], phoneRef: [{
6895
+ type: ViewChild,
6896
+ args: ['phoneRef']
6897
+ }], fallbackMask: [{
6898
+ type: Input,
6899
+ args: ['fallbackMask']
6900
+ }], value: [{
6901
+ type: Input,
6902
+ args: ['value']
6903
+ }], onChange: [{
6904
+ type: Output
6905
+ }] } });
6906
+
6907
+ class StepComponent {
6908
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: StepComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
6909
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.0", type: StepComponent, isStandalone: false, selector: "matcha-step", inputs: { step: ["title", "step"] }, viewQueries: [{ propertyName: "template", first: true, predicate: TemplateRef, descendants: true, static: true }], ngImport: i0, template: `<ng-template><ng-content></ng-content></ng-template>`, isInline: true }); }
6910
+ }
6911
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: StepComponent, decorators: [{
6912
+ type: Component,
7259
6913
  args: [{
7260
- selector: 'input[mask], textarea[mask]',
7261
- standalone: false,
7262
- providers: [
7263
- {
7264
- provide: NG_VALUE_ACCESSOR,
7265
- useExisting: forwardRef(() => MatchaMaskDirective),
7266
- multi: true,
7267
- },
7268
- {
7269
- provide: NG_VALIDATORS,
7270
- useExisting: forwardRef(() => MatchaMaskDirective),
7271
- multi: true,
7272
- },
7273
- MatchaMaskService,
7274
- ],
7275
- exportAs: 'mask,matchaMask',
6914
+ selector: 'matcha-step',
6915
+ template: `<ng-template><ng-content></ng-content></ng-template>`,
6916
+ standalone: false
7276
6917
  }]
7277
- }], propDecorators: { onPaste: [{
7278
- type: HostListener,
7279
- args: ['paste']
7280
- }], onFocus: [{
7281
- type: HostListener,
7282
- args: ['focus', ['$event']]
7283
- }], onModelChange: [{
7284
- type: HostListener,
7285
- args: ['ngModelChange', ['$event']]
7286
- }], onInput: [{
7287
- type: HostListener,
7288
- args: ['input', ['$event']]
7289
- }], onCompositionStart: [{
7290
- type: HostListener,
7291
- args: ['compositionstart', ['$event']]
7292
- }], onCompositionEnd: [{
7293
- type: HostListener,
7294
- args: ['compositionend', ['$event']]
7295
- }], onBlur: [{
7296
- type: HostListener,
7297
- args: ['blur', ['$event']]
7298
- }], onClick: [{
7299
- type: HostListener,
7300
- args: ['click', ['$event']]
7301
- }], onKeyDown: [{
7302
- type: HostListener,
7303
- args: ['keydown', ['$event']]
6918
+ }], propDecorators: { step: [{
6919
+ type: Input,
6920
+ args: ['title']
6921
+ }], template: [{
6922
+ type: ViewChild,
6923
+ args: [TemplateRef, { static: true }]
7304
6924
  }] } });
7305
6925
 
7306
- /**
7307
- * Componente MatchaInputPhone
7308
- *
7309
- * Componente Angular para entrada de telefone internacional com seleção de país, máscara dinâmica e exibição de bandeira.
7310
- *
7311
- * Funcionalidades:
7312
- * - Seleção de país com dropdown e bandeira.
7313
- * - Máscara dinâmica de acordo com o país e DDD digitado.
7314
- * - Suporte a diferentes formatos de telefone (fixo/celular) para o Brasil.
7315
- * - Emissão de evento ao alterar o valor do telefone.
7316
- * - Inicialização automática pelo valor informado ou pelo idioma do navegador.
7317
- *
7318
- * Inputs:
7319
- * - fallbackMask: string - Máscara padrão caso não seja encontrada uma específica.
7320
- * - label: string - Rótulo do campo (padrão: 'Telefone').
7321
- * - value: string - Valor inicial do telefone (com ou sem DDI).
7322
- *
7323
- * Outputs:
7324
- * - onChange: EventEmitter<string> - Emite o valor do telefone completo (com DDI) ao alterar.
7325
- *
7326
- * ViewChild:
7327
- * - inputSelector: ElementRef - Referência ao container do input (usado para fechar o dropdown).
7328
- * - phoneRef: ElementRef - Referência ao input do telefone.
7329
- *
7330
- * Métodos principais:
7331
- * - ngOnInit: Inicializa o componente pelo valor ou idioma.
7332
- * - ngOnChanges: Atualiza o valor ao receber novo input externo.
7333
- * - initCountryPhone: Inicializa país e máscara pelo valor do telefone.
7334
- * - selectMaskForDialCode: Seleciona a máscara conforme país e DDD.
7335
- * - selectCountry: Troca o país selecionado e atualiza máscara.
7336
- * - onInput: Atualiza máscara e emite evento ao digitar.
7337
- * - toggleDropdown: Abre/fecha o dropdown de países.
7338
- */
7339
- class MatchaInputPhoneComponent {
7340
- constructor(renderer, cdr) {
7341
- this.renderer = renderer;
7342
- this.cdr = cdr;
7343
- this.fallbackMask = '00 0000 0000';
7344
- this.onChange = new EventEmitter();
7345
- this.typeMask = '';
7346
- this.labelHover = 'su';
7347
- this.allCountries = getCountryISO2();
7348
- this.isOpen = false;
7349
- this.inputValueModel = '';
7350
- this.clickListener = null;
7351
- this.isInitialized = false;
7352
- }
7353
- ngOnInit() {
7354
- this.value ? this.initCountryPhone(this.value) : this.initCountrylanguageNavigator();
7355
- this.cdr.detectChanges();
7356
- this.isInitialized = true;
6926
+ class MatchaStepperStateService {
6927
+ constructor() {
6928
+ this.steps = [];
6929
+ this._steps$ = new BehaviorSubject([]);
6930
+ this.steps$ = this._steps$.asObservable();
6931
+ this._activeStep$ = new BehaviorSubject(0);
6932
+ this.activeStep$ = this._activeStep$.asObservable();
6933
+ this.pendingActiveStep = null;
7357
6934
  }
7358
- ngOnChanges(changes) {
7359
- if (changes['value'] && !changes['value'].firstChange) {
7360
- this.value = changes['value'].currentValue;
7361
- if (!this.value) {
7362
- this.inputValueModel = this.value ?? '';
7363
- return;
7364
- }
7365
- this.initCountryPhone(this.value);
7366
- this.cdr.detectChanges();
6935
+ setSteps(steps) {
6936
+ this.steps = steps;
6937
+ this._steps$.next(steps);
6938
+ // Se havia um índice pendente, aplica agora
6939
+ if (this.pendingActiveStep !== null) {
6940
+ this.setActiveStep(this.pendingActiveStep);
6941
+ this.pendingActiveStep = null;
7367
6942
  }
7368
6943
  }
7369
- initCountryPhone(phone) {
7370
- if (!phone.startsWith('+')) {
7371
- this.setCountryAndInputValue('br', phone);
6944
+ setActiveStep(index) {
6945
+ if (this.steps.length === 0) {
6946
+ // Steps ainda não definidos, guarda para depois
6947
+ this.pendingActiveStep = index;
7372
6948
  return;
7373
6949
  }
7374
- const phoneWithoutPlus = phone.replace('+', '');
7375
- const countryDialCode = this.selectedCountry?.dialCode;
7376
- if (phoneWithoutPlus.startsWith(countryDialCode)) {
7377
- this.setCountryAndInputValue(this.selectedCountry.iso2, phoneWithoutPlus.replace(countryDialCode, ''));
7378
- this.inputValueModel = phoneWithoutPlus.replace(countryDialCode, '');
7379
- }
7380
- else {
7381
- this.matchCountryAndSetInputValue(phoneWithoutPlus);
6950
+ if (index >= 0 && index < this.steps.length) {
6951
+ this._activeStep$.next(index);
7382
6952
  }
7383
6953
  }
7384
- setCountryAndInputValue(iso2, phone) {
7385
- this.selectedCountry = this.allCountries.find((country) => country.iso2 === iso2);
7386
- this.inputValueModel = phone.startsWith('0') ? phone.slice(1) : phone;
7387
- this.selectMaskForDialCode(this.selectedCountry.areaCodes ? this.selectedCountry.areaCodes[0] : '000', this.inputValueModel);
7388
- }
7389
- matchCountryAndSetInputValue(phoneWithoutPlus) {
7390
- const matchingCountry = this.getMatchingCountry(phoneWithoutPlus);
7391
- if (matchingCountry.length === 1) {
7392
- this.setCountryAndInputValue(matchingCountry[0].iso2, phoneWithoutPlus.replace(matchingCountry[0].dialCode, ''));
7393
- }
7394
- else {
7395
- this.matchAreaCodeAndSetInputValue(phoneWithoutPlus, matchingCountry);
6954
+ nextStep() {
6955
+ const current = this._activeStep$.value;
6956
+ if (current < this.steps.length - 1) {
6957
+ this._activeStep$.next(current + 1);
7396
6958
  }
7397
6959
  }
7398
- getMatchingCountry(phoneWithoutPlus) {
7399
- return this.allCountries.filter((country) => {
7400
- const dialCode = country.dialCode;
7401
- return phoneWithoutPlus.startsWith(dialCode);
7402
- });
7403
- }
7404
- matchAreaCodeAndSetInputValue(phoneWithoutPlus, matchingCountry) {
7405
- const phoneWithoutDialCode = phoneWithoutPlus.replace(matchingCountry[0].dialCode, '');
7406
- const filterAreaCode = phoneWithoutDialCode.substring(0, 3);
7407
- const matchingAreaCode = matchingCountry.filter((country) => {
7408
- if (country.areaCodes) {
7409
- return country.areaCodes.includes(filterAreaCode);
7410
- }
7411
- });
7412
- if (matchingAreaCode.length === 1) {
7413
- this.setCountryAndInputValue(matchingAreaCode[0].iso2, phoneWithoutDialCode);
7414
- }
7415
- else {
7416
- const defaultCountry = matchingCountry.find((country) => country.priority === 0);
7417
- this.setCountryAndInputValue(defaultCountry.iso2, phoneWithoutDialCode);
7418
- }
7419
- }
7420
- selectMaskForDialCode(inputDigits, targetValuePhone) {
7421
- const previousMask = this.typeMask;
7422
- const maskArray = this.selectedCountry?.mask;
7423
- const maskIndex = this.selectedCountry?.areaCodes
7424
- ? this.selectedCountry.areaCodes.findIndex((code) => inputDigits === code)
7425
- : -1;
7426
- if (this.selectedCountry?.iso2 === 'br' && (targetValuePhone && targetValuePhone.length > 2)) {
7427
- const eventInput = targetValuePhone.substring(2);
7428
- if (eventInput && eventInput[0] === '9') {
7429
- this.typeMask = "00 0 0000 0000";
7430
- this.cdr.detectChanges();
7431
- return;
7432
- }
7433
- }
7434
- if (Array.isArray(maskArray)) {
7435
- if (maskIndex !== -1 && maskArray[maskIndex]) {
7436
- this.typeMask = maskArray[maskIndex];
7437
- }
7438
- else if (maskArray[0]) {
7439
- this.typeMask = maskArray[0];
7440
- }
7441
- else {
7442
- this.typeMask = this.fallbackMask;
7443
- }
7444
- }
7445
- else {
7446
- this.typeMask = this.fallbackMask;
7447
- }
7448
- if (previousMask !== this.typeMask)
7449
- this.inputValueModel = '';
7450
- this.cdr.detectChanges();
7451
- }
7452
- initCountrylanguageNavigator() {
7453
- let lang = navigator.language;
7454
- if (lang.includes('-')) {
7455
- const langParts = lang.split('-');
7456
- lang = langParts[1];
7457
- }
7458
- this.selectedCountry = this.allCountries.find((country) => country.iso2 === lang.toLocaleLowerCase());
7459
- this.selectMaskForDialCode(this.selectedCountry.areaCodes ? this.selectedCountry.areaCodes[0] : '000');
7460
- }
7461
- selectCountry(country) {
7462
- this.selectedCountry = country;
7463
- this.selectMaskForDialCode(this.selectedCountry.areaCodes ? this.selectedCountry.areaCodes[0] : '000');
7464
- this.isOpen = false;
7465
- this.onChange.emit('+' + this.selectedCountry.dialCode + this.inputValueModel);
7466
- this.removeClickListener();
7467
- this.cdr.detectChanges();
7468
- }
7469
- toggleDropdown() {
7470
- this.isOpen = !this.isOpen;
7471
- this.clickListener = this.renderer.listen('window', 'click', (event) => {
7472
- if (this.isOpen && !this.inputSelector.nativeElement.contains(event.target)) {
7473
- this.isOpen = false;
7474
- this.removeClickListener();
7475
- }
7476
- });
7477
- this.cdr.detectChanges();
7478
- }
7479
- removeClickListener() {
7480
- if (this.clickListener) {
7481
- this.clickListener();
7482
- this.clickListener = null;
7483
- }
7484
- }
7485
- onInput(event) {
7486
- this.phoneRef.nativeElement.value = event.target.value.replace(/[^\d\s]/g, '');
7487
- let targetValuePhone = event.target.value.replace(/\D/g, '');
7488
- this.onChange.emit('+' + this.selectedCountry.dialCode + this.inputValueModel);
7489
- const inputDigits = targetValuePhone.substring(0, 3);
7490
- if (inputDigits) {
7491
- this.selectMaskForDialCode(inputDigits, targetValuePhone);
7492
- }
7493
- this.cdr.detectChanges();
7494
- }
7495
- ngOnDestroy() {
7496
- this.removeClickListener();
7497
- }
7498
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaInputPhoneComponent, deps: [{ token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
7499
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.0", type: MatchaInputPhoneComponent, isStandalone: false, selector: "matcha-input-phone", inputs: { fallbackMask: "fallbackMask", value: "value" }, outputs: { onChange: "onChange" }, viewQueries: [{ propertyName: "inputSelector", first: true, predicate: ["inputSelector"], descendants: true }, { propertyName: "phoneRef", first: true, predicate: ["phoneRef"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "\n<div class=\"flex-row position-relative px-16 gap-8\" #inputSelector>\n <div class=\"min-h-24 radius-8 cursor-pointer d-flex gap-8 flex-align-center fs-16\" (click)=\"toggleDropdown()\">\n <div class=\"d-flex-row flex-align-center\">\n <img alt=\"\" [src]=\"'https://flagcdn.com/16x12/'+ selectedCountry?.iso2?.toLowerCase() + '.png'\"\n height=\"16\">\n </div>\n <span class=\"w-16 fs-16\"\n [ngClass]=\"isOpen ? 'i-matcha-action_arrow_up': 'i-matcha-action_arrow_down'\"></span>\n\n </div>\n <input *ngIf=\"isInitialized\" #phoneRef type=\"text\" placeholder=\"{{ typeMask }}\"\n [(ngModel)]=\"inputValueModel\"\n pattern=\"[0-9]*\" (keyup)=\"onInput($event)\" [mask]=\"typeMask\">\n\n <ng-container *ngIf=\"isOpen\">\n <div class=\"position-absolute z-index-10\">\n <div class=\"grid-1 gap-16 radius-8 z-index-10 p-8 w-300 position-absolute background-surface elevation-z-1\"\n style=\"top: calc(100% + 10px); overflow: hidden; height: 300px; overflow-y: auto;\">\n\n <label *ngFor=\"let country of allCountries; let i = index\"\n class=\"fs-16 lh-18 cursor-pointer d-flex-align-center p-8 ts-300-l\"\n [ngClass]=\"labelHover === i+'bg' ? 'background-bg' : 'background-surface'\"\n (mouseover)=\"labelHover = i+'bg'\" (mouseout)=\"labelHover = i+'su'\"\n (click)=\"selectCountry(country)\">\n <img alt=\"\" class=\"mr-8\"\n [src]=\"'https://flagcdn.com/16x12/'+ country?.iso2?.toLowerCase() + '.png'\" height=\"16\">\n {{country.name}}\n </label>\n </div>\n </div>\n </ng-container>\n</div>\n", dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.PatternValidator, selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", inputs: ["pattern"] }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: MatchaMaskDirective, selector: "input[mask], textarea[mask]", inputs: ["mask", "specialCharacters", "patterns", "prefix", "suffix", "thousandSeparator", "decimalMarker", "dropSpecialCharacters", "hiddenInput", "showMaskTyped", "placeHolderCharacter", "shownMaskExpression", "clearIfNotMatch", "validation", "separatorLimit", "allowNegativeNumbers", "leadZeroDateTime", "leadZero", "triggerOnMaskChange", "apm", "inputTransformFn", "outputTransformFn", "keepCharacterPositions", "instantPrefix"], outputs: ["maskFilled"], exportAs: ["mask", "matchaMask"] }] }); }
7500
- }
7501
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaInputPhoneComponent, decorators: [{
7502
- type: Component,
7503
- args: [{ selector: 'matcha-input-phone', standalone: false, template: "\n<div class=\"flex-row position-relative px-16 gap-8\" #inputSelector>\n <div class=\"min-h-24 radius-8 cursor-pointer d-flex gap-8 flex-align-center fs-16\" (click)=\"toggleDropdown()\">\n <div class=\"d-flex-row flex-align-center\">\n <img alt=\"\" [src]=\"'https://flagcdn.com/16x12/'+ selectedCountry?.iso2?.toLowerCase() + '.png'\"\n height=\"16\">\n </div>\n <span class=\"w-16 fs-16\"\n [ngClass]=\"isOpen ? 'i-matcha-action_arrow_up': 'i-matcha-action_arrow_down'\"></span>\n\n </div>\n <input *ngIf=\"isInitialized\" #phoneRef type=\"text\" placeholder=\"{{ typeMask }}\"\n [(ngModel)]=\"inputValueModel\"\n pattern=\"[0-9]*\" (keyup)=\"onInput($event)\" [mask]=\"typeMask\">\n\n <ng-container *ngIf=\"isOpen\">\n <div class=\"position-absolute z-index-10\">\n <div class=\"grid-1 gap-16 radius-8 z-index-10 p-8 w-300 position-absolute background-surface elevation-z-1\"\n style=\"top: calc(100% + 10px); overflow: hidden; height: 300px; overflow-y: auto;\">\n\n <label *ngFor=\"let country of allCountries; let i = index\"\n class=\"fs-16 lh-18 cursor-pointer d-flex-align-center p-8 ts-300-l\"\n [ngClass]=\"labelHover === i+'bg' ? 'background-bg' : 'background-surface'\"\n (mouseover)=\"labelHover = i+'bg'\" (mouseout)=\"labelHover = i+'su'\"\n (click)=\"selectCountry(country)\">\n <img alt=\"\" class=\"mr-8\"\n [src]=\"'https://flagcdn.com/16x12/'+ country?.iso2?.toLowerCase() + '.png'\" height=\"16\">\n {{country.name}}\n </label>\n </div>\n </div>\n </ng-container>\n</div>\n" }]
7504
- }], ctorParameters: () => [{ type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }], propDecorators: { inputSelector: [{
7505
- type: ViewChild,
7506
- args: ['inputSelector']
7507
- }], phoneRef: [{
7508
- type: ViewChild,
7509
- args: ['phoneRef']
7510
- }], fallbackMask: [{
7511
- type: Input,
7512
- args: ['fallbackMask']
7513
- }], value: [{
7514
- type: Input,
7515
- args: ['value']
7516
- }], onChange: [{
7517
- type: Output
7518
- }] } });
7519
-
7520
- class StepComponent {
7521
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: StepComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
7522
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.0", type: StepComponent, isStandalone: false, selector: "matcha-step", inputs: { step: ["title", "step"] }, viewQueries: [{ propertyName: "template", first: true, predicate: TemplateRef, descendants: true, static: true }], ngImport: i0, template: `<ng-template><ng-content></ng-content></ng-template>`, isInline: true }); }
7523
- }
7524
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: StepComponent, decorators: [{
7525
- type: Component,
7526
- args: [{
7527
- selector: 'matcha-step',
7528
- template: `<ng-template><ng-content></ng-content></ng-template>`,
7529
- standalone: false
7530
- }]
7531
- }], propDecorators: { step: [{
7532
- type: Input,
7533
- args: ['title']
7534
- }], template: [{
7535
- type: ViewChild,
7536
- args: [TemplateRef, { static: true }]
7537
- }] } });
7538
-
7539
- class MatchaStepperStateService {
7540
- constructor() {
7541
- this.steps = [];
7542
- this._steps$ = new BehaviorSubject([]);
7543
- this.steps$ = this._steps$.asObservable();
7544
- this._activeStep$ = new BehaviorSubject(0);
7545
- this.activeStep$ = this._activeStep$.asObservable();
7546
- this.pendingActiveStep = null;
7547
- }
7548
- setSteps(steps) {
7549
- this.steps = steps;
7550
- this._steps$.next(steps);
7551
- // Se havia um índice pendente, aplica agora
7552
- if (this.pendingActiveStep !== null) {
7553
- this.setActiveStep(this.pendingActiveStep);
7554
- this.pendingActiveStep = null;
7555
- }
7556
- }
7557
- setActiveStep(index) {
7558
- if (this.steps.length === 0) {
7559
- // Steps ainda não definidos, guarda para depois
7560
- this.pendingActiveStep = index;
7561
- return;
7562
- }
7563
- if (index >= 0 && index < this.steps.length) {
7564
- this._activeStep$.next(index);
7565
- }
7566
- }
7567
- nextStep() {
7568
- const current = this._activeStep$.value;
7569
- if (current < this.steps.length - 1) {
7570
- this._activeStep$.next(current + 1);
7571
- }
7572
- }
7573
- prevStep() {
7574
- const current = this._activeStep$.value;
7575
- if (current > 0) {
7576
- this._activeStep$.next(current - 1);
6960
+ prevStep() {
6961
+ const current = this._activeStep$.value;
6962
+ if (current > 0) {
6963
+ this._activeStep$.next(current - 1);
7577
6964
  }
7578
6965
  }
7579
6966
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaStepperStateService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
@@ -12157,49 +11544,1206 @@ class MatchaDragHandleDirective {
12157
11544
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaDragHandleDirective, deps: [{ token: i0.ElementRef }, { token: MatchaDragDirective }], target: i0.ɵɵFactoryTarget.Directive }); }
12158
11545
  static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.0", type: MatchaDragHandleDirective, isStandalone: false, selector: "[matchaDragHandle]", host: { properties: { "class.matcha-drag-handle": "this.dragHandleClass" } }, ngImport: i0 }); }
12159
11546
  }
12160
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaDragHandleDirective, decorators: [{
11547
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaDragHandleDirective, decorators: [{
11548
+ type: Directive,
11549
+ args: [{
11550
+ selector: '[matchaDragHandle]',
11551
+ standalone: false
11552
+ }]
11553
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: MatchaDragDirective }], propDecorators: { dragHandleClass: [{
11554
+ type: HostBinding,
11555
+ args: ['class.matcha-drag-handle']
11556
+ }] } });
11557
+
11558
+ class MatchaDropListModule {
11559
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaDropListModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
11560
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.0", ngImport: i0, type: MatchaDropListModule, declarations: [MatchaDropListComponent,
11561
+ MatchaDragDirective,
11562
+ MatchaDragHandleDirective], imports: [CommonModule], exports: [MatchaDropListComponent,
11563
+ MatchaDragDirective,
11564
+ MatchaDragHandleDirective] }); }
11565
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaDropListModule, providers: [
11566
+ MatchaDropListService
11567
+ ], imports: [CommonModule] }); }
11568
+ }
11569
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaDropListModule, decorators: [{
11570
+ type: NgModule,
11571
+ args: [{
11572
+ declarations: [
11573
+ MatchaDropListComponent,
11574
+ MatchaDragDirective,
11575
+ MatchaDragHandleDirective
11576
+ ],
11577
+ imports: [
11578
+ CommonModule
11579
+ ],
11580
+ exports: [
11581
+ MatchaDropListComponent,
11582
+ MatchaDragDirective,
11583
+ MatchaDragHandleDirective
11584
+ ],
11585
+ providers: [
11586
+ MatchaDropListService
11587
+ ]
11588
+ }]
11589
+ }] });
11590
+
11591
+ const compatibleOptions = {
11592
+ specialCharacters: ['/', '(', ')', '.', ':', '-', ' ', '+', ',', '@', '[', ']', '"', "'", '*'],
11593
+ patterns: {
11594
+ '0': { pattern: /\d/ },
11595
+ '9': { pattern: /\d/, optional: true },
11596
+ 'A': { pattern: /[a-zA-Z0-9]/ },
11597
+ 'S': { pattern: /[a-zA-Z]/ }
11598
+ },
11599
+ prefix: '',
11600
+ suffix: '',
11601
+ thousandSeparator: '',
11602
+ decimalMarker: '.',
11603
+ clearIfNotMatch: false,
11604
+ showMaskTyped: false,
11605
+ placeHolderCharacter: '_',
11606
+ shownMaskExpression: '',
11607
+ dropSpecialCharacters: true,
11608
+ hiddenInput: false,
11609
+ validation: true,
11610
+ instantPrefix: false,
11611
+ separatorLimit: '',
11612
+ apm: false,
11613
+ allowNegativeNumbers: false,
11614
+ leadZeroDateTime: false,
11615
+ leadZero: false,
11616
+ triggerOnMaskChange: false,
11617
+ keepCharacterPositions: false,
11618
+ inputTransformFn: (v) => v,
11619
+ outputTransformFn: (v) => v,
11620
+ maskFilled: new EventEmitter()
11621
+ };
11622
+ class MatchaMaskCompatibleModule {
11623
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaMaskCompatibleModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
11624
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.0", ngImport: i0, type: MatchaMaskCompatibleModule, declarations: [MatchaMaskCompatibleDirective], imports: [CommonModule], exports: [MatchaMaskCompatibleDirective] }); }
11625
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaMaskCompatibleModule, providers: [
11626
+ MatchaMaskService,
11627
+ { provide: MATCHA_MASK_CONFIG, useValue: compatibleOptions }
11628
+ ], imports: [CommonModule] }); }
11629
+ }
11630
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaMaskCompatibleModule, decorators: [{
11631
+ type: NgModule,
11632
+ args: [{
11633
+ declarations: [MatchaMaskCompatibleDirective],
11634
+ imports: [
11635
+ CommonModule
11636
+ ],
11637
+ exports: [
11638
+ MatchaMaskCompatibleDirective
11639
+ ],
11640
+ providers: [
11641
+ MatchaMaskService,
11642
+ { provide: MATCHA_MASK_CONFIG, useValue: compatibleOptions }
11643
+ ]
11644
+ }]
11645
+ }] });
11646
+
11647
+ class MatchaInputPhoneModule {
11648
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaInputPhoneModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
11649
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.0", ngImport: i0, type: MatchaInputPhoneModule, declarations: [MatchaInputPhoneComponent], imports: [CommonModule,
11650
+ MatchaFormFieldModule,
11651
+ FormsModule,
11652
+ MatchaMaskCompatibleModule], exports: [MatchaInputPhoneComponent] }); }
11653
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaInputPhoneModule, imports: [CommonModule,
11654
+ MatchaFormFieldModule,
11655
+ FormsModule,
11656
+ MatchaMaskCompatibleModule] }); }
11657
+ }
11658
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaInputPhoneModule, decorators: [{
11659
+ type: NgModule,
11660
+ args: [{
11661
+ declarations: [MatchaInputPhoneComponent],
11662
+ imports: [
11663
+ CommonModule,
11664
+ MatchaFormFieldModule,
11665
+ FormsModule,
11666
+ MatchaMaskCompatibleModule
11667
+ ],
11668
+ exports: [MatchaInputPhoneComponent]
11669
+ }]
11670
+ }] });
11671
+
11672
+ class MatchaPageLayoutModule {
11673
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaPageLayoutModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
11674
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.0", ngImport: i0, type: MatchaPageLayoutModule, declarations: [MatchaPageLayoutComponent], imports: [CommonModule,
11675
+ MatchaStepperModule], exports: [MatchaPageLayoutComponent] }); }
11676
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaPageLayoutModule, imports: [CommonModule,
11677
+ MatchaStepperModule] }); }
11678
+ }
11679
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaPageLayoutModule, decorators: [{
11680
+ type: NgModule,
11681
+ args: [{
11682
+ declarations: [
11683
+ MatchaPageLayoutComponent
11684
+ ],
11685
+ imports: [
11686
+ CommonModule,
11687
+ MatchaStepperModule
11688
+ ],
11689
+ exports: [
11690
+ MatchaPageLayoutComponent
11691
+ ]
11692
+ }]
11693
+ }] });
11694
+
11695
+ class MatchaRadioModule {
11696
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaRadioModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
11697
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.0", ngImport: i0, type: MatchaRadioModule, declarations: [MatchaRadioComponent], imports: [CommonModule, MatchaRippleModule], exports: [MatchaRadioComponent] }); }
11698
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaRadioModule, imports: [CommonModule, MatchaRippleModule] }); }
11699
+ }
11700
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaRadioModule, decorators: [{
11701
+ type: NgModule,
11702
+ args: [{
11703
+ declarations: [
11704
+ MatchaRadioComponent,
11705
+ ],
11706
+ imports: [CommonModule, MatchaRippleModule],
11707
+ exports: [
11708
+ MatchaRadioComponent,
11709
+ ],
11710
+ }]
11711
+ }] });
11712
+
11713
+ class MatchaAvatarModule {
11714
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaAvatarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
11715
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.0", ngImport: i0, type: MatchaAvatarModule, declarations: [MatchaAvatarComponent], imports: [CommonModule], exports: [MatchaAvatarComponent] }); }
11716
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaAvatarModule, imports: [CommonModule] }); }
11717
+ }
11718
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaAvatarModule, decorators: [{
11719
+ type: NgModule,
11720
+ args: [{
11721
+ declarations: [MatchaAvatarComponent],
11722
+ imports: [
11723
+ CommonModule
11724
+ ],
11725
+ exports: [MatchaAvatarComponent]
11726
+ }]
11727
+ }] });
11728
+
11729
+ class MatchaDrawerModule {
11730
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaDrawerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
11731
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.0", ngImport: i0, type: MatchaDrawerModule, declarations: [MatchaDrawerComponent,
11732
+ MatchaDrawerContainerComponent,
11733
+ MatchaDrawerContentComponent], imports: [CommonModule,
11734
+ MatchaButtonModule], exports: [MatchaDrawerComponent,
11735
+ MatchaDrawerContainerComponent,
11736
+ MatchaDrawerContentComponent] }); }
11737
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaDrawerModule, providers: [
11738
+ MatchaBreakpointObserver
11739
+ ], imports: [CommonModule,
11740
+ MatchaButtonModule] }); }
11741
+ }
11742
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaDrawerModule, decorators: [{
11743
+ type: NgModule,
11744
+ args: [{
11745
+ declarations: [
11746
+ MatchaDrawerComponent,
11747
+ MatchaDrawerContainerComponent,
11748
+ MatchaDrawerContentComponent
11749
+ ],
11750
+ imports: [
11751
+ CommonModule,
11752
+ MatchaButtonModule
11753
+ ],
11754
+ providers: [
11755
+ MatchaBreakpointObserver
11756
+ ],
11757
+ exports: [
11758
+ MatchaDrawerComponent,
11759
+ MatchaDrawerContainerComponent,
11760
+ MatchaDrawerContentComponent
11761
+ ]
11762
+ }]
11763
+ }] });
11764
+
11765
+ // Prism.js será carregado dinamicamente no componente quando necessário
11766
+ class MatchaHighlightModule {
11767
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaHighlightModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
11768
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.0", ngImport: i0, type: MatchaHighlightModule, declarations: [MatchaHighlightComponent,
11769
+ CopyButtonComponent], imports: [MatchaIconModule,
11770
+ MatchaButtonModule], exports: [MatchaHighlightComponent,
11771
+ CopyButtonComponent] }); }
11772
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaHighlightModule, imports: [MatchaIconModule,
11773
+ MatchaButtonModule] }); }
11774
+ }
11775
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaHighlightModule, decorators: [{
11776
+ type: NgModule,
11777
+ args: [{
11778
+ declarations: [
11779
+ MatchaHighlightComponent,
11780
+ CopyButtonComponent
11781
+ ],
11782
+ imports: [
11783
+ MatchaIconModule,
11784
+ MatchaButtonModule
11785
+ ],
11786
+ exports: [
11787
+ MatchaHighlightComponent,
11788
+ CopyButtonComponent
11789
+ ],
11790
+ }]
11791
+ }] });
11792
+
11793
+ class MatchaSliderModule {
11794
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaSliderModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
11795
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.0", ngImport: i0, type: MatchaSliderModule, declarations: [MatchaSliderComponent], imports: [CommonModule, FormsModule], exports: [MatchaSliderComponent] }); }
11796
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaSliderModule, imports: [CommonModule, FormsModule] }); }
11797
+ }
11798
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaSliderModule, decorators: [{
11799
+ type: NgModule,
11800
+ args: [{
11801
+ declarations: [MatchaSliderComponent],
11802
+ imports: [
11803
+ CommonModule, FormsModule
11804
+ ],
11805
+ exports: [MatchaSliderComponent]
11806
+ }]
11807
+ }] });
11808
+
11809
+ class MatchaMaskDirective {
11810
+ constructor() {
11811
+ this.mask = input('', ...(ngDevMode ? [{ debugName: "mask" }] : []));
11812
+ this.specialCharacters = input([], ...(ngDevMode ? [{ debugName: "specialCharacters" }] : []));
11813
+ this.patterns = input({}, ...(ngDevMode ? [{ debugName: "patterns" }] : []));
11814
+ this.prefix = input('', ...(ngDevMode ? [{ debugName: "prefix" }] : []));
11815
+ this.suffix = input('', ...(ngDevMode ? [{ debugName: "suffix" }] : []));
11816
+ this.thousandSeparator = input(' ', ...(ngDevMode ? [{ debugName: "thousandSeparator" }] : []));
11817
+ this.decimalMarker = input('.', ...(ngDevMode ? [{ debugName: "decimalMarker" }] : []));
11818
+ this.dropSpecialCharacters = input(null, ...(ngDevMode ? [{ debugName: "dropSpecialCharacters" }] : []));
11819
+ this.hiddenInput = input(null, ...(ngDevMode ? [{ debugName: "hiddenInput" }] : []));
11820
+ this.showMaskTyped = input(null, ...(ngDevMode ? [{ debugName: "showMaskTyped" }] : []));
11821
+ this.placeHolderCharacter = input(null, ...(ngDevMode ? [{ debugName: "placeHolderCharacter" }] : []));
11822
+ this.shownMaskExpression = input(null, ...(ngDevMode ? [{ debugName: "shownMaskExpression" }] : []));
11823
+ this.clearIfNotMatch = input(null, ...(ngDevMode ? [{ debugName: "clearIfNotMatch" }] : []));
11824
+ this.validation = input(null, ...(ngDevMode ? [{ debugName: "validation" }] : []));
11825
+ this.separatorLimit = input('', ...(ngDevMode ? [{ debugName: "separatorLimit" }] : []));
11826
+ this.allowNegativeNumbers = input(null, ...(ngDevMode ? [{ debugName: "allowNegativeNumbers" }] : []));
11827
+ this.leadZeroDateTime = input(null, ...(ngDevMode ? [{ debugName: "leadZeroDateTime" }] : []));
11828
+ this.leadZero = input(null, ...(ngDevMode ? [{ debugName: "leadZero" }] : []));
11829
+ this.triggerOnMaskChange = input(null, ...(ngDevMode ? [{ debugName: "triggerOnMaskChange" }] : []));
11830
+ this.apm = input(null, ...(ngDevMode ? [{ debugName: "apm" }] : []));
11831
+ this.inputTransformFn = input(null, ...(ngDevMode ? [{ debugName: "inputTransformFn" }] : []));
11832
+ this.outputTransformFn = input(null, ...(ngDevMode ? [{ debugName: "outputTransformFn" }] : []));
11833
+ this.keepCharacterPositions = input(null, ...(ngDevMode ? [{ debugName: "keepCharacterPositions" }] : []));
11834
+ this.instantPrefix = input(null, ...(ngDevMode ? [{ debugName: "instantPrefix" }] : []));
11835
+ this.maskFilled = output();
11836
+ this._maskValue = signal('', ...(ngDevMode ? [{ debugName: "_maskValue" }] : []));
11837
+ this._inputValue = signal('', ...(ngDevMode ? [{ debugName: "_inputValue" }] : []));
11838
+ this._position = signal(null, ...(ngDevMode ? [{ debugName: "_position" }] : []));
11839
+ this._code = signal('', ...(ngDevMode ? [{ debugName: "_code" }] : []));
11840
+ this._maskExpressionArray = signal([], ...(ngDevMode ? [{ debugName: "_maskExpressionArray" }] : []));
11841
+ this._justPasted = signal(false, ...(ngDevMode ? [{ debugName: "_justPasted" }] : []));
11842
+ this._isFocused = signal(false, ...(ngDevMode ? [{ debugName: "_isFocused" }] : []));
11843
+ /**For IME composition event */
11844
+ this._isComposing = signal(false, ...(ngDevMode ? [{ debugName: "_isComposing" }] : []));
11845
+ this._maskService = inject(MatchaMaskService, { self: true });
11846
+ this.document = inject(DOCUMENT);
11847
+ this._config = inject(MATCHA_MASK_CONFIG);
11848
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
11849
+ this.onChange = (_) => { };
11850
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
11851
+ this.onTouch = () => { };
11852
+ }
11853
+ ngOnChanges(changes) {
11854
+ const { mask, specialCharacters, patterns, prefix, suffix, thousandSeparator, decimalMarker, dropSpecialCharacters, hiddenInput, showMaskTyped, placeHolderCharacter, shownMaskExpression, clearIfNotMatch, validation, separatorLimit, allowNegativeNumbers, leadZeroDateTime, leadZero, triggerOnMaskChange, apm, inputTransformFn, outputTransformFn, keepCharacterPositions, instantPrefix, } = changes;
11855
+ if (mask) {
11856
+ if (mask.currentValue !== mask.previousValue && !mask.firstChange) {
11857
+ this._maskService.maskChanged = true;
11858
+ }
11859
+ if (mask.currentValue && mask.currentValue.split("||" /* MaskExpression.OR */).length > 1) {
11860
+ this._maskExpressionArray.set(mask.currentValue.split("||" /* MaskExpression.OR */).sort((a, b) => {
11861
+ return a.length - b.length;
11862
+ }));
11863
+ this._setMask();
11864
+ }
11865
+ else {
11866
+ this._maskExpressionArray.set([]);
11867
+ this._maskValue.set(mask.currentValue || "" /* MaskExpression.EMPTY_STRING */);
11868
+ this._maskService.maskExpression = this._maskValue();
11869
+ }
11870
+ }
11871
+ if (specialCharacters) {
11872
+ if (!specialCharacters.currentValue || !Array.isArray(specialCharacters.currentValue)) {
11873
+ return;
11874
+ }
11875
+ else {
11876
+ this._maskService.specialCharacters = specialCharacters.currentValue || [];
11877
+ }
11878
+ }
11879
+ if (allowNegativeNumbers) {
11880
+ this._maskService.allowNegativeNumbers = allowNegativeNumbers.currentValue;
11881
+ if (this._maskService.allowNegativeNumbers) {
11882
+ this._maskService.specialCharacters = this._maskService.specialCharacters.filter((c) => c !== "-" /* MaskExpression.MINUS */);
11883
+ }
11884
+ }
11885
+ // Only overwrite the mask available patterns if a pattern has actually been passed in
11886
+ if (patterns && patterns.currentValue) {
11887
+ this._maskService.patterns = patterns.currentValue;
11888
+ }
11889
+ if (apm && apm.currentValue) {
11890
+ this._maskService.apm = apm.currentValue;
11891
+ }
11892
+ if (instantPrefix) {
11893
+ this._maskService.instantPrefix = instantPrefix.currentValue;
11894
+ }
11895
+ if (prefix) {
11896
+ this._maskService.prefix = prefix.currentValue;
11897
+ }
11898
+ if (suffix) {
11899
+ this._maskService.suffix = suffix.currentValue;
11900
+ }
11901
+ if (thousandSeparator) {
11902
+ this._maskService.thousandSeparator = thousandSeparator.currentValue;
11903
+ if (thousandSeparator.previousValue && thousandSeparator.currentValue) {
11904
+ const previousDecimalMarker = this._maskService.decimalMarker;
11905
+ if (thousandSeparator.currentValue === this._maskService.decimalMarker) {
11906
+ this._maskService.decimalMarker =
11907
+ thousandSeparator.currentValue === "," /* MaskExpression.COMMA */
11908
+ ? "." /* MaskExpression.DOT */
11909
+ : "," /* MaskExpression.COMMA */;
11910
+ }
11911
+ if (this._maskService.dropSpecialCharacters === true) {
11912
+ this._maskService.specialCharacters = this._config.specialCharacters;
11913
+ }
11914
+ if (typeof previousDecimalMarker === 'string' &&
11915
+ typeof this._maskService.decimalMarker === 'string') {
11916
+ this._inputValue.set(this._inputValue()
11917
+ .split(thousandSeparator.previousValue)
11918
+ .join('')
11919
+ .replace(previousDecimalMarker, this._maskService.decimalMarker));
11920
+ this._maskService.actualValue = this._inputValue();
11921
+ }
11922
+ this._maskService.writingValue = true;
11923
+ }
11924
+ }
11925
+ if (decimalMarker) {
11926
+ this._maskService.decimalMarker = decimalMarker.currentValue;
11927
+ }
11928
+ if (dropSpecialCharacters) {
11929
+ this._maskService.dropSpecialCharacters = dropSpecialCharacters.currentValue;
11930
+ }
11931
+ if (hiddenInput) {
11932
+ this._maskService.hiddenInput = hiddenInput.currentValue;
11933
+ if (hiddenInput.previousValue === true && hiddenInput.currentValue === false) {
11934
+ this._inputValue.set(this._maskService.actualValue);
11935
+ }
11936
+ }
11937
+ if (showMaskTyped) {
11938
+ this._maskService.showMaskTyped = showMaskTyped.currentValue;
11939
+ if (showMaskTyped.previousValue === false &&
11940
+ showMaskTyped.currentValue === true &&
11941
+ this._isFocused()) {
11942
+ requestAnimationFrame(() => {
11943
+ this._maskService._elementRef?.nativeElement.click();
11944
+ });
11945
+ }
11946
+ }
11947
+ if (placeHolderCharacter) {
11948
+ this._maskService.placeHolderCharacter = placeHolderCharacter.currentValue;
11949
+ }
11950
+ if (shownMaskExpression) {
11951
+ this._maskService.shownMaskExpression = shownMaskExpression.currentValue;
11952
+ }
11953
+ if (clearIfNotMatch) {
11954
+ this._maskService.clearIfNotMatch = clearIfNotMatch.currentValue;
11955
+ }
11956
+ if (validation) {
11957
+ this._maskService.validation = validation.currentValue;
11958
+ }
11959
+ if (separatorLimit) {
11960
+ this._maskService.separatorLimit = separatorLimit.currentValue;
11961
+ }
11962
+ if (leadZeroDateTime) {
11963
+ this._maskService.leadZeroDateTime = leadZeroDateTime.currentValue;
11964
+ }
11965
+ if (leadZero) {
11966
+ this._maskService.leadZero = leadZero.currentValue;
11967
+ }
11968
+ if (triggerOnMaskChange) {
11969
+ this._maskService.triggerOnMaskChange = triggerOnMaskChange.currentValue;
11970
+ }
11971
+ if (inputTransformFn) {
11972
+ this._maskService.inputTransformFn = inputTransformFn.currentValue;
11973
+ }
11974
+ if (outputTransformFn) {
11975
+ this._maskService.outputTransformFn = outputTransformFn.currentValue;
11976
+ }
11977
+ if (keepCharacterPositions) {
11978
+ this._maskService.keepCharacterPositions = keepCharacterPositions.currentValue;
11979
+ }
11980
+ this._applyMask();
11981
+ }
11982
+ validate({ value }) {
11983
+ const processedValue = typeof value === 'number' ? String(value) : value;
11984
+ const maskValue = this._maskValue();
11985
+ if (!this._maskService.validation || !maskValue) {
11986
+ return null;
11987
+ }
11988
+ if (this._maskService.ipError) {
11989
+ return this._createValidationError(processedValue);
11990
+ }
11991
+ if (this._maskService.cpfCnpjError) {
11992
+ return this._createValidationError(processedValue);
11993
+ }
11994
+ if (maskValue.startsWith("separator" /* MaskExpression.SEPARATOR */)) {
11995
+ return null;
11996
+ }
11997
+ if (withoutValidation.includes(maskValue)) {
11998
+ return null;
11999
+ }
12000
+ if (this._maskService.clearIfNotMatch) {
12001
+ return null;
12002
+ }
12003
+ if (timeMasks.includes(maskValue)) {
12004
+ return this._validateTime(processedValue);
12005
+ }
12006
+ if (maskValue === "A*@A*.A*" /* MaskExpression.EMAIL_MASK */) {
12007
+ const emailPattern = /^[^@]+@[^@]+\.[^@]+$/;
12008
+ if (!emailPattern.test(processedValue) && processedValue) {
12009
+ return this._createValidationError(processedValue);
12010
+ }
12011
+ else {
12012
+ return null;
12013
+ }
12014
+ }
12015
+ if (processedValue && processedValue.length >= 1) {
12016
+ let counterOfOpt = 0;
12017
+ if (maskValue.includes("{" /* MaskExpression.CURLY_BRACKETS_LEFT */) &&
12018
+ maskValue.includes("}" /* MaskExpression.CURLY_BRACKETS_RIGHT */)) {
12019
+ const lengthInsideCurlyBrackets = maskValue.slice(maskValue.indexOf("{" /* MaskExpression.CURLY_BRACKETS_LEFT */) + 1, maskValue.indexOf("}" /* MaskExpression.CURLY_BRACKETS_RIGHT */));
12020
+ return lengthInsideCurlyBrackets === String(processedValue.length)
12021
+ ? null
12022
+ : this._createValidationError(processedValue);
12023
+ }
12024
+ if (maskValue.startsWith("percent" /* MaskExpression.PERCENT */)) {
12025
+ return null;
12026
+ }
12027
+ for (const key in this._maskService.patterns) {
12028
+ if (this._maskService.patterns[key]?.optional) {
12029
+ if (maskValue.indexOf(key) !== maskValue.lastIndexOf(key)) {
12030
+ const opt = maskValue
12031
+ .split("" /* MaskExpression.EMPTY_STRING */)
12032
+ .filter((i) => i === key)
12033
+ .join("" /* MaskExpression.EMPTY_STRING */);
12034
+ counterOfOpt += opt.length;
12035
+ }
12036
+ else if (maskValue.indexOf(key) !== -1) {
12037
+ counterOfOpt++;
12038
+ }
12039
+ if (maskValue.indexOf(key) !== -1 &&
12040
+ processedValue.length >= maskValue.indexOf(key)) {
12041
+ return null;
12042
+ }
12043
+ if (counterOfOpt === maskValue.length) {
12044
+ return null;
12045
+ }
12046
+ }
12047
+ }
12048
+ if ((maskValue.indexOf("*" /* MaskExpression.SYMBOL_STAR */) > 1 &&
12049
+ processedValue.length < maskValue.indexOf("*" /* MaskExpression.SYMBOL_STAR */)) ||
12050
+ (maskValue.indexOf("?" /* MaskExpression.SYMBOL_QUESTION */) > 1 &&
12051
+ processedValue.length < maskValue.indexOf("?" /* MaskExpression.SYMBOL_QUESTION */))) {
12052
+ return this._createValidationError(processedValue);
12053
+ }
12054
+ if (maskValue.indexOf("*" /* MaskExpression.SYMBOL_STAR */) === -1 ||
12055
+ maskValue.indexOf("?" /* MaskExpression.SYMBOL_QUESTION */) === -1) {
12056
+ const array = maskValue.split('*');
12057
+ const length = this._maskService.dropSpecialCharacters
12058
+ ? maskValue.length -
12059
+ this._maskService.checkDropSpecialCharAmount(maskValue) -
12060
+ counterOfOpt
12061
+ : this.prefix()
12062
+ ? maskValue.length + this.prefix().length - counterOfOpt
12063
+ : maskValue.length - counterOfOpt;
12064
+ if (array.length === 1) {
12065
+ if (processedValue.length < length) {
12066
+ return this._createValidationError(processedValue);
12067
+ }
12068
+ }
12069
+ if (array.length > 1) {
12070
+ const lastIndexArray = array[array.length - 1];
12071
+ if (lastIndexArray &&
12072
+ this._maskService.specialCharacters.includes(lastIndexArray[0]) &&
12073
+ String(processedValue).includes(lastIndexArray[0] ?? '') &&
12074
+ !this.dropSpecialCharacters()) {
12075
+ const special = value.split(lastIndexArray[0]);
12076
+ return special[special.length - 1].length === lastIndexArray.length - 1
12077
+ ? null
12078
+ : this._createValidationError(processedValue);
12079
+ }
12080
+ else if (((lastIndexArray &&
12081
+ !this._maskService.specialCharacters.includes(lastIndexArray[0])) ||
12082
+ !lastIndexArray ||
12083
+ this._maskService.dropSpecialCharacters) &&
12084
+ processedValue.length >= length - 1) {
12085
+ return null;
12086
+ }
12087
+ else {
12088
+ return this._createValidationError(processedValue);
12089
+ }
12090
+ }
12091
+ }
12092
+ if (maskValue.indexOf("*" /* MaskExpression.SYMBOL_STAR */) === 1 ||
12093
+ maskValue.indexOf("?" /* MaskExpression.SYMBOL_QUESTION */) === 1) {
12094
+ return null;
12095
+ }
12096
+ }
12097
+ if (value) {
12098
+ this.maskFilled.emit();
12099
+ return null;
12100
+ }
12101
+ return null;
12102
+ }
12103
+ onPaste() {
12104
+ this._justPasted.set(true);
12105
+ }
12106
+ onFocus() {
12107
+ this._isFocused.set(true);
12108
+ }
12109
+ onModelChange(value) {
12110
+ // on form reset we need to update the actualValue
12111
+ if ((value === "" /* MaskExpression.EMPTY_STRING */ ||
12112
+ value === null ||
12113
+ typeof value === 'undefined') &&
12114
+ this._maskService.actualValue) {
12115
+ this._maskService.actualValue = this._maskService.getActualValue("" /* MaskExpression.EMPTY_STRING */);
12116
+ }
12117
+ }
12118
+ onInput(e) {
12119
+ // If IME is composing text, we wait for the composed text.
12120
+ if (this._isComposing()) {
12121
+ return;
12122
+ }
12123
+ const el = e.target;
12124
+ const transformedValue = this._maskService.inputTransformFn
12125
+ ? this._maskService.inputTransformFn(el.value)
12126
+ : el.value;
12127
+ if (el.type !== 'number') {
12128
+ if (typeof transformedValue === 'string' || typeof transformedValue === 'number') {
12129
+ el.value = transformedValue.toString();
12130
+ this._inputValue.set(el.value);
12131
+ this._setMask();
12132
+ if (!this._maskValue()) {
12133
+ this.onChange(el.value);
12134
+ return;
12135
+ }
12136
+ let position = el.selectionStart === 1
12137
+ ? el.selectionStart + this._maskService.prefix.length
12138
+ : el.selectionStart;
12139
+ if (this.showMaskTyped() &&
12140
+ this.keepCharacterPositions() &&
12141
+ this._maskService.placeHolderCharacter.length === 1) {
12142
+ const suffix = this.suffix();
12143
+ const prefix = this.prefix();
12144
+ const inputSymbol = el.value.slice(position - 1, position);
12145
+ const prefixLength = prefix.length;
12146
+ const checkSymbols = this._maskService._checkSymbolMask(inputSymbol, this._maskService.maskExpression[position - 1 - prefixLength] ??
12147
+ "" /* MaskExpression.EMPTY_STRING */);
12148
+ const checkSpecialCharacter = this._maskService._checkSymbolMask(inputSymbol, this._maskService.maskExpression[position + 1 - prefixLength] ??
12149
+ "" /* MaskExpression.EMPTY_STRING */);
12150
+ const selectRangeBackspace = this._maskService.selStart === this._maskService.selEnd;
12151
+ const selStart = Number(this._maskService.selStart) - prefixLength;
12152
+ const selEnd = Number(this._maskService.selEnd) - prefixLength;
12153
+ const backspaceOrDelete = this._code() === "Backspace" /* MaskExpression.BACKSPACE */ ||
12154
+ this._code() === "Delete" /* MaskExpression.DELETE */;
12155
+ if (backspaceOrDelete) {
12156
+ if (!selectRangeBackspace) {
12157
+ if (this._maskService.selStart === prefixLength) {
12158
+ this._maskService.actualValue = `${prefix}${this._maskService.maskIsShown.slice(0, selEnd)}${this._inputValue().split(prefix).join('')}`;
12159
+ }
12160
+ else if (this._maskService.selStart ===
12161
+ this._maskService.maskIsShown.length + prefixLength) {
12162
+ this._maskService.actualValue = `${this._inputValue()}${this._maskService.maskIsShown.slice(selStart, selEnd)}`;
12163
+ }
12164
+ else {
12165
+ this._maskService.actualValue = `${prefix}${this._inputValue()
12166
+ .split(prefix)
12167
+ .join('')
12168
+ .slice(0, selStart)}${this._maskService.maskIsShown.slice(selStart, selEnd)}${this._maskService.actualValue.slice(selEnd + prefixLength, this._maskService.maskIsShown.length + prefixLength)}${suffix}`;
12169
+ }
12170
+ }
12171
+ else if (!this._maskService.specialCharacters.includes(this._maskService.maskExpression.slice(position - prefixLength, position + 1 - prefixLength)) &&
12172
+ selectRangeBackspace) {
12173
+ if (selStart === 1 && prefix) {
12174
+ this._maskService.actualValue = `${prefix}${this._maskService.placeHolderCharacter}${el.value
12175
+ .split(prefix)
12176
+ .join('')
12177
+ .split(suffix)
12178
+ .join('')}${suffix}`;
12179
+ position = position - 1;
12180
+ }
12181
+ else {
12182
+ const part1 = el.value.substring(0, position);
12183
+ const part2 = el.value.substring(position);
12184
+ this._maskService.actualValue = `${part1}${this._maskService.placeHolderCharacter}${part2}`;
12185
+ }
12186
+ }
12187
+ position = this._code() === "Delete" /* MaskExpression.DELETE */ ? position + 1 : position;
12188
+ }
12189
+ if (!backspaceOrDelete) {
12190
+ if (!checkSymbols && !checkSpecialCharacter && selectRangeBackspace) {
12191
+ position = Number(el.selectionStart) - 1;
12192
+ }
12193
+ else if (this._maskService.specialCharacters.includes(el.value.slice(position, position + 1)) &&
12194
+ checkSpecialCharacter &&
12195
+ !this._maskService.specialCharacters.includes(el.value.slice(position + 1, position + 2))) {
12196
+ this._maskService.actualValue = `${el.value.slice(0, position - 1)}${el.value.slice(position, position + 1)}${inputSymbol}${el.value.slice(position + 2)}`;
12197
+ position = position + 1;
12198
+ }
12199
+ else if (checkSymbols) {
12200
+ if (el.value.length === 1 && position === 1) {
12201
+ this._maskService.actualValue = `${prefix}${inputSymbol}${this._maskService.maskIsShown.slice(1, this._maskService.maskIsShown.length)}${suffix}`;
12202
+ }
12203
+ else {
12204
+ this._maskService.actualValue = `${el.value.slice(0, position - 1)}${inputSymbol}${el.value
12205
+ .slice(position + 1)
12206
+ .split(suffix)
12207
+ .join('')}${suffix}`;
12208
+ }
12209
+ }
12210
+ else if (prefix &&
12211
+ el.value.length === 1 &&
12212
+ position - prefixLength === 1 &&
12213
+ this._maskService._checkSymbolMask(el.value, this._maskService.maskExpression[position - 1 - prefixLength] ??
12214
+ "" /* MaskExpression.EMPTY_STRING */)) {
12215
+ this._maskService.actualValue = `${prefix}${el.value}${this._maskService.maskIsShown.slice(1, this._maskService.maskIsShown.length)}${suffix}`;
12216
+ }
12217
+ }
12218
+ }
12219
+ let caretShift = 0;
12220
+ let backspaceShift = false;
12221
+ if (this._code() === "Delete" /* MaskExpression.DELETE */ && "separator" /* MaskExpression.SEPARATOR */) {
12222
+ this._maskService.deletedSpecialCharacter = true;
12223
+ }
12224
+ if (this._inputValue().length >= this._maskService.maskExpression.length - 1 &&
12225
+ this._code() !== "Backspace" /* MaskExpression.BACKSPACE */ &&
12226
+ this._maskService.maskExpression === "d0/M0/0000" /* MaskExpression.DAYS_MONTHS_YEARS */ &&
12227
+ position < 10) {
12228
+ const inputSymbol = this._inputValue().slice(position - 1, position);
12229
+ el.value =
12230
+ this._inputValue().slice(0, position - 1) +
12231
+ inputSymbol +
12232
+ this._inputValue().slice(position + 1);
12233
+ }
12234
+ if (this._maskService.maskExpression === "d0/M0/0000" /* MaskExpression.DAYS_MONTHS_YEARS */ &&
12235
+ this.leadZeroDateTime()) {
12236
+ if ((position < 3 && Number(el.value) > 31 && Number(el.value) < 40) ||
12237
+ (position === 5 && Number(el.value.slice(3, 5)) > 12)) {
12238
+ position = position + 2;
12239
+ }
12240
+ }
12241
+ if (this._maskService.maskExpression === "Hh:m0:s0" /* MaskExpression.HOURS_MINUTES_SECONDS */ &&
12242
+ this.apm()) {
12243
+ if (this._justPasted() && el.value.slice(0, 2) === "00" /* MaskExpression.DOUBLE_ZERO */) {
12244
+ el.value = el.value.slice(1, 2) + el.value.slice(2, el.value.length);
12245
+ }
12246
+ el.value =
12247
+ el.value === "00" /* MaskExpression.DOUBLE_ZERO */
12248
+ ? "0" /* MaskExpression.NUMBER_ZERO */
12249
+ : el.value;
12250
+ }
12251
+ this._maskService.applyValueChanges(position, this._justPasted(), this._code() === "Backspace" /* MaskExpression.BACKSPACE */ ||
12252
+ this._code() === "Delete" /* MaskExpression.DELETE */, (shift, _backspaceShift) => {
12253
+ this._justPasted.set(false);
12254
+ caretShift = shift;
12255
+ backspaceShift = _backspaceShift;
12256
+ });
12257
+ // only set the selection if the element is active
12258
+ if (this._getActiveElement() !== el) {
12259
+ return;
12260
+ }
12261
+ if (this._maskService.plusOnePosition) {
12262
+ position = position + 1;
12263
+ this._maskService.plusOnePosition = false;
12264
+ }
12265
+ // update position after applyValueChanges to prevent cursor on wrong position when it has an array of maskExpression
12266
+ if (this._maskExpressionArray().length) {
12267
+ if (this._code() === "Backspace" /* MaskExpression.BACKSPACE */) {
12268
+ const specialChartMinusOne = this.specialCharacters().includes(this._maskService.actualValue.slice(position - 1, position));
12269
+ const allowFewMaskChangeMask = this._maskService.removeMask(this._inputValue())?.length ===
12270
+ this._maskService.removeMask(this._maskService.maskExpression)?.length;
12271
+ const specialChartPlusOne = this.specialCharacters().includes(this._maskService.actualValue.slice(position, position + 1));
12272
+ if (allowFewMaskChangeMask && !specialChartPlusOne) {
12273
+ position = el.selectionStart + 1;
12274
+ }
12275
+ else {
12276
+ position = specialChartMinusOne ? position - 1 : position;
12277
+ }
12278
+ }
12279
+ else {
12280
+ position =
12281
+ el.selectionStart === 1
12282
+ ? el.selectionStart + this._maskService.prefix.length
12283
+ : el.selectionStart;
12284
+ }
12285
+ }
12286
+ this._position.set(this._position() === 1 && this._inputValue().length === 1
12287
+ ? null
12288
+ : this._position());
12289
+ let positionToApply = this._position()
12290
+ ? this._inputValue().length + position + caretShift
12291
+ : position +
12292
+ (this._code() === "Backspace" /* MaskExpression.BACKSPACE */ && !backspaceShift
12293
+ ? 0
12294
+ : caretShift);
12295
+ if (positionToApply > this._getActualInputLength()) {
12296
+ positionToApply =
12297
+ el.value === this._maskService.decimalMarker && el.value.length === 1
12298
+ ? this._getActualInputLength() + 1
12299
+ : this._getActualInputLength();
12300
+ }
12301
+ if (positionToApply < 0) {
12302
+ positionToApply = 0;
12303
+ }
12304
+ el.setSelectionRange(positionToApply, positionToApply);
12305
+ this._position.set(null);
12306
+ }
12307
+ else {
12308
+ // eslint-disable-next-line no-console
12309
+ console.warn('Matcha-mask writeValue work with string | number, your current value:', typeof transformedValue);
12310
+ }
12311
+ }
12312
+ else {
12313
+ if (!this._maskValue()) {
12314
+ this.onChange(el.value);
12315
+ return;
12316
+ }
12317
+ this._maskService.applyValueChanges(el.value.length, this._justPasted(), this._code() === "Backspace" /* MaskExpression.BACKSPACE */ || this._code() === "Delete" /* MaskExpression.DELETE */);
12318
+ }
12319
+ }
12320
+ // IME starts
12321
+ onCompositionStart() {
12322
+ this._isComposing.set(true);
12323
+ }
12324
+ // IME completes
12325
+ onCompositionEnd(e) {
12326
+ this._isComposing.set(false);
12327
+ this._justPasted.set(true);
12328
+ this.onInput(e);
12329
+ }
12330
+ onBlur(e) {
12331
+ if (this._maskValue()) {
12332
+ const el = e.target;
12333
+ if (this._maskService.leadZero &&
12334
+ el.value.length > 0 &&
12335
+ typeof this._maskService.decimalMarker === 'string') {
12336
+ const maskExpression = this._maskService.maskExpression;
12337
+ const decimalMarker = this._maskService.decimalMarker;
12338
+ const suffix = this._maskService.suffix;
12339
+ const precision = Number(this._maskService.maskExpression.slice(maskExpression.length - 1, maskExpression.length));
12340
+ if (precision > 0) {
12341
+ el.value = suffix ? el.value.split(suffix).join('') : el.value;
12342
+ const decimalPart = el.value.split(decimalMarker)[1];
12343
+ el.value = el.value.includes(decimalMarker)
12344
+ ? el.value +
12345
+ "0" /* MaskExpression.NUMBER_ZERO */.repeat(precision - decimalPart.length) +
12346
+ suffix
12347
+ : el.value +
12348
+ decimalMarker +
12349
+ "0" /* MaskExpression.NUMBER_ZERO */.repeat(precision) +
12350
+ suffix;
12351
+ this._maskService.actualValue = el.value;
12352
+ }
12353
+ }
12354
+ this._maskService.clearIfNotMatchFn();
12355
+ }
12356
+ this._isFocused.set(false);
12357
+ this.onTouch();
12358
+ }
12359
+ onClick(e) {
12360
+ if (!this._maskValue()) {
12361
+ return;
12362
+ }
12363
+ const el = e.target;
12364
+ const posStart = 0;
12365
+ const posEnd = 0;
12366
+ if (el !== null &&
12367
+ el.selectionStart !== null &&
12368
+ el.selectionStart === el.selectionEnd &&
12369
+ el.selectionStart > this._maskService.prefix.length &&
12370
+ e.keyCode !== 38) {
12371
+ if (this._maskService.showMaskTyped && !this.keepCharacterPositions()) {
12372
+ // We are showing the mask in the input
12373
+ this._maskService.maskIsShown = this._maskService.showMaskInInput();
12374
+ if (el.setSelectionRange &&
12375
+ this._maskService.prefix + this._maskService.maskIsShown === el.value) {
12376
+ // the input ONLY contains the mask, so position the cursor at the start
12377
+ el.focus();
12378
+ el.setSelectionRange(posStart, posEnd);
12379
+ }
12380
+ else {
12381
+ // the input contains some characters already
12382
+ if (el.selectionStart > this._maskService.actualValue.length) {
12383
+ // if the user clicked beyond our value's length, position the cursor at the end of our value
12384
+ el.setSelectionRange(this._maskService.actualValue.length, this._maskService.actualValue.length);
12385
+ }
12386
+ }
12387
+ }
12388
+ }
12389
+ const nextValue = el &&
12390
+ (el.value === this._maskService.prefix
12391
+ ? this._maskService.prefix + this._maskService.maskIsShown
12392
+ : el.value);
12393
+ /** Fix of cursor position jumping to end in most browsers no matter where cursor is inserted onFocus */
12394
+ if (el && el.value !== nextValue) {
12395
+ el.value = nextValue;
12396
+ }
12397
+ /** fix of cursor position with prefix when mouse click occur */
12398
+ if (el &&
12399
+ el.type !== 'number' &&
12400
+ (el.selectionStart || el.selectionEnd) <=
12401
+ this._maskService.prefix.length) {
12402
+ const specialCharactersAtTheStart = this._maskService.maskExpression.match(new RegExp(`^[${this._maskService.specialCharacters.map((c) => `\\${c}`).join('')}]+`))?.[0].length || 0;
12403
+ el.selectionStart = this._maskService.prefix.length + specialCharactersAtTheStart;
12404
+ return;
12405
+ }
12406
+ /** select only inserted text */
12407
+ if (el && el.selectionEnd > this._getActualInputLength()) {
12408
+ el.selectionEnd = this._getActualInputLength();
12409
+ }
12410
+ }
12411
+ onKeyDown(e) {
12412
+ if (!this._maskValue()) {
12413
+ return;
12414
+ }
12415
+ if (this._isComposing()) {
12416
+ // User finalize their choice from IME composition, so trigger onInput() for the composed text.
12417
+ if (e.key === 'Enter') {
12418
+ this.onCompositionEnd(e);
12419
+ }
12420
+ return;
12421
+ }
12422
+ this._code.set(e.code ? e.code : e.key);
12423
+ const el = e.target;
12424
+ this._inputValue.set(el.value);
12425
+ this._setMask();
12426
+ if (el.type !== 'number') {
12427
+ if (e.key === "ArrowUp" /* MaskExpression.ARROW_UP */) {
12428
+ e.preventDefault();
12429
+ }
12430
+ if (e.key === "ArrowLeft" /* MaskExpression.ARROW_LEFT */ ||
12431
+ e.key === "Backspace" /* MaskExpression.BACKSPACE */ ||
12432
+ e.key === "Delete" /* MaskExpression.DELETE */) {
12433
+ if (e.key === "Backspace" /* MaskExpression.BACKSPACE */ && el.value.length === 0) {
12434
+ el.selectionStart = el.selectionEnd;
12435
+ }
12436
+ if (e.key === "Backspace" /* MaskExpression.BACKSPACE */ && el.selectionStart !== 0) {
12437
+ const prefixLength = this.prefix().length;
12438
+ // If specialChars is false, (shouldn't ever happen) then set to the defaults
12439
+ const specialCharacters = this.specialCharacters().length
12440
+ ? this.specialCharacters()
12441
+ : this._config.specialCharacters;
12442
+ if (prefixLength > 1 && el.selectionStart <= prefixLength) {
12443
+ el.setSelectionRange(prefixLength, el.selectionEnd);
12444
+ }
12445
+ else {
12446
+ if (this._inputValue().length !== el.selectionStart &&
12447
+ el.selectionStart !== 1) {
12448
+ while (specialCharacters.includes((this._inputValue()[el.selectionStart - 1] ??
12449
+ "" /* MaskExpression.EMPTY_STRING */).toString()) &&
12450
+ ((prefixLength >= 1 &&
12451
+ el.selectionStart > prefixLength) ||
12452
+ prefixLength === 0)) {
12453
+ el.setSelectionRange(el.selectionStart - 1, el.selectionEnd);
12454
+ }
12455
+ }
12456
+ }
12457
+ }
12458
+ this.checkSelectionOnDeletion(el);
12459
+ if (this._maskService.prefix.length &&
12460
+ el.selectionStart <= this._maskService.prefix.length &&
12461
+ el.selectionEnd <= this._maskService.prefix.length) {
12462
+ e.preventDefault();
12463
+ }
12464
+ const cursorStart = el.selectionStart;
12465
+ if (e.key === "Backspace" /* MaskExpression.BACKSPACE */ &&
12466
+ !el.readOnly &&
12467
+ cursorStart === 0 &&
12468
+ el.selectionEnd === el.value.length &&
12469
+ el.value.length !== 0) {
12470
+ this._position.set(this._maskService.prefix ? this._maskService.prefix.length : 0);
12471
+ this._maskService.applyMask(this._maskService.prefix, this._maskService.maskExpression, this._position());
12472
+ }
12473
+ }
12474
+ if (!!this.suffix() &&
12475
+ this.suffix().length > 1 &&
12476
+ this._inputValue().length - this.suffix().length < el.selectionStart) {
12477
+ el.setSelectionRange(this._inputValue().length - this.suffix().length, this._inputValue().length);
12478
+ }
12479
+ else if ((e.code === 'KeyA' && e.ctrlKey) ||
12480
+ (e.code === 'KeyA' && e.metaKey) // Cmd + A (Mac)
12481
+ ) {
12482
+ el.setSelectionRange(0, this._getActualInputLength());
12483
+ e.preventDefault();
12484
+ }
12485
+ this._maskService.selStart = el.selectionStart;
12486
+ this._maskService.selEnd = el.selectionEnd;
12487
+ }
12488
+ }
12489
+ /** It writes the value in the input */
12490
+ async writeValue(controlValue) {
12491
+ let value = controlValue;
12492
+ const inputTransformFn = this._maskService.inputTransformFn;
12493
+ if (typeof value === 'object' && value !== null && 'value' in value) {
12494
+ if ('disable' in value) {
12495
+ this.setDisabledState(Boolean(value.disable));
12496
+ }
12497
+ value = value.value;
12498
+ }
12499
+ if (value !== null) {
12500
+ value = inputTransformFn ? inputTransformFn(value) : value;
12501
+ }
12502
+ if (typeof value === 'string' ||
12503
+ typeof value === 'number' ||
12504
+ value === null ||
12505
+ typeof value === 'undefined') {
12506
+ if (value === null || typeof value === 'undefined' || value === '') {
12507
+ this._maskService.currentValue = '';
12508
+ this._maskService.previousValue = '';
12509
+ }
12510
+ let inputValue = value;
12511
+ if (typeof inputValue === 'number' ||
12512
+ this._maskValue().startsWith("separator" /* MaskExpression.SEPARATOR */)) {
12513
+ inputValue = String(inputValue);
12514
+ const localeDecimalMarker = this._maskService.currentLocaleDecimalMarker();
12515
+ if (!Array.isArray(this._maskService.decimalMarker)) {
12516
+ inputValue =
12517
+ this._maskService.decimalMarker !== localeDecimalMarker
12518
+ ? inputValue.replace(localeDecimalMarker, this._maskService.decimalMarker)
12519
+ : inputValue;
12520
+ }
12521
+ if (this._maskService.leadZero &&
12522
+ inputValue &&
12523
+ this.mask() &&
12524
+ this.dropSpecialCharacters() !== false) {
12525
+ inputValue = this._maskService._checkPrecision(this._maskService.maskExpression, inputValue);
12526
+ }
12527
+ if (this._maskService.decimalMarker === "," /* MaskExpression.COMMA */ ||
12528
+ (Array.isArray(this._maskService.decimalMarker) &&
12529
+ this._maskService.thousandSeparator === "." /* MaskExpression.DOT */)) {
12530
+ inputValue = inputValue
12531
+ .toString()
12532
+ .replace("." /* MaskExpression.DOT */, "," /* MaskExpression.COMMA */);
12533
+ }
12534
+ if (this.mask()?.startsWith("separator" /* MaskExpression.SEPARATOR */) && this.leadZero()) {
12535
+ requestAnimationFrame(() => {
12536
+ this._maskService.applyMask(inputValue?.toString() ?? '', this._maskService.maskExpression);
12537
+ });
12538
+ }
12539
+ this._maskService.isNumberValue = true;
12540
+ }
12541
+ if (typeof inputValue !== 'string' || value === null || typeof value === 'undefined') {
12542
+ inputValue = '';
12543
+ }
12544
+ this._inputValue.set(inputValue);
12545
+ this._setMask();
12546
+ if ((inputValue && this._maskService.maskExpression) ||
12547
+ (this._maskService.maskExpression &&
12548
+ (this._maskService.prefix || this._maskService.showMaskTyped))) {
12549
+ // Let the service we know we are writing value so that triggering onChange function won't happen during applyMask
12550
+ this._maskService.writingValue = true;
12551
+ this._maskService.formElementProperty = [
12552
+ 'value',
12553
+ this._maskService.applyMask(inputValue, this._maskService.maskExpression),
12554
+ ];
12555
+ // Let the service know we've finished writing value
12556
+ this._maskService.writingValue = false;
12557
+ }
12558
+ else {
12559
+ this._maskService.formElementProperty = ['value', inputValue];
12560
+ }
12561
+ this._inputValue.set(inputValue);
12562
+ }
12563
+ else {
12564
+ // eslint-disable-next-line no-console
12565
+ console.warn('Matcha-mask writeValue work with string | number, your current value:', typeof value);
12566
+ }
12567
+ }
12568
+ registerOnChange(fn) {
12569
+ this._maskService.onChange = this.onChange = fn;
12570
+ }
12571
+ registerOnTouched(fn) {
12572
+ this.onTouch = fn;
12573
+ }
12574
+ _getActiveElement(document = this.document) {
12575
+ const shadowRootEl = document?.activeElement?.shadowRoot;
12576
+ if (!shadowRootEl?.activeElement) {
12577
+ return document.activeElement;
12578
+ }
12579
+ else {
12580
+ return this._getActiveElement(shadowRootEl);
12581
+ }
12582
+ }
12583
+ checkSelectionOnDeletion(el) {
12584
+ const prefixLength = this.prefix().length;
12585
+ const suffixLength = this.suffix().length;
12586
+ const inputValueLength = this._inputValue().length;
12587
+ el.selectionStart = Math.min(Math.max(prefixLength, el.selectionStart), inputValueLength - suffixLength);
12588
+ el.selectionEnd = Math.min(Math.max(prefixLength, el.selectionEnd), inputValueLength - suffixLength);
12589
+ }
12590
+ /** It disables the input element */
12591
+ setDisabledState(isDisabled) {
12592
+ this._maskService.formElementProperty = ['disabled', isDisabled];
12593
+ }
12594
+ _applyMask() {
12595
+ this._maskService.maskExpression = this._maskService._repeatPatternSymbols(this._maskValue() || '');
12596
+ this._maskService.formElementProperty = [
12597
+ 'value',
12598
+ this._maskService.applyMask(this._inputValue(), this._maskService.maskExpression),
12599
+ ];
12600
+ }
12601
+ _validateTime(value) {
12602
+ const rowMaskLen = this._maskValue()
12603
+ .split("" /* MaskExpression.EMPTY_STRING */)
12604
+ .filter((s) => s !== ':').length;
12605
+ if (!value) {
12606
+ return null; // Don't validate empty values to allow for optional form control
12607
+ }
12608
+ if ((+(value[value.length - 1] ?? -1) === 0 && value.length < rowMaskLen) ||
12609
+ value.length <= rowMaskLen - 2) {
12610
+ return this._createValidationError(value);
12611
+ }
12612
+ return null;
12613
+ }
12614
+ _getActualInputLength() {
12615
+ return (this._maskService.actualValue.length ||
12616
+ this._maskService.actualValue.length + this._maskService.prefix.length);
12617
+ }
12618
+ _createValidationError(actualValue) {
12619
+ return {
12620
+ mask: {
12621
+ requiredMask: this._maskValue(),
12622
+ actualValue,
12623
+ },
12624
+ };
12625
+ }
12626
+ _setMask() {
12627
+ this._maskExpressionArray().some((mask) => {
12628
+ const specialChart = mask
12629
+ .split("" /* MaskExpression.EMPTY_STRING */)
12630
+ .some((char) => this._maskService.specialCharacters.includes(char));
12631
+ if ((specialChart &&
12632
+ this._inputValue() &&
12633
+ this._areAllCharactersInEachStringSame(this._maskExpressionArray())) ||
12634
+ mask.includes("{" /* MaskExpression.CURLY_BRACKETS_LEFT */)) {
12635
+ const test = this._maskService.removeMask(this._inputValue())?.length <=
12636
+ this._maskService.removeMask(mask)?.length;
12637
+ if (test) {
12638
+ const maskValue = mask.includes("{" /* MaskExpression.CURLY_BRACKETS_LEFT */)
12639
+ ? this._maskService._repeatPatternSymbols(mask)
12640
+ : mask;
12641
+ this._maskValue.set(maskValue);
12642
+ this._maskService.maskExpression = maskValue;
12643
+ return test;
12644
+ }
12645
+ else {
12646
+ const expression = this._maskExpressionArray()[this._maskExpressionArray().length - 1] ??
12647
+ "" /* MaskExpression.EMPTY_STRING */;
12648
+ const maskValue = expression.includes("{" /* MaskExpression.CURLY_BRACKETS_LEFT */)
12649
+ ? this._maskService._repeatPatternSymbols(expression)
12650
+ : expression;
12651
+ this._maskValue.set(maskValue);
12652
+ this._maskService.maskExpression = maskValue;
12653
+ }
12654
+ }
12655
+ else {
12656
+ const cleanMask = this._maskService.removeMask(mask);
12657
+ const check = this._maskService
12658
+ .removeMask(this._inputValue())
12659
+ ?.split("" /* MaskExpression.EMPTY_STRING */)
12660
+ .every((character, index) => {
12661
+ const indexMask = cleanMask.charAt(index);
12662
+ return this._maskService._checkSymbolMask(character, indexMask);
12663
+ });
12664
+ if (check || this._justPasted()) {
12665
+ this._maskValue.set(mask);
12666
+ this._maskService.maskExpression = mask;
12667
+ return check;
12668
+ }
12669
+ }
12670
+ });
12671
+ }
12672
+ _areAllCharactersInEachStringSame(array) {
12673
+ const specialCharacters = this._maskService.specialCharacters;
12674
+ function removeSpecialCharacters(str) {
12675
+ const regex = new RegExp(`[${specialCharacters.map((ch) => `\\${ch}`).join('')}]`, 'g');
12676
+ return str.replace(regex, '');
12677
+ }
12678
+ const processedArr = array.map(removeSpecialCharacters);
12679
+ return processedArr.every((str) => {
12680
+ const uniqueCharacters = new Set(str);
12681
+ return uniqueCharacters.size === 1;
12682
+ });
12683
+ }
12684
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaMaskDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
12685
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.0", type: MatchaMaskDirective, isStandalone: false, selector: "input[mask], textarea[mask]", inputs: { mask: { classPropertyName: "mask", publicName: "mask", isSignal: true, isRequired: false, transformFunction: null }, specialCharacters: { classPropertyName: "specialCharacters", publicName: "specialCharacters", isSignal: true, isRequired: false, transformFunction: null }, patterns: { classPropertyName: "patterns", publicName: "patterns", isSignal: true, isRequired: false, transformFunction: null }, prefix: { classPropertyName: "prefix", publicName: "prefix", isSignal: true, isRequired: false, transformFunction: null }, suffix: { classPropertyName: "suffix", publicName: "suffix", isSignal: true, isRequired: false, transformFunction: null }, thousandSeparator: { classPropertyName: "thousandSeparator", publicName: "thousandSeparator", isSignal: true, isRequired: false, transformFunction: null }, decimalMarker: { classPropertyName: "decimalMarker", publicName: "decimalMarker", isSignal: true, isRequired: false, transformFunction: null }, dropSpecialCharacters: { classPropertyName: "dropSpecialCharacters", publicName: "dropSpecialCharacters", isSignal: true, isRequired: false, transformFunction: null }, hiddenInput: { classPropertyName: "hiddenInput", publicName: "hiddenInput", isSignal: true, isRequired: false, transformFunction: null }, showMaskTyped: { classPropertyName: "showMaskTyped", publicName: "showMaskTyped", isSignal: true, isRequired: false, transformFunction: null }, placeHolderCharacter: { classPropertyName: "placeHolderCharacter", publicName: "placeHolderCharacter", isSignal: true, isRequired: false, transformFunction: null }, shownMaskExpression: { classPropertyName: "shownMaskExpression", publicName: "shownMaskExpression", isSignal: true, isRequired: false, transformFunction: null }, clearIfNotMatch: { classPropertyName: "clearIfNotMatch", publicName: "clearIfNotMatch", isSignal: true, isRequired: false, transformFunction: null }, validation: { classPropertyName: "validation", publicName: "validation", isSignal: true, isRequired: false, transformFunction: null }, separatorLimit: { classPropertyName: "separatorLimit", publicName: "separatorLimit", isSignal: true, isRequired: false, transformFunction: null }, allowNegativeNumbers: { classPropertyName: "allowNegativeNumbers", publicName: "allowNegativeNumbers", isSignal: true, isRequired: false, transformFunction: null }, leadZeroDateTime: { classPropertyName: "leadZeroDateTime", publicName: "leadZeroDateTime", isSignal: true, isRequired: false, transformFunction: null }, leadZero: { classPropertyName: "leadZero", publicName: "leadZero", isSignal: true, isRequired: false, transformFunction: null }, triggerOnMaskChange: { classPropertyName: "triggerOnMaskChange", publicName: "triggerOnMaskChange", isSignal: true, isRequired: false, transformFunction: null }, apm: { classPropertyName: "apm", publicName: "apm", isSignal: true, isRequired: false, transformFunction: null }, inputTransformFn: { classPropertyName: "inputTransformFn", publicName: "inputTransformFn", isSignal: true, isRequired: false, transformFunction: null }, outputTransformFn: { classPropertyName: "outputTransformFn", publicName: "outputTransformFn", isSignal: true, isRequired: false, transformFunction: null }, keepCharacterPositions: { classPropertyName: "keepCharacterPositions", publicName: "keepCharacterPositions", isSignal: true, isRequired: false, transformFunction: null }, instantPrefix: { classPropertyName: "instantPrefix", publicName: "instantPrefix", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { maskFilled: "maskFilled" }, host: { listeners: { "paste": "onPaste()", "focus": "onFocus($event)", "ngModelChange": "onModelChange($event)", "input": "onInput($event)", "compositionstart": "onCompositionStart($event)", "compositionend": "onCompositionEnd($event)", "blur": "onBlur($event)", "click": "onClick($event)", "keydown": "onKeyDown($event)" } }, providers: [
12686
+ {
12687
+ provide: NG_VALUE_ACCESSOR,
12688
+ useExisting: forwardRef(() => MatchaMaskDirective),
12689
+ multi: true,
12690
+ },
12691
+ {
12692
+ provide: NG_VALIDATORS,
12693
+ useExisting: forwardRef(() => MatchaMaskDirective),
12694
+ multi: true,
12695
+ },
12696
+ MatchaMaskService,
12697
+ ], exportAs: ["mask", "matchaMask"], usesOnChanges: true, ngImport: i0 }); }
12698
+ }
12699
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaMaskDirective, decorators: [{
12161
12700
  type: Directive,
12162
12701
  args: [{
12163
- selector: '[matchaDragHandle]',
12164
- standalone: false
12165
- }]
12166
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: MatchaDragDirective }], propDecorators: { dragHandleClass: [{
12167
- type: HostBinding,
12168
- args: ['class.matcha-drag-handle']
12169
- }] } });
12170
-
12171
- class MatchaDropListModule {
12172
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaDropListModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
12173
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.0", ngImport: i0, type: MatchaDropListModule, declarations: [MatchaDropListComponent,
12174
- MatchaDragDirective,
12175
- MatchaDragHandleDirective], imports: [CommonModule], exports: [MatchaDropListComponent,
12176
- MatchaDragDirective,
12177
- MatchaDragHandleDirective] }); }
12178
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaDropListModule, providers: [
12179
- MatchaDropListService
12180
- ], imports: [CommonModule] }); }
12181
- }
12182
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaDropListModule, decorators: [{
12183
- type: NgModule,
12184
- args: [{
12185
- declarations: [
12186
- MatchaDropListComponent,
12187
- MatchaDragDirective,
12188
- MatchaDragHandleDirective
12189
- ],
12190
- imports: [
12191
- CommonModule
12192
- ],
12193
- exports: [
12194
- MatchaDropListComponent,
12195
- MatchaDragDirective,
12196
- MatchaDragHandleDirective
12197
- ],
12702
+ selector: 'input[mask], textarea[mask]',
12703
+ standalone: false,
12198
12704
  providers: [
12199
- MatchaDropListService
12200
- ]
12705
+ {
12706
+ provide: NG_VALUE_ACCESSOR,
12707
+ useExisting: forwardRef(() => MatchaMaskDirective),
12708
+ multi: true,
12709
+ },
12710
+ {
12711
+ provide: NG_VALIDATORS,
12712
+ useExisting: forwardRef(() => MatchaMaskDirective),
12713
+ multi: true,
12714
+ },
12715
+ MatchaMaskService,
12716
+ ],
12717
+ exportAs: 'mask,matchaMask',
12201
12718
  }]
12202
- }] });
12719
+ }], propDecorators: { onPaste: [{
12720
+ type: HostListener,
12721
+ args: ['paste']
12722
+ }], onFocus: [{
12723
+ type: HostListener,
12724
+ args: ['focus', ['$event']]
12725
+ }], onModelChange: [{
12726
+ type: HostListener,
12727
+ args: ['ngModelChange', ['$event']]
12728
+ }], onInput: [{
12729
+ type: HostListener,
12730
+ args: ['input', ['$event']]
12731
+ }], onCompositionStart: [{
12732
+ type: HostListener,
12733
+ args: ['compositionstart', ['$event']]
12734
+ }], onCompositionEnd: [{
12735
+ type: HostListener,
12736
+ args: ['compositionend', ['$event']]
12737
+ }], onBlur: [{
12738
+ type: HostListener,
12739
+ args: ['blur', ['$event']]
12740
+ }], onClick: [{
12741
+ type: HostListener,
12742
+ args: ['click', ['$event']]
12743
+ }], onKeyDown: [{
12744
+ type: HostListener,
12745
+ args: ['keydown', ['$event']]
12746
+ }] } });
12203
12747
 
12204
12748
  class MatchaMaskPipe {
12205
12749
  constructor() {
@@ -12357,169 +12901,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImpor
12357
12901
  }]
12358
12902
  }] });
12359
12903
 
12360
- class MatchaInputPhoneModule {
12361
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaInputPhoneModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
12362
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.0", ngImport: i0, type: MatchaInputPhoneModule, declarations: [MatchaInputPhoneComponent], imports: [CommonModule,
12363
- MatchaFormFieldModule,
12364
- FormsModule,
12365
- MatchaMaskModule], exports: [MatchaInputPhoneComponent] }); }
12366
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaInputPhoneModule, providers: [MatchaMaskModule], imports: [CommonModule,
12367
- MatchaFormFieldModule,
12368
- FormsModule,
12369
- MatchaMaskModule] }); }
12370
- }
12371
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaInputPhoneModule, decorators: [{
12372
- type: NgModule,
12373
- args: [{
12374
- declarations: [MatchaInputPhoneComponent],
12375
- imports: [
12376
- CommonModule,
12377
- MatchaFormFieldModule,
12378
- FormsModule,
12379
- MatchaMaskModule,
12380
- ],
12381
- exports: [MatchaInputPhoneComponent],
12382
- providers: [MatchaMaskModule],
12383
- }]
12384
- }] });
12385
-
12386
- class MatchaPageLayoutModule {
12387
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaPageLayoutModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
12388
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.0", ngImport: i0, type: MatchaPageLayoutModule, declarations: [MatchaPageLayoutComponent], imports: [CommonModule,
12389
- MatchaStepperModule], exports: [MatchaPageLayoutComponent] }); }
12390
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaPageLayoutModule, imports: [CommonModule,
12391
- MatchaStepperModule] }); }
12392
- }
12393
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaPageLayoutModule, decorators: [{
12394
- type: NgModule,
12395
- args: [{
12396
- declarations: [
12397
- MatchaPageLayoutComponent
12398
- ],
12399
- imports: [
12400
- CommonModule,
12401
- MatchaStepperModule
12402
- ],
12403
- exports: [
12404
- MatchaPageLayoutComponent
12405
- ]
12406
- }]
12407
- }] });
12408
-
12409
- class MatchaRadioModule {
12410
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaRadioModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
12411
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.0", ngImport: i0, type: MatchaRadioModule, declarations: [MatchaRadioComponent], imports: [CommonModule, MatchaRippleModule], exports: [MatchaRadioComponent] }); }
12412
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaRadioModule, imports: [CommonModule, MatchaRippleModule] }); }
12413
- }
12414
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaRadioModule, decorators: [{
12415
- type: NgModule,
12416
- args: [{
12417
- declarations: [
12418
- MatchaRadioComponent,
12419
- ],
12420
- imports: [CommonModule, MatchaRippleModule],
12421
- exports: [
12422
- MatchaRadioComponent,
12423
- ],
12424
- }]
12425
- }] });
12426
-
12427
- class MatchaAvatarModule {
12428
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaAvatarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
12429
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.0", ngImport: i0, type: MatchaAvatarModule, declarations: [MatchaAvatarComponent], imports: [CommonModule], exports: [MatchaAvatarComponent] }); }
12430
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaAvatarModule, imports: [CommonModule] }); }
12431
- }
12432
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaAvatarModule, decorators: [{
12433
- type: NgModule,
12434
- args: [{
12435
- declarations: [MatchaAvatarComponent],
12436
- imports: [
12437
- CommonModule
12438
- ],
12439
- exports: [MatchaAvatarComponent]
12440
- }]
12441
- }] });
12442
-
12443
- class MatchaDrawerModule {
12444
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaDrawerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
12445
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.0", ngImport: i0, type: MatchaDrawerModule, declarations: [MatchaDrawerComponent,
12446
- MatchaDrawerContainerComponent,
12447
- MatchaDrawerContentComponent], imports: [CommonModule,
12448
- MatchaButtonModule], exports: [MatchaDrawerComponent,
12449
- MatchaDrawerContainerComponent,
12450
- MatchaDrawerContentComponent] }); }
12451
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaDrawerModule, providers: [
12452
- MatchaBreakpointObserver
12453
- ], imports: [CommonModule,
12454
- MatchaButtonModule] }); }
12455
- }
12456
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaDrawerModule, decorators: [{
12457
- type: NgModule,
12458
- args: [{
12459
- declarations: [
12460
- MatchaDrawerComponent,
12461
- MatchaDrawerContainerComponent,
12462
- MatchaDrawerContentComponent
12463
- ],
12464
- imports: [
12465
- CommonModule,
12466
- MatchaButtonModule
12467
- ],
12468
- providers: [
12469
- MatchaBreakpointObserver
12470
- ],
12471
- exports: [
12472
- MatchaDrawerComponent,
12473
- MatchaDrawerContainerComponent,
12474
- MatchaDrawerContentComponent
12475
- ]
12476
- }]
12477
- }] });
12478
-
12479
- // Prism.js será carregado dinamicamente no componente quando necessário
12480
- class MatchaHighlightModule {
12481
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaHighlightModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
12482
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.0", ngImport: i0, type: MatchaHighlightModule, declarations: [MatchaHighlightComponent,
12483
- CopyButtonComponent], imports: [MatchaIconModule,
12484
- MatchaButtonModule], exports: [MatchaHighlightComponent,
12485
- CopyButtonComponent] }); }
12486
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaHighlightModule, imports: [MatchaIconModule,
12487
- MatchaButtonModule] }); }
12488
- }
12489
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaHighlightModule, decorators: [{
12490
- type: NgModule,
12491
- args: [{
12492
- declarations: [
12493
- MatchaHighlightComponent,
12494
- CopyButtonComponent
12495
- ],
12496
- imports: [
12497
- MatchaIconModule,
12498
- MatchaButtonModule
12499
- ],
12500
- exports: [
12501
- MatchaHighlightComponent,
12502
- CopyButtonComponent
12503
- ],
12504
- }]
12505
- }] });
12506
-
12507
- class MatchaSliderModule {
12508
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaSliderModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
12509
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.0", ngImport: i0, type: MatchaSliderModule, declarations: [MatchaSliderComponent], imports: [CommonModule, FormsModule], exports: [MatchaSliderComponent] }); }
12510
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaSliderModule, imports: [CommonModule, FormsModule] }); }
12511
- }
12512
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaSliderModule, decorators: [{
12513
- type: NgModule,
12514
- args: [{
12515
- declarations: [MatchaSliderComponent],
12516
- imports: [
12517
- CommonModule, FormsModule
12518
- ],
12519
- exports: [MatchaSliderComponent]
12520
- }]
12521
- }] });
12522
-
12523
12904
  class MatchaComponentsModule {
12524
12905
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaComponentsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
12525
12906
  static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.0", ngImport: i0, type: MatchaComponentsModule, declarations: [MatchaOverflowDraggableComponent], imports: [CommonModule,
@@ -12890,5 +13271,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImpor
12890
13271
  * Generated bundle index. Do not edit.
12891
13272
  */
12892
13273
 
12893
- export { CopyButtonComponent, INITIAL_CONFIG, MATCHA_MASK_CONFIG, MATCHA_OPTION_PARENT, MatchaAccordionComponent, MatchaAccordionContentComponent, MatchaAccordionHeaderComponent, MatchaAccordionItemComponent, MatchaAccordionModule, MatchaAutocompleteComponent, MatchaAutocompleteModule, MatchaAutocompleteTriggerDirective, MatchaAvatarComponent, MatchaAvatarModule, MatchaBadgeDirective, MatchaBadgeModule, MatchaBreakpointObservableModule, MatchaBreakpointObserver, MatchaButtonComponent, MatchaButtonModule, MatchaButtonToggleComponent, MatchaButtonToggleModule, MatchaCardComponent, MatchaCardModule, MatchaCheckboxComponent, MatchaCheckboxModule, MatchaComponentsModule, MatchaDateRangeComponent, MatchaDateRangeModule, MatchaDividerComponent, MatchaDividerModule, MatchaDragDirective, MatchaDragHandleDirective, MatchaDrawerComponent, MatchaDrawerContainerComponent, MatchaDrawerContentComponent, MatchaDrawerModule, MatchaDropListComponent, MatchaDropListModule, MatchaElevationDirective, MatchaElevationModule, MatchaErrorComponent, MatchaFormFieldComponent, MatchaFormFieldModule, MatchaGridComponent, MatchaGridModule, MatchaHighlightComponent, MatchaHighlightModule, MatchaHintTextComponent, MatchaHintTextModule, MatchaIconComponent, MatchaIconModule, MatchaInfiniteScrollComponent, MatchaInfiniteScrollDataComponent, MatchaInfiniteScrollModule, MatchaInputDirective, MatchaInputModule, MatchaInputPhoneComponent, MatchaInputPhoneModule, MatchaLabelComponent, MatchaLazyloadComponent, MatchaLazyloadDataComponent, MatchaLazyloadModule, MatchaMaskApplierService, MatchaMaskDirective, MatchaMaskModule, MatchaMaskPipe, MatchaMaskService, MatchaMasonryComponent, MatchaMasonryModule, MatchaMenuComponent, MatchaMenuModule, MatchaMenuTriggerForDirective, MatchaModalComponent, MatchaModalContentComponent, MatchaModalFooterComponent, MatchaModalHeaderComponent, MatchaModalModule, MatchaModalOptionsComponent, MatchaModalService, MatchaOptionComponent, MatchaOptionModule, MatchaOverlayService, MatchaPageLayoutComponent, MatchaPageLayoutModule, MatchaPaginatorComponent, MatchaPaginatorIntl, MatchaPaginatorModule, MatchaPanelComponent, MatchaPanelModule, MatchaProgressBarDirective, MatchaProgressBarModule, MatchaRadioComponent, MatchaRadioModule, MatchaRippleDirective, MatchaRippleModule, MatchaSelectComponent, MatchaSelectModule, MatchaSelectTriggerDirective, MatchaSidenavDirective, MatchaSidenavModule, MatchaSkeletonComponent, MatchaSkeletonModule, MatchaSlideToggleComponent, MatchaSlideToggleModule, MatchaSliderComponent, MatchaSliderModule, MatchaSnackBarDirective, MatchaSnackBarModule, MatchaSortHeaderDirective, MatchaSortHeaderModule, MatchaSpinComponent, MatchaSpinModule, MatchaSpinnerComponent, MatchaSpinnerModule, MatchaStepperComponent, MatchaStepperContentComponent, MatchaStepperControllerComponent, MatchaStepperModule, MatchaStepperStateService, MatchaTabItemComponent, MatchaTableDirective, MatchaTableModule, MatchaTabsComponent, MatchaTabsModule, MatchaTimeComponent, MatchaTimeModule, MatchaTitleComponent, MatchaTitleModule, MatchaToolbarButtonComponent, MatchaToolbarComponent, MatchaToolbarContentComponent, MatchaToolbarCustomButtonComponent, MatchaToolbarMainButtonComponent, MatchaToolbarModule, MatchaTooltipDirective, MatchaTooltipModule, NEW_CONFIG, NextStepDirective, PrevStepDirective, StepComponent, StepContentDirective, initialConfig, options, timeMasks, withoutValidation };
13274
+ export { CopyButtonComponent, INITIAL_CONFIG, MATCHA_MASK_CONFIG, MATCHA_OPTION_PARENT, MatchaAccordionComponent, MatchaAccordionContentComponent, MatchaAccordionHeaderComponent, MatchaAccordionItemComponent, MatchaAccordionModule, MatchaAutocompleteComponent, MatchaAutocompleteModule, MatchaAutocompleteTriggerDirective, MatchaAvatarComponent, MatchaAvatarModule, MatchaBadgeDirective, MatchaBadgeModule, MatchaBreakpointObservableModule, MatchaBreakpointObserver, MatchaButtonComponent, MatchaButtonModule, MatchaButtonToggleComponent, MatchaButtonToggleModule, MatchaCardComponent, MatchaCardModule, MatchaCheckboxComponent, MatchaCheckboxModule, MatchaComponentsModule, MatchaDateRangeComponent, MatchaDateRangeModule, MatchaDividerComponent, MatchaDividerModule, MatchaDragDirective, MatchaDragHandleDirective, MatchaDrawerComponent, MatchaDrawerContainerComponent, MatchaDrawerContentComponent, MatchaDrawerModule, MatchaDropListComponent, MatchaDropListModule, MatchaElevationDirective, MatchaElevationModule, MatchaErrorComponent, MatchaFormFieldComponent, MatchaFormFieldModule, MatchaGridComponent, MatchaGridModule, MatchaHighlightComponent, MatchaHighlightModule, MatchaHintTextComponent, MatchaHintTextModule, MatchaIconComponent, MatchaIconModule, MatchaInfiniteScrollComponent, MatchaInfiniteScrollDataComponent, MatchaInfiniteScrollModule, MatchaInputDirective, MatchaInputModule, MatchaInputPhoneComponent, MatchaInputPhoneModule, MatchaLabelComponent, MatchaLazyloadComponent, MatchaLazyloadDataComponent, MatchaLazyloadModule, MatchaMaskApplierService, MatchaMaskCompatibleDirective, MatchaMaskCompatibleModule, MatchaMaskDirective, MatchaMaskModule, MatchaMaskPipe, MatchaMaskService, MatchaMasonryComponent, MatchaMasonryModule, MatchaMenuComponent, MatchaMenuModule, MatchaMenuTriggerForDirective, MatchaModalComponent, MatchaModalContentComponent, MatchaModalFooterComponent, MatchaModalHeaderComponent, MatchaModalModule, MatchaModalOptionsComponent, MatchaModalService, MatchaOptionComponent, MatchaOptionModule, MatchaOverlayService, MatchaPageLayoutComponent, MatchaPageLayoutModule, MatchaPaginatorComponent, MatchaPaginatorIntl, MatchaPaginatorModule, MatchaPanelComponent, MatchaPanelModule, MatchaProgressBarDirective, MatchaProgressBarModule, MatchaRadioComponent, MatchaRadioModule, MatchaRippleDirective, MatchaRippleModule, MatchaSelectComponent, MatchaSelectModule, MatchaSelectTriggerDirective, MatchaSidenavDirective, MatchaSidenavModule, MatchaSkeletonComponent, MatchaSkeletonModule, MatchaSlideToggleComponent, MatchaSlideToggleModule, MatchaSliderComponent, MatchaSliderModule, MatchaSnackBarDirective, MatchaSnackBarModule, MatchaSortHeaderDirective, MatchaSortHeaderModule, MatchaSpinComponent, MatchaSpinModule, MatchaSpinnerComponent, MatchaSpinnerModule, MatchaStepperComponent, MatchaStepperContentComponent, MatchaStepperControllerComponent, MatchaStepperModule, MatchaStepperStateService, MatchaTabItemComponent, MatchaTableDirective, MatchaTableModule, MatchaTabsComponent, MatchaTabsModule, MatchaTimeComponent, MatchaTimeModule, MatchaTitleComponent, MatchaTitleModule, MatchaToolbarButtonComponent, MatchaToolbarComponent, MatchaToolbarContentComponent, MatchaToolbarCustomButtonComponent, MatchaToolbarMainButtonComponent, MatchaToolbarModule, MatchaTooltipDirective, MatchaTooltipModule, NEW_CONFIG, NextStepDirective, PrevStepDirective, StepComponent, StepContentDirective, compatibleOptions, initialConfig, options, timeMasks, withoutValidation };
12894
13275
  //# sourceMappingURL=matcha-components.mjs.map