matcha-components 20.278.0 → 20.279.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.
- package/fesm2022/matcha-components.mjs +64 -14
- package/fesm2022/matcha-components.mjs.map +1 -1
- package/index.d.ts +15 -1
- package/package.json +1 -1
|
@@ -1894,11 +1894,13 @@ class MatchaSelectComponent {
|
|
|
1894
1894
|
});
|
|
1895
1895
|
// Notificar a diretiva sobre a seleção
|
|
1896
1896
|
this.notifyDirectiveOfSelection(option.value);
|
|
1897
|
-
//
|
|
1898
|
-
|
|
1899
|
-
//
|
|
1897
|
+
// Notificar o Angular Forms sobre a mudança ANTES de emitir o evento:
|
|
1898
|
+
// consumidores que leem o valor atual do formulário no handler de
|
|
1899
|
+
// selectionChange precisam já enxergar o novo valor.
|
|
1900
1900
|
this.onChange(option.value);
|
|
1901
1901
|
this.onTouched();
|
|
1902
|
+
// Emitir evento de mudança de seleção (compatível com MatSelectChange)
|
|
1903
|
+
this.selectionChange.emit({ source: this, value: option.value });
|
|
1902
1904
|
// Forçar detecção de mudanças
|
|
1903
1905
|
this.cdr.detectChanges();
|
|
1904
1906
|
}
|
|
@@ -1955,11 +1957,13 @@ class MatchaSelectComponent {
|
|
|
1955
1957
|
});
|
|
1956
1958
|
// Notificar a diretiva sobre a seleção antes de fechar o painel
|
|
1957
1959
|
this.notifyDirectiveOfSelection(option.value);
|
|
1958
|
-
//
|
|
1959
|
-
|
|
1960
|
-
//
|
|
1960
|
+
// Notificar o Angular Forms sobre a mudança ANTES de emitir o evento:
|
|
1961
|
+
// consumidores que leem o valor atual do formulário no handler de
|
|
1962
|
+
// selectionChange precisam já enxergar o novo valor.
|
|
1961
1963
|
this.onChange(option.value);
|
|
1962
1964
|
this.onTouched();
|
|
1965
|
+
// Emitir evento de mudança de seleção (compatível com MatSelectChange)
|
|
1966
|
+
this.selectionChange.emit({ source: this, value: option.value });
|
|
1963
1967
|
// Fechamos painel automaticamente
|
|
1964
1968
|
this.closePanel();
|
|
1965
1969
|
// Forçar detecção de mudanças para garantir que o painel seja fechado
|
|
@@ -2820,9 +2824,12 @@ class MatchaSelectMultipleComponent {
|
|
|
2820
2824
|
}
|
|
2821
2825
|
emitChange() {
|
|
2822
2826
|
const value = [...this.selectedValues];
|
|
2823
|
-
|
|
2827
|
+
// Atualiza o FormControl ANTES de emitir o evento: consumidores que leem o
|
|
2828
|
+
// valor atual do formulário no handler de selectionChange precisam já
|
|
2829
|
+
// enxergar o novo valor.
|
|
2824
2830
|
this.onChange(value);
|
|
2825
2831
|
this.onTouched();
|
|
2832
|
+
this.selectionChange.emit({ source: this, value });
|
|
2826
2833
|
}
|
|
2827
2834
|
// ===== Ordenação / navegação =====
|
|
2828
2835
|
/** Retorna as opções com as marcadas primeiro, preservando a ordem de declaração. */
|
|
@@ -10254,6 +10261,9 @@ class MatchaPeriodComponent {
|
|
|
10254
10261
|
this.cdr.detectChanges();
|
|
10255
10262
|
this.panel.attachTo(anchor);
|
|
10256
10263
|
this.panel.openPanel();
|
|
10264
|
+
if (this.showingCustom) {
|
|
10265
|
+
this.scrollCustomIntoView();
|
|
10266
|
+
}
|
|
10257
10267
|
this.opened.emit();
|
|
10258
10268
|
this.openedChange.emit(true);
|
|
10259
10269
|
}
|
|
@@ -10303,6 +10313,26 @@ class MatchaPeriodComponent {
|
|
|
10303
10313
|
this.customError = '';
|
|
10304
10314
|
this.syncCustomInputsFromValue();
|
|
10305
10315
|
this.cdr.detectChanges();
|
|
10316
|
+
this.scrollCustomIntoView();
|
|
10317
|
+
}
|
|
10318
|
+
/**
|
|
10319
|
+
* Rola o editor personalizado para dentro da área visível do painel.
|
|
10320
|
+
*
|
|
10321
|
+
* O painel tem scroll interno limitado por `maxHeight`; ao expandir o editor
|
|
10322
|
+
* (que é inserido no fim da lista) o conteúdo novo pode ficar abaixo da dobra.
|
|
10323
|
+
* Sem isso, o usuário precisaria rolar manualmente para ver os campos de data.
|
|
10324
|
+
*
|
|
10325
|
+
* `block: 'nearest'` garante o mínimo de rolagem necessária e evita mexer no
|
|
10326
|
+
* scroll da página. Adiado por rAF para rodar após a renderização do *ngIf e
|
|
10327
|
+
* o reposicionamento do painel (ResizeObserver).
|
|
10328
|
+
*/
|
|
10329
|
+
scrollCustomIntoView() {
|
|
10330
|
+
if (typeof requestAnimationFrame === 'undefined') {
|
|
10331
|
+
return;
|
|
10332
|
+
}
|
|
10333
|
+
requestAnimationFrame(() => {
|
|
10334
|
+
this.customEditorRef?.nativeElement.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
|
|
10335
|
+
});
|
|
10306
10336
|
}
|
|
10307
10337
|
applyCustom() {
|
|
10308
10338
|
const start = this.parseDate(this.customForm.value.start ?? null);
|
|
@@ -10323,9 +10353,13 @@ class MatchaPeriodComponent {
|
|
|
10323
10353
|
}
|
|
10324
10354
|
commitValue(value) {
|
|
10325
10355
|
this.value = value;
|
|
10326
|
-
|
|
10356
|
+
// Atualiza o FormControl ANTES de emitir o evento: consumidores que leem o
|
|
10357
|
+
// valor atual do formulário dentro do handler de `periodChange` precisam já
|
|
10358
|
+
// enxergar o novo valor. Emitir antes do `onChange` faria o handler ler o
|
|
10359
|
+
// valor anterior.
|
|
10327
10360
|
this.onChange(value);
|
|
10328
10361
|
this.onTouched();
|
|
10362
|
+
this.periodChange.emit(value);
|
|
10329
10363
|
this.cdr.detectChanges();
|
|
10330
10364
|
}
|
|
10331
10365
|
// ---------------------------------------------------------------------------
|
|
@@ -10475,7 +10509,7 @@ class MatchaPeriodComponent {
|
|
|
10475
10509
|
useExisting: forwardRef(() => MatchaPeriodComponent),
|
|
10476
10510
|
multi: true
|
|
10477
10511
|
}
|
|
10478
|
-
], viewQueries: [{ propertyName: "panel", first: true, predicate: MatchaPanelComponent, descendants: true }], ngImport: i0, template: "<div class=\"position-relative d-inline-block w-100-p\">\n <div class=\"matcha-period-trigger d-flex flex-align-center flex-space-between cursor-pointer\"\n [class.matcha-period-disabled]=\"isCurrentlyDisabled\" (click)=\"onTriggerClick()\"\n (keydown)=\"onTriggerKeyDown($event)\" [attr.tabindex]=\"isCurrentlyDisabled ? -1 : 0\" role=\"combobox\"\n [attr.aria-expanded]=\"open\" [attr.aria-haspopup]=\"true\" [attr.aria-disabled]=\"isCurrentlyDisabled\">\n\n <span class=\"matcha-period-value\" [class.matcha-period-placeholder]=\"!hasValue\">\n {{ triggerLabel }}\n </span>\n\n <span class=\"matcha-period-arrow\" [class.matcha-period-arrow-open]=\"open\">\n <span class=\"i-matcha-action_arrow_down\"></span>\n </span>\n </div>\n\n <matcha-panel #panel [placement]=\"placement\" [maxHeight]=\"maxHeight\" [minWidth]=\"minWidth\" [open]=\"open\"\n [portalToBody]=\"true\" [ignoreClickOutsideElements]=\"calendarOverlays\" (closed)=\"closePanel()\">\n\n <div class=\"py-4\" role=\"listbox\">\n <!-- Lista de presets -->\n <div *ngFor=\"let preset of presets; let i = index\" class=\"matcha-period-option\" role=\"option\"\n [class.matcha-period-option-selected]=\"isPresetSelected(preset)\"\n [class.matcha-period-option-active]=\"isActiveIndex(i)\" [attr.aria-selected]=\"isPresetSelected(preset)\"\n (click)=\"selectPreset(preset)\">\n {{ preset.label }}\n </div>\n\n <!-- Op\u00E7\u00E3o \"Personalizado\" -->\n <ng-container *ngIf=\"allowCustom\">\n <matcha-divider gap=\"8\"></matcha-divider>\n\n <div class=\"matcha-period-option\" role=\"option\"\n [class.matcha-period-option-selected]=\"isCustomSelected || showingCustom\"\n [class.matcha-period-option-active]=\"isCustomActive\" [attr.aria-selected]=\"isCustomSelected\"\n (click)=\"toggleCustom()\">\n {{ customLabel }}\n </div>\n\n <!-- Editor de per\u00EDodo personalizado (reaproveita matcha-date-range + matcha-date) -->\n <div class=\"pt-8 px-16 pb-12\" *ngIf=\"showingCustom\" [formGroup]=\"customForm\">\n <matcha-date-range>\n <matcha-form-field>\n <matcha-label>Data in\u00EDcio</matcha-label>\n <matcha-date formControlName=\"start\" placeholder=\"__/__/____\" [useNativePicker]=\"false\"\n [max]=\"customStartMax\" [suppressPanelGlobalClose]=\"true\"\n (calendarPanelOpened)=\"registerCalendarOverlay($event)\"></matcha-date>\n </matcha-form-field>\n <matcha-form-field>\n <matcha-label>Data fim</matcha-label>\n <matcha-date formControlName=\"end\" placeholder=\"__/__/____\" [useNativePicker]=\"false\"\n [min]=\"customEndMin\" [suppressPanelGlobalClose]=\"true\"\n (calendarPanelOpened)=\"registerCalendarOverlay($event)\"></matcha-date>\n </matcha-form-field>\n </matcha-date-range>\n\n <div class=\"color-red fs-12 mt-8\" *ngIf=\"customError\">{{ customError }}</div>\n\n <button matcha-button color=\"accent\" size=\"small\" type=\"button\" class=\"w-100-p mt-12\"\n (click)=\"applyCustom()\">\n Aplicar\n </button>\n </div>\n </ng-container>\n </div>\n </matcha-panel>\n</div>\n", styles: [""], dependencies: [{ 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.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: MatchaPanelComponent, selector: "matcha-panel", inputs: ["placement", "maxHeight", "minWidth", "widthMode", "offset", "triggerElement", "open", "hasOverlay", "ignoreClickOutsideElements", "suppressGlobalClose", "portalToBody"], outputs: ["opened", "closed"] }, { kind: "component", type: MatchaButtonComponent, selector: "[matcha-button]", inputs: ["size", "size-xs", "size-sm", "size-md", "size-lg", "size-xl", "gap", "color", "basic", "outline", "alpha", "pill", "link", "icon", "badge"] }, { kind: "component", type: MatchaDividerComponent, selector: "matcha-divider", inputs: ["gap", "gap-sm", "gap-md", "gap-lg", "gap-xl", "direction"] }, { kind: "component", type: MatchaDateComponent, selector: "matcha-date", inputs: ["placeholder", "min", "max", "disabled", "showNativePicker", "useNativePicker", "suppressPanelGlobalClose"], outputs: ["calendarPanelOpened", "calendarPanelClosed"] }, { kind: "component", type: MatchaDateRangeComponent, selector: "matcha-date-range" }, { kind: "component", type: MatchaFormFieldComponent, selector: "matcha-form-field", inputs: ["color", "size", "size-xs", "size-sm", "size-md", "size-lg", "size-xl"] }, { kind: "component", type: MatchaLabelComponent, selector: "matcha-label", inputs: ["color"] }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
10512
|
+
], viewQueries: [{ propertyName: "panel", first: true, predicate: MatchaPanelComponent, descendants: true }, { propertyName: "customEditorRef", first: true, predicate: ["customEditor"], descendants: true }], ngImport: i0, template: "<div class=\"position-relative d-inline-block w-100-p\">\n <div class=\"matcha-period-trigger d-flex flex-align-center flex-space-between cursor-pointer\"\n [class.matcha-period-disabled]=\"isCurrentlyDisabled\" (click)=\"onTriggerClick()\"\n (keydown)=\"onTriggerKeyDown($event)\" [attr.tabindex]=\"isCurrentlyDisabled ? -1 : 0\" role=\"combobox\"\n [attr.aria-expanded]=\"open\" [attr.aria-haspopup]=\"true\" [attr.aria-disabled]=\"isCurrentlyDisabled\">\n\n <span class=\"matcha-period-value\" [class.matcha-period-placeholder]=\"!hasValue\">\n {{ triggerLabel }}\n </span>\n\n <span class=\"matcha-period-arrow\" [class.matcha-period-arrow-open]=\"open\">\n <span class=\"i-matcha-action_arrow_down\"></span>\n </span>\n </div>\n\n <matcha-panel #panel [placement]=\"placement\" [maxHeight]=\"maxHeight\" [minWidth]=\"minWidth\" [open]=\"open\"\n [portalToBody]=\"true\" [ignoreClickOutsideElements]=\"calendarOverlays\" (closed)=\"closePanel()\">\n\n <div class=\"py-4\" role=\"listbox\">\n <!-- Lista de presets -->\n <div *ngFor=\"let preset of presets; let i = index\" class=\"matcha-period-option\" role=\"option\"\n [class.matcha-period-option-selected]=\"isPresetSelected(preset)\"\n [class.matcha-period-option-active]=\"isActiveIndex(i)\" [attr.aria-selected]=\"isPresetSelected(preset)\"\n (click)=\"selectPreset(preset)\">\n {{ preset.label }}\n </div>\n\n <!-- Op\u00E7\u00E3o \"Personalizado\" -->\n <ng-container *ngIf=\"allowCustom\">\n <matcha-divider gap=\"8\"></matcha-divider>\n\n <div class=\"matcha-period-option\" role=\"option\"\n [class.matcha-period-option-selected]=\"isCustomSelected || showingCustom\"\n [class.matcha-period-option-active]=\"isCustomActive\" [attr.aria-selected]=\"isCustomSelected\"\n (click)=\"toggleCustom()\">\n {{ customLabel }}\n </div>\n\n <!-- Editor de per\u00EDodo personalizado (reaproveita matcha-date-range + matcha-date) -->\n <div #customEditor class=\"pt-8 px-16 pb-12\" *ngIf=\"showingCustom\" [formGroup]=\"customForm\">\n <matcha-date-range>\n <matcha-form-field>\n <matcha-label>Data in\u00EDcio</matcha-label>\n <matcha-date formControlName=\"start\" placeholder=\"__/__/____\" [useNativePicker]=\"false\"\n [max]=\"customStartMax\" [suppressPanelGlobalClose]=\"true\"\n (calendarPanelOpened)=\"registerCalendarOverlay($event)\"></matcha-date>\n </matcha-form-field>\n <matcha-form-field>\n <matcha-label>Data fim</matcha-label>\n <matcha-date formControlName=\"end\" placeholder=\"__/__/____\" [useNativePicker]=\"false\"\n [min]=\"customEndMin\" [suppressPanelGlobalClose]=\"true\"\n (calendarPanelOpened)=\"registerCalendarOverlay($event)\"></matcha-date>\n </matcha-form-field>\n </matcha-date-range>\n\n <div class=\"color-red fs-12 mt-8\" *ngIf=\"customError\">{{ customError }}</div>\n\n <button matcha-button color=\"accent\" size=\"small\" type=\"button\" class=\"w-100-p mt-12\"\n (click)=\"applyCustom()\">\n Aplicar\n </button>\n </div>\n </ng-container>\n </div>\n </matcha-panel>\n</div>\n", styles: [""], dependencies: [{ 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.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: MatchaPanelComponent, selector: "matcha-panel", inputs: ["placement", "maxHeight", "minWidth", "widthMode", "offset", "triggerElement", "open", "hasOverlay", "ignoreClickOutsideElements", "suppressGlobalClose", "portalToBody"], outputs: ["opened", "closed"] }, { kind: "component", type: MatchaButtonComponent, selector: "[matcha-button]", inputs: ["size", "size-xs", "size-sm", "size-md", "size-lg", "size-xl", "gap", "color", "basic", "outline", "alpha", "pill", "link", "icon", "badge"] }, { kind: "component", type: MatchaDividerComponent, selector: "matcha-divider", inputs: ["gap", "gap-sm", "gap-md", "gap-lg", "gap-xl", "direction"] }, { kind: "component", type: MatchaDateComponent, selector: "matcha-date", inputs: ["placeholder", "min", "max", "disabled", "showNativePicker", "useNativePicker", "suppressPanelGlobalClose"], outputs: ["calendarPanelOpened", "calendarPanelClosed"] }, { kind: "component", type: MatchaDateRangeComponent, selector: "matcha-date-range" }, { kind: "component", type: MatchaFormFieldComponent, selector: "matcha-form-field", inputs: ["color", "size", "size-xs", "size-sm", "size-md", "size-lg", "size-xl"] }, { kind: "component", type: MatchaLabelComponent, selector: "matcha-label", inputs: ["color"] }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
10479
10513
|
}
|
|
10480
10514
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: MatchaPeriodComponent, decorators: [{
|
|
10481
10515
|
type: Component,
|
|
@@ -10485,10 +10519,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImpo
|
|
|
10485
10519
|
useExisting: forwardRef(() => MatchaPeriodComponent),
|
|
10486
10520
|
multi: true
|
|
10487
10521
|
}
|
|
10488
|
-
], template: "<div class=\"position-relative d-inline-block w-100-p\">\n <div class=\"matcha-period-trigger d-flex flex-align-center flex-space-between cursor-pointer\"\n [class.matcha-period-disabled]=\"isCurrentlyDisabled\" (click)=\"onTriggerClick()\"\n (keydown)=\"onTriggerKeyDown($event)\" [attr.tabindex]=\"isCurrentlyDisabled ? -1 : 0\" role=\"combobox\"\n [attr.aria-expanded]=\"open\" [attr.aria-haspopup]=\"true\" [attr.aria-disabled]=\"isCurrentlyDisabled\">\n\n <span class=\"matcha-period-value\" [class.matcha-period-placeholder]=\"!hasValue\">\n {{ triggerLabel }}\n </span>\n\n <span class=\"matcha-period-arrow\" [class.matcha-period-arrow-open]=\"open\">\n <span class=\"i-matcha-action_arrow_down\"></span>\n </span>\n </div>\n\n <matcha-panel #panel [placement]=\"placement\" [maxHeight]=\"maxHeight\" [minWidth]=\"minWidth\" [open]=\"open\"\n [portalToBody]=\"true\" [ignoreClickOutsideElements]=\"calendarOverlays\" (closed)=\"closePanel()\">\n\n <div class=\"py-4\" role=\"listbox\">\n <!-- Lista de presets -->\n <div *ngFor=\"let preset of presets; let i = index\" class=\"matcha-period-option\" role=\"option\"\n [class.matcha-period-option-selected]=\"isPresetSelected(preset)\"\n [class.matcha-period-option-active]=\"isActiveIndex(i)\" [attr.aria-selected]=\"isPresetSelected(preset)\"\n (click)=\"selectPreset(preset)\">\n {{ preset.label }}\n </div>\n\n <!-- Op\u00E7\u00E3o \"Personalizado\" -->\n <ng-container *ngIf=\"allowCustom\">\n <matcha-divider gap=\"8\"></matcha-divider>\n\n <div class=\"matcha-period-option\" role=\"option\"\n [class.matcha-period-option-selected]=\"isCustomSelected || showingCustom\"\n [class.matcha-period-option-active]=\"isCustomActive\" [attr.aria-selected]=\"isCustomSelected\"\n (click)=\"toggleCustom()\">\n {{ customLabel }}\n </div>\n\n <!-- Editor de per\u00EDodo personalizado (reaproveita matcha-date-range + matcha-date) -->\n <div class=\"pt-8 px-16 pb-12\" *ngIf=\"showingCustom\" [formGroup]=\"customForm\">\n <matcha-date-range>\n <matcha-form-field>\n <matcha-label>Data in\u00EDcio</matcha-label>\n <matcha-date formControlName=\"start\" placeholder=\"__/__/____\" [useNativePicker]=\"false\"\n [max]=\"customStartMax\" [suppressPanelGlobalClose]=\"true\"\n (calendarPanelOpened)=\"registerCalendarOverlay($event)\"></matcha-date>\n </matcha-form-field>\n <matcha-form-field>\n <matcha-label>Data fim</matcha-label>\n <matcha-date formControlName=\"end\" placeholder=\"__/__/____\" [useNativePicker]=\"false\"\n [min]=\"customEndMin\" [suppressPanelGlobalClose]=\"true\"\n (calendarPanelOpened)=\"registerCalendarOverlay($event)\"></matcha-date>\n </matcha-form-field>\n </matcha-date-range>\n\n <div class=\"color-red fs-12 mt-8\" *ngIf=\"customError\">{{ customError }}</div>\n\n <button matcha-button color=\"accent\" size=\"small\" type=\"button\" class=\"w-100-p mt-12\"\n (click)=\"applyCustom()\">\n Aplicar\n </button>\n </div>\n </ng-container>\n </div>\n </matcha-panel>\n</div>\n" }]
|
|
10522
|
+
], template: "<div class=\"position-relative d-inline-block w-100-p\">\n <div class=\"matcha-period-trigger d-flex flex-align-center flex-space-between cursor-pointer\"\n [class.matcha-period-disabled]=\"isCurrentlyDisabled\" (click)=\"onTriggerClick()\"\n (keydown)=\"onTriggerKeyDown($event)\" [attr.tabindex]=\"isCurrentlyDisabled ? -1 : 0\" role=\"combobox\"\n [attr.aria-expanded]=\"open\" [attr.aria-haspopup]=\"true\" [attr.aria-disabled]=\"isCurrentlyDisabled\">\n\n <span class=\"matcha-period-value\" [class.matcha-period-placeholder]=\"!hasValue\">\n {{ triggerLabel }}\n </span>\n\n <span class=\"matcha-period-arrow\" [class.matcha-period-arrow-open]=\"open\">\n <span class=\"i-matcha-action_arrow_down\"></span>\n </span>\n </div>\n\n <matcha-panel #panel [placement]=\"placement\" [maxHeight]=\"maxHeight\" [minWidth]=\"minWidth\" [open]=\"open\"\n [portalToBody]=\"true\" [ignoreClickOutsideElements]=\"calendarOverlays\" (closed)=\"closePanel()\">\n\n <div class=\"py-4\" role=\"listbox\">\n <!-- Lista de presets -->\n <div *ngFor=\"let preset of presets; let i = index\" class=\"matcha-period-option\" role=\"option\"\n [class.matcha-period-option-selected]=\"isPresetSelected(preset)\"\n [class.matcha-period-option-active]=\"isActiveIndex(i)\" [attr.aria-selected]=\"isPresetSelected(preset)\"\n (click)=\"selectPreset(preset)\">\n {{ preset.label }}\n </div>\n\n <!-- Op\u00E7\u00E3o \"Personalizado\" -->\n <ng-container *ngIf=\"allowCustom\">\n <matcha-divider gap=\"8\"></matcha-divider>\n\n <div class=\"matcha-period-option\" role=\"option\"\n [class.matcha-period-option-selected]=\"isCustomSelected || showingCustom\"\n [class.matcha-period-option-active]=\"isCustomActive\" [attr.aria-selected]=\"isCustomSelected\"\n (click)=\"toggleCustom()\">\n {{ customLabel }}\n </div>\n\n <!-- Editor de per\u00EDodo personalizado (reaproveita matcha-date-range + matcha-date) -->\n <div #customEditor class=\"pt-8 px-16 pb-12\" *ngIf=\"showingCustom\" [formGroup]=\"customForm\">\n <matcha-date-range>\n <matcha-form-field>\n <matcha-label>Data in\u00EDcio</matcha-label>\n <matcha-date formControlName=\"start\" placeholder=\"__/__/____\" [useNativePicker]=\"false\"\n [max]=\"customStartMax\" [suppressPanelGlobalClose]=\"true\"\n (calendarPanelOpened)=\"registerCalendarOverlay($event)\"></matcha-date>\n </matcha-form-field>\n <matcha-form-field>\n <matcha-label>Data fim</matcha-label>\n <matcha-date formControlName=\"end\" placeholder=\"__/__/____\" [useNativePicker]=\"false\"\n [min]=\"customEndMin\" [suppressPanelGlobalClose]=\"true\"\n (calendarPanelOpened)=\"registerCalendarOverlay($event)\"></matcha-date>\n </matcha-form-field>\n </matcha-date-range>\n\n <div class=\"color-red fs-12 mt-8\" *ngIf=\"customError\">{{ customError }}</div>\n\n <button matcha-button color=\"accent\" size=\"small\" type=\"button\" class=\"w-100-p mt-12\"\n (click)=\"applyCustom()\">\n Aplicar\n </button>\n </div>\n </ng-container>\n </div>\n </matcha-panel>\n</div>\n" }]
|
|
10489
10523
|
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }], propDecorators: { panel: [{
|
|
10490
10524
|
type: ViewChild,
|
|
10491
10525
|
args: [MatchaPanelComponent]
|
|
10526
|
+
}], customEditorRef: [{
|
|
10527
|
+
type: ViewChild,
|
|
10528
|
+
args: ['customEditor']
|
|
10492
10529
|
}], presets: [{
|
|
10493
10530
|
type: Input
|
|
10494
10531
|
}], allowCustom: [{
|
|
@@ -15369,9 +15406,12 @@ class MatchaSliderComponent {
|
|
|
15369
15406
|
this.isDragging = false;
|
|
15370
15407
|
this.draggingPointer = null;
|
|
15371
15408
|
this.removeVisualFeedback();
|
|
15372
|
-
|
|
15409
|
+
// Atualiza o FormControl ANTES de emitir o evento de interação:
|
|
15410
|
+
// consumidores que leem o valor atual do formulário no handler de
|
|
15411
|
+
// `userChangeEnd` precisam já enxergar o novo valor.
|
|
15373
15412
|
this.onChange(this.isRange ? [this.value, this.highValue] : this.value);
|
|
15374
15413
|
this.onTouched();
|
|
15414
|
+
this.userChangeEnd.emit(this.value);
|
|
15375
15415
|
}
|
|
15376
15416
|
this.cleanupEventListeners();
|
|
15377
15417
|
this.cancelAnimationFrame();
|
|
@@ -15453,9 +15493,13 @@ class MatchaSliderComponent {
|
|
|
15453
15493
|
const clampedValue = Math.max(floor, Math.min(ceil, newValue));
|
|
15454
15494
|
if (clampedValue !== this.value) {
|
|
15455
15495
|
this.value = clampedValue;
|
|
15496
|
+
// `valueChange` é o output de two-way binding ([(value)]); permanece antes
|
|
15497
|
+
// do `onChange`, espelhando o comportamento do Angular Material. Já o
|
|
15498
|
+
// `userChange` (evento de interação) é emitido DEPOIS de atualizar o
|
|
15499
|
+
// FormControl, para que o handler leia o novo valor.
|
|
15456
15500
|
this.valueChange.emit(this.value);
|
|
15457
|
-
this.userChange.emit(this.value);
|
|
15458
15501
|
this.onChange(this.value);
|
|
15502
|
+
this.userChange.emit(this.value);
|
|
15459
15503
|
this.cdr.markForCheck();
|
|
15460
15504
|
}
|
|
15461
15505
|
}
|
|
@@ -15489,9 +15533,12 @@ class MatchaSliderComponent {
|
|
|
15489
15533
|
}
|
|
15490
15534
|
if (clampedValue !== this.value) {
|
|
15491
15535
|
this.value = clampedValue;
|
|
15536
|
+
// `valueChange` (two-way binding) permanece antes do `onChange`; o
|
|
15537
|
+
// `userChange` (evento de interação) é emitido depois de atualizar o
|
|
15538
|
+
// FormControl.
|
|
15492
15539
|
this.valueChange.emit(this.value);
|
|
15493
|
-
this.userChange.emit(this.value);
|
|
15494
15540
|
this.onChange([this.value, this.highValue]);
|
|
15541
|
+
this.userChange.emit(this.value);
|
|
15495
15542
|
this.cdr.markForCheck();
|
|
15496
15543
|
}
|
|
15497
15544
|
}
|
|
@@ -15512,9 +15559,12 @@ class MatchaSliderComponent {
|
|
|
15512
15559
|
}
|
|
15513
15560
|
if (clampedValue !== this.highValue) {
|
|
15514
15561
|
this.highValue = clampedValue;
|
|
15562
|
+
// `highValueChange` (two-way binding) permanece antes do `onChange`; o
|
|
15563
|
+
// `userChange` (evento de interação) é emitido depois de atualizar o
|
|
15564
|
+
// FormControl.
|
|
15515
15565
|
this.highValueChange.emit(this.highValue);
|
|
15516
|
-
this.userChange.emit(this.highValue);
|
|
15517
15566
|
this.onChange([this.value, this.highValue]);
|
|
15567
|
+
this.userChange.emit(this.highValue);
|
|
15518
15568
|
this.cdr.markForCheck();
|
|
15519
15569
|
}
|
|
15520
15570
|
}
|