@seniorsistemas/tmsx-angular-components 1.0.6 → 2.0.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 (73) hide show
  1. package/commons/field-type/field-type.d.ts +76 -0
  2. package/commons/field-type/index.d.ts +1 -0
  3. package/commons/index.d.ts +1 -0
  4. package/components/grid-editable-nested/grid-editable-nested.component.d.ts +11 -10
  5. package/components/grid-editable-nested/grid-editable-nested.module.d.ts +31 -0
  6. package/components/index.d.ts +1 -1
  7. package/components/painel-processamento/painel-processamento.component.d.ts +5 -2
  8. package/components/painel-processamento/painel-processamento.module.d.ts +13 -0
  9. package/components/painel-processamento/processamento.d.ts +1 -1
  10. package/esm2022/commons/field-type/field-type.mjs +76 -0
  11. package/esm2022/commons/field-type/index.mjs +2 -0
  12. package/esm2022/commons/index.mjs +2 -0
  13. package/esm2022/components/grid-editable-nested/grid-editable-nested.component.mjs +261 -0
  14. package/esm2022/components/grid-editable-nested/grid-editable-nested.module.mjs +133 -0
  15. package/esm2022/components/grid-editable-nested/grid.interface.mjs +9 -0
  16. package/esm2022/components/grid-editable-nested/index.mjs +3 -0
  17. package/esm2022/components/index.mjs +3 -0
  18. package/esm2022/components/painel-processamento/index.mjs +3 -0
  19. package/esm2022/components/painel-processamento/painel-processamento.component.mjs +226 -0
  20. package/esm2022/components/painel-processamento/painel-processamento.module.mjs +53 -0
  21. package/esm2022/components/painel-processamento/processamento.mjs +14 -0
  22. package/esm2022/locale/fallback.mjs +39 -0
  23. package/esm2022/public-api.mjs +6 -0
  24. package/esm2022/seniorsistemas-tmsx-angular-components.mjs +5 -0
  25. package/esm2022/tmsx-angular-components.module.mjs +24 -0
  26. package/esm2022/utils/index.mjs +2 -0
  27. package/esm2022/utils/services/utils.service.mjs +192 -0
  28. package/fesm2022/seniorsistemas-tmsx-angular-components.mjs +992 -0
  29. package/fesm2022/seniorsistemas-tmsx-angular-components.mjs.map +1 -0
  30. package/{seniorsistemas-tmsx-angular-components.d.ts → index.d.ts} +1 -0
  31. package/package.json +16 -59
  32. package/public-api.d.ts +4 -3
  33. package/tmsx-angular-components.module.d.ts +6 -2
  34. package/utils/services/utils.service.d.ts +7 -3
  35. package/bundles/seniorsistemas-tmsx-angular-components.umd.js +0 -1108
  36. package/bundles/seniorsistemas-tmsx-angular-components.umd.js.map +0 -1
  37. package/bundles/seniorsistemas-tmsx-angular-components.umd.min.js +0 -2
  38. package/bundles/seniorsistemas-tmsx-angular-components.umd.min.js.map +0 -1
  39. package/esm2015/components/grid-editable-nested/grid-editable-nested.component.js +0 -267
  40. package/esm2015/components/grid-editable-nested/grid-editable-nested.module.js +0 -64
  41. package/esm2015/components/grid-editable-nested/grid.interface.js +0 -9
  42. package/esm2015/components/grid-editable-nested/index.js +0 -3
  43. package/esm2015/components/index.js +0 -3
  44. package/esm2015/components/painel-processamento/index.js +0 -3
  45. package/esm2015/components/painel-processamento/painel-processamento.component.js +0 -235
  46. package/esm2015/components/painel-processamento/painel-processamento.module.js +0 -33
  47. package/esm2015/components/painel-processamento/processamento.js +0 -14
  48. package/esm2015/locale/fallback.js +0 -39
  49. package/esm2015/public-api.js +0 -5
  50. package/esm2015/seniorsistemas-tmsx-angular-components.js +0 -5
  51. package/esm2015/tmsx-angular-components.module.js +0 -22
  52. package/esm2015/utils/index.js +0 -2
  53. package/esm2015/utils/services/utils.service.js +0 -196
  54. package/esm5/components/grid-editable-nested/grid-editable-nested.component.js +0 -282
  55. package/esm5/components/grid-editable-nested/grid-editable-nested.module.js +0 -67
  56. package/esm5/components/grid-editable-nested/grid.interface.js +0 -9
  57. package/esm5/components/grid-editable-nested/index.js +0 -3
  58. package/esm5/components/index.js +0 -3
  59. package/esm5/components/painel-processamento/index.js +0 -3
  60. package/esm5/components/painel-processamento/painel-processamento.component.js +0 -263
  61. package/esm5/components/painel-processamento/painel-processamento.module.js +0 -36
  62. package/esm5/components/painel-processamento/processamento.js +0 -15
  63. package/esm5/locale/fallback.js +0 -39
  64. package/esm5/public-api.js +0 -5
  65. package/esm5/seniorsistemas-tmsx-angular-components.js +0 -5
  66. package/esm5/tmsx-angular-components.module.js +0 -26
  67. package/esm5/utils/index.js +0 -2
  68. package/esm5/utils/services/utils.service.js +0 -198
  69. package/fesm2015/seniorsistemas-tmsx-angular-components.js +0 -839
  70. package/fesm2015/seniorsistemas-tmsx-angular-components.js.map +0 -1
  71. package/fesm5/seniorsistemas-tmsx-angular-components.js +0 -895
  72. package/fesm5/seniorsistemas-tmsx-angular-components.js.map +0 -1
  73. package/seniorsistemas-tmsx-angular-components.metadata.json +0 -1
@@ -0,0 +1,992 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Injectable, EventEmitter, Component, Input, Output, ViewChild, NgModule, InjectionToken } from '@angular/core';
3
+ import * as i3 from 'angular2-hotkeys';
4
+ import { Hotkey } from 'angular2-hotkeys';
5
+ import { Subject } from 'rxjs';
6
+ import * as i1 from '@ngx-translate/core';
7
+ import { TranslateModule } from '@ngx-translate/core';
8
+ import * as i2 from '@seniorsistemas/angular-components/locale';
9
+ import { LocaleModule } from '@seniorsistemas/angular-components/locale';
10
+ import * as i6 from '@angular/common';
11
+ import { CommonModule } from '@angular/common';
12
+ import * as i5 from '@seniorsistemas/angular-components/button';
13
+ import { ButtonModule } from '@seniorsistemas/angular-components/button';
14
+ import * as i6$1 from '@seniorsistemas/angular-components/table';
15
+ import { TableModule, EnumColumnFieldType } from '@seniorsistemas/angular-components/table';
16
+ import * as i7 from '@seniorsistemas/angular-components/loading-state';
17
+ import { LoadingStateModule } from '@seniorsistemas/angular-components/loading-state';
18
+ import * as i8 from '@seniorsistemas/angular-components/number-input';
19
+ import { NumberInputModule } from '@seniorsistemas/angular-components/number-input';
20
+ import * as i4 from 'primeng/api';
21
+ import { SharedModule } from 'primeng/api';
22
+ import * as i10 from 'primeng/table';
23
+ import { TableModule as TableModule$1 } from 'primeng/table';
24
+ import * as i11 from 'primeng/tooltip';
25
+ import { TooltipModule as TooltipModule$1 } from 'primeng/tooltip';
26
+ import * as i12 from 'primeng/inputtext';
27
+ import { InputTextModule } from 'primeng/inputtext';
28
+ import * as i13 from 'primeng/datepicker';
29
+ import { DatePickerModule } from 'primeng/datepicker';
30
+ import * as i14 from 'primeng/autocomplete';
31
+ import { AutoCompleteModule } from 'primeng/autocomplete';
32
+ import * as i15 from '@angular/forms';
33
+ import { FormsModule, ReactiveFormsModule } from '@angular/forms';
34
+ import { BreadcrumbModule } from '@seniorsistemas/angular-components/breadcrumb';
35
+ import { ControlErrorsModule } from '@seniorsistemas/angular-components/control-errors';
36
+ import { CustomFieldsModule } from '@seniorsistemas/angular-components/custom-fields';
37
+ import { DynamicFormModule } from '@seniorsistemas/angular-components/dynamic-form';
38
+ import { EmptyStateModule } from '@seniorsistemas/angular-components/empty-state';
39
+ import { TokenListModule } from '@seniorsistemas/angular-components/token-list';
40
+ import * as i2$1 from '@seniorsistemas/angular-components/tooltip';
41
+ import { TooltipModule } from '@seniorsistemas/angular-components/tooltip';
42
+ import { CheckboxModule } from 'primeng/checkbox';
43
+ import { ConfirmDialogModule } from 'primeng/confirmdialog';
44
+ import { DropdownModule } from 'primeng/dropdown';
45
+ import * as i7$1 from 'primeng/panel';
46
+ import { PanelModule } from 'primeng/panel';
47
+ import { ToastModule } from 'primeng/toast';
48
+
49
+ /**
50
+ * Constante que mapeia os tipos de campo disponíveis no DynamicForm do
51
+ * `@seniorsistemas/angular-components`. Substitui o antigo `FieldType` enum
52
+ * que foi removido na v19 em favor de string literals.
53
+ *
54
+ * Uso:
55
+ * ```typescript
56
+ * import { FieldType } from '@tmsx/angular-components';
57
+ *
58
+ * { type: FieldType.String, name: 'nome', ... }
59
+ * { type: FieldType.Enum, name: 'status', ... }
60
+ * { type: FieldType.Lookup, name: 'cidade', ... }
61
+ * ```
62
+ */
63
+ // eslint-disable-next-line @typescript-eslint/naming-convention
64
+ const FieldType = {
65
+ /** Campo de texto livre padrão. */
66
+ String: 'string',
67
+ /** Campo de texto tratado como dado binário (ex: base64). */
68
+ Binary: 'binary',
69
+ /** Campo de seleção (dropdown/select) com lista de opções. */
70
+ Enum: 'enum',
71
+ /** Campo numérico inteiro (usa NumberInput). */
72
+ Integer: 'integer',
73
+ /** Campo numérico genérico com grande precisão (usa BignumberInput). */
74
+ Number: 'number',
75
+ /** Campo numérico com casas decimais (usa BignumberInput). */
76
+ Double: 'double',
77
+ /** @deprecated Use `Number` ou `Double` com addon. Campo numérico legado. */
78
+ LegacyNumber: 'legacyNumber',
79
+ /** @deprecated Use `Number` ou `Double` com addon. Campo monetário com símbolo de moeda. */
80
+ Money: 'money',
81
+ /** Campo booleano exibido como radio buttons (Sim/Não). */
82
+ Boolean: 'boolean',
83
+ /** Campo booleano exibido como toggle switch. */
84
+ BooleanSwitch: 'booleanSwitch',
85
+ /** Campo de data apenas (dia/mês/ano). */
86
+ Date: 'date',
87
+ /** Campo de data e hora com timezone UTC. */
88
+ DateTime: 'dateTime',
89
+ /** Campo de data e hora sem timezone (local). */
90
+ LocalDateTime: 'localDateTime',
91
+ /** Campo de hora apenas (hora:minuto:segundo). */
92
+ Time: 'time',
93
+ /** Campo de pesquisa avançada com autocompletar e diálogo de busca. */
94
+ Lookup: 'lookup',
95
+ /** Campo de autocompletar simples com sugestões via Observable. */
96
+ Autocomplete: 'autocomplete',
97
+ /** Campo de seleção única com radio buttons. */
98
+ RadioButton: 'radioButton',
99
+ /** Campo de múltipla escolha com checkboxes. */
100
+ Checkbox: 'checkbox',
101
+ /** Campo de entrada de múltiplas tags/chips. */
102
+ Chips: 'chips',
103
+ /** Campo de área de texto multilinha. */
104
+ TextArea: 'textArea',
105
+ /** Campo de área de texto com geração de conteúdo via IA. */
106
+ ContentGenerator: 'contentGenerator',
107
+ /** @deprecated Use `ContentGenerator`. */
108
+ TextAreaIA: 'textAreaIA',
109
+ /** Campo de upload de arquivos binários. */
110
+ Blob: 'blob',
111
+ /** Botão renderizado como campo do formulário. */
112
+ Button: 'button',
113
+ /** Campo de senha com indicador de força. */
114
+ Password: 'password',
115
+ /** Campo de foto de perfil com recorte. */
116
+ ProfilePicture: 'profilePicture',
117
+ /** Campo de controle deslizante (slider). */
118
+ Slider: 'slider',
119
+ /** Campo de avaliação com estrelas. */
120
+ StarRating: 'starRating',
121
+ /** Campo de seleção de país com entrada de telefone. */
122
+ CountryPhonePicker: 'countryPhonePicker',
123
+ };
124
+
125
+ class UtilsService {
126
+ translate;
127
+ dataPipe;
128
+ constructor(translate, dataPipe) {
129
+ this.translate = translate;
130
+ this.dataPipe = dataPipe;
131
+ }
132
+ getAuditCreatedBy(createdBy, createdDate) {
133
+ if (!createdBy || !createdDate) {
134
+ return '';
135
+ }
136
+ let date = '';
137
+ this.dataPipe.transform(createdDate).subscribe((item) => date = item.split(' '));
138
+ return this.translate.instant('tmsx_fnd.tmsx_angular_components.audit_created_by', { nome: createdBy, data: date[0], hora: date[1] });
139
+ }
140
+ getAuditModifiedBy(modifiedBy, modifiedDate) {
141
+ if (!modifiedBy || !modifiedDate) {
142
+ return '';
143
+ }
144
+ let date = '';
145
+ this.dataPipe.transform(modifiedDate).subscribe((item) => date = item.split(' '));
146
+ return this.translate.instant('tmsx_fnd.tmsx_angular_components.audit_modified_by', { nome: modifiedBy, data: date[0], hora: date[1] });
147
+ }
148
+ getAuditInactivatedBy(inactivatedBy, inactivatedDate) {
149
+ if (!inactivatedBy || !inactivatedDate) {
150
+ return '';
151
+ }
152
+ let date = '';
153
+ this.dataPipe.transform(inactivatedDate).subscribe((item) => date = item.split(' '));
154
+ return this.translate.instant('tmsx_fnd.tmsx_angular_components.audit_inactivated_by', { nome: inactivatedBy, data: date[0], hora: date[1] });
155
+ }
156
+ /* usage: [innerHTML]="getProp(rowData, 'nome')" */
157
+ getProp(obj, path, type) {
158
+ let value = path.split('.').reduce((result, prop) => (result[prop] === undefined ? '' : result[prop]), obj);
159
+ if (value || value === 0) {
160
+ if (type) {
161
+ value = this.formatType(value, type);
162
+ }
163
+ return `<span>${value}</span>`;
164
+ }
165
+ return `<span class="empty-grid">${this.translate.instant('tmsx_fnd.tmsx_angular_components.list_grid_empty_field')}</span>`;
166
+ }
167
+ formatType(value, type) {
168
+ if (value) {
169
+ if (type === 'date') {
170
+ let date = '';
171
+ this.dataPipe.transform(value).subscribe((item) => date = item.split(' '));
172
+ return date[0];
173
+ }
174
+ if (type === 'datetime') {
175
+ let date = '';
176
+ this.dataPipe.transform(value).subscribe((item) => date = item);
177
+ return date;
178
+ }
179
+ if (type === 'decimal') {
180
+ if (typeof value === 'string') {
181
+ value = Number(value);
182
+ }
183
+ return value.toLocaleString('pt-BR', { minimumFractionDigits: 2, maximumFractionDigits: 2 });
184
+ }
185
+ if (type === 'currency') {
186
+ return value.toLocaleString('pt-BR', { style: 'currency', currency: 'BRL' });
187
+ }
188
+ if (type === 'cep') {
189
+ return value.replace(/^(\d{2})(\d{3})(\d{3})/, '$1.$2-$3');
190
+ }
191
+ }
192
+ return value;
193
+ }
194
+ /* usage: [ngClass]="emptyGridClass(value)" */
195
+ emptyGridClass(value) {
196
+ if (!value || value === this.translate.instant('tmsx_fnd.replicacao.list_grid_empty_field')) {
197
+ return 'empty-grid';
198
+ }
199
+ return '';
200
+ }
201
+ infoContent(entity) {
202
+ let text = '';
203
+ if (!entity) {
204
+ return this.translate.instant("tmsx_fnd.tmsx_angular_components.condicao_valor_lookup_condicional_no_audit");
205
+ }
206
+ text += this.getAuditCreatedBy(entity.createdBy, entity.createdDate);
207
+ if (text) {
208
+ text += '\n';
209
+ }
210
+ text += this.getAuditModifiedBy(entity.lastModifiedBy, entity.lastModifiedDate);
211
+ return text;
212
+ }
213
+ formatCurrency(value) {
214
+ return value.toLocaleString('pt-BR', { style: 'currency', currency: 'BRL' });
215
+ }
216
+ getAtivoTokenLabel(formField, value, translate) {
217
+ const { name, type, label } = formField;
218
+ if (type === 'radio') {
219
+ const labelValue = value
220
+ ? translate.instant('tmsx_fnd.tmsx_angular_components.situacao_ativo_true')
221
+ : translate.instant('tmsx_fnd.tmsx_angular_components.situacao_ativo_false');
222
+ return { id: name, label: `${label}: ${labelValue}` };
223
+ }
224
+ return this.createFilterTokens(formField, value, translate);
225
+ }
226
+ getUtilsProp(obj, path) {
227
+ return path.split('.').reduce((result, prop) => (result[prop] === undefined ? '' : result[prop]), obj);
228
+ }
229
+ createFilterTokens(formField, value, translate) {
230
+ const { name, type, label, searchFields, options } = formField;
231
+ const labelValue = this.getLabelValueByType(type, value, searchFields, options, translate);
232
+ return { id: name, label: `${label}: ${labelValue}` };
233
+ }
234
+ getLabelValueByType(type, value, searchFields, options, translate) {
235
+ switch (type) {
236
+ case 'date':
237
+ return this.getDateLabel(value);
238
+ case 'time':
239
+ return this.getTimeFromDate(value);
240
+ case 'localdatetime':
241
+ case 'datetime':
242
+ return this.getDateTimeFromDate(value);
243
+ case 'lookup':
244
+ return this.getLookupLabel(value, searchFields);
245
+ case 'enum':
246
+ return this.getEnumLabel(value, options);
247
+ case 'boolean':
248
+ return this.getBooleanLabel(value, translate);
249
+ default:
250
+ return value;
251
+ }
252
+ }
253
+ getDateLabel(value) {
254
+ const dateObj = value instanceof Date ? value : new Date(value);
255
+ return !isNaN(dateObj.getTime()) ? dateObj.toLocaleDateString('pt-BR') : value;
256
+ }
257
+ getLookupLabel(value, searchFields) {
258
+ return searchFields.map((field) => this.getUtilsProp(value, field.name)).join(' - ');
259
+ }
260
+ getEnumLabel(value, options) {
261
+ const option = options.find((opt) => opt.value === value);
262
+ return option ? option.label : value;
263
+ }
264
+ getBooleanLabel(value, translate) {
265
+ return value
266
+ ? translate.instant('tmsx_fnd.tmsx_angular_components.list_grid_boolean_true')
267
+ : translate.instant('tmsx_fnd.tmsx_angular_components.list_grid_boolean_false');
268
+ }
269
+ getTimeFromDate(value) {
270
+ let dateObj;
271
+ if (typeof value === 'string' && /^\d{2}:\d{2}(:\d{2})?$/.test(value)) {
272
+ const [h, m, s = '00'] = value.split(':');
273
+ dateObj = new Date();
274
+ dateObj.setHours(+h, +m, +s, 0);
275
+ }
276
+ else {
277
+ dateObj = value instanceof Date ? value : new Date(value);
278
+ }
279
+ if (!isNaN(dateObj.getTime())) {
280
+ return dateObj.toLocaleTimeString('pt-BR', {
281
+ hour: '2-digit',
282
+ minute: '2-digit',
283
+ second: '2-digit',
284
+ hour12: false
285
+ }); // HH:mm:ss
286
+ }
287
+ return value;
288
+ }
289
+ getDateTimeFromDate(value) {
290
+ const dateObj = value instanceof Date ? value : new Date(value);
291
+ if (!isNaN(dateObj.getTime())) {
292
+ const datePart = dateObj.toLocaleDateString('pt-BR'); // DD/MM/AAAA
293
+ const timePart = dateObj.toLocaleTimeString('pt-BR', {
294
+ hour: '2-digit',
295
+ minute: '2-digit',
296
+ second: '2-digit',
297
+ hour12: false
298
+ }); // HH:mm:ss
299
+ return `${datePart} ${timePart}`;
300
+ }
301
+ return value;
302
+ }
303
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: UtilsService, deps: [{ token: i1.TranslateService }, { token: i2.LocalizedDatePipe }], target: i0.ɵɵFactoryTarget.Injectable });
304
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: UtilsService, providedIn: 'root' });
305
+ }
306
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: UtilsService, decorators: [{
307
+ type: Injectable,
308
+ args: [{
309
+ providedIn: 'root'
310
+ }]
311
+ }], ctorParameters: () => [{ type: i1.TranslateService }, { type: i2.LocalizedDatePipe }] });
312
+
313
+ class GridEditableNestedComponent {
314
+ changeDetectorRef;
315
+ translate;
316
+ utils;
317
+ hotkeysService;
318
+ config;
319
+ nestedFunction;
320
+ openDetails = new EventEmitter();
321
+ paging = new EventEmitter();
322
+ delete = new EventEmitter();
323
+ save = new EventEmitter();
324
+ add = new EventEmitter();
325
+ table;
326
+ clonedData = {};
327
+ gridLoading = true;
328
+ editing = false;
329
+ lazy = true;
330
+ deleteEnabled = false;
331
+ editEnabled = false;
332
+ addEnabled = false;
333
+ detailsEnabled = false;
334
+ calendarTooltipText = '';
335
+ currentListParams = { page: 0, size: 5, sort: [] };
336
+ gridData = [];
337
+ gridColumns = [];
338
+ gridTotalRecords = 0;
339
+ selected = [];
340
+ nestedGridLoading = false;
341
+ frozenPosition = 'left';
342
+ frozenWidth = '200px';
343
+ frozenColumns = [];
344
+ ngUnsubscribe = new Subject();
345
+ constructor(changeDetectorRef, translate, utils, hotkeysService) {
346
+ this.changeDetectorRef = changeDetectorRef;
347
+ this.translate = translate;
348
+ this.utils = utils;
349
+ this.hotkeysService = hotkeysService;
350
+ this.calendarTooltipText = this.translate.instant('tmsx_fnd.tmsx_angular_components.grid_editable_nested_calendar_required');
351
+ }
352
+ ngOnInit() {
353
+ this.setGridData();
354
+ this.setHotkeys();
355
+ }
356
+ ngOnChanges(changes) {
357
+ if (changes.config) {
358
+ this.setGridData();
359
+ }
360
+ }
361
+ formatData(column, value) {
362
+ return value;
363
+ }
364
+ setGridData() {
365
+ if (!this.config) {
366
+ return;
367
+ }
368
+ const { data, size, columns, frozenPosition, frozenColumns, editing, lazy, deleteActionsEnabled, editEnabled, addEnabled, editActionsEnabled } = this.config;
369
+ this.gridData = data ?? [];
370
+ this.gridTotalRecords = size ?? 0;
371
+ this.gridColumns = columns ?? [];
372
+ this.frozenPosition = frozenPosition ?? 'left';
373
+ this.frozenColumns = frozenColumns ?? [];
374
+ this.frozenWidth = this.calculateFrozenWidth(this.frozenColumns);
375
+ this.editing = !!editing;
376
+ this.lazy = !!lazy;
377
+ this.deleteEnabled = !!deleteActionsEnabled;
378
+ this.editEnabled = !!editEnabled;
379
+ this.addEnabled = !!addEnabled;
380
+ this.detailsEnabled = !!editActionsEnabled;
381
+ this.changeDetectorRef.detectChanges();
382
+ this.nestedGridLoading = false;
383
+ this.gridLoading = false;
384
+ }
385
+ calculateFrozenWidth(frozenColumns) {
386
+ const gutter = 120;
387
+ if (!(frozenColumns?.length)) {
388
+ return '120px';
389
+ }
390
+ const totalWidth = frozenColumns.reduce((sum, col) => sum + gutter + (parseInt(col.width, 10) || 0), 0);
391
+ return `${totalWidth}px`;
392
+ }
393
+ getActions(data) {
394
+ return [
395
+ {
396
+ id: 'edit',
397
+ label: this.translate.instant('tmsx_fnd.tmsx_angular_components.edit'),
398
+ disabled: !this.detailsEnabled,
399
+ command: () => {
400
+ this.openRowDetails(data.id);
401
+ },
402
+ },
403
+ { separator: true },
404
+ {
405
+ id: 'delete',
406
+ label: this.translate.instant('tmsx_fnd.tmsx_angular_components.delete'),
407
+ disabled: !this.deleteEnabled,
408
+ command: () => {
409
+ this.onDelete(data.id);
410
+ },
411
+ },
412
+ ];
413
+ }
414
+ updateGridData(event) {
415
+ const size = event.rows ? event.rows : 10;
416
+ const page = event.first ? event.first / size : 0;
417
+ this.gridLoading = true;
418
+ if (this.clonedData && Object.keys(this.clonedData).length) {
419
+ this.clonedData = {};
420
+ this.table.editingRowKeys = {};
421
+ }
422
+ this.paging.emit({ page, size });
423
+ }
424
+ async updateNestedGridData(event, rowData) {
425
+ const size = event.rows ? event.rows : 10;
426
+ const page = event.first ? event.first / size : 0;
427
+ const sort = event.multiSortMeta || [];
428
+ rowData.nestedGridLoading = true;
429
+ await this.nestedFunction({ page, size, sort }, rowData);
430
+ }
431
+ onTab(event) {
432
+ if (event.key !== 'Tab') {
433
+ return;
434
+ }
435
+ event.preventDefault();
436
+ const focusables = Array.from(document.querySelectorAll('p-cellEditor input, p-cellEditor textarea, p-cellEditor [tabindex="0"]')).filter(el => el.offsetParent !== null);
437
+ const currentIndex = focusables.indexOf(event.target);
438
+ let next;
439
+ if (event.shiftKey) {
440
+ next = focusables[currentIndex - 1] || focusables[focusables.length - 1];
441
+ }
442
+ else {
443
+ next = focusables[currentIndex + 1] || focusables[0];
444
+ }
445
+ if (next) {
446
+ next.focus();
447
+ }
448
+ }
449
+ getRowIndex() {
450
+ const page = this.currentListParams.page || 0;
451
+ const size = this.currentListParams.size || 0;
452
+ return page * size;
453
+ }
454
+ getPageSize() {
455
+ return this.currentListParams.size ?? 0;
456
+ }
457
+ openRowDetails(id) {
458
+ this.openDetails.emit(id);
459
+ }
460
+ onDelete(id) {
461
+ this.delete.emit(id);
462
+ }
463
+ onAdd() {
464
+ this.add.emit();
465
+ }
466
+ ngOnDestroy() {
467
+ this.ngUnsubscribe.next();
468
+ this.ngUnsubscribe.complete();
469
+ }
470
+ onEditSave() {
471
+ this.saveAllRows();
472
+ }
473
+ onEditCancel() {
474
+ this.gridData.forEach((data) => {
475
+ if (this.clonedData[data.id]) {
476
+ const index = this.gridData.findIndex((row) => row.id === data.id);
477
+ this.gridData[index] = this.clonedData[data.id];
478
+ delete this.clonedData[data.id];
479
+ }
480
+ this.table.cancelRowEdit(data);
481
+ });
482
+ this.editing = false;
483
+ }
484
+ initAllRowsEdit() {
485
+ this.gridData.forEach((data) => {
486
+ this.editing = true;
487
+ this.table.initRowEdit(data);
488
+ this.clonedData[data.id] = { ...data };
489
+ });
490
+ }
491
+ saveAllRows() {
492
+ this.gridData.forEach((data) => {
493
+ if (this.clonedData[data.id]) {
494
+ delete this.clonedData[data.id];
495
+ }
496
+ this.table.cancelRowEdit(data);
497
+ });
498
+ this.editing = false;
499
+ this.save.emit(this.gridData);
500
+ }
501
+ formatRowData(field) {
502
+ return field;
503
+ }
504
+ filterOptions(event) {
505
+ return event;
506
+ }
507
+ getSpanProp(obj, path, type) {
508
+ type = type?.toLowerCase();
509
+ const value = this.utils.getProp(obj, path, type);
510
+ if (value === '<span>0</span>' && type === 'decimal') {
511
+ return '<span>0,00</span>';
512
+ }
513
+ if (!obj.tiposDados) {
514
+ return value;
515
+ }
516
+ if ('MONETARIO' === obj.tiposDados[path]) {
517
+ return 'R$ ' + value;
518
+ }
519
+ if ('PERCENTUAL' === obj.tiposDados[path]) {
520
+ return value + ' %';
521
+ }
522
+ return value;
523
+ }
524
+ setHotkeys() {
525
+ this.hotkeysService.add(new Hotkey('alt+shift+n', () => {
526
+ this.onAdd();
527
+ return false;
528
+ }, ['INPUT', 'SELECT', 'TEXTAREA']));
529
+ }
530
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: GridEditableNestedComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i1.TranslateService }, { token: UtilsService }, { token: i3.HotkeysService }], target: i0.ɵɵFactoryTarget.Component });
531
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: GridEditableNestedComponent, selector: "tmsx-grid-editable-nested", inputs: { config: "config", nestedFunction: "nestedFunction" }, outputs: { openDetails: "openDetails", paging: "paging", delete: "delete", save: "save", add: "add" }, viewQueries: [{ propertyName: "table", first: true, predicate: ["table"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div class=\"ui-g\">\n <div class=\"ui-g-12\">\n <s-button id=\"add-button\"\n data-cy=\"add-button\"\n priority=\"primary\" type=\"button\"\n [label]=\"'tmsx_fnd.tmsx_angular_components.add' | translate\"\n tooltip=\"{{'tmsx_fnd.tmsx_angular_components.add' | translate}} (Alt + Shift + N)\"\n [disabled]=\"!addEnabled\"\n (click)=\"onAdd()\">\n </s-button>\n @if (!editing) {\n <s-button\n priority=\"primary\"\n iconClass=\"fa fa-edit\"\n label=\"{{'tmsx_fnd.tmsx_angular_components.grid_editable_nested_editar' | translate}}\"\n tooltip=\"{{'tmsx_fnd.tmsx_angular_components.grid_editable_nested_editar' | translate}}\"\n [disabled]=\"!editEnabled\"\n (click)=\"initAllRowsEdit()\"\n ></s-button>\n }\n @if (editing) {\n <s-button\n priority=\"primary\"\n label=\"{{'tmsx_fnd.tmsx_angular_components.grid_editable_nested_salvar' | translate}}\"\n iconClass=\"fa fa-check\"\n [disabled]=\"false\"\n (click)=\"onEditSave()\"\n ></s-button>\n }\n @if (editing) {\n <s-button\n priority=\"default\"\n label=\"{{'tmsx_fnd.tmsx_angular_components.grid_editable_nested_cancelar' | translate}}\"\n iconClass=\"fa fa-times\"\n [disabled]=\"false\"\n (click)=\"onEditCancel()\"\n ></s-button>\n }\n <p-table\n selectionMode=\"single\"\n [(selection)]=\"selected\"\n [value]=\"gridData\"\n [columns]=\"gridColumns\"\n dataKey=\"id\"\n [rows]=\"10\"\n [rowsPerPageOptions]=\"[10, 20, 50, 100]\"\n [paginator]=\"true\"\n [totalRecords]=\"gridTotalRecords\"\n [lazy]=\"lazy\"\n (onLazyLoad)=\"updateGridData($event)\"\n *sLoadingState=\"gridLoading\"\n sortMode=\"multiple\"\n [scrollable]=\"true\"\n editMode=\"row\"\n #table\n >\n <ng-template pTemplate=\"frozenbody\" let-rowData let-expanded=\"expanded\">\n <tr [pSelectableRow]=\"rowData\">\n <td class=\"col50\" tabindex=\"0\" [sRowToggler]=\"rowData\"\n [attr.aria-label]=\"expanded\n ? ('tmsx_fnd.tmsx_angular_components.collapse_row' | translate)\n : ('tmsx_fnd.tmsx_angular_components.expand_row' | translate)\"\n (keydown.enter)=\"table.toggleRow(rowData, $event)\">\n <i class=\"fa fa-{{ expanded ? 'minus' : 'plus' }}\"\n aria-hidden=\"true\"></i>\n </td>\n @for (col of frozenColumns; track col) {\n <td class=\"colText\"\n tooltipPosition=\"top\" showDelay=\"500\"\n [innerHTML]=\"getSpanProp(rowData, col.field)\">\n </td>\n }\n <td class=\"frozenButton\">\n <s-button\n id=\"edit-button\"\n data-cy=\"edit-button\"\n priority=\"default\"\n type=\"button\"\n size=\"small\"\n [auxiliary]=\"true\"\n [disabled]=\"false\"\n [menuOptions]=\"getActions(rowData)\">\n </s-button>\n </td>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"colgroup\" let-columns>\n <colgroup>\n @for (col of columns; track col) {\n <col [style.width]=\"col.width\" />\n }\n </colgroup>\n </ng-template>\n\n <ng-template pTemplate=\"header\" let-columns>\n <tr>\n @for (col of columns; track col) {\n <th scope=\"col\">\n <div class=\"senior-header\">\n <span class=\"senior-header-title\">{{ col.header }}</span>\n </div>\n </th>\n }\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"body\" let-rowData let-expanded=\"expanded\" let-columns=\"columns\">\n <tr sNavigation tabindex=\"0\" [pEditableRow]=\"rowData\">\n @for (col of columns; track col) {\n <td\n [ngClass]=\"editing? 'editPadding': ''\"\n pResizableColumn\n [pTooltip]=\"rowData[col.field]\"\n tooltipPosition=\"top\"\n showDelay=\"500\"\n tabindex=\"0\"\n class=\"col80 colText\"\n >\n <p-cellEditor>\n <ng-template pTemplate=\"input\">\n <div class=\"ui-fluid\">\n @switch (col.type) {\n @case ('Text') {\n <span>{{ rowData[col.field] }}</span>\n }\n @case ('Date') {\n <p-datepicker\n [(ngModel)]=\"rowData[col.field]\"\n appendTo=\"body\"\n [showIcon]=\"true\"\n [required]=\"true\"\n [attr.aria-label]=\"col.header\"\n pTooltip=\"{{ calendarTooltipText }}\"\n tooltipPosition=\"bottom\"\n [tooltipDisabled]=\"rowData[col.field]\"\n ></p-datepicker>\n }\n @case ('Autocomplete') {\n <p-autoComplete\n [(ngModel)]=\"rowData[col.field]\"\n [suggestions]=\"col.options\"\n [attr.aria-label]=\"col.header\"\n appendTo=\"body\"\n (completeMethod)=\"filterOptions($event)\"\n [dropdown]=\"true\"\n [forceSelection]=\"true\"\n ></p-autoComplete>\n }\n @case ('Decimal') {\n <div class=\"ui-inputgroup\">\n @if ('MONETARIO' === rowData.tiposDados[col.field]) {\n <span class=\"ui-inputgroup-addon\"\n >R$</span>\n }\n <input sNumberInput [scale]=\"2\"\n alignTo=\"right\"\n thousandsSeparator=\".\"\n pInputText\n [attr.aria-label]=\"col.header\"\n [(ngModel)]=\"rowData[col.field]\"\n (keydown)=\"onTab($event)\"\n />\n @if ('PERCENTUAL' === rowData.tiposDados[col.field]) {\n <span class=\"ui-inputgroup-addon\"\n >%</span>\n }\n </div>\n }\n @default {\n <input pInputText type=\"text\"\n [(ngModel)]=\"rowData[col.field]\"\n [attr.aria-label]=\"col.header\"\n (keydown)=\"onTab($event)\"\n />\n }\n }\n </div>\n </ng-template>\n <ng-template pTemplate=\"output\">\n <div [innerHTML]=\"getSpanProp(rowData, col.field, col.type)\"></div>\n </ng-template>\n </p-cellEditor>\n </td>\n }\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"rowexpansion\" let-rowData>\n <tr class=\"sds-expanded-row\">\n <td [attr.colspan]=\"gridColumns.length + 1\">\n <p-table\n [value]=\"rowData.nestedGridData\"\n [columns]=\"rowData.nestedGridColumns\"\n dataKey=\"id\"\n [rows]=\"5\"\n [first]=\"getRowIndex()\"\n [rows]=\"getPageSize()\"\n [rowsPerPageOptions]=\"[5, 10, 20, 50]\"\n [paginator]=\"true\"\n [totalRecords]=\"rowData.nestedGridTotalRecords\"\n [responsive]=\"true\"\n [lazy]=\"true\"\n (onLazyLoad)=\"updateNestedGridData($event, rowData)\"\n sortMode=\"multiple\"\n *sLoadingState=\"rowData.nestedGridLoading\"\n >\n <ng-template pTemplate=\"header\" let-columns>\n <tr>\n @for (col of columns; track col) {\n <th scope=\"col\"\n [pSortableColumn]=\"col.field\">\n <div class=\"senior-header\">\n <span class=\"senior-header-title\">{{ col.header }}</span>\n <p-sortIcon [field]=\"col.field\"></p-sortIcon>\n </div>\n </th>\n }\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"body\" let-rowData let-columns=\"columns\">\n <tr [pSelectableRow]=\"rowData\">\n @for (col of columns; track col) {\n <td class=\"colText\">\n {{ formatData(col, rowData[col.field]) }}\n </td>\n }\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"paginatorright\">\n <span>\n {{ rowData.nestedGridTotalRecords }}\n {{'tmsx_fnd.tmsx_angular_components.grid_editable_nested_paging' | translate}}\n </span>\n </ng-template>\n </p-table>\n </td>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"paginatorright\">\n <span>\n {{ gridTotalRecords }}\n {{'tmsx_fnd.tmsx_angular_components.grid_editable_nested_paging' | translate}}\n </span>\n </ng-template>\n </p-table>\n </div>\n </div>\n", styles: [":host ::ng-deep div.contents{margin-top:15px}input{max-width:100%}.col50{width:50px}.col80{width:80px}.col200{width:200px}.colText{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.frozenButton{width:70px;padding:5px}.editPadding{padding-top:8px;padding-bottom:9px}\n"], dependencies: [{ kind: "directive", type: i6.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: i5.ButtonComponent, selector: "s-button", inputs: ["id", "label", "tooltip", "tooltipPosition", "iconClass", "rightIconClass", "caret", "styleClass", "baseZIndex", "disabled", "auxiliary", "type", "priority", "menuOptions", "size", "slide", "animation", "badge", "iconColor", "menuAriaLabel"], outputs: ["clicked"] }, { kind: "directive", type: i6$1.RowTogllerDirective, selector: "[sRowToggler]", inputs: ["sRowToggler"] }, { kind: "directive", type: i6$1.NavigationDirective, selector: "[sNavigation]" }, { kind: "directive", type: i7.LoadingStateDirective, selector: "[sLoadingState]", inputs: ["sLoadingState"] }, { kind: "directive", type: i8.NumberInputDirective, selector: "input[sNumberInput]" }, { kind: "directive", type: i4.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "component", type: i10.Table, selector: "p-table", inputs: ["frozenColumns", "frozenValue", "style", "styleClass", "tableStyle", "tableStyleClass", "paginator", "pageLinks", "rowsPerPageOptions", "alwaysShowPaginator", "paginatorPosition", "paginatorStyleClass", "paginatorDropdownAppendTo", "paginatorDropdownScrollHeight", "currentPageReportTemplate", "showCurrentPageReport", "showJumpToPageDropdown", "showJumpToPageInput", "showFirstLastIcon", "showPageLinks", "defaultSortOrder", "sortMode", "resetPageOnSort", "selectionMode", "selectionPageOnly", "contextMenuSelection", "contextMenuSelectionMode", "dataKey", "metaKeySelection", "rowSelectable", "rowTrackBy", "lazy", "lazyLoadOnInit", "compareSelectionBy", "csvSeparator", "exportFilename", "filters", "globalFilterFields", "filterDelay", "filterLocale", "expandedRowKeys", "editingRowKeys", "rowExpandMode", "scrollable", "scrollDirection", "rowGroupMode", "scrollHeight", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "virtualScrollDelay", "frozenWidth", "responsive", "contextMenu", "resizableColumns", "columnResizeMode", "reorderableColumns", "loading", "loadingIcon", "showLoader", "rowHover", "customSort", "showInitialSortBadge", "autoLayout", "exportFunction", "exportHeader", "stateKey", "stateStorage", "editMode", "groupRowsBy", "size", "showGridlines", "stripedRows", "groupRowsByOrder", "responsiveLayout", "breakpoint", "paginatorLocale", "value", "columns", "first", "rows", "totalRecords", "sortField", "sortOrder", "multiSortMeta", "selection", "virtualRowHeight", "selectAll"], outputs: ["contextMenuSelectionChange", "selectAllChange", "selectionChange", "onRowSelect", "onRowUnselect", "onPage", "onSort", "onFilter", "onLazyLoad", "onRowExpand", "onRowCollapse", "onContextMenuSelect", "onColResize", "onColReorder", "onRowReorder", "onEditInit", "onEditComplete", "onEditCancel", "onHeaderCheckboxToggle", "sortFunction", "firstChange", "rowsChange", "onStateSave", "onStateRestore"] }, { kind: "directive", type: i10.SortableColumn, selector: "[pSortableColumn]", inputs: ["pSortableColumn", "pSortableColumnDisabled"] }, { kind: "directive", type: i10.SelectableRow, selector: "[pSelectableRow]", inputs: ["pSelectableRow", "pSelectableRowIndex", "pSelectableRowDisabled"] }, { kind: "directive", type: i10.ResizableColumn, selector: "[pResizableColumn]", inputs: ["pResizableColumnDisabled"] }, { kind: "component", type: i10.CellEditor, selector: "p-cellEditor" }, { kind: "component", type: i10.SortIcon, selector: "p-sortIcon", inputs: ["field"] }, { kind: "directive", type: i10.EditableRow, selector: "[pEditableRow]", inputs: ["pEditableRow", "pEditableRowDisabled"] }, { kind: "directive", type: i11.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "autoHide", "fitContent", "hideOnEscape", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { kind: "directive", type: i12.InputText, selector: "[pInputText]", inputs: ["variant", "fluid", "pSize"] }, { kind: "component", type: i13.DatePicker, selector: "p-datePicker, p-datepicker, p-date-picker", inputs: ["iconDisplay", "style", "styleClass", "inputStyle", "inputId", "name", "inputStyleClass", "placeholder", "ariaLabelledBy", "ariaLabel", "iconAriaLabel", "disabled", "dateFormat", "multipleSeparator", "rangeSeparator", "inline", "showOtherMonths", "selectOtherMonths", "showIcon", "fluid", "icon", "appendTo", "readonlyInput", "shortYearCutoff", "monthNavigator", "yearNavigator", "hourFormat", "timeOnly", "stepHour", "stepMinute", "stepSecond", "showSeconds", "required", "showOnFocus", "showWeek", "startWeekFromFirstDayOfYear", "showClear", "dataType", "selectionMode", "maxDateCount", "showButtonBar", "todayButtonStyleClass", "clearButtonStyleClass", "autofocus", "autoZIndex", "baseZIndex", "panelStyleClass", "panelStyle", "keepInvalid", "hideOnDateTimeSelect", "touchUI", "timeSeparator", "focusTrap", "showTransitionOptions", "hideTransitionOptions", "tabindex", "variant", "size", "minDate", "maxDate", "disabledDates", "disabledDays", "yearRange", "showTime", "responsiveOptions", "numberOfMonths", "firstDayOfWeek", "locale", "view", "defaultDate"], outputs: ["onFocus", "onBlur", "onClose", "onSelect", "onClear", "onInput", "onTodayClick", "onClearClick", "onMonthChange", "onYearChange", "onClickOutside", "onShow"] }, { kind: "component", type: i14.AutoComplete, selector: "p-autoComplete, p-autocomplete, p-auto-complete", inputs: ["minLength", "delay", "style", "panelStyle", "styleClass", "panelStyleClass", "inputStyle", "inputId", "inputStyleClass", "placeholder", "readonly", "disabled", "scrollHeight", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "maxlength", "name", "required", "size", "appendTo", "autoHighlight", "forceSelection", "type", "autoZIndex", "baseZIndex", "ariaLabel", "dropdownAriaLabel", "ariaLabelledBy", "dropdownIcon", "unique", "group", "completeOnFocus", "showClear", "field", "dropdown", "showEmptyMessage", "dropdownMode", "multiple", "tabindex", "dataKey", "emptyMessage", "showTransitionOptions", "hideTransitionOptions", "autofocus", "autocomplete", "optionGroupChildren", "optionGroupLabel", "overlayOptions", "suggestions", "itemSize", "optionLabel", "optionValue", "id", "searchMessage", "emptySelectionMessage", "selectionMessage", "autoOptionFocus", "selectOnFocus", "searchLocale", "optionDisabled", "focusOnHover", "typeahead", "variant", "fluid"], outputs: ["completeMethod", "onSelect", "onUnselect", "onFocus", "onBlur", "onDropdownClick", "onClear", "onKeyUp", "onShow", "onHide", "onLazyLoad"] }, { kind: "directive", type: i15.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: i15.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i15.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i15.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "pipe", type: i1.TranslatePipe, name: "translate" }] });
532
+ }
533
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: GridEditableNestedComponent, decorators: [{
534
+ type: Component,
535
+ args: [{ selector: 'tmsx-grid-editable-nested', template: "<div class=\"ui-g\">\n <div class=\"ui-g-12\">\n <s-button id=\"add-button\"\n data-cy=\"add-button\"\n priority=\"primary\" type=\"button\"\n [label]=\"'tmsx_fnd.tmsx_angular_components.add' | translate\"\n tooltip=\"{{'tmsx_fnd.tmsx_angular_components.add' | translate}} (Alt + Shift + N)\"\n [disabled]=\"!addEnabled\"\n (click)=\"onAdd()\">\n </s-button>\n @if (!editing) {\n <s-button\n priority=\"primary\"\n iconClass=\"fa fa-edit\"\n label=\"{{'tmsx_fnd.tmsx_angular_components.grid_editable_nested_editar' | translate}}\"\n tooltip=\"{{'tmsx_fnd.tmsx_angular_components.grid_editable_nested_editar' | translate}}\"\n [disabled]=\"!editEnabled\"\n (click)=\"initAllRowsEdit()\"\n ></s-button>\n }\n @if (editing) {\n <s-button\n priority=\"primary\"\n label=\"{{'tmsx_fnd.tmsx_angular_components.grid_editable_nested_salvar' | translate}}\"\n iconClass=\"fa fa-check\"\n [disabled]=\"false\"\n (click)=\"onEditSave()\"\n ></s-button>\n }\n @if (editing) {\n <s-button\n priority=\"default\"\n label=\"{{'tmsx_fnd.tmsx_angular_components.grid_editable_nested_cancelar' | translate}}\"\n iconClass=\"fa fa-times\"\n [disabled]=\"false\"\n (click)=\"onEditCancel()\"\n ></s-button>\n }\n <p-table\n selectionMode=\"single\"\n [(selection)]=\"selected\"\n [value]=\"gridData\"\n [columns]=\"gridColumns\"\n dataKey=\"id\"\n [rows]=\"10\"\n [rowsPerPageOptions]=\"[10, 20, 50, 100]\"\n [paginator]=\"true\"\n [totalRecords]=\"gridTotalRecords\"\n [lazy]=\"lazy\"\n (onLazyLoad)=\"updateGridData($event)\"\n *sLoadingState=\"gridLoading\"\n sortMode=\"multiple\"\n [scrollable]=\"true\"\n editMode=\"row\"\n #table\n >\n <ng-template pTemplate=\"frozenbody\" let-rowData let-expanded=\"expanded\">\n <tr [pSelectableRow]=\"rowData\">\n <td class=\"col50\" tabindex=\"0\" [sRowToggler]=\"rowData\"\n [attr.aria-label]=\"expanded\n ? ('tmsx_fnd.tmsx_angular_components.collapse_row' | translate)\n : ('tmsx_fnd.tmsx_angular_components.expand_row' | translate)\"\n (keydown.enter)=\"table.toggleRow(rowData, $event)\">\n <i class=\"fa fa-{{ expanded ? 'minus' : 'plus' }}\"\n aria-hidden=\"true\"></i>\n </td>\n @for (col of frozenColumns; track col) {\n <td class=\"colText\"\n tooltipPosition=\"top\" showDelay=\"500\"\n [innerHTML]=\"getSpanProp(rowData, col.field)\">\n </td>\n }\n <td class=\"frozenButton\">\n <s-button\n id=\"edit-button\"\n data-cy=\"edit-button\"\n priority=\"default\"\n type=\"button\"\n size=\"small\"\n [auxiliary]=\"true\"\n [disabled]=\"false\"\n [menuOptions]=\"getActions(rowData)\">\n </s-button>\n </td>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"colgroup\" let-columns>\n <colgroup>\n @for (col of columns; track col) {\n <col [style.width]=\"col.width\" />\n }\n </colgroup>\n </ng-template>\n\n <ng-template pTemplate=\"header\" let-columns>\n <tr>\n @for (col of columns; track col) {\n <th scope=\"col\">\n <div class=\"senior-header\">\n <span class=\"senior-header-title\">{{ col.header }}</span>\n </div>\n </th>\n }\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"body\" let-rowData let-expanded=\"expanded\" let-columns=\"columns\">\n <tr sNavigation tabindex=\"0\" [pEditableRow]=\"rowData\">\n @for (col of columns; track col) {\n <td\n [ngClass]=\"editing? 'editPadding': ''\"\n pResizableColumn\n [pTooltip]=\"rowData[col.field]\"\n tooltipPosition=\"top\"\n showDelay=\"500\"\n tabindex=\"0\"\n class=\"col80 colText\"\n >\n <p-cellEditor>\n <ng-template pTemplate=\"input\">\n <div class=\"ui-fluid\">\n @switch (col.type) {\n @case ('Text') {\n <span>{{ rowData[col.field] }}</span>\n }\n @case ('Date') {\n <p-datepicker\n [(ngModel)]=\"rowData[col.field]\"\n appendTo=\"body\"\n [showIcon]=\"true\"\n [required]=\"true\"\n [attr.aria-label]=\"col.header\"\n pTooltip=\"{{ calendarTooltipText }}\"\n tooltipPosition=\"bottom\"\n [tooltipDisabled]=\"rowData[col.field]\"\n ></p-datepicker>\n }\n @case ('Autocomplete') {\n <p-autoComplete\n [(ngModel)]=\"rowData[col.field]\"\n [suggestions]=\"col.options\"\n [attr.aria-label]=\"col.header\"\n appendTo=\"body\"\n (completeMethod)=\"filterOptions($event)\"\n [dropdown]=\"true\"\n [forceSelection]=\"true\"\n ></p-autoComplete>\n }\n @case ('Decimal') {\n <div class=\"ui-inputgroup\">\n @if ('MONETARIO' === rowData.tiposDados[col.field]) {\n <span class=\"ui-inputgroup-addon\"\n >R$</span>\n }\n <input sNumberInput [scale]=\"2\"\n alignTo=\"right\"\n thousandsSeparator=\".\"\n pInputText\n [attr.aria-label]=\"col.header\"\n [(ngModel)]=\"rowData[col.field]\"\n (keydown)=\"onTab($event)\"\n />\n @if ('PERCENTUAL' === rowData.tiposDados[col.field]) {\n <span class=\"ui-inputgroup-addon\"\n >%</span>\n }\n </div>\n }\n @default {\n <input pInputText type=\"text\"\n [(ngModel)]=\"rowData[col.field]\"\n [attr.aria-label]=\"col.header\"\n (keydown)=\"onTab($event)\"\n />\n }\n }\n </div>\n </ng-template>\n <ng-template pTemplate=\"output\">\n <div [innerHTML]=\"getSpanProp(rowData, col.field, col.type)\"></div>\n </ng-template>\n </p-cellEditor>\n </td>\n }\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"rowexpansion\" let-rowData>\n <tr class=\"sds-expanded-row\">\n <td [attr.colspan]=\"gridColumns.length + 1\">\n <p-table\n [value]=\"rowData.nestedGridData\"\n [columns]=\"rowData.nestedGridColumns\"\n dataKey=\"id\"\n [rows]=\"5\"\n [first]=\"getRowIndex()\"\n [rows]=\"getPageSize()\"\n [rowsPerPageOptions]=\"[5, 10, 20, 50]\"\n [paginator]=\"true\"\n [totalRecords]=\"rowData.nestedGridTotalRecords\"\n [responsive]=\"true\"\n [lazy]=\"true\"\n (onLazyLoad)=\"updateNestedGridData($event, rowData)\"\n sortMode=\"multiple\"\n *sLoadingState=\"rowData.nestedGridLoading\"\n >\n <ng-template pTemplate=\"header\" let-columns>\n <tr>\n @for (col of columns; track col) {\n <th scope=\"col\"\n [pSortableColumn]=\"col.field\">\n <div class=\"senior-header\">\n <span class=\"senior-header-title\">{{ col.header }}</span>\n <p-sortIcon [field]=\"col.field\"></p-sortIcon>\n </div>\n </th>\n }\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"body\" let-rowData let-columns=\"columns\">\n <tr [pSelectableRow]=\"rowData\">\n @for (col of columns; track col) {\n <td class=\"colText\">\n {{ formatData(col, rowData[col.field]) }}\n </td>\n }\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"paginatorright\">\n <span>\n {{ rowData.nestedGridTotalRecords }}\n {{'tmsx_fnd.tmsx_angular_components.grid_editable_nested_paging' | translate}}\n </span>\n </ng-template>\n </p-table>\n </td>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"paginatorright\">\n <span>\n {{ gridTotalRecords }}\n {{'tmsx_fnd.tmsx_angular_components.grid_editable_nested_paging' | translate}}\n </span>\n </ng-template>\n </p-table>\n </div>\n </div>\n", styles: [":host ::ng-deep div.contents{margin-top:15px}input{max-width:100%}.col50{width:50px}.col80{width:80px}.col200{width:200px}.colText{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.frozenButton{width:70px;padding:5px}.editPadding{padding-top:8px;padding-bottom:9px}\n"] }]
536
+ }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: i1.TranslateService }, { type: UtilsService }, { type: i3.HotkeysService }], propDecorators: { config: [{
537
+ type: Input
538
+ }], nestedFunction: [{
539
+ type: Input
540
+ }], openDetails: [{
541
+ type: Output
542
+ }], paging: [{
543
+ type: Output
544
+ }], delete: [{
545
+ type: Output
546
+ }], save: [{
547
+ type: Output
548
+ }], add: [{
549
+ type: Output
550
+ }], table: [{
551
+ type: ViewChild,
552
+ args: ["table", { static: false }]
553
+ }] } });
554
+
555
+ class GridEditableNestedModule {
556
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: GridEditableNestedModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
557
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: GridEditableNestedModule, declarations: [GridEditableNestedComponent], imports: [CommonModule, i2.LocaleModule, i1.TranslateModule, ButtonModule,
558
+ TableModule,
559
+ TooltipModule,
560
+ LoadingStateModule,
561
+ NumberInputModule,
562
+ BreadcrumbModule,
563
+ ControlErrorsModule,
564
+ CustomFieldsModule,
565
+ DynamicFormModule,
566
+ EmptyStateModule,
567
+ TokenListModule,
568
+ // PrimeNG modules
569
+ ToastModule,
570
+ TableModule$1,
571
+ TooltipModule$1,
572
+ PanelModule,
573
+ InputTextModule,
574
+ ConfirmDialogModule,
575
+ DatePickerModule,
576
+ DropdownModule,
577
+ SharedModule,
578
+ AutoCompleteModule,
579
+ CheckboxModule,
580
+ // Angular modules
581
+ FormsModule,
582
+ ReactiveFormsModule], exports: [GridEditableNestedComponent] });
583
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: GridEditableNestedModule, imports: [CommonModule,
584
+ LocaleModule.forChild(),
585
+ TranslateModule.forChild(),
586
+ ButtonModule,
587
+ TableModule,
588
+ TooltipModule,
589
+ LoadingStateModule,
590
+ NumberInputModule,
591
+ BreadcrumbModule,
592
+ ControlErrorsModule,
593
+ CustomFieldsModule,
594
+ DynamicFormModule,
595
+ EmptyStateModule,
596
+ TokenListModule,
597
+ // PrimeNG modules
598
+ ToastModule,
599
+ TableModule$1,
600
+ TooltipModule$1,
601
+ PanelModule,
602
+ InputTextModule,
603
+ ConfirmDialogModule,
604
+ DatePickerModule,
605
+ DropdownModule,
606
+ SharedModule,
607
+ AutoCompleteModule,
608
+ CheckboxModule,
609
+ // Angular modules
610
+ FormsModule,
611
+ ReactiveFormsModule] });
612
+ }
613
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: GridEditableNestedModule, decorators: [{
614
+ type: NgModule,
615
+ args: [{
616
+ imports: [
617
+ CommonModule,
618
+ LocaleModule.forChild(),
619
+ TranslateModule.forChild(),
620
+ ButtonModule,
621
+ TableModule,
622
+ TooltipModule,
623
+ LoadingStateModule,
624
+ NumberInputModule,
625
+ BreadcrumbModule,
626
+ ControlErrorsModule,
627
+ CustomFieldsModule,
628
+ DynamicFormModule,
629
+ EmptyStateModule,
630
+ TokenListModule,
631
+ // PrimeNG modules
632
+ ToastModule,
633
+ TableModule$1,
634
+ TooltipModule$1,
635
+ PanelModule,
636
+ InputTextModule,
637
+ ConfirmDialogModule,
638
+ DatePickerModule,
639
+ DropdownModule,
640
+ SharedModule,
641
+ AutoCompleteModule,
642
+ CheckboxModule,
643
+ // Angular modules
644
+ FormsModule,
645
+ ReactiveFormsModule
646
+ ],
647
+ declarations: [
648
+ GridEditableNestedComponent,
649
+ ],
650
+ providers: [],
651
+ exports: [
652
+ GridEditableNestedComponent,
653
+ ],
654
+ }]
655
+ }] });
656
+
657
+ var EnumProcessamentoStatus;
658
+ (function (EnumProcessamentoStatus) {
659
+ EnumProcessamentoStatus["SUCCESS"] = "SUCCESS";
660
+ EnumProcessamentoStatus["FAILED"] = "FAILED";
661
+ EnumProcessamentoStatus["PENDING"] = "PENDING";
662
+ EnumProcessamentoStatus["PROCESSING"] = "PROCESSING";
663
+ })(EnumProcessamentoStatus || (EnumProcessamentoStatus = {}));
664
+ const ENUM_PROCESSAMENTO_STATUS_TRANSLATION_MAP = {
665
+ [EnumProcessamentoStatus.SUCCESS]: 'tmsx_fnd.tmsx_angular_components.painel_processamento_status_success',
666
+ [EnumProcessamentoStatus.FAILED]: 'tmsx_fnd.tmsx_angular_components.painel_processamento_status_failed',
667
+ [EnumProcessamentoStatus.PENDING]: 'tmsx_fnd.tmsx_angular_components.painel_processamento_status_pending',
668
+ [EnumProcessamentoStatus.PROCESSING]: 'tmsx_fnd.tmsx_angular_components.painel_processamento_status_processing'
669
+ };
670
+
671
+ class PainelProcessamentoComponent {
672
+ translate;
673
+ static GENERIC_ERR_KEY = 'tmsx_fnd.tmsx_angular_components.painel_processamento_generic_error';
674
+ params;
675
+ processado = new EventEmitter();
676
+ concluido = new EventEmitter();
677
+ gridData;
678
+ gridColumns;
679
+ totalRecords = 0;
680
+ successCount = 0;
681
+ failedCount = 0;
682
+ pendingCount = 0;
683
+ successProgress = '0%';
684
+ failedProgress = '0%';
685
+ pendingProgress = '100%';
686
+ processingProgress = '0%';
687
+ sortField = 'status';
688
+ sortOrder = 1;
689
+ constructor(translate) {
690
+ this.translate = translate;
691
+ }
692
+ ngOnInit() {
693
+ this.initPanel();
694
+ }
695
+ initPanel() {
696
+ this.gridColumns = this.getGridColumn();
697
+ this.initGrid();
698
+ this.initProgressBar();
699
+ }
700
+ initProgressBar() {
701
+ this.successProgress = '0%';
702
+ this.failedProgress = '0%';
703
+ this.pendingProgress = '100%';
704
+ this.processingProgress = '0%';
705
+ this.totalRecords = this.params.registros.length;
706
+ this.pendingCount = this.totalRecords;
707
+ if (this.params.quantidadeChamadasSimultaneas > 1) {
708
+ this.processAllRecordsWithPLimit();
709
+ }
710
+ else {
711
+ this.syncProcessRecord(0);
712
+ }
713
+ }
714
+ initGrid() {
715
+ this.gridData = [];
716
+ this.gridData = this.params.registros.map(registro => ({
717
+ registro,
718
+ status: EnumProcessamentoStatus.PENDING,
719
+ label: registro.descricao
720
+ }));
721
+ }
722
+ getErrorMessage(error) {
723
+ try {
724
+ if (!error) {
725
+ return this.genericErrorMsg;
726
+ }
727
+ if (error?.error?.message) {
728
+ return String(error.error.message);
729
+ }
730
+ if (error?.message?.message) {
731
+ return String(error.message.message);
732
+ }
733
+ return this.genericErrorMsg;
734
+ }
735
+ catch {
736
+ return this.genericErrorMsg;
737
+ }
738
+ }
739
+ get genericErrorMsg() {
740
+ return this.translate.instant(PainelProcessamentoComponent.GENERIC_ERR_KEY);
741
+ }
742
+ updateRowSuccess(row) {
743
+ this.successCount++;
744
+ this.pendingCount--;
745
+ this.updateRowStatus(row, EnumProcessamentoStatus.SUCCESS);
746
+ this.processado.emit(row);
747
+ this.updateProgressBar();
748
+ }
749
+ updateRowError(row, index, message) {
750
+ this.failedCount++;
751
+ this.pendingCount--;
752
+ this.updateRowStatus(row, EnumProcessamentoStatus.FAILED, message);
753
+ this.processado.emit(row);
754
+ this.updateProgressBar();
755
+ }
756
+ syncProcessRecord(index) {
757
+ if (this.pendingCount < 1) {
758
+ this.concluido.emit('ok');
759
+ return;
760
+ }
761
+ this.updateRowStatus(this.gridData[index], EnumProcessamentoStatus.PROCESSING);
762
+ const record = this.params.registros[index];
763
+ const row = this.gridData.find(item => item.registro === record);
764
+ if (record.apiEnvio) {
765
+ record.apiEnvio(record.objEnvio)
766
+ .subscribe(() => {
767
+ this.updateRowSuccess(row);
768
+ this.syncProcessRecord(index + 1);
769
+ }, (error) => {
770
+ this.updateRowError(row, index, this.getErrorMessage(error));
771
+ this.syncProcessRecord(index + 1);
772
+ });
773
+ }
774
+ else {
775
+ this.failedCount = this.pendingCount;
776
+ this.pendingCount = 0;
777
+ this.updateRowStatus(row, EnumProcessamentoStatus.FAILED, this.translate.instant('tmsx_fnd.tmsx_angular_components.painel_processamento_api_error'));
778
+ this.updateProgressBar();
779
+ this.concluido.emit('erro');
780
+ }
781
+ }
782
+ async processAllRecordsWithPLimit() {
783
+ const pLimitModule = await import('p-limit');
784
+ const pLimit = pLimitModule.default ?? pLimitModule;
785
+ const limit = pLimit(this.params.quantidadeChamadasSimultaneas);
786
+ const promises = this.params.registros.map((record, index) => limit(async () => {
787
+ const row = this.gridData.find(item => item.registro === record);
788
+ this.updateRowStatus(row, EnumProcessamentoStatus.PROCESSING);
789
+ try {
790
+ const result = await record.apiEnvio(record.objEnvio).toPromise();
791
+ this.updateRowSuccess(row);
792
+ return { success: true, record, result };
793
+ }
794
+ catch (error) {
795
+ this.updateRowError(row, index, this.getErrorMessage(error));
796
+ return { success: false, record, error };
797
+ }
798
+ }));
799
+ const results = await Promise.all(promises);
800
+ this.concluido.emit(results);
801
+ return results;
802
+ }
803
+ updateProgressBar() {
804
+ const successWidth = (this.successCount / this.totalRecords) * 100;
805
+ const failedWidth = (this.failedCount / this.totalRecords) * 100;
806
+ const pendingWidth = (this.pendingCount / this.totalRecords) * 100;
807
+ const processedWidth = successWidth + failedWidth;
808
+ this.processingProgress = `${processedWidth.toFixed(0)}%`;
809
+ this.successProgress = `${successWidth.toFixed(0)}%`;
810
+ this.failedProgress = `${failedWidth.toFixed(0)}%`;
811
+ this.pendingProgress = `${pendingWidth.toFixed(0)}%`;
812
+ }
813
+ updateRowStatus(row, status, message) {
814
+ row.status = status;
815
+ if (message) {
816
+ row.message = message;
817
+ }
818
+ this.sortGridData();
819
+ }
820
+ sortGridData() {
821
+ this.gridData.sort((a, b) => {
822
+ const statusOrder = {
823
+ [EnumProcessamentoStatus.FAILED]: 1,
824
+ [EnumProcessamentoStatus.PROCESSING]: 2,
825
+ [EnumProcessamentoStatus.SUCCESS]: 3,
826
+ [EnumProcessamentoStatus.PENDING]: 4
827
+ };
828
+ if (this.sortField === 'status') {
829
+ return (statusOrder[a.status] - statusOrder[b.status]) * this.sortOrder;
830
+ }
831
+ else {
832
+ const valA = a[this.sortField] || '';
833
+ const valB = b[this.sortField] || '';
834
+ return valA.localeCompare(valB) * this.sortOrder;
835
+ }
836
+ });
837
+ }
838
+ getData(rowData, field) {
839
+ if (field === 'status') {
840
+ let text = this.translate.instant(ENUM_PROCESSAMENTO_STATUS_TRANSLATION_MAP[rowData.status]);
841
+ if (rowData.message) {
842
+ text += `: ${rowData.message}`;
843
+ }
844
+ return text;
845
+ }
846
+ return rowData[field];
847
+ }
848
+ getClassStatus(rowData, field) {
849
+ if (field !== 'status') {
850
+ return '';
851
+ }
852
+ return `status ${rowData[field].toLowerCase()}`;
853
+ }
854
+ getGridColumn() {
855
+ return [
856
+ {
857
+ field: 'label',
858
+ header: this.translate.instant('tmsx_fnd.tmsx_angular_components.registro'),
859
+ style: { width: '50%' },
860
+ attributes: [],
861
+ type: EnumColumnFieldType.STRING
862
+ },
863
+ {
864
+ field: 'status',
865
+ header: this.translate.instant('tmsx_fnd.tmsx_angular_components.status'),
866
+ style: { width: '50%' },
867
+ attributes: [],
868
+ type: EnumColumnFieldType.STRING
869
+ },
870
+ ];
871
+ }
872
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: PainelProcessamentoComponent, deps: [{ token: i1.TranslateService }], target: i0.ɵɵFactoryTarget.Component });
873
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: PainelProcessamentoComponent, selector: "tmsx-painel-processamento", inputs: { params: "params" }, outputs: { processado: "processado", concluido: "concluido" }, ngImport: i0, template: "<p-panel>\n <p-header>{{ this.params.titulo }} ({{processingProgress }})</p-header>\n\n <div class=\"progressbar\"\n [attr.aria-label]=\"'tmsx_fnd.tmsx_angular_components.progress' | translate\">\n <div class=\"success\"\n [ngClass]=\"successProgress === '0%' ? '' : 'visible'\"\n [ngStyle]=\"{'width': successProgress }\"\n [sTooltip]=\"successProgress\"\n [escape]=\"false\"\n mobileBehavior=\"tap\"></div>\n <div class=\"failed\"\n [ngClass]=\"failedProgress === '0%' ? '' : 'visible'\"\n [ngStyle]=\"{'width': failedProgress }\"\n [sTooltip]=\"failedProgress\"\n [escape]=\"false\"\n mobileBehavior=\"tap\"></div>\n <div class=\"pending\"\n [ngClass]=\"pendingProgress === '0%' ? '' : 'visible'\"\n [ngStyle]=\"{'width': pendingProgress }\"\n [sTooltip]=\"pendingProgress\"\n [escape]=\"false\"\n mobileBehavior=\"tap\"></div>\n </div>\n\n <p-table\n #myTable\n [value]=\"gridData\"\n [columns]=\"gridColumns\"\n dataKey=\"id\"\n [resizableColumns]=\"true\"\n sortMode=\"multiple\"\n [scrollable]=\"true\"\n [paginator]=\"true\"\n [rows]=\"10\"\n showInitialSortBadge=\"true\"\n [rowsPerPageOptions]=\"[10, 20, 50, 100]\"\n [sortField]=\"sortField\"\n [sortOrder]=\"sortOrder\">\n\n <ng-template pTemplate=\"colgroup\" let-columns>\n <colgroup>\n @for (col of columns; track col) {\n <col [ngStyle]=\"col.style\">\n }\n </colgroup>\n </ng-template>\n\n <ng-template pTemplate=\"header\" let-columns>\n <tr>\n @for (col of columns; track col) {\n <th scope=\"col\"\n [pSortableColumn]=\"col.field\"\n [pSortableColumnDisabled]=\"col.disableColumnSort\"\n [ngStyle]=\"col.style\"\n pResizableColumn>\n <div class=\"senior-header\">\n <span class=\"senior-header-title\">{{col.header}}</span>\n @if (!col.disableColumnSort) {\n <p-sortIcon [field]=\"col.field\"></p-sortIcon>\n }\n </div>\n </th>\n }\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"body\" let-rowData let-columns=\"columns\">\n <tr>\n @for (col of columns; track col) {\n <td [ngClass]=\"getClassStatus(rowData, col.field)\">\n {{ getData(rowData, col.field) }}\n </td>\n }\n </tr>\n\n </ng-template>\n\n <ng-template pTemplate=\"paginatorright\">\n <s-table-paging\n [table]=\"myTable\"\n [totalRecords]=\"gridData.length\"\n [exportable]=\"false\"\n >\n </s-table-paging>\n </ng-template>\n</p-table>\n</p-panel>\n", styles: [".progressbar{margin-bottom:30px;border-radius:20px;height:40px}.progressbar .visible:nth-child(1 of.visible){border-top-left-radius:20px;border-bottom-left-radius:20px}.progressbar .visible:nth-last-child(1 of.visible){border-top-right-radius:20px;border-bottom-right-radius:20px}.progressbar .success,.progressbar .pending,.progressbar .failed{display:inline-block;height:100%;width:0%}.progressbar .success{background-color:#4caf50}.progressbar .failed{background-color:#f44336}.progressbar .pending{background-color:#ccc}.status.success{color:#007504}.status.pending{color:#333}.status.failed{color:#8d0900}.status.processing{color:#b96f00}\n"], dependencies: [{ kind: "directive", type: i2$1.TooltipDirective, selector: "[sTooltip]", inputs: ["sTooltip", "tooltipPosition", "showDelay", "displayTime", "tooltipEvent", "escape", "visible", "mobileBehavior", "focusedInputRef", "checkTruncatedText"] }, { kind: "component", type: i10.Table, selector: "p-table", inputs: ["frozenColumns", "frozenValue", "style", "styleClass", "tableStyle", "tableStyleClass", "paginator", "pageLinks", "rowsPerPageOptions", "alwaysShowPaginator", "paginatorPosition", "paginatorStyleClass", "paginatorDropdownAppendTo", "paginatorDropdownScrollHeight", "currentPageReportTemplate", "showCurrentPageReport", "showJumpToPageDropdown", "showJumpToPageInput", "showFirstLastIcon", "showPageLinks", "defaultSortOrder", "sortMode", "resetPageOnSort", "selectionMode", "selectionPageOnly", "contextMenuSelection", "contextMenuSelectionMode", "dataKey", "metaKeySelection", "rowSelectable", "rowTrackBy", "lazy", "lazyLoadOnInit", "compareSelectionBy", "csvSeparator", "exportFilename", "filters", "globalFilterFields", "filterDelay", "filterLocale", "expandedRowKeys", "editingRowKeys", "rowExpandMode", "scrollable", "scrollDirection", "rowGroupMode", "scrollHeight", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "virtualScrollDelay", "frozenWidth", "responsive", "contextMenu", "resizableColumns", "columnResizeMode", "reorderableColumns", "loading", "loadingIcon", "showLoader", "rowHover", "customSort", "showInitialSortBadge", "autoLayout", "exportFunction", "exportHeader", "stateKey", "stateStorage", "editMode", "groupRowsBy", "size", "showGridlines", "stripedRows", "groupRowsByOrder", "responsiveLayout", "breakpoint", "paginatorLocale", "value", "columns", "first", "rows", "totalRecords", "sortField", "sortOrder", "multiSortMeta", "selection", "virtualRowHeight", "selectAll"], outputs: ["contextMenuSelectionChange", "selectAllChange", "selectionChange", "onRowSelect", "onRowUnselect", "onPage", "onSort", "onFilter", "onLazyLoad", "onRowExpand", "onRowCollapse", "onContextMenuSelect", "onColResize", "onColReorder", "onRowReorder", "onEditInit", "onEditComplete", "onEditCancel", "onHeaderCheckboxToggle", "sortFunction", "firstChange", "rowsChange", "onStateSave", "onStateRestore"] }, { kind: "component", type: i4.Header, selector: "p-header" }, { kind: "directive", type: i4.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "directive", type: i10.SortableColumn, selector: "[pSortableColumn]", inputs: ["pSortableColumn", "pSortableColumnDisabled"] }, { kind: "directive", type: i10.ResizableColumn, selector: "[pResizableColumn]", inputs: ["pResizableColumnDisabled"] }, { kind: "component", type: i10.SortIcon, selector: "p-sortIcon", inputs: ["field"] }, { kind: "component", type: i6$1.TablePagingComponent, selector: "s-table-paging", inputs: ["totalRecords", "exportFileName", "table", "exportable", "enableExportSelectedRecords", "customActions", "loadAllRecords", "loadCurrentPageRecords", "loadSelectedRecords"] }, { kind: "directive", type: i6.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i6.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: i7$1.Panel, selector: "p-panel", inputs: ["toggleable", "header", "collapsed", "style", "styleClass", "iconPos", "expandIcon", "collapseIcon", "showHeader", "toggler", "transitionOptions", "toggleButtonProps"], outputs: ["collapsedChange", "onBeforeToggle", "onAfterToggle"] }, { kind: "pipe", type: i1.TranslatePipe, name: "translate" }] });
874
+ }
875
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: PainelProcessamentoComponent, decorators: [{
876
+ type: Component,
877
+ args: [{ selector: 'tmsx-painel-processamento', template: "<p-panel>\n <p-header>{{ this.params.titulo }} ({{processingProgress }})</p-header>\n\n <div class=\"progressbar\"\n [attr.aria-label]=\"'tmsx_fnd.tmsx_angular_components.progress' | translate\">\n <div class=\"success\"\n [ngClass]=\"successProgress === '0%' ? '' : 'visible'\"\n [ngStyle]=\"{'width': successProgress }\"\n [sTooltip]=\"successProgress\"\n [escape]=\"false\"\n mobileBehavior=\"tap\"></div>\n <div class=\"failed\"\n [ngClass]=\"failedProgress === '0%' ? '' : 'visible'\"\n [ngStyle]=\"{'width': failedProgress }\"\n [sTooltip]=\"failedProgress\"\n [escape]=\"false\"\n mobileBehavior=\"tap\"></div>\n <div class=\"pending\"\n [ngClass]=\"pendingProgress === '0%' ? '' : 'visible'\"\n [ngStyle]=\"{'width': pendingProgress }\"\n [sTooltip]=\"pendingProgress\"\n [escape]=\"false\"\n mobileBehavior=\"tap\"></div>\n </div>\n\n <p-table\n #myTable\n [value]=\"gridData\"\n [columns]=\"gridColumns\"\n dataKey=\"id\"\n [resizableColumns]=\"true\"\n sortMode=\"multiple\"\n [scrollable]=\"true\"\n [paginator]=\"true\"\n [rows]=\"10\"\n showInitialSortBadge=\"true\"\n [rowsPerPageOptions]=\"[10, 20, 50, 100]\"\n [sortField]=\"sortField\"\n [sortOrder]=\"sortOrder\">\n\n <ng-template pTemplate=\"colgroup\" let-columns>\n <colgroup>\n @for (col of columns; track col) {\n <col [ngStyle]=\"col.style\">\n }\n </colgroup>\n </ng-template>\n\n <ng-template pTemplate=\"header\" let-columns>\n <tr>\n @for (col of columns; track col) {\n <th scope=\"col\"\n [pSortableColumn]=\"col.field\"\n [pSortableColumnDisabled]=\"col.disableColumnSort\"\n [ngStyle]=\"col.style\"\n pResizableColumn>\n <div class=\"senior-header\">\n <span class=\"senior-header-title\">{{col.header}}</span>\n @if (!col.disableColumnSort) {\n <p-sortIcon [field]=\"col.field\"></p-sortIcon>\n }\n </div>\n </th>\n }\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"body\" let-rowData let-columns=\"columns\">\n <tr>\n @for (col of columns; track col) {\n <td [ngClass]=\"getClassStatus(rowData, col.field)\">\n {{ getData(rowData, col.field) }}\n </td>\n }\n </tr>\n\n </ng-template>\n\n <ng-template pTemplate=\"paginatorright\">\n <s-table-paging\n [table]=\"myTable\"\n [totalRecords]=\"gridData.length\"\n [exportable]=\"false\"\n >\n </s-table-paging>\n </ng-template>\n</p-table>\n</p-panel>\n", styles: [".progressbar{margin-bottom:30px;border-radius:20px;height:40px}.progressbar .visible:nth-child(1 of.visible){border-top-left-radius:20px;border-bottom-left-radius:20px}.progressbar .visible:nth-last-child(1 of.visible){border-top-right-radius:20px;border-bottom-right-radius:20px}.progressbar .success,.progressbar .pending,.progressbar .failed{display:inline-block;height:100%;width:0%}.progressbar .success{background-color:#4caf50}.progressbar .failed{background-color:#f44336}.progressbar .pending{background-color:#ccc}.status.success{color:#007504}.status.pending{color:#333}.status.failed{color:#8d0900}.status.processing{color:#b96f00}\n"] }]
878
+ }], ctorParameters: () => [{ type: i1.TranslateService }], propDecorators: { params: [{
879
+ type: Input
880
+ }], processado: [{
881
+ type: Output
882
+ }], concluido: [{
883
+ type: Output
884
+ }] } });
885
+
886
+ class PainelProcessamentoModule {
887
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: PainelProcessamentoModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
888
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: PainelProcessamentoModule, declarations: [PainelProcessamentoComponent], imports: [i2.LocaleModule, i1.TranslateModule, TooltipModule,
889
+ TableModule$1,
890
+ TableModule,
891
+ ButtonModule,
892
+ CommonModule,
893
+ PanelModule], exports: [PainelProcessamentoComponent] });
894
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: PainelProcessamentoModule, imports: [LocaleModule.forChild(),
895
+ TranslateModule.forChild(),
896
+ TooltipModule,
897
+ TableModule$1,
898
+ TableModule,
899
+ ButtonModule,
900
+ CommonModule,
901
+ PanelModule] });
902
+ }
903
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: PainelProcessamentoModule, decorators: [{
904
+ type: NgModule,
905
+ args: [{
906
+ imports: [
907
+ LocaleModule.forChild(),
908
+ TranslateModule.forChild(),
909
+ TooltipModule,
910
+ TableModule$1,
911
+ TableModule,
912
+ ButtonModule,
913
+ CommonModule,
914
+ PanelModule,
915
+ ],
916
+ declarations: [
917
+ PainelProcessamentoComponent
918
+ ],
919
+ providers: [],
920
+ exports: [
921
+ PainelProcessamentoComponent
922
+ ],
923
+ }]
924
+ }] });
925
+
926
+ const fallback = {
927
+ "tmsx_fnd.tmsx_angular_components.add": "Adicionar",
928
+ "tmsx_fnd.tmsx_angular_components.audit_created_by": "Criado por {{nome}} em {{data}} às {{hora}}.",
929
+ "tmsx_fnd.tmsx_angular_components.audit_modified_by": "Modificado por {{nome}} em {{data}} às {{hora}}.",
930
+ "tmsx_fnd.tmsx_angular_components.audit_inactivated_by": "Inativado por {{nome}} em {{data}} às {{hora}}.",
931
+ "tmsx_fnd.tmsx_angular_components.condicao_valor_lookup_condicional_no_audit": "Sem informações de auditoria",
932
+ "tmsx_fnd.tmsx_angular_components.delete": "Excluir",
933
+ "tmsx_fnd.tmsx_angular_components.edit": "Editar",
934
+ "tmsx_fnd.tmsx_angular_components.error_forbidden_description": "Você não tem permissão para acessar este recurso.",
935
+ "tmsx_fnd.tmsx_angular_components.error_forbidden_title": "Acesso Negado",
936
+ "tmsx_fnd.tmsx_angular_components.error_not_found_description": "O recurso solicitado não foi encontrado.",
937
+ "tmsx_fnd.tmsx_angular_components.error_not_found_title": "Não Encontrado",
938
+ "tmsx_fnd.tmsx_angular_components.error_unauthorized_description": "Você não está autorizado a acessar este recurso.",
939
+ "tmsx_fnd.tmsx_angular_components.error_unauthorized_title": "Não Autorizado",
940
+ "tmsx_fnd.tmsx_angular_components.grid_aninhada": "Grid Aninhada",
941
+ "tmsx_fnd.tmsx_angular_components.grid_editable_nested_calendar_required": "É necessário informar a data",
942
+ "tmsx_fnd.tmsx_angular_components.grid_editable_nested_cancelar": "Cancelar",
943
+ "tmsx_fnd.tmsx_angular_components.grid_editable_nested_editar": "Editar valores",
944
+ "tmsx_fnd.tmsx_angular_components.grid_editable_nested_paging": "registros encontrados",
945
+ "tmsx_fnd.tmsx_angular_components.grid_editable_nested_salvar": "Salvar alterações",
946
+ "tmsx_fnd.tmsx_angular_components.list_grid_boolean_false": "Não",
947
+ "tmsx_fnd.tmsx_angular_components.list_grid_boolean_true": "Sim",
948
+ "tmsx_fnd.tmsx_angular_components.list_grid_empty_field": "Não informado",
949
+ "tmsx_fnd.tmsx_angular_components.painel_processamento": "Painel de Processamento",
950
+ "tmsx_fnd.tmsx_angular_components.painel_processamento_api_error": "API de envio não definida",
951
+ "tmsx_fnd.tmsx_angular_components.painel_processamento_status_failed": "Ocorreu um erro",
952
+ "tmsx_fnd.tmsx_angular_components.painel_processamento_status_pending": "Pendente",
953
+ "tmsx_fnd.tmsx_angular_components.painel_processamento_status_processing": "Processando",
954
+ "tmsx_fnd.tmsx_angular_components.painel_processamento_status_success": "Finalizado com sucesso",
955
+ "tmsx_fnd.tmsx_angular_components.registro": "Registro",
956
+ "tmsx_fnd.tmsx_angular_components.showcase_painel_processamento_title": "Demonstração do Painel de Processamento",
957
+ "tmsx_fnd.tmsx_angular_components.showcase_table_title": "Demonstração da Tabela",
958
+ "tmsx_fnd.tmsx_angular_components.showcase_title": "Showcase",
959
+ "tmsx_fnd.tmsx_angular_components.situacao_ativo_false": "Inativo",
960
+ "tmsx_fnd.tmsx_angular_components.situacao_ativo_true": "Ativo",
961
+ "tmsx_fnd.tmsx_angular_components.status": "Situação",
962
+ "tmsx_fnd.tmsx_angular_components.total_records": "{{ value }} registros encontrados"
963
+ };
964
+
965
+ const HOST_PROJECT_CONFIGS_INJECTION_TOKEN = new InjectionToken("hostProjectConfigs");
966
+ class TmsxAngularComponentsModule {
967
+ static forRoot(config) {
968
+ return {
969
+ ngModule: TmsxAngularComponentsModule,
970
+ providers: [
971
+ {
972
+ provide: HOST_PROJECT_CONFIGS_INJECTION_TOKEN,
973
+ useValue: config
974
+ }
975
+ ]
976
+ };
977
+ }
978
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: TmsxAngularComponentsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
979
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: TmsxAngularComponentsModule });
980
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: TmsxAngularComponentsModule });
981
+ }
982
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: TmsxAngularComponentsModule, decorators: [{
983
+ type: NgModule,
984
+ args: [{}]
985
+ }] });
986
+
987
+ /**
988
+ * Generated bundle index. Do not edit.
989
+ */
990
+
991
+ export { FieldType, GridEditableNestedComponent, GridEditableNestedModule, HOST_PROJECT_CONFIGS_INJECTION_TOKEN, PainelProcessamentoComponent, PainelProcessamentoModule, TmsxAngularComponentsModule, UtilsService, fallback };
992
+ //# sourceMappingURL=seniorsistemas-tmsx-angular-components.mjs.map