@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.
- package/commons/field-type/field-type.d.ts +76 -0
- package/commons/field-type/index.d.ts +1 -0
- package/commons/index.d.ts +1 -0
- package/components/grid-editable-nested/grid-editable-nested.component.d.ts +11 -10
- package/components/grid-editable-nested/grid-editable-nested.module.d.ts +31 -0
- package/components/index.d.ts +1 -1
- package/components/painel-processamento/painel-processamento.component.d.ts +5 -2
- package/components/painel-processamento/painel-processamento.module.d.ts +13 -0
- package/components/painel-processamento/processamento.d.ts +1 -1
- package/esm2022/commons/field-type/field-type.mjs +76 -0
- package/esm2022/commons/field-type/index.mjs +2 -0
- package/esm2022/commons/index.mjs +2 -0
- package/esm2022/components/grid-editable-nested/grid-editable-nested.component.mjs +261 -0
- package/esm2022/components/grid-editable-nested/grid-editable-nested.module.mjs +133 -0
- package/esm2022/components/grid-editable-nested/grid.interface.mjs +9 -0
- package/esm2022/components/grid-editable-nested/index.mjs +3 -0
- package/esm2022/components/index.mjs +3 -0
- package/esm2022/components/painel-processamento/index.mjs +3 -0
- package/esm2022/components/painel-processamento/painel-processamento.component.mjs +226 -0
- package/esm2022/components/painel-processamento/painel-processamento.module.mjs +53 -0
- package/esm2022/components/painel-processamento/processamento.mjs +14 -0
- package/esm2022/locale/fallback.mjs +39 -0
- package/esm2022/public-api.mjs +6 -0
- package/esm2022/seniorsistemas-tmsx-angular-components.mjs +5 -0
- package/esm2022/tmsx-angular-components.module.mjs +24 -0
- package/esm2022/utils/index.mjs +2 -0
- package/esm2022/utils/services/utils.service.mjs +192 -0
- package/fesm2022/seniorsistemas-tmsx-angular-components.mjs +992 -0
- package/fesm2022/seniorsistemas-tmsx-angular-components.mjs.map +1 -0
- package/{seniorsistemas-tmsx-angular-components.d.ts → index.d.ts} +1 -0
- package/package.json +16 -59
- package/public-api.d.ts +4 -3
- package/tmsx-angular-components.module.d.ts +6 -2
- package/utils/services/utils.service.d.ts +7 -3
- package/bundles/seniorsistemas-tmsx-angular-components.umd.js +0 -1108
- package/bundles/seniorsistemas-tmsx-angular-components.umd.js.map +0 -1
- package/bundles/seniorsistemas-tmsx-angular-components.umd.min.js +0 -2
- package/bundles/seniorsistemas-tmsx-angular-components.umd.min.js.map +0 -1
- package/esm2015/components/grid-editable-nested/grid-editable-nested.component.js +0 -267
- package/esm2015/components/grid-editable-nested/grid-editable-nested.module.js +0 -64
- package/esm2015/components/grid-editable-nested/grid.interface.js +0 -9
- package/esm2015/components/grid-editable-nested/index.js +0 -3
- package/esm2015/components/index.js +0 -3
- package/esm2015/components/painel-processamento/index.js +0 -3
- package/esm2015/components/painel-processamento/painel-processamento.component.js +0 -235
- package/esm2015/components/painel-processamento/painel-processamento.module.js +0 -33
- package/esm2015/components/painel-processamento/processamento.js +0 -14
- package/esm2015/locale/fallback.js +0 -39
- package/esm2015/public-api.js +0 -5
- package/esm2015/seniorsistemas-tmsx-angular-components.js +0 -5
- package/esm2015/tmsx-angular-components.module.js +0 -22
- package/esm2015/utils/index.js +0 -2
- package/esm2015/utils/services/utils.service.js +0 -196
- package/esm5/components/grid-editable-nested/grid-editable-nested.component.js +0 -282
- package/esm5/components/grid-editable-nested/grid-editable-nested.module.js +0 -67
- package/esm5/components/grid-editable-nested/grid.interface.js +0 -9
- package/esm5/components/grid-editable-nested/index.js +0 -3
- package/esm5/components/index.js +0 -3
- package/esm5/components/painel-processamento/index.js +0 -3
- package/esm5/components/painel-processamento/painel-processamento.component.js +0 -263
- package/esm5/components/painel-processamento/painel-processamento.module.js +0 -36
- package/esm5/components/painel-processamento/processamento.js +0 -15
- package/esm5/locale/fallback.js +0 -39
- package/esm5/public-api.js +0 -5
- package/esm5/seniorsistemas-tmsx-angular-components.js +0 -5
- package/esm5/tmsx-angular-components.module.js +0 -26
- package/esm5/utils/index.js +0 -2
- package/esm5/utils/services/utils.service.js +0 -198
- package/fesm2015/seniorsistemas-tmsx-angular-components.js +0 -839
- package/fesm2015/seniorsistemas-tmsx-angular-components.js.map +0 -1
- package/fesm5/seniorsistemas-tmsx-angular-components.js +0 -895
- package/fesm5/seniorsistemas-tmsx-angular-components.js.map +0 -1
- package/seniorsistemas-tmsx-angular-components.metadata.json +0 -1
|
@@ -1,839 +0,0 @@
|
|
|
1
|
-
import pLimit from 'p-limit';
|
|
2
|
-
import { __awaiter, __decorate } from 'tslib';
|
|
3
|
-
import { TranslateService, TranslateModule } from '@ngx-translate/core';
|
|
4
|
-
import { EventEmitter, ɵɵdefineInjectable, ɵɵinject, Input, Output, Injectable, Component, NgModule, ChangeDetectorRef, ViewChild, InjectionToken } from '@angular/core';
|
|
5
|
-
import { EnumColumnFieldType, LocaleModule, TooltipModule, TableModule as TableModule$1, ButtonModule, FieldType, LocalizedDatePipe, LoadingStateModule, NumberInputModule, BreadcrumbModule, ControlErrorsModule, CustomFieldsModule, DynamicFormModule, EmptyStateModule, TokenListModule } from '@seniorsistemas/angular-components';
|
|
6
|
-
import { TableModule } from 'primeng/table';
|
|
7
|
-
import { CommonModule } from '@angular/common';
|
|
8
|
-
import { PanelModule } from 'primeng/panel';
|
|
9
|
-
import { Subject } from 'rxjs';
|
|
10
|
-
import { Hotkey, HotkeysService } from 'angular2-hotkeys';
|
|
11
|
-
import { ToastModule } from 'primeng/toast';
|
|
12
|
-
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
13
|
-
import { InputTextModule } from 'primeng/inputtext';
|
|
14
|
-
import { ConfirmDialogModule } from 'primeng/confirmdialog';
|
|
15
|
-
import { CalendarModule } from 'primeng/calendar';
|
|
16
|
-
import { DropdownModule } from 'primeng/dropdown';
|
|
17
|
-
import { SharedModule } from 'primeng/api';
|
|
18
|
-
import { TooltipModule as TooltipModule$1 } from 'primeng/tooltip';
|
|
19
|
-
import { AutoCompleteModule } from 'primeng/autocomplete';
|
|
20
|
-
import { CheckboxModule } from 'primeng/checkbox';
|
|
21
|
-
|
|
22
|
-
var EnumProcessamentoStatus;
|
|
23
|
-
(function (EnumProcessamentoStatus) {
|
|
24
|
-
EnumProcessamentoStatus["SUCCESS"] = "SUCCESS";
|
|
25
|
-
EnumProcessamentoStatus["FAILED"] = "FAILED";
|
|
26
|
-
EnumProcessamentoStatus["PENDING"] = "PENDING";
|
|
27
|
-
EnumProcessamentoStatus["PROCESSING"] = "PROCESSING";
|
|
28
|
-
})(EnumProcessamentoStatus || (EnumProcessamentoStatus = {}));
|
|
29
|
-
const EnumProcessamentoStatusTranslationMap = {
|
|
30
|
-
[EnumProcessamentoStatus.SUCCESS]: 'tmsx_fnd.tmsx_angular_components.painel_processamento_status_success',
|
|
31
|
-
[EnumProcessamentoStatus.FAILED]: 'tmsx_fnd.tmsx_angular_components.painel_processamento_status_failed',
|
|
32
|
-
[EnumProcessamentoStatus.PENDING]: 'tmsx_fnd.tmsx_angular_components.painel_processamento_status_pending',
|
|
33
|
-
[EnumProcessamentoStatus.PROCESSING]: 'tmsx_fnd.tmsx_angular_components.painel_processamento_status_processing'
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
var PainelProcessamentoComponent_1;
|
|
37
|
-
let PainelProcessamentoComponent = PainelProcessamentoComponent_1 = class PainelProcessamentoComponent {
|
|
38
|
-
constructor(translate) {
|
|
39
|
-
this.translate = translate;
|
|
40
|
-
this.processado = new EventEmitter();
|
|
41
|
-
this.concluido = new EventEmitter();
|
|
42
|
-
this.totalRecords = 0;
|
|
43
|
-
this.successCount = 0;
|
|
44
|
-
this.failedCount = 0;
|
|
45
|
-
this.pendingCount = 0;
|
|
46
|
-
this.successProgress = '0%';
|
|
47
|
-
this.failedProgress = '0%';
|
|
48
|
-
this.pendingProgress = '100%';
|
|
49
|
-
this.processingProgress = '0%';
|
|
50
|
-
this.sortField = 'status';
|
|
51
|
-
this.sortOrder = 1;
|
|
52
|
-
}
|
|
53
|
-
ngOnInit() {
|
|
54
|
-
this.initPanel();
|
|
55
|
-
}
|
|
56
|
-
initPanel() {
|
|
57
|
-
this.gridColumns = this.getGridColumn();
|
|
58
|
-
this.initGrid();
|
|
59
|
-
this.initProgressBar();
|
|
60
|
-
}
|
|
61
|
-
initProgressBar() {
|
|
62
|
-
this.successProgress = '0%';
|
|
63
|
-
this.failedProgress = '0%';
|
|
64
|
-
this.pendingProgress = '100%';
|
|
65
|
-
this.processingProgress = '0%';
|
|
66
|
-
this.totalRecords = this.params.registros.length;
|
|
67
|
-
this.pendingCount = this.totalRecords;
|
|
68
|
-
if (this.params.quantidadeChamadasSimultaneas > 1) {
|
|
69
|
-
this.processAllRecordsWithPLimit();
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
this.syncProcessRecord(0);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
initGrid() {
|
|
76
|
-
this.gridData = [];
|
|
77
|
-
this.gridData = this.params.registros.map(registro => ({
|
|
78
|
-
registro,
|
|
79
|
-
status: EnumProcessamentoStatus.PENDING,
|
|
80
|
-
label: registro.descricao
|
|
81
|
-
}));
|
|
82
|
-
}
|
|
83
|
-
getErrorMessage(error) {
|
|
84
|
-
var _a, _b;
|
|
85
|
-
try {
|
|
86
|
-
if (!error) {
|
|
87
|
-
return this.genericErrorMsg;
|
|
88
|
-
}
|
|
89
|
-
if ((_a = error === null || error === void 0 ? void 0 : error.error) === null || _a === void 0 ? void 0 : _a.message) {
|
|
90
|
-
return String(error.error.message);
|
|
91
|
-
}
|
|
92
|
-
if ((_b = error === null || error === void 0 ? void 0 : error.message) === null || _b === void 0 ? void 0 : _b.message) {
|
|
93
|
-
return String(error.message.message);
|
|
94
|
-
}
|
|
95
|
-
return this.genericErrorMsg;
|
|
96
|
-
}
|
|
97
|
-
catch (_c) {
|
|
98
|
-
return this.genericErrorMsg;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
get genericErrorMsg() {
|
|
102
|
-
return this.translate.instant(PainelProcessamentoComponent_1.GENERIC_ERR_KEY);
|
|
103
|
-
}
|
|
104
|
-
updateRowSuccess(row, index) {
|
|
105
|
-
this.successCount++;
|
|
106
|
-
this.pendingCount--;
|
|
107
|
-
this.updateRowStatus(row, EnumProcessamentoStatus.SUCCESS);
|
|
108
|
-
this.processado.emit(row);
|
|
109
|
-
this.updateProgressBar();
|
|
110
|
-
}
|
|
111
|
-
updateRowError(row, index, message) {
|
|
112
|
-
this.failedCount++;
|
|
113
|
-
this.pendingCount--;
|
|
114
|
-
this.updateRowStatus(row, EnumProcessamentoStatus.FAILED, message);
|
|
115
|
-
this.processado.emit(row);
|
|
116
|
-
this.updateProgressBar();
|
|
117
|
-
}
|
|
118
|
-
syncProcessRecord(index) {
|
|
119
|
-
if (this.pendingCount < 1) {
|
|
120
|
-
this.concluido.emit('ok');
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
this.updateRowStatus(this.gridData[index], EnumProcessamentoStatus.PROCESSING);
|
|
124
|
-
const record = this.params.registros[index];
|
|
125
|
-
const row = this.gridData.find(item => item.registro === record);
|
|
126
|
-
if (record.apiEnvio) {
|
|
127
|
-
record.apiEnvio(record.objEnvio)
|
|
128
|
-
.subscribe(() => {
|
|
129
|
-
this.updateRowSuccess(row, index);
|
|
130
|
-
this.syncProcessRecord(index + 1);
|
|
131
|
-
}, (error) => {
|
|
132
|
-
this.updateRowError(row, index, this.getErrorMessage(error));
|
|
133
|
-
this.syncProcessRecord(index + 1);
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
else {
|
|
137
|
-
this.failedCount = this.pendingCount;
|
|
138
|
-
this.pendingCount = 0;
|
|
139
|
-
this.updateRowStatus(row, EnumProcessamentoStatus.FAILED, this.translate.instant('tmsx_fnd.tmsx_angular_components.painel_processamento_api_error'));
|
|
140
|
-
this.updateProgressBar();
|
|
141
|
-
this.concluido.emit('erro');
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
processAllRecordsWithPLimit() {
|
|
145
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
146
|
-
const pLimit$1 = pLimit;
|
|
147
|
-
const limit = pLimit$1(this.params.quantidadeChamadasSimultaneas);
|
|
148
|
-
const promises = this.params.registros.map((record, index) => {
|
|
149
|
-
return limit(() => __awaiter(this, void 0, void 0, function* () {
|
|
150
|
-
const row = this.gridData.find(item => item.registro === record);
|
|
151
|
-
this.updateRowStatus(row, EnumProcessamentoStatus.PROCESSING);
|
|
152
|
-
try {
|
|
153
|
-
const result = yield record.apiEnvio(record.objEnvio).toPromise();
|
|
154
|
-
this.updateRowSuccess(row, index);
|
|
155
|
-
return { success: true, record, result };
|
|
156
|
-
}
|
|
157
|
-
catch (error) {
|
|
158
|
-
this.updateRowError(row, index, this.getErrorMessage(error));
|
|
159
|
-
return { success: false, record, error };
|
|
160
|
-
}
|
|
161
|
-
}));
|
|
162
|
-
});
|
|
163
|
-
const results = yield Promise.all(promises);
|
|
164
|
-
this.concluido.emit(results);
|
|
165
|
-
return results;
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
updateProgressBar() {
|
|
169
|
-
const successWidth = (this.successCount / this.totalRecords) * 100;
|
|
170
|
-
const failedWidth = (this.failedCount / this.totalRecords) * 100;
|
|
171
|
-
const pendingWidth = (this.pendingCount / this.totalRecords) * 100;
|
|
172
|
-
const processedWidth = successWidth + failedWidth;
|
|
173
|
-
this.processingProgress = `${processedWidth.toFixed(0)}%`;
|
|
174
|
-
this.successProgress = `${successWidth.toFixed(0)}%`;
|
|
175
|
-
this.failedProgress = `${failedWidth.toFixed(0)}%`;
|
|
176
|
-
this.pendingProgress = `${pendingWidth.toFixed(0)}%`;
|
|
177
|
-
}
|
|
178
|
-
updateRowStatus(row, status, message) {
|
|
179
|
-
row.status = status;
|
|
180
|
-
if (message) {
|
|
181
|
-
row.message = message;
|
|
182
|
-
}
|
|
183
|
-
this.sortGridData();
|
|
184
|
-
}
|
|
185
|
-
sortGridData() {
|
|
186
|
-
this.gridData.sort((a, b) => {
|
|
187
|
-
const statusOrder = {
|
|
188
|
-
[EnumProcessamentoStatus.FAILED]: 1,
|
|
189
|
-
[EnumProcessamentoStatus.PROCESSING]: 2,
|
|
190
|
-
[EnumProcessamentoStatus.SUCCESS]: 3,
|
|
191
|
-
[EnumProcessamentoStatus.PENDING]: 4
|
|
192
|
-
};
|
|
193
|
-
if (this.sortField === 'status') {
|
|
194
|
-
return (statusOrder[a.status] - statusOrder[b.status]) * this.sortOrder;
|
|
195
|
-
}
|
|
196
|
-
else {
|
|
197
|
-
const valA = a[this.sortField] || '';
|
|
198
|
-
const valB = b[this.sortField] || '';
|
|
199
|
-
return valA.localeCompare(valB) * this.sortOrder;
|
|
200
|
-
}
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
getData(rowData, field) {
|
|
204
|
-
if (field === 'status') {
|
|
205
|
-
let text = this.translate.instant(EnumProcessamentoStatusTranslationMap[rowData.status]);
|
|
206
|
-
if (rowData.message) {
|
|
207
|
-
text += `: ${rowData.message}`;
|
|
208
|
-
}
|
|
209
|
-
return text;
|
|
210
|
-
}
|
|
211
|
-
return rowData[field];
|
|
212
|
-
}
|
|
213
|
-
getClassStatus(rowData, field) {
|
|
214
|
-
if (field !== 'status') {
|
|
215
|
-
return '';
|
|
216
|
-
}
|
|
217
|
-
return `status ${rowData[field].toLowerCase()}`;
|
|
218
|
-
}
|
|
219
|
-
getGridColumn() {
|
|
220
|
-
return [
|
|
221
|
-
{
|
|
222
|
-
field: 'label',
|
|
223
|
-
header: this.translate.instant('tmsx_fnd.tmsx_angular_components.registro'),
|
|
224
|
-
style: { width: '50%' },
|
|
225
|
-
attributes: [],
|
|
226
|
-
type: EnumColumnFieldType.STRING
|
|
227
|
-
},
|
|
228
|
-
{
|
|
229
|
-
field: 'status',
|
|
230
|
-
header: this.translate.instant('tmsx_fnd.tmsx_angular_components.status'),
|
|
231
|
-
style: { width: '50%' },
|
|
232
|
-
attributes: [],
|
|
233
|
-
type: EnumColumnFieldType.STRING
|
|
234
|
-
},
|
|
235
|
-
];
|
|
236
|
-
}
|
|
237
|
-
};
|
|
238
|
-
PainelProcessamentoComponent.GENERIC_ERR_KEY = 'tmsx_fnd.tmsx_angular_components.painel_processamento_generic_error';
|
|
239
|
-
PainelProcessamentoComponent.ctorParameters = () => [
|
|
240
|
-
{ type: TranslateService }
|
|
241
|
-
];
|
|
242
|
-
PainelProcessamentoComponent.ɵprov = ɵɵdefineInjectable({ factory: function PainelProcessamentoComponent_Factory() { return new PainelProcessamentoComponent(ɵɵinject(TranslateService)); }, token: PainelProcessamentoComponent, providedIn: "root" });
|
|
243
|
-
__decorate([
|
|
244
|
-
Input()
|
|
245
|
-
], PainelProcessamentoComponent.prototype, "params", void 0);
|
|
246
|
-
__decorate([
|
|
247
|
-
Output()
|
|
248
|
-
], PainelProcessamentoComponent.prototype, "processado", void 0);
|
|
249
|
-
__decorate([
|
|
250
|
-
Output()
|
|
251
|
-
], PainelProcessamentoComponent.prototype, "concluido", void 0);
|
|
252
|
-
PainelProcessamentoComponent = PainelProcessamentoComponent_1 = __decorate([
|
|
253
|
-
Injectable({
|
|
254
|
-
providedIn: 'root'
|
|
255
|
-
}),
|
|
256
|
-
Component({
|
|
257
|
-
selector: 'tmsx-painel-processamento',
|
|
258
|
-
template: "<p-panel>\n <p-header>{{ this.params.titulo }} ({{processingProgress }})</p-header>\n\n <div class=\"progressbar\">\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 <col *ngFor=\"let col of columns\" [ngStyle]=\"col.style\">\n </colgroup>\n </ng-template>\n\n <ng-template pTemplate=\"header\" let-columns>\n <tr>\n <th scope=\"col\"\n *ngFor=\"let col of columns\"\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 <p-sortIcon *ngIf=\"!col.disableColumnSort\" [field]=\"col.field\"></p-sortIcon>\n </div>\n </th>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"body\" let-rowData let-columns=\"columns\">\n <tr>\n <td *ngFor=\"let col of columns\" [ngClass]=\"getClassStatus(rowData, col.field)\">\n {{ getData(rowData, col.field) }}\n </td>\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",
|
|
259
|
-
styles: [".progressbar{margin-bottom:30px;border-radius:20px;height:40px}.progressbar .visible:nth-child(1of.visible){border-top-left-radius:20px;border-bottom-left-radius:20px}.progressbar .visible:nth-last-child(1of.visible){border-top-right-radius:20px;border-bottom-right-radius:20px}.progressbar .failed,.progressbar .pending,.progressbar .success{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}"]
|
|
260
|
-
})
|
|
261
|
-
], PainelProcessamentoComponent);
|
|
262
|
-
|
|
263
|
-
let PainelProcessamentoModule = class PainelProcessamentoModule {
|
|
264
|
-
};
|
|
265
|
-
PainelProcessamentoModule = __decorate([
|
|
266
|
-
NgModule({
|
|
267
|
-
imports: [
|
|
268
|
-
LocaleModule.forChild(),
|
|
269
|
-
TranslateModule.forChild(),
|
|
270
|
-
TooltipModule,
|
|
271
|
-
TableModule,
|
|
272
|
-
TableModule$1,
|
|
273
|
-
ButtonModule,
|
|
274
|
-
CommonModule,
|
|
275
|
-
PanelModule,
|
|
276
|
-
],
|
|
277
|
-
declarations: [
|
|
278
|
-
PainelProcessamentoComponent
|
|
279
|
-
],
|
|
280
|
-
providers: [],
|
|
281
|
-
exports: [
|
|
282
|
-
PainelProcessamentoComponent
|
|
283
|
-
],
|
|
284
|
-
})
|
|
285
|
-
], PainelProcessamentoModule);
|
|
286
|
-
|
|
287
|
-
let UtilsService = class UtilsService {
|
|
288
|
-
constructor(translate, dataPipe) {
|
|
289
|
-
this.translate = translate;
|
|
290
|
-
this.dataPipe = dataPipe;
|
|
291
|
-
}
|
|
292
|
-
getAuditCreatedBy(createdBy, createdDate) {
|
|
293
|
-
if (!createdBy || !createdDate) {
|
|
294
|
-
return '';
|
|
295
|
-
}
|
|
296
|
-
let date = '';
|
|
297
|
-
this.dataPipe.transform(createdDate).subscribe((item) => date = item.split(' '));
|
|
298
|
-
return this.translate.instant('tmsx_fnd.tmsx_angular_components.audit_created_by', { nome: createdBy, data: date[0], hora: date[1] });
|
|
299
|
-
}
|
|
300
|
-
getAuditModifiedBy(modifiedBy, modifiedDate) {
|
|
301
|
-
if (!modifiedBy || !modifiedDate) {
|
|
302
|
-
return '';
|
|
303
|
-
}
|
|
304
|
-
let date = '';
|
|
305
|
-
this.dataPipe.transform(modifiedDate).subscribe((item) => date = item.split(' '));
|
|
306
|
-
return this.translate.instant('tmsx_fnd.tmsx_angular_components.audit_modified_by', { nome: modifiedBy, data: date[0], hora: date[1] });
|
|
307
|
-
}
|
|
308
|
-
getAuditInactivatedBy(inactivatedBy, inactivatedDate) {
|
|
309
|
-
if (!inactivatedBy || !inactivatedDate) {
|
|
310
|
-
return '';
|
|
311
|
-
}
|
|
312
|
-
let date = '';
|
|
313
|
-
this.dataPipe.transform(inactivatedDate).subscribe((item) => date = item.split(' '));
|
|
314
|
-
return this.translate.instant('tmsx_fnd.tmsx_angular_components.audit_inactivated_by', { nome: inactivatedBy, data: date[0], hora: date[1] });
|
|
315
|
-
}
|
|
316
|
-
/* usage: [innerHTML]="getProp(rowData, 'nome')" */
|
|
317
|
-
getProp(obj, path, type) {
|
|
318
|
-
let value = path.split('.').reduce((result, prop) => (result[prop] === undefined ? '' : result[prop]), obj);
|
|
319
|
-
if (value || value === 0) {
|
|
320
|
-
if (type) {
|
|
321
|
-
value = this.formatType(value, type);
|
|
322
|
-
}
|
|
323
|
-
return `<span>${value}</span>`;
|
|
324
|
-
}
|
|
325
|
-
return `<span class="empty-grid">${this.translate.instant('tmsx_fnd.tmsx_angular_components.list_grid_empty_field')}</span>`;
|
|
326
|
-
}
|
|
327
|
-
formatType(value, type) {
|
|
328
|
-
if (value) {
|
|
329
|
-
if (type === 'date') {
|
|
330
|
-
let date = '';
|
|
331
|
-
this.dataPipe.transform(value).subscribe((item) => date = item.split(' '));
|
|
332
|
-
return date[0];
|
|
333
|
-
}
|
|
334
|
-
if (type === 'datetime') {
|
|
335
|
-
let date = '';
|
|
336
|
-
this.dataPipe.transform(value).subscribe((item) => date = item);
|
|
337
|
-
return date;
|
|
338
|
-
}
|
|
339
|
-
if (type === 'decimal') {
|
|
340
|
-
if (typeof value === 'string') {
|
|
341
|
-
value = Number(value);
|
|
342
|
-
}
|
|
343
|
-
return value.toLocaleString('pt-BR', { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
|
344
|
-
}
|
|
345
|
-
if (type === 'currency') {
|
|
346
|
-
return value.toLocaleString('pt-BR', { style: 'currency', currency: 'BRL' });
|
|
347
|
-
}
|
|
348
|
-
if (type === 'cep') {
|
|
349
|
-
return value.replace(/^(\d{2})(\d{3})(\d{3})/, '$1.$2-$3');
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
return value;
|
|
353
|
-
}
|
|
354
|
-
/* usage: [ngClass]="emptyGridClass(value)" */
|
|
355
|
-
emptyGridClass(value) {
|
|
356
|
-
if (!value || value === this.translate.instant('tmsx_fnd.replicacao.list_grid_empty_field')) {
|
|
357
|
-
return 'empty-grid';
|
|
358
|
-
}
|
|
359
|
-
return '';
|
|
360
|
-
}
|
|
361
|
-
infoContent(entity) {
|
|
362
|
-
let text = '';
|
|
363
|
-
if (!entity) {
|
|
364
|
-
return this.translate.instant("tmsx_fnd.tmsx_angular_components.condicao_valor_lookup_condicional_no_audit");
|
|
365
|
-
}
|
|
366
|
-
text += this.getAuditCreatedBy(entity.createdBy, entity.createdDate);
|
|
367
|
-
if (text) {
|
|
368
|
-
text += '\n';
|
|
369
|
-
}
|
|
370
|
-
text += this.getAuditModifiedBy(entity.lastModifiedBy, entity.lastModifiedDate);
|
|
371
|
-
return text;
|
|
372
|
-
}
|
|
373
|
-
formatCurrency(value) {
|
|
374
|
-
return value.toLocaleString('pt-BR', { style: 'currency', currency: 'BRL' });
|
|
375
|
-
}
|
|
376
|
-
getAtivoTokenLabel(formField, value, translate) {
|
|
377
|
-
const { name, type, label } = formField;
|
|
378
|
-
if (type === FieldType.Radio) {
|
|
379
|
-
const labelValue = value
|
|
380
|
-
? translate.instant('tmsx_fnd.tmsx_angular_components.situacao_ativo_true')
|
|
381
|
-
: translate.instant('tmsx_fnd.tmsx_angular_components.situacao_ativo_false');
|
|
382
|
-
return { id: name, label: `${label}: ${labelValue}` };
|
|
383
|
-
}
|
|
384
|
-
return this.createFilterTokens(formField, value, translate);
|
|
385
|
-
}
|
|
386
|
-
getUtilsProp(obj, path) {
|
|
387
|
-
return path.split('.').reduce((result, prop) => (result[prop] === undefined ? '' : result[prop]), obj);
|
|
388
|
-
}
|
|
389
|
-
createFilterTokens(formField, value, translate) {
|
|
390
|
-
const { name, type, label, searchFields, options } = formField;
|
|
391
|
-
const labelValue = this.getLabelValueByType(type, value, searchFields, options, translate);
|
|
392
|
-
return { id: name, label: `${label}: ${labelValue}` };
|
|
393
|
-
}
|
|
394
|
-
getLabelValueByType(type, value, searchFields, options, translate) {
|
|
395
|
-
switch (type) {
|
|
396
|
-
case FieldType.Date:
|
|
397
|
-
return this.getDateLabel(value);
|
|
398
|
-
case FieldType.Time:
|
|
399
|
-
return this.getTimeFromDate(value);
|
|
400
|
-
case FieldType.LocalDateTime:
|
|
401
|
-
case FieldType.DateTime:
|
|
402
|
-
return this.getDateTimeFromDate(value);
|
|
403
|
-
case FieldType.Lookup:
|
|
404
|
-
return this.getLookupLabel(value, searchFields);
|
|
405
|
-
case FieldType.Enum:
|
|
406
|
-
return this.getEnumLabel(value, options);
|
|
407
|
-
case FieldType.Boolean:
|
|
408
|
-
return this.getBooleanLabel(value, translate);
|
|
409
|
-
default:
|
|
410
|
-
return value;
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
getDateLabel(value) {
|
|
414
|
-
const dateObj = value instanceof Date ? value : new Date(value);
|
|
415
|
-
return !isNaN(dateObj.getTime()) ? dateObj.toLocaleDateString('pt-BR') : value;
|
|
416
|
-
}
|
|
417
|
-
getLookupLabel(value, searchFields) {
|
|
418
|
-
return searchFields.map((field) => this.getUtilsProp(value, field.name)).join(' - ');
|
|
419
|
-
}
|
|
420
|
-
getEnumLabel(value, options) {
|
|
421
|
-
const option = options.find((opt) => opt.value === value);
|
|
422
|
-
return option ? option.label : value;
|
|
423
|
-
}
|
|
424
|
-
getBooleanLabel(value, translate) {
|
|
425
|
-
return value
|
|
426
|
-
? translate.instant('tmsx_fnd.tmsx_angular_components.list_grid_boolean_true')
|
|
427
|
-
: translate.instant('tmsx_fnd.tmsx_angular_components.list_grid_boolean_false');
|
|
428
|
-
}
|
|
429
|
-
getTimeFromDate(value) {
|
|
430
|
-
let dateObj;
|
|
431
|
-
if (typeof value === 'string' && /^\d{2}:\d{2}(:\d{2})?$/.test(value)) {
|
|
432
|
-
const [h, m, s = '00'] = value.split(':');
|
|
433
|
-
dateObj = new Date();
|
|
434
|
-
dateObj.setHours(+h, +m, +s, 0);
|
|
435
|
-
}
|
|
436
|
-
else {
|
|
437
|
-
dateObj = value instanceof Date ? value : new Date(value);
|
|
438
|
-
}
|
|
439
|
-
if (!isNaN(dateObj.getTime())) {
|
|
440
|
-
return dateObj.toLocaleTimeString('pt-BR', {
|
|
441
|
-
hour: '2-digit',
|
|
442
|
-
minute: '2-digit',
|
|
443
|
-
second: '2-digit',
|
|
444
|
-
hour12: false
|
|
445
|
-
}); // HH:mm:ss
|
|
446
|
-
}
|
|
447
|
-
return value;
|
|
448
|
-
}
|
|
449
|
-
getDateTimeFromDate(value) {
|
|
450
|
-
const dateObj = value instanceof Date ? value : new Date(value);
|
|
451
|
-
if (!isNaN(dateObj.getTime())) {
|
|
452
|
-
const datePart = dateObj.toLocaleDateString('pt-BR'); // DD/MM/AAAA
|
|
453
|
-
const timePart = dateObj.toLocaleTimeString('pt-BR', {
|
|
454
|
-
hour: '2-digit',
|
|
455
|
-
minute: '2-digit',
|
|
456
|
-
second: '2-digit',
|
|
457
|
-
hour12: false
|
|
458
|
-
}); // HH:mm:ss
|
|
459
|
-
return `${datePart} ${timePart}`;
|
|
460
|
-
}
|
|
461
|
-
return value;
|
|
462
|
-
}
|
|
463
|
-
};
|
|
464
|
-
UtilsService.ctorParameters = () => [
|
|
465
|
-
{ type: TranslateService },
|
|
466
|
-
{ type: LocalizedDatePipe }
|
|
467
|
-
];
|
|
468
|
-
UtilsService.ɵprov = ɵɵdefineInjectable({ factory: function UtilsService_Factory() { return new UtilsService(ɵɵinject(TranslateService), ɵɵinject(LocalizedDatePipe)); }, token: UtilsService, providedIn: "root" });
|
|
469
|
-
UtilsService = __decorate([
|
|
470
|
-
Injectable({
|
|
471
|
-
providedIn: 'root'
|
|
472
|
-
})
|
|
473
|
-
], UtilsService);
|
|
474
|
-
|
|
475
|
-
let GridEditableNestedComponent = class GridEditableNestedComponent {
|
|
476
|
-
constructor(changeDetectorRef, translate, utils, hotkeysService) {
|
|
477
|
-
this.changeDetectorRef = changeDetectorRef;
|
|
478
|
-
this.translate = translate;
|
|
479
|
-
this.utils = utils;
|
|
480
|
-
this.hotkeysService = hotkeysService;
|
|
481
|
-
this.openDetails = new EventEmitter();
|
|
482
|
-
this.paging = new EventEmitter();
|
|
483
|
-
this.delete = new EventEmitter();
|
|
484
|
-
this.save = new EventEmitter();
|
|
485
|
-
this.add = new EventEmitter();
|
|
486
|
-
this.clonedData = {};
|
|
487
|
-
this.gridLoading = true;
|
|
488
|
-
this.editing = false;
|
|
489
|
-
this.lazy = true;
|
|
490
|
-
this.deleteEnabled = false;
|
|
491
|
-
this.editEnabled = false;
|
|
492
|
-
this.addEnabled = false;
|
|
493
|
-
this.detailsEnabled = false;
|
|
494
|
-
this.calendarTooltipText = '';
|
|
495
|
-
this.currentListParams = { page: 0, size: 5, sort: [] };
|
|
496
|
-
this.gridData = [];
|
|
497
|
-
this.gridColumns = [];
|
|
498
|
-
this.gridTotalRecords = 0;
|
|
499
|
-
this.selected = [];
|
|
500
|
-
this.nestedGridLoading = false;
|
|
501
|
-
this.frozenPosition = 'left';
|
|
502
|
-
this.frozenWidth = '200px';
|
|
503
|
-
this.frozenColumns = [];
|
|
504
|
-
this.ngUnsubscribe = new Subject();
|
|
505
|
-
this.calendarTooltipText = this.translate.instant('tmsx_fnd.tmsx_angular_components.grid_editable_nested_calendar_required');
|
|
506
|
-
}
|
|
507
|
-
ngOnInit() {
|
|
508
|
-
this.setGridData();
|
|
509
|
-
this.setHotkeys();
|
|
510
|
-
}
|
|
511
|
-
ngOnChanges(changes) {
|
|
512
|
-
if (changes.config) {
|
|
513
|
-
this.setGridData();
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
formatData(column, value) {
|
|
517
|
-
return value;
|
|
518
|
-
}
|
|
519
|
-
setGridData() {
|
|
520
|
-
if (!this.config) {
|
|
521
|
-
return;
|
|
522
|
-
}
|
|
523
|
-
const { data, size, columns, frozenPosition, frozenColumns, editing, lazy, deleteActionsEnabled, editEnabled, addEnabled, editActionsEnabled } = this.config;
|
|
524
|
-
this.gridData = data !== null && data !== void 0 ? data : [];
|
|
525
|
-
this.gridTotalRecords = size !== null && size !== void 0 ? size : 0;
|
|
526
|
-
this.gridColumns = columns !== null && columns !== void 0 ? columns : [];
|
|
527
|
-
this.frozenPosition = frozenPosition !== null && frozenPosition !== void 0 ? frozenPosition : 'left';
|
|
528
|
-
this.frozenColumns = frozenColumns !== null && frozenColumns !== void 0 ? frozenColumns : [];
|
|
529
|
-
this.frozenWidth = this.calculateFrozenWidth(this.frozenColumns);
|
|
530
|
-
this.editing = !!editing;
|
|
531
|
-
this.lazy = !!lazy;
|
|
532
|
-
this.deleteEnabled = !!deleteActionsEnabled;
|
|
533
|
-
this.editEnabled = !!editEnabled;
|
|
534
|
-
this.addEnabled = !!addEnabled;
|
|
535
|
-
this.detailsEnabled = !!editActionsEnabled;
|
|
536
|
-
this.changeDetectorRef.detectChanges();
|
|
537
|
-
this.nestedGridLoading = false;
|
|
538
|
-
this.gridLoading = false;
|
|
539
|
-
}
|
|
540
|
-
calculateFrozenWidth(frozenColumns) {
|
|
541
|
-
const gutter = 120;
|
|
542
|
-
if (!(frozenColumns === null || frozenColumns === void 0 ? void 0 : frozenColumns.length)) {
|
|
543
|
-
return '120px';
|
|
544
|
-
}
|
|
545
|
-
const totalWidth = frozenColumns.reduce((sum, col) => sum + gutter + (parseInt(col.width, 10) || 0), 0);
|
|
546
|
-
return `${totalWidth}px`;
|
|
547
|
-
}
|
|
548
|
-
getActions(data) {
|
|
549
|
-
return [
|
|
550
|
-
{
|
|
551
|
-
id: 'edit',
|
|
552
|
-
label: this.translate.instant('tmsx_fnd.tmsx_angular_components.edit'),
|
|
553
|
-
disabled: !this.detailsEnabled,
|
|
554
|
-
command: () => {
|
|
555
|
-
this.openRowDetails(data.id);
|
|
556
|
-
},
|
|
557
|
-
},
|
|
558
|
-
{ separator: true },
|
|
559
|
-
{
|
|
560
|
-
id: 'delete',
|
|
561
|
-
label: this.translate.instant('tmsx_fnd.tmsx_angular_components.delete'),
|
|
562
|
-
disabled: !this.deleteEnabled,
|
|
563
|
-
command: () => {
|
|
564
|
-
this.onDelete(data.id);
|
|
565
|
-
},
|
|
566
|
-
},
|
|
567
|
-
];
|
|
568
|
-
}
|
|
569
|
-
updateGridData(event) {
|
|
570
|
-
const size = event.rows ? event.rows : 10;
|
|
571
|
-
const page = event.first ? event.first / size : 0;
|
|
572
|
-
this.gridLoading = true;
|
|
573
|
-
if (this.clonedData && Object.keys(this.clonedData).length) {
|
|
574
|
-
this.clonedData = {};
|
|
575
|
-
this.table.editingRowKeys = {};
|
|
576
|
-
}
|
|
577
|
-
this.paging.emit({ page, size });
|
|
578
|
-
}
|
|
579
|
-
updateNestedGridData(event, rowData) {
|
|
580
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
581
|
-
const size = event.rows ? event.rows : 10;
|
|
582
|
-
const page = event.first ? event.first / size : 0;
|
|
583
|
-
const sort = event.multiSortMeta || [];
|
|
584
|
-
rowData.nestedGridLoading = true;
|
|
585
|
-
yield this.nestedFunction({ page, size, sort }, rowData);
|
|
586
|
-
});
|
|
587
|
-
}
|
|
588
|
-
onTab(event) {
|
|
589
|
-
if (event.key !== 'Tab') {
|
|
590
|
-
return;
|
|
591
|
-
}
|
|
592
|
-
event.preventDefault();
|
|
593
|
-
const focusables = Array.from(document.querySelectorAll('p-cellEditor input, p-cellEditor textarea, p-cellEditor [tabindex="0"]')).filter(el => el.offsetParent !== null);
|
|
594
|
-
const currentIndex = focusables.indexOf(event.target);
|
|
595
|
-
let next;
|
|
596
|
-
if (event.shiftKey) {
|
|
597
|
-
next = focusables[currentIndex - 1] || focusables[focusables.length - 1];
|
|
598
|
-
}
|
|
599
|
-
else {
|
|
600
|
-
next = focusables[currentIndex + 1] || focusables[0];
|
|
601
|
-
}
|
|
602
|
-
if (next) {
|
|
603
|
-
next.focus();
|
|
604
|
-
}
|
|
605
|
-
}
|
|
606
|
-
getRowIndex() {
|
|
607
|
-
const page = this.currentListParams.page || 0;
|
|
608
|
-
const size = this.currentListParams.size || 0;
|
|
609
|
-
return page * size;
|
|
610
|
-
}
|
|
611
|
-
getPageSize() {
|
|
612
|
-
var _a;
|
|
613
|
-
return (_a = this.currentListParams.size) !== null && _a !== void 0 ? _a : 0;
|
|
614
|
-
}
|
|
615
|
-
openRowDetails(id) {
|
|
616
|
-
this.openDetails.emit(id);
|
|
617
|
-
}
|
|
618
|
-
onDelete(id) {
|
|
619
|
-
this.delete.emit(id);
|
|
620
|
-
}
|
|
621
|
-
onAdd() {
|
|
622
|
-
this.add.emit();
|
|
623
|
-
}
|
|
624
|
-
ngOnDestroy() {
|
|
625
|
-
this.ngUnsubscribe.next();
|
|
626
|
-
this.ngUnsubscribe.complete();
|
|
627
|
-
}
|
|
628
|
-
onEditSave() {
|
|
629
|
-
this.saveAllRows();
|
|
630
|
-
}
|
|
631
|
-
onEditCancel() {
|
|
632
|
-
this.gridData.forEach((data) => {
|
|
633
|
-
if (this.clonedData[data.id]) {
|
|
634
|
-
const index = this.gridData.findIndex((row) => row.id === data.id);
|
|
635
|
-
this.gridData[index] = this.clonedData[data.id];
|
|
636
|
-
delete this.clonedData[data.id];
|
|
637
|
-
}
|
|
638
|
-
this.table.cancelRowEdit(data);
|
|
639
|
-
});
|
|
640
|
-
this.editing = false;
|
|
641
|
-
}
|
|
642
|
-
initAllRowsEdit() {
|
|
643
|
-
this.gridData.forEach((data) => {
|
|
644
|
-
this.editing = true;
|
|
645
|
-
this.table.initRowEdit(data);
|
|
646
|
-
this.clonedData[data.id] = Object.assign({}, data);
|
|
647
|
-
});
|
|
648
|
-
}
|
|
649
|
-
saveAllRows() {
|
|
650
|
-
this.gridData.forEach((data) => {
|
|
651
|
-
if (this.clonedData[data.id]) {
|
|
652
|
-
delete this.clonedData[data.id];
|
|
653
|
-
}
|
|
654
|
-
this.table.cancelRowEdit(data);
|
|
655
|
-
});
|
|
656
|
-
this.editing = false;
|
|
657
|
-
this.save.emit(this.gridData);
|
|
658
|
-
}
|
|
659
|
-
formatRowData(field) {
|
|
660
|
-
return field;
|
|
661
|
-
}
|
|
662
|
-
filterOptions(event) {
|
|
663
|
-
return event;
|
|
664
|
-
}
|
|
665
|
-
getSpanProp(obj, path, type) {
|
|
666
|
-
type = type === null || type === void 0 ? void 0 : type.toLowerCase();
|
|
667
|
-
const value = this.utils.getProp(obj, path, type);
|
|
668
|
-
if (value === '<span>0</span>' && type === 'decimal') {
|
|
669
|
-
return '<span>0,00</span>';
|
|
670
|
-
}
|
|
671
|
-
if (!obj.tiposDados) {
|
|
672
|
-
return value;
|
|
673
|
-
}
|
|
674
|
-
if ('MONETARIO' === obj.tiposDados[path]) {
|
|
675
|
-
return 'R$ ' + value;
|
|
676
|
-
}
|
|
677
|
-
if ('PERCENTUAL' === obj.tiposDados[path]) {
|
|
678
|
-
return value + ' %';
|
|
679
|
-
}
|
|
680
|
-
return value;
|
|
681
|
-
}
|
|
682
|
-
setHotkeys() {
|
|
683
|
-
this.hotkeysService.add(new Hotkey('alt+shift+n', () => {
|
|
684
|
-
this.onAdd();
|
|
685
|
-
return false;
|
|
686
|
-
}, ['INPUT', 'SELECT', 'TEXTAREA']));
|
|
687
|
-
}
|
|
688
|
-
};
|
|
689
|
-
GridEditableNestedComponent.ctorParameters = () => [
|
|
690
|
-
{ type: ChangeDetectorRef },
|
|
691
|
-
{ type: TranslateService },
|
|
692
|
-
{ type: UtilsService },
|
|
693
|
-
{ type: HotkeysService }
|
|
694
|
-
];
|
|
695
|
-
GridEditableNestedComponent.ɵprov = ɵɵdefineInjectable({ factory: function GridEditableNestedComponent_Factory() { return new GridEditableNestedComponent(ɵɵinject(ChangeDetectorRef), ɵɵinject(TranslateService), ɵɵinject(UtilsService), ɵɵinject(HotkeysService)); }, token: GridEditableNestedComponent, providedIn: "root" });
|
|
696
|
-
__decorate([
|
|
697
|
-
Input()
|
|
698
|
-
], GridEditableNestedComponent.prototype, "config", void 0);
|
|
699
|
-
__decorate([
|
|
700
|
-
Input()
|
|
701
|
-
], GridEditableNestedComponent.prototype, "nestedFunction", void 0);
|
|
702
|
-
__decorate([
|
|
703
|
-
Output()
|
|
704
|
-
], GridEditableNestedComponent.prototype, "openDetails", void 0);
|
|
705
|
-
__decorate([
|
|
706
|
-
Output()
|
|
707
|
-
], GridEditableNestedComponent.prototype, "paging", void 0);
|
|
708
|
-
__decorate([
|
|
709
|
-
Output()
|
|
710
|
-
], GridEditableNestedComponent.prototype, "delete", void 0);
|
|
711
|
-
__decorate([
|
|
712
|
-
Output()
|
|
713
|
-
], GridEditableNestedComponent.prototype, "save", void 0);
|
|
714
|
-
__decorate([
|
|
715
|
-
Output()
|
|
716
|
-
], GridEditableNestedComponent.prototype, "add", void 0);
|
|
717
|
-
__decorate([
|
|
718
|
-
ViewChild("table", { static: false })
|
|
719
|
-
], GridEditableNestedComponent.prototype, "table", void 0);
|
|
720
|
-
GridEditableNestedComponent = __decorate([
|
|
721
|
-
Injectable({
|
|
722
|
-
providedIn: 'root'
|
|
723
|
-
}),
|
|
724
|
-
Component({
|
|
725
|
-
selector: 'tmsx-grid-editable-nested',
|
|
726
|
-
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 <s-button\n *ngIf=\"!editing\"\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 <s-button\n *ngIf=\"editing\"\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 <s-button\n *ngIf=\"editing\"\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 <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 [frozenWidth]=\"frozenWidth\"\n [scrollable]=\"true\"\n [sTableFrozenPosition]=\"frozenPosition\"\n [sTableFrozenValue]=\"gridData\"\n editMode=\"row\"\n #table\n >\n <ng-template pTemplate=\"frozencolgroup\" let-columns>\n <colgroup>\n <col class=\"col50\" />\n <col *ngFor=\"let col of frozenColumns\" class=\"col200\" />\n <col class=\"frozenButton\" />\n </colgroup>\n </ng-template>\n\n <ng-template pTemplate=\"frozenheader\">\n <tr>\n <th pResizableColumn scope=\"col\"></th>\n <th pResizableColumn *ngFor=\"let col of frozenColumns\" scope=\"col\">{{ col.header }}</th>\n <th pResizableColumn scope=\"col\"></th>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"frozenbody\" let-rowData let-expanded=\"expanded\">\n <tr [pSelectableRow]=\"rowData\">\n <td class=\"col50\" tabindex=\"0\" [sRowToggler]=\"rowData\">\n <i class=\"fa fa-{{ expanded ? 'minus' : 'plus' }} \"></i>\n </td>\n <td *ngFor=\"let col of frozenColumns\" class=\"colText\"\n tooltipPosition=\"top\" showDelay=\"500\"\n [innerHTML]=\"getSpanProp(rowData, col.field)\">\n </td>\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 [model]=\"getActions(rowData)\">\n </s-button>\n </td>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"colgroup\" let-columns>\n <colgroup>\n <col *ngFor=\"let col of columns\" [style.width]=\"col.width\" />\n </colgroup>\n </ng-template>\n\n <ng-template pTemplate=\"header\" let-columns>\n <tr>\n <th *ngFor=\"let col of columns\" scope=\"col\">\n <div class=\"senior-header\">\n <span class=\"senior-header-title\">{{ col.header }}</span>\n </div>\n </th>\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 <td\n *ngFor=\"let col of columns\"\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 <ng-container [ngSwitch]=\"col.type\">\n <ng-container *ngSwitchCase=\"'Text'\">\n <span>{{ rowData[col.field] }}</span>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'Date'\">\n <p-calendar\n [(ngModel)]=\"rowData[col.field]\"\n appendTo=\"body\"\n [showIcon]=\"true\"\n [required]=\"true\"\n pTooltip=\"{{ calendarTooltipText }}\"\n tooltipPosition=\"bottom\"\n [tooltipDisabled]=\"rowData[col.field]\"\n ></p-calendar>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'Autocomplete'\">\n <p-autoComplete\n [(ngModel)]=\"rowData[col.field]\"\n [suggestions]=\"col.options\"\n appendTo=\"body\"\n (completeMethod)=\"filterOptions($event)\"\n [dropdown]=\"true\"\n [forceSelection]=\"true\"\n ></p-autoComplete>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'Decimal'\">\n <div class=\"ui-inputgroup\">\n <span class=\"ui-inputgroup-addon\"\n *ngIf=\"'MONETARIO' === rowData.tiposDados[col.field]\"\n >R$</span>\n <input sNumberInput [scale]=\"2\"\n alignTo=\"right\"\n thousandsSeparator=\".\"\n pInputText\n [(ngModel)]=\"rowData[col.field]\"\n (keydown)=\"onTab($event)\"\n />\n <span class=\"ui-inputgroup-addon\"\n *ngIf=\"'PERCENTUAL' === rowData.tiposDados[col.field]\"\n >%</span>\n </div>\n </ng-container>\n\n <ng-container *ngSwitchDefault>\n <input pInputText type=\"text\"\n [(ngModel)]=\"rowData[col.field]\"\n (keydown)=\"onTab($event)\"\n />\n </ng-container>\n </ng-container>\n </div>\n </ng-template>\n\n <ng-template pTemplate=\"output\">\n <div [innerHTML]=\"getSpanProp(rowData, col.field, col.type)\"></div>\n </ng-template>\n </p-cellEditor>\n </td>\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 <th *ngFor=\"let col of columns\" 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 </tr>\n </ng-template>\n\n <ng-template pTemplate=\"body\" let-rowData let-columns=\"columns\">\n <tr [pSelectableRow]=\"rowData\">\n <td *ngFor=\"let col of columns\" class=\"colText\">\n {{ formatData(col, rowData[col.field]) }}\n </td>\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",
|
|
727
|
-
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}"]
|
|
728
|
-
})
|
|
729
|
-
], GridEditableNestedComponent);
|
|
730
|
-
|
|
731
|
-
let GridEditableNestedModule = class GridEditableNestedModule {
|
|
732
|
-
};
|
|
733
|
-
GridEditableNestedModule = __decorate([
|
|
734
|
-
NgModule({
|
|
735
|
-
imports: [
|
|
736
|
-
CommonModule,
|
|
737
|
-
LocaleModule.forChild(),
|
|
738
|
-
TranslateModule.forChild(),
|
|
739
|
-
ButtonModule,
|
|
740
|
-
TableModule$1,
|
|
741
|
-
TooltipModule,
|
|
742
|
-
LoadingStateModule,
|
|
743
|
-
NumberInputModule,
|
|
744
|
-
BreadcrumbModule,
|
|
745
|
-
ControlErrorsModule,
|
|
746
|
-
CustomFieldsModule,
|
|
747
|
-
DynamicFormModule,
|
|
748
|
-
EmptyStateModule,
|
|
749
|
-
TokenListModule,
|
|
750
|
-
// PrimeNG modules
|
|
751
|
-
ToastModule,
|
|
752
|
-
TableModule,
|
|
753
|
-
TooltipModule$1,
|
|
754
|
-
PanelModule,
|
|
755
|
-
InputTextModule,
|
|
756
|
-
ConfirmDialogModule,
|
|
757
|
-
CalendarModule,
|
|
758
|
-
DropdownModule,
|
|
759
|
-
SharedModule,
|
|
760
|
-
AutoCompleteModule,
|
|
761
|
-
CheckboxModule,
|
|
762
|
-
// Angular modules
|
|
763
|
-
FormsModule,
|
|
764
|
-
ReactiveFormsModule
|
|
765
|
-
],
|
|
766
|
-
declarations: [
|
|
767
|
-
GridEditableNestedComponent,
|
|
768
|
-
],
|
|
769
|
-
providers: [],
|
|
770
|
-
exports: [
|
|
771
|
-
GridEditableNestedComponent,
|
|
772
|
-
],
|
|
773
|
-
})
|
|
774
|
-
], GridEditableNestedModule);
|
|
775
|
-
|
|
776
|
-
var TmsxAngularComponentsModule_1;
|
|
777
|
-
const HostProjectConfigsInjectionToken = new InjectionToken("hostProjectConfigs");
|
|
778
|
-
let TmsxAngularComponentsModule = TmsxAngularComponentsModule_1 = class TmsxAngularComponentsModule {
|
|
779
|
-
static forRoot(config) {
|
|
780
|
-
return {
|
|
781
|
-
ngModule: TmsxAngularComponentsModule_1,
|
|
782
|
-
providers: [
|
|
783
|
-
{
|
|
784
|
-
provide: HostProjectConfigsInjectionToken,
|
|
785
|
-
useValue: config
|
|
786
|
-
}
|
|
787
|
-
]
|
|
788
|
-
};
|
|
789
|
-
}
|
|
790
|
-
};
|
|
791
|
-
TmsxAngularComponentsModule = TmsxAngularComponentsModule_1 = __decorate([
|
|
792
|
-
NgModule({})
|
|
793
|
-
], TmsxAngularComponentsModule);
|
|
794
|
-
|
|
795
|
-
const fallback = {
|
|
796
|
-
"tmsx_fnd.tmsx_angular_components.add": "Adicionar",
|
|
797
|
-
"tmsx_fnd.tmsx_angular_components.audit_created_by": "Criado por {{nome}} em {{data}} às {{hora}}.",
|
|
798
|
-
"tmsx_fnd.tmsx_angular_components.audit_modified_by": "Modificado por {{nome}} em {{data}} às {{hora}}.",
|
|
799
|
-
"tmsx_fnd.tmsx_angular_components.audit_inactivated_by": "Inativado por {{nome}} em {{data}} às {{hora}}.",
|
|
800
|
-
"tmsx_fnd.tmsx_angular_components.condicao_valor_lookup_condicional_no_audit": "Sem informações de auditoria",
|
|
801
|
-
"tmsx_fnd.tmsx_angular_components.delete": "Excluir",
|
|
802
|
-
"tmsx_fnd.tmsx_angular_components.edit": "Editar",
|
|
803
|
-
"tmsx_fnd.tmsx_angular_components.error_forbidden_description": "Você não tem permissão para acessar este recurso.",
|
|
804
|
-
"tmsx_fnd.tmsx_angular_components.error_forbidden_title": "Acesso Negado",
|
|
805
|
-
"tmsx_fnd.tmsx_angular_components.error_not_found_description": "O recurso solicitado não foi encontrado.",
|
|
806
|
-
"tmsx_fnd.tmsx_angular_components.error_not_found_title": "Não Encontrado",
|
|
807
|
-
"tmsx_fnd.tmsx_angular_components.error_unauthorized_description": "Você não está autorizado a acessar este recurso.",
|
|
808
|
-
"tmsx_fnd.tmsx_angular_components.error_unauthorized_title": "Não Autorizado",
|
|
809
|
-
"tmsx_fnd.tmsx_angular_components.grid_aninhada": "Grid Aninhada",
|
|
810
|
-
"tmsx_fnd.tmsx_angular_components.grid_editable_nested_calendar_required": "É necessário informar a data",
|
|
811
|
-
"tmsx_fnd.tmsx_angular_components.grid_editable_nested_cancelar": "Cancelar",
|
|
812
|
-
"tmsx_fnd.tmsx_angular_components.grid_editable_nested_editar": "Editar valores",
|
|
813
|
-
"tmsx_fnd.tmsx_angular_components.grid_editable_nested_paging": "registros encontrados",
|
|
814
|
-
"tmsx_fnd.tmsx_angular_components.grid_editable_nested_salvar": "Salvar alterações",
|
|
815
|
-
"tmsx_fnd.tmsx_angular_components.list_grid_boolean_false": "Não",
|
|
816
|
-
"tmsx_fnd.tmsx_angular_components.list_grid_boolean_true": "Sim",
|
|
817
|
-
"tmsx_fnd.tmsx_angular_components.list_grid_empty_field": "Não informado",
|
|
818
|
-
"tmsx_fnd.tmsx_angular_components.painel_processamento": "Painel de Processamento",
|
|
819
|
-
"tmsx_fnd.tmsx_angular_components.painel_processamento_api_error": "API de envio não definida",
|
|
820
|
-
"tmsx_fnd.tmsx_angular_components.painel_processamento_status_failed": "Ocorreu um erro",
|
|
821
|
-
"tmsx_fnd.tmsx_angular_components.painel_processamento_status_pending": "Pendente",
|
|
822
|
-
"tmsx_fnd.tmsx_angular_components.painel_processamento_status_processing": "Processando",
|
|
823
|
-
"tmsx_fnd.tmsx_angular_components.painel_processamento_status_success": "Finalizado com sucesso",
|
|
824
|
-
"tmsx_fnd.tmsx_angular_components.registro": "Registro",
|
|
825
|
-
"tmsx_fnd.tmsx_angular_components.showcase_painel_processamento_title": "Demonstração do Painel de Processamento",
|
|
826
|
-
"tmsx_fnd.tmsx_angular_components.showcase_table_title": "Demonstração da Tabela",
|
|
827
|
-
"tmsx_fnd.tmsx_angular_components.showcase_title": "Showcase",
|
|
828
|
-
"tmsx_fnd.tmsx_angular_components.situacao_ativo_false": "Inativo",
|
|
829
|
-
"tmsx_fnd.tmsx_angular_components.situacao_ativo_true": "Ativo",
|
|
830
|
-
"tmsx_fnd.tmsx_angular_components.status": "Situação",
|
|
831
|
-
"tmsx_fnd.tmsx_angular_components.total_records": "{{ value }} registros encontrados"
|
|
832
|
-
};
|
|
833
|
-
|
|
834
|
-
/**
|
|
835
|
-
* Generated bundle index. Do not edit.
|
|
836
|
-
*/
|
|
837
|
-
|
|
838
|
-
export { GridEditableNestedComponent, GridEditableNestedModule, HostProjectConfigsInjectionToken, PainelProcessamentoComponent, PainelProcessamentoModule, TmsxAngularComponentsModule, UtilsService, fallback };
|
|
839
|
-
//# sourceMappingURL=seniorsistemas-tmsx-angular-components.js.map
|