sf-crud 12.0.1-beta9 → 12.0.2
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/bundles/sf-crud.umd.js +1221 -125
- package/bundles/sf-crud.umd.js.map +1 -1
- package/esm2015/lib/components/control/control.component.js +114 -12
- package/esm2015/lib/components/registro/registro.component.js +307 -43
- package/esm2015/lib/components/registro-child/registro-child.component.js +328 -0
- package/esm2015/lib/components/registro-detalle/registro-detalle.component.js +232 -0
- package/esm2015/lib/components/tablero/tablero.component.js +81 -19
- package/esm2015/lib/sf-crud.module.js +24 -13
- package/esm2015/lib/sf-crud.service.js +16 -2
- package/esm2015/lib/shared/models/crud-config.model.js +51 -0
- package/esm2015/lib/shared/models/data-temp-crud.model.js +6 -0
- package/esm2015/lib/shared/models/shema.model.js +7 -0
- package/esm2015/lib/shared/services/general.service.js +1 -1
- package/esm2015/public-api.js +2 -1
- package/fesm2015/sf-crud.js +1074 -91
- package/fesm2015/sf-crud.js.map +1 -1
- package/lib/components/control/control.component.d.ts +16 -3
- package/lib/components/registro/registro.component.d.ts +45 -10
- package/lib/components/registro-child/registro-child.component.d.ts +47 -0
- package/lib/components/registro-detalle/registro-detalle.component.d.ts +36 -0
- package/lib/components/tablero/tablero.component.d.ts +17 -4
- package/lib/sf-crud.module.d.ts +76 -74
- package/lib/sf-crud.service.d.ts +4 -0
- package/lib/shared/{services/models → models}/crud-config.model.d.ts +18 -2
- package/lib/shared/models/data-temp-crud.model.d.ts +4 -0
- package/lib/shared/{services/models → models}/shema.model.d.ts +1 -0
- package/lib/shared/services/general.service.d.ts +1 -1
- package/package.json +1 -1
- package/public-api.d.ts +1 -0
- package/esm2015/lib/shared/services/models/crud-config.model.js +0 -43
- package/esm2015/lib/shared/services/models/shema.model.js +0 -7
package/fesm2015/sf-crud.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Injectable, Component, Input,
|
|
2
|
+
import { Injectable, EventEmitter, Component, Input, Output, NgModule } from '@angular/core';
|
|
3
|
+
import * as _ from 'lodash';
|
|
4
|
+
import * as jsonpath from 'jsonpath';
|
|
3
5
|
import { __awaiter } from 'tslib';
|
|
4
6
|
import * as i1 from '@angular/common/http';
|
|
5
7
|
import { HttpClientModule } from '@angular/common/http';
|
|
@@ -10,30 +12,41 @@ import * as i4 from 'primeng/toolbar';
|
|
|
10
12
|
import { ToolbarModule } from 'primeng/toolbar';
|
|
11
13
|
import * as i5 from 'primeng/table';
|
|
12
14
|
import { TableModule } from 'primeng/table';
|
|
13
|
-
import * as i6 from '
|
|
14
|
-
import
|
|
15
|
+
import * as i6 from 'primeng/splitbutton';
|
|
16
|
+
import { SplitButtonModule } from 'primeng/splitbutton';
|
|
17
|
+
import * as i7 from '@angular/common';
|
|
18
|
+
import * as i2$1 from 'primeng/api';
|
|
15
19
|
import { MessageService } from 'primeng/api';
|
|
16
|
-
import * as
|
|
20
|
+
import * as i9 from 'primeng/button';
|
|
17
21
|
import { ButtonModule } from 'primeng/button';
|
|
18
|
-
import * as
|
|
22
|
+
import * as i10 from 'primeng/ripple';
|
|
19
23
|
import { RippleModule } from 'primeng/ripple';
|
|
20
|
-
import * as
|
|
24
|
+
import * as i11 from 'primeng/inputtext';
|
|
21
25
|
import { InputTextModule } from 'primeng/inputtext';
|
|
22
|
-
import * as
|
|
23
|
-
import {
|
|
24
|
-
import * as
|
|
25
|
-
import * as
|
|
26
|
+
import * as i1$1 from 'primeng/dynamicdialog';
|
|
27
|
+
import { DialogService, DynamicDialogConfig, DynamicDialogRef, DynamicDialogModule } from 'primeng/dynamicdialog';
|
|
28
|
+
import * as moment from 'moment';
|
|
29
|
+
import * as i3$2 from 'primeng/toast';
|
|
26
30
|
import { ToastModule } from 'primeng/toast';
|
|
27
|
-
import * as i2$
|
|
31
|
+
import * as i2$2 from 'primeng/inputmask';
|
|
32
|
+
import { InputMaskModule } from 'primeng/inputmask';
|
|
33
|
+
import * as i3$1 from 'primeng/dropdown';
|
|
28
34
|
import { DropdownModule } from 'primeng/dropdown';
|
|
29
|
-
import * as
|
|
35
|
+
import * as i4$1 from 'primeng/autocomplete';
|
|
30
36
|
import { AutoCompleteModule } from 'primeng/autocomplete';
|
|
31
|
-
import * as
|
|
37
|
+
import * as i5$1 from 'primeng/calendar';
|
|
32
38
|
import { CalendarModule } from 'primeng/calendar';
|
|
33
|
-
import * as
|
|
39
|
+
import * as i6$1 from 'primeng/inputnumber';
|
|
34
40
|
import { InputNumberModule } from 'primeng/inputnumber';
|
|
35
|
-
import * as i7 from '
|
|
41
|
+
import * as i7$1 from 'primeng/fileupload';
|
|
42
|
+
import { FileUploadModule } from 'primeng/fileupload';
|
|
43
|
+
import * as i8 from 'primeng/inputswitch';
|
|
44
|
+
import { InputSwitchModule } from 'primeng/inputswitch';
|
|
45
|
+
import * as i10$1 from '@angular/forms';
|
|
36
46
|
import { FormsModule } from '@angular/forms';
|
|
47
|
+
import * as i12 from 'primeng/inputtextarea';
|
|
48
|
+
import { InputTextareaModule } from 'primeng/inputtextarea';
|
|
49
|
+
import Swal from 'sweetalert2';
|
|
37
50
|
import { AccordionModule } from 'primeng/accordion';
|
|
38
51
|
import { AvatarGroupModule } from 'primeng/avatargroup';
|
|
39
52
|
import { AvatarModule } from 'primeng/avatar';
|
|
@@ -45,7 +58,6 @@ import { CascadeSelectModule } from 'primeng/cascadeselect';
|
|
|
45
58
|
import { CheckboxModule } from 'primeng/checkbox';
|
|
46
59
|
import { ChipModule } from 'primeng/chip';
|
|
47
60
|
import { ChipsModule } from 'primeng/chips';
|
|
48
|
-
import { CodeHighlighterModule } from 'primeng/codehighlighter';
|
|
49
61
|
import { ColorPickerModule } from 'primeng/colorpicker';
|
|
50
62
|
import { ConfirmDialogModule } from 'primeng/confirmdialog';
|
|
51
63
|
import { ConfirmPopupModule } from 'primeng/confirmpopup';
|
|
@@ -53,14 +65,9 @@ import { ContextMenuModule } from 'primeng/contextmenu';
|
|
|
53
65
|
import { DialogModule } from 'primeng/dialog';
|
|
54
66
|
import { DividerModule } from 'primeng/divider';
|
|
55
67
|
import { FieldsetModule } from 'primeng/fieldset';
|
|
56
|
-
import { FileUploadModule } from 'primeng/fileupload';
|
|
57
68
|
import { GalleriaModule } from 'primeng/galleria';
|
|
58
69
|
import { InplaceModule } from 'primeng/inplace';
|
|
59
|
-
import { InputMaskModule } from 'primeng/inputmask';
|
|
60
|
-
import { InputSwitchModule } from 'primeng/inputswitch';
|
|
61
|
-
import { InputTextareaModule } from 'primeng/inputtextarea';
|
|
62
70
|
import { KnobModule } from 'primeng/knob';
|
|
63
|
-
import { LightboxModule } from 'primeng/lightbox';
|
|
64
71
|
import { ListboxModule } from 'primeng/listbox';
|
|
65
72
|
import { MegaMenuModule } from 'primeng/megamenu';
|
|
66
73
|
import { MenubarModule } from 'primeng/menubar';
|
|
@@ -92,6 +99,7 @@ import { TerminalModule } from 'primeng/terminal';
|
|
|
92
99
|
import { TieredMenuModule } from 'primeng/tieredmenu';
|
|
93
100
|
import { TimelineModule } from 'primeng/timeline';
|
|
94
101
|
import { ToggleButtonModule } from 'primeng/togglebutton';
|
|
102
|
+
import { TooltipModule } from 'primeng/tooltip';
|
|
95
103
|
import { TreeModule } from 'primeng/tree';
|
|
96
104
|
|
|
97
105
|
class Shema {
|
|
@@ -115,8 +123,8 @@ class ConfigTablero {
|
|
|
115
123
|
this.endpoint = '';
|
|
116
124
|
this.method = '';
|
|
117
125
|
this.server = '';
|
|
118
|
-
this.key = '';
|
|
119
126
|
this.filters = [];
|
|
127
|
+
this.keys = [];
|
|
120
128
|
}
|
|
121
129
|
}
|
|
122
130
|
class ConfigRegistro {
|
|
@@ -141,6 +149,14 @@ class Validations {
|
|
|
141
149
|
this.server = '';
|
|
142
150
|
this.endpoint = '';
|
|
143
151
|
}
|
|
152
|
+
}
|
|
153
|
+
class RequestChecking {
|
|
154
|
+
constructor(dynamics, statics, swal, redirect) {
|
|
155
|
+
this.dynamics = dynamics;
|
|
156
|
+
this.statics = statics;
|
|
157
|
+
this.swal = swal;
|
|
158
|
+
this.redirect = redirect;
|
|
159
|
+
}
|
|
144
160
|
}
|
|
145
161
|
|
|
146
162
|
class GeneralService {
|
|
@@ -196,6 +212,8 @@ class TableroComponent {
|
|
|
196
212
|
this.opciones = [];
|
|
197
213
|
this.idEntidad = '';
|
|
198
214
|
this.idKatios = '';
|
|
215
|
+
this.onSelectAction = new EventEmitter();
|
|
216
|
+
this.items = [];
|
|
199
217
|
this.crudConfig = new CrudConfig();
|
|
200
218
|
this.enProceso = false;
|
|
201
219
|
this.data = [];
|
|
@@ -210,7 +228,6 @@ class TableroComponent {
|
|
|
210
228
|
.then(res => {
|
|
211
229
|
this.crudConfig = res;
|
|
212
230
|
this.getInfoTablero(this.crudConfig.tablero);
|
|
213
|
-
this.loadOptions();
|
|
214
231
|
})
|
|
215
232
|
.catch(err => {
|
|
216
233
|
console.log(err);
|
|
@@ -218,9 +235,15 @@ class TableroComponent {
|
|
|
218
235
|
});
|
|
219
236
|
}
|
|
220
237
|
getInfoTablero(configTablero) {
|
|
221
|
-
this.generalService.genericRequest(configTablero.method, configTablero.server, configTablero.endpoint)
|
|
238
|
+
this.generalService.genericRequest(configTablero.method, configTablero.server, this.aplyKeys(configTablero.keys, configTablero.endpoint, this.dataExt))
|
|
222
239
|
.then((res) => {
|
|
223
|
-
|
|
240
|
+
let aux;
|
|
241
|
+
if (!Array.isArray(res))
|
|
242
|
+
aux = res.data;
|
|
243
|
+
else
|
|
244
|
+
aux = res;
|
|
245
|
+
this.generateData(aux);
|
|
246
|
+
this.loadOptions();
|
|
224
247
|
this.enProceso = false;
|
|
225
248
|
})
|
|
226
249
|
.catch(err => {
|
|
@@ -228,11 +251,27 @@ class TableroComponent {
|
|
|
228
251
|
this.enProceso = false;
|
|
229
252
|
});
|
|
230
253
|
}
|
|
254
|
+
generateData(data) {
|
|
255
|
+
data.forEach((item) => {
|
|
256
|
+
let newItem = {};
|
|
257
|
+
this.crudConfig.tablero.columns.forEach(col => {
|
|
258
|
+
newItem[col.col] = this.getValue(col.col, item);
|
|
259
|
+
});
|
|
260
|
+
this.data.push(newItem);
|
|
261
|
+
});
|
|
262
|
+
console.log(this.data);
|
|
263
|
+
}
|
|
264
|
+
getValue(path, item) {
|
|
265
|
+
if (path.includes("."))
|
|
266
|
+
return jsonpath.query(item, path)[0];
|
|
267
|
+
return item[path];
|
|
268
|
+
}
|
|
231
269
|
loadOptions() {
|
|
270
|
+
this.items = [];
|
|
232
271
|
this.btn.create = this.opciones.find(x => x.label == 'Crear');
|
|
233
|
-
this.
|
|
234
|
-
|
|
235
|
-
|
|
272
|
+
this.opciones.filter((opc) => opc.valor.action).forEach(opc => {
|
|
273
|
+
this.items.push({ label: opc.label, icon: opc.icon, command: () => this.execAction(opc.valor) });
|
|
274
|
+
});
|
|
236
275
|
}
|
|
237
276
|
redirect(accion, data) {
|
|
238
277
|
var _a, _b;
|
|
@@ -241,21 +280,52 @@ class TableroComponent {
|
|
|
241
280
|
this.router.navigateByUrl(((_b = (_a = this.btn.create) === null || _a === void 0 ? void 0 : _a.valor) === null || _b === void 0 ? void 0 : _b.redirect) || '');
|
|
242
281
|
break;
|
|
243
282
|
case 'read':
|
|
244
|
-
this.router.navigateByUrl(this.btn.read.valor.redirect
|
|
283
|
+
this.router.navigateByUrl(this.aplyKeys(this.crudConfig.tablero.keys, this.btn.read.valor.redirect, data));
|
|
245
284
|
break;
|
|
246
285
|
case 'update':
|
|
247
|
-
this.router.navigateByUrl(this.btn.update.valor.redirect
|
|
286
|
+
this.router.navigateByUrl(this.aplyKeys(this.crudConfig.tablero.keys, this.btn.update.valor.redirect, data));
|
|
248
287
|
break;
|
|
249
288
|
case 'delete':
|
|
250
|
-
this.router.navigateByUrl(this.btn.delete.valor.redirect
|
|
289
|
+
this.router.navigateByUrl(this.aplyKeys(this.crudConfig.tablero.keys, this.btn.delete.valor.redirect, data));
|
|
251
290
|
break;
|
|
252
291
|
default:
|
|
253
292
|
break;
|
|
254
293
|
}
|
|
255
294
|
}
|
|
295
|
+
aplyKeys(keys, endpoint, data) {
|
|
296
|
+
keys.forEach(key => {
|
|
297
|
+
var _a, _b, _c, _d;
|
|
298
|
+
switch (key.key) {
|
|
299
|
+
case '@ndoc':
|
|
300
|
+
endpoint = endpoint.replace(key.key, ((_b = (_a = this.user) === null || _a === void 0 ? void 0 : _a.UsuarioSistema) === null || _b === void 0 ? void 0 : _b.NDOC) || '');
|
|
301
|
+
break;
|
|
302
|
+
case '@tdoc':
|
|
303
|
+
endpoint = endpoint.replace(key.key, ((_d = (_c = this.user) === null || _c === void 0 ? void 0 : _c.UsuarioSistema) === null || _d === void 0 ? void 0 : _d.TDOC) || '');
|
|
304
|
+
break;
|
|
305
|
+
case '@idKatios':
|
|
306
|
+
endpoint = endpoint.replace(key.key, this.idKatios);
|
|
307
|
+
break;
|
|
308
|
+
default:
|
|
309
|
+
if (endpoint.includes(key.key) && data)
|
|
310
|
+
endpoint = endpoint.replace(key.key, jsonpath.query(data, (key === null || key === void 0 ? void 0 : key.scope) || '')[0]);
|
|
311
|
+
break;
|
|
312
|
+
}
|
|
313
|
+
});
|
|
314
|
+
return endpoint;
|
|
315
|
+
}
|
|
316
|
+
execAction(params) {
|
|
317
|
+
switch (params.action) {
|
|
318
|
+
case 'redirect':
|
|
319
|
+
this.router.navigateByUrl(this.aplyKeys(this.crudConfig.tablero.keys, params.link, this.itemSelected));
|
|
320
|
+
break;
|
|
321
|
+
default:
|
|
322
|
+
this.onSelectAction.emit({ data: _.cloneDeep(this.itemSelected), params });
|
|
323
|
+
break;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
256
326
|
}
|
|
257
327
|
TableroComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: TableroComponent, deps: [{ token: GeneralService }, { token: i2.Router }], target: i0.ɵɵFactoryTarget.Component });
|
|
258
|
-
TableroComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: TableroComponent, selector: "sf-crudtablero", inputs: { opciones: "opciones", idEntidad: "idEntidad", idKatios: "idKatios" }, ngImport: i0, template: "<p-blockUI [blocked]=\"enProceso\">\r\n <i class=\"pi pi-cog pi-spin\" style=\"font-size: 50px\"></i>\r\n</p-blockUI>\r\n\r\n<div class=\"card\" *ngIf=\"!enProceso\">\r\n <p-toolbar styleClass=\"mb-4 gap-2\">\r\n <ng-template pTemplate=\"left\">\r\n <button *ngIf=\"btn.create\" pButton pRipple [label]=\"btn.create.label\" [icon]=\"btn.create.icon\"\r\n class=\"p-button-success mr-2\" (click)=\"redirect('create')\"></button>\r\n </ng-template>\r\n </p-toolbar>\r\n <p-table #dt [columns]=\"crudConfig.tablero.columns\" [value]=\"data\" [rowHover]=\"true\" [rows]=\"10\" [paginator]=\"true\"\r\n [globalFilterFields]=\"crudConfig.tablero?.filters || []\" [tableStyle]=\"{'min-width': '75rem'}\"\r\n currentPageReportTemplate=\"Registro {first} al {last} de {totalRecords}
|
|
328
|
+
TableroComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: TableroComponent, selector: "sf-crudtablero", inputs: { opciones: "opciones", idEntidad: "idEntidad", idKatios: "idKatios", user: "user", dataExt: "dataExt" }, outputs: { onSelectAction: "onSelectAction" }, ngImport: i0, template: "<p-blockUI [blocked]=\"enProceso\">\r\n <i class=\"pi pi-cog pi-spin\" style=\"font-size: 50px\"></i>\r\n</p-blockUI>\r\n\r\n<div class=\"card\" *ngIf=\"!enProceso\">\r\n <p-toolbar styleClass=\"mb-4 gap-2\">\r\n <ng-template pTemplate=\"left\">\r\n <button *ngIf=\"btn.create\" pButton pRipple [label]=\"btn.create.label\" [icon]=\"btn.create.icon\"\r\n class=\"p-button-success mr-2\" (click)=\"redirect('create')\"></button>\r\n </ng-template>\r\n </p-toolbar>\r\n <p-table #dt [columns]=\"crudConfig.tablero.columns\" [value]=\"data\" [rowHover]=\"true\" [rows]=\"10\" [paginator]=\"true\"\r\n [globalFilterFields]=\"crudConfig.tablero?.filters || []\" [tableStyle]=\"{'min-width': '75rem'}\"\r\n currentPageReportTemplate=\"Registro {first} al {last} de {totalRecords}\" [showCurrentPageReport]=\"true\">\r\n <ng-template pTemplate=\"caption\">\r\n <div class=\"flex align-items-center justify-content-between\">\r\n <h5 class=\"m-0\">{{crudConfig.tablero?.label || idEntidad}}</h5>\r\n <span class=\"p-input-icon-left\">\r\n <i class=\"pi pi-search\"></i>\r\n <input pInputText type=\"text\" (input)=\"dt.filterGlobal($event.target.value, 'contains')\"\r\n placeholder=\"Buscar...\" />\r\n </span>\r\n </div>\r\n </ng-template>\r\n <ng-template pTemplate=\"header\" let-columns>\r\n <tr>\r\n <th *ngFor=\"let col of columns\">\r\n {{col.label}}\r\n </th>\r\n <th>Acci\u00F3n</th>\r\n </tr>\r\n </ng-template>\r\n <ng-template pTemplate=\"body\" let-rowData let-columns=\"columns\">\r\n <tr>\r\n <ng-container *ngFor=\"let col of columns\" [ngSwitch]=\"col.type\">\r\n <td *ngSwitchCase=\"'text'\">{{rowData[col.col]}}</td>\r\n <td *ngSwitchCase=\"'date:yyyy-mm-dd'\">{{rowData[col.col] | date: 'yyyy-MM-dd'}}</td>\r\n <td *ngSwitchCase=\"'currency:USD'\">{{rowData[col.col] | currency: 'USD'}}</td>\r\n </ng-container>\r\n <td>\r\n <p-splitButton icon=\"pi pi-align-justify\" [model]=\"items\" appendTo=\"body\"\r\n (onDropdownClick)=\"itemSelected = rowData\"></p-splitButton>\r\n </td>\r\n </tr>\r\n </ng-template>\r\n </p-table>\r\n</div>", components: [{ type: i3.BlockUI, selector: "p-blockUI", inputs: ["target", "autoZIndex", "baseZIndex", "styleClass", "blocked"] }, { type: i4.Toolbar, selector: "p-toolbar", inputs: ["style", "styleClass"] }, { type: i5.Table, selector: "p-table", inputs: ["frozenColumns", "frozenValue", "style", "styleClass", "tableStyle", "tableStyleClass", "paginator", "pageLinks", "rowsPerPageOptions", "alwaysShowPaginator", "paginatorPosition", "paginatorDropdownAppendTo", "paginatorDropdownScrollHeight", "currentPageReportTemplate", "showCurrentPageReport", "showJumpToPageDropdown", "showFirstLastIcon", "showPageLinks", "defaultSortOrder", "sortMode", "resetPageOnSort", "selectionMode", "contextMenuSelection", "contextMenuSelectionMode", "dataKey", "metaKeySelection", "rowTrackBy", "lazy", "lazyLoadOnInit", "compareSelectionBy", "csvSeparator", "exportFilename", "filters", "globalFilterFields", "filterDelay", "filterLocale", "expandedRowKeys", "editingRowKeys", "rowExpandMode", "scrollable", "scrollDirection", "rowGroupMode", "scrollHeight", "virtualScroll", "virtualScrollDelay", "virtualRowHeight", "frozenWidth", "responsive", "contextMenu", "resizableColumns", "columnResizeMode", "reorderableColumns", "loading", "loadingIcon", "showLoader", "rowHover", "customSort", "showInitialSortBadge", "autoLayout", "exportFunction", "stateKey", "stateStorage", "editMode", "groupRowsBy", "minBufferPx", "maxBufferPx", "responsiveLayout", "breakpoint", "value", "columns", "first", "rows", "totalRecords", "sortField", "sortOrder", "multiSortMeta", "selection"], outputs: ["selectionChange", "contextMenuSelectionChange", "onRowSelect", "onRowUnselect", "onPage", "onSort", "onFilter", "onLazyLoad", "onRowExpand", "onRowCollapse", "onContextMenuSelect", "onColResize", "onColReorder", "onRowReorder", "onEditInit", "onEditComplete", "onEditCancel", "onHeaderCheckboxToggle", "sortFunction", "firstChange", "rowsChange", "onStateSave", "onStateRestore"] }, { type: i6.SplitButton, selector: "p-splitButton", inputs: ["model", "icon", "iconPos", "label", "style", "styleClass", "menuStyle", "menuStyleClass", "disabled", "tabindex", "appendTo", "dir", "showTransitionOptions", "hideTransitionOptions"], outputs: ["onClick", "onDropdownClick"] }], directives: [{ type: i7.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2$1.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { type: i9.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { type: i10.Ripple, selector: "[pRipple]" }, { type: i11.InputText, selector: "[pInputText]" }, { type: i7.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i7.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i7.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }], pipes: { "date": i7.DatePipe, "currency": i7.CurrencyPipe } });
|
|
259
329
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: TableroComponent, decorators: [{
|
|
260
330
|
type: Component,
|
|
261
331
|
args: [{
|
|
@@ -268,6 +338,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
|
|
|
268
338
|
type: Input
|
|
269
339
|
}], idKatios: [{
|
|
270
340
|
type: Input
|
|
341
|
+
}], user: [{
|
|
342
|
+
type: Input
|
|
343
|
+
}], dataExt: [{
|
|
344
|
+
type: Input
|
|
345
|
+
}], onSelectAction: [{
|
|
346
|
+
type: Output
|
|
271
347
|
}] } });
|
|
272
348
|
|
|
273
349
|
class ControlComponent {
|
|
@@ -276,22 +352,56 @@ class ControlComponent {
|
|
|
276
352
|
this.control = new Shema();
|
|
277
353
|
this.label = '';
|
|
278
354
|
this.setValue = new EventEmitter();
|
|
355
|
+
this.sendNotification = new EventEmitter();
|
|
356
|
+
this.sendObject = new EventEmitter();
|
|
279
357
|
this.isLoading = false;
|
|
280
358
|
this.dataFromService = [];
|
|
359
|
+
this.uploadedFiles = [];
|
|
360
|
+
this.displayAdd = false;
|
|
361
|
+
this.tempValue = {};
|
|
281
362
|
}
|
|
282
363
|
ngOnInit() {
|
|
283
364
|
var _a;
|
|
284
365
|
if (((_a = this.control) === null || _a === void 0 ? void 0 : _a.config) && this.control.subtype == 'dropdown')
|
|
285
366
|
this.loadDataFromService();
|
|
367
|
+
if (this.value && this.control.subtype == 'autocomplete')
|
|
368
|
+
this.setDefaultValue();
|
|
369
|
+
if (this.value && this.control.type == 'date')
|
|
370
|
+
this.setDate();
|
|
286
371
|
}
|
|
287
372
|
sendValue() {
|
|
288
373
|
this.setValue.emit(this.value);
|
|
289
374
|
}
|
|
290
|
-
sendValueFromObject() {
|
|
291
|
-
|
|
375
|
+
sendValueFromObject(event) {
|
|
376
|
+
switch (typeof (this.control.config.optionValue)) {
|
|
377
|
+
case 'object':
|
|
378
|
+
this.control.config.optionValue.forEach((op) => op['value'] = event[op.key]);
|
|
379
|
+
this.setValue.emit(this.control.config.optionValue);
|
|
380
|
+
break;
|
|
381
|
+
default:
|
|
382
|
+
this.setValue.emit(event[this.control.config.optionValue]);
|
|
383
|
+
break;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
validateValue(type) {
|
|
387
|
+
switch (type) {
|
|
388
|
+
case 'email':
|
|
389
|
+
let regex = new RegExp(/([\w\.\-_]+)?\w+@[\w-_]+(\.\w+){1,}/igm);
|
|
390
|
+
if (regex.test(this.value))
|
|
391
|
+
this.sendValue();
|
|
392
|
+
else {
|
|
393
|
+
this.value = null;
|
|
394
|
+
this.sendValue();
|
|
395
|
+
this.sendNotification.emit({ severity: 'warn', detail: 'El correo no es válido' });
|
|
396
|
+
}
|
|
397
|
+
break;
|
|
398
|
+
default:
|
|
399
|
+
break;
|
|
400
|
+
}
|
|
292
401
|
}
|
|
293
402
|
loadDataFromService() {
|
|
294
403
|
this.isLoading = true;
|
|
404
|
+
this.dataFromService = [];
|
|
295
405
|
this.generalService.genericRequest(this.control.config.method, this.control.config.server, this.control.config.endpoint)
|
|
296
406
|
.then((res) => {
|
|
297
407
|
this.dataFromService = res.data;
|
|
@@ -306,9 +416,64 @@ class ControlComponent {
|
|
|
306
416
|
this.isLoading = false;
|
|
307
417
|
});
|
|
308
418
|
}
|
|
419
|
+
onUpload(event) {
|
|
420
|
+
let file = event.files[0];
|
|
421
|
+
let formData = new FormData();
|
|
422
|
+
let path = 'Imagenes/CRUD/temp';
|
|
423
|
+
formData.append('uploadFile', file);
|
|
424
|
+
formData.append('Ruta', `/${path}`);
|
|
425
|
+
this.isLoading = true;
|
|
426
|
+
this.generalService.genericRequest(this.control.config.method, this.control.config.server, this.control.config.endpoint, formData)
|
|
427
|
+
.then(() => {
|
|
428
|
+
this.sendNotification.emit({ severity: 'info', detail: `Archivo cargado correctamente!` });
|
|
429
|
+
this.uploadedFiles.push(file);
|
|
430
|
+
this.isLoading = false;
|
|
431
|
+
this.value = `${this.generalService.jsonConfig.Server}${path}/${file.name}`;
|
|
432
|
+
this.sendValue();
|
|
433
|
+
})
|
|
434
|
+
.catch(err => {
|
|
435
|
+
console.log(err);
|
|
436
|
+
this.isLoading = false;
|
|
437
|
+
this.sendNotification.emit({ severity: 'error', detail: `Error al cargar el archivo!` });
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
refresData() {
|
|
441
|
+
var _a, _b;
|
|
442
|
+
if ((_b = (_a = this.control) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.endpointtemp)
|
|
443
|
+
this.loadDataFromService();
|
|
444
|
+
}
|
|
445
|
+
setDefaultValue() {
|
|
446
|
+
var _a;
|
|
447
|
+
Object.defineProperty(this.tempValue, (_a = this.control.config) === null || _a === void 0 ? void 0 : _a.optionLabel, { value: this.value, writable: true, enumerable: true, configurable: true });
|
|
448
|
+
}
|
|
449
|
+
searchValue(value) {
|
|
450
|
+
let endpoint = this.control.config.endpoint.replace('@id', value);
|
|
451
|
+
this.generalService.genericRequest(this.control.config.method, this.control.config.server, endpoint)
|
|
452
|
+
.then((res) => {
|
|
453
|
+
var _a;
|
|
454
|
+
if (((_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
455
|
+
this.sendObject.emit({ data: res.data[0], optionValue: this.control.config.optionValue });
|
|
456
|
+
}
|
|
457
|
+
else {
|
|
458
|
+
this.sendNotification.emit({ severity: 'warn', detail: `Valor no encontrado.` });
|
|
459
|
+
this.sendObject.emit({ data: null, optionValue: this.control.config.optionValue });
|
|
460
|
+
}
|
|
461
|
+
})
|
|
462
|
+
.catch(err => {
|
|
463
|
+
console.log(err);
|
|
464
|
+
this.sendNotification.emit({ severity: 'error', detail: `Error al consumir el servicio.` });
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
setDate() {
|
|
468
|
+
let format = this.control.formatMoment;
|
|
469
|
+
if (format && this.value) {
|
|
470
|
+
this.value = moment(this.value, format).toDate();
|
|
471
|
+
this.sendValue();
|
|
472
|
+
}
|
|
473
|
+
}
|
|
309
474
|
}
|
|
310
475
|
ControlComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ControlComponent, deps: [{ token: GeneralService }], target: i0.ɵɵFactoryTarget.Component });
|
|
311
|
-
ControlComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: ControlComponent, selector: "sf-control", inputs: { control: "control", label: "label", value: "value" }, outputs: { setValue: "setValue" }, ngImport: i0, template: "<ng-container [ngSwitch]=\"control.type\">\r\n <label>{{label}}</label>\r\n <ng-container *ngSwitchCase=\"'string'\">\r\n <ng-container [ngSwitch]=\"control.subtype\">\r\n <ng-container *ngSwitchCase=\"'input'\">\r\n <input pInputText type=\"text\" [(ngModel)]=\"value\" (focusout)=\"sendValue()\">\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'password'\">\r\n <input pInputText type=\"password\" [(ngModel)]=\"value\" (focusout)=\"sendValue()\">\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'email'\">\r\n <input pInputText type=\"email\" [(ngModel)]=\"value\" (focusout)=\"sendValue()\">\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'phone'\">\r\n <input pInputText type=\"tel\" [(ngModel)]=\"value\" (focusout)=\"sendValue()\">\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'enum'\">\r\n <p-dropdown [options]=\"control.enum\" [(ngModel)]=\"value\" (onChange)=\"sendValue()\"\r\n placeholder=\"Seleccione una opci\u00F3n\"></p-dropdown>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'dropdown'\">\r\n <p-dropdown [lazy]=\"isLoading\" [options]=\"dataFromService\" [(ngModel)]=\"value\" (onChange)=\"sendValue()\"\r\n [optionLabel]=\"control.config.optionLabel\" [optionValue]=\"control.config.optionValue\"\r\n placeholder=\"Seleccione una opci\u00F3n\"></p-dropdown>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'autocomplete'\">\r\n <p-autoComplete [(ngModel)]=\"value\" [showEmptyMessage]=\"true\" [suggestions]=\"dataFromService\"\r\n (completeMethod)=\"loadDataFromControlBusquedaService($event)\" [field]=\"control.field\"\r\n [minLength]=\"1\" (onSelect)=\"sendValueFromObject()\"></p-autoComplete>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'date'\">\r\n <ng-container [ngSwitch]=\"control.subtype\">\r\n <ng-container *ngSwitchCase=\"'calendar'\">\r\n <p-calendar [(ngModel)]=\"value\" (onSelect)=\"sendValue()\"\r\n [format]=\"control?.format || 'yy-mm-dd'\"></p-calendar>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'numeric'\">\r\n <ng-container [ngSwitch]=\"control.subtype\">\r\n <ng-container *ngSwitchCase=\"'currency'\">\r\n <p-inputNumber [(ngModel)]=\"value\" mode=\"currency\" [minFractionDigits]=\"control?.minFractionDigits || 0\"\r\n (onChange)=\"sendValue()\" [currency]=\"control?.currency || 'USD'\"></p-inputNumber>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'decimal'\">\r\n <p-inputNumber [(ngModel)]=\"value\" mode=\"decimal\" (onChange)=\"sendValue()\"\r\n [minFractionDigits]=\"control?.minFractionDigits || 0\"></p-inputNumber>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'percentage'\">\r\n <p-inputNumber [(ngModel)]=\"value\" suffix=\" %\" (onChange)=\"sendValue()\"\r\n [minFractionDigits]=\"control?.minFractionDigits || 2\"></p-inputNumber>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n</ng-container>", components: [{ type: i2$1.Dropdown, selector: "p-dropdown", inputs: ["scrollHeight", "resetFilterOnHide", "dropdownIcon", "optionGroupChildren", "autoDisplayFirst", "emptyFilterMessage", "emptyMessage", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "filterMatchMode", "tooltip", "tooltipPosition", "tooltipPositionStyle", "autofocusFilter", "disabled", "options", "filterValue", "filter", "name", "style", "panelStyle", "styleClass", "panelStyleClass", "readonly", "required", "editable", "appendTo", "tabindex", "placeholder", "filterPlaceholder", "filterLocale", "inputId", "selectId", "dataKey", "filterBy", "autofocus", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "group", "showClear", "virtualScroll", "itemSize", "ariaFilterLabel", "ariaLabelledBy", "maxlength", "tooltipStyleClass"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onShow", "onHide"] }, { type: i3$2.AutoComplete, selector: "p-autoComplete", inputs: ["minLength", "delay", "type", "autoZIndex", "baseZIndex", "dropdownIcon", "unique", "completeOnFocus", "scrollHeight", "dropdownMode", "showTransitionOptions", "hideTransitionOptions", "autocomplete", "suggestions", "disabled", "style", "panelStyle", "styleClass", "panelStyleClass", "inputStyle", "inputId", "inputStyleClass", "placeholder", "readonly", "virtualScroll", "itemSize", "maxlength", "name", "required", "size", "appendTo", "autoHighlight", "forceSelection", "ariaLabel", "ariaLabelledBy", "group", "field", "dropdown", "showEmptyMessage", "multiple", "tabindex", "dataKey", "emptyMessage", "autofocus", "optionGroupChildren", "optionGroupLabel"], outputs: ["completeMethod", "onSelect", "onUnselect", "onFocus", "onBlur", "onDropdownClick", "onClear", "onKeyUp", "onShow", "onHide"] }, { type: i4$1.Calendar, selector: "p-calendar", inputs: ["dateFormat", "multipleSeparator", "rangeSeparator", "inline", "showOtherMonths", "icon", "shortYearCutoff", "hourFormat", "stepHour", "stepMinute", "stepSecond", "showSeconds", "showOnFocus", "showWeek", "dataType", "selectionMode", "todayButtonStyleClass", "clearButtonStyleClass", "autoZIndex", "baseZIndex", "keepInvalid", "hideOnDateTimeSelect", "numberOfMonths", "view", "timeSeparator", "focusTrap", "firstDayOfWeek", "showTransitionOptions", "hideTransitionOptions", "defaultDate", "minDate", "maxDate", "disabledDates", "disabledDays", "yearRange", "showTime", "locale", "disabled", "style", "styleClass", "inputStyle", "inputId", "name", "inputStyleClass", "placeholder", "ariaLabelledBy", "selectOtherMonths", "showIcon", "appendTo", "readonlyInput", "monthNavigator", "yearNavigator", "timeOnly", "required", "maxDateCount", "showButtonBar", "panelStyleClass", "panelStyle", "touchUI", "tabindex"], outputs: ["onFocus", "onBlur", "onClose", "onSelect", "onInput", "onTodayClick", "onClearClick", "onMonthChange", "onYearChange", "onClickOutside", "onShow"] }, { type: i5$1.InputNumber, selector: "p-inputNumber", inputs: ["showButtons", "format", "buttonLayout", "incrementButtonIcon", "decrementButtonIcon", "step", "locale", "localeMatcher", "mode", "currency", "currencyDisplay", "useGrouping", "minFractionDigits", "maxFractionDigits", "prefix", "suffix", "disabled", "inputId", "styleClass", "style", "placeholder", "size", "maxlength", "tabindex", "title", "ariaLabel", "ariaRequired", "name", "required", "autocomplete", "min", "max", "incrementButtonClass", "decrementButtonClass", "inputStyle", "inputStyleClass"], outputs: ["onInput", "onFocus", "onBlur", "onKeyDown"] }], directives: [{ type: i6.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i6.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i7.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i10.InputText, selector: "[pInputText]" }, { type: i7.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i7.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
|
|
476
|
+
ControlComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: ControlComponent, selector: "sf-control", inputs: { control: "control", label: "label", value: "value", appendTo: "appendTo" }, outputs: { setValue: "setValue", sendNotification: "sendNotification", sendObject: "sendObject" }, ngImport: i0, template: "<ng-container [ngSwitch]=\"control.type\" #cc>\r\n <label [for]=\"label\" style=\"width: -webkit-fill-available;\">{{label}}</label>\r\n <ng-container *ngSwitchCase=\"'string'\">\r\n <ng-container [ngSwitch]=\"control.subtype\">\r\n <ng-container *ngSwitchCase=\"'input'\">\r\n <input pInputText type=\"text\" [(ngModel)]=\"value\" (focusout)=\"sendValue()\"\r\n [disabled]=\"control?.disabled || false\">\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'textarea'\">\r\n <textarea [rows]=\"control?.rows ? control.rows : 4\" \r\n [(ngModel)]=\"value\" (focusout)=\"sendValue()\" pInputTextarea \r\n [disabled]=\"control?.disabled || false\" [autoResize]=\"control?.autoresize || false\"></textarea>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'password'\">\r\n <input pInputText type=\"password\" [(ngModel)]=\"value\" (focusout)=\"sendValue()\"\r\n [disabled]=\"control?.disabled || false\">\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'email'\">\r\n <input pInputText type=\"text\" [(ngModel)]=\"value\" placeholder=\"email@example.com\"\r\n (focusout)=\"validateValue('email')\" [disabled]=\"control?.disabled || false\">\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'phone'\">\r\n <p-inputMask mask=\"(999) 999-9999\" [(ngModel)]=\"value\" placeholder=\"(999) 999-9999\"\r\n (focusout)=\"sendValue()\" [disabled]=\"control?.disabled || false\" [unmask]=\"control.unmask || false\"></p-inputMask>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'enum'\">\r\n <p-dropdown [options]=\"control.enum\" [(ngModel)]=\"value\" (onChange)=\"sendValue()\" appendTo=\"body\"\r\n placeholder=\"Seleccione una opci\u00F3n\" [disabled]=\"control?.disabled || false\"></p-dropdown>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'dropdown'\">\r\n <p-dropdown [lazy]=\"isLoading\" [options]=\"dataFromService\" [(ngModel)]=\"value\" (onChange)=\"sendValue()\"\r\n [optionLabel]=\"control.config.optionLabel\"\r\n [optionValue]=\"control?.field || control.config.optionValue\" (onClick)=\"refresData()\"\r\n appendTo=\"body\" placeholder=\"Seleccione una opci\u00F3n\"\r\n [disabled]=\"control?.disabled || false\"></p-dropdown>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'dropdown:replace'\">\r\n <p-dropdown [lazy]=\"isLoading\" [options]=\"dataFromService\"\r\n (onChange)=\"sendValueFromObject($event.value)\" [optionLabel]=\"control.config.optionLabel\"\r\n (onClick)=\"refresData()\" appendTo=\"body\" placeholder=\"Seleccione una opci\u00F3n\"\r\n [disabled]=\"control?.disabled || false\"></p-dropdown>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'autocomplete'\">\r\n <p-autoComplete [showEmptyMessage]=\"true\" [suggestions]=\"dataFromService\" appendTo=\"body\"\r\n (completeMethod)=\"loadDataFromControlBusquedaService($event)\" [field]=\"control.field\"\r\n [minLength]=\"1\" (onSelect)=\"sendValueFromObject($event.value)\" [(ngModel)]=\"tempValue\"\r\n [disabled]=\"control?.disabled || false\"></p-autoComplete>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'input:search'\">\r\n <div class=\"p-inputgroup\">\r\n <input type=\"text\" pInputText [(ngModel)]=\"value\" (focusout)=\"sendValue()\" />\r\n <button type=\"button\" pButton icon=\"pi pi-search\" (click)=\"searchValue(value)\"></button>\r\n </div>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'date'\">\r\n <ng-container [ngSwitch]=\"control.subtype\">\r\n <ng-container *ngSwitchCase=\"'calendar'\">\r\n <p-calendar [(ngModel)]=\"value\" (onSelect)=\"sendValue()\" (onBlur)=\"sendValue()\" [monthNavigator]=\"true\"\r\n [yearNavigator]=\"true\" yearRange=\"1900:2035\" [dateFormat]=\"control?.format || 'yy-mm-dd'\"\r\n appendTo=\"body\" [disabled]=\"control?.disabled || false\" [showOnFocus]=\"!control?.hide\"\r\n [placeholder]=\"control?.placeholder || 'aaaa-mm-dd'\" [touchUI]=\"control?.touchUI || false\"\r\n [showIcon]=\"control?.showIcon || false\"></p-calendar>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'numeric'\">\r\n <ng-container [ngSwitch]=\"control.subtype\">\r\n <ng-container *ngSwitchCase=\"'currency'\">\r\n <p-inputNumber [(ngModel)]=\"value\" mode=\"currency\" [minFractionDigits]=\"control?.minFractionDigits || 0\"\r\n [min]=\"control?.min || null\" [max]=\"control?.max || null\" (focusout)=\"sendValue()\" [locale]=\"control?.locale || undefined\"\r\n [currency]=\"control?.currency || 'USD'\" [disabled]=\"control?.disabled || false\"></p-inputNumber>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'decimal'\">\r\n <p-inputNumber [(ngModel)]=\"value\" mode=\"decimal\" (focusout)=\"sendValue()\" [min]=\"control?.min || null\"\r\n [max]=\"control?.max || null\" [minFractionDigits]=\"control?.minFractionDigits || 0\" [locale]=\"control?.locale || undefined\"\r\n [disabled]=\"control?.disabled || false\"></p-inputNumber>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'percentage'\">\r\n <p-inputNumber [(ngModel)]=\"value\" suffix=\" %\" (focusout)=\"sendValue()\" [min]=\"control?.min || null\"\r\n [max]=\"control?.max || null\" [minFractionDigits]=\"control?.minFractionDigits || 2\" [locale]=\"control?.locale || undefined\"\r\n [disabled]=\"control?.disabled || false\"></p-inputNumber>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'decimal:search'\">\r\n <div class=\"p-inputgroup\">\r\n <input type=\"number\" pInputText [(ngModel)]=\"value\" (focusout)=\"sendValue()\" />\r\n <button type=\"button\" pButton icon=\"pi pi-search\" (click)=\"searchValue(value)\"></button>\r\n </div>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'file'\">\r\n <ng-container [ngSwitch]=\"control.subtype\">\r\n <ng-container *ngSwitchCase=\"'filetmp'\">\r\n <p-fileUpload [accept]=\"control.config.accept\" [customUpload]=\"true\" (uploadHandler)=\"onUpload($event)\"\r\n [maxFileSize]=\"control.config?.maxFileSize || null\" fileLimit=\"1\">\r\n <ng-template pTemplate=\"content\">\r\n <ul *ngIf=\"uploadedFiles.length\">\r\n <li *ngFor=\"let file of uploadedFiles\">{{file.name}} - {{file.size}} bytes</li>\r\n </ul>\r\n </ng-template>\r\n </p-fileUpload>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'boolean'\">\r\n <ng-container [ngSwitch]=\"control.subtype\">\r\n <ng-container *ngSwitchCase=\"'switch'\">\r\n <p-inputSwitch [(ngModel)]=\"value\" (onChange)=\"sendValue()\" [id]=\"label\"></p-inputSwitch>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n</ng-container>", components: [{ type: i2$2.InputMask, selector: "p-inputMask", inputs: ["type", "slotChar", "autoClear", "style", "inputId", "styleClass", "placeholder", "size", "maxlength", "tabindex", "title", "ariaLabel", "ariaRequired", "disabled", "readonly", "unmask", "name", "required", "characterPattern", "autoFocus", "autocomplete", "mask"], outputs: ["onComplete", "onFocus", "onBlur", "onInput", "onKeydown"] }, { type: i3$1.Dropdown, selector: "p-dropdown", inputs: ["scrollHeight", "filter", "name", "style", "panelStyle", "styleClass", "panelStyleClass", "readonly", "required", "editable", "appendTo", "tabindex", "placeholder", "filterPlaceholder", "filterLocale", "inputId", "selectId", "dataKey", "filterBy", "autofocus", "resetFilterOnHide", "dropdownIcon", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "autoDisplayFirst", "group", "showClear", "emptyFilterMessage", "emptyMessage", "virtualScroll", "itemSize", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "ariaFilterLabel", "ariaLabelledBy", "filterMatchMode", "maxlength", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "autofocusFilter", "disabled", "options", "filterValue"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onShow", "onHide"] }, { type: i4$1.AutoComplete, selector: "p-autoComplete", inputs: ["minLength", "delay", "style", "panelStyle", "styleClass", "panelStyleClass", "inputStyle", "inputId", "inputStyleClass", "placeholder", "readonly", "disabled", "virtualScroll", "itemSize", "maxlength", "name", "required", "size", "appendTo", "autoHighlight", "forceSelection", "type", "autoZIndex", "baseZIndex", "ariaLabel", "ariaLabelledBy", "dropdownIcon", "unique", "group", "completeOnFocus", "field", "scrollHeight", "dropdown", "showEmptyMessage", "dropdownMode", "multiple", "tabindex", "dataKey", "emptyMessage", "showTransitionOptions", "hideTransitionOptions", "autofocus", "autocomplete", "optionGroupChildren", "optionGroupLabel", "suggestions"], outputs: ["completeMethod", "onSelect", "onUnselect", "onFocus", "onBlur", "onDropdownClick", "onClear", "onKeyUp", "onShow", "onHide"] }, { type: i5$1.Calendar, selector: "p-calendar", inputs: ["style", "styleClass", "inputStyle", "inputId", "name", "inputStyleClass", "placeholder", "ariaLabelledBy", "disabled", "dateFormat", "multipleSeparator", "rangeSeparator", "inline", "showOtherMonths", "selectOtherMonths", "showIcon", "icon", "appendTo", "readonlyInput", "shortYearCutoff", "monthNavigator", "yearNavigator", "hourFormat", "timeOnly", "stepHour", "stepMinute", "stepSecond", "showSeconds", "required", "showOnFocus", "showWeek", "dataType", "selectionMode", "maxDateCount", "showButtonBar", "todayButtonStyleClass", "clearButtonStyleClass", "autoZIndex", "baseZIndex", "panelStyleClass", "panelStyle", "keepInvalid", "hideOnDateTimeSelect", "numberOfMonths", "view", "touchUI", "timeSeparator", "focusTrap", "firstDayOfWeek", "showTransitionOptions", "hideTransitionOptions", "tabindex", "defaultDate", "minDate", "maxDate", "disabledDates", "disabledDays", "yearRange", "showTime", "locale"], outputs: ["onFocus", "onBlur", "onClose", "onSelect", "onInput", "onTodayClick", "onClearClick", "onMonthChange", "onYearChange", "onClickOutside", "onShow"] }, { type: i6$1.InputNumber, selector: "p-inputNumber", inputs: ["showButtons", "format", "buttonLayout", "inputId", "styleClass", "style", "placeholder", "size", "maxlength", "tabindex", "title", "ariaLabel", "ariaRequired", "name", "required", "autocomplete", "min", "max", "incrementButtonClass", "decrementButtonClass", "incrementButtonIcon", "decrementButtonIcon", "step", "inputStyle", "inputStyleClass", "locale", "localeMatcher", "mode", "currency", "currencyDisplay", "useGrouping", "minFractionDigits", "maxFractionDigits", "prefix", "suffix", "disabled"], outputs: ["onInput", "onFocus", "onBlur", "onKeyDown"] }, { type: i7$1.FileUpload, selector: "p-fileUpload", inputs: ["name", "url", "method", "multiple", "accept", "disabled", "auto", "withCredentials", "maxFileSize", "invalidFileSizeMessageSummary", "invalidFileSizeMessageDetail", "invalidFileTypeMessageSummary", "invalidFileTypeMessageDetail", "invalidFileLimitMessageDetail", "invalidFileLimitMessageSummary", "style", "styleClass", "previewWidth", "chooseLabel", "uploadLabel", "cancelLabel", "chooseIcon", "uploadIcon", "cancelIcon", "showUploadButton", "showCancelButton", "mode", "headers", "customUpload", "fileLimit", "files"], outputs: ["onBeforeUpload", "onSend", "onUpload", "onError", "onClear", "onRemove", "onSelect", "onProgress", "uploadHandler"] }, { type: i8.InputSwitch, selector: "p-inputSwitch", inputs: ["style", "styleClass", "tabindex", "inputId", "name", "disabled", "readonly", "ariaLabelledBy"], outputs: ["onChange"] }], directives: [{ type: i7.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i7.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i10$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i11.InputText, selector: "[pInputText]" }, { type: i10$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i10$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i12.InputTextarea, selector: "[pInputTextarea]", inputs: ["autoResize"], outputs: ["onResize"] }, { type: i9.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { type: i10$1.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { type: i2$1.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { type: i7.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i7.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
|
|
312
477
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ControlComponent, decorators: [{
|
|
313
478
|
type: Component,
|
|
314
479
|
args: [{
|
|
@@ -321,45 +486,636 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
|
|
|
321
486
|
type: Input
|
|
322
487
|
}], value: [{
|
|
323
488
|
type: Input
|
|
489
|
+
}], appendTo: [{
|
|
490
|
+
type: Input
|
|
324
491
|
}], setValue: [{
|
|
325
492
|
type: Output
|
|
493
|
+
}], sendNotification: [{
|
|
494
|
+
type: Output
|
|
495
|
+
}], sendObject: [{
|
|
496
|
+
type: Output
|
|
326
497
|
}] } });
|
|
327
498
|
|
|
499
|
+
class RegistroDetalleComponent {
|
|
500
|
+
constructor(ref, config, messageService) {
|
|
501
|
+
this.ref = ref;
|
|
502
|
+
this.config = config;
|
|
503
|
+
this.messageService = messageService;
|
|
504
|
+
this.esquema = new Shema();
|
|
505
|
+
}
|
|
506
|
+
ngOnInit() {
|
|
507
|
+
var _a;
|
|
508
|
+
this.uiEsquema = this.config.data.uiEsquema[0];
|
|
509
|
+
this.esquema = this.config.data.esquema;
|
|
510
|
+
this.data = (_a = this.config.data) === null || _a === void 0 ? void 0 : _a.data;
|
|
511
|
+
if (!this.data) {
|
|
512
|
+
this.data = this.createObject(this.esquema);
|
|
513
|
+
jsonpath.value(this.data, '$..id', this.config.data.id);
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
getControl(scope) {
|
|
517
|
+
return jsonpath.query(this.esquema, scope)[0];
|
|
518
|
+
}
|
|
519
|
+
getValue(scope) {
|
|
520
|
+
return jsonpath.query(this.data, scope.replace('.properties', ''))[0];
|
|
521
|
+
}
|
|
522
|
+
setValue(value, scope) {
|
|
523
|
+
switch (typeof (value)) {
|
|
524
|
+
case 'object':
|
|
525
|
+
if (Array.isArray(value))
|
|
526
|
+
value.forEach((val) => jsonpath.value(this.data, val.scope.replace('.properties', ''), val.value));
|
|
527
|
+
else
|
|
528
|
+
jsonpath.value(this.data, scope.replace('.properties', ''), value);
|
|
529
|
+
break;
|
|
530
|
+
default:
|
|
531
|
+
jsonpath.value(this.data, scope.replace('.properties', ''), value);
|
|
532
|
+
break;
|
|
533
|
+
}
|
|
534
|
+
this.applyValuesOnEvent('onChange', this.esquema, scope.replace('$..properties.', ''));
|
|
535
|
+
}
|
|
536
|
+
createObject(esquema) {
|
|
537
|
+
let object = {};
|
|
538
|
+
const resultArray = [];
|
|
539
|
+
switch (esquema.type) {
|
|
540
|
+
case 'numeric':
|
|
541
|
+
return (esquema === null || esquema === void 0 ? void 0 : esquema.default) || 0;
|
|
542
|
+
case 'string':
|
|
543
|
+
case 'date':
|
|
544
|
+
return (esquema === null || esquema === void 0 ? void 0 : esquema.default) ? this.setDefaultValue(esquema.default) : null;
|
|
545
|
+
case 'boolean':
|
|
546
|
+
return (esquema === null || esquema === void 0 ? void 0 : esquema.default) || false;
|
|
547
|
+
case 'file':
|
|
548
|
+
return null;
|
|
549
|
+
case 'array':
|
|
550
|
+
case 'object':
|
|
551
|
+
for (const key in esquema === null || esquema === void 0 ? void 0 : esquema.properties) {
|
|
552
|
+
Object.defineProperty(object, key, { value: this.createObject(esquema === null || esquema === void 0 ? void 0 : esquema.properties[key]), writable: true, enumerable: true, configurable: true });
|
|
553
|
+
}
|
|
554
|
+
break;
|
|
555
|
+
default:
|
|
556
|
+
break;
|
|
557
|
+
}
|
|
558
|
+
return object;
|
|
559
|
+
}
|
|
560
|
+
setDefaultValue(value) {
|
|
561
|
+
let data = null;
|
|
562
|
+
let uactivo;
|
|
563
|
+
switch (value) {
|
|
564
|
+
case '@uactivo':
|
|
565
|
+
uactivo = JSON.parse(localStorage.getItem('oSessionTFM') || '{}');
|
|
566
|
+
if (!uactivo)
|
|
567
|
+
console.log('Validar configuracion de sesion');
|
|
568
|
+
else
|
|
569
|
+
data = `${uactivo.UsuarioSistema.TDOC}-${uactivo.UsuarioSistema.NDOC}`;
|
|
570
|
+
break;
|
|
571
|
+
case '@tdocactivo':
|
|
572
|
+
uactivo = JSON.parse(sessionStorage.getItem('usrSesion') || '{}');
|
|
573
|
+
if (!uactivo)
|
|
574
|
+
console.log('Validar configuracion de sesion');
|
|
575
|
+
else
|
|
576
|
+
data = uactivo.UsuarioSistema.TDOC;
|
|
577
|
+
break;
|
|
578
|
+
case '@ndocactivo':
|
|
579
|
+
uactivo = JSON.parse(sessionStorage.getItem('usrSesion') || '{}');
|
|
580
|
+
if (!uactivo)
|
|
581
|
+
console.log('Validar configuracion de sesion');
|
|
582
|
+
else
|
|
583
|
+
data = uactivo.UsuarioSistema.NDOC;
|
|
584
|
+
break;
|
|
585
|
+
case '@hoy':
|
|
586
|
+
data = new Date();
|
|
587
|
+
break;
|
|
588
|
+
default:
|
|
589
|
+
data = value;
|
|
590
|
+
break;
|
|
591
|
+
}
|
|
592
|
+
return data;
|
|
593
|
+
}
|
|
594
|
+
submit() {
|
|
595
|
+
this.applyValuesOnEvent('onSubmit', this.esquema);
|
|
596
|
+
if (!this.validateData())
|
|
597
|
+
return;
|
|
598
|
+
this.ref.close(this.data);
|
|
599
|
+
}
|
|
600
|
+
cancel() {
|
|
601
|
+
this.applyValuesOnEvent('onCancel', this.esquema);
|
|
602
|
+
this.ref.close();
|
|
603
|
+
}
|
|
604
|
+
validateData() {
|
|
605
|
+
if (this.esquema.validations.type == 'local')
|
|
606
|
+
return this.validateDataLocal();
|
|
607
|
+
return true;
|
|
608
|
+
}
|
|
609
|
+
validateDataLocal() {
|
|
610
|
+
let err = [];
|
|
611
|
+
this.esquema.validations.required.forEach((x) => {
|
|
612
|
+
if (!jsonpath.query(this.data, x.field)[0])
|
|
613
|
+
err.push(x.message);
|
|
614
|
+
});
|
|
615
|
+
if (err.length != 0)
|
|
616
|
+
this.messageService.add({ severity: 'warn', detail: err.join('. ') });
|
|
617
|
+
return err.length == 0;
|
|
618
|
+
}
|
|
619
|
+
applyValuesOnEvent(event, esquema, scope) {
|
|
620
|
+
if (scope) {
|
|
621
|
+
if (esquema.properties[scope][event]) {
|
|
622
|
+
esquema.properties[scope][event].forEach((value) => {
|
|
623
|
+
this.setValueEvent(this.data, value);
|
|
624
|
+
});
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
else {
|
|
628
|
+
for (const key in esquema.properties) {
|
|
629
|
+
if (esquema.properties[key][event]) {
|
|
630
|
+
esquema.properties[key][event].forEach((value) => {
|
|
631
|
+
this.setValueEvent(this.data, value);
|
|
632
|
+
});
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
setValueEvent(data, params) {
|
|
638
|
+
var _a;
|
|
639
|
+
let value;
|
|
640
|
+
let date = moment(new Date());
|
|
641
|
+
switch (params.op) {
|
|
642
|
+
case 'sum':
|
|
643
|
+
value = jsonpath.query(data, params === null || params === void 0 ? void 0 : params.scope[0]).reduce((acc, cur) => acc += (params === null || params === void 0 ? void 0 : params.key) ? cur[params.key] : cur, 0);
|
|
644
|
+
break;
|
|
645
|
+
case 'concat':
|
|
646
|
+
let array = [];
|
|
647
|
+
(_a = params === null || params === void 0 ? void 0 : params.key) === null || _a === void 0 ? void 0 : _a.reduce((acc, cur) => {
|
|
648
|
+
array.push(jsonpath.query(data, cur)[0]);
|
|
649
|
+
}, []);
|
|
650
|
+
if (params === null || params === void 0 ? void 0 : params.separator)
|
|
651
|
+
jsonpath.value(data, params.scope[0], array.join((params === null || params === void 0 ? void 0 : params.separator) || ' '));
|
|
652
|
+
break;
|
|
653
|
+
case 'enable':
|
|
654
|
+
jsonpath.value(this.esquema, params.scope[0], false);
|
|
655
|
+
break;
|
|
656
|
+
case 'disabled':
|
|
657
|
+
jsonpath.value(this.esquema, params.scope[0], true);
|
|
658
|
+
break;
|
|
659
|
+
case 'replace:endpoint':
|
|
660
|
+
jsonpath.value(this.esquema, params.scope[0], jsonpath.query(this.esquema, params.scope[1])[0].replace(params.scope[2], jsonpath.query(data, `$..${params.key}`)));
|
|
661
|
+
break;
|
|
662
|
+
case 'setNull':
|
|
663
|
+
jsonpath.value(this.data, `$.${params.key}`, null);
|
|
664
|
+
break;
|
|
665
|
+
case 'datediff:years':
|
|
666
|
+
jsonpath.value(this.data, params.scope[0], date.diff(moment(jsonpath.query(this.data, params.scope[1])[0]), 'years'));
|
|
667
|
+
break;
|
|
668
|
+
case 'datediff:months':
|
|
669
|
+
jsonpath.value(this.data, params.scope[0], date.diff(moment(jsonpath.query(this.data, params.scope[1])[0]), 'months'));
|
|
670
|
+
break;
|
|
671
|
+
case 'datediff:weeks':
|
|
672
|
+
jsonpath.value(this.data, params.scope[0], date.diff(moment(jsonpath.query(this.data, params.scope[1])[0]), 'weeks'));
|
|
673
|
+
break;
|
|
674
|
+
case 'datediff:days':
|
|
675
|
+
jsonpath.value(this.data, params.scope[0], date.diff(moment(jsonpath.query(this.data, params.scope[1])[0]), 'days'));
|
|
676
|
+
break;
|
|
677
|
+
default:
|
|
678
|
+
break;
|
|
679
|
+
}
|
|
680
|
+
return value;
|
|
681
|
+
}
|
|
682
|
+
sendNotification(message) {
|
|
683
|
+
this.messageService.add(message);
|
|
684
|
+
}
|
|
685
|
+
applyValuesFromObject(event) {
|
|
686
|
+
if (event.data)
|
|
687
|
+
event.optionValue.forEach((value) => jsonpath.value(this.data, value.scope.replace('.properties', ''), this.aplyFormatValue(value.scope, event.data[value.key])));
|
|
688
|
+
else
|
|
689
|
+
event.optionValue.forEach((value) => jsonpath.value(this.data, value.scope.replace('.properties', ''), null));
|
|
690
|
+
}
|
|
691
|
+
aplyFormatValue(scope, value) {
|
|
692
|
+
let control = jsonpath.query(this.esquema, scope)[0];
|
|
693
|
+
let resp;
|
|
694
|
+
switch (control.type) {
|
|
695
|
+
case 'date':
|
|
696
|
+
resp = new Date(`${value}`);
|
|
697
|
+
break;
|
|
698
|
+
case 'numeric':
|
|
699
|
+
resp = +value;
|
|
700
|
+
break;
|
|
701
|
+
default:
|
|
702
|
+
resp = value;
|
|
703
|
+
break;
|
|
704
|
+
}
|
|
705
|
+
return resp;
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
RegistroDetalleComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RegistroDetalleComponent, deps: [{ token: i1$1.DynamicDialogRef }, { token: i1$1.DynamicDialogConfig }, { token: i2$1.MessageService }], target: i0.ɵɵFactoryTarget.Component });
|
|
709
|
+
RegistroDetalleComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: RegistroDetalleComponent, selector: "lib-registro-detalle", ngImport: i0, template: "<p-toast></p-toast>\r\n<div *ngFor=\"let element of uiEsquema.elements\" [class]=\"element?.class\" #a>\r\n <ng-container [ngSwitch]=\"element.type\">\r\n <div *ngSwitchCase=\"'Label'\" [style]=\"element?.style\">\r\n {{element?.label}}\r\n </div>\r\n <ng-container *ngSwitchCase=\"'HorizontalLayout'\">\r\n <div *ngFor=\"let el of element.elements\" [class]=\"el?.class\">\r\n <ng-container [ngSwitch]=\"el.type\">\r\n <sf-control *ngSwitchCase=\"'Control'\" [control]=\"getControl(el.scope)\" [label]=\"el.label\"\r\n [value]=\"getValue(el.scope)\" (setValue)=\"setValue($event, el.scope)\"\r\n (sendNotification)=\"sendNotification($event)\" (sendObject)=\"applyValuesFromObject($event)\"></sf-control>\r\n </ng-container>\r\n </div>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'VerticalLayout'\">\r\n <div *ngFor=\"let el of element.elements\" [class]=\"el?.class\">\r\n <ng-container [ngSwitch]=\"el.type\">\r\n <sf-control *ngSwitchCase=\"'Control'\" [control]=\"getControl(el.scope)\" [label]=\"el.label\"\r\n [value]=\"getValue(el.scope)\" (setValue)=\"setValue($event, el.scope)\"\r\n (sendNotification)=\"sendNotification($event)\" (sendObject)=\"applyValuesFromObject($event)\"></sf-control>\r\n </ng-container>\r\n </div>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'Control'\">\r\n <sf-control [control]=\"getControl(element.scope)\" [label]=\"element.label\"></sf-control>\r\n </ng-container>\r\n </ng-container>\r\n</div>\r\n<div class=\"card-footer mt-2\">\r\n <button pButton pRipple type=\"button\" label=\"Guardar\" (click)=\"submit()\" class=\"mr-2\"></button>\r\n <button pButton pRipple type=\"button\" label=\"Cancelar\" (click)=\"cancel()\" class=\"p-button-danger\"></button>\r\n</div>", styles: [""], components: [{ type: i3$2.Toast, selector: "p-toast", inputs: ["key", "autoZIndex", "baseZIndex", "style", "styleClass", "position", "preventOpenDuplicates", "preventDuplicates", "showTransformOptions", "hideTransformOptions", "showTransitionOptions", "hideTransitionOptions", "breakpoints"], outputs: ["onClose"] }, { type: ControlComponent, selector: "sf-control", inputs: ["control", "label", "value", "appendTo"], outputs: ["setValue", "sendNotification", "sendObject"] }], directives: [{ type: i7.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i7.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i7.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i9.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { type: i10.Ripple, selector: "[pRipple]" }] });
|
|
710
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RegistroDetalleComponent, decorators: [{
|
|
711
|
+
type: Component,
|
|
712
|
+
args: [{
|
|
713
|
+
selector: 'lib-registro-detalle',
|
|
714
|
+
templateUrl: './registro-detalle.component.html',
|
|
715
|
+
styleUrls: ['./registro-detalle.component.css']
|
|
716
|
+
}]
|
|
717
|
+
}], ctorParameters: function () { return [{ type: i1$1.DynamicDialogRef }, { type: i1$1.DynamicDialogConfig }, { type: i2$1.MessageService }]; } });
|
|
718
|
+
|
|
719
|
+
class RegistroChildComponent {
|
|
720
|
+
constructor(ref, config, messageService, dialogService) {
|
|
721
|
+
this.ref = ref;
|
|
722
|
+
this.config = config;
|
|
723
|
+
this.messageService = messageService;
|
|
724
|
+
this.dialogService = dialogService;
|
|
725
|
+
this.esquema = new Shema();
|
|
726
|
+
this.trx = 'c';
|
|
727
|
+
this.controlsLoaded = false;
|
|
728
|
+
}
|
|
729
|
+
ngOnInit() {
|
|
730
|
+
var _a;
|
|
731
|
+
this.uiEsquema = this.config.data.uiEsquema[0];
|
|
732
|
+
this.esquema = this.config.data.esquema;
|
|
733
|
+
this.data = (_a = this.config.data) === null || _a === void 0 ? void 0 : _a.data;
|
|
734
|
+
if (!this.data) {
|
|
735
|
+
this.data = this.createObject(this.esquema);
|
|
736
|
+
jsonpath.value(this.data, '$..id', this.config.data.id);
|
|
737
|
+
}
|
|
738
|
+
this.buildControls();
|
|
739
|
+
}
|
|
740
|
+
buildControls() {
|
|
741
|
+
this.controlsLoaded = false;
|
|
742
|
+
this.controls = [];
|
|
743
|
+
this.values = [];
|
|
744
|
+
this.uiEsquema.elements.forEach((layout, i) => {
|
|
745
|
+
var _a;
|
|
746
|
+
this.controls.push([]);
|
|
747
|
+
this.values.push([]);
|
|
748
|
+
(_a = layout.elements) === null || _a === void 0 ? void 0 : _a.forEach((element) => {
|
|
749
|
+
if (!element.scope)
|
|
750
|
+
console.log("CONFIGURAR BIEN " + element);
|
|
751
|
+
this.controls[i].push(this.getControl(element.scope));
|
|
752
|
+
this.values[i].push(this.getValue(element.scope));
|
|
753
|
+
});
|
|
754
|
+
});
|
|
755
|
+
this.controlsLoaded = true;
|
|
756
|
+
}
|
|
757
|
+
getControl(scope) {
|
|
758
|
+
return jsonpath.query(this.esquema, scope)[0];
|
|
759
|
+
}
|
|
760
|
+
getValue(scope) {
|
|
761
|
+
return jsonpath.query(this.data, scope.replace('.properties', ''))[0];
|
|
762
|
+
}
|
|
763
|
+
setValue(value, scope, i, j) {
|
|
764
|
+
switch (typeof (value)) {
|
|
765
|
+
case 'object':
|
|
766
|
+
if (Array.isArray(value))
|
|
767
|
+
value.forEach((val) => jsonpath.value(this.data, val.scope.replace('.properties', ''), val.value));
|
|
768
|
+
else
|
|
769
|
+
jsonpath.value(this.data, scope.replace('.properties', ''), value);
|
|
770
|
+
break;
|
|
771
|
+
default:
|
|
772
|
+
this.values[i][j] = value;
|
|
773
|
+
jsonpath.value(this.data, scope.replace('.properties', ''), value);
|
|
774
|
+
break;
|
|
775
|
+
}
|
|
776
|
+
this.applyValuesOnEvent('onChange', this.esquema, scope.replace('$..properties.', ''));
|
|
777
|
+
}
|
|
778
|
+
createObject(esquema) {
|
|
779
|
+
let object = {};
|
|
780
|
+
const resultArray = [];
|
|
781
|
+
switch (esquema.type) {
|
|
782
|
+
case 'numeric':
|
|
783
|
+
return (esquema === null || esquema === void 0 ? void 0 : esquema.default) || 0;
|
|
784
|
+
case 'string':
|
|
785
|
+
case 'date':
|
|
786
|
+
return (esquema === null || esquema === void 0 ? void 0 : esquema.default) ? this.setDefaultValue(esquema.default) : null;
|
|
787
|
+
case 'boolean':
|
|
788
|
+
return (esquema === null || esquema === void 0 ? void 0 : esquema.default) || false;
|
|
789
|
+
case 'file':
|
|
790
|
+
return null;
|
|
791
|
+
case 'array':
|
|
792
|
+
case 'object':
|
|
793
|
+
for (const key in esquema === null || esquema === void 0 ? void 0 : esquema.properties) {
|
|
794
|
+
Object.defineProperty(object, key, { value: this.createObjectChild(esquema === null || esquema === void 0 ? void 0 : esquema.properties[key]), writable: true, enumerable: true, configurable: true });
|
|
795
|
+
}
|
|
796
|
+
break;
|
|
797
|
+
default:
|
|
798
|
+
break;
|
|
799
|
+
}
|
|
800
|
+
return object;
|
|
801
|
+
}
|
|
802
|
+
createObjectChild(esquema) {
|
|
803
|
+
let object = {};
|
|
804
|
+
const resultArray = [];
|
|
805
|
+
switch (esquema.type) {
|
|
806
|
+
case 'numeric':
|
|
807
|
+
return (esquema === null || esquema === void 0 ? void 0 : esquema.default) || 0;
|
|
808
|
+
case 'string':
|
|
809
|
+
case 'date':
|
|
810
|
+
return (esquema === null || esquema === void 0 ? void 0 : esquema.default) ? this.setDefaultValue(esquema.default) : null;
|
|
811
|
+
case 'boolean':
|
|
812
|
+
return (esquema === null || esquema === void 0 ? void 0 : esquema.default) || false;
|
|
813
|
+
case 'file':
|
|
814
|
+
return null;
|
|
815
|
+
case 'array':
|
|
816
|
+
return [];
|
|
817
|
+
case 'object':
|
|
818
|
+
for (const key in esquema === null || esquema === void 0 ? void 0 : esquema.properties) {
|
|
819
|
+
Object.defineProperty(object, key, { value: this.createObject(esquema === null || esquema === void 0 ? void 0 : esquema.properties[key]), writable: true, enumerable: true, configurable: true });
|
|
820
|
+
}
|
|
821
|
+
break;
|
|
822
|
+
default:
|
|
823
|
+
break;
|
|
824
|
+
}
|
|
825
|
+
return object;
|
|
826
|
+
}
|
|
827
|
+
setDefaultValue(value) {
|
|
828
|
+
let data = null;
|
|
829
|
+
let uactivo;
|
|
830
|
+
switch (value) {
|
|
831
|
+
case '@uactivo':
|
|
832
|
+
uactivo = JSON.parse(localStorage.getItem('oSessionTFM') || '{}');
|
|
833
|
+
if (!uactivo)
|
|
834
|
+
console.log('Validar configuracion de sesion');
|
|
835
|
+
else
|
|
836
|
+
data = `${uactivo.UsuarioSistema.TDOC}-${uactivo.UsuarioSistema.NDOC}`;
|
|
837
|
+
break;
|
|
838
|
+
case '@tdocactivo':
|
|
839
|
+
uactivo = JSON.parse(sessionStorage.getItem('usrSesion') || '{}');
|
|
840
|
+
if (!uactivo)
|
|
841
|
+
console.log('Validar configuracion de sesion');
|
|
842
|
+
else
|
|
843
|
+
data = uactivo.UsuarioSistema.TDOC;
|
|
844
|
+
break;
|
|
845
|
+
case '@ndocactivo':
|
|
846
|
+
uactivo = JSON.parse(sessionStorage.getItem('usrSesion') || '{}');
|
|
847
|
+
if (!uactivo)
|
|
848
|
+
console.log('Validar configuracion de sesion');
|
|
849
|
+
else
|
|
850
|
+
data = uactivo.UsuarioSistema.NDOC;
|
|
851
|
+
break;
|
|
852
|
+
case '@hoy':
|
|
853
|
+
data = new Date();
|
|
854
|
+
break;
|
|
855
|
+
default:
|
|
856
|
+
data = value;
|
|
857
|
+
break;
|
|
858
|
+
}
|
|
859
|
+
return data;
|
|
860
|
+
}
|
|
861
|
+
submit() {
|
|
862
|
+
this.applyValuesOnEvent('onSubmit', this.esquema);
|
|
863
|
+
if (!this.validateData())
|
|
864
|
+
return;
|
|
865
|
+
this.ref.close(this.data);
|
|
866
|
+
}
|
|
867
|
+
cancel() {
|
|
868
|
+
this.applyValuesOnEvent('onCancel', this.esquema);
|
|
869
|
+
this.ref.close();
|
|
870
|
+
}
|
|
871
|
+
validateData() {
|
|
872
|
+
if (this.esquema.validations.type == 'local')
|
|
873
|
+
return this.validateDataLocal();
|
|
874
|
+
return true;
|
|
875
|
+
}
|
|
876
|
+
validateDataLocal() {
|
|
877
|
+
let err = [];
|
|
878
|
+
this.esquema.validations.required.forEach((x) => {
|
|
879
|
+
if (!jsonpath.query(this.data, x.field)[0])
|
|
880
|
+
err.push(x.message);
|
|
881
|
+
});
|
|
882
|
+
if (err.length != 0)
|
|
883
|
+
this.messageService.add({ severity: 'warn', detail: err.join('. ') });
|
|
884
|
+
return err.length == 0;
|
|
885
|
+
}
|
|
886
|
+
applyValuesOnEvent(event, esquema, scope) {
|
|
887
|
+
if (scope) {
|
|
888
|
+
if (esquema.properties[scope][event]) {
|
|
889
|
+
esquema.properties[scope][event].forEach((value) => {
|
|
890
|
+
this.setValueEvent(this.data, value);
|
|
891
|
+
});
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
else {
|
|
895
|
+
for (const key in esquema.properties) {
|
|
896
|
+
if (esquema.properties[key][event]) {
|
|
897
|
+
esquema.properties[key][event].forEach((value) => {
|
|
898
|
+
this.setValueEvent(this.data, value);
|
|
899
|
+
});
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
setValueEvent(data, params) {
|
|
905
|
+
var _a;
|
|
906
|
+
let value;
|
|
907
|
+
let date = moment(new Date());
|
|
908
|
+
switch (params.op) {
|
|
909
|
+
case 'sum':
|
|
910
|
+
value = jsonpath.query(data, params === null || params === void 0 ? void 0 : params.scope[0]).reduce((acc, cur) => acc += (params === null || params === void 0 ? void 0 : params.key) ? cur[params.key] : cur, 0);
|
|
911
|
+
break;
|
|
912
|
+
case 'concat':
|
|
913
|
+
let array = [];
|
|
914
|
+
(_a = params === null || params === void 0 ? void 0 : params.key) === null || _a === void 0 ? void 0 : _a.reduce((acc, cur) => {
|
|
915
|
+
array.push(jsonpath.query(data, cur)[0]);
|
|
916
|
+
}, []);
|
|
917
|
+
if (params === null || params === void 0 ? void 0 : params.separator)
|
|
918
|
+
jsonpath.value(data, params.scope[0], array.join((params === null || params === void 0 ? void 0 : params.separator) || ' '));
|
|
919
|
+
break;
|
|
920
|
+
case 'enable':
|
|
921
|
+
jsonpath.value(this.esquema, params.scope[0], false);
|
|
922
|
+
break;
|
|
923
|
+
case 'disabled':
|
|
924
|
+
jsonpath.value(this.esquema, params.scope[0], true);
|
|
925
|
+
break;
|
|
926
|
+
case 'replace:endpoint':
|
|
927
|
+
jsonpath.value(this.esquema, params.scope[0], jsonpath.query(this.esquema, params.scope[1])[0].replace(params.scope[2], jsonpath.query(data, `$..${params.key}`)));
|
|
928
|
+
break;
|
|
929
|
+
case 'setNull':
|
|
930
|
+
jsonpath.value(this.data, `$.${params.key}`, null);
|
|
931
|
+
break;
|
|
932
|
+
case 'datediff:years':
|
|
933
|
+
jsonpath.value(this.data, params.scope[0], date.diff(moment(jsonpath.query(this.data, params.scope[1])[0]), 'years'));
|
|
934
|
+
break;
|
|
935
|
+
case 'datediff:months':
|
|
936
|
+
jsonpath.value(this.data, params.scope[0], date.diff(moment(jsonpath.query(this.data, params.scope[1])[0]), 'months'));
|
|
937
|
+
break;
|
|
938
|
+
case 'datediff:weeks':
|
|
939
|
+
jsonpath.value(this.data, params.scope[0], date.diff(moment(jsonpath.query(this.data, params.scope[1])[0]), 'weeks'));
|
|
940
|
+
break;
|
|
941
|
+
case 'datediff:days':
|
|
942
|
+
jsonpath.value(this.data, params.scope[0], date.diff(moment(jsonpath.query(this.data, params.scope[1])[0]), 'days'));
|
|
943
|
+
break;
|
|
944
|
+
default:
|
|
945
|
+
break;
|
|
946
|
+
}
|
|
947
|
+
return value;
|
|
948
|
+
}
|
|
949
|
+
sendNotification(message) {
|
|
950
|
+
this.messageService.add(message);
|
|
951
|
+
}
|
|
952
|
+
addObjectArray(element) {
|
|
953
|
+
this.dialogRef = this.dialogService.open(RegistroDetalleComponent, {
|
|
954
|
+
header: element.label ? element.label : 'Detalle',
|
|
955
|
+
width: '70%',
|
|
956
|
+
modal: true,
|
|
957
|
+
closable: false,
|
|
958
|
+
data: {
|
|
959
|
+
uiEsquema: Object.assign({}, element.elements),
|
|
960
|
+
esquema: this.getControl(element.scope),
|
|
961
|
+
id: this.getValue(element.scope).length + 1
|
|
962
|
+
}
|
|
963
|
+
});
|
|
964
|
+
this.dialogRef.onClose.subscribe((data) => {
|
|
965
|
+
if (data)
|
|
966
|
+
this.data[element.scope.replace('$..properties.', '')].push(data);
|
|
967
|
+
this.applyValuesOnEvent('onChange', this.esquema, element.scope.replace('$..properties.', ''));
|
|
968
|
+
});
|
|
969
|
+
}
|
|
970
|
+
editRow(element, data, index) {
|
|
971
|
+
this.dialogRef = this.dialogService.open(RegistroDetalleComponent, {
|
|
972
|
+
header: element.label ? element.label : 'Detalle',
|
|
973
|
+
width: '70%',
|
|
974
|
+
modal: true,
|
|
975
|
+
closable: false,
|
|
976
|
+
data: {
|
|
977
|
+
uiEsquema: Object.assign({}, element.elements),
|
|
978
|
+
esquema: this.getControl(element.scope),
|
|
979
|
+
data: Object.assign({}, data)
|
|
980
|
+
}
|
|
981
|
+
});
|
|
982
|
+
this.dialogRef.onClose.subscribe((data) => {
|
|
983
|
+
if (data)
|
|
984
|
+
this.data[element.scope.replace('$..properties.', '')][index] = data;
|
|
985
|
+
this.applyValuesOnEvent('onChange', this.esquema, element.scope.replace('$..properties.', ''));
|
|
986
|
+
});
|
|
987
|
+
}
|
|
988
|
+
deleteRow(element, index) {
|
|
989
|
+
this.data[element.scope.replace('$..properties.', '')].splice(index, 1);
|
|
990
|
+
index = 1;
|
|
991
|
+
this.data[element.scope.replace('$..properties.', '')].forEach((el) => {
|
|
992
|
+
el.id = index;
|
|
993
|
+
index++;
|
|
994
|
+
});
|
|
995
|
+
this.applyValuesOnEvent('onChange', this.esquema, element.scope.replace('$..properties.', ''));
|
|
996
|
+
}
|
|
997
|
+
applyValuesFromObject(event) {
|
|
998
|
+
if (event.data)
|
|
999
|
+
event.optionValue.forEach((value) => jsonpath.value(this.data, value.scope.replace('.properties', ''), this.aplyFormatValue(value.scope, event.data[value.key])));
|
|
1000
|
+
else
|
|
1001
|
+
event.optionValue.forEach((value) => jsonpath.value(this.data, value.scope.replace('.properties', ''), null));
|
|
1002
|
+
}
|
|
1003
|
+
aplyFormatValue(scope, value) {
|
|
1004
|
+
let control = jsonpath.query(this.esquema, scope)[0];
|
|
1005
|
+
let resp;
|
|
1006
|
+
switch (control.type) {
|
|
1007
|
+
case 'date':
|
|
1008
|
+
resp = new Date(`${value}`);
|
|
1009
|
+
break;
|
|
1010
|
+
case 'numeric':
|
|
1011
|
+
resp = +value;
|
|
1012
|
+
break;
|
|
1013
|
+
default:
|
|
1014
|
+
resp = value;
|
|
1015
|
+
break;
|
|
1016
|
+
}
|
|
1017
|
+
return resp;
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
RegistroChildComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RegistroChildComponent, deps: [{ token: i1$1.DynamicDialogRef }, { token: i1$1.DynamicDialogConfig }, { token: i2$1.MessageService }, { token: i1$1.DialogService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1021
|
+
RegistroChildComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: RegistroChildComponent, selector: "lib-registro-child", providers: [MessageService, DialogService], ngImport: i0, template: "<p-toast></p-toast>\r\n<div *ngIf=\"controlsLoaded\">\r\n<div *ngFor=\"let element of uiEsquema.elements; let i = index\" [class]=\"element?.class\" #a>\r\n <ng-container [ngSwitch]=\"element.type\">\r\n <div *ngSwitchCase=\"'Label'\" [style]=\"element?.style\">\r\n {{element?.label}}\r\n </div>\r\n <ng-container *ngSwitchCase=\"'HorizontalLayout'\">\r\n <div *ngFor=\"let el of element.elements; let j =index\" [class]=\"el?.class\">\r\n <ng-container [ngSwitch]=\"el.type\">\r\n <sf-control *ngSwitchCase=\"'Control'\" [control]=\"controls[i][j]\" [label]=\"el.label\" [value]=\"values[i][j]\"\r\n (setValue)=\"setValue($event, el.scope, i, j)\" (sendNotification)=\"sendNotification($event)\"\r\n (sendObject)=\"applyValuesFromObject($event)\"></sf-control>\r\n </ng-container>\r\n </div>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'VerticalLayout'\">\r\n <div *ngFor=\"let el of element.elements; let k =index\" [class]=\"el?.class\">\r\n <ng-container [ngSwitch]=\"el.type\">\r\n <sf-control *ngSwitchCase=\"'Control'\" [control]=\"controls[i][k]\" [label]=\"el.label\"\r\n [value]=\"values[i][k]\" (setValue)=\"setValue($event, el.scope, i, k)\"\r\n (sendNotification)=\"sendNotification($event)\"\r\n (sendObject)=\"applyValuesFromObject($event)\"></sf-control>\r\n <ng-container *ngSwitchCase=\"'Table'\">\r\n <p-table [value]=\"getValue(el.scope)\" [columns]=\"getControl(el.scope).config.columns\">\r\n <ng-template pTemplate=\"caption\">\r\n <div class=\"flex align-items-center justify-content-between\">\r\n <button pButton pRipple icon=\"pi pi-plus\" (click)=\"addObjectArray(el)\"\r\n class=\"p-button-success\"></button>\r\n </div>\r\n </ng-template>\r\n <ng-template pTemplate=\"header\" let-columns>\r\n <tr>\r\n <th *ngFor=\"let col of columns\">\r\n {{col.label}}\r\n </th>\r\n <ng-container *ngIf=\"trx == 'c' || trx == 'u'\">\r\n <th></th>\r\n </ng-container>\r\n </tr>\r\n </ng-template>\r\n <ng-template pTemplate=\"body\" let-rowData let-columns=\"columns\" let-rowIndex=\"rowIndex\">\r\n <tr>\r\n <ng-container *ngFor=\"let col of columns\" [ngSwitch]=\"col.type\">\r\n <ng-container *ngSwitchCase=\"'text'\">\r\n <td>{{rowData[col.col]}}</td>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'currency:USD'\">\r\n <td>{{rowData[col.col] | currency: 'USD'}}</td>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'date:yyyy-mm-dd'\">\r\n <td>{{rowData[col.col] | date: 'yyyy-mm-dd'}}</td>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'date:dd/mm/yyyy'\">\r\n <td>{{rowData[col.col] | date: 'dd/MM/yyyy'}}</td>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'boolean'\">\r\n <td>\r\n <i *ngIf=\"rowData[col.col]\" class=\"pi pi-check\"></i>\r\n <i *ngIf=\"!rowData[col.col]\" class=\"pi pi-times\"></i>\r\n </td>\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"trx == 'c' || trx == 'u'\">\r\n <td>\r\n <button pButton pRipple type=\"button\"\r\n (click)=\"editRow(el, rowData, rowIndex)\" icon=\"pi pi-pencil\"\r\n class=\"p-button-rounded p-button-info mr-1\"></button>\r\n <button pButton pRipple type=\"button\" (click)=\"deleteRow(el, rowIndex)\"\r\n icon=\"pi pi-trash\" class=\"p-button-rounded p-button-danger\"></button>\r\n </td>\r\n </ng-container>\r\n </tr>\r\n </ng-template>\r\n </p-table>\r\n </ng-container>\r\n </ng-container>\r\n </div>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'Control'\">\r\n <sf-control [control]=\"getControl(element.scope)\" [label]=\"element.label\"></sf-control>\r\n </ng-container>\r\n </ng-container>\r\n</div>\r\n<div class=\"card-footer mt-2\">\r\n <button pButton pRipple type=\"button\" label=\"Guardar\" (click)=\"submit()\" class=\"mr-2\"></button>\r\n <button pButton pRipple type=\"button\" label=\"Cancelar\" (click)=\"cancel()\" class=\"p-button-danger\"></button>\r\n</div>\r\n</div>\r\n", components: [{ type: i3$2.Toast, selector: "p-toast", inputs: ["key", "autoZIndex", "baseZIndex", "style", "styleClass", "position", "preventOpenDuplicates", "preventDuplicates", "showTransformOptions", "hideTransformOptions", "showTransitionOptions", "hideTransitionOptions", "breakpoints"], outputs: ["onClose"] }, { type: ControlComponent, selector: "sf-control", inputs: ["control", "label", "value", "appendTo"], outputs: ["setValue", "sendNotification", "sendObject"] }, { type: i5.Table, selector: "p-table", inputs: ["frozenColumns", "frozenValue", "style", "styleClass", "tableStyle", "tableStyleClass", "paginator", "pageLinks", "rowsPerPageOptions", "alwaysShowPaginator", "paginatorPosition", "paginatorDropdownAppendTo", "paginatorDropdownScrollHeight", "currentPageReportTemplate", "showCurrentPageReport", "showJumpToPageDropdown", "showFirstLastIcon", "showPageLinks", "defaultSortOrder", "sortMode", "resetPageOnSort", "selectionMode", "contextMenuSelection", "contextMenuSelectionMode", "dataKey", "metaKeySelection", "rowTrackBy", "lazy", "lazyLoadOnInit", "compareSelectionBy", "csvSeparator", "exportFilename", "filters", "globalFilterFields", "filterDelay", "filterLocale", "expandedRowKeys", "editingRowKeys", "rowExpandMode", "scrollable", "scrollDirection", "rowGroupMode", "scrollHeight", "virtualScroll", "virtualScrollDelay", "virtualRowHeight", "frozenWidth", "responsive", "contextMenu", "resizableColumns", "columnResizeMode", "reorderableColumns", "loading", "loadingIcon", "showLoader", "rowHover", "customSort", "showInitialSortBadge", "autoLayout", "exportFunction", "stateKey", "stateStorage", "editMode", "groupRowsBy", "minBufferPx", "maxBufferPx", "responsiveLayout", "breakpoint", "value", "columns", "first", "rows", "totalRecords", "sortField", "sortOrder", "multiSortMeta", "selection"], outputs: ["selectionChange", "contextMenuSelectionChange", "onRowSelect", "onRowUnselect", "onPage", "onSort", "onFilter", "onLazyLoad", "onRowExpand", "onRowCollapse", "onContextMenuSelect", "onColResize", "onColReorder", "onRowReorder", "onEditInit", "onEditComplete", "onEditCancel", "onHeaderCheckboxToggle", "sortFunction", "firstChange", "rowsChange", "onStateSave", "onStateRestore"] }], directives: [{ type: i7.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i7.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i7.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i7.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i2$1.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { type: i9.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { type: i10.Ripple, selector: "[pRipple]" }], pipes: { "currency": i7.CurrencyPipe, "date": i7.DatePipe } });
|
|
1022
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RegistroChildComponent, decorators: [{
|
|
1023
|
+
type: Component,
|
|
1024
|
+
args: [{
|
|
1025
|
+
selector: 'lib-registro-child',
|
|
1026
|
+
templateUrl: './registro-child.component.html',
|
|
1027
|
+
providers: [MessageService, DialogService]
|
|
1028
|
+
}]
|
|
1029
|
+
}], ctorParameters: function () { return [{ type: i1$1.DynamicDialogRef }, { type: i1$1.DynamicDialogConfig }, { type: i2$1.MessageService }, { type: i1$1.DialogService }]; } });
|
|
1030
|
+
|
|
1031
|
+
class SfCrudService {
|
|
1032
|
+
constructor() {
|
|
1033
|
+
this._dataTemp = [];
|
|
1034
|
+
}
|
|
1035
|
+
saveDataTemp(scope, value) {
|
|
1036
|
+
this._dataTemp.push({ scope, value });
|
|
1037
|
+
sessionStorage.setItem('dataTemp', JSON.stringify(this._dataTemp));
|
|
1038
|
+
}
|
|
1039
|
+
getDataTemp() {
|
|
1040
|
+
let dataTemp = sessionStorage.getItem('dataTemp');
|
|
1041
|
+
sessionStorage.removeItem('dataTemp');
|
|
1042
|
+
return dataTemp ? JSON.parse(dataTemp) : [];
|
|
1043
|
+
}
|
|
1044
|
+
cleanDataTemp() {
|
|
1045
|
+
sessionStorage.removeItem('dataTemp');
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
SfCrudService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SfCrudService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1049
|
+
SfCrudService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SfCrudService, providedIn: 'root' });
|
|
1050
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SfCrudService, decorators: [{
|
|
1051
|
+
type: Injectable,
|
|
1052
|
+
args: [{
|
|
1053
|
+
providedIn: 'root'
|
|
1054
|
+
}]
|
|
1055
|
+
}], ctorParameters: function () { return []; } });
|
|
1056
|
+
|
|
328
1057
|
class RegistroComponent {
|
|
329
|
-
constructor(generalService, router, messageSerice) {
|
|
1058
|
+
constructor(generalService, router, messageSerice, dialogService, sfCrudService) {
|
|
330
1059
|
this.generalService = generalService;
|
|
331
1060
|
this.router = router;
|
|
332
1061
|
this.messageSerice = messageSerice;
|
|
1062
|
+
this.dialogService = dialogService;
|
|
1063
|
+
this.sfCrudService = sfCrudService;
|
|
333
1064
|
this.idKatios = '';
|
|
334
1065
|
this.idEntidad = '';
|
|
335
1066
|
this.trx = '';
|
|
336
1067
|
this.id = '';
|
|
337
|
-
this.
|
|
1068
|
+
this.sendData = new EventEmitter();
|
|
1069
|
+
this.onSubmit = new EventEmitter();
|
|
1070
|
+
this.dataTemp = [];
|
|
338
1071
|
this.crudConfig = new CrudConfig();
|
|
1072
|
+
this.enProceso = false;
|
|
339
1073
|
this.configOperation = new Operations();
|
|
1074
|
+
this.isLocal = false;
|
|
1075
|
+
this.controlsLoaded = false;
|
|
1076
|
+
this.dataTemp = this.sfCrudService.getDataTemp();
|
|
340
1077
|
}
|
|
341
1078
|
ngOnInit() {
|
|
342
1079
|
this.loadConfigCrud();
|
|
343
|
-
this.setLabelSumbit();
|
|
344
1080
|
}
|
|
345
1081
|
loadConfigCrud() {
|
|
346
1082
|
this.enProceso = true;
|
|
347
1083
|
this.generalService.getCrudByEntidad(this.idKatios, this.idEntidad)
|
|
348
1084
|
.then(res => {
|
|
1085
|
+
this.setDataTemp(res.esquema, this.dataTemp);
|
|
349
1086
|
this.crudConfig = res;
|
|
350
|
-
if (this.trx
|
|
351
|
-
this.getInfoRegistro(this.crudConfig.registro);
|
|
352
|
-
else {
|
|
1087
|
+
if (this.trx == 'c') {
|
|
353
1088
|
this.data = this.createObject(this.crudConfig.esquema);
|
|
1089
|
+
this.setLabelSumbit();
|
|
354
1090
|
this.enProceso = false;
|
|
1091
|
+
this.configOperation = this.crudConfig.registro.operations.find(x => x.type.startsWith(this.trx)) || new Operations();
|
|
1092
|
+
this.buildControls();
|
|
355
1093
|
}
|
|
356
|
-
|
|
1094
|
+
else
|
|
1095
|
+
this.getInfoRegistro(this.crudConfig.registro);
|
|
357
1096
|
})
|
|
358
1097
|
.catch(err => {
|
|
359
1098
|
console.log(err);
|
|
360
1099
|
this.enProceso = false;
|
|
361
1100
|
});
|
|
362
1101
|
}
|
|
1102
|
+
buildControls() {
|
|
1103
|
+
this.controlsLoaded = false;
|
|
1104
|
+
this.controls = [];
|
|
1105
|
+
this.values = [];
|
|
1106
|
+
this.crudConfig.uiEsquema.elements.forEach((layout, i) => {
|
|
1107
|
+
var _a;
|
|
1108
|
+
this.controls.push([]);
|
|
1109
|
+
this.values.push([]);
|
|
1110
|
+
(_a = layout.elements) === null || _a === void 0 ? void 0 : _a.forEach((element) => {
|
|
1111
|
+
if (!element.scope)
|
|
1112
|
+
console.log("CONFIGURAR BIEN " + element);
|
|
1113
|
+
this.controls[i].push(this.getControl(element.scope));
|
|
1114
|
+
this.values[i].push(this.getValue(element.scope));
|
|
1115
|
+
});
|
|
1116
|
+
});
|
|
1117
|
+
this.controlsLoaded = true;
|
|
1118
|
+
}
|
|
363
1119
|
setLabelSumbit() {
|
|
364
1120
|
if (this.trx == 'c')
|
|
365
1121
|
this.btnSubmit = { label: 'Guardar', icon: 'pi pi-save' };
|
|
@@ -374,11 +1130,26 @@ class RegistroComponent {
|
|
|
374
1130
|
let op = configRegistro.operations.find(x => x.type == 'read');
|
|
375
1131
|
let endpoint = (op === null || op === void 0 ? void 0 : op.endpoint) || '';
|
|
376
1132
|
endpoint = endpoint.replace('@idKatios', this.idKatios);
|
|
1133
|
+
endpoint = endpoint.replace('@ndocactivo', this.user.UsuarioSistema.NDOC);
|
|
377
1134
|
endpoint = endpoint.replace('@id', this.id);
|
|
378
1135
|
this.generalService.genericRequest((op === null || op === void 0 ? void 0 : op.method) || '', (op === null || op === void 0 ? void 0 : op.server) || '', endpoint)
|
|
379
1136
|
.then((res) => {
|
|
380
|
-
|
|
1137
|
+
if (res === null || res === void 0 ? void 0 : res.data) {
|
|
1138
|
+
if (Array.isArray(res.data))
|
|
1139
|
+
this.data = res.data[0];
|
|
1140
|
+
else
|
|
1141
|
+
this.data = res.data;
|
|
1142
|
+
this.trx = 'u';
|
|
1143
|
+
}
|
|
1144
|
+
else {
|
|
1145
|
+
this.trx = 'c';
|
|
1146
|
+
this.data = this.createObject(this.crudConfig.esquema);
|
|
1147
|
+
console.log(this.data);
|
|
1148
|
+
}
|
|
1149
|
+
this.buildControls();
|
|
381
1150
|
this.enProceso = false;
|
|
1151
|
+
this.configOperation = this.crudConfig.registro.operations.find(x => x.type.startsWith(this.trx)) || new Operations();
|
|
1152
|
+
this.setLabelSumbit();
|
|
382
1153
|
})
|
|
383
1154
|
.catch(err => {
|
|
384
1155
|
console.log(err);
|
|
@@ -394,11 +1165,23 @@ class RegistroComponent {
|
|
|
394
1165
|
getValue(scope) {
|
|
395
1166
|
return jsonpath.query(this.data, scope.replace('.properties', ''))[0];
|
|
396
1167
|
}
|
|
397
|
-
setValue(value, scope) {
|
|
398
|
-
|
|
1168
|
+
setValue(value, scope, i, j) {
|
|
1169
|
+
switch (typeof (value)) {
|
|
1170
|
+
case 'object':
|
|
1171
|
+
if (Array.isArray(value))
|
|
1172
|
+
value.forEach((val) => jsonpath.value(this.data, val.scope.replace('.properties', ''), val.value));
|
|
1173
|
+
else
|
|
1174
|
+
jsonpath.value(this.data, scope.replace('.properties', ''), value);
|
|
1175
|
+
break;
|
|
1176
|
+
default:
|
|
1177
|
+
this.values[i][j] = value;
|
|
1178
|
+
jsonpath.value(this.data, scope.replace('.properties', ''), value);
|
|
1179
|
+
break;
|
|
1180
|
+
}
|
|
1181
|
+
this.applyValuesOnEvent('onChange', this.crudConfig.esquema);
|
|
399
1182
|
}
|
|
400
1183
|
createObject(esquema) {
|
|
401
|
-
|
|
1184
|
+
const object = {};
|
|
402
1185
|
switch (esquema.type) {
|
|
403
1186
|
case 'numeric':
|
|
404
1187
|
return (esquema === null || esquema === void 0 ? void 0 : esquema.default) || 0;
|
|
@@ -409,48 +1192,106 @@ class RegistroComponent {
|
|
|
409
1192
|
return (esquema === null || esquema === void 0 ? void 0 : esquema.default) || false;
|
|
410
1193
|
case 'array':
|
|
411
1194
|
return [];
|
|
1195
|
+
case 'file':
|
|
1196
|
+
return null;
|
|
412
1197
|
case 'object':
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
1198
|
+
Object.getOwnPropertyNames(esquema === null || esquema === void 0 ? void 0 : esquema.properties).forEach(key => {
|
|
1199
|
+
let aux = esquema === null || esquema === void 0 ? void 0 : esquema.properties[key];
|
|
1200
|
+
if (aux)
|
|
1201
|
+
object[key] = this.createObject(aux);
|
|
1202
|
+
});
|
|
1203
|
+
return object;
|
|
417
1204
|
default:
|
|
418
|
-
|
|
1205
|
+
return null;
|
|
419
1206
|
}
|
|
420
|
-
return object;
|
|
421
1207
|
}
|
|
422
1208
|
submit() {
|
|
1209
|
+
console.log(this.data);
|
|
423
1210
|
if (!this.validateData())
|
|
424
1211
|
return;
|
|
1212
|
+
this.applyValuesOnEvent('onSubmit', this.crudConfig.esquema);
|
|
425
1213
|
this.enProceso = true;
|
|
426
1214
|
let endpoint = this.configOperation.endpoint;
|
|
427
1215
|
endpoint = endpoint.replace('@idKatios', this.idKatios);
|
|
428
1216
|
endpoint = endpoint.replace('@id', this.id);
|
|
429
1217
|
this.generalService.genericRequest(this.configOperation.method, this.configOperation.server, endpoint, this.data)
|
|
430
|
-
.then(() => {
|
|
431
|
-
this.
|
|
1218
|
+
.then((res) => {
|
|
1219
|
+
this.generateMessage({ severity: 'success', detail: `Proceso exitoso!` }, res, this.configOperation.answerChecking);
|
|
1220
|
+
this.enProceso = false;
|
|
432
1221
|
setTimeout(() => {
|
|
433
|
-
|
|
434
|
-
this.
|
|
1222
|
+
var _a, _b;
|
|
1223
|
+
if ((_a = this.configOperation) === null || _a === void 0 ? void 0 : _a.redirect)
|
|
1224
|
+
this.router.navigate([(_b = this.configOperation) === null || _b === void 0 ? void 0 : _b.redirect]);
|
|
1225
|
+
else
|
|
1226
|
+
this.onSubmit.emit(this.data);
|
|
435
1227
|
}, 2000);
|
|
436
1228
|
})
|
|
437
1229
|
.catch(err => {
|
|
438
|
-
|
|
439
|
-
this.
|
|
1230
|
+
const operation = this.crudConfig.registro.operations.find(op => op.type.startsWith(this.trx));
|
|
1231
|
+
this.generateMessage({ severity: "error", detail: "Por favor comunicarse con el admin", summary: "Error no controlado" }, err.error, operation.errorChecking);
|
|
440
1232
|
this.enProceso = false;
|
|
441
1233
|
});
|
|
442
1234
|
}
|
|
1235
|
+
/**
|
|
1236
|
+
* Generates message using answerchecking
|
|
1237
|
+
* @param currentMsg Default message: Message
|
|
1238
|
+
* @param rta Resquest's response
|
|
1239
|
+
* @param answerChecking
|
|
1240
|
+
*/
|
|
1241
|
+
generateMessage(currentMsg, rta, requestChecking) {
|
|
1242
|
+
if (requestChecking) {
|
|
1243
|
+
if (requestChecking.statics)
|
|
1244
|
+
Object.assign(currentMsg, requestChecking.statics);
|
|
1245
|
+
//mapear los dinamicos
|
|
1246
|
+
if (requestChecking.dynamics) {
|
|
1247
|
+
const dynamics = requestChecking.dynamics;
|
|
1248
|
+
try {
|
|
1249
|
+
if (dynamics && typeof (rta) == "string")
|
|
1250
|
+
rta = JSON.parse(rta);
|
|
1251
|
+
if (dynamics) {
|
|
1252
|
+
for (const property in dynamics) {
|
|
1253
|
+
currentMsg[property] = jsonpath.query(rta, dynamics[property])[0];
|
|
1254
|
+
}
|
|
1255
|
+
}
|
|
1256
|
+
}
|
|
1257
|
+
catch (error) { //es una respuesta sin JSON
|
|
1258
|
+
if (dynamics)
|
|
1259
|
+
currentMsg.detail = rta;
|
|
1260
|
+
}
|
|
1261
|
+
}
|
|
1262
|
+
}
|
|
1263
|
+
if ((requestChecking === null || requestChecking === void 0 ? void 0 : requestChecking.redirect) || (requestChecking === null || requestChecking === void 0 ? void 0 : requestChecking.swal))
|
|
1264
|
+
Swal.fire(currentMsg.summary, currentMsg.detail, currentMsg.severity).then((res) => {
|
|
1265
|
+
if (res.isConfirmed && requestChecking.redirect)
|
|
1266
|
+
window.location.href = requestChecking.redirect;
|
|
1267
|
+
});
|
|
1268
|
+
else
|
|
1269
|
+
this.messageSerice.add(currentMsg);
|
|
1270
|
+
}
|
|
443
1271
|
validateData() {
|
|
444
1272
|
if (this.configOperation.validations.type == 'local')
|
|
445
1273
|
return this.validateDataLocal();
|
|
446
1274
|
return true;
|
|
447
1275
|
}
|
|
448
1276
|
validateDataLocal() {
|
|
1277
|
+
var _a, _b, _c, _d;
|
|
449
1278
|
let err = [];
|
|
450
|
-
this.configOperation.validations.required.forEach(x => {
|
|
1279
|
+
(_b = (_a = this.configOperation.validations) === null || _a === void 0 ? void 0 : _a.required) === null || _b === void 0 ? void 0 : _b.forEach(x => {
|
|
451
1280
|
if (!jsonpath.query(this.data, x.field)[0])
|
|
452
1281
|
err.push(x.message);
|
|
453
1282
|
});
|
|
1283
|
+
(_d = (_c = this.configOperation.validations) === null || _c === void 0 ? void 0 : _c.operations) === null || _d === void 0 ? void 0 : _d.forEach((op) => {
|
|
1284
|
+
switch (op.action) {
|
|
1285
|
+
case 'sumArray':
|
|
1286
|
+
let var1 = jsonpath.query(this.data, op.scope[0]).reduce((acc, cur) => acc += cur[op.key], 0);
|
|
1287
|
+
let var2 = jsonpath.query(this.data, op.scope[1]).reduce((acc, cur) => acc += cur[op.key], 0);
|
|
1288
|
+
if (var1 != var2)
|
|
1289
|
+
err.push(op.message);
|
|
1290
|
+
break;
|
|
1291
|
+
default:
|
|
1292
|
+
break;
|
|
1293
|
+
}
|
|
1294
|
+
});
|
|
454
1295
|
if (err.length != 0)
|
|
455
1296
|
this.messageSerice.add({ severity: 'warn', detail: err.join('. ') });
|
|
456
1297
|
return err.length == 0;
|
|
@@ -459,11 +1300,13 @@ class RegistroComponent {
|
|
|
459
1300
|
let data = null;
|
|
460
1301
|
switch (value) {
|
|
461
1302
|
case '@uactivo':
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
1303
|
+
data = `${this.user.UsuarioSistema.TDOC}-${this.user.UsuarioSistema.NDOC}`;
|
|
1304
|
+
break;
|
|
1305
|
+
case '@tdocactivo':
|
|
1306
|
+
data = this.user.UsuarioSistema.TDOC;
|
|
1307
|
+
break;
|
|
1308
|
+
case '@ndocactivo':
|
|
1309
|
+
data = this.user.UsuarioSistema.NDOC;
|
|
467
1310
|
break;
|
|
468
1311
|
case '@hoy':
|
|
469
1312
|
data = new Date();
|
|
@@ -474,17 +1317,154 @@ class RegistroComponent {
|
|
|
474
1317
|
}
|
|
475
1318
|
return data;
|
|
476
1319
|
}
|
|
1320
|
+
sendNotification(message) {
|
|
1321
|
+
this.messageSerice.add(message);
|
|
1322
|
+
}
|
|
1323
|
+
addObjectArray(element) {
|
|
1324
|
+
this.dialogRef = this.dialogService.open(RegistroChildComponent, {
|
|
1325
|
+
header: element.label ? element.label : 'Detalle',
|
|
1326
|
+
width: '70%',
|
|
1327
|
+
modal: true,
|
|
1328
|
+
closable: false,
|
|
1329
|
+
data: {
|
|
1330
|
+
uiEsquema: Object.assign({}, element.elements),
|
|
1331
|
+
esquema: this.getControl(element.scope),
|
|
1332
|
+
id: this.getValue(element.scope).length + 1
|
|
1333
|
+
}
|
|
1334
|
+
});
|
|
1335
|
+
this.dialogRef.onClose.subscribe((data) => {
|
|
1336
|
+
if (data)
|
|
1337
|
+
this.data[element.scope.replace('$..properties.', '')].push(data);
|
|
1338
|
+
this.applyValuesOnEvent('onChange', this.crudConfig.esquema, element.scope.replace('$..properties.', ''));
|
|
1339
|
+
});
|
|
1340
|
+
}
|
|
1341
|
+
editRow(element, data, index) {
|
|
1342
|
+
this.dialogRef = this.dialogService.open(RegistroChildComponent, {
|
|
1343
|
+
header: element.label ? element.label : 'Detalle',
|
|
1344
|
+
width: '70%',
|
|
1345
|
+
modal: true,
|
|
1346
|
+
closable: false,
|
|
1347
|
+
data: {
|
|
1348
|
+
uiEsquema: Object.assign({}, element.elements),
|
|
1349
|
+
esquema: this.getControl(element.scope),
|
|
1350
|
+
data: Object.assign({}, data)
|
|
1351
|
+
}
|
|
1352
|
+
});
|
|
1353
|
+
this.dialogRef.onClose.subscribe((data) => {
|
|
1354
|
+
if (data)
|
|
1355
|
+
this.data[element.scope.replace('$..properties.', '')][index] = data;
|
|
1356
|
+
this.applyValuesOnEvent('onChange', this.crudConfig.esquema, element.scope.replace('$..properties.', ''));
|
|
1357
|
+
});
|
|
1358
|
+
}
|
|
1359
|
+
deleteRow(element, index) {
|
|
1360
|
+
this.data[element.scope.replace('$..properties.', '')].splice(index, 1);
|
|
1361
|
+
index = 1;
|
|
1362
|
+
this.data[element.scope.replace('$..properties.', '')].forEach((el) => {
|
|
1363
|
+
el.id = index;
|
|
1364
|
+
index++;
|
|
1365
|
+
});
|
|
1366
|
+
this.applyValuesOnEvent('onChange', this.crudConfig.esquema, element.scope.replace('$..properties.', ''));
|
|
1367
|
+
}
|
|
1368
|
+
applyValuesOnEvent(event, esquema, key) {
|
|
1369
|
+
if (key) {
|
|
1370
|
+
if (esquema.properties[key][event]) {
|
|
1371
|
+
esquema.properties[key][event].forEach((value) => {
|
|
1372
|
+
this.setValueEvent(this.data, value);
|
|
1373
|
+
});
|
|
1374
|
+
}
|
|
1375
|
+
}
|
|
1376
|
+
else {
|
|
1377
|
+
for (const key in esquema.properties) {
|
|
1378
|
+
if (esquema.properties[key][event]) {
|
|
1379
|
+
esquema.properties[key][event].forEach((value) => {
|
|
1380
|
+
this.setValueEvent(this.data, value);
|
|
1381
|
+
});
|
|
1382
|
+
}
|
|
1383
|
+
}
|
|
1384
|
+
}
|
|
1385
|
+
}
|
|
1386
|
+
setValueEvent(data, params) {
|
|
1387
|
+
var _a;
|
|
1388
|
+
let date = moment(new Date());
|
|
1389
|
+
switch (params.op) {
|
|
1390
|
+
case 'sum':
|
|
1391
|
+
jsonpath.value(data, params.scope[1], jsonpath.query(data, params.scope[0]).reduce((acc, cur) => acc += (params === null || params === void 0 ? void 0 : params.key) ? cur[params.key] : cur, 0));
|
|
1392
|
+
break;
|
|
1393
|
+
case 'concat':
|
|
1394
|
+
let array = [];
|
|
1395
|
+
(_a = params === null || params === void 0 ? void 0 : params.key) === null || _a === void 0 ? void 0 : _a.reduce((acc, cur) => {
|
|
1396
|
+
array.push(jsonpath.query(data, cur)[0]);
|
|
1397
|
+
}, []);
|
|
1398
|
+
if (params === null || params === void 0 ? void 0 : params.separator)
|
|
1399
|
+
jsonpath.value(data, params.scope[0], array.join((params === null || params === void 0 ? void 0 : params.separator) || ' '));
|
|
1400
|
+
break;
|
|
1401
|
+
case 'enable':
|
|
1402
|
+
jsonpath.value(this.crudConfig.esquema, params.scope[0], false);
|
|
1403
|
+
break;
|
|
1404
|
+
case 'disabled':
|
|
1405
|
+
jsonpath.value(this.crudConfig.esquema, params.scope[0], true);
|
|
1406
|
+
break;
|
|
1407
|
+
case 'replace:endpoint':
|
|
1408
|
+
jsonpath.value(this.crudConfig.esquema, params.scope[0], this.crudConfig.esquema.config.endpointtemp.replace(params.scope[1], jsonpath.query(data, `$..${params.key}`)));
|
|
1409
|
+
break;
|
|
1410
|
+
case 'setNull':
|
|
1411
|
+
jsonpath.value(this.data, `$.${params.key}`, null);
|
|
1412
|
+
break;
|
|
1413
|
+
case 'datediff:years':
|
|
1414
|
+
jsonpath.value(this.data, params.scope[0], date.diff(moment(jsonpath.query(this.data, params.scope[1])[0]), 'years'));
|
|
1415
|
+
break;
|
|
1416
|
+
case 'datediff:months':
|
|
1417
|
+
jsonpath.value(this.data, params.scope[0], date.diff(moment(jsonpath.query(this.data, params.scope[1])[0]), 'months'));
|
|
1418
|
+
break;
|
|
1419
|
+
case 'datediff:weeks':
|
|
1420
|
+
jsonpath.value(this.data, params.scope[0], date.diff(moment(jsonpath.query(this.data, params.scope[1])[0]), 'weeks'));
|
|
1421
|
+
break;
|
|
1422
|
+
case 'datediff:days':
|
|
1423
|
+
jsonpath.value(this.data, params.scope[0], date.diff(moment(jsonpath.query(this.data, params.scope[1])[0]), 'days'));
|
|
1424
|
+
break;
|
|
1425
|
+
default:
|
|
1426
|
+
break;
|
|
1427
|
+
}
|
|
1428
|
+
}
|
|
1429
|
+
setDataTemp(esquema, dataTemp) {
|
|
1430
|
+
dataTemp.forEach(data => {
|
|
1431
|
+
jsonpath.value(esquema, data.scope, data.value);
|
|
1432
|
+
});
|
|
1433
|
+
}
|
|
1434
|
+
applyValuesFromObject(event) {
|
|
1435
|
+
if (event.data)
|
|
1436
|
+
event.optionValue.forEach((value) => jsonpath.value(this.data, value.scope.replace('.properties', ''), this.aplyFormatValue(value.scope, event.data[value.key])));
|
|
1437
|
+
else
|
|
1438
|
+
event.optionValue.forEach((value) => jsonpath.value(this.data, value.scope.replace('.properties', ''), null));
|
|
1439
|
+
}
|
|
1440
|
+
aplyFormatValue(scope, value) {
|
|
1441
|
+
let control = jsonpath.query(this.crudConfig.esquema, scope)[0];
|
|
1442
|
+
let resp;
|
|
1443
|
+
switch (control.type) {
|
|
1444
|
+
case 'date':
|
|
1445
|
+
resp = new Date(`${value}`);
|
|
1446
|
+
break;
|
|
1447
|
+
case 'numeric':
|
|
1448
|
+
resp = +value;
|
|
1449
|
+
break;
|
|
1450
|
+
default:
|
|
1451
|
+
resp = value;
|
|
1452
|
+
break;
|
|
1453
|
+
}
|
|
1454
|
+
return resp;
|
|
1455
|
+
}
|
|
477
1456
|
}
|
|
478
|
-
RegistroComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RegistroComponent, deps: [{ token: GeneralService }, { token: i2.Router }, { token:
|
|
479
|
-
RegistroComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: RegistroComponent, selector: "sf-registro", inputs: { idKatios: "idKatios", idEntidad: "idEntidad", trx: "trx", id: "id" }, providers: [MessageService], ngImport: i0, template: "<p-blockUI [blocked]=\"enProceso\">\r\n <i class=\"pi pi-cog pi-spin\" style=\"font-size: 50px\"></i>\r\n</p-blockUI>\r\n\r\n<p-toast></p-toast>\r\n\r\n<div class=\"card\" *ngIf=\"!enProceso\">\r\n <h5 class=\"card-header mb-2\" style=\"display: flex; justify-content: space-between;align-items: center;\">\r\n <span>{{idEntidad}} {{id != '' ? '-' + id : ''}}</span>\r\n <button pButton pRipple type=\"button\" icon=\"pi pi-arrow-left\" (click)=\"back()\"></button>\r\n </h5>\r\n <div *ngFor=\"let element of crudConfig.uiEsquema.elements\" [class]=\"element?.class\">\r\n <ng-container [ngSwitch]=\"element.type\">\r\n <div *ngSwitchCase=\"'Label'\" [style]=\"element?.style\">\r\n {{element?.label}}\r\n </div>\r\n <ng-container *ngSwitchCase=\"'HorizontalLayout'\">\r\n <div *ngFor=\"let el of element.elements\" [class]=\"el?.class\">\r\n <ng-container [ngSwitch]=\"el.type\" >\r\n <sf-control *ngSwitchCase=\"'Control'\" [control]=\"getControl(el.scope)\" [label]=\"el.label\" [value]=\"getValue(el.scope)\" (setValue)=\"setValue($event, el.scope)\"></sf-control>\r\n </ng-container>\r\n </div>\r\n </ng-container>\r\n <div *ngSwitchCase=\"'Control'\">\r\n <sf-control *ngSwitchCase=\"'Control'\" [control]=\"getControl(element.scope)\" [label]=\"element.label\"></sf-control>\r\n </div>\r\n </ng-container>\r\n </div>\r\n <div class=\"card-footer\" *ngIf=\"btnSubmit\">\r\n <button pButton pRipple type=\"button\" [icon]=\"btnSubmit.icon\" [label]=\"btnSubmit.label\" (click)=\"submit()\"></button>\r\n </div>\r\n</div>", components: [{ type: i3.BlockUI, selector: "p-blockUI", inputs: ["autoZIndex", "baseZIndex", "blocked", "target", "styleClass"] }, { type: i5$2.Toast, selector: "p-toast", inputs: ["autoZIndex", "baseZIndex", "position", "preventOpenDuplicates", "preventDuplicates", "showTransformOptions", "hideTransformOptions", "showTransitionOptions", "hideTransitionOptions", "key", "style", "styleClass", "breakpoints"], outputs: ["onClose"] }, { type: ControlComponent, selector: "sf-control", inputs: ["control", "label", "value"], outputs: ["setValue"] }], directives: [{ type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i8.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { type: i9.Ripple, selector: "[pRipple]" }, { type: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i6.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i6.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }] });
|
|
1457
|
+
RegistroComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RegistroComponent, deps: [{ token: GeneralService }, { token: i2.Router }, { token: i2$1.MessageService }, { token: i1$1.DialogService }, { token: SfCrudService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1458
|
+
RegistroComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: RegistroComponent, selector: "sf-registro", inputs: { idKatios: "idKatios", idEntidad: "idEntidad", trx: "trx", id: "id", user: "user" }, outputs: { sendData: "sendData", onSubmit: "onSubmit" }, providers: [MessageService, DialogService, DynamicDialogConfig, DynamicDialogRef], ngImport: i0, template: "<p-blockUI [blocked]=\"enProceso\">\r\n <i class=\"pi pi-cog pi-spin\" style=\"font-size: 50px\"></i>\r\n</p-blockUI>\r\n\r\n<p-toast></p-toast>\r\n\r\n<div class=\"card\" *ngIf=\"!enProceso && controlsLoaded\">\r\n <h5 class=\"card-header mb-2\" style=\"display: flex; justify-content: space-between;align-items: center;\">\r\n <span>{{crudConfig.registro?.label || idEntidad}} {{id != '' ? '-' + id : ''}}</span>\r\n <button *ngIf=\"crudConfig.registro?.canBack\" pButton pRipple type=\"button\" icon=\"pi pi-arrow-left\" (click)=\"back()\"></button>\r\n </h5>\r\n <div *ngFor=\"let element of crudConfig.uiEsquema.elements; let i = index\" [class]=\"element?.class\">\r\n <ng-container [ngSwitch]=\"element.type\">\r\n <div *ngSwitchCase=\"'Label'\" [style]=\"element?.style\">\r\n {{element?.label}}\r\n </div>\r\n <ng-container *ngSwitchCase=\"'HorizontalLayout'\">\r\n <div *ngFor=\"let el of element.elements;let j = index\" [class]=\"el?.class\">\r\n <ng-container [ngSwitch]=\"el.type\">\r\n <sf-control *ngSwitchCase=\"'Control'\" [control]=\"controls[i][j]\" [label]=\"el.label\"\r\n [value]=\"values[i][j]\" (setValue)=\"setValue($event, el.scope, i, j)\"\r\n (sendNotification)=\"sendNotification($event)\" (sendObject)=\"applyValuesFromObject($event)\"></sf-control>\r\n </ng-container>\r\n </div>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'VerticalLayout'\">\r\n <div *ngFor=\"let el of element.elements;let j = index\" [class]=\"el?.class\">\r\n <ng-container [ngSwitch]=\"el.type\">\r\n <sf-control *ngSwitchCase=\"'Control'\" [control]=\"controls[i][j]\" [label]=\"el.label\"\r\n [value]=\"values[i][j]\" (setValue)=\"setValue($event, el.scope, i, j)\"\r\n (sendNotification)=\"sendNotification($event)\" (sendObject)=\"applyValuesFromObject($event)\"></sf-control>\r\n <ng-container *ngSwitchCase=\"'Table'\">\r\n <p-table [value]=\"getValue(el.scope)\" [columns]=\"getControl(el.scope).config.columns\">\r\n <ng-template pTemplate=\"caption\">\r\n <div class=\"flex align-items-center justify-content-between\">\r\n <button pButton pRipple icon=\"pi pi-plus\" (click)=\"addObjectArray(el)\"\r\n class=\"p-button-success\"></button>\r\n </div>\r\n </ng-template>\r\n <ng-template pTemplate=\"header\" let-columns>\r\n <tr>\r\n <th *ngFor=\"let col of columns\">\r\n {{col.label}}\r\n </th>\r\n <ng-container *ngIf=\"trx == 'c' || trx == 'u'\">\r\n <th></th>\r\n </ng-container>\r\n </tr>\r\n </ng-template>\r\n <ng-template pTemplate=\"body\" let-rowData let-columns=\"columns\" let-rowIndex=\"rowIndex\">\r\n <tr>\r\n <ng-container *ngFor=\"let col of columns\" [ngSwitch]=\"col.type\">\r\n <ng-container *ngSwitchCase=\"'text'\">\r\n <td>{{rowData[col.col]}}</td>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'currency:USD'\">\r\n <td>{{rowData[col.col] | currency: 'USD'}}</td>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'date:yyyy-mm-dd'\">\r\n <td>{{rowData[col.col] | date: 'yyyy-mm-dd'}}</td>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'date:dd/mm/yyyy'\">\r\n <td>{{rowData[col.col] | date: 'dd/MM/yyyy'}}</td>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'boolean'\">\r\n <td>\r\n <i *ngIf=\"rowData[col.col]\" class=\"pi pi-check\"></i>\r\n <i *ngIf=\"!rowData[col.col]\" class=\"pi pi-times\"></i>\r\n </td>\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"trx == 'c' || trx == 'u'\">\r\n <td>\r\n <button pButton pRipple type=\"button\" (click)=\"editRow(el, rowData, rowIndex)\" icon=\"pi pi-pencil\" class=\"p-button-rounded p-button-info mr-1\"></button>\r\n <button pButton pRipple type=\"button\" (click)=\"deleteRow(el, rowIndex)\" icon=\"pi pi-trash\" class=\"p-button-rounded p-button-danger\"></button>\r\n </td>\r\n </ng-container>\r\n </tr>\r\n </ng-template>\r\n </p-table>\r\n </ng-container>\r\n </ng-container>\r\n </div>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'Control'\">\r\n <sf-control [control]=\"getControl(element.scope)\" [label]=\"element.label\"></sf-control>\r\n </ng-container>\r\n </ng-container>\r\n </div>\r\n <div class=\"card-footer mt-2\" *ngIf=\"btnSubmit\">\r\n <button pButton pRipple type=\"button\" [icon]=\"btnSubmit.icon\" [label]=\"btnSubmit.label\"\r\n (click)=\"submit()\"></button>\r\n </div>\r\n</div>\r\n", components: [{ type: i3.BlockUI, selector: "p-blockUI", inputs: ["target", "autoZIndex", "baseZIndex", "styleClass", "blocked"] }, { type: i3$2.Toast, selector: "p-toast", inputs: ["key", "autoZIndex", "baseZIndex", "style", "styleClass", "position", "preventOpenDuplicates", "preventDuplicates", "showTransformOptions", "hideTransformOptions", "showTransitionOptions", "hideTransitionOptions", "breakpoints"], outputs: ["onClose"] }, { type: ControlComponent, selector: "sf-control", inputs: ["control", "label", "value", "appendTo"], outputs: ["setValue", "sendNotification", "sendObject"] }, { type: i5.Table, selector: "p-table", inputs: ["frozenColumns", "frozenValue", "style", "styleClass", "tableStyle", "tableStyleClass", "paginator", "pageLinks", "rowsPerPageOptions", "alwaysShowPaginator", "paginatorPosition", "paginatorDropdownAppendTo", "paginatorDropdownScrollHeight", "currentPageReportTemplate", "showCurrentPageReport", "showJumpToPageDropdown", "showFirstLastIcon", "showPageLinks", "defaultSortOrder", "sortMode", "resetPageOnSort", "selectionMode", "contextMenuSelection", "contextMenuSelectionMode", "dataKey", "metaKeySelection", "rowTrackBy", "lazy", "lazyLoadOnInit", "compareSelectionBy", "csvSeparator", "exportFilename", "filters", "globalFilterFields", "filterDelay", "filterLocale", "expandedRowKeys", "editingRowKeys", "rowExpandMode", "scrollable", "scrollDirection", "rowGroupMode", "scrollHeight", "virtualScroll", "virtualScrollDelay", "virtualRowHeight", "frozenWidth", "responsive", "contextMenu", "resizableColumns", "columnResizeMode", "reorderableColumns", "loading", "loadingIcon", "showLoader", "rowHover", "customSort", "showInitialSortBadge", "autoLayout", "exportFunction", "stateKey", "stateStorage", "editMode", "groupRowsBy", "minBufferPx", "maxBufferPx", "responsiveLayout", "breakpoint", "value", "columns", "first", "rows", "totalRecords", "sortField", "sortOrder", "multiSortMeta", "selection"], outputs: ["selectionChange", "contextMenuSelectionChange", "onRowSelect", "onRowUnselect", "onPage", "onSort", "onFilter", "onLazyLoad", "onRowExpand", "onRowCollapse", "onContextMenuSelect", "onColResize", "onColReorder", "onRowReorder", "onEditInit", "onEditComplete", "onEditCancel", "onHeaderCheckboxToggle", "sortFunction", "firstChange", "rowsChange", "onStateSave", "onStateRestore"] }], directives: [{ type: i7.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i9.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { type: i10.Ripple, selector: "[pRipple]" }, { type: i7.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i7.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i7.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i2$1.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }], pipes: { "currency": i7.CurrencyPipe, "date": i7.DatePipe } });
|
|
480
1459
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RegistroComponent, decorators: [{
|
|
481
1460
|
type: Component,
|
|
482
1461
|
args: [{
|
|
483
1462
|
selector: 'sf-registro',
|
|
484
1463
|
templateUrl: './registro.component.html',
|
|
485
|
-
providers: [MessageService]
|
|
1464
|
+
providers: [MessageService, DialogService, DynamicDialogConfig, DynamicDialogRef],
|
|
1465
|
+
entryComponents: [RegistroComponent]
|
|
486
1466
|
}]
|
|
487
|
-
}], ctorParameters: function () { return [{ type: GeneralService }, { type: i2.Router }, { type:
|
|
1467
|
+
}], ctorParameters: function () { return [{ type: GeneralService }, { type: i2.Router }, { type: i2$1.MessageService }, { type: i1$1.DialogService }, { type: SfCrudService }]; }, propDecorators: { idKatios: [{
|
|
488
1468
|
type: Input
|
|
489
1469
|
}], idEntidad: [{
|
|
490
1470
|
type: Input
|
|
@@ -492,6 +1472,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
|
|
|
492
1472
|
type: Input
|
|
493
1473
|
}], id: [{
|
|
494
1474
|
type: Input
|
|
1475
|
+
}], user: [{
|
|
1476
|
+
type: Input
|
|
1477
|
+
}], sendData: [{
|
|
1478
|
+
type: Output
|
|
1479
|
+
}], onSubmit: [{
|
|
1480
|
+
type: Output
|
|
495
1481
|
}] } });
|
|
496
1482
|
|
|
497
1483
|
class SfCrudComponent {
|
|
@@ -524,7 +1510,9 @@ SfCrudModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "1
|
|
|
524
1510
|
SfCrudModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SfCrudModule, declarations: [SfCrudComponent,
|
|
525
1511
|
TableroComponent,
|
|
526
1512
|
RegistroComponent,
|
|
527
|
-
ControlComponent
|
|
1513
|
+
ControlComponent,
|
|
1514
|
+
RegistroChildComponent,
|
|
1515
|
+
RegistroDetalleComponent], imports: [AccordionModule,
|
|
528
1516
|
AutoCompleteModule,
|
|
529
1517
|
AvatarGroupModule,
|
|
530
1518
|
AvatarModule,
|
|
@@ -539,7 +1527,6 @@ SfCrudModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "
|
|
|
539
1527
|
CheckboxModule,
|
|
540
1528
|
ChipModule,
|
|
541
1529
|
ChipsModule,
|
|
542
|
-
CodeHighlighterModule,
|
|
543
1530
|
ColorPickerModule,
|
|
544
1531
|
ConfirmDialogModule,
|
|
545
1532
|
ConfirmPopupModule,
|
|
@@ -547,6 +1534,7 @@ SfCrudModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "
|
|
|
547
1534
|
DialogModule,
|
|
548
1535
|
DividerModule,
|
|
549
1536
|
DropdownModule,
|
|
1537
|
+
DynamicDialogModule,
|
|
550
1538
|
FieldsetModule,
|
|
551
1539
|
FileUploadModule,
|
|
552
1540
|
FormsModule,
|
|
@@ -559,7 +1547,6 @@ SfCrudModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "
|
|
|
559
1547
|
InputTextareaModule,
|
|
560
1548
|
InputTextModule,
|
|
561
1549
|
KnobModule,
|
|
562
|
-
LightboxModule,
|
|
563
1550
|
ListboxModule,
|
|
564
1551
|
MegaMenuModule,
|
|
565
1552
|
MenubarModule,
|
|
@@ -583,6 +1570,7 @@ SfCrudModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "
|
|
|
583
1570
|
SkeletonModule,
|
|
584
1571
|
SlideMenuModule,
|
|
585
1572
|
SliderModule,
|
|
1573
|
+
SplitButtonModule,
|
|
586
1574
|
SplitterModule,
|
|
587
1575
|
StepsModule,
|
|
588
1576
|
TableModule,
|
|
@@ -598,7 +1586,8 @@ SfCrudModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "
|
|
|
598
1586
|
TooltipModule,
|
|
599
1587
|
TreeModule], exports: [SfCrudComponent,
|
|
600
1588
|
TableroComponent,
|
|
601
|
-
RegistroComponent
|
|
1589
|
+
RegistroComponent,
|
|
1590
|
+
ControlComponent] });
|
|
602
1591
|
SfCrudModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SfCrudModule, imports: [[
|
|
603
1592
|
AccordionModule,
|
|
604
1593
|
AutoCompleteModule,
|
|
@@ -615,7 +1604,6 @@ SfCrudModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
|
615
1604
|
CheckboxModule,
|
|
616
1605
|
ChipModule,
|
|
617
1606
|
ChipsModule,
|
|
618
|
-
CodeHighlighterModule,
|
|
619
1607
|
ColorPickerModule,
|
|
620
1608
|
ConfirmDialogModule,
|
|
621
1609
|
ConfirmPopupModule,
|
|
@@ -623,6 +1611,7 @@ SfCrudModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
|
623
1611
|
DialogModule,
|
|
624
1612
|
DividerModule,
|
|
625
1613
|
DropdownModule,
|
|
1614
|
+
DynamicDialogModule,
|
|
626
1615
|
FieldsetModule,
|
|
627
1616
|
FileUploadModule,
|
|
628
1617
|
FormsModule,
|
|
@@ -635,7 +1624,6 @@ SfCrudModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
|
635
1624
|
InputTextareaModule,
|
|
636
1625
|
InputTextModule,
|
|
637
1626
|
KnobModule,
|
|
638
|
-
LightboxModule,
|
|
639
1627
|
ListboxModule,
|
|
640
1628
|
MegaMenuModule,
|
|
641
1629
|
MenubarModule,
|
|
@@ -659,6 +1647,7 @@ SfCrudModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
|
659
1647
|
SkeletonModule,
|
|
660
1648
|
SlideMenuModule,
|
|
661
1649
|
SliderModule,
|
|
1650
|
+
SplitButtonModule,
|
|
662
1651
|
SplitterModule,
|
|
663
1652
|
StepsModule,
|
|
664
1653
|
TableModule,
|
|
@@ -681,7 +1670,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
|
|
|
681
1670
|
SfCrudComponent,
|
|
682
1671
|
TableroComponent,
|
|
683
1672
|
RegistroComponent,
|
|
684
|
-
ControlComponent
|
|
1673
|
+
ControlComponent,
|
|
1674
|
+
RegistroChildComponent,
|
|
1675
|
+
RegistroDetalleComponent
|
|
685
1676
|
],
|
|
686
1677
|
imports: [
|
|
687
1678
|
AccordionModule,
|
|
@@ -699,7 +1690,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
|
|
|
699
1690
|
CheckboxModule,
|
|
700
1691
|
ChipModule,
|
|
701
1692
|
ChipsModule,
|
|
702
|
-
CodeHighlighterModule,
|
|
703
1693
|
ColorPickerModule,
|
|
704
1694
|
ConfirmDialogModule,
|
|
705
1695
|
ConfirmPopupModule,
|
|
@@ -707,6 +1697,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
|
|
|
707
1697
|
DialogModule,
|
|
708
1698
|
DividerModule,
|
|
709
1699
|
DropdownModule,
|
|
1700
|
+
DynamicDialogModule,
|
|
710
1701
|
FieldsetModule,
|
|
711
1702
|
FileUploadModule,
|
|
712
1703
|
FormsModule,
|
|
@@ -719,7 +1710,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
|
|
|
719
1710
|
InputTextareaModule,
|
|
720
1711
|
InputTextModule,
|
|
721
1712
|
KnobModule,
|
|
722
|
-
LightboxModule,
|
|
723
1713
|
ListboxModule,
|
|
724
1714
|
MegaMenuModule,
|
|
725
1715
|
MenubarModule,
|
|
@@ -743,6 +1733,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
|
|
|
743
1733
|
SkeletonModule,
|
|
744
1734
|
SlideMenuModule,
|
|
745
1735
|
SliderModule,
|
|
1736
|
+
SplitButtonModule,
|
|
746
1737
|
SplitterModule,
|
|
747
1738
|
StepsModule,
|
|
748
1739
|
TableModule,
|
|
@@ -761,23 +1752,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
|
|
|
761
1752
|
exports: [
|
|
762
1753
|
SfCrudComponent,
|
|
763
1754
|
TableroComponent,
|
|
764
|
-
RegistroComponent
|
|
1755
|
+
RegistroComponent,
|
|
1756
|
+
ControlComponent
|
|
1757
|
+
],
|
|
1758
|
+
entryComponents: [
|
|
1759
|
+
RegistroChildComponent
|
|
765
1760
|
]
|
|
766
1761
|
}]
|
|
767
1762
|
}] });
|
|
768
1763
|
|
|
769
|
-
class SfCrudService {
|
|
770
|
-
constructor() { }
|
|
771
|
-
}
|
|
772
|
-
SfCrudService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SfCrudService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
773
|
-
SfCrudService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SfCrudService, providedIn: 'root' });
|
|
774
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SfCrudService, decorators: [{
|
|
775
|
-
type: Injectable,
|
|
776
|
-
args: [{
|
|
777
|
-
providedIn: 'root'
|
|
778
|
-
}]
|
|
779
|
-
}], ctorParameters: function () { return []; } });
|
|
780
|
-
|
|
781
1764
|
/*
|
|
782
1765
|
* Public API Surface of sf-crud
|
|
783
1766
|
*/
|
|
@@ -786,5 +1769,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
|
|
|
786
1769
|
* Generated bundle index. Do not edit.
|
|
787
1770
|
*/
|
|
788
1771
|
|
|
789
|
-
export { RegistroComponent, SfCrudComponent, SfCrudModule, SfCrudService, TableroComponent };
|
|
1772
|
+
export { ControlComponent, RegistroComponent, SfCrudComponent, SfCrudModule, SfCrudService, TableroComponent };
|
|
790
1773
|
//# sourceMappingURL=sf-crud.js.map
|