matcha-components 20.149.0 → 20.152.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 +155 -31
- package/fesm2022/matcha-components.mjs.map +1 -1
- package/index.d.ts +39 -4
- package/package.json +1 -1
|
@@ -2206,8 +2206,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImpor
|
|
|
2206
2206
|
}] });
|
|
2207
2207
|
|
|
2208
2208
|
class MatchaFormFieldComponent {
|
|
2209
|
-
constructor(elementRef) {
|
|
2209
|
+
constructor(elementRef, cdr) {
|
|
2210
2210
|
this.elementRef = elementRef;
|
|
2211
|
+
this.cdr = cdr;
|
|
2211
2212
|
this.color = 'grey';
|
|
2212
2213
|
this.size = null;
|
|
2213
2214
|
this.sizeXs = null;
|
|
@@ -2215,9 +2216,20 @@ class MatchaFormFieldComponent {
|
|
|
2215
2216
|
this.sizeMd = null;
|
|
2216
2217
|
this.sizeLg = null;
|
|
2217
2218
|
this.sizeXl = null;
|
|
2219
|
+
this.isDisabled = false;
|
|
2218
2220
|
}
|
|
2219
2221
|
ngAfterViewInit() {
|
|
2220
2222
|
this.generateDataCy();
|
|
2223
|
+
this.checkDisabledState();
|
|
2224
|
+
this.setupDisabledObserver();
|
|
2225
|
+
}
|
|
2226
|
+
ngOnDestroy() {
|
|
2227
|
+
if (this.mutationObserver) {
|
|
2228
|
+
this.mutationObserver.disconnect();
|
|
2229
|
+
}
|
|
2230
|
+
if (this.controlSubscription) {
|
|
2231
|
+
this.controlSubscription.unsubscribe();
|
|
2232
|
+
}
|
|
2221
2233
|
}
|
|
2222
2234
|
generateDataCy() {
|
|
2223
2235
|
// Busca o matcha-label dentro do form-field
|
|
@@ -2245,13 +2257,94 @@ class MatchaFormFieldComponent {
|
|
|
2245
2257
|
get showError() {
|
|
2246
2258
|
return !!this.control?.invalid && !!this.control?.touched;
|
|
2247
2259
|
}
|
|
2248
|
-
|
|
2249
|
-
|
|
2260
|
+
/**
|
|
2261
|
+
* Verifica se algum input filho está disabled
|
|
2262
|
+
*/
|
|
2263
|
+
checkDisabledState() {
|
|
2264
|
+
const nativeElement = this.elementRef.nativeElement;
|
|
2265
|
+
// Verificar FormControl disabled
|
|
2266
|
+
if (this.control?.disabled) {
|
|
2267
|
+
this.isDisabled = true;
|
|
2268
|
+
this.cdr.detectChanges();
|
|
2269
|
+
return;
|
|
2270
|
+
}
|
|
2271
|
+
// Verificar inputs nativos (input, textarea, select)
|
|
2272
|
+
const nativeInputs = nativeElement.querySelectorAll('input:disabled, textarea:disabled, select:disabled');
|
|
2273
|
+
if (nativeInputs.length > 0) {
|
|
2274
|
+
this.isDisabled = true;
|
|
2275
|
+
this.cdr.detectChanges();
|
|
2276
|
+
return;
|
|
2277
|
+
}
|
|
2278
|
+
// Verificar componentes customizados com atributo disabled
|
|
2279
|
+
const customComponentsWithAttr = nativeElement.querySelectorAll('matcha-select[disabled], matcha-autocomplete[disabled], matcha-date[disabled]');
|
|
2280
|
+
if (customComponentsWithAttr.length > 0) {
|
|
2281
|
+
this.isDisabled = true;
|
|
2282
|
+
this.cdr.detectChanges();
|
|
2283
|
+
return;
|
|
2284
|
+
}
|
|
2285
|
+
// Verificar componentes customizados com classe disabled
|
|
2286
|
+
const disabledByClass = nativeElement.querySelectorAll('.matcha-select-disabled, .matcha-autocomplete-disabled');
|
|
2287
|
+
if (disabledByClass.length > 0) {
|
|
2288
|
+
this.isDisabled = true;
|
|
2289
|
+
this.cdr.detectChanges();
|
|
2290
|
+
return;
|
|
2291
|
+
}
|
|
2292
|
+
// Verificar componentes customizados através de elementos que podem ter a propriedade disabled
|
|
2293
|
+
// O MutationObserver vai detectar mudanças nas classes e atributos
|
|
2294
|
+
const matchaSelect = nativeElement.querySelector('matcha-select');
|
|
2295
|
+
const matchaAutocomplete = nativeElement.querySelector('matcha-autocomplete');
|
|
2296
|
+
if (matchaSelect) {
|
|
2297
|
+
// Verificar se tem classe disabled ou atributo disabled
|
|
2298
|
+
if (matchaSelect.hasAttribute('disabled') ||
|
|
2299
|
+
matchaSelect.classList.contains('matcha-select-disabled')) {
|
|
2300
|
+
this.isDisabled = true;
|
|
2301
|
+
this.cdr.detectChanges();
|
|
2302
|
+
return;
|
|
2303
|
+
}
|
|
2304
|
+
}
|
|
2305
|
+
if (matchaAutocomplete) {
|
|
2306
|
+
if (matchaAutocomplete.hasAttribute('disabled') ||
|
|
2307
|
+
matchaAutocomplete.classList.contains('matcha-autocomplete-disabled')) {
|
|
2308
|
+
this.isDisabled = true;
|
|
2309
|
+
this.cdr.detectChanges();
|
|
2310
|
+
return;
|
|
2311
|
+
}
|
|
2312
|
+
}
|
|
2313
|
+
// Se nenhum input está disabled, atualizar estado
|
|
2314
|
+
if (this.isDisabled) {
|
|
2315
|
+
this.isDisabled = false;
|
|
2316
|
+
this.cdr.detectChanges();
|
|
2317
|
+
}
|
|
2318
|
+
}
|
|
2319
|
+
/**
|
|
2320
|
+
* Configura observadores para detectar mudanças no estado disabled
|
|
2321
|
+
*/
|
|
2322
|
+
setupDisabledObserver() {
|
|
2323
|
+
// Observar mudanças no FormControl
|
|
2324
|
+
if (this.control) {
|
|
2325
|
+
this.controlSubscription = this.control.statusChanges?.subscribe(() => {
|
|
2326
|
+
this.checkDisabledState();
|
|
2327
|
+
});
|
|
2328
|
+
}
|
|
2329
|
+
// Observar mudanças nos atributos e classes disabled dos elementos filhos
|
|
2330
|
+
this.mutationObserver = new MutationObserver(() => {
|
|
2331
|
+
this.checkDisabledState();
|
|
2332
|
+
});
|
|
2333
|
+
// Observar mudanças nos atributos, classes e na árvore DOM
|
|
2334
|
+
this.mutationObserver.observe(this.elementRef.nativeElement, {
|
|
2335
|
+
attributes: true,
|
|
2336
|
+
attributeFilter: ['disabled', 'class'],
|
|
2337
|
+
childList: true,
|
|
2338
|
+
subtree: true
|
|
2339
|
+
});
|
|
2340
|
+
}
|
|
2341
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaFormFieldComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2342
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.0", type: MatchaFormFieldComponent, isStandalone: false, selector: "matcha-form-field", inputs: { color: "color", size: "size", sizeXs: ["size-xs", "sizeXs"], sizeSm: ["size-sm", "sizeSm"], sizeMd: ["size-md", "sizeMd"], sizeLg: ["size-lg", "sizeLg"], sizeXl: ["size-xl", "sizeXl"] }, queries: [{ propertyName: "controlDir", first: true, predicate: FormControlName, descendants: true }], ngImport: i0, template: "<div class=\"flex-column\">\n <div class=\"matcha-form-field position-relative w-100-p min-h-40 flex-align-center\"\n [class.matcha-form-field-disabled]=\"isDisabled\"\n #inputSelector>\n <div class=\"flex-row position-absolute w-100-p min-h-40 h-100-p\">\n <div class=\"matcha-form-field-border-start bl-2 bt-2 bb-2 radius-left-8 min-w-8 border-color-{{color}}\"></div>\n <div class=\"matcha-form-field-border-middle bb-2 w-auto border-color-{{color}}\">\n <ng-content select=\"matcha-label\"></ng-content>\n </div>\n <div class=\"matcha-form-field-border-end br-2 bt-2 bb-2 radius-right-8 w-100-p border-color-{{color}}\"></div>\n </div>\n <div class=\"flex-row position-relative py-8 px-12 gap-8 w-100-p\">\n <ng-content></ng-content>\n </div>\n </div>\n <ng-content select=\"matcha-autocomplete\"></ng-content>\n <ng-container *ngIf=\"showError\">\n <ng-content select=\"matcha-error\"></ng-content>\n </ng-container>\n</div>\n<ng-content select=\"matcha-hint-text\"></ng-content>\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
|
|
2250
2343
|
}
|
|
2251
2344
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaFormFieldComponent, decorators: [{
|
|
2252
2345
|
type: Component,
|
|
2253
|
-
args: [{ selector: 'matcha-form-field', standalone: false, template: "<div class=\"flex-column\">\n <div class=\"matcha-form-field position-relative w-100-p min-h-40 flex-align-center\"
|
|
2254
|
-
}], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { color: [{
|
|
2346
|
+
args: [{ selector: 'matcha-form-field', standalone: false, template: "<div class=\"flex-column\">\n <div class=\"matcha-form-field position-relative w-100-p min-h-40 flex-align-center\"\n [class.matcha-form-field-disabled]=\"isDisabled\"\n #inputSelector>\n <div class=\"flex-row position-absolute w-100-p min-h-40 h-100-p\">\n <div class=\"matcha-form-field-border-start bl-2 bt-2 bb-2 radius-left-8 min-w-8 border-color-{{color}}\"></div>\n <div class=\"matcha-form-field-border-middle bb-2 w-auto border-color-{{color}}\">\n <ng-content select=\"matcha-label\"></ng-content>\n </div>\n <div class=\"matcha-form-field-border-end br-2 bt-2 bb-2 radius-right-8 w-100-p border-color-{{color}}\"></div>\n </div>\n <div class=\"flex-row position-relative py-8 px-12 gap-8 w-100-p\">\n <ng-content></ng-content>\n </div>\n </div>\n <ng-content select=\"matcha-autocomplete\"></ng-content>\n <ng-container *ngIf=\"showError\">\n <ng-content select=\"matcha-error\"></ng-content>\n </ng-container>\n</div>\n<ng-content select=\"matcha-hint-text\"></ng-content>\n" }]
|
|
2347
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }], propDecorators: { color: [{
|
|
2255
2348
|
type: Input
|
|
2256
2349
|
}], size: [{
|
|
2257
2350
|
type: Input,
|
|
@@ -8951,11 +9044,11 @@ class MatchaAutocompleteComponent {
|
|
|
8951
9044
|
return null;
|
|
8952
9045
|
}
|
|
8953
9046
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaAutocompleteComponent, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
8954
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.0", type: MatchaAutocompleteComponent, isStandalone: false, selector: "matcha-autocomplete", inputs: { placement: "placement", maxHeight: "maxHeight", minWidth: "minWidth", autoSelectOnBlur: "autoSelectOnBlur", displayWith: "displayWith", displayProperty: "displayProperty", showClearButton: "showClearButton", clearButtonIcon: "clearButtonIcon", clearButtonAriaLabel: "clearButtonAriaLabel" }, outputs: { opened: "opened", closed: "closed", cleared: "cleared", autoSelected: "autoSelected" }, queries: [{ propertyName: "options", predicate: MatchaOptionComponent, descendants: true }], viewQueries: [{ propertyName: "panel", first: true, predicate: MatchaPanelComponent, descendants: true }], ngImport: i0, template: "<matcha-panel\n
|
|
9047
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.0", type: MatchaAutocompleteComponent, isStandalone: false, selector: "matcha-autocomplete", inputs: { placement: "placement", maxHeight: "maxHeight", minWidth: "minWidth", autoSelectOnBlur: "autoSelectOnBlur", displayWith: "displayWith", displayProperty: "displayProperty", showClearButton: "showClearButton", clearButtonIcon: "clearButtonIcon", clearButtonAriaLabel: "clearButtonAriaLabel" }, outputs: { opened: "opened", closed: "closed", cleared: "cleared", autoSelected: "autoSelected" }, queries: [{ propertyName: "options", predicate: MatchaOptionComponent, descendants: true }], viewQueries: [{ propertyName: "panel", first: true, predicate: MatchaPanelComponent, descendants: true }], ngImport: i0, template: "<div class=\"matcha-autocomplete-container\">\n <matcha-panel\n #panel\n [open]=\"open\"\n [placement]=\"placement\"\n [maxHeight]=\"maxHeight\"\n [minWidth]=\"minWidth\"\n [triggerElement]=\"triggerElement\"\n (opened)=\"opened.emit()\"\n (closed)=\"closed.emit()\">\n <div class=\"matcha-panel-content flex-column\">\n <ng-content></ng-content>\n </div>\n </matcha-panel>\n</div>\n", dependencies: [{ kind: "component", type: MatchaPanelComponent, selector: "matcha-panel", inputs: ["placement", "maxHeight", "minWidth", "offset", "triggerElement", "open"], outputs: ["opened", "closed"] }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
8955
9048
|
}
|
|
8956
9049
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaAutocompleteComponent, decorators: [{
|
|
8957
9050
|
type: Component,
|
|
8958
|
-
args: [{ selector: 'matcha-autocomplete', encapsulation: ViewEncapsulation.None, standalone: false, template: "<matcha-panel\n
|
|
9051
|
+
args: [{ selector: 'matcha-autocomplete', encapsulation: ViewEncapsulation.None, standalone: false, template: "<div class=\"matcha-autocomplete-container\">\n <matcha-panel\n #panel\n [open]=\"open\"\n [placement]=\"placement\"\n [maxHeight]=\"maxHeight\"\n [minWidth]=\"minWidth\"\n [triggerElement]=\"triggerElement\"\n (opened)=\"opened.emit()\"\n (closed)=\"closed.emit()\">\n <div class=\"matcha-panel-content flex-column\">\n <ng-content></ng-content>\n </div>\n </matcha-panel>\n</div>\n" }]
|
|
8959
9052
|
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }], propDecorators: { options: [{
|
|
8960
9053
|
type: ContentChildren,
|
|
8961
9054
|
args: [MatchaOptionComponent, { descendants: true }]
|
|
@@ -8991,6 +9084,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImpor
|
|
|
8991
9084
|
}] } });
|
|
8992
9085
|
|
|
8993
9086
|
class MatchaSelectComponent {
|
|
9087
|
+
/**
|
|
9088
|
+
* Getter consolidado para verificar se o componente está disabled
|
|
9089
|
+
* Combina o estado do @Input disabled com o estado do FormControl
|
|
9090
|
+
*/
|
|
9091
|
+
get isCurrentlyDisabled() {
|
|
9092
|
+
return this.disabled || this.isDisabledByForm;
|
|
9093
|
+
}
|
|
9094
|
+
/**
|
|
9095
|
+
* HostBinding para adicionar classe disabled no elemento raiz do componente
|
|
9096
|
+
* Isso permite que o matcha-form-field detecte o estado disabled
|
|
9097
|
+
*/
|
|
9098
|
+
get hostDisabledClass() {
|
|
9099
|
+
return this.isCurrentlyDisabled;
|
|
9100
|
+
}
|
|
9101
|
+
/**
|
|
9102
|
+
* HostBinding para adicionar atributo disabled no elemento raiz do componente
|
|
9103
|
+
* Isso permite que o matcha-form-field detecte o estado disabled
|
|
9104
|
+
*/
|
|
9105
|
+
get hostDisabledAttr() {
|
|
9106
|
+
return this.isCurrentlyDisabled ? '' : null;
|
|
9107
|
+
}
|
|
8994
9108
|
constructor(elRef, renderer, cdr) {
|
|
8995
9109
|
this.elRef = elRef;
|
|
8996
9110
|
this.renderer = renderer;
|
|
@@ -9012,7 +9126,7 @@ class MatchaSelectComponent {
|
|
|
9012
9126
|
// ControlValueAccessor properties
|
|
9013
9127
|
this.onChange = (value) => { };
|
|
9014
9128
|
this.onTouched = () => { };
|
|
9015
|
-
this.
|
|
9129
|
+
this.isDisabledByForm = false;
|
|
9016
9130
|
}
|
|
9017
9131
|
ngAfterContentInit() {
|
|
9018
9132
|
// quando options mudarem, resetamos estado relevante
|
|
@@ -9057,7 +9171,7 @@ class MatchaSelectComponent {
|
|
|
9057
9171
|
if (!this.triggerElement)
|
|
9058
9172
|
return;
|
|
9059
9173
|
this.triggerElement.addEventListener('keydown', (event) => {
|
|
9060
|
-
if (this.
|
|
9174
|
+
if (this.isCurrentlyDisabled)
|
|
9061
9175
|
return;
|
|
9062
9176
|
switch (event.key) {
|
|
9063
9177
|
case 'ArrowDown':
|
|
@@ -9143,12 +9257,15 @@ class MatchaSelectComponent {
|
|
|
9143
9257
|
this.elRef.nativeElement.dispatchEvent(selectionEvent);
|
|
9144
9258
|
}
|
|
9145
9259
|
onTriggerClick() {
|
|
9146
|
-
if (this.
|
|
9260
|
+
if (this.isCurrentlyDisabled) {
|
|
9261
|
+
this.ensurePanelClosed();
|
|
9147
9262
|
return;
|
|
9263
|
+
}
|
|
9148
9264
|
this.togglePanel();
|
|
9149
9265
|
}
|
|
9150
9266
|
openPanel() {
|
|
9151
|
-
if (this.
|
|
9267
|
+
if (this.isCurrentlyDisabled) {
|
|
9268
|
+
this.ensurePanelClosed();
|
|
9152
9269
|
return;
|
|
9153
9270
|
}
|
|
9154
9271
|
// Garantir que o triggerElement está configurado
|
|
@@ -9353,18 +9470,35 @@ class MatchaSelectComponent {
|
|
|
9353
9470
|
registerOnTouched(fn) {
|
|
9354
9471
|
this.onTouched = fn;
|
|
9355
9472
|
}
|
|
9473
|
+
/**
|
|
9474
|
+
* Garante que o painel está fechado quando o componente está disabled
|
|
9475
|
+
*/
|
|
9476
|
+
ensurePanelClosed() {
|
|
9477
|
+
if (this.open) {
|
|
9478
|
+
this.closePanel();
|
|
9479
|
+
}
|
|
9480
|
+
}
|
|
9481
|
+
/**
|
|
9482
|
+
* ControlValueAccessor: Define o estado disabled do FormControl
|
|
9483
|
+
*/
|
|
9356
9484
|
setDisabledState(isDisabled) {
|
|
9357
|
-
this.
|
|
9485
|
+
this.isDisabledByForm = isDisabled;
|
|
9486
|
+
// Se foi desabilitado, garantir que o painel está fechado
|
|
9487
|
+
if (isDisabled) {
|
|
9488
|
+
this.ensurePanelClosed();
|
|
9489
|
+
}
|
|
9490
|
+
// Atualizar a UI
|
|
9491
|
+
this.cdr.markForCheck();
|
|
9358
9492
|
this.cdr.detectChanges();
|
|
9359
9493
|
}
|
|
9360
9494
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaSelectComponent, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
9361
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.0", type: MatchaSelectComponent, isStandalone: false, selector: "matcha-select", inputs: { placement: "placement", maxHeight: "maxHeight", minWidth: "minWidth", placeholder: "placeholder", disabled: "disabled" }, outputs: { opened: "opened", closed: "closed", selectionChange: "selectionChange" }, providers: [
|
|
9495
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.0", type: MatchaSelectComponent, isStandalone: false, selector: "matcha-select", inputs: { placement: "placement", maxHeight: "maxHeight", minWidth: "minWidth", placeholder: "placeholder", disabled: "disabled" }, outputs: { opened: "opened", closed: "closed", selectionChange: "selectionChange" }, host: { properties: { "class.matcha-select-disabled": "this.hostDisabledClass", "attr.disabled": "this.hostDisabledAttr" } }, providers: [
|
|
9362
9496
|
{
|
|
9363
9497
|
provide: NG_VALUE_ACCESSOR,
|
|
9364
9498
|
useExisting: forwardRef(() => MatchaSelectComponent),
|
|
9365
9499
|
multi: true
|
|
9366
9500
|
}
|
|
9367
|
-
], queries: [{ propertyName: "options", predicate: MatchaOptionComponent, descendants: true }], viewQueries: [{ propertyName: "panel", first: true, predicate: MatchaPanelComponent, descendants: true }], ngImport: i0, template: "<div class=\"matcha-select-container\" [class.matcha-select-disabled]=\"
|
|
9501
|
+
], queries: [{ propertyName: "options", predicate: MatchaOptionComponent, descendants: true }], viewQueries: [{ propertyName: "panel", first: true, predicate: MatchaPanelComponent, descendants: true }], ngImport: i0, template: "<div class=\"matcha-select-container\" [class.matcha-select-disabled]=\"isCurrentlyDisabled\">\n <div\n class=\"matcha-select-trigger\"\n [class.matcha-select-open]=\"open\"\n [class.matcha-select-disabled]=\"isCurrentlyDisabled\"\n (click)=\"onTriggerClick()\"\n [attr.tabindex]=\"isCurrentlyDisabled ? -1 : 0\"\n role=\"combobox\"\n [attr.aria-expanded]=\"open\"\n [attr.aria-haspopup]=\"true\"\n [attr.aria-disabled]=\"isCurrentlyDisabled\">\n\n <span class=\"matcha-select-value\" [class.matcha-select-placeholder]=\"!selectedValue\">\n {{ getSelectedLabel() || placeholder }}\n </span>\n\n <span class=\"matcha-select-arrow\" [class.matcha-select-arrow-open]=\"open\">\n <span class=\"i-matcha-action_arrow_down\"></span>\n </span>\n </div>\n\n <matcha-panel\n #panel\n [placement]=\"placement\"\n [maxHeight]=\"maxHeight\"\n [minWidth]=\"minWidth\"\n [open]=\"open\">\n <ng-content></ng-content>\n </matcha-panel>\n</div>\n", styles: [""], dependencies: [{ kind: "component", type: MatchaPanelComponent, selector: "matcha-panel", inputs: ["placement", "maxHeight", "minWidth", "offset", "triggerElement", "open"], outputs: ["opened", "closed"] }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
9368
9502
|
}
|
|
9369
9503
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaSelectComponent, decorators: [{
|
|
9370
9504
|
type: Component,
|
|
@@ -9374,7 +9508,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImpor
|
|
|
9374
9508
|
useExisting: forwardRef(() => MatchaSelectComponent),
|
|
9375
9509
|
multi: true
|
|
9376
9510
|
}
|
|
9377
|
-
], template: "<div class=\"matcha-select-container\" [class.matcha-select-disabled]=\"
|
|
9511
|
+
], template: "<div class=\"matcha-select-container\" [class.matcha-select-disabled]=\"isCurrentlyDisabled\">\n <div\n class=\"matcha-select-trigger\"\n [class.matcha-select-open]=\"open\"\n [class.matcha-select-disabled]=\"isCurrentlyDisabled\"\n (click)=\"onTriggerClick()\"\n [attr.tabindex]=\"isCurrentlyDisabled ? -1 : 0\"\n role=\"combobox\"\n [attr.aria-expanded]=\"open\"\n [attr.aria-haspopup]=\"true\"\n [attr.aria-disabled]=\"isCurrentlyDisabled\">\n\n <span class=\"matcha-select-value\" [class.matcha-select-placeholder]=\"!selectedValue\">\n {{ getSelectedLabel() || placeholder }}\n </span>\n\n <span class=\"matcha-select-arrow\" [class.matcha-select-arrow-open]=\"open\">\n <span class=\"i-matcha-action_arrow_down\"></span>\n </span>\n </div>\n\n <matcha-panel\n #panel\n [placement]=\"placement\"\n [maxHeight]=\"maxHeight\"\n [minWidth]=\"minWidth\"\n [open]=\"open\">\n <ng-content></ng-content>\n </matcha-panel>\n</div>\n" }]
|
|
9378
9512
|
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }], propDecorators: { options: [{
|
|
9379
9513
|
type: ContentChildren,
|
|
9380
9514
|
args: [MatchaOptionComponent, { descendants: true }]
|
|
@@ -9397,6 +9531,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImpor
|
|
|
9397
9531
|
type: Output
|
|
9398
9532
|
}], selectionChange: [{
|
|
9399
9533
|
type: Output
|
|
9534
|
+
}], hostDisabledClass: [{
|
|
9535
|
+
type: HostBinding,
|
|
9536
|
+
args: ['class.matcha-select-disabled']
|
|
9537
|
+
}], hostDisabledAttr: [{
|
|
9538
|
+
type: HostBinding,
|
|
9539
|
+
args: ['attr.disabled']
|
|
9400
9540
|
}] } });
|
|
9401
9541
|
|
|
9402
9542
|
/**
|
|
@@ -9763,12 +9903,6 @@ class MatchaHighlightComponent {
|
|
|
9763
9903
|
* On init
|
|
9764
9904
|
*/
|
|
9765
9905
|
ngOnInit() {
|
|
9766
|
-
// Debug: Verificar se Prism está carregado
|
|
9767
|
-
const Prism = window.Prism;
|
|
9768
|
-
console.log('Prism loaded:', typeof Prism !== 'undefined');
|
|
9769
|
-
if (typeof Prism !== 'undefined') {
|
|
9770
|
-
console.log('Prism languages:', Object.keys(Prism.languages));
|
|
9771
|
-
}
|
|
9772
9906
|
// Aplicar tema
|
|
9773
9907
|
// this.applyTheme();
|
|
9774
9908
|
// If there is no language defined, return...
|
|
@@ -9831,7 +9965,6 @@ class MatchaHighlightComponent {
|
|
|
9831
9965
|
this.loadPrismComponent('/assets/prismjs/components/prism-javascript.js');
|
|
9832
9966
|
this.loadPrismComponent('/assets/prismjs/components/prism-css.js');
|
|
9833
9967
|
this.loadPrismComponent('/assets/prismjs/components/prism-markup.js');
|
|
9834
|
-
console.log('PrismJS carregado com sucesso');
|
|
9835
9968
|
resolve();
|
|
9836
9969
|
};
|
|
9837
9970
|
script.onerror = () => {
|
|
@@ -9860,9 +9993,6 @@ class MatchaHighlightComponent {
|
|
|
9860
9993
|
await this.loadPrismJS();
|
|
9861
9994
|
}
|
|
9862
9995
|
const Prism = window.Prism;
|
|
9863
|
-
console.log('Highlighting code:', sourceCode.substring(0, 50) + '...');
|
|
9864
|
-
console.log('Language:', this.lang);
|
|
9865
|
-
console.log('Prism available:', typeof Prism !== 'undefined');
|
|
9866
9996
|
// Check if Prism is available
|
|
9867
9997
|
if (typeof Prism === 'undefined') {
|
|
9868
9998
|
console.error('Prism.js is not loaded');
|
|
@@ -9871,8 +10001,6 @@ class MatchaHighlightComponent {
|
|
|
9871
10001
|
}
|
|
9872
10002
|
// Check if the language is supported
|
|
9873
10003
|
if (!Prism.languages[this.lang]) {
|
|
9874
|
-
console.error(`Language "${this.lang}" is not supported by Prism.js`);
|
|
9875
|
-
console.log('Available languages:', Object.keys(Prism.languages));
|
|
9876
10004
|
this._elementRef.nativeElement.innerHTML = '<pre><code>' + sourceCode + '</code></pre>';
|
|
9877
10005
|
return;
|
|
9878
10006
|
}
|
|
@@ -9880,7 +10008,6 @@ class MatchaHighlightComponent {
|
|
|
9880
10008
|
const sourceLines = sourceCode.split('\n');
|
|
9881
10009
|
// Verificar se o array não está vazio
|
|
9882
10010
|
if (sourceLines.length === 0) {
|
|
9883
|
-
console.warn('Source code is empty');
|
|
9884
10011
|
this._elementRef.nativeElement.innerHTML = '<pre><code></code></pre>';
|
|
9885
10012
|
return;
|
|
9886
10013
|
}
|
|
@@ -9897,7 +10024,6 @@ class MatchaHighlightComponent {
|
|
|
9897
10024
|
// Find the first non-whitespace char index in
|
|
9898
10025
|
// Verificar novamente se o array não está vazio após remoções
|
|
9899
10026
|
if (sourceLines.length === 0) {
|
|
9900
|
-
console.warn('Source code is empty after trimming');
|
|
9901
10027
|
this._elementRef.nativeElement.innerHTML = '<pre><code></code></pre>';
|
|
9902
10028
|
return;
|
|
9903
10029
|
}
|
|
@@ -9916,10 +10042,8 @@ class MatchaHighlightComponent {
|
|
|
9916
10042
|
source = source + '\n';
|
|
9917
10043
|
}
|
|
9918
10044
|
});
|
|
9919
|
-
console.log('Processed source:', source.substring(0, 50) + '...');
|
|
9920
10045
|
// Generate the highlighted code
|
|
9921
10046
|
const highlightedCode = Prism.highlight(source, Prism.languages[this.lang], this.lang);
|
|
9922
|
-
console.log('Highlighted result:', highlightedCode.substring(0, 100) + '...');
|
|
9923
10047
|
// Replace the innerHTML of the highlight-content div with the highlighted code
|
|
9924
10048
|
const highlightContent = this._elementRef.nativeElement.querySelector('.highlight-content');
|
|
9925
10049
|
if (highlightContent) {
|