@main-class/componentes 3.11.1 → 4.0.0-next.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.
Files changed (136) hide show
  1. package/README.md +17 -0
  2. package/fesm2022/main-class-componentes-arquivo.mjs +851 -369
  3. package/fesm2022/main-class-componentes-arquivo.mjs.map +1 -1
  4. package/fesm2022/main-class-componentes-core.mjs +288 -240
  5. package/fesm2022/main-class-componentes-core.mjs.map +1 -1
  6. package/fesm2022/main-class-componentes-crud.mjs +1004 -546
  7. package/fesm2022/main-class-componentes-crud.mjs.map +1 -1
  8. package/fesm2022/main-class-componentes-dialog.mjs +758 -385
  9. package/fesm2022/main-class-componentes-dialog.mjs.map +1 -1
  10. package/fesm2022/main-class-componentes-form.mjs +299 -196
  11. package/fesm2022/main-class-componentes-form.mjs.map +1 -1
  12. package/fesm2022/main-class-componentes-input.mjs +4143 -2141
  13. package/fesm2022/main-class-componentes-input.mjs.map +1 -1
  14. package/fesm2022/main-class-componentes-loader.mjs +262 -212
  15. package/fesm2022/main-class-componentes-loader.mjs.map +1 -1
  16. package/fesm2022/main-class-componentes-misc.mjs +508 -354
  17. package/fesm2022/main-class-componentes-misc.mjs.map +1 -1
  18. package/fesm2022/main-class-componentes-pipe.mjs +39 -26
  19. package/fesm2022/main-class-componentes-pipe.mjs.map +1 -1
  20. package/fesm2022/main-class-componentes-table.mjs +1331 -624
  21. package/fesm2022/main-class-componentes-table.mjs.map +1 -1
  22. package/fesm2022/main-class-componentes.mjs +3 -11
  23. package/fesm2022/main-class-componentes.mjs.map +1 -1
  24. package/package.json +32 -16
  25. package/types/main-class-componentes-arquivo.d.ts +190 -0
  26. package/types/main-class-componentes-core.d.ts +99 -0
  27. package/types/main-class-componentes-crud.d.ts +172 -0
  28. package/types/main-class-componentes-dialog.d.ts +125 -0
  29. package/types/main-class-componentes-form.d.ts +70 -0
  30. package/types/main-class-componentes-input.d.ts +687 -0
  31. package/types/main-class-componentes-loader.d.ts +69 -0
  32. package/types/main-class-componentes-misc.d.ts +87 -0
  33. package/types/main-class-componentes-pipe.d.ts +10 -0
  34. package/types/main-class-componentes-table.d.ts +265 -0
  35. package/types/main-class-componentes.d.ts +4 -0
  36. package/arquivo/index.d.ts +0 -5
  37. package/arquivo/src/arquivo-manager.service.d.ts +0 -13
  38. package/arquivo/src/download-arquivo.directive.d.ts +0 -12
  39. package/arquivo/src/imagem.directive.d.ts +0 -21
  40. package/arquivo/src/preview-arquivo/dialog-preview-arquivo/dialog-preview-arquivo.component.d.ts +0 -23
  41. package/arquivo/src/preview-arquivo/preview-arquivo.component.d.ts +0 -27
  42. package/core/index.d.ts +0 -4
  43. package/core/src/criptografia/criptografia.service.d.ts +0 -6
  44. package/core/src/mensageria/mensageria.service.d.ts +0 -17
  45. package/core/src/mobile/mobile.service.d.ts +0 -15
  46. package/core/src/validator/valida-modulo11.service.d.ts +0 -55
  47. package/crud/index.d.ts +0 -7
  48. package/crud/src/abstract-consulta-paginada-component.d.ts +0 -24
  49. package/crud/src/abstract-edicao-component.d.ts +0 -19
  50. package/crud/src/abstract-edicao-modal-component.d.ts +0 -19
  51. package/crud/src/query/query-field/query-field.component.d.ts +0 -40
  52. package/crud/src/query/query-form-field/query-form-field.component.d.ts +0 -12
  53. package/crud/src/query/query-form.component.d.ts +0 -28
  54. package/crud/src/query/query-modal-form/query-modal-form.component.d.ts +0 -13
  55. package/dialog/index.d.ts +0 -10
  56. package/dialog/src/dialog-confirmacao/dialog-confirmacao.component.d.ts +0 -23
  57. package/dialog/src/dialog-iframe/dialog-iframe.component.d.ts +0 -21
  58. package/dialog/src/dialog-sidebar/modal-template/modal-body.directive.d.ts +0 -9
  59. package/dialog/src/dialog-sidebar/modal-template/modal-close.directive.d.ts +0 -9
  60. package/dialog/src/dialog-sidebar/modal-template/modal-footer.directive.d.ts +0 -6
  61. package/dialog/src/dialog-sidebar/modal-template/modal-header.directive.d.ts +0 -6
  62. package/dialog/src/dialog-sidebar/modal-template/modal-template.component.d.ts +0 -12
  63. package/dialog/src/dialog-sidebar/modal.component.d.ts +0 -8
  64. package/dialog/src/dialog-sidebar/sidebar-modal-ref.d.ts +0 -21
  65. package/dialog/src/dialog.service.d.ts +0 -26
  66. package/form/index.d.ts +0 -3
  67. package/form/src/form.component.d.ts +0 -24
  68. package/form/src/mensagens-erro/mensagens-erro.component.d.ts +0 -17
  69. package/form/src/single-click.directive.d.ts +0 -13
  70. package/index.d.ts +0 -5
  71. package/input/index.d.ts +0 -26
  72. package/input/src/abstract-control-value-accessor.d.ts +0 -18
  73. package/input/src/abstract-mat-form-field-control.d.ts +0 -42
  74. package/input/src/abstract-mat-form-field-select-control.d.ts +0 -31
  75. package/input/src/input-currency/input-currency.component.d.ts +0 -9
  76. package/input/src/input-datetime/input-datetime.component.d.ts +0 -32
  77. package/input/src/input-fileupload/input-fileupload-validator.directive.d.ts +0 -8
  78. package/input/src/input-fileupload/input-fileupload.component.d.ts +0 -70
  79. package/input/src/input-mask/documento-validators.d.ts +0 -7
  80. package/input/src/input-mask/input-cep.component.d.ts +0 -7
  81. package/input/src/input-mask/input-cnpj.component.d.ts +0 -7
  82. package/input/src/input-mask/input-cpf-cnpj.component.d.ts +0 -7
  83. package/input/src/input-mask/input-cpf.component.d.ts +0 -7
  84. package/input/src/input-mask/input-mask-validator.directive.d.ts +0 -16
  85. package/input/src/input-mask/input-mask.component.d.ts +0 -24
  86. package/input/src/input-mask/input-phone.component.d.ts +0 -7
  87. package/input/src/input-mask/mask-functions.d.ts +0 -2
  88. package/input/src/input-telefone-internacional/input-telefone-internacional-validator.directive.d.ts +0 -8
  89. package/input/src/input-telefone-internacional/input-telefone-internacional.component.d.ts +0 -19
  90. package/input/src/option-checkbox/all-option-checkbox.component.d.ts +0 -18
  91. package/input/src/option-checkbox/node-pool.d.ts +0 -23
  92. package/input/src/option-checkbox/option-checkbox-group.component.d.ts +0 -25
  93. package/input/src/option-checkbox/option-checkbox.component.d.ts +0 -23
  94. package/input/src/option-checkbox/option-checkbox.service.d.ts +0 -16
  95. package/input/src/option-checkbox/option-node.d.ts +0 -13
  96. package/input/src/select-autocomplete/select-autocomplete.component.d.ts +0 -15
  97. package/input/src/select-chips/select-chips.component.d.ts +0 -12
  98. package/input/src/select-many-checkbox/select-many-checkbox.component.d.ts +0 -12
  99. package/input/src/select-option/delegate-option-provider.directive.d.ts +0 -13
  100. package/input/src/select-option/select-option-provider.d.ts +0 -10
  101. package/input/src/select-option/select-option.component.d.ts +0 -10
  102. package/input/src/select-option/select-option.d.ts +0 -4
  103. package/input/src/select-radio/select-radio.component.d.ts +0 -9
  104. package/loader/index.d.ts +0 -2
  105. package/loader/src/loader.component.d.ts +0 -25
  106. package/loader/src/loader.service.d.ts +0 -20
  107. package/misc/index.d.ts +0 -12
  108. package/misc/src/cnpj/cnpj.directive.d.ts +0 -12
  109. package/misc/src/cnpj/cnpjs.pipe.d.ts +0 -7
  110. package/misc/src/cpf/cpf.directive.d.ts +0 -12
  111. package/misc/src/cpf/cpf.pipe.d.ts +0 -7
  112. package/misc/src/cpf-cnpj/cpf-cnpj.directive.d.ts +0 -12
  113. package/misc/src/cpf-cnpj/cpf-cnpj.pipe.d.ts +0 -7
  114. package/misc/src/mask/mask.pipe.d.ts +0 -8
  115. package/misc/src/monetario/monetario-mask.d.ts +0 -1
  116. package/misc/src/monetario/monetario.pipe.d.ts +0 -7
  117. package/misc/src/porcentagem/porcentagem-mask.d.ts +0 -1
  118. package/misc/src/porcentagem/porcentagem.pipe.d.ts +0 -7
  119. package/misc/src/telefone/telefone.pipe.d.ts +0 -7
  120. package/misc/src/unsafe-inner-html/unsafe-inner-html.directive.d.ts +0 -10
  121. package/pipe/index.d.ts +0 -1
  122. package/pipe/src/nome-resumido.pipe.d.ts +0 -7
  123. package/public-api.d.ts +0 -2
  124. package/table/index.d.ts +0 -10
  125. package/table/src/column/column-cell.directive.d.ts +0 -8
  126. package/table/src/column/column-footer.directive.d.ts +0 -8
  127. package/table/src/column/column-header.directive.d.ts +0 -8
  128. package/table/src/column/column.directive.d.ts +0 -16
  129. package/table/src/numeric-paginator/numeric-paginator.component.d.ts +0 -26
  130. package/table/src/paginated-table/paginated-table.component.d.ts +0 -58
  131. package/table/src/paginator-i18n.d.ts +0 -8
  132. package/table/src/table/table.component.d.ts +0 -41
  133. package/table/src/td/td.component.d.ts +0 -8
  134. package/table/src/th/th.component.d.ts +0 -8
  135. package/table/src/undefined-paginator/undefined-paginator.component.d.ts +0 -25
  136. package/table/src/virtual-paginated-table/virtual-paginated-table.component.d.ts +0 -28
@@ -1,547 +1,1005 @@
1
- import * as i0 from '@angular/core';
2
- import { Input, ContentChildren, Inject, Self, Optional, Component, EventEmitter, TemplateRef, Output, ViewChild, inject } from '@angular/core';
3
- import * as i1 from '@angular/forms';
4
- import { FormControl, Validators, ReactiveFormsModule, FormsModule } from '@angular/forms';
5
- import { of, debounceTime, lastValueFrom } from 'rxjs';
6
- import { DatePipe, NgClass } from '@angular/common';
7
- import { SELECT_OPTION_PROVIDER, SelectOptionComponent, InputDatetimeComponent, InputCpfComponent, InputCnpjComponent, InputCpfCnpjComponent, SelectAutocompleteComponent, InputMaskComponent, InputCurrencyComponent, DelegateOptionProviderDirective } from '@main-class/componentes/input';
8
- import { CpfCnpjPipe, MonetarioPipe, MaskPipe } from '@main-class/componentes/misc';
9
- import { MensagensErroComponent } from '@main-class/componentes/form';
10
- import { MatIconButton, MatButton } from '@angular/material/button';
11
- import { MatIcon } from '@angular/material/icon';
12
- import { MatFormField, MatError, MatLabel, MatHint, MatSuffix } from '@angular/material/form-field';
13
- import { MatInput } from '@angular/material/input';
14
- import * as i2 from '@main-class/componentes/dialog';
15
- import { SIDEBAR_MODAL_DATA, ModalHeaderDirective, ModalCloseDirective, ModalBodyDirective, ModalFooterDirective, DialogService } from '@main-class/componentes/dialog';
16
- import { delay } from 'rxjs/operators';
17
- import * as i1$1 from '@angular/router';
18
- import { Router, ActivatedRoute } from '@angular/router';
19
- import { LoaderService } from '@main-class/componentes/loader';
20
- import { PaginatedTableComponent } from '@main-class/componentes/table';
21
- import { MensageriaService } from '@main-class/componentes/core';
22
- import { MatDialogRef } from '@angular/material/dialog';
23
-
24
- class QueryFieldComponent {
25
- optionProvider;
26
- cpfCnpjPipe = new CpfCnpjPipe();
27
- datePipe = new DatePipe('pt-BR');
28
- currencyPipe = new MonetarioPipe();
29
- maskPipe = new MaskPipe();
30
- $fieldType;
31
- formControl = new FormControl('');
32
- labelText;
33
- description;
34
- mask;
35
- name;
36
- $fixed;
37
- options;
38
- fields;
39
- constructor(optionProvider) {
40
- this.optionProvider = optionProvider;
41
- }
42
- set fixed(fixed) {
43
- this.$fixed = fixed || fixed === '';
44
- }
45
- get fixed() {
46
- return this.$fixed;
47
- }
48
- get required() {
49
- return this.formControl.hasValidator(Validators.required);
50
- }
51
- get fieldType() {
52
- return this.$fieldType;
53
- }
54
- set fieldType(fieldType) {
55
- this.$fieldType = fieldType;
56
- }
57
- get empty() {
58
- if (this.fieldType === 'group') {
59
- return !this.fields?.find(field => !field.empty);
60
- }
61
- return this.formControl?.value === '' || this.formControl?.value === undefined || this.formControl?.value === null;
62
- }
63
- get value() {
64
- if (!this.empty) {
65
- switch (this.fieldType) {
66
- case 'cpf':
67
- case 'cnpj':
68
- case 'cpf_cnpj':
69
- return this.cpfCnpjPipe.transform(this.formControl?.value);
70
- case 'date':
71
- return this.datePipe.transform(this.formControl?.value, 'dd/MM/yyyy');
72
- case 'option':
73
- return this.label(this.formControl?.value);
74
- case 'currency':
75
- return this.currencyPipe.transform(this.formControl?.value);
76
- case 'mask':
77
- return this.maskPipe.transform(this.formControl?.value, this.mask);
78
- }
79
- return this.formControl?.value;
80
- }
81
- return undefined;
82
- }
83
- type() {
84
- switch (this.fieldType) {
85
- case 'date':
86
- return 'date';
87
- case 'option':
88
- return this.optionProvider?.type() || 'object';
89
- }
90
- return 'string';
91
- }
92
- provide(search) {
93
- if (!!this.optionProvider) {
94
- return this.optionProvider.provide(search);
95
- }
96
- if (typeof search === 'string' || search == undefined) {
97
- return of((this.options?.toArray() || [])
98
- .filter(op => (op.label || '').indexOf((search || '').toLowerCase()) >= 0));
99
- }
100
- return of(this.options?.toArray() || []);
101
- }
102
- label(value) {
103
- if (!!this.optionProvider) {
104
- return this.optionProvider.label(value);
105
- }
106
- return this.options?.find(op => op.value === value)?.label || '';
107
- }
108
- trackBy(value) {
109
- if (!!this.optionProvider?.trackBy) {
110
- return this.optionProvider.trackBy(value);
111
- }
112
- return value;
113
- }
114
- clear() {
115
- if (this.fieldType === 'group') {
116
- this.fields?.forEach(field => field.clear());
117
- }
118
- else {
119
- this.formControl?.setValue(undefined);
120
- }
121
- }
122
- serialized() {
123
- if (!this.empty) {
124
- switch (this.type()) {
125
- case 'object':
126
- return JSON.stringify(this.formControl.value);
127
- }
128
- return String(this.formControl.value);
129
- }
130
- return undefined;
131
- }
132
- desserialize(value) {
133
- if (!!value) {
134
- switch (this.type()) {
135
- case 'object':
136
- return JSON.parse(value);
137
- case 'date':
138
- return new Date(value);
139
- case 'number':
140
- return Number(value);
141
- }
142
- return value;
143
- }
144
- return undefined;
145
- }
146
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.9", ngImport: i0, type: QueryFieldComponent, deps: [{ token: SELECT_OPTION_PROVIDER, optional: true, self: true }], target: i0.ɵɵFactoryTarget.Component });
147
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.9", type: QueryFieldComponent, isStandalone: true, selector: "mcl-query-field", inputs: { labelText: ["label", "labelText"], description: "description", mask: "mask", name: "name", fixed: "fixed", fieldType: ["type", "fieldType"] }, queries: [{ propertyName: "options", predicate: SelectOptionComponent }, { propertyName: "fields", predicate: QueryFieldComponent }], ngImport: i0, template: "", styles: [""], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }] });
148
- }
149
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.9", ngImport: i0, type: QueryFieldComponent, decorators: [{
150
- type: Component,
151
- args: [{ selector: 'mcl-query-field', imports: [
152
- ReactiveFormsModule
153
- ], template: "" }]
154
- }], ctorParameters: () => [{ type: undefined, decorators: [{
155
- type: Inject,
156
- args: [SELECT_OPTION_PROVIDER]
157
- }, {
158
- type: Self
159
- }, {
160
- type: Optional
161
- }] }], propDecorators: { labelText: [{
162
- type: Input,
163
- args: ['label']
164
- }], description: [{
165
- type: Input
166
- }], mask: [{
167
- type: Input
168
- }], name: [{
169
- type: Input
170
- }], options: [{
171
- type: ContentChildren,
172
- args: [SelectOptionComponent]
173
- }], fields: [{
174
- type: ContentChildren,
175
- args: [QueryFieldComponent]
176
- }], fixed: [{
177
- type: Input
178
- }], fieldType: [{
179
- type: Input,
180
- args: ['type']
181
- }] } });
182
-
183
- class QueryFormFieldComponent {
184
- field;
185
- control;
186
- get formControl() {
187
- return this.control;
188
- }
189
- get formGroup() {
190
- return this.control;
191
- }
192
- clear() {
193
- this.formControl.setValue(undefined);
194
- }
195
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.9", ngImport: i0, type: QueryFormFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
196
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.9", type: QueryFormFieldComponent, isStandalone: true, selector: "mcl-query-form-field", inputs: { field: "field", control: "control" }, ngImport: i0, template: "@if (field!.fieldType === 'group') {\n <div [formGroup]=\"formGroup\">\n @for (child of field!.fields; track child.labelText) {\n <mcl-query-form-field [field]=\"child\"\n [control]=\"formGroup.controls[child.labelText!]\"></mcl-query-form-field>\n }\n </div>\n} @else {\n <mat-form-field>\n <mat-label>{{ field!.labelText }}</mat-label>\n @switch (field!.fieldType) {\n @case ('input') {\n <input matInput [formControl]=\"formControl\"/>\n }\n @case ('cpf') {\n <mcl-input cpf [formControl]=\"formControl\"/>\n }\n @case ('cnpj') {\n <mcl-input cnpj [formControl]=\"formControl\"/>\n }\n @case ('cpf_cnpj') {\n <mcl-input cpfCnpj [formControl]=\"formControl\"/>\n }\n @case ('date') {\n <mcl-input-datetime type=\"date\" [formControl]=\"formControl\"/>\n }\n @case ('option') {\n <mcl-select-autocomplete [formControl]=\"formControl\" [delegate]=\"field\"/>\n }\n @case ('mask') {\n <mcl-input [mask]=\"field!.mask!\" [formControl]=\"formControl\"/>\n }\n @case ('currency') {\n <mcl-input currency [formControl]=\"formControl\"/>\n }\n }\n @if (formControl.value) {\n <button mat-icon-button matSuffix (click)=\"clear()\">\n <mat-icon>close</mat-icon>\n </button>\n }\n @if (!!field?.description) {\n <mat-hint>{{ field?.description }}</mat-hint>\n }\n <mat-error [mclErrorFor]=\"formControl\"></mat-error>\n </mat-form-field>\n}\n", styles: [""], dependencies: [{ kind: "component", type: QueryFormFieldComponent, selector: "mcl-query-form-field", inputs: ["field", "control"] }, { kind: "component", type: MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.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: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "component", type: InputDatetimeComponent, selector: "mcl-input-datetime", inputs: ["type", "readonly", "name"] }, { kind: "directive", type: MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: MatLabel, selector: "mat-label" }, { kind: "directive", type: MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "component", type: InputCpfComponent, selector: "mcl-input[cpf]" }, { kind: "component", type: InputCnpjComponent, selector: "mcl-input[cnpj]" }, { kind: "component", type: InputCpfCnpjComponent, selector: "mcl-input[cpfCnpj]" }, { kind: "component", type: SelectAutocompleteComponent, selector: "mcl-select-autocomplete", inputs: ["readonly"], outputs: ["select", "blur"] }, { kind: "component", type: InputMaskComponent, selector: "mcl-input[mask]", inputs: ["keepMask", "mask"], outputs: ["focusin", "focusout"] }, { kind: "component", type: MensagensErroComponent, selector: "[mclErrorFor],[mclError]", inputs: ["mclErrorFor"] }, { kind: "component", type: InputCurrencyComponent, selector: "mcl-input[currency]" }, { kind: "directive", type: DelegateOptionProviderDirective, selector: "mcl-select-autocomplete[delegate]", inputs: ["delegate"] }, { kind: "component", type: MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }] });
197
- }
198
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.9", ngImport: i0, type: QueryFormFieldComponent, decorators: [{
199
- type: Component,
200
- args: [{ selector: 'mcl-query-form-field', imports: [
201
- MatFormField,
202
- ReactiveFormsModule,
203
- MatInput,
204
- InputDatetimeComponent,
205
- MatError,
206
- MatLabel,
207
- MatHint,
208
- InputCpfComponent,
209
- InputCnpjComponent,
210
- InputCpfCnpjComponent,
211
- SelectAutocompleteComponent,
212
- InputMaskComponent,
213
- MensagensErroComponent,
214
- InputCurrencyComponent,
215
- DelegateOptionProviderDirective,
216
- MatIconButton,
217
- MatIcon,
218
- MatSuffix
219
- ], template: "@if (field!.fieldType === 'group') {\n <div [formGroup]=\"formGroup\">\n @for (child of field!.fields; track child.labelText) {\n <mcl-query-form-field [field]=\"child\"\n [control]=\"formGroup.controls[child.labelText!]\"></mcl-query-form-field>\n }\n </div>\n} @else {\n <mat-form-field>\n <mat-label>{{ field!.labelText }}</mat-label>\n @switch (field!.fieldType) {\n @case ('input') {\n <input matInput [formControl]=\"formControl\"/>\n }\n @case ('cpf') {\n <mcl-input cpf [formControl]=\"formControl\"/>\n }\n @case ('cnpj') {\n <mcl-input cnpj [formControl]=\"formControl\"/>\n }\n @case ('cpf_cnpj') {\n <mcl-input cpfCnpj [formControl]=\"formControl\"/>\n }\n @case ('date') {\n <mcl-input-datetime type=\"date\" [formControl]=\"formControl\"/>\n }\n @case ('option') {\n <mcl-select-autocomplete [formControl]=\"formControl\" [delegate]=\"field\"/>\n }\n @case ('mask') {\n <mcl-input [mask]=\"field!.mask!\" [formControl]=\"formControl\"/>\n }\n @case ('currency') {\n <mcl-input currency [formControl]=\"formControl\"/>\n }\n }\n @if (formControl.value) {\n <button mat-icon-button matSuffix (click)=\"clear()\">\n <mat-icon>close</mat-icon>\n </button>\n }\n @if (!!field?.description) {\n <mat-hint>{{ field?.description }}</mat-hint>\n }\n <mat-error [mclErrorFor]=\"formControl\"></mat-error>\n </mat-form-field>\n}\n" }]
220
- }], propDecorators: { field: [{
221
- type: Input
222
- }], control: [{
223
- type: Input
224
- }] } });
225
-
226
- class QueryModalFormComponent {
227
- modalRef;
228
- fields;
229
- form;
230
- constructor(fb, modalRef, fields) {
231
- this.modalRef = modalRef;
232
- this.fields = fields;
233
- this.form = fb.group(fields.map(field => {
234
- if (field.fieldType === 'group') {
235
- return {
236
- [field.name]: fb.group(field.fields.map(child => ({
237
- [child.name]: fb.control(child.formControl.value)
238
- })).reduce((c1, c2) => ({ ...c1, ...c2 })))
239
- };
240
- }
241
- else {
242
- return { [field.name]: fb.control(field.formControl.value) };
243
- }
244
- }).reduce((c1, c2) => ({ ...c1, ...c2 })));
245
- }
246
- apply() {
247
- this.fields.forEach(field => {
248
- if (field.fieldType === 'group') {
249
- const formGroup = this.form.controls[field.name];
250
- field.fields?.forEach(child => {
251
- child.formControl.patchValue(formGroup.controls[child.name].value);
252
- });
253
- }
254
- else {
255
- const formControl = this.form.controls[field.name];
256
- field.formControl.patchValue(formControl.value);
257
- }
258
- });
259
- this.modalRef.close();
260
- }
261
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.9", ngImport: i0, type: QueryModalFormComponent, deps: [{ token: i1.FormBuilder }, { token: i2.SidebarModalRef }, { token: SIDEBAR_MODAL_DATA }], target: i0.ɵɵFactoryTarget.Component });
262
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.9", type: QueryModalFormComponent, isStandalone: true, selector: "mcl-query-form", ngImport: i0, template: "<form (ngSubmit)=\"apply()\" class=\"sidebar\">\n <h2 mclSidebarModalHeader>\n <mat-icon>search</mat-icon>\n Aplicar filtros\n </h2>\n\n <div mclSidebarModalBody>\n @for (field of fields; track field.name) {\n <div [ngClass]=\"field.fieldType\">\n @if (field.fieldType === 'group') {\n <h3>{{ field.labelText }}</h3>\n }\n\n <mcl-query-form-field [field]=\"field\" [control]=\"form.controls[field.name!]!\"></mcl-query-form-field>\n </div>\n }\n </div>\n\n <div mclSidebarModalFooter>\n <button mat-flat-button color=\"primary\" type=\"submit\">\n Aplicar\n </button>\n <button mat-button type=\"button\" mclSidebarModalClose>\n Cancelar\n </button>\n </div>\n</form>\n", styles: ["@charset \"UTF-8\";:host{--af-bg: var(--lib-color-surface, var(--mat-sys-surface));--af-fg: var(--lib-color-on-surface, var(--mat-sys-on-surface));--af-muted: var(--lib-color-outline, var(--mat-sys-outline));--af-border: var(--lib-color-outline-variant, var(--mat-sys-outline-variant));--af-primary: var(--lib-color-primary, var(--mat-sys-primary));--af-struct: var(--lib-color-secondary, var(--mat-sys-secondary));--af-gap: 12px;--af-slot-gap: 10px;--af-slot-min: 220px;display:block;background:var(--af-bg);color:var(--af-fg)}.aff{display:grid;gap:var(--af-gap)}.aff__section-title{display:flex;align-items:center;gap:8px;margin:8px 0 4px;font-size:.95rem;font-weight:700;color:var(--af-fg)}.aff__section-mark{inline-size:4px;block-size:16px;border-radius:999px;background:var(--af-struct)}.aff__slot{display:grid;gap:var(--af-slot-gap);grid-template-columns:repeat(auto-fit,minmax(var(--af-slot-min),1fr));align-items:start}.aff-group{background:transparent;border:1px solid var(--af-border);border-radius:12px;padding:12px;display:grid;gap:10px}.aff-group__head{display:flex;align-items:center;gap:8px}.aff-group__title{display:inline-flex;align-items:center;gap:8px;font-size:.92rem;font-weight:700;color:var(--af-fg);margin:0}.aff-group__title-mark{inline-size:4px;block-size:16px;border-radius:999px;background:var(--af-struct)}.aff-group__clear{margin-inline-start:auto;inline-size:30px;block-size:30px;display:grid;place-items:center;border-radius:10px;border:1px solid transparent;background:transparent;color:var(--af-muted);cursor:pointer;transition:background-color .15s ease,color .15s ease}.aff-group__clear:hover{background:color-mix(in oklab,var(--af-primary) 10%,#fff);color:var(--af-fg)}.aff-group__clear:focus-visible{outline:2px solid color-mix(in oklab,var(--af-primary) 60%,#fff);outline-offset:2px}.aff-group__clear mat-icon{font-size:20px}.aff-group__fields{display:grid;gap:var(--af-slot-gap);grid-template-columns:repeat(auto-fit,minmax(var(--af-slot-min),1fr));align-items:start}.aff-subtitle{font-size:.85rem;font-weight:700;color:color-mix(in oklab,var(--af-fg) 90%,#222);margin:4px 0 0}.aff__inline-actions{display:flex;gap:8px;justify-content:flex-end}.aff__btn{height:32px;padding:0 10px;border-radius:10px;border:1px solid var(--af-border);background:#fff;color:var(--af-fg);display:inline-flex;align-items:center;gap:6px;transition:background-color .15s ease,border-color .15s ease,color .15s ease}.aff__btn:hover{background:color-mix(in oklab,var(--af-primary) 8%,#fff)}.aff__btn mat-icon{font-size:20px}@media (max-width: 600px){.aff__slot,.aff-group__fields{grid-template-columns:1fr}}\n"], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: ModalHeaderDirective, selector: "[mclSidebarModalHeader]" }, { kind: "directive", type: ModalCloseDirective, selector: "[mclSidebarModalClose]" }, { kind: "directive", type: ModalBodyDirective, selector: "[mclSidebarModalBody]" }, { kind: "directive", type: ModalFooterDirective, selector: "[mclSidebarModalFooter]" }, { kind: "component", type: QueryFormFieldComponent, selector: "mcl-query-form-field", inputs: ["field", "control"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] });
263
- }
264
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.9", ngImport: i0, type: QueryModalFormComponent, decorators: [{
265
- type: Component,
266
- args: [{ selector: 'mcl-query-form', imports: [
267
- ReactiveFormsModule,
268
- FormsModule,
269
- ModalHeaderDirective,
270
- ModalCloseDirective,
271
- ModalBodyDirective,
272
- ModalFooterDirective,
273
- QueryFormFieldComponent,
274
- NgClass,
275
- ModalFooterDirective,
276
- ModalCloseDirective,
277
- MatButton,
278
- ModalBodyDirective,
279
- ModalHeaderDirective,
280
- MatIcon
281
- ], template: "<form (ngSubmit)=\"apply()\" class=\"sidebar\">\n <h2 mclSidebarModalHeader>\n <mat-icon>search</mat-icon>\n Aplicar filtros\n </h2>\n\n <div mclSidebarModalBody>\n @for (field of fields; track field.name) {\n <div [ngClass]=\"field.fieldType\">\n @if (field.fieldType === 'group') {\n <h3>{{ field.labelText }}</h3>\n }\n\n <mcl-query-form-field [field]=\"field\" [control]=\"form.controls[field.name!]!\"></mcl-query-form-field>\n </div>\n }\n </div>\n\n <div mclSidebarModalFooter>\n <button mat-flat-button color=\"primary\" type=\"submit\">\n Aplicar\n </button>\n <button mat-button type=\"button\" mclSidebarModalClose>\n Cancelar\n </button>\n </div>\n</form>\n", styles: ["@charset \"UTF-8\";:host{--af-bg: var(--lib-color-surface, var(--mat-sys-surface));--af-fg: var(--lib-color-on-surface, var(--mat-sys-on-surface));--af-muted: var(--lib-color-outline, var(--mat-sys-outline));--af-border: var(--lib-color-outline-variant, var(--mat-sys-outline-variant));--af-primary: var(--lib-color-primary, var(--mat-sys-primary));--af-struct: var(--lib-color-secondary, var(--mat-sys-secondary));--af-gap: 12px;--af-slot-gap: 10px;--af-slot-min: 220px;display:block;background:var(--af-bg);color:var(--af-fg)}.aff{display:grid;gap:var(--af-gap)}.aff__section-title{display:flex;align-items:center;gap:8px;margin:8px 0 4px;font-size:.95rem;font-weight:700;color:var(--af-fg)}.aff__section-mark{inline-size:4px;block-size:16px;border-radius:999px;background:var(--af-struct)}.aff__slot{display:grid;gap:var(--af-slot-gap);grid-template-columns:repeat(auto-fit,minmax(var(--af-slot-min),1fr));align-items:start}.aff-group{background:transparent;border:1px solid var(--af-border);border-radius:12px;padding:12px;display:grid;gap:10px}.aff-group__head{display:flex;align-items:center;gap:8px}.aff-group__title{display:inline-flex;align-items:center;gap:8px;font-size:.92rem;font-weight:700;color:var(--af-fg);margin:0}.aff-group__title-mark{inline-size:4px;block-size:16px;border-radius:999px;background:var(--af-struct)}.aff-group__clear{margin-inline-start:auto;inline-size:30px;block-size:30px;display:grid;place-items:center;border-radius:10px;border:1px solid transparent;background:transparent;color:var(--af-muted);cursor:pointer;transition:background-color .15s ease,color .15s ease}.aff-group__clear:hover{background:color-mix(in oklab,var(--af-primary) 10%,#fff);color:var(--af-fg)}.aff-group__clear:focus-visible{outline:2px solid color-mix(in oklab,var(--af-primary) 60%,#fff);outline-offset:2px}.aff-group__clear mat-icon{font-size:20px}.aff-group__fields{display:grid;gap:var(--af-slot-gap);grid-template-columns:repeat(auto-fit,minmax(var(--af-slot-min),1fr));align-items:start}.aff-subtitle{font-size:.85rem;font-weight:700;color:color-mix(in oklab,var(--af-fg) 90%,#222);margin:4px 0 0}.aff__inline-actions{display:flex;gap:8px;justify-content:flex-end}.aff__btn{height:32px;padding:0 10px;border-radius:10px;border:1px solid var(--af-border);background:#fff;color:var(--af-fg);display:inline-flex;align-items:center;gap:6px;transition:background-color .15s ease,border-color .15s ease,color .15s ease}.aff__btn:hover{background:color-mix(in oklab,var(--af-primary) 8%,#fff)}.aff__btn mat-icon{font-size:20px}@media (max-width: 600px){.aff__slot,.aff-group__fields{grid-template-columns:1fr}}\n"] }]
282
- }], ctorParameters: () => [{ type: i1.FormBuilder }, { type: i2.SidebarModalRef }, { type: Array, decorators: [{
283
- type: Inject,
284
- args: [SIDEBAR_MODAL_DATA]
285
- }] }] });
286
-
287
- class QueryFormComponent {
288
- router;
289
- dialogService;
290
- activatedRoute;
291
- fields;
292
- modalTemplate;
293
- query = new EventEmitter();
294
- _subscriptions = {};
295
- constructor(router, dialogService, activatedRoute) {
296
- this.router = router;
297
- this.dialogService = dialogService;
298
- this.activatedRoute = activatedRoute;
299
- }
300
- ngAfterViewInit() {
301
- this.activatedRoute.queryParams
302
- .pipe(debounceTime(300))
303
- .subscribe(qp => {
304
- this.desserialize(qp);
305
- });
306
- this.fields.changes.subscribe(() => {
307
- this.configFieldsSubscriptions();
308
- });
309
- this.configFieldsSubscriptions();
310
- }
311
- ngOnDestroy() {
312
- Object.keys(this._subscriptions).forEach(key => {
313
- this._subscriptions[key].unsubscribe();
314
- delete this._subscriptions[key];
315
- });
316
- }
317
- get filterCount() {
318
- return this.fields?.filter(f => !f.fixed && !f.empty)?.length || 0;
319
- }
320
- openFilter($event) {
321
- $event.stopPropagation();
322
- this.dialogService.openSidebar(QueryModalFormComponent, {
323
- data: this.fields.toArray()
324
- }).afterClosed().subscribe(query => {
325
- this.router.navigate(['./'], {
326
- relativeTo: this.activatedRoute,
327
- queryParams: this.serialized(),
328
- });
329
- });
330
- }
331
- clearAll() {
332
- this.fields?.forEach(field => {
333
- field.clear();
334
- });
335
- this.router.navigate(['./'], {
336
- relativeTo: this.activatedRoute,
337
- queryParams: this.serialized(),
338
- });
339
- }
340
- clear(item) {
341
- item.clear();
342
- this.router.navigate(['./'], {
343
- relativeTo: this.activatedRoute,
344
- queryParams: this.serialized(),
345
- });
346
- }
347
- Validators = Validators;
348
- serialized() {
349
- let obj = this.fields?.map(field => {
350
- if (field.fieldType === 'group') {
351
- return field.fields.map(child => ({
352
- [`${field.name}.${child.name}`]: child.serialized()
353
- })).reduce((c1, c2) => ({ ...c1, ...c2 }));
354
- }
355
- else {
356
- return { [field.name]: field.serialized() };
357
- }
358
- }).reduce((c1, c2) => ({ ...c1, ...c2 }));
359
- console.log('filtro: ', obj);
360
- return obj;
361
- }
362
- desserialize(value) {
363
- this.fields?.forEach(field => {
364
- if (field.fieldType === 'group') {
365
- field.fields.forEach(child => {
366
- child.formControl.patchValue(child.desserialize(value[`${field.name}.${child.name}`]));
367
- });
368
- }
369
- else {
370
- field.formControl.patchValue(field.desserialize(value[field.name]));
371
- }
372
- });
373
- const query = this.fields
374
- ?.filter(field => !field.empty)
375
- ?.map(field => {
376
- if (field.fieldType === 'group') {
377
- return {
378
- [field.name]: field.fields
379
- ?.filter(field => !field.empty)
380
- ?.map(field => ({ [field.name]: field.formControl.value }))
381
- .reduce((o1, o2) => ({ ...o1, ...o2 }), {})
382
- };
383
- }
384
- else {
385
- return { [field.name]: field.formControl.value };
386
- }
387
- })
388
- .reduce((o1, o2) => ({ ...o1, ...o2 }), {});
389
- this.query.emit(query);
390
- }
391
- configFieldsSubscriptions() {
392
- this.fields.forEach(field => {
393
- if (!this._subscriptions[field.name]) {
394
- this._subscriptions[field.name] = field.formControl.valueChanges
395
- .pipe(delay(300)).subscribe(_ => {
396
- console.log('field: ', field.name, ' value: ', field.formControl.value);
397
- const queryParams = this.activatedRoute.snapshot.queryParams;
398
- if (field.serialized() !== queryParams[field.name]) {
399
- this.router.navigate(['./'], {
400
- relativeTo: this.activatedRoute,
401
- queryParams: this.serialized(),
402
- });
403
- }
404
- });
405
- }
406
- });
407
- Object.keys(this._subscriptions).forEach(key => {
408
- if (!this.fields?.find(field => field.name === key)) {
409
- this._subscriptions[key].unsubscribe();
410
- delete this._subscriptions[key];
411
- }
412
- });
413
- }
414
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.9", ngImport: i0, type: QueryFormComponent, deps: [{ token: i1$1.Router }, { token: i2.DialogService }, { token: i1$1.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Component });
415
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.9", type: QueryFormComponent, isStandalone: true, selector: "mcl-query-form", outputs: { query: "query" }, queries: [{ propertyName: "fields", predicate: QueryFieldComponent }], viewQueries: [{ propertyName: "modalTemplate", first: true, predicate: ["modalTemplate"], descendants: true, read: TemplateRef }], ngImport: i0, template: "@if (!!fields) {\n <section class=\"flt\" aria-label=\"Filtros e busca\">\n <!-- Barra de filtros aplicados (chips) -->\n @if (filterCount > 0) {\n <div class=\"flt__applied\">\n <div class=\"flt__applied-title\">Filtros aplicados:</div>\n\n <ul class=\"flt__chips\" role=\"list\">\n @for (field of fields.toArray(); track field.labelText) {\n @if (!field.fixed && !field.empty) {\n\n @if (field.fieldType === 'group') {\n\n <li class=\"flt__chip-group\">\n <div class=\"flt__chip-group-head\">\n <span class=\"flt__chip-group-title\">{{ field.labelText }}</span>\n @if (!field.required) {\n <button\n type=\"button\"\n class=\"flt__chip-group-clear\"\n (click)=\"clear(field)\">\n <mat-icon aria-hidden=\"true\">close</mat-icon>\n </button>\n }\n </div>\n\n <ul class=\"flt__chip-group-items\" role=\"list\">\n @for (sub of field.fields; track sub.labelText) {\n <li class=\"flt__chip flt__chip--sub\">\n @if (sub.labelText) {\n <span class=\"flt__chip-label\">{{ sub.labelText }}:</span>\n }\n <span class=\"flt__chip-value\">{{ sub.value }}</span>\n\n @if (!sub.required) {\n <button\n type=\"button\"\n class=\"flt__chip-remove\"\n (click)=\"clear(field)\">\n <mat-icon aria-hidden=\"true\">close</mat-icon>\n </button>\n }\n </li>\n }\n </ul>\n </li>\n } @else {\n <li class=\"flt__chip\">\n <span class=\"flt__chip-label\">{{ field.labelText }}:</span>\n <span class=\"flt__chip-value\">{{ field.value }}</span>\n\n @if (!field.required) {\n <button\n type=\"button\"\n class=\"flt__chip-remove\"\n (click)=\"clear(field)\">\n <mat-icon aria-hidden=\"true\">close</mat-icon>\n </button>\n }\n </li>\n }\n\n }\n }\n </ul>\n\n <button type=\"button\" class=\"flt__clear\" (click)=\"clearAll()\">\n <mat-icon aria-hidden=\"true\">filter_alt_off</mat-icon>\n Limpar tudo\n </button>\n </div>\n }\n\n <div class=\"flt__body\">\n @for (field of fields; track field.name) {\n @if (field.fixed) {\n <div [ngClass]=\"field.fieldType\" class=\"flt__field\" >\n @if (field.fieldType === 'group') {\n <h3>{{ field.labelText }}</h3>\n }\n\n <mcl-query-form-field [field]=\"field\" [control]=\"field.formControl\"></mcl-query-form-field>\n </div>\n }\n }\n\n <div class=\"flt__separator\"></div>\n\n <!-- A\u00E7\u00F5es -->\n <div class=\"flt__actions\">\n <button mat-stroked-button type=\"button\" (click)=\"openFilter($event)\">\n <mat-icon aria-hidden=\"true\">tune</mat-icon>\n Filtros avan\u00E7ados\n </button>\n </div>\n </div>\n </section>\n\n}\n\n", styles: ["@charset \"UTF-8\";:host{--flt-bg: var(--lib-color-surface, var(--mat-sys-surface));--flt-fg: var(--lib-color-on-surface, var(--mat-sys-on-surface));--flt-muted: var(--lib-color-on-surface-variant, var(--mat-sys-on-surface-variant));--flt-border: var(--lib-color-outline-variant, var(--mat-sys-outline-variant));--flt-primary: var(--lib-color-primary, var(--mat-sys-primary));--flt-chip-bg: var(--lib-color-surface-container-low, var(--mat-sys-surface-container-low));--flt-radius: var(--mcl-radius-md, 12px);display:block}.flt{background:var(--flt-bg);border:1px solid var(--flt-border);border-radius:var(--flt-radius);box-shadow:var(--mcl-shadow-1, 0 1px 3px rgba(0, 0, 0, .05));margin-bottom:16px}.flt__applied{display:flex;align-items:center;gap:10px;padding:10px 16px;border-bottom:1px solid var(--flt-border);background:var(--flt-chip-bg);flex-wrap:wrap}.flt__applied-title{font-size:.8125rem;color:var(--flt-muted);white-space:nowrap}.flt__chips{display:flex;flex-wrap:wrap;gap:6px;list-style:none;padding:0;margin:0;flex:1 1 auto}.flt__chip{display:inline-flex;align-items:center;gap:6px;max-width:100%;height:30px;padding:0 6px 0 12px;border:1px solid var(--flt-border);border-radius:var(--mcl-radius-full, 999px);background:var(--flt-bg);color:var(--flt-fg)}.flt__chip-label{font-size:.78rem;font-weight:600;color:var(--flt-muted)}.flt__chip-value{font-size:.78rem;color:var(--flt-fg);font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:26ch}.flt__chip-remove{inline-size:20px;block-size:20px;display:grid;place-items:center;border:0;border-radius:var(--mcl-radius-full, 999px);background:transparent;color:var(--flt-muted);transition:background-color var(--mcl-transition, .18s ease),color var(--mcl-transition, .18s ease)}.flt__chip-remove mat-icon{font-size:16px;height:16px;width:16px}.flt__chip-remove:hover{background:color-mix(in oklab,var(--flt-fg) 8%,var(--flt-bg));color:var(--flt-fg)}.flt__chip-remove:focus-visible{outline:2px solid var(--flt-primary);outline-offset:2px}.flt__chip-group{display:inline-flex;align-items:center;gap:6px;flex-wrap:wrap}.flt__chip-group-head{display:inline-flex;align-items:center;gap:2px}.flt__chip-group-title{display:inline-flex;align-items:center;height:30px;padding:0 10px;border-radius:var(--mcl-radius-full, 999px);background:color-mix(in oklab,var(--flt-primary) 10%,var(--flt-bg));color:var(--flt-primary);font-size:.78rem;font-weight:600;white-space:nowrap}.flt__chip-group-items{display:inline-flex;align-items:center;gap:6px;list-style:none;padding:0;margin:0}.flt__chip--sub{border-color:color-mix(in oklab,var(--flt-primary) 24%,var(--flt-border))}.flt__chip-group-clear{inline-size:22px;block-size:22px;display:grid;place-items:center;border-radius:var(--mcl-radius-full, 999px);border:0;background:transparent;color:var(--flt-muted);transition:background-color var(--mcl-transition, .18s ease),color var(--mcl-transition, .18s ease)}.flt__chip-group-clear mat-icon{font-size:16px;height:16px;width:16px}.flt__chip-group-clear:hover{background:color-mix(in oklab,var(--flt-fg) 8%,var(--flt-bg));color:var(--flt-fg)}.flt__clear{height:30px;padding:0 12px;display:inline-flex;align-items:center;gap:6px;border-radius:var(--mcl-radius-full, 999px);border:1px solid var(--flt-border);background:var(--flt-bg);color:var(--flt-muted);font-size:.8125rem;white-space:nowrap;transition:background-color var(--mcl-transition, .18s ease),border-color var(--mcl-transition, .18s ease),color var(--mcl-transition, .18s ease)}.flt__clear mat-icon{font-size:16px;height:16px;width:16px}.flt__clear:hover{background:color-mix(in oklab,var(--flt-fg) 5%,var(--flt-bg));color:var(--flt-fg)}.flt__body{display:flex;flex-wrap:wrap;gap:4px 16px;align-items:center;padding:16px 16px 4px}.flt__field{flex:1 1 220px;min-width:220px;max-width:340px}.flt__separator{flex:1 1 auto}.flt__actions{display:flex;justify-content:flex-end;gap:8px;padding-bottom:12px}@media (max-width: 767.98px){.flt__body{padding:12px 12px 4px}.flt__field{flex-basis:100%;min-width:0;max-width:none}.flt__actions{width:100%;justify-content:stretch}.flt__actions button{width:100%}.flt__applied{padding-inline:12px}}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: QueryFormFieldComponent, selector: "mcl-query-form-field", inputs: ["field", "control"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }] });
416
- }
417
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.9", ngImport: i0, type: QueryFormComponent, decorators: [{
418
- type: Component,
419
- args: [{ selector: 'mcl-query-form', imports: [
420
- FormsModule,
421
- MatIcon,
422
- QueryFormFieldComponent,
423
- NgClass,
424
- MatButton,
425
- ], template: "@if (!!fields) {\n <section class=\"flt\" aria-label=\"Filtros e busca\">\n <!-- Barra de filtros aplicados (chips) -->\n @if (filterCount > 0) {\n <div class=\"flt__applied\">\n <div class=\"flt__applied-title\">Filtros aplicados:</div>\n\n <ul class=\"flt__chips\" role=\"list\">\n @for (field of fields.toArray(); track field.labelText) {\n @if (!field.fixed && !field.empty) {\n\n @if (field.fieldType === 'group') {\n\n <li class=\"flt__chip-group\">\n <div class=\"flt__chip-group-head\">\n <span class=\"flt__chip-group-title\">{{ field.labelText }}</span>\n @if (!field.required) {\n <button\n type=\"button\"\n class=\"flt__chip-group-clear\"\n (click)=\"clear(field)\">\n <mat-icon aria-hidden=\"true\">close</mat-icon>\n </button>\n }\n </div>\n\n <ul class=\"flt__chip-group-items\" role=\"list\">\n @for (sub of field.fields; track sub.labelText) {\n <li class=\"flt__chip flt__chip--sub\">\n @if (sub.labelText) {\n <span class=\"flt__chip-label\">{{ sub.labelText }}:</span>\n }\n <span class=\"flt__chip-value\">{{ sub.value }}</span>\n\n @if (!sub.required) {\n <button\n type=\"button\"\n class=\"flt__chip-remove\"\n (click)=\"clear(field)\">\n <mat-icon aria-hidden=\"true\">close</mat-icon>\n </button>\n }\n </li>\n }\n </ul>\n </li>\n } @else {\n <li class=\"flt__chip\">\n <span class=\"flt__chip-label\">{{ field.labelText }}:</span>\n <span class=\"flt__chip-value\">{{ field.value }}</span>\n\n @if (!field.required) {\n <button\n type=\"button\"\n class=\"flt__chip-remove\"\n (click)=\"clear(field)\">\n <mat-icon aria-hidden=\"true\">close</mat-icon>\n </button>\n }\n </li>\n }\n\n }\n }\n </ul>\n\n <button type=\"button\" class=\"flt__clear\" (click)=\"clearAll()\">\n <mat-icon aria-hidden=\"true\">filter_alt_off</mat-icon>\n Limpar tudo\n </button>\n </div>\n }\n\n <div class=\"flt__body\">\n @for (field of fields; track field.name) {\n @if (field.fixed) {\n <div [ngClass]=\"field.fieldType\" class=\"flt__field\" >\n @if (field.fieldType === 'group') {\n <h3>{{ field.labelText }}</h3>\n }\n\n <mcl-query-form-field [field]=\"field\" [control]=\"field.formControl\"></mcl-query-form-field>\n </div>\n }\n }\n\n <div class=\"flt__separator\"></div>\n\n <!-- A\u00E7\u00F5es -->\n <div class=\"flt__actions\">\n <button mat-stroked-button type=\"button\" (click)=\"openFilter($event)\">\n <mat-icon aria-hidden=\"true\">tune</mat-icon>\n Filtros avan\u00E7ados\n </button>\n </div>\n </div>\n </section>\n\n}\n\n", styles: ["@charset \"UTF-8\";:host{--flt-bg: var(--lib-color-surface, var(--mat-sys-surface));--flt-fg: var(--lib-color-on-surface, var(--mat-sys-on-surface));--flt-muted: var(--lib-color-on-surface-variant, var(--mat-sys-on-surface-variant));--flt-border: var(--lib-color-outline-variant, var(--mat-sys-outline-variant));--flt-primary: var(--lib-color-primary, var(--mat-sys-primary));--flt-chip-bg: var(--lib-color-surface-container-low, var(--mat-sys-surface-container-low));--flt-radius: var(--mcl-radius-md, 12px);display:block}.flt{background:var(--flt-bg);border:1px solid var(--flt-border);border-radius:var(--flt-radius);box-shadow:var(--mcl-shadow-1, 0 1px 3px rgba(0, 0, 0, .05));margin-bottom:16px}.flt__applied{display:flex;align-items:center;gap:10px;padding:10px 16px;border-bottom:1px solid var(--flt-border);background:var(--flt-chip-bg);flex-wrap:wrap}.flt__applied-title{font-size:.8125rem;color:var(--flt-muted);white-space:nowrap}.flt__chips{display:flex;flex-wrap:wrap;gap:6px;list-style:none;padding:0;margin:0;flex:1 1 auto}.flt__chip{display:inline-flex;align-items:center;gap:6px;max-width:100%;height:30px;padding:0 6px 0 12px;border:1px solid var(--flt-border);border-radius:var(--mcl-radius-full, 999px);background:var(--flt-bg);color:var(--flt-fg)}.flt__chip-label{font-size:.78rem;font-weight:600;color:var(--flt-muted)}.flt__chip-value{font-size:.78rem;color:var(--flt-fg);font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:26ch}.flt__chip-remove{inline-size:20px;block-size:20px;display:grid;place-items:center;border:0;border-radius:var(--mcl-radius-full, 999px);background:transparent;color:var(--flt-muted);transition:background-color var(--mcl-transition, .18s ease),color var(--mcl-transition, .18s ease)}.flt__chip-remove mat-icon{font-size:16px;height:16px;width:16px}.flt__chip-remove:hover{background:color-mix(in oklab,var(--flt-fg) 8%,var(--flt-bg));color:var(--flt-fg)}.flt__chip-remove:focus-visible{outline:2px solid var(--flt-primary);outline-offset:2px}.flt__chip-group{display:inline-flex;align-items:center;gap:6px;flex-wrap:wrap}.flt__chip-group-head{display:inline-flex;align-items:center;gap:2px}.flt__chip-group-title{display:inline-flex;align-items:center;height:30px;padding:0 10px;border-radius:var(--mcl-radius-full, 999px);background:color-mix(in oklab,var(--flt-primary) 10%,var(--flt-bg));color:var(--flt-primary);font-size:.78rem;font-weight:600;white-space:nowrap}.flt__chip-group-items{display:inline-flex;align-items:center;gap:6px;list-style:none;padding:0;margin:0}.flt__chip--sub{border-color:color-mix(in oklab,var(--flt-primary) 24%,var(--flt-border))}.flt__chip-group-clear{inline-size:22px;block-size:22px;display:grid;place-items:center;border-radius:var(--mcl-radius-full, 999px);border:0;background:transparent;color:var(--flt-muted);transition:background-color var(--mcl-transition, .18s ease),color var(--mcl-transition, .18s ease)}.flt__chip-group-clear mat-icon{font-size:16px;height:16px;width:16px}.flt__chip-group-clear:hover{background:color-mix(in oklab,var(--flt-fg) 8%,var(--flt-bg));color:var(--flt-fg)}.flt__clear{height:30px;padding:0 12px;display:inline-flex;align-items:center;gap:6px;border-radius:var(--mcl-radius-full, 999px);border:1px solid var(--flt-border);background:var(--flt-bg);color:var(--flt-muted);font-size:.8125rem;white-space:nowrap;transition:background-color var(--mcl-transition, .18s ease),border-color var(--mcl-transition, .18s ease),color var(--mcl-transition, .18s ease)}.flt__clear mat-icon{font-size:16px;height:16px;width:16px}.flt__clear:hover{background:color-mix(in oklab,var(--flt-fg) 5%,var(--flt-bg));color:var(--flt-fg)}.flt__body{display:flex;flex-wrap:wrap;gap:4px 16px;align-items:center;padding:16px 16px 4px}.flt__field{flex:1 1 220px;min-width:220px;max-width:340px}.flt__separator{flex:1 1 auto}.flt__actions{display:flex;justify-content:flex-end;gap:8px;padding-bottom:12px}@media (max-width: 767.98px){.flt__body{padding:12px 12px 4px}.flt__field{flex-basis:100%;min-width:0;max-width:none}.flt__actions{width:100%;justify-content:stretch}.flt__actions button{width:100%}.flt__applied{padding-inline:12px}}\n"] }]
426
- }], ctorParameters: () => [{ type: i1$1.Router }, { type: i2.DialogService }, { type: i1$1.ActivatedRoute }], propDecorators: { fields: [{
427
- type: ContentChildren,
428
- args: [QueryFieldComponent]
429
- }], modalTemplate: [{
430
- type: ViewChild,
431
- args: ['modalTemplate', { read: TemplateRef }]
432
- }], query: [{
433
- type: Output
434
- }] } });
435
-
436
- class AbstractConsultaPaginadaComponent {
437
- router = inject(Router);
438
- dialogService = inject(DialogService);
439
- loaderService = inject(LoaderService);
440
- timeoutConsulta;
441
- filtro = {};
442
- page;
443
- table;
444
- ngAfterViewInit() {
445
- this.reset();
446
- }
447
- async reset(filtro = this.filtro) {
448
- this.filtro = filtro;
449
- this.page = undefined;
450
- await this.busca();
451
- }
452
- get tamanhoPagina() {
453
- return this.page?.tamanhoPagina || this.page?.size;
454
- }
455
- async busca(event = { type: 'numeric', page: 1, size: 10 }) {
456
- if (event.type === 'numeric') {
457
- clearTimeout(this.timeoutConsulta);
458
- this.timeoutConsulta = setTimeout(async () => {
459
- this.page = await lastValueFrom(this.table.loadingAround(this.consultaEntidades(event.page, event.size)));
460
- }, 300);
461
- }
462
- }
463
- async remove(entidade) {
464
- const confirmacao = await this.dialogService
465
- .confirma('mcl.consulta.confirma-remocao').toPromise();
466
- if (confirmacao) {
467
- await this.loaderService.listen(this.deleteEntidade(entidade)).toPromise();
468
- }
469
- }
470
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.9", ngImport: i0, type: AbstractConsultaPaginadaComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
471
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.9", type: AbstractConsultaPaginadaComponent, isStandalone: true, selector: "ng-component", viewQueries: [{ propertyName: "table", first: true, predicate: PaginatedTableComponent, descendants: true }], ngImport: i0, template: '', isInline: true });
472
- }
473
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.9", ngImport: i0, type: AbstractConsultaPaginadaComponent, decorators: [{
474
- type: Component,
475
- args: [{
476
- template: ''
477
- }]
478
- }], propDecorators: { table: [{
479
- type: ViewChild,
480
- args: [PaginatedTableComponent]
481
- }] } });
482
-
483
- class AbstractEdicaoComponent {
484
- entidade = {};
485
- router = inject(Router);
486
- activatedRoute = inject(ActivatedRoute);
487
- mensageriaService = inject(MensageriaService);
488
- loaderService = inject(LoaderService);
489
- ngOnInit() {
490
- if (!!this.detalhaEntidade) {
491
- this.activatedRoute.params.subscribe(params => {
492
- if (params['id']) {
493
- this.loaderService.listen(this.detalhaEntidade(params['id'])).subscribe((entidade) => this.entidade = entidade);
494
- }
495
- });
496
- }
497
- }
498
- async salva(form) {
499
- if (!form.valid) {
500
- return;
501
- }
502
- await this.loaderService.listen(this.salvaEntidade()).toPromise();
503
- this.mensageriaService.addMensagem('mcl.edicao.salvo-sucesso');
504
- }
505
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.9", ngImport: i0, type: AbstractEdicaoComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
506
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.9", type: AbstractEdicaoComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: '', isInline: true });
507
- }
508
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.9", ngImport: i0, type: AbstractEdicaoComponent, decorators: [{
509
- type: Component,
510
- args: [{
511
- template: ''
512
- }]
513
- }] });
514
-
515
- class AbstractEdicaoModalComponent {
516
- router = inject(Router);
517
- activatedRoute = inject(ActivatedRoute);
518
- dialogService = inject(DialogService);
519
- loaderService = inject(LoaderService);
520
- mensageriaService = inject(MensageriaService);
521
- dialogRef = inject(MatDialogRef);
522
- async salva(form) {
523
- if (!form.valid) {
524
- return;
525
- }
526
- const salvo = await this.loaderService.listen(this.salvaEntidade()).toPromise();
527
- this.mensageriaService.addMensagem('mcl.edicao.salvo-sucesso');
528
- this.dialogRef.close(salvo);
529
- }
530
- async remove(entidade) {
531
- if (!!this.deleteEntidade) {
532
- const confirmacao = await this.dialogService
533
- .confirma('mcl.consulta.confirma-remocao').toPromise();
534
- if (confirmacao) {
535
- await this.loaderService.listen(this.deleteEntidade(entidade)).toPromise();
536
- this.dialogRef.close(true);
537
- }
538
- }
539
- }
540
- }
541
-
542
- /**
543
- * Generated bundle index. Do not edit.
544
- */
545
-
1
+ import * as i0 from "@angular/core";
2
+ import { ChangeDetectionStrategy, Component, ContentChildren, EventEmitter, Inject, Input, Optional, Output, Self, TemplateRef, ViewChild, inject } from "@angular/core";
3
+ import * as i1 from "@angular/forms";
4
+ import { FormBuilder, FormControl, FormsModule, ReactiveFormsModule, Validators } from "@angular/forms";
5
+ import { debounceTime, lastValueFrom, of } from "rxjs";
6
+ import { DatePipe, NgClass } from "@angular/common";
7
+ import { DelegateOptionProviderDirective, InputCnpjComponent, InputCpfCnpjComponent, InputCpfComponent, InputCurrencyComponent, InputDatetimeComponent, InputMaskComponent, SELECT_OPTION_PROVIDER, SelectAutocompleteComponent, SelectOptionComponent } from "@main-class/componentes/input";
8
+ import { CpfCnpjPipe, MaskPipe, MonetarioPipe } from "@main-class/componentes/misc";
9
+ import { MensagensErroComponent } from "@main-class/componentes/form";
10
+ import { MatButton, MatIconButton } from "@angular/material/button";
11
+ import { MatIcon } from "@angular/material/icon";
12
+ import { MatError, MatFormField, MatHint, MatLabel, MatSuffix } from "@angular/material/form-field";
13
+ import { MatInput } from "@angular/material/input";
14
+ import { DialogService, ModalBodyDirective, ModalCloseDirective, ModalFooterDirective, ModalHeaderDirective, SIDEBAR_MODAL_DATA, SidebarModalRef } from "@main-class/componentes/dialog";
15
+ import { ActivatedRoute, Router } from "@angular/router";
16
+ import { delay } from "rxjs/operators";
17
+ import { LoaderService } from "@main-class/componentes/loader";
18
+ import { PaginatedTableComponent } from "@main-class/componentes/table";
19
+ import { MensageriaService, observaParametrosDaRota } from "@main-class/componentes/core";
20
+ import { MatDialogRef } from "@angular/material/dialog";
21
+ var QueryFieldComponent = class QueryFieldComponent {
22
+ optionProvider;
23
+ cpfCnpjPipe = new CpfCnpjPipe();
24
+ datePipe = new DatePipe("pt-BR");
25
+ currencyPipe = new MonetarioPipe();
26
+ maskPipe = new MaskPipe();
27
+ $fieldType;
28
+ formControl = new FormControl("");
29
+ labelText;
30
+ description;
31
+ mask;
32
+ name;
33
+ $fixed;
34
+ options;
35
+ fields;
36
+ constructor(optionProvider) {
37
+ this.optionProvider = optionProvider;
38
+ }
39
+ set fixed(fixed) {
40
+ this.$fixed = fixed || fixed === "";
41
+ }
42
+ get fixed() {
43
+ return this.$fixed;
44
+ }
45
+ get required() {
46
+ return this.formControl.hasValidator(Validators.required);
47
+ }
48
+ get fieldType() {
49
+ return this.$fieldType;
50
+ }
51
+ set fieldType(fieldType) {
52
+ this.$fieldType = fieldType;
53
+ }
54
+ get empty() {
55
+ if (this.fieldType === "group") return !this.fields?.find((field) => !field.empty);
56
+ return this.formControl?.value === "" || this.formControl?.value === void 0 || this.formControl?.value === null;
57
+ }
58
+ get value() {
59
+ if (!this.empty) {
60
+ switch (this.fieldType) {
61
+ case "cpf":
62
+ case "cnpj":
63
+ case "cpf_cnpj": return this.cpfCnpjPipe.transform(this.formControl?.value);
64
+ case "date": return this.datePipe.transform(this.formControl?.value, "dd/MM/yyyy");
65
+ case "option": return this.label(this.formControl?.value);
66
+ case "currency": return this.currencyPipe.transform(this.formControl?.value);
67
+ case "mask": return this.maskPipe.transform(this.formControl?.value, this.mask);
68
+ }
69
+ return this.formControl?.value;
70
+ }
71
+ }
72
+ type() {
73
+ switch (this.fieldType) {
74
+ case "date": return "date";
75
+ case "option": return this.optionProvider?.type() || "object";
76
+ }
77
+ return "string";
78
+ }
79
+ provide(search) {
80
+ if (!!this.optionProvider) return this.optionProvider.provide(search);
81
+ if (typeof search === "string" || search == void 0) return of((this.options?.toArray() || []).filter((op) => (op.label || "").indexOf((search || "").toLowerCase()) >= 0));
82
+ return of(this.options?.toArray() || []);
83
+ }
84
+ label(value) {
85
+ if (!!this.optionProvider) return this.optionProvider.label(value);
86
+ return this.options?.find((op) => op.value === value)?.label || "";
87
+ }
88
+ trackBy(value) {
89
+ if (!!this.optionProvider?.trackBy) return this.optionProvider.trackBy(value);
90
+ return value;
91
+ }
92
+ clear() {
93
+ if (this.fieldType === "group") this.fields?.forEach((field) => field.clear());
94
+ else this.formControl?.setValue(void 0);
95
+ }
96
+ serialized() {
97
+ if (!this.empty) {
98
+ switch (this.type()) {
99
+ case "object": return JSON.stringify(this.formControl.value);
100
+ }
101
+ return String(this.formControl.value);
102
+ }
103
+ }
104
+ desserialize(value) {
105
+ if (!!value) {
106
+ switch (this.type()) {
107
+ case "object": return JSON.parse(value);
108
+ case "date": return new Date(value);
109
+ case "number": return Number(value);
110
+ }
111
+ return value;
112
+ }
113
+ }
114
+ static ɵfac = i0.ɵɵngDeclareFactory({
115
+ minVersion: "12.0.0",
116
+ version: "22.3.2",
117
+ ngImport: i0,
118
+ type: QueryFieldComponent,
119
+ deps: [{
120
+ token: SELECT_OPTION_PROVIDER,
121
+ optional: true,
122
+ self: true
123
+ }],
124
+ target: i0.ɵɵFactoryTarget.Component
125
+ });
126
+ static ɵcmp = i0.ɵɵngDeclareComponent({
127
+ minVersion: "14.0.0",
128
+ version: "22.3.2",
129
+ type: QueryFieldComponent,
130
+ isStandalone: true,
131
+ selector: "mcl-query-field",
132
+ inputs: {
133
+ labelText: ["label", "labelText"],
134
+ description: "description",
135
+ mask: "mask",
136
+ name: "name",
137
+ fixed: "fixed",
138
+ fieldType: ["type", "fieldType"]
139
+ },
140
+ queries: [{
141
+ propertyName: "options",
142
+ predicate: SelectOptionComponent
143
+ }, {
144
+ propertyName: "fields",
145
+ predicate: QueryFieldComponent
146
+ }],
147
+ ngImport: i0,
148
+ template: "",
149
+ styles: [""],
150
+ dependencies: [{
151
+ kind: "ngmodule",
152
+ type: ReactiveFormsModule
153
+ }],
154
+ changeDetection: i0.ChangeDetectionStrategy.Eager
155
+ });
156
+ };
157
+ i0.ɵɵngDeclareClassMetadata({
158
+ minVersion: "12.0.0",
159
+ version: "22.3.2",
160
+ ngImport: i0,
161
+ type: QueryFieldComponent,
162
+ decorators: [{
163
+ type: Component,
164
+ args: [{
165
+ selector: "mcl-query-field",
166
+ imports: [ReactiveFormsModule],
167
+ changeDetection: ChangeDetectionStrategy.Eager,
168
+ template: ""
169
+ }]
170
+ }],
171
+ ctorParameters: () => [{
172
+ type: void 0,
173
+ decorators: [
174
+ {
175
+ type: Inject,
176
+ args: [SELECT_OPTION_PROVIDER]
177
+ },
178
+ { type: Self },
179
+ { type: Optional }
180
+ ]
181
+ }],
182
+ propDecorators: {
183
+ labelText: [{
184
+ type: Input,
185
+ args: ["label"]
186
+ }],
187
+ description: [{ type: Input }],
188
+ mask: [{ type: Input }],
189
+ name: [{ type: Input }],
190
+ options: [{
191
+ type: ContentChildren,
192
+ args: [SelectOptionComponent]
193
+ }],
194
+ fields: [{
195
+ type: ContentChildren,
196
+ args: [QueryFieldComponent]
197
+ }],
198
+ fixed: [{ type: Input }],
199
+ fieldType: [{
200
+ type: Input,
201
+ args: ["type"]
202
+ }]
203
+ }
204
+ });
205
+ var QueryFormFieldComponent = class QueryFormFieldComponent {
206
+ field;
207
+ control;
208
+ get formControl() {
209
+ return this.control;
210
+ }
211
+ get formGroup() {
212
+ return this.control;
213
+ }
214
+ clear() {
215
+ this.formControl.setValue(void 0);
216
+ }
217
+ static ɵfac = i0.ɵɵngDeclareFactory({
218
+ minVersion: "12.0.0",
219
+ version: "22.3.2",
220
+ ngImport: i0,
221
+ type: QueryFormFieldComponent,
222
+ deps: [],
223
+ target: i0.ɵɵFactoryTarget.Component
224
+ });
225
+ static ɵcmp = i0.ɵɵngDeclareComponent({
226
+ minVersion: "17.0.0",
227
+ version: "22.3.2",
228
+ type: QueryFormFieldComponent,
229
+ isStandalone: true,
230
+ selector: "mcl-query-form-field",
231
+ inputs: {
232
+ field: "field",
233
+ control: "control"
234
+ },
235
+ ngImport: i0,
236
+ template: "@if (field!.fieldType === 'group') {\n <div [formGroup]=\"formGroup\">\n @for (child of field!.fields; track child.labelText) {\n <mcl-query-form-field [field]=\"child\"\n [control]=\"formGroup.controls[child.labelText!]\"></mcl-query-form-field>\n }\n </div>\n} @else {\n <mat-form-field>\n <mat-label>{{ field!.labelText }}</mat-label>\n @switch (field!.fieldType) {\n @case ('input') {\n <input matInput [formControl]=\"formControl\"/>\n }\n @case ('cpf') {\n <mcl-input cpf [formControl]=\"formControl\"/>\n }\n @case ('cnpj') {\n <mcl-input cnpj [formControl]=\"formControl\"/>\n }\n @case ('cpf_cnpj') {\n <mcl-input cpfCnpj [formControl]=\"formControl\"/>\n }\n @case ('date') {\n <mcl-input-datetime type=\"date\" [formControl]=\"formControl\"/>\n }\n @case ('option') {\n <mcl-select-autocomplete [formControl]=\"formControl\" [delegate]=\"field\"/>\n }\n @case ('mask') {\n <mcl-input [mask]=\"field!.mask!\" [formControl]=\"formControl\"/>\n }\n @case ('currency') {\n <mcl-input currency [formControl]=\"formControl\"/>\n }\n }\n @if (formControl.value) {\n <button mat-icon-button matSuffix (click)=\"clear()\">\n <mat-icon>close</mat-icon>\n </button>\n }\n @if (!!field?.description) {\n <mat-hint>{{ field?.description }}</mat-hint>\n }\n <mat-error [mclErrorFor]=\"formControl\"></mat-error>\n </mat-form-field>\n}\n",
237
+ styles: [""],
238
+ dependencies: [
239
+ {
240
+ kind: "component",
241
+ type: QueryFormFieldComponent,
242
+ selector: "mcl-query-form-field",
243
+ inputs: ["field", "control"]
244
+ },
245
+ {
246
+ kind: "component",
247
+ type: MatFormField,
248
+ selector: "mat-form-field",
249
+ inputs: [
250
+ "hideRequiredMarker",
251
+ "color",
252
+ "floatLabel",
253
+ "appearance",
254
+ "subscriptSizing",
255
+ "hintLabel"
256
+ ],
257
+ exportAs: ["matFormField"]
258
+ },
259
+ {
260
+ kind: "ngmodule",
261
+ type: ReactiveFormsModule
262
+ },
263
+ {
264
+ kind: "directive",
265
+ type: i1.DefaultValueAccessor,
266
+ selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[ngModel],[ngDefaultControl]"
267
+ },
268
+ {
269
+ kind: "directive",
270
+ type: i1.NgControlStatus,
271
+ selector: "[formControlName],[ngModel],[formControl]"
272
+ },
273
+ {
274
+ kind: "directive",
275
+ type: i1.NgControlStatusGroup,
276
+ selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]"
277
+ },
278
+ {
279
+ kind: "directive",
280
+ type: i1.FormControlDirective,
281
+ selector: "[formControl]",
282
+ inputs: [
283
+ "formControl",
284
+ "disabled",
285
+ "ngModel"
286
+ ],
287
+ outputs: ["ngModelChange"],
288
+ exportAs: ["ngForm"]
289
+ },
290
+ {
291
+ kind: "directive",
292
+ type: i1.FormGroupDirective,
293
+ selector: "[formGroup]",
294
+ inputs: ["formGroup"],
295
+ outputs: ["ngSubmit"],
296
+ exportAs: ["ngForm"]
297
+ },
298
+ {
299
+ kind: "directive",
300
+ type: MatInput,
301
+ selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]",
302
+ inputs: [
303
+ "disabled",
304
+ "id",
305
+ "placeholder",
306
+ "name",
307
+ "required",
308
+ "type",
309
+ "errorStateMatcher",
310
+ "aria-describedby",
311
+ "value",
312
+ "readonly",
313
+ "disabledInteractive"
314
+ ],
315
+ exportAs: ["matInput"]
316
+ },
317
+ {
318
+ kind: "component",
319
+ type: InputDatetimeComponent,
320
+ selector: "mcl-input-datetime",
321
+ inputs: [
322
+ "type",
323
+ "readonly",
324
+ "name"
325
+ ]
326
+ },
327
+ {
328
+ kind: "directive",
329
+ type: MatError,
330
+ selector: "mat-error, [matError]",
331
+ inputs: ["id"]
332
+ },
333
+ {
334
+ kind: "directive",
335
+ type: MatLabel,
336
+ selector: "mat-label"
337
+ },
338
+ {
339
+ kind: "directive",
340
+ type: MatHint,
341
+ selector: "mat-hint",
342
+ inputs: ["align", "id"]
343
+ },
344
+ {
345
+ kind: "component",
346
+ type: InputCpfComponent,
347
+ selector: "mcl-input[cpf]"
348
+ },
349
+ {
350
+ kind: "component",
351
+ type: InputCnpjComponent,
352
+ selector: "mcl-input[cnpj]"
353
+ },
354
+ {
355
+ kind: "component",
356
+ type: InputCpfCnpjComponent,
357
+ selector: "mcl-input[cpfCnpj]"
358
+ },
359
+ {
360
+ kind: "component",
361
+ type: SelectAutocompleteComponent,
362
+ selector: "mcl-select-autocomplete",
363
+ inputs: ["readonly"],
364
+ outputs: ["select", "blur"]
365
+ },
366
+ {
367
+ kind: "component",
368
+ type: InputMaskComponent,
369
+ selector: "mcl-input[mask]",
370
+ inputs: ["keepMask", "mask"],
371
+ outputs: ["focusin", "focusout"]
372
+ },
373
+ {
374
+ kind: "component",
375
+ type: MensagensErroComponent,
376
+ selector: "[mclErrorFor],[mclError]",
377
+ inputs: ["mclErrorFor"]
378
+ },
379
+ {
380
+ kind: "component",
381
+ type: InputCurrencyComponent,
382
+ selector: "mcl-input[currency]"
383
+ },
384
+ {
385
+ kind: "directive",
386
+ type: DelegateOptionProviderDirective,
387
+ selector: "mcl-select-autocomplete[delegate]",
388
+ inputs: ["delegate"]
389
+ },
390
+ {
391
+ kind: "component",
392
+ type: MatIconButton,
393
+ selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]",
394
+ exportAs: ["matButton", "matAnchor"]
395
+ },
396
+ {
397
+ kind: "component",
398
+ type: MatIcon,
399
+ selector: "mat-icon",
400
+ inputs: [
401
+ "color",
402
+ "inline",
403
+ "svgIcon",
404
+ "fontSet",
405
+ "fontIcon"
406
+ ],
407
+ exportAs: ["matIcon"]
408
+ },
409
+ {
410
+ kind: "directive",
411
+ type: MatSuffix,
412
+ selector: "[matSuffix], [matIconSuffix], [matTextSuffix]",
413
+ inputs: ["matTextSuffix"]
414
+ }
415
+ ],
416
+ changeDetection: i0.ChangeDetectionStrategy.Eager
417
+ });
418
+ };
419
+ i0.ɵɵngDeclareClassMetadata({
420
+ minVersion: "12.0.0",
421
+ version: "22.3.2",
422
+ ngImport: i0,
423
+ type: QueryFormFieldComponent,
424
+ decorators: [{
425
+ type: Component,
426
+ args: [{
427
+ selector: "mcl-query-form-field",
428
+ imports: [
429
+ MatFormField,
430
+ ReactiveFormsModule,
431
+ MatInput,
432
+ InputDatetimeComponent,
433
+ MatError,
434
+ MatLabel,
435
+ MatHint,
436
+ InputCpfComponent,
437
+ InputCnpjComponent,
438
+ InputCpfCnpjComponent,
439
+ SelectAutocompleteComponent,
440
+ InputMaskComponent,
441
+ MensagensErroComponent,
442
+ InputCurrencyComponent,
443
+ DelegateOptionProviderDirective,
444
+ MatIconButton,
445
+ MatIcon,
446
+ MatSuffix
447
+ ],
448
+ changeDetection: ChangeDetectionStrategy.Eager,
449
+ template: "@if (field!.fieldType === 'group') {\n <div [formGroup]=\"formGroup\">\n @for (child of field!.fields; track child.labelText) {\n <mcl-query-form-field [field]=\"child\"\n [control]=\"formGroup.controls[child.labelText!]\"></mcl-query-form-field>\n }\n </div>\n} @else {\n <mat-form-field>\n <mat-label>{{ field!.labelText }}</mat-label>\n @switch (field!.fieldType) {\n @case ('input') {\n <input matInput [formControl]=\"formControl\"/>\n }\n @case ('cpf') {\n <mcl-input cpf [formControl]=\"formControl\"/>\n }\n @case ('cnpj') {\n <mcl-input cnpj [formControl]=\"formControl\"/>\n }\n @case ('cpf_cnpj') {\n <mcl-input cpfCnpj [formControl]=\"formControl\"/>\n }\n @case ('date') {\n <mcl-input-datetime type=\"date\" [formControl]=\"formControl\"/>\n }\n @case ('option') {\n <mcl-select-autocomplete [formControl]=\"formControl\" [delegate]=\"field\"/>\n }\n @case ('mask') {\n <mcl-input [mask]=\"field!.mask!\" [formControl]=\"formControl\"/>\n }\n @case ('currency') {\n <mcl-input currency [formControl]=\"formControl\"/>\n }\n }\n @if (formControl.value) {\n <button mat-icon-button matSuffix (click)=\"clear()\">\n <mat-icon>close</mat-icon>\n </button>\n }\n @if (!!field?.description) {\n <mat-hint>{{ field?.description }}</mat-hint>\n }\n <mat-error [mclErrorFor]=\"formControl\"></mat-error>\n </mat-form-field>\n}\n"
450
+ }]
451
+ }],
452
+ propDecorators: {
453
+ field: [{ type: Input }],
454
+ control: [{ type: Input }]
455
+ }
456
+ });
457
+ var QueryModalFormComponent = class QueryModalFormComponent {
458
+ modalRef;
459
+ fields;
460
+ form;
461
+ constructor(fb, modalRef, fields) {
462
+ this.modalRef = modalRef;
463
+ this.fields = fields;
464
+ this.form = fb.group(fields.map((field) => {
465
+ if (field.fieldType === "group") return { [field.name]: fb.group(field.fields.map((child) => ({ [child.name]: fb.control(child.formControl.value) })).reduce((c1, c2) => ({
466
+ ...c1,
467
+ ...c2
468
+ }))) };
469
+ else return { [field.name]: fb.control(field.formControl.value) };
470
+ }).reduce((c1, c2) => ({
471
+ ...c1,
472
+ ...c2
473
+ })));
474
+ }
475
+ apply() {
476
+ this.fields.forEach((field) => {
477
+ if (field.fieldType === "group") {
478
+ const formGroup = this.form.controls[field.name];
479
+ field.fields?.forEach((child) => {
480
+ child.formControl.patchValue(formGroup.controls[child.name].value);
481
+ });
482
+ } else {
483
+ const formControl = this.form.controls[field.name];
484
+ field.formControl.patchValue(formControl.value);
485
+ }
486
+ });
487
+ this.modalRef.close();
488
+ }
489
+ static ɵfac = i0.ɵɵngDeclareFactory({
490
+ minVersion: "12.0.0",
491
+ version: "22.3.2",
492
+ ngImport: i0,
493
+ type: QueryModalFormComponent,
494
+ deps: [
495
+ { token: FormBuilder },
496
+ { token: SidebarModalRef },
497
+ { token: SIDEBAR_MODAL_DATA }
498
+ ],
499
+ target: i0.ɵɵFactoryTarget.Component
500
+ });
501
+ static ɵcmp = i0.ɵɵngDeclareComponent({
502
+ minVersion: "17.0.0",
503
+ version: "22.3.2",
504
+ type: QueryModalFormComponent,
505
+ isStandalone: true,
506
+ selector: "mcl-query-form",
507
+ ngImport: i0,
508
+ template: "<form (ngSubmit)=\"apply()\" class=\"sidebar\">\n <h2 mclSidebarModalHeader>\n <mat-icon>search</mat-icon>\n Aplicar filtros\n </h2>\n\n <div mclSidebarModalBody>\n @for (field of fields; track field.name) {\n <div [ngClass]=\"field.fieldType\">\n @if (field.fieldType === 'group') {\n <h3>{{ field.labelText }}</h3>\n }\n\n <mcl-query-form-field [field]=\"field\" [control]=\"form.controls[field.name!]!\"></mcl-query-form-field>\n </div>\n }\n </div>\n\n <div mclSidebarModalFooter>\n <button mat-flat-button color=\"primary\" type=\"submit\">\n Aplicar\n </button>\n <button mat-button type=\"button\" mclSidebarModalClose>\n Cancelar\n </button>\n </div>\n</form>\n",
509
+ styles: ["@charset \"UTF-8\";:host{--af-bg: var(--lib-color-surface, var(--mat-sys-surface));--af-fg: var(--lib-color-on-surface, var(--mat-sys-on-surface));--af-muted: var(--lib-color-outline, var(--mat-sys-outline));--af-border: var(--lib-color-outline-variant, var(--mat-sys-outline-variant));--af-primary: var(--lib-color-primary, var(--mat-sys-primary));--af-struct: var(--lib-color-secondary, var(--mat-sys-secondary));--af-gap: 12px;--af-slot-gap: 10px;--af-slot-min: 220px;display:block;background:var(--af-bg);color:var(--af-fg)}.aff{display:grid;gap:var(--af-gap)}.aff__section-title{display:flex;align-items:center;gap:8px;margin:8px 0 4px;font-size:.95rem;font-weight:700;color:var(--af-fg)}.aff__section-mark{inline-size:4px;block-size:16px;border-radius:999px;background:var(--af-struct)}.aff__slot{display:grid;gap:var(--af-slot-gap);grid-template-columns:repeat(auto-fit,minmax(var(--af-slot-min),1fr));align-items:start}.aff-group{background:transparent;border:1px solid var(--af-border);border-radius:12px;padding:12px;display:grid;gap:10px}.aff-group__head{display:flex;align-items:center;gap:8px}.aff-group__title{display:inline-flex;align-items:center;gap:8px;font-size:.92rem;font-weight:700;color:var(--af-fg);margin:0}.aff-group__title-mark{inline-size:4px;block-size:16px;border-radius:999px;background:var(--af-struct)}.aff-group__clear{margin-inline-start:auto;inline-size:30px;block-size:30px;display:grid;place-items:center;border-radius:10px;border:1px solid transparent;background:transparent;color:var(--af-muted);cursor:pointer;transition:background-color .15s ease,color .15s ease}.aff-group__clear:hover{background:color-mix(in oklab,var(--af-primary) 10%,#fff);color:var(--af-fg)}.aff-group__clear:focus-visible{outline:2px solid color-mix(in oklab,var(--af-primary) 60%,#fff);outline-offset:2px}.aff-group__clear mat-icon{font-size:20px}.aff-group__fields{display:grid;gap:var(--af-slot-gap);grid-template-columns:repeat(auto-fit,minmax(var(--af-slot-min),1fr));align-items:start}.aff-subtitle{font-size:.85rem;font-weight:700;color:color-mix(in oklab,var(--af-fg) 90%,#222);margin:4px 0 0}.aff__inline-actions{display:flex;gap:8px;justify-content:flex-end}.aff__btn{height:32px;padding:0 10px;border-radius:10px;border:1px solid var(--af-border);background:#fff;color:var(--af-fg);display:inline-flex;align-items:center;gap:6px;transition:background-color .15s ease,border-color .15s ease,color .15s ease}.aff__btn:hover{background:color-mix(in oklab,var(--af-primary) 8%,#fff)}.aff__btn mat-icon{font-size:20px}@media(max-width:600px){.aff__slot,.aff-group__fields{grid-template-columns:1fr}}\n"],
510
+ dependencies: [
511
+ {
512
+ kind: "ngmodule",
513
+ type: ReactiveFormsModule
514
+ },
515
+ {
516
+ kind: "directive",
517
+ type: i1.ɵNgNoValidate,
518
+ selector: "form:not([ngNoForm]):not([ngNativeValidate])"
519
+ },
520
+ {
521
+ kind: "directive",
522
+ type: i1.NgControlStatusGroup,
523
+ selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]"
524
+ },
525
+ {
526
+ kind: "ngmodule",
527
+ type: FormsModule
528
+ },
529
+ {
530
+ kind: "directive",
531
+ type: i1.NgForm,
532
+ selector: "form:not([ngNoForm]):not([formGroup]):not([formArray]),ng-form,[ngForm]",
533
+ inputs: ["ngFormOptions"],
534
+ outputs: ["ngSubmit"],
535
+ exportAs: ["ngForm"]
536
+ },
537
+ {
538
+ kind: "directive",
539
+ type: ModalHeaderDirective,
540
+ selector: "[mclSidebarModalHeader]"
541
+ },
542
+ {
543
+ kind: "directive",
544
+ type: ModalCloseDirective,
545
+ selector: "[mclSidebarModalClose]"
546
+ },
547
+ {
548
+ kind: "directive",
549
+ type: ModalBodyDirective,
550
+ selector: "[mclSidebarModalBody]"
551
+ },
552
+ {
553
+ kind: "directive",
554
+ type: ModalFooterDirective,
555
+ selector: "[mclSidebarModalFooter]"
556
+ },
557
+ {
558
+ kind: "component",
559
+ type: QueryFormFieldComponent,
560
+ selector: "mcl-query-form-field",
561
+ inputs: ["field", "control"]
562
+ },
563
+ {
564
+ kind: "directive",
565
+ type: NgClass,
566
+ selector: "[ngClass]",
567
+ inputs: ["class", "ngClass"]
568
+ },
569
+ {
570
+ kind: "component",
571
+ type: MatButton,
572
+ selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ",
573
+ inputs: ["matButton"],
574
+ exportAs: ["matButton", "matAnchor"]
575
+ },
576
+ {
577
+ kind: "component",
578
+ type: MatIcon,
579
+ selector: "mat-icon",
580
+ inputs: [
581
+ "color",
582
+ "inline",
583
+ "svgIcon",
584
+ "fontSet",
585
+ "fontIcon"
586
+ ],
587
+ exportAs: ["matIcon"]
588
+ }
589
+ ],
590
+ changeDetection: i0.ChangeDetectionStrategy.Eager
591
+ });
592
+ };
593
+ i0.ɵɵngDeclareClassMetadata({
594
+ minVersion: "12.0.0",
595
+ version: "22.3.2",
596
+ ngImport: i0,
597
+ type: QueryModalFormComponent,
598
+ decorators: [{
599
+ type: Component,
600
+ args: [{
601
+ selector: "mcl-query-form",
602
+ imports: [
603
+ ReactiveFormsModule,
604
+ FormsModule,
605
+ ModalHeaderDirective,
606
+ ModalCloseDirective,
607
+ ModalBodyDirective,
608
+ ModalFooterDirective,
609
+ QueryFormFieldComponent,
610
+ NgClass,
611
+ ModalFooterDirective,
612
+ ModalCloseDirective,
613
+ MatButton,
614
+ ModalBodyDirective,
615
+ ModalHeaderDirective,
616
+ MatIcon
617
+ ],
618
+ changeDetection: ChangeDetectionStrategy.Eager,
619
+ template: "<form (ngSubmit)=\"apply()\" class=\"sidebar\">\n <h2 mclSidebarModalHeader>\n <mat-icon>search</mat-icon>\n Aplicar filtros\n </h2>\n\n <div mclSidebarModalBody>\n @for (field of fields; track field.name) {\n <div [ngClass]=\"field.fieldType\">\n @if (field.fieldType === 'group') {\n <h3>{{ field.labelText }}</h3>\n }\n\n <mcl-query-form-field [field]=\"field\" [control]=\"form.controls[field.name!]!\"></mcl-query-form-field>\n </div>\n }\n </div>\n\n <div mclSidebarModalFooter>\n <button mat-flat-button color=\"primary\" type=\"submit\">\n Aplicar\n </button>\n <button mat-button type=\"button\" mclSidebarModalClose>\n Cancelar\n </button>\n </div>\n</form>\n",
620
+ styles: ["@charset \"UTF-8\";:host{--af-bg: var(--lib-color-surface, var(--mat-sys-surface));--af-fg: var(--lib-color-on-surface, var(--mat-sys-on-surface));--af-muted: var(--lib-color-outline, var(--mat-sys-outline));--af-border: var(--lib-color-outline-variant, var(--mat-sys-outline-variant));--af-primary: var(--lib-color-primary, var(--mat-sys-primary));--af-struct: var(--lib-color-secondary, var(--mat-sys-secondary));--af-gap: 12px;--af-slot-gap: 10px;--af-slot-min: 220px;display:block;background:var(--af-bg);color:var(--af-fg)}.aff{display:grid;gap:var(--af-gap)}.aff__section-title{display:flex;align-items:center;gap:8px;margin:8px 0 4px;font-size:.95rem;font-weight:700;color:var(--af-fg)}.aff__section-mark{inline-size:4px;block-size:16px;border-radius:999px;background:var(--af-struct)}.aff__slot{display:grid;gap:var(--af-slot-gap);grid-template-columns:repeat(auto-fit,minmax(var(--af-slot-min),1fr));align-items:start}.aff-group{background:transparent;border:1px solid var(--af-border);border-radius:12px;padding:12px;display:grid;gap:10px}.aff-group__head{display:flex;align-items:center;gap:8px}.aff-group__title{display:inline-flex;align-items:center;gap:8px;font-size:.92rem;font-weight:700;color:var(--af-fg);margin:0}.aff-group__title-mark{inline-size:4px;block-size:16px;border-radius:999px;background:var(--af-struct)}.aff-group__clear{margin-inline-start:auto;inline-size:30px;block-size:30px;display:grid;place-items:center;border-radius:10px;border:1px solid transparent;background:transparent;color:var(--af-muted);cursor:pointer;transition:background-color .15s ease,color .15s ease}.aff-group__clear:hover{background:color-mix(in oklab,var(--af-primary) 10%,#fff);color:var(--af-fg)}.aff-group__clear:focus-visible{outline:2px solid color-mix(in oklab,var(--af-primary) 60%,#fff);outline-offset:2px}.aff-group__clear mat-icon{font-size:20px}.aff-group__fields{display:grid;gap:var(--af-slot-gap);grid-template-columns:repeat(auto-fit,minmax(var(--af-slot-min),1fr));align-items:start}.aff-subtitle{font-size:.85rem;font-weight:700;color:color-mix(in oklab,var(--af-fg) 90%,#222);margin:4px 0 0}.aff__inline-actions{display:flex;gap:8px;justify-content:flex-end}.aff__btn{height:32px;padding:0 10px;border-radius:10px;border:1px solid var(--af-border);background:#fff;color:var(--af-fg);display:inline-flex;align-items:center;gap:6px;transition:background-color .15s ease,border-color .15s ease,color .15s ease}.aff__btn:hover{background:color-mix(in oklab,var(--af-primary) 8%,#fff)}.aff__btn mat-icon{font-size:20px}@media(max-width:600px){.aff__slot,.aff-group__fields{grid-template-columns:1fr}}\n"]
621
+ }]
622
+ }],
623
+ ctorParameters: () => [
624
+ { type: FormBuilder },
625
+ { type: SidebarModalRef },
626
+ {
627
+ type: Array,
628
+ decorators: [{
629
+ type: Inject,
630
+ args: [SIDEBAR_MODAL_DATA]
631
+ }]
632
+ }
633
+ ]
634
+ });
635
+ var QueryFormComponent = class QueryFormComponent {
636
+ router;
637
+ dialogService;
638
+ activatedRoute;
639
+ fields;
640
+ modalTemplate;
641
+ query = new EventEmitter();
642
+ _subscriptions = {};
643
+ constructor(router, dialogService, activatedRoute) {
644
+ this.router = router;
645
+ this.dialogService = dialogService;
646
+ this.activatedRoute = activatedRoute;
647
+ }
648
+ ngAfterViewInit() {
649
+ this.activatedRoute.queryParams.pipe(debounceTime(300)).subscribe((qp) => {
650
+ this.desserialize(qp);
651
+ });
652
+ this.fields.changes.subscribe(() => {
653
+ this.configFieldsSubscriptions();
654
+ });
655
+ this.configFieldsSubscriptions();
656
+ }
657
+ ngOnDestroy() {
658
+ Object.keys(this._subscriptions).forEach((key) => {
659
+ this._subscriptions[key].unsubscribe();
660
+ delete this._subscriptions[key];
661
+ });
662
+ }
663
+ get filterCount() {
664
+ return this.fields?.filter((f) => !f.fixed && !f.empty)?.length || 0;
665
+ }
666
+ openFilter($event) {
667
+ $event.stopPropagation();
668
+ this.dialogService.openSidebar(QueryModalFormComponent, { data: this.fields.toArray() }).afterClosed().subscribe((query) => {
669
+ this.router.navigate(["./"], {
670
+ relativeTo: this.activatedRoute,
671
+ queryParams: this.serialized()
672
+ });
673
+ });
674
+ }
675
+ clearAll() {
676
+ this.fields?.forEach((field) => {
677
+ field.clear();
678
+ });
679
+ this.router.navigate(["./"], {
680
+ relativeTo: this.activatedRoute,
681
+ queryParams: this.serialized()
682
+ });
683
+ }
684
+ clear(item) {
685
+ item.clear();
686
+ this.router.navigate(["./"], {
687
+ relativeTo: this.activatedRoute,
688
+ queryParams: this.serialized()
689
+ });
690
+ }
691
+ Validators = Validators;
692
+ serialized() {
693
+ let obj = this.fields?.map((field) => {
694
+ if (field.fieldType === "group") return field.fields.map((child) => ({ [`${field.name}.${child.name}`]: child.serialized() })).reduce((c1, c2) => ({
695
+ ...c1,
696
+ ...c2
697
+ }));
698
+ else return { [field.name]: field.serialized() };
699
+ }).reduce((c1, c2) => ({
700
+ ...c1,
701
+ ...c2
702
+ }));
703
+ console.log("filtro: ", obj);
704
+ return obj;
705
+ }
706
+ desserialize(value) {
707
+ this.fields?.forEach((field) => {
708
+ if (field.fieldType === "group") field.fields.forEach((child) => {
709
+ child.formControl.patchValue(child.desserialize(value[`${field.name}.${child.name}`]));
710
+ });
711
+ else field.formControl.patchValue(field.desserialize(value[field.name]));
712
+ });
713
+ const query = this.fields?.filter((field) => !field.empty)?.map((field) => {
714
+ if (field.fieldType === "group") return { [field.name]: field.fields?.filter((field) => !field.empty)?.map((field) => ({ [field.name]: field.formControl.value })).reduce((o1, o2) => ({
715
+ ...o1,
716
+ ...o2
717
+ }), {}) };
718
+ else return { [field.name]: field.formControl.value };
719
+ }).reduce((o1, o2) => ({
720
+ ...o1,
721
+ ...o2
722
+ }), {});
723
+ this.query.emit(query);
724
+ }
725
+ configFieldsSubscriptions() {
726
+ this.fields.forEach((field) => {
727
+ if (!this._subscriptions[field.name]) this._subscriptions[field.name] = field.formControl.valueChanges.pipe(delay(300)).subscribe((_) => {
728
+ console.log("field: ", field.name, " value: ", field.formControl.value);
729
+ const queryParams = this.activatedRoute.snapshot.queryParams;
730
+ if (field.serialized() !== queryParams[field.name]) this.router.navigate(["./"], {
731
+ relativeTo: this.activatedRoute,
732
+ queryParams: this.serialized()
733
+ });
734
+ });
735
+ });
736
+ Object.keys(this._subscriptions).forEach((key) => {
737
+ if (!this.fields?.find((field) => field.name === key)) {
738
+ this._subscriptions[key].unsubscribe();
739
+ delete this._subscriptions[key];
740
+ }
741
+ });
742
+ }
743
+ static ɵfac = i0.ɵɵngDeclareFactory({
744
+ minVersion: "12.0.0",
745
+ version: "22.3.2",
746
+ ngImport: i0,
747
+ type: QueryFormComponent,
748
+ deps: [
749
+ { token: Router },
750
+ { token: DialogService },
751
+ { token: ActivatedRoute }
752
+ ],
753
+ target: i0.ɵɵFactoryTarget.Component
754
+ });
755
+ static ɵcmp = i0.ɵɵngDeclareComponent({
756
+ minVersion: "17.0.0",
757
+ version: "22.3.2",
758
+ type: QueryFormComponent,
759
+ isStandalone: true,
760
+ selector: "mcl-query-form",
761
+ outputs: { query: "query" },
762
+ queries: [{
763
+ propertyName: "fields",
764
+ predicate: QueryFieldComponent
765
+ }],
766
+ viewQueries: [{
767
+ propertyName: "modalTemplate",
768
+ first: true,
769
+ predicate: ["modalTemplate"],
770
+ descendants: true,
771
+ read: TemplateRef
772
+ }],
773
+ ngImport: i0,
774
+ template: "@if (!!fields) {\n <section class=\"flt\" aria-label=\"Filtros e busca\">\n <!-- Barra de filtros aplicados (chips) -->\n @if (filterCount > 0) {\n <div class=\"flt__applied\">\n <div class=\"flt__applied-title\">Filtros aplicados:</div>\n\n <ul class=\"flt__chips\" role=\"list\">\n @for (field of fields.toArray(); track field.labelText) {\n @if (!field.fixed && !field.empty) {\n\n @if (field.fieldType === 'group') {\n\n <li class=\"flt__chip-group\">\n <div class=\"flt__chip-group-head\">\n <span class=\"flt__chip-group-title\">{{ field.labelText }}</span>\n @if (!field.required) {\n <button\n type=\"button\"\n class=\"flt__chip-group-clear\"\n (click)=\"clear(field)\">\n <mat-icon aria-hidden=\"true\">close</mat-icon>\n </button>\n }\n </div>\n\n <ul class=\"flt__chip-group-items\" role=\"list\">\n @for (sub of field.fields; track sub.labelText) {\n <li class=\"flt__chip flt__chip--sub\">\n @if (sub.labelText) {\n <span class=\"flt__chip-label\">{{ sub.labelText }}:</span>\n }\n <span class=\"flt__chip-value\">{{ sub.value }}</span>\n\n @if (!sub.required) {\n <button\n type=\"button\"\n class=\"flt__chip-remove\"\n (click)=\"clear(field)\">\n <mat-icon aria-hidden=\"true\">close</mat-icon>\n </button>\n }\n </li>\n }\n </ul>\n </li>\n } @else {\n <li class=\"flt__chip\">\n <span class=\"flt__chip-label\">{{ field.labelText }}:</span>\n <span class=\"flt__chip-value\">{{ field.value }}</span>\n\n @if (!field.required) {\n <button\n type=\"button\"\n class=\"flt__chip-remove\"\n (click)=\"clear(field)\">\n <mat-icon aria-hidden=\"true\">close</mat-icon>\n </button>\n }\n </li>\n }\n\n }\n }\n </ul>\n\n <button type=\"button\" class=\"flt__clear\" (click)=\"clearAll()\">\n <mat-icon aria-hidden=\"true\">filter_alt_off</mat-icon>\n Limpar tudo\n </button>\n </div>\n }\n\n <div class=\"flt__body\">\n @for (field of fields; track field.name) {\n @if (field.fixed) {\n <div [ngClass]=\"field.fieldType\" class=\"flt__field\" >\n @if (field.fieldType === 'group') {\n <h3>{{ field.labelText }}</h3>\n }\n\n <mcl-query-form-field [field]=\"field\" [control]=\"field.formControl\"></mcl-query-form-field>\n </div>\n }\n }\n\n <div class=\"flt__separator\"></div>\n\n <!-- Ações -->\n <div class=\"flt__actions\">\n <button mat-stroked-button type=\"button\" (click)=\"openFilter($event)\">\n <mat-icon aria-hidden=\"true\">tune</mat-icon>\n Filtros avançados\n </button>\n </div>\n </div>\n </section>\n\n}\n\n",
775
+ styles: ["@charset \"UTF-8\";:host{--flt-bg: var(--lib-color-surface, var(--mat-sys-surface));--flt-fg: var(--lib-color-on-surface, var(--mat-sys-on-surface));--flt-muted: var(--lib-color-on-surface-variant, var(--mat-sys-on-surface-variant));--flt-border: var(--lib-color-outline-variant, var(--mat-sys-outline-variant));--flt-primary: var(--lib-color-primary, var(--mat-sys-primary));--flt-chip-bg: var(--lib-color-surface-container-low, var(--mat-sys-surface-container-low));--flt-radius: var(--mcl-radius-md, 12px);display:block}.flt{background:var(--flt-bg);border:1px solid var(--flt-border);border-radius:var(--flt-radius);box-shadow:var(--mcl-shadow-1, 0 1px 3px rgba(0, 0, 0, .05));margin-bottom:16px}.flt__applied{display:flex;align-items:center;gap:10px;padding:10px 16px;border-bottom:1px solid var(--flt-border);background:var(--flt-chip-bg);flex-wrap:wrap}.flt__applied-title{font-size:.8125rem;color:var(--flt-muted);white-space:nowrap}.flt__chips{display:flex;flex-wrap:wrap;gap:6px;list-style:none;padding:0;margin:0;flex:1 1 auto}.flt__chip{display:inline-flex;align-items:center;gap:6px;max-width:100%;height:30px;padding:0 6px 0 12px;border:1px solid var(--flt-border);border-radius:var(--mcl-radius-full, 999px);background:var(--flt-bg);color:var(--flt-fg)}.flt__chip-label{font-size:.78rem;font-weight:600;color:var(--flt-muted)}.flt__chip-value{font-size:.78rem;color:var(--flt-fg);font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:26ch}.flt__chip-remove{inline-size:20px;block-size:20px;display:grid;place-items:center;border:0;border-radius:var(--mcl-radius-full, 999px);background:transparent;color:var(--flt-muted);transition:background-color var(--mcl-transition, .18s ease),color var(--mcl-transition, .18s ease)}.flt__chip-remove mat-icon{font-size:16px;height:16px;width:16px}.flt__chip-remove:hover{background:color-mix(in oklab,var(--flt-fg) 8%,var(--flt-bg));color:var(--flt-fg)}.flt__chip-remove:focus-visible{outline:2px solid var(--flt-primary);outline-offset:2px}.flt__chip-group{display:inline-flex;align-items:center;gap:6px;flex-wrap:wrap}.flt__chip-group-head{display:inline-flex;align-items:center;gap:2px}.flt__chip-group-title{display:inline-flex;align-items:center;height:30px;padding:0 10px;border-radius:var(--mcl-radius-full, 999px);background:color-mix(in oklab,var(--flt-primary) 10%,var(--flt-bg));color:var(--flt-primary);font-size:.78rem;font-weight:600;white-space:nowrap}.flt__chip-group-items{display:inline-flex;align-items:center;gap:6px;list-style:none;padding:0;margin:0}.flt__chip--sub{border-color:color-mix(in oklab,var(--flt-primary) 24%,var(--flt-border))}.flt__chip-group-clear{inline-size:22px;block-size:22px;display:grid;place-items:center;border-radius:var(--mcl-radius-full, 999px);border:0;background:transparent;color:var(--flt-muted);transition:background-color var(--mcl-transition, .18s ease),color var(--mcl-transition, .18s ease)}.flt__chip-group-clear mat-icon{font-size:16px;height:16px;width:16px}.flt__chip-group-clear:hover{background:color-mix(in oklab,var(--flt-fg) 8%,var(--flt-bg));color:var(--flt-fg)}.flt__clear{height:30px;padding:0 12px;display:inline-flex;align-items:center;gap:6px;border-radius:var(--mcl-radius-full, 999px);border:1px solid var(--flt-border);background:var(--flt-bg);color:var(--flt-muted);font-size:.8125rem;white-space:nowrap;transition:background-color var(--mcl-transition, .18s ease),border-color var(--mcl-transition, .18s ease),color var(--mcl-transition, .18s ease)}.flt__clear mat-icon{font-size:16px;height:16px;width:16px}.flt__clear:hover{background:color-mix(in oklab,var(--flt-fg) 5%,var(--flt-bg));color:var(--flt-fg)}.flt__body{display:flex;flex-wrap:wrap;gap:4px 16px;align-items:center;padding:16px 16px 4px}.flt__field{flex:1 1 220px;min-width:220px;max-width:340px}.flt__separator{flex:1 1 auto}.flt__actions{display:flex;justify-content:flex-end;gap:8px;padding-bottom:12px}@media(max-width:767.98px){.flt__body{padding:12px 12px 4px}.flt__field{flex-basis:100%;min-width:0;max-width:none}.flt__actions{width:100%;justify-content:stretch}.flt__actions button{width:100%}.flt__applied{padding-inline:12px}}\n"],
776
+ dependencies: [
777
+ {
778
+ kind: "ngmodule",
779
+ type: FormsModule
780
+ },
781
+ {
782
+ kind: "component",
783
+ type: MatIcon,
784
+ selector: "mat-icon",
785
+ inputs: [
786
+ "color",
787
+ "inline",
788
+ "svgIcon",
789
+ "fontSet",
790
+ "fontIcon"
791
+ ],
792
+ exportAs: ["matIcon"]
793
+ },
794
+ {
795
+ kind: "component",
796
+ type: QueryFormFieldComponent,
797
+ selector: "mcl-query-form-field",
798
+ inputs: ["field", "control"]
799
+ },
800
+ {
801
+ kind: "directive",
802
+ type: NgClass,
803
+ selector: "[ngClass]",
804
+ inputs: ["class", "ngClass"]
805
+ },
806
+ {
807
+ kind: "component",
808
+ type: MatButton,
809
+ selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ",
810
+ inputs: ["matButton"],
811
+ exportAs: ["matButton", "matAnchor"]
812
+ }
813
+ ],
814
+ changeDetection: i0.ChangeDetectionStrategy.Eager
815
+ });
816
+ };
817
+ i0.ɵɵngDeclareClassMetadata({
818
+ minVersion: "12.0.0",
819
+ version: "22.3.2",
820
+ ngImport: i0,
821
+ type: QueryFormComponent,
822
+ decorators: [{
823
+ type: Component,
824
+ args: [{
825
+ selector: "mcl-query-form",
826
+ imports: [
827
+ FormsModule,
828
+ MatIcon,
829
+ QueryFormFieldComponent,
830
+ NgClass,
831
+ MatButton
832
+ ],
833
+ changeDetection: ChangeDetectionStrategy.Eager,
834
+ template: "@if (!!fields) {\n <section class=\"flt\" aria-label=\"Filtros e busca\">\n <!-- Barra de filtros aplicados (chips) -->\n @if (filterCount > 0) {\n <div class=\"flt__applied\">\n <div class=\"flt__applied-title\">Filtros aplicados:</div>\n\n <ul class=\"flt__chips\" role=\"list\">\n @for (field of fields.toArray(); track field.labelText) {\n @if (!field.fixed && !field.empty) {\n\n @if (field.fieldType === 'group') {\n\n <li class=\"flt__chip-group\">\n <div class=\"flt__chip-group-head\">\n <span class=\"flt__chip-group-title\">{{ field.labelText }}</span>\n @if (!field.required) {\n <button\n type=\"button\"\n class=\"flt__chip-group-clear\"\n (click)=\"clear(field)\">\n <mat-icon aria-hidden=\"true\">close</mat-icon>\n </button>\n }\n </div>\n\n <ul class=\"flt__chip-group-items\" role=\"list\">\n @for (sub of field.fields; track sub.labelText) {\n <li class=\"flt__chip flt__chip--sub\">\n @if (sub.labelText) {\n <span class=\"flt__chip-label\">{{ sub.labelText }}:</span>\n }\n <span class=\"flt__chip-value\">{{ sub.value }}</span>\n\n @if (!sub.required) {\n <button\n type=\"button\"\n class=\"flt__chip-remove\"\n (click)=\"clear(field)\">\n <mat-icon aria-hidden=\"true\">close</mat-icon>\n </button>\n }\n </li>\n }\n </ul>\n </li>\n } @else {\n <li class=\"flt__chip\">\n <span class=\"flt__chip-label\">{{ field.labelText }}:</span>\n <span class=\"flt__chip-value\">{{ field.value }}</span>\n\n @if (!field.required) {\n <button\n type=\"button\"\n class=\"flt__chip-remove\"\n (click)=\"clear(field)\">\n <mat-icon aria-hidden=\"true\">close</mat-icon>\n </button>\n }\n </li>\n }\n\n }\n }\n </ul>\n\n <button type=\"button\" class=\"flt__clear\" (click)=\"clearAll()\">\n <mat-icon aria-hidden=\"true\">filter_alt_off</mat-icon>\n Limpar tudo\n </button>\n </div>\n }\n\n <div class=\"flt__body\">\n @for (field of fields; track field.name) {\n @if (field.fixed) {\n <div [ngClass]=\"field.fieldType\" class=\"flt__field\" >\n @if (field.fieldType === 'group') {\n <h3>{{ field.labelText }}</h3>\n }\n\n <mcl-query-form-field [field]=\"field\" [control]=\"field.formControl\"></mcl-query-form-field>\n </div>\n }\n }\n\n <div class=\"flt__separator\"></div>\n\n <!-- Ações -->\n <div class=\"flt__actions\">\n <button mat-stroked-button type=\"button\" (click)=\"openFilter($event)\">\n <mat-icon aria-hidden=\"true\">tune</mat-icon>\n Filtros avançados\n </button>\n </div>\n </div>\n </section>\n\n}\n\n",
835
+ styles: ["@charset \"UTF-8\";:host{--flt-bg: var(--lib-color-surface, var(--mat-sys-surface));--flt-fg: var(--lib-color-on-surface, var(--mat-sys-on-surface));--flt-muted: var(--lib-color-on-surface-variant, var(--mat-sys-on-surface-variant));--flt-border: var(--lib-color-outline-variant, var(--mat-sys-outline-variant));--flt-primary: var(--lib-color-primary, var(--mat-sys-primary));--flt-chip-bg: var(--lib-color-surface-container-low, var(--mat-sys-surface-container-low));--flt-radius: var(--mcl-radius-md, 12px);display:block}.flt{background:var(--flt-bg);border:1px solid var(--flt-border);border-radius:var(--flt-radius);box-shadow:var(--mcl-shadow-1, 0 1px 3px rgba(0, 0, 0, .05));margin-bottom:16px}.flt__applied{display:flex;align-items:center;gap:10px;padding:10px 16px;border-bottom:1px solid var(--flt-border);background:var(--flt-chip-bg);flex-wrap:wrap}.flt__applied-title{font-size:.8125rem;color:var(--flt-muted);white-space:nowrap}.flt__chips{display:flex;flex-wrap:wrap;gap:6px;list-style:none;padding:0;margin:0;flex:1 1 auto}.flt__chip{display:inline-flex;align-items:center;gap:6px;max-width:100%;height:30px;padding:0 6px 0 12px;border:1px solid var(--flt-border);border-radius:var(--mcl-radius-full, 999px);background:var(--flt-bg);color:var(--flt-fg)}.flt__chip-label{font-size:.78rem;font-weight:600;color:var(--flt-muted)}.flt__chip-value{font-size:.78rem;color:var(--flt-fg);font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:26ch}.flt__chip-remove{inline-size:20px;block-size:20px;display:grid;place-items:center;border:0;border-radius:var(--mcl-radius-full, 999px);background:transparent;color:var(--flt-muted);transition:background-color var(--mcl-transition, .18s ease),color var(--mcl-transition, .18s ease)}.flt__chip-remove mat-icon{font-size:16px;height:16px;width:16px}.flt__chip-remove:hover{background:color-mix(in oklab,var(--flt-fg) 8%,var(--flt-bg));color:var(--flt-fg)}.flt__chip-remove:focus-visible{outline:2px solid var(--flt-primary);outline-offset:2px}.flt__chip-group{display:inline-flex;align-items:center;gap:6px;flex-wrap:wrap}.flt__chip-group-head{display:inline-flex;align-items:center;gap:2px}.flt__chip-group-title{display:inline-flex;align-items:center;height:30px;padding:0 10px;border-radius:var(--mcl-radius-full, 999px);background:color-mix(in oklab,var(--flt-primary) 10%,var(--flt-bg));color:var(--flt-primary);font-size:.78rem;font-weight:600;white-space:nowrap}.flt__chip-group-items{display:inline-flex;align-items:center;gap:6px;list-style:none;padding:0;margin:0}.flt__chip--sub{border-color:color-mix(in oklab,var(--flt-primary) 24%,var(--flt-border))}.flt__chip-group-clear{inline-size:22px;block-size:22px;display:grid;place-items:center;border-radius:var(--mcl-radius-full, 999px);border:0;background:transparent;color:var(--flt-muted);transition:background-color var(--mcl-transition, .18s ease),color var(--mcl-transition, .18s ease)}.flt__chip-group-clear mat-icon{font-size:16px;height:16px;width:16px}.flt__chip-group-clear:hover{background:color-mix(in oklab,var(--flt-fg) 8%,var(--flt-bg));color:var(--flt-fg)}.flt__clear{height:30px;padding:0 12px;display:inline-flex;align-items:center;gap:6px;border-radius:var(--mcl-radius-full, 999px);border:1px solid var(--flt-border);background:var(--flt-bg);color:var(--flt-muted);font-size:.8125rem;white-space:nowrap;transition:background-color var(--mcl-transition, .18s ease),border-color var(--mcl-transition, .18s ease),color var(--mcl-transition, .18s ease)}.flt__clear mat-icon{font-size:16px;height:16px;width:16px}.flt__clear:hover{background:color-mix(in oklab,var(--flt-fg) 5%,var(--flt-bg));color:var(--flt-fg)}.flt__body{display:flex;flex-wrap:wrap;gap:4px 16px;align-items:center;padding:16px 16px 4px}.flt__field{flex:1 1 220px;min-width:220px;max-width:340px}.flt__separator{flex:1 1 auto}.flt__actions{display:flex;justify-content:flex-end;gap:8px;padding-bottom:12px}@media(max-width:767.98px){.flt__body{padding:12px 12px 4px}.flt__field{flex-basis:100%;min-width:0;max-width:none}.flt__actions{width:100%;justify-content:stretch}.flt__actions button{width:100%}.flt__applied{padding-inline:12px}}\n"]
836
+ }]
837
+ }],
838
+ ctorParameters: () => [
839
+ { type: Router },
840
+ { type: DialogService },
841
+ { type: ActivatedRoute }
842
+ ],
843
+ propDecorators: {
844
+ fields: [{
845
+ type: ContentChildren,
846
+ args: [QueryFieldComponent]
847
+ }],
848
+ modalTemplate: [{
849
+ type: ViewChild,
850
+ args: ["modalTemplate", { read: TemplateRef }]
851
+ }],
852
+ query: [{ type: Output }]
853
+ }
854
+ });
855
+ var AbstractConsultaPaginadaComponent = class AbstractConsultaPaginadaComponent {
856
+ router = inject(Router);
857
+ dialogService = inject(DialogService);
858
+ loaderService = inject(LoaderService);
859
+ timeoutConsulta;
860
+ filtro = {};
861
+ page;
862
+ table;
863
+ ngAfterViewInit() {
864
+ this.reset();
865
+ }
866
+ async reset(filtro = this.filtro) {
867
+ this.filtro = filtro;
868
+ this.page = void 0;
869
+ await this.busca();
870
+ }
871
+ get tamanhoPagina() {
872
+ return this.page?.tamanhoPagina || this.page?.size;
873
+ }
874
+ async busca(event = {
875
+ type: "numeric",
876
+ page: 1,
877
+ size: 10
878
+ }) {
879
+ if (event.type === "numeric") {
880
+ clearTimeout(this.timeoutConsulta);
881
+ this.timeoutConsulta = setTimeout(async () => {
882
+ this.page = await lastValueFrom(this.table.loadingAround(this.consultaEntidades(event.page, event.size)));
883
+ }, 300);
884
+ }
885
+ }
886
+ async remove(entidade) {
887
+ if (await this.dialogService.confirma("mcl.consulta.confirma-remocao").toPromise()) await this.loaderService.listen(this.deleteEntidade(entidade)).toPromise();
888
+ }
889
+ static ɵfac = i0.ɵɵngDeclareFactory({
890
+ minVersion: "12.0.0",
891
+ version: "22.3.2",
892
+ ngImport: i0,
893
+ type: AbstractConsultaPaginadaComponent,
894
+ deps: [],
895
+ target: i0.ɵɵFactoryTarget.Component
896
+ });
897
+ static ɵcmp = i0.ɵɵngDeclareComponent({
898
+ minVersion: "14.0.0",
899
+ version: "22.3.2",
900
+ type: AbstractConsultaPaginadaComponent,
901
+ isStandalone: true,
902
+ selector: "ng-component",
903
+ viewQueries: [{
904
+ propertyName: "table",
905
+ first: true,
906
+ predicate: PaginatedTableComponent,
907
+ descendants: true
908
+ }],
909
+ ngImport: i0,
910
+ template: "",
911
+ isInline: true,
912
+ changeDetection: i0.ChangeDetectionStrategy.Eager
913
+ });
914
+ };
915
+ i0.ɵɵngDeclareClassMetadata({
916
+ minVersion: "12.0.0",
917
+ version: "22.3.2",
918
+ ngImport: i0,
919
+ type: AbstractConsultaPaginadaComponent,
920
+ decorators: [{
921
+ type: Component,
922
+ args: [{
923
+ changeDetection: ChangeDetectionStrategy.Eager,
924
+ template: ""
925
+ }]
926
+ }],
927
+ propDecorators: { table: [{
928
+ type: ViewChild,
929
+ args: [PaginatedTableComponent]
930
+ }] }
931
+ });
932
+ var AbstractEdicaoComponent = class AbstractEdicaoComponent {
933
+ entidade = {};
934
+ router = inject(Router);
935
+ activatedRoute = inject(ActivatedRoute);
936
+ mensageriaService = inject(MensageriaService);
937
+ loaderService = inject(LoaderService);
938
+ ngOnInit() {
939
+ if (!!this.detalhaEntidade) observaParametrosDaRota(this.activatedRoute).subscribe((params) => {
940
+ if (params["id"]) this.loaderService.listen(this.detalhaEntidade(params["id"])).subscribe((entidade) => this.entidade = entidade);
941
+ });
942
+ }
943
+ async salva(form) {
944
+ if (!form.valid) return;
945
+ await this.loaderService.listen(this.salvaEntidade()).toPromise();
946
+ this.mensageriaService.addMensagem("mcl.edicao.salvo-sucesso");
947
+ }
948
+ static ɵfac = i0.ɵɵngDeclareFactory({
949
+ minVersion: "12.0.0",
950
+ version: "22.3.2",
951
+ ngImport: i0,
952
+ type: AbstractEdicaoComponent,
953
+ deps: [],
954
+ target: i0.ɵɵFactoryTarget.Component
955
+ });
956
+ static ɵcmp = i0.ɵɵngDeclareComponent({
957
+ minVersion: "14.0.0",
958
+ version: "22.3.2",
959
+ type: AbstractEdicaoComponent,
960
+ isStandalone: true,
961
+ selector: "ng-component",
962
+ ngImport: i0,
963
+ template: "",
964
+ isInline: true,
965
+ changeDetection: i0.ChangeDetectionStrategy.Eager
966
+ });
967
+ };
968
+ i0.ɵɵngDeclareClassMetadata({
969
+ minVersion: "12.0.0",
970
+ version: "22.3.2",
971
+ ngImport: i0,
972
+ type: AbstractEdicaoComponent,
973
+ decorators: [{
974
+ type: Component,
975
+ args: [{
976
+ changeDetection: ChangeDetectionStrategy.Eager,
977
+ template: ""
978
+ }]
979
+ }]
980
+ });
981
+ var AbstractEdicaoModalComponent = class {
982
+ router = inject(Router);
983
+ activatedRoute = inject(ActivatedRoute);
984
+ dialogService = inject(DialogService);
985
+ loaderService = inject(LoaderService);
986
+ mensageriaService = inject(MensageriaService);
987
+ dialogRef = inject(MatDialogRef);
988
+ async salva(form) {
989
+ if (!form.valid) return;
990
+ const salvo = await this.loaderService.listen(this.salvaEntidade()).toPromise();
991
+ this.mensageriaService.addMensagem("mcl.edicao.salvo-sucesso");
992
+ this.dialogRef.close(salvo);
993
+ }
994
+ async remove(entidade) {
995
+ if (!!this.deleteEntidade) {
996
+ if (await this.dialogService.confirma("mcl.consulta.confirma-remocao").toPromise()) {
997
+ await this.loaderService.listen(this.deleteEntidade(entidade)).toPromise();
998
+ this.dialogRef.close(true);
999
+ }
1000
+ }
1001
+ }
1002
+ };
546
1003
  export { AbstractConsultaPaginadaComponent, AbstractEdicaoComponent, AbstractEdicaoModalComponent, QueryFieldComponent, QueryFormComponent, QueryFormFieldComponent, QueryModalFormComponent };
547
- //# sourceMappingURL=main-class-componentes-crud.mjs.map
1004
+
1005
+ //# sourceMappingURL=main-class-componentes-crud.mjs.map