matcha-components 20.136.0 → 20.142.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, ViewEncapsulation, ChangeDetectionStrategy, HostListener, ContentChild, Directive, forwardRef, ViewChild, InjectionToken, inject, Injectable, TemplateRef, Optional, NgModule, createComponent, PLATFORM_ID, Pipe } from '@angular/core';
2
+ import { EventEmitter, Output, HostBinding, Input, Component, ContentChildren, ElementRef, Renderer2, Inject, ViewEncapsulation, ChangeDetectionStrategy, HostListener, ContentChild, Directive, forwardRef, ViewChild, InjectionToken, inject, Injectable, TemplateRef, Optional, NgModule, createComponent, Pipe, PLATFORM_ID } 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, fromEvent, BehaviorSubject, of } from 'rxjs';
5
5
  import { debounceTime, takeUntil, filter, startWith, map, distinctUntilChanged } from 'rxjs/operators';
@@ -9584,31 +9584,26 @@ class MatchaPaginatorComponent {
9584
9584
  }
9585
9585
  return pages;
9586
9586
  }
9587
+ // Se tiver até 5 páginas, mostra todas
9587
9588
  if (total <= 5) {
9588
9589
  for (let i = 1; i <= total; i++) {
9589
9590
  pages.push(i);
9590
9591
  }
9591
9592
  }
9592
9593
  else {
9593
- if (current <= 3) {
9594
+ // Janela deslizante: sempre mostra 3 páginas com a atual no meio
9595
+ // Exemplo: < 1 2 3 ... 999 > -> usuário clica no 3 -> < 2 3 4 ... 999 >
9596
+ if (current <= 2) {
9597
+ // Início: mostra [1, 2, 3, ..., total]
9594
9598
  pages.push(1, 2, 3, '...', total);
9595
9599
  }
9596
- else if (current >= total - 2) {
9597
- for (let i = total - 4; i <= total; i++) {
9598
- pages.push(i);
9599
- }
9600
+ else if (current >= total - 1) {
9601
+ // Final: mostra [1, ..., total-2, total-1, total]
9602
+ pages.push(1, '...', total - 2, total - 1, total);
9600
9603
  }
9601
9604
  else {
9602
- const startPage = current - 1;
9603
- for (let i = startPage; i <= current + 2 && i <= total; i++) {
9604
- pages.push(i);
9605
- }
9606
- if (current + 2 < total - 1) {
9607
- pages.push('...');
9608
- }
9609
- if (current + 2 < total) {
9610
- pages.push(total);
9611
- }
9605
+ // Meio: mostra [1, ..., current-1, current, current+1, ..., total]
9606
+ pages.push(1, '...', current - 1, current, current + 1, '...', total);
9612
9607
  }
9613
9608
  }
9614
9609
  return pages;
@@ -11777,6 +11772,105 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImpor
11777
11772
  }]
11778
11773
  }] });
11779
11774
 
11775
+ class MatchaMaskPipe {
11776
+ constructor() {
11777
+ this.defaultOptions = inject(MATCHA_MASK_CONFIG);
11778
+ this._maskService = inject(MatchaMaskService);
11779
+ this._maskExpressionArray = [];
11780
+ this.mask = '';
11781
+ }
11782
+ transform(value, mask, { patterns, ...config } = {}) {
11783
+ let processedValue = value;
11784
+ const currentConfig = {
11785
+ maskExpression: mask,
11786
+ ...this.defaultOptions,
11787
+ ...config,
11788
+ patterns: {
11789
+ ...this._maskService.patterns,
11790
+ ...patterns,
11791
+ },
11792
+ };
11793
+ Object.entries(currentConfig).forEach(([key, val]) => {
11794
+ this._maskService[key] = val;
11795
+ });
11796
+ if (mask.includes('||')) {
11797
+ const maskParts = mask.split('||');
11798
+ if (maskParts.length > 1) {
11799
+ this._maskExpressionArray = maskParts.sort((a, b) => a.length - b.length);
11800
+ this._setMask(`${processedValue}`);
11801
+ return this._maskService.applyMask(`${processedValue}`, this.mask);
11802
+ }
11803
+ else {
11804
+ this._maskExpressionArray = [];
11805
+ return this._maskService.applyMask(`${processedValue}`, this.mask);
11806
+ }
11807
+ }
11808
+ if (mask.includes("{" /* MaskExpression.CURLY_BRACKETS_LEFT */)) {
11809
+ return this._maskService.applyMask(`${processedValue}`, this._maskService._repeatPatternSymbols(mask));
11810
+ }
11811
+ if (mask.startsWith("separator" /* MaskExpression.SEPARATOR */)) {
11812
+ if (config.decimalMarker) {
11813
+ this._maskService.decimalMarker = config.decimalMarker;
11814
+ }
11815
+ if (config.thousandSeparator) {
11816
+ this._maskService.thousandSeparator = config.thousandSeparator;
11817
+ }
11818
+ if (config.leadZero) {
11819
+ this._maskService.leadZero = config.leadZero;
11820
+ }
11821
+ processedValue = String(processedValue);
11822
+ const localeDecimalMarker = this._maskService.currentLocaleDecimalMarker();
11823
+ if (!Array.isArray(this._maskService.decimalMarker)) {
11824
+ processedValue =
11825
+ this._maskService.decimalMarker !== localeDecimalMarker
11826
+ ? processedValue.replace(localeDecimalMarker, this._maskService.decimalMarker)
11827
+ : processedValue;
11828
+ }
11829
+ if (this._maskService.leadZero &&
11830
+ processedValue &&
11831
+ this._maskService.dropSpecialCharacters !== false) {
11832
+ processedValue = this._maskService._checkPrecision(mask, processedValue);
11833
+ }
11834
+ if (this._maskService.decimalMarker === "," /* MaskExpression.COMMA */) {
11835
+ processedValue = processedValue.replace("." /* MaskExpression.DOT */, "," /* MaskExpression.COMMA */);
11836
+ }
11837
+ this._maskService.isNumberValue = true;
11838
+ }
11839
+ if (processedValue === null || typeof processedValue === 'undefined') {
11840
+ return this._maskService.applyMask('', mask);
11841
+ }
11842
+ return this._maskService.applyMask(`${processedValue}`, mask);
11843
+ }
11844
+ _setMask(value) {
11845
+ if (this._maskExpressionArray.length > 0) {
11846
+ this._maskExpressionArray.some((mask) => {
11847
+ const test = this._maskService.removeMask(value)?.length <=
11848
+ this._maskService.removeMask(mask)?.length;
11849
+ if (value && test) {
11850
+ this.mask = mask;
11851
+ return test;
11852
+ }
11853
+ else {
11854
+ this.mask =
11855
+ this._maskExpressionArray[this._maskExpressionArray.length - 1] ??
11856
+ "" /* MaskExpression.EMPTY_STRING */;
11857
+ }
11858
+ });
11859
+ }
11860
+ }
11861
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaMaskPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
11862
+ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.0", ngImport: i0, type: MatchaMaskPipe, isStandalone: false, name: "matchaMask" }); }
11863
+ }
11864
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaMaskPipe, decorators: [{
11865
+ type: Pipe,
11866
+ args: [{
11867
+ // Usar 'matchaMask' para evitar conflito com o pipe 'mask' legado (ex: ngx-mask)
11868
+ name: 'matchaMask',
11869
+ pure: true,
11870
+ standalone: false,
11871
+ }]
11872
+ }] });
11873
+
11780
11874
  const compatibleOptions = {
11781
11875
  specialCharacters: ['/', '(', ')', '.', ':', '-', ' ', '+', ',', '@', '[', ']', '"', "'", '*'],
11782
11876
  patterns: {
@@ -11810,7 +11904,9 @@ const compatibleOptions = {
11810
11904
  };
11811
11905
  class MatchaMaskModule {
11812
11906
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaMaskModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
11813
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.0", ngImport: i0, type: MatchaMaskModule, declarations: [MatchaMaskCompatibleDirective], imports: [CommonModule], exports: [MatchaMaskCompatibleDirective] }); }
11907
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.0", ngImport: i0, type: MatchaMaskModule, declarations: [MatchaMaskCompatibleDirective,
11908
+ MatchaMaskPipe], imports: [CommonModule], exports: [MatchaMaskCompatibleDirective,
11909
+ MatchaMaskPipe] }); }
11814
11910
  static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaMaskModule, providers: [
11815
11911
  MatchaMaskService,
11816
11912
  { provide: MATCHA_MASK_CONFIG, useValue: compatibleOptions }
@@ -11820,13 +11916,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImpor
11820
11916
  type: NgModule,
11821
11917
  args: [{
11822
11918
  declarations: [
11823
- MatchaMaskCompatibleDirective
11919
+ MatchaMaskCompatibleDirective,
11920
+ MatchaMaskPipe
11824
11921
  ],
11825
11922
  imports: [
11826
11923
  CommonModule
11827
11924
  ],
11828
11925
  exports: [
11829
- MatchaMaskCompatibleDirective
11926
+ MatchaMaskCompatibleDirective,
11927
+ MatchaMaskPipe
11830
11928
  ],
11831
11929
  providers: [
11832
11930
  MatchaMaskService,
@@ -13534,104 +13632,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImpor
13534
13632
  }]
13535
13633
  }] });
13536
13634
 
13537
- class MatchaMaskPipe {
13538
- constructor() {
13539
- this.defaultOptions = inject(MATCHA_MASK_CONFIG);
13540
- this._maskService = inject(MatchaMaskService);
13541
- this._maskExpressionArray = [];
13542
- this.mask = '';
13543
- }
13544
- transform(value, mask, { patterns, ...config } = {}) {
13545
- let processedValue = value;
13546
- const currentConfig = {
13547
- maskExpression: mask,
13548
- ...this.defaultOptions,
13549
- ...config,
13550
- patterns: {
13551
- ...this._maskService.patterns,
13552
- ...patterns,
13553
- },
13554
- };
13555
- Object.entries(currentConfig).forEach(([key, val]) => {
13556
- this._maskService[key] = val;
13557
- });
13558
- if (mask.includes('||')) {
13559
- const maskParts = mask.split('||');
13560
- if (maskParts.length > 1) {
13561
- this._maskExpressionArray = maskParts.sort((a, b) => a.length - b.length);
13562
- this._setMask(`${processedValue}`);
13563
- return this._maskService.applyMask(`${processedValue}`, this.mask);
13564
- }
13565
- else {
13566
- this._maskExpressionArray = [];
13567
- return this._maskService.applyMask(`${processedValue}`, this.mask);
13568
- }
13569
- }
13570
- if (mask.includes("{" /* MaskExpression.CURLY_BRACKETS_LEFT */)) {
13571
- return this._maskService.applyMask(`${processedValue}`, this._maskService._repeatPatternSymbols(mask));
13572
- }
13573
- if (mask.startsWith("separator" /* MaskExpression.SEPARATOR */)) {
13574
- if (config.decimalMarker) {
13575
- this._maskService.decimalMarker = config.decimalMarker;
13576
- }
13577
- if (config.thousandSeparator) {
13578
- this._maskService.thousandSeparator = config.thousandSeparator;
13579
- }
13580
- if (config.leadZero) {
13581
- this._maskService.leadZero = config.leadZero;
13582
- }
13583
- processedValue = String(processedValue);
13584
- const localeDecimalMarker = this._maskService.currentLocaleDecimalMarker();
13585
- if (!Array.isArray(this._maskService.decimalMarker)) {
13586
- processedValue =
13587
- this._maskService.decimalMarker !== localeDecimalMarker
13588
- ? processedValue.replace(localeDecimalMarker, this._maskService.decimalMarker)
13589
- : processedValue;
13590
- }
13591
- if (this._maskService.leadZero &&
13592
- processedValue &&
13593
- this._maskService.dropSpecialCharacters !== false) {
13594
- processedValue = this._maskService._checkPrecision(mask, processedValue);
13595
- }
13596
- if (this._maskService.decimalMarker === "," /* MaskExpression.COMMA */) {
13597
- processedValue = processedValue.replace("." /* MaskExpression.DOT */, "," /* MaskExpression.COMMA */);
13598
- }
13599
- this._maskService.isNumberValue = true;
13600
- }
13601
- if (processedValue === null || typeof processedValue === 'undefined') {
13602
- return this._maskService.applyMask('', mask);
13603
- }
13604
- return this._maskService.applyMask(`${processedValue}`, mask);
13605
- }
13606
- _setMask(value) {
13607
- if (this._maskExpressionArray.length > 0) {
13608
- this._maskExpressionArray.some((mask) => {
13609
- const test = this._maskService.removeMask(value)?.length <=
13610
- this._maskService.removeMask(mask)?.length;
13611
- if (value && test) {
13612
- this.mask = mask;
13613
- return test;
13614
- }
13615
- else {
13616
- this.mask =
13617
- this._maskExpressionArray[this._maskExpressionArray.length - 1] ??
13618
- "" /* MaskExpression.EMPTY_STRING */;
13619
- }
13620
- });
13621
- }
13622
- }
13623
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaMaskPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
13624
- static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.0", ngImport: i0, type: MatchaMaskPipe, isStandalone: false, name: "mask" }); }
13625
- }
13626
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaMaskPipe, decorators: [{
13627
- type: Pipe,
13628
- args: [{
13629
- name: 'mask',
13630
- pure: true,
13631
- standalone: false,
13632
- }]
13633
- }] });
13634
-
13635
13635
  class StepContentDirective {
13636
13636
  constructor(template) {
13637
13637
  this.template = template;