sf-crud 12.0.1-beta4 → 12.0.1-beta41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/bundles/sf-crud.umd.js +804 -105
  2. package/bundles/sf-crud.umd.js.map +1 -1
  3. package/esm2015/lib/components/control/control.component.js +104 -9
  4. package/esm2015/lib/components/registro/registro.component.js +238 -32
  5. package/esm2015/lib/components/registro-child/registro-child.component.js +232 -0
  6. package/esm2015/lib/components/tablero/tablero.component.js +81 -19
  7. package/esm2015/lib/sf-crud.module.js +32 -20
  8. package/esm2015/lib/sf-crud.service.js +16 -2
  9. package/esm2015/lib/shared/models/crud-config.model.js +43 -0
  10. package/esm2015/lib/shared/models/data-temp-crud.model.js +6 -0
  11. package/esm2015/lib/shared/models/shema.model.js +7 -0
  12. package/esm2015/lib/shared/services/general.service.js +1 -1
  13. package/esm2015/public-api.js +2 -1
  14. package/fesm2015/sf-crud.js +679 -79
  15. package/fesm2015/sf-crud.js.map +1 -1
  16. package/lib/components/control/control.component.d.ts +15 -2
  17. package/lib/components/registro/registro.component.d.ts +33 -9
  18. package/lib/components/registro-child/registro-child.component.d.ts +36 -0
  19. package/lib/components/tablero/tablero.component.d.ts +17 -4
  20. package/lib/sf-crud.module.d.ts +75 -73
  21. package/lib/sf-crud.service.d.ts +4 -0
  22. package/lib/shared/{services/models → models}/crud-config.model.d.ts +8 -2
  23. package/lib/shared/models/data-temp-crud.model.d.ts +4 -0
  24. package/lib/shared/{services/models → models}/shema.model.d.ts +1 -0
  25. package/lib/shared/services/general.service.d.ts +1 -1
  26. package/package.json +1 -1
  27. package/public-api.d.ts +1 -0
  28. package/esm2015/lib/shared/services/models/crud-config.model.js +0 -43
  29. package/esm2015/lib/shared/services/models/shema.model.js +0 -7
@@ -1,5 +1,7 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Injectable, Component, Input, EventEmitter, Output, NgModule } from '@angular/core';
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,31 +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';
15
+ import * as i6 from 'primeng/splitbutton';
16
+ import { SplitButtonModule } from 'primeng/splitbutton';
13
17
  import * as i7 from '@angular/common';
14
18
  import * as i3$1 from 'primeng/api';
15
19
  import { MessageService } from 'primeng/api';
16
- import * as i8 from 'primeng/button';
20
+ import * as i9 from 'primeng/button';
17
21
  import { ButtonModule } from 'primeng/button';
18
- import * as i9 from 'primeng/ripple';
22
+ import * as i10 from 'primeng/ripple';
19
23
  import { RippleModule } from 'primeng/ripple';
20
- import * as i10 from 'primeng/inputtext';
24
+ import * as i11 from 'primeng/inputtext';
21
25
  import { InputTextModule } from 'primeng/inputtext';
22
- import * as i11 from 'primeng/tooltip';
23
- import { TooltipModule } from 'primeng/tooltip';
24
- import * as jsonpath from 'jsonpath';
25
- import * as i5$1 from 'primeng/toast';
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$3 from 'primeng/toast';
26
30
  import { ToastModule } from 'primeng/toast';
27
- import * as i2$1 from 'primeng/dropdown';
31
+ import * as i2$1 from 'primeng/inputmask';
32
+ import { InputMaskModule } from 'primeng/inputmask';
33
+ import * as i3$2 from 'primeng/dropdown';
28
34
  import { DropdownModule } from 'primeng/dropdown';
29
- import * as i3$2 from 'primeng/calendar';
35
+ import * as i4$1 from 'primeng/autocomplete';
36
+ import { AutoCompleteModule } from 'primeng/autocomplete';
37
+ import * as i5$1 from 'primeng/calendar';
30
38
  import { CalendarModule } from 'primeng/calendar';
31
- import * as i4$1 from 'primeng/inputnumber';
39
+ import * as i6$1 from 'primeng/inputnumber';
32
40
  import { InputNumberModule } from 'primeng/inputnumber';
33
- import * as i6 from '@angular/forms';
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';
34
46
  import { FormsModule } from '@angular/forms';
35
47
  import { AccordionModule } from 'primeng/accordion';
36
- import { AvatarModule } from 'primeng/avatar';
37
48
  import { AvatarGroupModule } from 'primeng/avatargroup';
49
+ import { AvatarModule } from 'primeng/avatar';
38
50
  import { BadgeModule } from 'primeng/badge';
39
51
  import { BreadcrumbModule } from 'primeng/breadcrumb';
40
52
  import { CardModule } from 'primeng/card';
@@ -43,33 +55,28 @@ import { CascadeSelectModule } from 'primeng/cascadeselect';
43
55
  import { CheckboxModule } from 'primeng/checkbox';
44
56
  import { ChipModule } from 'primeng/chip';
45
57
  import { ChipsModule } from 'primeng/chips';
46
- import { CodeHighlighterModule } from 'primeng/codehighlighter';
58
+ import { ColorPickerModule } from 'primeng/colorpicker';
47
59
  import { ConfirmDialogModule } from 'primeng/confirmdialog';
48
60
  import { ConfirmPopupModule } from 'primeng/confirmpopup';
49
- import { ColorPickerModule } from 'primeng/colorpicker';
50
61
  import { ContextMenuModule } from 'primeng/contextmenu';
51
62
  import { DialogModule } from 'primeng/dialog';
52
63
  import { DividerModule } from 'primeng/divider';
53
64
  import { FieldsetModule } from 'primeng/fieldset';
54
- import { FileUploadModule } from 'primeng/fileupload';
55
65
  import { GalleriaModule } from 'primeng/galleria';
56
66
  import { InplaceModule } from 'primeng/inplace';
57
- import { InputMaskModule } from 'primeng/inputmask';
58
- import { InputSwitchModule } from 'primeng/inputswitch';
59
67
  import { InputTextareaModule } from 'primeng/inputtextarea';
60
68
  import { KnobModule } from 'primeng/knob';
61
- import { LightboxModule } from 'primeng/lightbox';
62
69
  import { ListboxModule } from 'primeng/listbox';
63
70
  import { MegaMenuModule } from 'primeng/megamenu';
64
- import { MenuModule } from 'primeng/menu';
65
71
  import { MenubarModule } from 'primeng/menubar';
66
- import { MessagesModule } from 'primeng/messages';
72
+ import { MenuModule } from 'primeng/menu';
67
73
  import { MessageModule } from 'primeng/message';
74
+ import { MessagesModule } from 'primeng/messages';
68
75
  import { MultiSelectModule } from 'primeng/multiselect';
69
76
  import { OrganizationChartModule } from 'primeng/organizationchart';
70
77
  import { OverlayPanelModule } from 'primeng/overlaypanel';
71
- import { PanelModule } from 'primeng/panel';
72
78
  import { PanelMenuModule } from 'primeng/panelmenu';
79
+ import { PanelModule } from 'primeng/panel';
73
80
  import { PasswordModule } from 'primeng/password';
74
81
  import { ProgressBarModule } from 'primeng/progressbar';
75
82
  import { RadioButtonModule } from 'primeng/radiobutton';
@@ -90,6 +97,7 @@ import { TerminalModule } from 'primeng/terminal';
90
97
  import { TieredMenuModule } from 'primeng/tieredmenu';
91
98
  import { TimelineModule } from 'primeng/timeline';
92
99
  import { ToggleButtonModule } from 'primeng/togglebutton';
100
+ import { TooltipModule } from 'primeng/tooltip';
93
101
  import { TreeModule } from 'primeng/tree';
94
102
 
95
103
  class Shema {
@@ -113,8 +121,8 @@ class ConfigTablero {
113
121
  this.endpoint = '';
114
122
  this.method = '';
115
123
  this.server = '';
116
- this.key = '';
117
124
  this.filters = [];
125
+ this.keys = [];
118
126
  }
119
127
  }
120
128
  class ConfigRegistro {
@@ -194,6 +202,8 @@ class TableroComponent {
194
202
  this.opciones = [];
195
203
  this.idEntidad = '';
196
204
  this.idKatios = '';
205
+ this.onSelectAction = new EventEmitter();
206
+ this.items = [];
197
207
  this.crudConfig = new CrudConfig();
198
208
  this.enProceso = false;
199
209
  this.data = [];
@@ -208,7 +218,6 @@ class TableroComponent {
208
218
  .then(res => {
209
219
  this.crudConfig = res;
210
220
  this.getInfoTablero(this.crudConfig.tablero);
211
- this.loadOptions();
212
221
  })
213
222
  .catch(err => {
214
223
  console.log(err);
@@ -216,9 +225,15 @@ class TableroComponent {
216
225
  });
217
226
  }
218
227
  getInfoTablero(configTablero) {
219
- this.generalService.genericRequest(configTablero.method, configTablero.server, configTablero.endpoint)
228
+ this.generalService.genericRequest(configTablero.method, configTablero.server, this.aplyKeys(configTablero.keys, configTablero.endpoint, this.dataExt))
220
229
  .then((res) => {
221
- this.data = res.data;
230
+ let aux;
231
+ if (!Array.isArray(res))
232
+ aux = res.data;
233
+ else
234
+ aux = res;
235
+ this.generateData(aux);
236
+ this.loadOptions();
222
237
  this.enProceso = false;
223
238
  })
224
239
  .catch(err => {
@@ -226,11 +241,27 @@ class TableroComponent {
226
241
  this.enProceso = false;
227
242
  });
228
243
  }
244
+ generateData(data) {
245
+ data.forEach((item) => {
246
+ let newItem = {};
247
+ this.crudConfig.tablero.columns.forEach(col => {
248
+ newItem[col.col] = this.getValue(col.col, item);
249
+ });
250
+ this.data.push(newItem);
251
+ });
252
+ console.log(this.data);
253
+ }
254
+ getValue(path, item) {
255
+ if (path.includes("."))
256
+ return jsonpath.query(item, path)[0];
257
+ return item[path];
258
+ }
229
259
  loadOptions() {
260
+ this.items = [];
230
261
  this.btn.create = this.opciones.find(x => x.label == 'Crear');
231
- this.btn.read = this.opciones.find(x => x.label == 'Visualizar');
232
- this.btn.update = this.opciones.find(x => x.label == 'Editar');
233
- this.btn.delete = this.opciones.find(x => x.label == 'Eliminar');
262
+ this.opciones.filter((opc) => opc.valor.action).forEach(opc => {
263
+ this.items.push({ label: opc.label, icon: opc.icon, command: () => this.execAction(opc.valor) });
264
+ });
234
265
  }
235
266
  redirect(accion, data) {
236
267
  var _a, _b;
@@ -239,21 +270,52 @@ class TableroComponent {
239
270
  this.router.navigateByUrl(((_b = (_a = this.btn.create) === null || _a === void 0 ? void 0 : _a.valor) === null || _b === void 0 ? void 0 : _b.redirect) || '');
240
271
  break;
241
272
  case 'read':
242
- this.router.navigateByUrl(this.btn.read.valor.redirect.replace('$id', data[this.crudConfig.tablero.key]));
273
+ this.router.navigateByUrl(this.aplyKeys(this.crudConfig.tablero.keys, this.btn.read.valor.redirect, data));
243
274
  break;
244
275
  case 'update':
245
- this.router.navigateByUrl(this.btn.update.valor.redirect.replace('$id', data[this.crudConfig.tablero.key]));
276
+ this.router.navigateByUrl(this.aplyKeys(this.crudConfig.tablero.keys, this.btn.update.valor.redirect, data));
246
277
  break;
247
278
  case 'delete':
248
- this.router.navigateByUrl(this.btn.delete.valor.redirect.replace('$id', data[this.crudConfig.tablero.key]));
279
+ this.router.navigateByUrl(this.aplyKeys(this.crudConfig.tablero.keys, this.btn.delete.valor.redirect, data));
249
280
  break;
250
281
  default:
251
282
  break;
252
283
  }
253
284
  }
285
+ aplyKeys(keys, endpoint, data) {
286
+ keys.forEach(key => {
287
+ var _a, _b, _c, _d;
288
+ switch (key.key) {
289
+ case '@ndoc':
290
+ 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) || '');
291
+ break;
292
+ case '@tdoc':
293
+ 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) || '');
294
+ break;
295
+ case '@idKatios':
296
+ endpoint = endpoint.replace(key.key, this.idKatios);
297
+ break;
298
+ default:
299
+ if (endpoint.includes(key.key) && data)
300
+ endpoint = endpoint.replace(key.key, jsonpath.query(data, (key === null || key === void 0 ? void 0 : key.scope) || '')[0]);
301
+ break;
302
+ }
303
+ });
304
+ return endpoint;
305
+ }
306
+ execAction(params) {
307
+ switch (params.action) {
308
+ case 'redirect':
309
+ this.router.navigateByUrl(this.aplyKeys(this.crudConfig.tablero.keys, params.link, this.itemSelected));
310
+ break;
311
+ default:
312
+ this.onSelectAction.emit({ data: _.cloneDeep(this.itemSelected), params });
313
+ break;
314
+ }
315
+ }
254
316
  }
255
317
  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 });
256
- 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} {{idEntidad}}\"\r\n [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\">{{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 <td *ngFor=\"let col of columns\">\r\n {{rowData[col.col]}}\r\n </td>\r\n <th>\r\n <button *ngIf=\"btn.read\" pButton pRipple [pTooltip]=\"btn.read.label\" [icon]=\"btn.read.icon\"\r\n class=\"p-button-rounded p-button-info mr-2\" (click)=\"redirect('read', rowData)\"></button>\r\n <button *ngIf=\"btn.update\" pButton pRipple [pTooltip]=\"btn.update.label\" [icon]=\"btn.update.icon\"\r\n class=\"p-button-rounded p-button-warning mr-2\" (click)=\"redirect('update', rowData)\"></button>\r\n <button *ngIf=\"btn.delete\" pButton pRipple [pTooltip]=\"btn.delete.label\" [icon]=\"btn.delete.icon\"\r\n class=\"p-button-rounded p-button-danger mr-2\" (click)=\"redirect('delete', rowData)\"></button>\r\n </th>\r\n </tr>\r\n </ng-template>\r\n </p-table>\r\n</div>", components: [{ type: i3.BlockUI, selector: "p-blockUI", inputs: ["autoZIndex", "baseZIndex", "blocked", "target", "styleClass"] }, { type: i4.Toolbar, selector: "p-toolbar", inputs: ["style", "styleClass"] }, { type: i5.Table, selector: "p-table", inputs: ["pageLinks", "alwaysShowPaginator", "paginatorPosition", "paginatorDropdownScrollHeight", "currentPageReportTemplate", "showFirstLastIcon", "showPageLinks", "defaultSortOrder", "sortMode", "resetPageOnSort", "contextMenuSelectionMode", "rowTrackBy", "lazy", "lazyLoadOnInit", "compareSelectionBy", "csvSeparator", "exportFilename", "filters", "filterDelay", "expandedRowKeys", "editingRowKeys", "rowExpandMode", "virtualScrollDelay", "virtualRowHeight", "columnResizeMode", "loadingIcon", "showLoader", "showInitialSortBadge", "stateStorage", "editMode", "totalRecords", "value", "columns", "first", "rows", "sortField", "sortOrder", "multiSortMeta", "selection", "contextMenuSelection", "frozenColumns", "frozenValue", "style", "styleClass", "tableStyle", "tableStyleClass", "paginator", "rowsPerPageOptions", "paginatorDropdownAppendTo", "showCurrentPageReport", "showJumpToPageDropdown", "selectionMode", "dataKey", "metaKeySelection", "globalFilterFields", "filterLocale", "scrollable", "scrollHeight", "virtualScroll", "frozenWidth", "responsive", "contextMenu", "resizableColumns", "reorderableColumns", "loading", "rowHover", "customSort", "autoLayout", "exportFunction", "stateKey", "minBufferPx", "maxBufferPx"], 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: i3$1.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { type: i8.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { type: i9.Ripple, selector: "[pRipple]" }, { type: i10.InputText, selector: "[pInputText]" }, { type: i7.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i11.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "tooltipZIndex", "escape", "tooltipDisabled", "pTooltip", "positionStyle", "tooltipStyleClass", "showDelay", "hideDelay", "life"] }] });
318
+ 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: i3$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 } });
257
319
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: TableroComponent, decorators: [{
258
320
  type: Component,
259
321
  args: [{
@@ -266,6 +328,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
266
328
  type: Input
267
329
  }], idKatios: [{
268
330
  type: Input
331
+ }], user: [{
332
+ type: Input
333
+ }], dataExt: [{
334
+ type: Input
335
+ }], onSelectAction: [{
336
+ type: Output
269
337
  }] } });
270
338
 
271
339
  class ControlComponent {
@@ -274,19 +342,54 @@ class ControlComponent {
274
342
  this.control = new Shema();
275
343
  this.label = '';
276
344
  this.setValue = new EventEmitter();
345
+ this.sendNotification = new EventEmitter();
346
+ this.sendObject = new EventEmitter();
277
347
  this.isLoading = false;
278
348
  this.dataFromService = [];
349
+ this.uploadedFiles = [];
350
+ this.displayAdd = false;
351
+ this.tempValue = {};
279
352
  }
280
353
  ngOnInit() {
281
354
  var _a;
282
355
  if (((_a = this.control) === null || _a === void 0 ? void 0 : _a.config) && this.control.subtype == 'dropdown')
283
356
  this.loadDataFromService();
357
+ if (this.value && this.control.subtype == 'autocomplete')
358
+ this.setDefaultValue();
284
359
  }
285
360
  sendValue() {
286
361
  this.setValue.emit(this.value);
287
362
  }
363
+ sendValueFromObject(event) {
364
+ switch (typeof (this.control.config.optionValue)) {
365
+ case 'object':
366
+ this.control.config.optionValue.forEach((op) => op['value'] = event[op.key]);
367
+ this.setValue.emit(this.control.config.optionValue);
368
+ break;
369
+ default:
370
+ this.setValue.emit(event[this.control.config.optionValue]);
371
+ break;
372
+ }
373
+ }
374
+ validateValue(type) {
375
+ switch (type) {
376
+ case 'email':
377
+ let regex = new RegExp(/([\w\.\-_]+)?\w+@[\w-_]+(\.\w+){1,}/igm);
378
+ if (regex.test(this.value))
379
+ this.sendValue();
380
+ else {
381
+ this.value = null;
382
+ this.sendValue();
383
+ this.sendNotification.emit({ severity: 'warn', detail: 'El correo no es válido' });
384
+ }
385
+ break;
386
+ default:
387
+ break;
388
+ }
389
+ }
288
390
  loadDataFromService() {
289
391
  this.isLoading = true;
392
+ this.dataFromService = [];
290
393
  this.generalService.genericRequest(this.control.config.method, this.control.config.server, this.control.config.endpoint)
291
394
  .then((res) => {
292
395
  this.dataFromService = res.data;
@@ -301,9 +404,57 @@ class ControlComponent {
301
404
  this.isLoading = false;
302
405
  });
303
406
  }
407
+ onUpload(event) {
408
+ let file = event.files[0];
409
+ let formData = new FormData();
410
+ let path = 'Imagenes/CRUD/temp';
411
+ formData.append('uploadFile', file);
412
+ formData.append('Ruta', `/${path}`);
413
+ this.isLoading = true;
414
+ this.generalService.genericRequest(this.control.config.method, this.control.config.server, this.control.config.endpoint, formData)
415
+ .then(() => {
416
+ this.sendNotification.emit({ severity: 'info', detail: `Archivo cargado correctamente!` });
417
+ this.uploadedFiles.push(file);
418
+ this.isLoading = false;
419
+ this.value = `${this.generalService.jsonConfig.Server}${path}/${file.name}`;
420
+ this.sendValue();
421
+ })
422
+ .catch(err => {
423
+ console.log(err);
424
+ this.isLoading = false;
425
+ this.sendNotification.emit({ severity: 'error', detail: `Error al cargar el archivo!` });
426
+ });
427
+ }
428
+ refresData() {
429
+ var _a, _b;
430
+ if ((_b = (_a = this.control) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.endpointtemp)
431
+ this.loadDataFromService();
432
+ }
433
+ setDefaultValue() {
434
+ var _a;
435
+ 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 });
436
+ }
437
+ searchValue(value) {
438
+ let endpoint = this.control.config.endpoint.replace('@id', value);
439
+ this.generalService.genericRequest(this.control.config.method, this.control.config.server, endpoint)
440
+ .then((res) => {
441
+ var _a;
442
+ if (((_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.length) > 0) {
443
+ this.sendObject.emit({ data: res.data[0], optionValue: this.control.config.optionValue });
444
+ }
445
+ else {
446
+ this.sendNotification.emit({ severity: 'warn', detail: `Valor no encontrado.` });
447
+ this.sendObject.emit({ data: null, optionValue: this.control.config.optionValue });
448
+ }
449
+ })
450
+ .catch(err => {
451
+ console.log(err);
452
+ this.sendNotification.emit({ severity: 'error', detail: `Error al consumir el servicio.` });
453
+ });
454
+ }
304
455
  }
305
456
  ControlComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ControlComponent, deps: [{ token: GeneralService }], target: i0.ɵɵFactoryTarget.Component });
306
- 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\" [suggestions]=\"dataFromService\" [minlength]=\"3\"\r\n (completeMethod)=\"loadDataFromControlBusquedaService($event)\" [forceSelection]=\"true\" (onSelect)=\"sendValue()\"\r\n [field]=\"control.field\"></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()\" [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\"\r\n [currency]=\"control?.currency || 'USD'\"></p-inputNumber>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'decimal'\">\r\n <p-inputNumber [(ngModel)]=\"value\" mode=\"decimal\"\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=\" %\"\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.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: i4$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: i7.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i7.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i6.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: i6.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i6.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i6.MinLengthValidator, selector: "[minlength][formControlName],[minlength][formControl],[minlength][ngModel]", inputs: ["minlength"] }] });
457
+ 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=\"'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\"></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)\" [(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()\"\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\"\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\"\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$1.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$2.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: 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: i3$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"] }] });
307
458
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ControlComponent, decorators: [{
308
459
  type: Component,
309
460
  args: [{
@@ -316,39 +467,298 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
316
467
  type: Input
317
468
  }], value: [{
318
469
  type: Input
470
+ }], appendTo: [{
471
+ type: Input
319
472
  }], setValue: [{
320
473
  type: Output
474
+ }], sendNotification: [{
475
+ type: Output
476
+ }], sendObject: [{
477
+ type: Output
321
478
  }] } });
322
479
 
480
+ class RegistroChildComponent {
481
+ constructor(ref, config, messageService) {
482
+ this.ref = ref;
483
+ this.config = config;
484
+ this.messageService = messageService;
485
+ this.esquema = new Shema();
486
+ }
487
+ ngOnInit() {
488
+ var _a;
489
+ this.uiEsquema = this.config.data.uiEsquema[0];
490
+ this.esquema = this.config.data.esquema;
491
+ this.data = (_a = this.config.data) === null || _a === void 0 ? void 0 : _a.data;
492
+ if (!this.data) {
493
+ this.data = this.createObject(this.esquema);
494
+ jsonpath.value(this.data, '$..id', this.config.data.id);
495
+ }
496
+ }
497
+ getControl(scope) {
498
+ return jsonpath.query(this.esquema, scope)[0];
499
+ }
500
+ getValue(scope) {
501
+ return jsonpath.query(this.data, scope.replace('.properties', ''))[0];
502
+ }
503
+ setValue(value, scope) {
504
+ switch (typeof (value)) {
505
+ case 'object':
506
+ if (Array.isArray(value))
507
+ value.forEach((val) => jsonpath.value(this.data, val.scope.replace('.properties', ''), val.value));
508
+ else
509
+ jsonpath.value(this.data, scope.replace('.properties', ''), value);
510
+ break;
511
+ default:
512
+ jsonpath.value(this.data, scope.replace('.properties', ''), value);
513
+ break;
514
+ }
515
+ this.applyValuesOnEvent('onChange', this.esquema, scope.replace('$..properties.', ''));
516
+ }
517
+ createObject(esquema) {
518
+ let object = {};
519
+ switch (esquema.type) {
520
+ case 'numeric':
521
+ return (esquema === null || esquema === void 0 ? void 0 : esquema.default) || 0;
522
+ case 'string':
523
+ case 'date':
524
+ return (esquema === null || esquema === void 0 ? void 0 : esquema.default) ? this.setDefaultValue(esquema.default) : null;
525
+ case 'boolean':
526
+ return (esquema === null || esquema === void 0 ? void 0 : esquema.default) || false;
527
+ case 'file':
528
+ return null;
529
+ case 'array':
530
+ case 'object':
531
+ for (const key in esquema === null || esquema === void 0 ? void 0 : esquema.properties) {
532
+ Object.defineProperty(object, key, { value: this.createObject(esquema === null || esquema === void 0 ? void 0 : esquema.properties[key]), writable: true, enumerable: true, configurable: true });
533
+ }
534
+ break;
535
+ default:
536
+ break;
537
+ }
538
+ return object;
539
+ }
540
+ setDefaultValue(value) {
541
+ let data = null;
542
+ let uactivo;
543
+ switch (value) {
544
+ case '@uactivo':
545
+ uactivo = JSON.parse(localStorage.getItem('oSessionTFM') || '{}');
546
+ if (!uactivo)
547
+ console.log('Validar configuracion de sesion');
548
+ else
549
+ data = `${uactivo.UsuarioSistema.TDOC}-${uactivo.UsuarioSistema.NDOC}`;
550
+ break;
551
+ case '@tdocactivo':
552
+ uactivo = JSON.parse(sessionStorage.getItem('usrSesion') || '{}');
553
+ if (!uactivo)
554
+ console.log('Validar configuracion de sesion');
555
+ else
556
+ data = uactivo.UsuarioSistema.TDOC;
557
+ break;
558
+ case '@ndocactivo':
559
+ uactivo = JSON.parse(sessionStorage.getItem('usrSesion') || '{}');
560
+ if (!uactivo)
561
+ console.log('Validar configuracion de sesion');
562
+ else
563
+ data = uactivo.UsuarioSistema.NDOC;
564
+ break;
565
+ case '@hoy':
566
+ data = new Date();
567
+ break;
568
+ default:
569
+ data = value;
570
+ break;
571
+ }
572
+ return data;
573
+ }
574
+ submit() {
575
+ this.applyValuesOnEvent('onSubmit', this.esquema);
576
+ if (!this.validateData())
577
+ return;
578
+ this.ref.close(this.data);
579
+ }
580
+ cancel() {
581
+ this.applyValuesOnEvent('onCancel', this.esquema);
582
+ this.ref.close();
583
+ }
584
+ validateData() {
585
+ if (this.esquema.validations.type == 'local')
586
+ return this.validateDataLocal();
587
+ return true;
588
+ }
589
+ validateDataLocal() {
590
+ let err = [];
591
+ this.esquema.validations.required.forEach((x) => {
592
+ if (!jsonpath.query(this.data, x.field)[0])
593
+ err.push(x.message);
594
+ });
595
+ if (err.length != 0)
596
+ this.messageService.add({ severity: 'warn', detail: err.join('. ') });
597
+ return err.length == 0;
598
+ }
599
+ applyValuesOnEvent(event, esquema, scope) {
600
+ if (scope) {
601
+ if (esquema.properties[scope][event]) {
602
+ esquema.properties[scope][event].forEach((value) => {
603
+ this.setValueEvent(this.data, value);
604
+ });
605
+ }
606
+ }
607
+ else {
608
+ for (const key in esquema.properties) {
609
+ if (esquema.properties[key][event]) {
610
+ esquema.properties[key][event].forEach((value) => {
611
+ this.setValueEvent(this.data, value);
612
+ });
613
+ }
614
+ }
615
+ }
616
+ }
617
+ setValueEvent(data, params) {
618
+ var _a;
619
+ let value;
620
+ let date = moment(new Date());
621
+ switch (params.op) {
622
+ case 'sum':
623
+ 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);
624
+ break;
625
+ case 'concat':
626
+ let array = [];
627
+ (_a = params === null || params === void 0 ? void 0 : params.key) === null || _a === void 0 ? void 0 : _a.reduce((acc, cur) => {
628
+ array.push(jsonpath.query(data, cur)[0]);
629
+ }, []);
630
+ if (params === null || params === void 0 ? void 0 : params.separator)
631
+ jsonpath.value(data, params.scope[0], array.join((params === null || params === void 0 ? void 0 : params.separator) || ' '));
632
+ break;
633
+ case 'enable':
634
+ jsonpath.value(this.esquema, params.scope[0], false);
635
+ break;
636
+ case 'disabled':
637
+ jsonpath.value(this.esquema, params.scope[0], true);
638
+ break;
639
+ case 'replace:endpoint':
640
+ jsonpath.value(this.esquema, params.scope[0], jsonpath.query(this.esquema, params.scope[1])[0].replace(params.scope[2], jsonpath.query(data, `$..${params.key}`)));
641
+ break;
642
+ case 'setNull':
643
+ jsonpath.value(this.data, `$.${params.key}`, null);
644
+ break;
645
+ case 'datediff:years':
646
+ jsonpath.value(this.data, params.scope[0], date.diff(moment(jsonpath.query(this.data, params.scope[1])[0]), 'years'));
647
+ break;
648
+ case 'datediff:months':
649
+ jsonpath.value(this.data, params.scope[0], date.diff(moment(jsonpath.query(this.data, params.scope[1])[0]), 'months'));
650
+ break;
651
+ case 'datediff:weeks':
652
+ jsonpath.value(this.data, params.scope[0], date.diff(moment(jsonpath.query(this.data, params.scope[1])[0]), 'weeks'));
653
+ break;
654
+ case 'datediff:days':
655
+ jsonpath.value(this.data, params.scope[0], date.diff(moment(jsonpath.query(this.data, params.scope[1])[0]), 'days'));
656
+ break;
657
+ default:
658
+ break;
659
+ }
660
+ return value;
661
+ }
662
+ sendNotification(message) {
663
+ this.messageService.add(message);
664
+ }
665
+ applyValuesFromObject(event) {
666
+ if (event.data)
667
+ event.optionValue.forEach((value) => jsonpath.value(this.data, value.scope.replace('.properties', ''), this.aplyFormatValue(value.scope, event.data[value.key])));
668
+ else
669
+ event.optionValue.forEach((value) => jsonpath.value(this.data, value.scope.replace('.properties', ''), null));
670
+ }
671
+ aplyFormatValue(scope, value) {
672
+ let control = jsonpath.query(this.esquema, scope)[0];
673
+ let resp;
674
+ switch (control.type) {
675
+ case 'date':
676
+ resp = new Date(`${value}`);
677
+ break;
678
+ case 'numeric':
679
+ resp = +value;
680
+ break;
681
+ default:
682
+ resp = value;
683
+ break;
684
+ }
685
+ return resp;
686
+ }
687
+ }
688
+ 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: i3$1.MessageService }], target: i0.ɵɵFactoryTarget.Component });
689
+ RegistroChildComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: RegistroChildComponent, selector: "lib-registro-child", providers: [MessageService], 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>", components: [{ type: i3$3.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]" }] });
690
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RegistroChildComponent, decorators: [{
691
+ type: Component,
692
+ args: [{
693
+ selector: 'lib-registro-child',
694
+ templateUrl: './registro-child.component.html',
695
+ providers: [MessageService]
696
+ }]
697
+ }], ctorParameters: function () { return [{ type: i1$1.DynamicDialogRef }, { type: i1$1.DynamicDialogConfig }, { type: i3$1.MessageService }]; } });
698
+
699
+ class SfCrudService {
700
+ constructor() {
701
+ this._dataTemp = [];
702
+ }
703
+ saveDataTemp(scope, value) {
704
+ this._dataTemp.push({ scope, value });
705
+ sessionStorage.setItem('dataTemp', JSON.stringify(this._dataTemp));
706
+ }
707
+ getDataTemp() {
708
+ let dataTemp = sessionStorage.getItem('dataTemp');
709
+ sessionStorage.removeItem('dataTemp');
710
+ return dataTemp ? JSON.parse(dataTemp) : [];
711
+ }
712
+ cleanDataTemp() {
713
+ sessionStorage.removeItem('dataTemp');
714
+ }
715
+ }
716
+ SfCrudService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SfCrudService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
717
+ SfCrudService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SfCrudService, providedIn: 'root' });
718
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SfCrudService, decorators: [{
719
+ type: Injectable,
720
+ args: [{
721
+ providedIn: 'root'
722
+ }]
723
+ }], ctorParameters: function () { return []; } });
724
+
323
725
  class RegistroComponent {
324
- constructor(generalService, router, messageSerice) {
726
+ constructor(generalService, router, messageSerice, dialogService, sfCrudService) {
325
727
  this.generalService = generalService;
326
728
  this.router = router;
327
729
  this.messageSerice = messageSerice;
730
+ this.dialogService = dialogService;
731
+ this.sfCrudService = sfCrudService;
328
732
  this.idKatios = '';
329
733
  this.idEntidad = '';
330
734
  this.trx = '';
331
735
  this.id = '';
332
- this.enProceso = false;
736
+ this.sendData = new EventEmitter();
737
+ this.onSubmit = new EventEmitter();
738
+ this.dataTemp = [];
333
739
  this.crudConfig = new CrudConfig();
740
+ this.enProceso = false;
334
741
  this.configOperation = new Operations();
742
+ this.isLocal = false;
743
+ this.dataTemp = this.sfCrudService.getDataTemp();
335
744
  }
336
745
  ngOnInit() {
337
746
  this.loadConfigCrud();
338
- this.setLabelSumbit();
339
747
  }
340
748
  loadConfigCrud() {
341
749
  this.enProceso = true;
342
750
  this.generalService.getCrudByEntidad(this.idKatios, this.idEntidad)
343
751
  .then(res => {
752
+ this.setDataTemp(res.esquema, this.dataTemp);
344
753
  this.crudConfig = res;
345
- if (this.trx != 'c')
346
- this.getInfoRegistro(this.crudConfig.registro);
347
- else {
754
+ if (this.trx == 'c') {
348
755
  this.data = this.createObject(this.crudConfig.esquema);
756
+ this.setLabelSumbit();
349
757
  this.enProceso = false;
758
+ this.configOperation = this.crudConfig.registro.operations.find(x => x.type.startsWith(this.trx)) || new Operations();
350
759
  }
351
- this.configOperation = this.crudConfig.registro.operations.find(x => x.type.startsWith(this.trx)) || new Operations();
760
+ else
761
+ this.getInfoRegistro(this.crudConfig.registro);
352
762
  })
353
763
  .catch(err => {
354
764
  console.log(err);
@@ -369,11 +779,25 @@ class RegistroComponent {
369
779
  let op = configRegistro.operations.find(x => x.type == 'read');
370
780
  let endpoint = (op === null || op === void 0 ? void 0 : op.endpoint) || '';
371
781
  endpoint = endpoint.replace('@idKatios', this.idKatios);
782
+ endpoint = endpoint.replace('@ndocactivo', this.user.UsuarioSistema.NDOC);
372
783
  endpoint = endpoint.replace('@id', this.id);
373
784
  this.generalService.genericRequest((op === null || op === void 0 ? void 0 : op.method) || '', (op === null || op === void 0 ? void 0 : op.server) || '', endpoint)
374
785
  .then((res) => {
375
- this.data = res.data;
786
+ if (res === null || res === void 0 ? void 0 : res.data) {
787
+ if (Array.isArray(res.data))
788
+ this.data = res.data[0];
789
+ else
790
+ this.data = res.data;
791
+ this.trx = 'u';
792
+ }
793
+ else {
794
+ this.trx = 'c';
795
+ this.data = this.createObject(this.crudConfig.esquema);
796
+ console.log(this.data);
797
+ }
376
798
  this.enProceso = false;
799
+ this.configOperation = this.crudConfig.registro.operations.find(x => x.type.startsWith(this.trx)) || new Operations();
800
+ this.setLabelSumbit();
377
801
  })
378
802
  .catch(err => {
379
803
  console.log(err);
@@ -390,19 +814,33 @@ class RegistroComponent {
390
814
  return jsonpath.query(this.data, scope.replace('.properties', ''))[0];
391
815
  }
392
816
  setValue(value, scope) {
393
- jsonpath.value(this.data, scope.replace('.properties', ''), value);
817
+ switch (typeof (value)) {
818
+ case 'object':
819
+ if (Array.isArray(value))
820
+ value.forEach((val) => jsonpath.value(this.data, val.scope.replace('.properties', ''), val.value));
821
+ else
822
+ jsonpath.value(this.data, scope.replace('.properties', ''), value);
823
+ break;
824
+ default:
825
+ jsonpath.value(this.data, scope.replace('.properties', ''), value);
826
+ break;
827
+ }
828
+ this.applyValuesOnEvent('onChange', this.crudConfig.esquema);
394
829
  }
395
830
  createObject(esquema) {
396
831
  let object = {};
397
832
  switch (esquema.type) {
833
+ case 'numeric':
834
+ return (esquema === null || esquema === void 0 ? void 0 : esquema.default) || 0;
398
835
  case 'string':
399
- case 'number':
400
836
  case 'date':
401
837
  return (esquema === null || esquema === void 0 ? void 0 : esquema.default) ? this.setDefaultValue(esquema.default) : null;
402
838
  case 'boolean':
403
839
  return (esquema === null || esquema === void 0 ? void 0 : esquema.default) || false;
404
840
  case 'array':
405
841
  return [];
842
+ case 'file':
843
+ return null;
406
844
  case 'object':
407
845
  for (const key in esquema === null || esquema === void 0 ? void 0 : esquema.properties) {
408
846
  Object.defineProperty(object, key, { value: this.createObject(esquema === null || esquema === void 0 ? void 0 : esquema.properties[key]), writable: true, enumerable: true, configurable: true });
@@ -414,8 +852,10 @@ class RegistroComponent {
414
852
  return object;
415
853
  }
416
854
  submit() {
855
+ console.log(this.data);
417
856
  if (!this.validateData())
418
857
  return;
858
+ this.applyValuesOnEvent('onSubmit', this.crudConfig.esquema);
419
859
  this.enProceso = true;
420
860
  let endpoint = this.configOperation.endpoint;
421
861
  endpoint = endpoint.replace('@idKatios', this.idKatios);
@@ -423,9 +863,13 @@ class RegistroComponent {
423
863
  this.generalService.genericRequest(this.configOperation.method, this.configOperation.server, endpoint, this.data)
424
864
  .then(() => {
425
865
  this.messageSerice.add({ severity: 'success', detail: `Proceso exitoso!` });
866
+ this.enProceso = false;
426
867
  setTimeout(() => {
427
- this.enProceso = false;
428
- this.back();
868
+ var _a, _b;
869
+ if ((_a = this.configOperation) === null || _a === void 0 ? void 0 : _a.redirect)
870
+ this.router.navigate([(_b = this.configOperation) === null || _b === void 0 ? void 0 : _b.redirect]);
871
+ else
872
+ this.onSubmit.emit(this.data);
429
873
  }, 2000);
430
874
  })
431
875
  .catch(err => {
@@ -440,11 +884,24 @@ class RegistroComponent {
440
884
  return true;
441
885
  }
442
886
  validateDataLocal() {
887
+ var _a, _b, _c, _d;
443
888
  let err = [];
444
- this.configOperation.validations.required.forEach(x => {
889
+ (_b = (_a = this.configOperation.validations) === null || _a === void 0 ? void 0 : _a.required) === null || _b === void 0 ? void 0 : _b.forEach(x => {
445
890
  if (!jsonpath.query(this.data, x.field)[0])
446
891
  err.push(x.message);
447
892
  });
893
+ (_d = (_c = this.configOperation.validations) === null || _c === void 0 ? void 0 : _c.operations) === null || _d === void 0 ? void 0 : _d.forEach((op) => {
894
+ switch (op.action) {
895
+ case 'sumArray':
896
+ let var1 = jsonpath.query(this.data, op.scope[0]).reduce((acc, cur) => acc += cur[op.key], 0);
897
+ let var2 = jsonpath.query(this.data, op.scope[1]).reduce((acc, cur) => acc += cur[op.key], 0);
898
+ if (var1 != var2)
899
+ err.push(op.message);
900
+ break;
901
+ default:
902
+ break;
903
+ }
904
+ });
448
905
  if (err.length != 0)
449
906
  this.messageSerice.add({ severity: 'warn', detail: err.join('. ') });
450
907
  return err.length == 0;
@@ -453,11 +910,13 @@ class RegistroComponent {
453
910
  let data = null;
454
911
  switch (value) {
455
912
  case '@uactivo':
456
- let uactivo = JSON.parse(localStorage.getItem('oSessionTFM') || '{}');
457
- if (!uactivo)
458
- console.log('Validar configuracion de sesion');
459
- else
460
- data = `${uactivo.UsuarioSistema.TDOC}-${uactivo.UsuarioSistema.NDOC}`;
913
+ data = `${this.user.UsuarioSistema.TDOC}-${this.user.UsuarioSistema.NDOC}`;
914
+ break;
915
+ case '@tdocactivo':
916
+ data = this.user.UsuarioSistema.TDOC;
917
+ break;
918
+ case '@ndocactivo':
919
+ data = this.user.UsuarioSistema.NDOC;
461
920
  break;
462
921
  case '@hoy':
463
922
  data = new Date();
@@ -468,17 +927,154 @@ class RegistroComponent {
468
927
  }
469
928
  return data;
470
929
  }
930
+ sendNotification(message) {
931
+ this.messageSerice.add(message);
932
+ }
933
+ addObjectArray(element) {
934
+ this.dialogRef = this.dialogService.open(RegistroChildComponent, {
935
+ header: `Detalle`,
936
+ width: '70%',
937
+ modal: true,
938
+ closable: false,
939
+ data: {
940
+ uiEsquema: Object.assign({}, element.elements),
941
+ esquema: this.getControl(element.scope),
942
+ id: this.getValue(element.scope).length + 1
943
+ }
944
+ });
945
+ this.dialogRef.onClose.subscribe((data) => {
946
+ if (data)
947
+ this.data[element.scope.replace('$..properties.', '')].push(data);
948
+ this.applyValuesOnEvent('onChange', this.crudConfig.esquema, element.scope.replace('$..properties.', ''));
949
+ });
950
+ }
951
+ editRow(element, data, index) {
952
+ this.dialogRef = this.dialogService.open(RegistroChildComponent, {
953
+ header: `Detalle`,
954
+ width: '70%',
955
+ modal: true,
956
+ closable: false,
957
+ data: {
958
+ uiEsquema: Object.assign({}, element.elements),
959
+ esquema: this.getControl(element.scope),
960
+ data: Object.assign({}, data)
961
+ }
962
+ });
963
+ this.dialogRef.onClose.subscribe((data) => {
964
+ if (data)
965
+ this.data[element.scope.replace('$..properties.', '')][index] = data;
966
+ this.applyValuesOnEvent('onChange', this.crudConfig.esquema, element.scope.replace('$..properties.', ''));
967
+ });
968
+ }
969
+ deleteRow(element, index) {
970
+ this.data[element.scope.replace('$..properties.', '')].splice(index, 1);
971
+ index = 1;
972
+ this.data[element.scope.replace('$..properties.', '')].forEach((el) => {
973
+ el.id = index;
974
+ index++;
975
+ });
976
+ this.applyValuesOnEvent('onChange', this.crudConfig.esquema, element.scope.replace('$..properties.', ''));
977
+ }
978
+ applyValuesOnEvent(event, esquema, key) {
979
+ if (key) {
980
+ if (esquema.properties[key][event]) {
981
+ esquema.properties[key][event].forEach((value) => {
982
+ this.setValueEvent(this.data, value);
983
+ });
984
+ }
985
+ }
986
+ else {
987
+ for (const key in esquema.properties) {
988
+ if (esquema.properties[key][event]) {
989
+ esquema.properties[key][event].forEach((value) => {
990
+ this.setValueEvent(this.data, value);
991
+ });
992
+ }
993
+ }
994
+ }
995
+ }
996
+ setValueEvent(data, params) {
997
+ var _a;
998
+ let date = moment(new Date());
999
+ switch (params.op) {
1000
+ case 'sum':
1001
+ 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));
1002
+ break;
1003
+ case 'concat':
1004
+ let array = [];
1005
+ (_a = params === null || params === void 0 ? void 0 : params.key) === null || _a === void 0 ? void 0 : _a.reduce((acc, cur) => {
1006
+ array.push(jsonpath.query(data, cur)[0]);
1007
+ }, []);
1008
+ if (params === null || params === void 0 ? void 0 : params.separator)
1009
+ jsonpath.value(data, params.scope[0], array.join((params === null || params === void 0 ? void 0 : params.separator) || ' '));
1010
+ break;
1011
+ case 'enable':
1012
+ jsonpath.value(this.crudConfig.esquema, params.scope[0], false);
1013
+ break;
1014
+ case 'disabled':
1015
+ jsonpath.value(this.crudConfig.esquema, params.scope[0], true);
1016
+ break;
1017
+ case 'replace:endpoint':
1018
+ jsonpath.value(this.crudConfig.esquema, params.scope[0], this.crudConfig.esquema.config.endpointtemp.replace(params.scope[1], jsonpath.query(data, `$..${params.key}`)));
1019
+ break;
1020
+ case 'setNull':
1021
+ jsonpath.value(this.data, `$.${params.key}`, null);
1022
+ break;
1023
+ case 'datediff:years':
1024
+ jsonpath.value(this.data, params.scope[0], date.diff(moment(jsonpath.query(this.data, params.scope[1])[0]), 'years'));
1025
+ break;
1026
+ case 'datediff:months':
1027
+ jsonpath.value(this.data, params.scope[0], date.diff(moment(jsonpath.query(this.data, params.scope[1])[0]), 'months'));
1028
+ break;
1029
+ case 'datediff:weeks':
1030
+ jsonpath.value(this.data, params.scope[0], date.diff(moment(jsonpath.query(this.data, params.scope[1])[0]), 'weeks'));
1031
+ break;
1032
+ case 'datediff:days':
1033
+ jsonpath.value(this.data, params.scope[0], date.diff(moment(jsonpath.query(this.data, params.scope[1])[0]), 'days'));
1034
+ break;
1035
+ default:
1036
+ break;
1037
+ }
1038
+ }
1039
+ setDataTemp(esquema, dataTemp) {
1040
+ dataTemp.forEach(data => {
1041
+ jsonpath.value(esquema, data.scope, data.value);
1042
+ });
1043
+ }
1044
+ applyValuesFromObject(event) {
1045
+ if (event.data)
1046
+ event.optionValue.forEach((value) => jsonpath.value(this.data, value.scope.replace('.properties', ''), this.aplyFormatValue(value.scope, event.data[value.key])));
1047
+ else
1048
+ event.optionValue.forEach((value) => jsonpath.value(this.data, value.scope.replace('.properties', ''), null));
1049
+ }
1050
+ aplyFormatValue(scope, value) {
1051
+ let control = jsonpath.query(this.crudConfig.esquema, scope)[0];
1052
+ let resp;
1053
+ switch (control.type) {
1054
+ case 'date':
1055
+ resp = new Date(`${value}`);
1056
+ break;
1057
+ case 'numeric':
1058
+ resp = +value;
1059
+ break;
1060
+ default:
1061
+ resp = value;
1062
+ break;
1063
+ }
1064
+ return resp;
1065
+ }
471
1066
  }
472
- RegistroComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RegistroComponent, deps: [{ token: GeneralService }, { token: i2.Router }, { token: i3$1.MessageService }], target: i0.ɵɵFactoryTarget.Component });
473
- 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$1.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: i7.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i8.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { type: i9.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"] }] });
1067
+ RegistroComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RegistroComponent, deps: [{ token: GeneralService }, { token: i2.Router }, { token: i3$1.MessageService }, { token: i1$1.DialogService }, { token: SfCrudService }], target: i0.ɵɵFactoryTarget.Component });
1068
+ 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\">\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\" [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\"\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 *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$3.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: i3$1.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }], pipes: { "currency": i7.CurrencyPipe, "date": i7.DatePipe } });
474
1069
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RegistroComponent, decorators: [{
475
1070
  type: Component,
476
1071
  args: [{
477
1072
  selector: 'sf-registro',
478
1073
  templateUrl: './registro.component.html',
479
- providers: [MessageService]
1074
+ providers: [MessageService, DialogService, DynamicDialogConfig, DynamicDialogRef],
1075
+ entryComponents: [RegistroComponent]
480
1076
  }]
481
- }], ctorParameters: function () { return [{ type: GeneralService }, { type: i2.Router }, { type: i3$1.MessageService }]; }, propDecorators: { idKatios: [{
1077
+ }], ctorParameters: function () { return [{ type: GeneralService }, { type: i2.Router }, { type: i3$1.MessageService }, { type: i1$1.DialogService }, { type: SfCrudService }]; }, propDecorators: { idKatios: [{
482
1078
  type: Input
483
1079
  }], idEntidad: [{
484
1080
  type: Input
@@ -486,6 +1082,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
486
1082
  type: Input
487
1083
  }], id: [{
488
1084
  type: Input
1085
+ }], user: [{
1086
+ type: Input
1087
+ }], sendData: [{
1088
+ type: Output
1089
+ }], onSubmit: [{
1090
+ type: Output
489
1091
  }] } });
490
1092
 
491
1093
  class SfCrudComponent {
@@ -518,7 +1120,9 @@ SfCrudModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "1
518
1120
  SfCrudModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SfCrudModule, declarations: [SfCrudComponent,
519
1121
  TableroComponent,
520
1122
  RegistroComponent,
521
- ControlComponent], imports: [AccordionModule,
1123
+ ControlComponent,
1124
+ RegistroChildComponent], imports: [AccordionModule,
1125
+ AutoCompleteModule,
522
1126
  AvatarGroupModule,
523
1127
  AvatarModule,
524
1128
  BadgeModule,
@@ -532,7 +1136,6 @@ SfCrudModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "
532
1136
  CheckboxModule,
533
1137
  ChipModule,
534
1138
  ChipsModule,
535
- CodeHighlighterModule,
536
1139
  ColorPickerModule,
537
1140
  ConfirmDialogModule,
538
1141
  ConfirmPopupModule,
@@ -540,6 +1143,7 @@ SfCrudModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "
540
1143
  DialogModule,
541
1144
  DividerModule,
542
1145
  DropdownModule,
1146
+ DynamicDialogModule,
543
1147
  FieldsetModule,
544
1148
  FileUploadModule,
545
1149
  FormsModule,
@@ -552,7 +1156,6 @@ SfCrudModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "
552
1156
  InputTextareaModule,
553
1157
  InputTextModule,
554
1158
  KnobModule,
555
- LightboxModule,
556
1159
  ListboxModule,
557
1160
  MegaMenuModule,
558
1161
  MenubarModule,
@@ -576,6 +1179,7 @@ SfCrudModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "
576
1179
  SkeletonModule,
577
1180
  SlideMenuModule,
578
1181
  SliderModule,
1182
+ SplitButtonModule,
579
1183
  SplitterModule,
580
1184
  StepsModule,
581
1185
  TableModule,
@@ -591,9 +1195,11 @@ SfCrudModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "
591
1195
  TooltipModule,
592
1196
  TreeModule], exports: [SfCrudComponent,
593
1197
  TableroComponent,
594
- RegistroComponent] });
1198
+ RegistroComponent,
1199
+ ControlComponent] });
595
1200
  SfCrudModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SfCrudModule, imports: [[
596
1201
  AccordionModule,
1202
+ AutoCompleteModule,
597
1203
  AvatarGroupModule,
598
1204
  AvatarModule,
599
1205
  BadgeModule,
@@ -607,7 +1213,6 @@ SfCrudModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
607
1213
  CheckboxModule,
608
1214
  ChipModule,
609
1215
  ChipsModule,
610
- CodeHighlighterModule,
611
1216
  ColorPickerModule,
612
1217
  ConfirmDialogModule,
613
1218
  ConfirmPopupModule,
@@ -615,6 +1220,7 @@ SfCrudModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
615
1220
  DialogModule,
616
1221
  DividerModule,
617
1222
  DropdownModule,
1223
+ DynamicDialogModule,
618
1224
  FieldsetModule,
619
1225
  FileUploadModule,
620
1226
  FormsModule,
@@ -627,7 +1233,6 @@ SfCrudModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
627
1233
  InputTextareaModule,
628
1234
  InputTextModule,
629
1235
  KnobModule,
630
- LightboxModule,
631
1236
  ListboxModule,
632
1237
  MegaMenuModule,
633
1238
  MenubarModule,
@@ -651,6 +1256,7 @@ SfCrudModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
651
1256
  SkeletonModule,
652
1257
  SlideMenuModule,
653
1258
  SliderModule,
1259
+ SplitButtonModule,
654
1260
  SplitterModule,
655
1261
  StepsModule,
656
1262
  TableModule,
@@ -673,10 +1279,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
673
1279
  SfCrudComponent,
674
1280
  TableroComponent,
675
1281
  RegistroComponent,
676
- ControlComponent
1282
+ ControlComponent,
1283
+ RegistroChildComponent
677
1284
  ],
678
1285
  imports: [
679
1286
  AccordionModule,
1287
+ AutoCompleteModule,
680
1288
  AvatarGroupModule,
681
1289
  AvatarModule,
682
1290
  BadgeModule,
@@ -690,7 +1298,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
690
1298
  CheckboxModule,
691
1299
  ChipModule,
692
1300
  ChipsModule,
693
- CodeHighlighterModule,
694
1301
  ColorPickerModule,
695
1302
  ConfirmDialogModule,
696
1303
  ConfirmPopupModule,
@@ -698,6 +1305,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
698
1305
  DialogModule,
699
1306
  DividerModule,
700
1307
  DropdownModule,
1308
+ DynamicDialogModule,
701
1309
  FieldsetModule,
702
1310
  FileUploadModule,
703
1311
  FormsModule,
@@ -710,7 +1318,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
710
1318
  InputTextareaModule,
711
1319
  InputTextModule,
712
1320
  KnobModule,
713
- LightboxModule,
714
1321
  ListboxModule,
715
1322
  MegaMenuModule,
716
1323
  MenubarModule,
@@ -734,6 +1341,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
734
1341
  SkeletonModule,
735
1342
  SlideMenuModule,
736
1343
  SliderModule,
1344
+ SplitButtonModule,
737
1345
  SplitterModule,
738
1346
  StepsModule,
739
1347
  TableModule,
@@ -752,23 +1360,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
752
1360
  exports: [
753
1361
  SfCrudComponent,
754
1362
  TableroComponent,
755
- RegistroComponent
1363
+ RegistroComponent,
1364
+ ControlComponent
1365
+ ],
1366
+ entryComponents: [
1367
+ RegistroChildComponent
756
1368
  ]
757
1369
  }]
758
1370
  }] });
759
1371
 
760
- class SfCrudService {
761
- constructor() { }
762
- }
763
- SfCrudService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SfCrudService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
764
- SfCrudService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SfCrudService, providedIn: 'root' });
765
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SfCrudService, decorators: [{
766
- type: Injectable,
767
- args: [{
768
- providedIn: 'root'
769
- }]
770
- }], ctorParameters: function () { return []; } });
771
-
772
1372
  /*
773
1373
  * Public API Surface of sf-crud
774
1374
  */
@@ -777,5 +1377,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
777
1377
  * Generated bundle index. Do not edit.
778
1378
  */
779
1379
 
780
- export { RegistroComponent, SfCrudComponent, SfCrudModule, SfCrudService, TableroComponent };
1380
+ export { ControlComponent, RegistroComponent, SfCrudComponent, SfCrudModule, SfCrudService, TableroComponent };
781
1381
  //# sourceMappingURL=sf-crud.js.map