sf-crud 12.0.1-beta8 → 12.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/bundles/sf-crud.umd.js +1221 -125
  2. package/bundles/sf-crud.umd.js.map +1 -1
  3. package/esm2015/lib/components/control/control.component.js +114 -12
  4. package/esm2015/lib/components/registro/registro.component.js +307 -43
  5. package/esm2015/lib/components/registro-child/registro-child.component.js +328 -0
  6. package/esm2015/lib/components/registro-detalle/registro-detalle.component.js +232 -0
  7. package/esm2015/lib/components/tablero/tablero.component.js +81 -19
  8. package/esm2015/lib/sf-crud.module.js +24 -13
  9. package/esm2015/lib/sf-crud.service.js +16 -2
  10. package/esm2015/lib/shared/models/crud-config.model.js +51 -0
  11. package/esm2015/lib/shared/models/data-temp-crud.model.js +6 -0
  12. package/esm2015/lib/shared/models/shema.model.js +7 -0
  13. package/esm2015/lib/shared/services/general.service.js +1 -1
  14. package/esm2015/public-api.js +2 -1
  15. package/fesm2015/sf-crud.js +1074 -91
  16. package/fesm2015/sf-crud.js.map +1 -1
  17. package/lib/components/control/control.component.d.ts +16 -3
  18. package/lib/components/registro/registro.component.d.ts +45 -10
  19. package/lib/components/registro-child/registro-child.component.d.ts +47 -0
  20. package/lib/components/registro-detalle/registro-detalle.component.d.ts +36 -0
  21. package/lib/components/tablero/tablero.component.d.ts +17 -4
  22. package/lib/sf-crud.module.d.ts +76 -74
  23. package/lib/sf-crud.service.d.ts +4 -0
  24. package/lib/shared/{services/models → models}/crud-config.model.d.ts +18 -2
  25. package/lib/shared/models/data-temp-crud.model.d.ts +4 -0
  26. package/lib/shared/{services/models → models}/shema.model.d.ts +1 -0
  27. package/lib/shared/services/general.service.d.ts +1 -1
  28. package/package.json +1 -1
  29. package/public-api.d.ts +1 -0
  30. package/esm2015/lib/shared/services/models/crud-config.model.js +0 -43
  31. package/esm2015/lib/shared/services/models/shema.model.js +0 -7
@@ -1,8 +1,10 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common/http'), require('@angular/router'), require('primeng/blockui'), require('primeng/toolbar'), require('primeng/table'), require('@angular/common'), require('primeng/api'), require('primeng/button'), require('primeng/ripple'), require('primeng/inputtext'), require('primeng/tooltip'), require('jsonpath'), require('primeng/toast'), require('primeng/dropdown'), require('primeng/autocomplete'), require('primeng/calendar'), require('primeng/inputnumber'), require('@angular/forms'), require('primeng/accordion'), require('primeng/avatargroup'), require('primeng/avatar'), require('primeng/badge'), require('primeng/breadcrumb'), require('primeng/card'), require('primeng/carousel'), require('primeng/cascadeselect'), require('primeng/checkbox'), require('primeng/chip'), require('primeng/chips'), require('primeng/codehighlighter'), require('primeng/colorpicker'), require('primeng/confirmdialog'), require('primeng/confirmpopup'), require('primeng/contextmenu'), require('primeng/dialog'), require('primeng/divider'), require('primeng/fieldset'), require('primeng/fileupload'), require('primeng/galleria'), require('primeng/inplace'), require('primeng/inputmask'), require('primeng/inputswitch'), require('primeng/inputtextarea'), require('primeng/knob'), require('primeng/lightbox'), require('primeng/listbox'), require('primeng/megamenu'), require('primeng/menubar'), require('primeng/menu'), require('primeng/message'), require('primeng/messages'), require('primeng/multiselect'), require('primeng/organizationchart'), require('primeng/overlaypanel'), require('primeng/panelmenu'), require('primeng/panel'), require('primeng/password'), require('primeng/progressbar'), require('primeng/radiobutton'), require('primeng/rating'), require('primeng/scrollpanel'), require('primeng/scrolltop'), require('primeng/selectbutton'), require('primeng/sidebar'), require('primeng/skeleton'), require('primeng/slidemenu'), require('primeng/slider'), require('primeng/splitter'), require('primeng/steps'), require('primeng/tabmenu'), require('primeng/tabview'), require('primeng/tag'), require('primeng/terminal'), require('primeng/tieredmenu'), require('primeng/timeline'), require('primeng/togglebutton'), require('primeng/tree')) :
3
- typeof define === 'function' && define.amd ? define('sf-crud', ['exports', '@angular/core', '@angular/common/http', '@angular/router', 'primeng/blockui', 'primeng/toolbar', 'primeng/table', '@angular/common', 'primeng/api', 'primeng/button', 'primeng/ripple', 'primeng/inputtext', 'primeng/tooltip', 'jsonpath', 'primeng/toast', 'primeng/dropdown', 'primeng/autocomplete', 'primeng/calendar', 'primeng/inputnumber', '@angular/forms', 'primeng/accordion', 'primeng/avatargroup', 'primeng/avatar', 'primeng/badge', 'primeng/breadcrumb', 'primeng/card', 'primeng/carousel', 'primeng/cascadeselect', 'primeng/checkbox', 'primeng/chip', 'primeng/chips', 'primeng/codehighlighter', 'primeng/colorpicker', 'primeng/confirmdialog', 'primeng/confirmpopup', 'primeng/contextmenu', 'primeng/dialog', 'primeng/divider', 'primeng/fieldset', 'primeng/fileupload', 'primeng/galleria', 'primeng/inplace', 'primeng/inputmask', 'primeng/inputswitch', 'primeng/inputtextarea', 'primeng/knob', 'primeng/lightbox', 'primeng/listbox', 'primeng/megamenu', 'primeng/menubar', 'primeng/menu', 'primeng/message', 'primeng/messages', 'primeng/multiselect', 'primeng/organizationchart', 'primeng/overlaypanel', 'primeng/panelmenu', 'primeng/panel', 'primeng/password', 'primeng/progressbar', 'primeng/radiobutton', 'primeng/rating', 'primeng/scrollpanel', 'primeng/scrolltop', 'primeng/selectbutton', 'primeng/sidebar', 'primeng/skeleton', 'primeng/slidemenu', 'primeng/slider', 'primeng/splitter', 'primeng/steps', 'primeng/tabmenu', 'primeng/tabview', 'primeng/tag', 'primeng/terminal', 'primeng/tieredmenu', 'primeng/timeline', 'primeng/togglebutton', 'primeng/tree'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["sf-crud"] = {}, global.ng.core, global.ng.common.http, global.ng.router, global.i3, global.i4, global.i5, global.ng.common, global.i3$1, global.i8, global.i9, global.i10, global.i11, global.jsonpath, global.i5$2, global.i2$1, global.i3$2, global.i4$1, global.i5$1, global.ng.forms, global.accordion, global.avatargroup, global.avatar, global.badge, global.breadcrumb, global.card, global.carousel, global.cascadeselect, global.checkbox, global.chip, global.chips, global.codehighlighter, global.colorpicker, global.confirmdialog, global.confirmpopup, global.contextmenu, global.dialog, global.divider, global.fieldset, global.fileupload, global.galleria, global.inplace, global.inputmask, global.inputswitch, global.inputtextarea, global.knob, global.lightbox, global.listbox, global.megamenu, global.menubar, global.menu, global.message, global.messages, global.multiselect, global.organizationchart, global.overlaypanel, global.panelmenu, global.panel, global.password, global.progressbar, global.radiobutton, global.rating, global.scrollpanel, global.scrolltop, global.selectbutton, global.sidebar, global.skeleton, global.slidemenu, global.slider, global.splitter, global.steps, global.tabmenu, global.tabview, global.tag, global.terminal, global.tieredmenu, global.timeline, global.togglebutton, global.tree));
5
- })(this, (function (exports, i0, i1, i2, i3, i4, i5, i6, i3$1, i8, i9, i10, i11, jsonpath, i5$2, i2$1, i3$2, i4$1, i5$1, i7, accordion, avatargroup, avatar, badge, breadcrumb, card, carousel, cascadeselect, checkbox, chip, chips, codehighlighter, colorpicker, confirmdialog, confirmpopup, contextmenu, dialog, divider, fieldset, fileupload, galleria, inplace, inputmask, inputswitch, inputtextarea, knob, lightbox, listbox, megamenu, menubar, menu, message, messages, multiselect, organizationchart, overlaypanel, panelmenu, panel, password, progressbar, radiobutton, rating, scrollpanel, scrolltop, selectbutton, sidebar, skeleton, slidemenu, slider, splitter, steps, tabmenu, tabview, tag, terminal, tieredmenu, timeline, togglebutton, tree) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('lodash'), require('jsonpath'), require('@angular/common/http'), require('@angular/router'), require('primeng/blockui'), require('primeng/toolbar'), require('primeng/table'), require('primeng/splitbutton'), require('@angular/common'), require('primeng/api'), require('primeng/button'), require('primeng/ripple'), require('primeng/inputtext'), require('primeng/dynamicdialog'), require('moment'), require('primeng/toast'), require('primeng/inputmask'), require('primeng/dropdown'), require('primeng/autocomplete'), require('primeng/calendar'), require('primeng/inputnumber'), require('primeng/fileupload'), require('primeng/inputswitch'), require('@angular/forms'), require('primeng/inputtextarea'), require('sweetalert2'), require('primeng/accordion'), require('primeng/avatargroup'), require('primeng/avatar'), require('primeng/badge'), require('primeng/breadcrumb'), require('primeng/card'), require('primeng/carousel'), require('primeng/cascadeselect'), require('primeng/checkbox'), require('primeng/chip'), require('primeng/chips'), require('primeng/colorpicker'), require('primeng/confirmdialog'), require('primeng/confirmpopup'), require('primeng/contextmenu'), require('primeng/dialog'), require('primeng/divider'), require('primeng/fieldset'), require('primeng/galleria'), require('primeng/inplace'), require('primeng/knob'), require('primeng/listbox'), require('primeng/megamenu'), require('primeng/menubar'), require('primeng/menu'), require('primeng/message'), require('primeng/messages'), require('primeng/multiselect'), require('primeng/organizationchart'), require('primeng/overlaypanel'), require('primeng/panelmenu'), require('primeng/panel'), require('primeng/password'), require('primeng/progressbar'), require('primeng/radiobutton'), require('primeng/rating'), require('primeng/scrollpanel'), require('primeng/scrolltop'), require('primeng/selectbutton'), require('primeng/sidebar'), require('primeng/skeleton'), require('primeng/slidemenu'), require('primeng/slider'), require('primeng/splitter'), require('primeng/steps'), require('primeng/tabmenu'), require('primeng/tabview'), require('primeng/tag'), require('primeng/terminal'), require('primeng/tieredmenu'), require('primeng/timeline'), require('primeng/togglebutton'), require('primeng/tooltip'), require('primeng/tree')) :
3
+ typeof define === 'function' && define.amd ? define('sf-crud', ['exports', '@angular/core', 'lodash', 'jsonpath', '@angular/common/http', '@angular/router', 'primeng/blockui', 'primeng/toolbar', 'primeng/table', 'primeng/splitbutton', '@angular/common', 'primeng/api', 'primeng/button', 'primeng/ripple', 'primeng/inputtext', 'primeng/dynamicdialog', 'moment', 'primeng/toast', 'primeng/inputmask', 'primeng/dropdown', 'primeng/autocomplete', 'primeng/calendar', 'primeng/inputnumber', 'primeng/fileupload', 'primeng/inputswitch', '@angular/forms', 'primeng/inputtextarea', 'sweetalert2', 'primeng/accordion', 'primeng/avatargroup', 'primeng/avatar', 'primeng/badge', 'primeng/breadcrumb', 'primeng/card', 'primeng/carousel', 'primeng/cascadeselect', 'primeng/checkbox', 'primeng/chip', 'primeng/chips', 'primeng/colorpicker', 'primeng/confirmdialog', 'primeng/confirmpopup', 'primeng/contextmenu', 'primeng/dialog', 'primeng/divider', 'primeng/fieldset', 'primeng/galleria', 'primeng/inplace', 'primeng/knob', 'primeng/listbox', 'primeng/megamenu', 'primeng/menubar', 'primeng/menu', 'primeng/message', 'primeng/messages', 'primeng/multiselect', 'primeng/organizationchart', 'primeng/overlaypanel', 'primeng/panelmenu', 'primeng/panel', 'primeng/password', 'primeng/progressbar', 'primeng/radiobutton', 'primeng/rating', 'primeng/scrollpanel', 'primeng/scrolltop', 'primeng/selectbutton', 'primeng/sidebar', 'primeng/skeleton', 'primeng/slidemenu', 'primeng/slider', 'primeng/splitter', 'primeng/steps', 'primeng/tabmenu', 'primeng/tabview', 'primeng/tag', 'primeng/terminal', 'primeng/tieredmenu', 'primeng/timeline', 'primeng/togglebutton', 'primeng/tooltip', 'primeng/tree'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["sf-crud"] = {}, global.ng.core, global._, global.jsonpath, global.ng.common.http, global.ng.router, global.i3, global.i4, global.i5, global.i6, global.ng.common, global.i2$1, global.i9, global.i10, global.i11, global.i1$1, global.moment, global.i3$2, global.i2$2, global.i3$1, global.i4$1, global.i5$1, global.i6$1, global.i7$1, global.i8, global.ng.forms, global.i12, global.Swal, global.accordion, global.avatargroup, global.avatar, global.badge, global.breadcrumb, global.card, global.carousel, global.cascadeselect, global.checkbox, global.chip, global.chips, global.colorpicker, global.confirmdialog, global.confirmpopup, global.contextmenu, global.dialog, global.divider, global.fieldset, global.galleria, global.inplace, global.knob, global.listbox, global.megamenu, global.menubar, global.menu, global.message, global.messages, global.multiselect, global.organizationchart, global.overlaypanel, global.panelmenu, global.panel, global.password, global.progressbar, global.radiobutton, global.rating, global.scrollpanel, global.scrolltop, global.selectbutton, global.sidebar, global.skeleton, global.slidemenu, global.slider, global.splitter, global.steps, global.tabmenu, global.tabview, global.tag, global.terminal, global.tieredmenu, global.timeline, global.togglebutton, global.tooltip, global.tree));
5
+ })(this, (function (exports, i0, _, jsonpath, i1, i2, i3, i4, i5, i6, i7, i2$1, i9, i10, i11, i1$1, moment, i3$2, i2$2, i3$1, i4$1, i5$1, i6$1, i7$1, i8, i10$1, i12, Swal, accordion, avatargroup, avatar, badge, breadcrumb, card, carousel, cascadeselect, checkbox, chip, chips, colorpicker, confirmdialog, confirmpopup, contextmenu, dialog, divider, fieldset, galleria, inplace, knob, listbox, megamenu, menubar, menu, message, messages, multiselect, organizationchart, overlaypanel, panelmenu, panel, password, progressbar, radiobutton, rating, scrollpanel, scrolltop, selectbutton, sidebar, skeleton, slidemenu, slider, splitter, steps, tabmenu, tabview, tag, terminal, tieredmenu, timeline, togglebutton, tooltip, tree) { 'use strict';
6
+
7
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
6
8
 
7
9
  function _interopNamespace(e) {
8
10
  if (e && e.__esModule) return e;
@@ -23,24 +25,32 @@
23
25
  }
24
26
 
25
27
  var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
28
+ var ___namespace = /*#__PURE__*/_interopNamespace(_);
29
+ var jsonpath__namespace = /*#__PURE__*/_interopNamespace(jsonpath);
26
30
  var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
27
31
  var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
28
32
  var i3__namespace = /*#__PURE__*/_interopNamespace(i3);
29
33
  var i4__namespace = /*#__PURE__*/_interopNamespace(i4);
30
34
  var i5__namespace = /*#__PURE__*/_interopNamespace(i5);
31
35
  var i6__namespace = /*#__PURE__*/_interopNamespace(i6);
32
- var i3__namespace$1 = /*#__PURE__*/_interopNamespace(i3$1);
33
- var i8__namespace = /*#__PURE__*/_interopNamespace(i8);
36
+ var i7__namespace = /*#__PURE__*/_interopNamespace(i7);
37
+ var i2__namespace$1 = /*#__PURE__*/_interopNamespace(i2$1);
34
38
  var i9__namespace = /*#__PURE__*/_interopNamespace(i9);
35
39
  var i10__namespace = /*#__PURE__*/_interopNamespace(i10);
36
40
  var i11__namespace = /*#__PURE__*/_interopNamespace(i11);
37
- var jsonpath__namespace = /*#__PURE__*/_interopNamespace(jsonpath);
38
- var i5__namespace$2 = /*#__PURE__*/_interopNamespace(i5$2);
39
- var i2__namespace$1 = /*#__PURE__*/_interopNamespace(i2$1);
41
+ var i1__namespace$1 = /*#__PURE__*/_interopNamespace(i1$1);
42
+ var moment__namespace = /*#__PURE__*/_interopNamespace(moment);
40
43
  var i3__namespace$2 = /*#__PURE__*/_interopNamespace(i3$2);
44
+ var i2__namespace$2 = /*#__PURE__*/_interopNamespace(i2$2);
45
+ var i3__namespace$1 = /*#__PURE__*/_interopNamespace(i3$1);
41
46
  var i4__namespace$1 = /*#__PURE__*/_interopNamespace(i4$1);
42
47
  var i5__namespace$1 = /*#__PURE__*/_interopNamespace(i5$1);
43
- var i7__namespace = /*#__PURE__*/_interopNamespace(i7);
48
+ var i6__namespace$1 = /*#__PURE__*/_interopNamespace(i6$1);
49
+ var i7__namespace$1 = /*#__PURE__*/_interopNamespace(i7$1);
50
+ var i8__namespace = /*#__PURE__*/_interopNamespace(i8);
51
+ var i10__namespace$1 = /*#__PURE__*/_interopNamespace(i10$1);
52
+ var i12__namespace = /*#__PURE__*/_interopNamespace(i12);
53
+ var Swal__default = /*#__PURE__*/_interopDefaultLegacy(Swal);
44
54
 
45
55
  var Shema = /** @class */ (function () {
46
56
  function Shema() {
@@ -65,8 +75,8 @@
65
75
  this.endpoint = '';
66
76
  this.method = '';
67
77
  this.server = '';
68
- this.key = '';
69
78
  this.filters = [];
79
+ this.keys = [];
70
80
  }
71
81
  return ConfigTablero;
72
82
  }());
@@ -95,6 +105,15 @@
95
105
  this.endpoint = '';
96
106
  }
97
107
  return Validations;
108
+ }());
109
+ var RequestChecking = /** @class */ (function () {
110
+ function RequestChecking(dynamics, statics, swal, redirect) {
111
+ this.dynamics = dynamics;
112
+ this.statics = statics;
113
+ this.swal = swal;
114
+ this.redirect = redirect;
115
+ }
116
+ return RequestChecking;
98
117
  }());
99
118
 
100
119
  /******************************************************************************
@@ -164,6 +183,64 @@
164
183
  function __param(paramIndex, decorator) {
165
184
  return function (target, key) { decorator(target, key, paramIndex); };
166
185
  }
186
+ function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
187
+ function accept(f) { if (f !== void 0 && typeof f !== "function")
188
+ throw new TypeError("Function expected"); return f; }
189
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
190
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
191
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
192
+ var _, done = false;
193
+ for (var i = decorators.length - 1; i >= 0; i--) {
194
+ var context = {};
195
+ for (var p in contextIn)
196
+ context[p] = p === "access" ? {} : contextIn[p];
197
+ for (var p in contextIn.access)
198
+ context.access[p] = contextIn.access[p];
199
+ context.addInitializer = function (f) { if (done)
200
+ throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
201
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
202
+ if (kind === "accessor") {
203
+ if (result === void 0)
204
+ continue;
205
+ if (result === null || typeof result !== "object")
206
+ throw new TypeError("Object expected");
207
+ if (_ = accept(result.get))
208
+ descriptor.get = _;
209
+ if (_ = accept(result.set))
210
+ descriptor.set = _;
211
+ if (_ = accept(result.init))
212
+ initializers.unshift(_);
213
+ }
214
+ else if (_ = accept(result)) {
215
+ if (kind === "field")
216
+ initializers.unshift(_);
217
+ else
218
+ descriptor[key] = _;
219
+ }
220
+ }
221
+ if (target)
222
+ Object.defineProperty(target, contextIn.name, descriptor);
223
+ done = true;
224
+ }
225
+ ;
226
+ function __runInitializers(thisArg, initializers, value) {
227
+ var useValue = arguments.length > 2;
228
+ for (var i = 0; i < initializers.length; i++) {
229
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
230
+ }
231
+ return useValue ? value : void 0;
232
+ }
233
+ ;
234
+ function __propKey(x) {
235
+ return typeof x === "symbol" ? x : "".concat(x);
236
+ }
237
+ ;
238
+ function __setFunctionName(f, name, prefix) {
239
+ if (typeof name === "symbol")
240
+ name = name.description ? "[".concat(name.description, "]") : "";
241
+ return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
242
+ }
243
+ ;
167
244
  function __metadata(metadataKey, metadataValue) {
168
245
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
169
246
  return Reflect.metadata(metadataKey, metadataValue);
@@ -195,7 +272,7 @@
195
272
  function step(op) {
196
273
  if (f)
197
274
  throw new TypeError("Generator is already executing.");
198
- while (_)
275
+ while (g && (g = 0, op[0] && (_ = 0)), _)
199
276
  try {
200
277
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
201
278
  return t;
@@ -363,7 +440,7 @@
363
440
  function __asyncDelegator(o) {
364
441
  var i, p;
365
442
  return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
366
- function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
443
+ function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
367
444
  }
368
445
  function __asyncValues(o) {
369
446
  if (!Symbol.asyncIterator)
@@ -422,7 +499,34 @@
422
499
  if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function"))
423
500
  throw new TypeError("Cannot use 'in' operator on non-object");
424
501
  return typeof state === "function" ? receiver === state : state.has(receiver);
425
- }
502
+ }
503
+ var tslib_es6 = {
504
+ __extends: __extends,
505
+ __assign: __assign,
506
+ __rest: __rest,
507
+ __decorate: __decorate,
508
+ __param: __param,
509
+ __metadata: __metadata,
510
+ __awaiter: __awaiter,
511
+ __generator: __generator,
512
+ __createBinding: __createBinding,
513
+ __exportStar: __exportStar,
514
+ __values: __values,
515
+ __read: __read,
516
+ __spread: __spread,
517
+ __spreadArrays: __spreadArrays,
518
+ __spreadArray: __spreadArray,
519
+ __await: __await,
520
+ __asyncGenerator: __asyncGenerator,
521
+ __asyncDelegator: __asyncDelegator,
522
+ __asyncValues: __asyncValues,
523
+ __makeTemplateObject: __makeTemplateObject,
524
+ __importStar: __importStar,
525
+ __importDefault: __importDefault,
526
+ __classPrivateFieldGet: __classPrivateFieldGet,
527
+ __classPrivateFieldSet: __classPrivateFieldSet,
528
+ __classPrivateFieldIn: __classPrivateFieldIn,
529
+ };
426
530
 
427
531
  var GeneralService = /** @class */ (function () {
428
532
  function GeneralService(http) {
@@ -483,6 +587,8 @@
483
587
  this.opciones = [];
484
588
  this.idEntidad = '';
485
589
  this.idKatios = '';
590
+ this.onSelectAction = new i0.EventEmitter();
591
+ this.items = [];
486
592
  this.crudConfig = new CrudConfig();
487
593
  this.enProceso = false;
488
594
  this.data = [];
@@ -498,7 +604,6 @@
498
604
  .then(function (res) {
499
605
  _this.crudConfig = res;
500
606
  _this.getInfoTablero(_this.crudConfig.tablero);
501
- _this.loadOptions();
502
607
  })
503
608
  .catch(function (err) {
504
609
  console.log(err);
@@ -507,9 +612,15 @@
507
612
  };
508
613
  TableroComponent.prototype.getInfoTablero = function (configTablero) {
509
614
  var _this = this;
510
- this.generalService.genericRequest(configTablero.method, configTablero.server, configTablero.endpoint)
615
+ this.generalService.genericRequest(configTablero.method, configTablero.server, this.aplyKeys(configTablero.keys, configTablero.endpoint, this.dataExt))
511
616
  .then(function (res) {
512
- _this.data = res.data;
617
+ var aux;
618
+ if (!Array.isArray(res))
619
+ aux = res.data;
620
+ else
621
+ aux = res;
622
+ _this.generateData(aux);
623
+ _this.loadOptions();
513
624
  _this.enProceso = false;
514
625
  })
515
626
  .catch(function (err) {
@@ -517,11 +628,29 @@
517
628
  _this.enProceso = false;
518
629
  });
519
630
  };
631
+ TableroComponent.prototype.generateData = function (data) {
632
+ var _this = this;
633
+ data.forEach(function (item) {
634
+ var newItem = {};
635
+ _this.crudConfig.tablero.columns.forEach(function (col) {
636
+ newItem[col.col] = _this.getValue(col.col, item);
637
+ });
638
+ _this.data.push(newItem);
639
+ });
640
+ console.log(this.data);
641
+ };
642
+ TableroComponent.prototype.getValue = function (path, item) {
643
+ if (path.includes("."))
644
+ return jsonpath__namespace.query(item, path)[0];
645
+ return item[path];
646
+ };
520
647
  TableroComponent.prototype.loadOptions = function () {
648
+ var _this = this;
649
+ this.items = [];
521
650
  this.btn.create = this.opciones.find(function (x) { return x.label == 'Crear'; });
522
- this.btn.read = this.opciones.find(function (x) { return x.label == 'Visualizar'; });
523
- this.btn.update = this.opciones.find(function (x) { return x.label == 'Editar'; });
524
- this.btn.delete = this.opciones.find(function (x) { return x.label == 'Eliminar'; });
651
+ this.opciones.filter(function (opc) { return opc.valor.action; }).forEach(function (opc) {
652
+ _this.items.push({ label: opc.label, icon: opc.icon, command: function () { return _this.execAction(opc.valor); } });
653
+ });
525
654
  };
526
655
  TableroComponent.prototype.redirect = function (accion, data) {
527
656
  var _a, _b;
@@ -530,22 +659,54 @@
530
659
  this.router.navigateByUrl(((_b = (_a = this.btn.create) === null || _a === void 0 ? void 0 : _a.valor) === null || _b === void 0 ? void 0 : _b.redirect) || '');
531
660
  break;
532
661
  case 'read':
533
- this.router.navigateByUrl(this.btn.read.valor.redirect.replace('$id', data[this.crudConfig.tablero.key]));
662
+ this.router.navigateByUrl(this.aplyKeys(this.crudConfig.tablero.keys, this.btn.read.valor.redirect, data));
534
663
  break;
535
664
  case 'update':
536
- this.router.navigateByUrl(this.btn.update.valor.redirect.replace('$id', data[this.crudConfig.tablero.key]));
665
+ this.router.navigateByUrl(this.aplyKeys(this.crudConfig.tablero.keys, this.btn.update.valor.redirect, data));
537
666
  break;
538
667
  case 'delete':
539
- this.router.navigateByUrl(this.btn.delete.valor.redirect.replace('$id', data[this.crudConfig.tablero.key]));
668
+ this.router.navigateByUrl(this.aplyKeys(this.crudConfig.tablero.keys, this.btn.delete.valor.redirect, data));
669
+ break;
670
+ default:
671
+ break;
672
+ }
673
+ };
674
+ TableroComponent.prototype.aplyKeys = function (keys, endpoint, data) {
675
+ var _this = this;
676
+ keys.forEach(function (key) {
677
+ var _a, _b, _c, _d;
678
+ switch (key.key) {
679
+ case '@ndoc':
680
+ 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) || '');
681
+ break;
682
+ case '@tdoc':
683
+ 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) || '');
684
+ break;
685
+ case '@idKatios':
686
+ endpoint = endpoint.replace(key.key, _this.idKatios);
687
+ break;
688
+ default:
689
+ if (endpoint.includes(key.key) && data)
690
+ endpoint = endpoint.replace(key.key, jsonpath__namespace.query(data, (key === null || key === void 0 ? void 0 : key.scope) || '')[0]);
691
+ break;
692
+ }
693
+ });
694
+ return endpoint;
695
+ };
696
+ TableroComponent.prototype.execAction = function (params) {
697
+ switch (params.action) {
698
+ case 'redirect':
699
+ this.router.navigateByUrl(this.aplyKeys(this.crudConfig.tablero.keys, params.link, this.itemSelected));
540
700
  break;
541
701
  default:
702
+ this.onSelectAction.emit({ data: ___namespace.cloneDeep(this.itemSelected), params: params });
542
703
  break;
543
704
  }
544
705
  };
545
706
  return TableroComponent;
546
707
  }());
547
708
  TableroComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: TableroComponent, deps: [{ token: GeneralService }, { token: i2__namespace.Router }], target: i0__namespace.ɵɵFactoryTarget.Component });
548
- TableroComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: TableroComponent, selector: "sf-crudtablero", inputs: { opciones: "opciones", idEntidad: "idEntidad", idKatios: "idKatios" }, ngImport: i0__namespace, 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__namespace.BlockUI, selector: "p-blockUI", inputs: ["autoZIndex", "baseZIndex", "blocked", "target", "styleClass"] }, { type: i4__namespace.Toolbar, selector: "p-toolbar", inputs: ["style", "styleClass"] }, { type: i5__namespace.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: i6__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3__namespace$1.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { type: i8__namespace.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { type: i9__namespace.Ripple, selector: "[pRipple]" }, { type: i10__namespace.InputText, selector: "[pInputText]" }, { type: i6__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i11__namespace.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "tooltipZIndex", "escape", "tooltipDisabled", "pTooltip", "positionStyle", "tooltipStyleClass", "showDelay", "hideDelay", "life"] }] });
709
+ TableroComponent.ɵcmp = i0__namespace.ɵɵ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__namespace, 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__namespace.BlockUI, selector: "p-blockUI", inputs: ["target", "autoZIndex", "baseZIndex", "styleClass", "blocked"] }, { type: i4__namespace.Toolbar, selector: "p-toolbar", inputs: ["style", "styleClass"] }, { type: i5__namespace.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__namespace.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__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2__namespace$1.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { type: i9__namespace.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { type: i10__namespace.Ripple, selector: "[pRipple]" }, { type: i11__namespace.InputText, selector: "[pInputText]" }, { type: i7__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i7__namespace.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i7__namespace.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }], pipes: { "date": i7__namespace.DatePipe, "currency": i7__namespace.CurrencyPipe } });
549
710
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: TableroComponent, decorators: [{
550
711
  type: i0.Component,
551
712
  args: [{
@@ -558,6 +719,12 @@
558
719
  type: i0.Input
559
720
  }], idKatios: [{
560
721
  type: i0.Input
722
+ }], user: [{
723
+ type: i0.Input
724
+ }], dataExt: [{
725
+ type: i0.Input
726
+ }], onSelectAction: [{
727
+ type: i0.Output
561
728
  }] } });
562
729
 
563
730
  var ControlComponent = /** @class */ (function () {
@@ -566,23 +733,57 @@
566
733
  this.control = new Shema();
567
734
  this.label = '';
568
735
  this.setValue = new i0.EventEmitter();
736
+ this.sendNotification = new i0.EventEmitter();
737
+ this.sendObject = new i0.EventEmitter();
569
738
  this.isLoading = false;
570
739
  this.dataFromService = [];
740
+ this.uploadedFiles = [];
741
+ this.displayAdd = false;
742
+ this.tempValue = {};
571
743
  }
572
744
  ControlComponent.prototype.ngOnInit = function () {
573
745
  var _a;
574
746
  if (((_a = this.control) === null || _a === void 0 ? void 0 : _a.config) && this.control.subtype == 'dropdown')
575
747
  this.loadDataFromService();
748
+ if (this.value && this.control.subtype == 'autocomplete')
749
+ this.setDefaultValue();
750
+ if (this.value && this.control.type == 'date')
751
+ this.setDate();
576
752
  };
577
753
  ControlComponent.prototype.sendValue = function () {
578
754
  this.setValue.emit(this.value);
579
755
  };
580
- ControlComponent.prototype.sendValueFromObject = function () {
581
- this.setValue.emit(this.value[this.control.config.optionValue]);
756
+ ControlComponent.prototype.sendValueFromObject = function (event) {
757
+ switch (typeof (this.control.config.optionValue)) {
758
+ case 'object':
759
+ this.control.config.optionValue.forEach(function (op) { return op['value'] = event[op.key]; });
760
+ this.setValue.emit(this.control.config.optionValue);
761
+ break;
762
+ default:
763
+ this.setValue.emit(event[this.control.config.optionValue]);
764
+ break;
765
+ }
766
+ };
767
+ ControlComponent.prototype.validateValue = function (type) {
768
+ switch (type) {
769
+ case 'email':
770
+ var regex = new RegExp(/([\w\.\-_]+)?\w+@[\w-_]+(\.\w+){1,}/igm);
771
+ if (regex.test(this.value))
772
+ this.sendValue();
773
+ else {
774
+ this.value = null;
775
+ this.sendValue();
776
+ this.sendNotification.emit({ severity: 'warn', detail: 'El correo no es válido' });
777
+ }
778
+ break;
779
+ default:
780
+ break;
781
+ }
582
782
  };
583
783
  ControlComponent.prototype.loadDataFromService = function () {
584
784
  var _this = this;
585
785
  this.isLoading = true;
786
+ this.dataFromService = [];
586
787
  this.generalService.genericRequest(this.control.config.method, this.control.config.server, this.control.config.endpoint)
587
788
  .then(function (res) {
588
789
  _this.dataFromService = res.data;
@@ -598,10 +799,67 @@
598
799
  _this.isLoading = false;
599
800
  });
600
801
  };
802
+ ControlComponent.prototype.onUpload = function (event) {
803
+ var _this = this;
804
+ var file = event.files[0];
805
+ var formData = new FormData();
806
+ var path = 'Imagenes/CRUD/temp';
807
+ formData.append('uploadFile', file);
808
+ formData.append('Ruta', "/" + path);
809
+ this.isLoading = true;
810
+ this.generalService.genericRequest(this.control.config.method, this.control.config.server, this.control.config.endpoint, formData)
811
+ .then(function () {
812
+ _this.sendNotification.emit({ severity: 'info', detail: "Archivo cargado correctamente!" });
813
+ _this.uploadedFiles.push(file);
814
+ _this.isLoading = false;
815
+ _this.value = "" + _this.generalService.jsonConfig.Server + path + "/" + file.name;
816
+ _this.sendValue();
817
+ })
818
+ .catch(function (err) {
819
+ console.log(err);
820
+ _this.isLoading = false;
821
+ _this.sendNotification.emit({ severity: 'error', detail: "Error al cargar el archivo!" });
822
+ });
823
+ };
824
+ ControlComponent.prototype.refresData = function () {
825
+ var _a, _b;
826
+ if ((_b = (_a = this.control) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.endpointtemp)
827
+ this.loadDataFromService();
828
+ };
829
+ ControlComponent.prototype.setDefaultValue = function () {
830
+ var _a;
831
+ 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 });
832
+ };
833
+ ControlComponent.prototype.searchValue = function (value) {
834
+ var _this = this;
835
+ var endpoint = this.control.config.endpoint.replace('@id', value);
836
+ this.generalService.genericRequest(this.control.config.method, this.control.config.server, endpoint)
837
+ .then(function (res) {
838
+ var _a;
839
+ if (((_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.length) > 0) {
840
+ _this.sendObject.emit({ data: res.data[0], optionValue: _this.control.config.optionValue });
841
+ }
842
+ else {
843
+ _this.sendNotification.emit({ severity: 'warn', detail: "Valor no encontrado." });
844
+ _this.sendObject.emit({ data: null, optionValue: _this.control.config.optionValue });
845
+ }
846
+ })
847
+ .catch(function (err) {
848
+ console.log(err);
849
+ _this.sendNotification.emit({ severity: 'error', detail: "Error al consumir el servicio." });
850
+ });
851
+ };
852
+ ControlComponent.prototype.setDate = function () {
853
+ var format = this.control.formatMoment;
854
+ if (format && this.value) {
855
+ this.value = moment__namespace(this.value, format).toDate();
856
+ this.sendValue();
857
+ }
858
+ };
601
859
  return ControlComponent;
602
860
  }());
603
861
  ControlComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ControlComponent, deps: [{ token: GeneralService }], target: i0__namespace.ɵɵFactoryTarget.Component });
604
- ControlComponent.ɵcmp = i0__namespace.ɵɵ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__namespace, 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 [field]=\"control.field\" (completeMethod)=\"loadDataFromControlBusquedaService($event)\"\r\n (onSelect)=\"sendValueFromObject()\"></p-autoComplete>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'date'\">\r\n <ng-container [ngSwitch]=\"control.subtype\">\r\n <ng-container *ngSwitchCase=\"'calendar'\">\r\n <p-calendar [(ngModel)]=\"value\" (onSelect)=\"sendValue()\"\r\n [format]=\"control?.format || 'yy-mm-dd'\"></p-calendar>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'numeric'\">\r\n <ng-container [ngSwitch]=\"control.subtype\">\r\n <ng-container *ngSwitchCase=\"'currency'\">\r\n <p-inputNumber [(ngModel)]=\"value\" mode=\"currency\" [minFractionDigits]=\"control?.minFractionDigits || 0\"\r\n (onChange)=\"sendValue()\" [currency]=\"control?.currency || 'USD'\"></p-inputNumber>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'decimal'\">\r\n <p-inputNumber [(ngModel)]=\"value\" mode=\"decimal\" (onChange)=\"sendValue()\"\r\n [minFractionDigits]=\"control?.minFractionDigits || 0\"></p-inputNumber>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'percentage'\">\r\n <p-inputNumber [(ngModel)]=\"value\" suffix=\" %\" (onChange)=\"sendValue()\"\r\n [minFractionDigits]=\"control?.minFractionDigits || 2\"></p-inputNumber>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n</ng-container>", components: [{ type: i2__namespace$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__namespace$2.AutoComplete, selector: "p-autoComplete", inputs: ["minLength", "delay", "type", "autoZIndex", "baseZIndex", "dropdownIcon", "unique", "completeOnFocus", "scrollHeight", "dropdownMode", "showTransitionOptions", "hideTransitionOptions", "autocomplete", "suggestions", "disabled", "style", "panelStyle", "styleClass", "panelStyleClass", "inputStyle", "inputId", "inputStyleClass", "placeholder", "readonly", "virtualScroll", "itemSize", "maxlength", "name", "required", "size", "appendTo", "autoHighlight", "forceSelection", "ariaLabel", "ariaLabelledBy", "group", "field", "dropdown", "showEmptyMessage", "multiple", "tabindex", "dataKey", "emptyMessage", "autofocus", "optionGroupChildren", "optionGroupLabel"], outputs: ["completeMethod", "onSelect", "onUnselect", "onFocus", "onBlur", "onDropdownClick", "onClear", "onKeyUp", "onShow", "onHide"] }, { type: i4__namespace$1.Calendar, selector: "p-calendar", inputs: ["dateFormat", "multipleSeparator", "rangeSeparator", "inline", "showOtherMonths", "icon", "shortYearCutoff", "hourFormat", "stepHour", "stepMinute", "stepSecond", "showSeconds", "showOnFocus", "showWeek", "dataType", "selectionMode", "todayButtonStyleClass", "clearButtonStyleClass", "autoZIndex", "baseZIndex", "keepInvalid", "hideOnDateTimeSelect", "numberOfMonths", "view", "timeSeparator", "focusTrap", "firstDayOfWeek", "showTransitionOptions", "hideTransitionOptions", "defaultDate", "minDate", "maxDate", "disabledDates", "disabledDays", "yearRange", "showTime", "locale", "disabled", "style", "styleClass", "inputStyle", "inputId", "name", "inputStyleClass", "placeholder", "ariaLabelledBy", "selectOtherMonths", "showIcon", "appendTo", "readonlyInput", "monthNavigator", "yearNavigator", "timeOnly", "required", "maxDateCount", "showButtonBar", "panelStyleClass", "panelStyle", "touchUI", "tabindex"], outputs: ["onFocus", "onBlur", "onClose", "onSelect", "onInput", "onTodayClick", "onClearClick", "onMonthChange", "onYearChange", "onClickOutside", "onShow"] }, { type: i5__namespace$1.InputNumber, selector: "p-inputNumber", inputs: ["showButtons", "format", "buttonLayout", "incrementButtonIcon", "decrementButtonIcon", "step", "locale", "localeMatcher", "mode", "currency", "currencyDisplay", "useGrouping", "minFractionDigits", "maxFractionDigits", "prefix", "suffix", "disabled", "inputId", "styleClass", "style", "placeholder", "size", "maxlength", "tabindex", "title", "ariaLabel", "ariaRequired", "name", "required", "autocomplete", "min", "max", "incrementButtonClass", "decrementButtonClass", "inputStyle", "inputStyleClass"], outputs: ["onInput", "onFocus", "onBlur", "onKeyDown"] }], directives: [{ type: i6__namespace.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i6__namespace.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i7__namespace.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__namespace.InputText, selector: "[pInputText]" }, { type: i7__namespace.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i7__namespace.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
862
+ ControlComponent.ɵcmp = i0__namespace.ɵɵ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__namespace, template: "<ng-container [ngSwitch]=\"control.type\" #cc>\r\n <label [for]=\"label\" style=\"width: -webkit-fill-available;\">{{label}}</label>\r\n <ng-container *ngSwitchCase=\"'string'\">\r\n <ng-container [ngSwitch]=\"control.subtype\">\r\n <ng-container *ngSwitchCase=\"'input'\">\r\n <input pInputText type=\"text\" [(ngModel)]=\"value\" (focusout)=\"sendValue()\"\r\n [disabled]=\"control?.disabled || false\">\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'textarea'\">\r\n <textarea [rows]=\"control?.rows ? control.rows : 4\" \r\n [(ngModel)]=\"value\" (focusout)=\"sendValue()\" pInputTextarea \r\n [disabled]=\"control?.disabled || false\" [autoResize]=\"control?.autoresize || false\"></textarea>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'password'\">\r\n <input pInputText type=\"password\" [(ngModel)]=\"value\" (focusout)=\"sendValue()\"\r\n [disabled]=\"control?.disabled || false\">\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'email'\">\r\n <input pInputText type=\"text\" [(ngModel)]=\"value\" placeholder=\"email@example.com\"\r\n (focusout)=\"validateValue('email')\" [disabled]=\"control?.disabled || false\">\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'phone'\">\r\n <p-inputMask mask=\"(999) 999-9999\" [(ngModel)]=\"value\" placeholder=\"(999) 999-9999\"\r\n (focusout)=\"sendValue()\" [disabled]=\"control?.disabled || false\" [unmask]=\"control.unmask || false\"></p-inputMask>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'enum'\">\r\n <p-dropdown [options]=\"control.enum\" [(ngModel)]=\"value\" (onChange)=\"sendValue()\" appendTo=\"body\"\r\n placeholder=\"Seleccione una opci\u00F3n\" [disabled]=\"control?.disabled || false\"></p-dropdown>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'dropdown'\">\r\n <p-dropdown [lazy]=\"isLoading\" [options]=\"dataFromService\" [(ngModel)]=\"value\" (onChange)=\"sendValue()\"\r\n [optionLabel]=\"control.config.optionLabel\"\r\n [optionValue]=\"control?.field || control.config.optionValue\" (onClick)=\"refresData()\"\r\n appendTo=\"body\" placeholder=\"Seleccione una opci\u00F3n\"\r\n [disabled]=\"control?.disabled || false\"></p-dropdown>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'dropdown:replace'\">\r\n <p-dropdown [lazy]=\"isLoading\" [options]=\"dataFromService\"\r\n (onChange)=\"sendValueFromObject($event.value)\" [optionLabel]=\"control.config.optionLabel\"\r\n (onClick)=\"refresData()\" appendTo=\"body\" placeholder=\"Seleccione una opci\u00F3n\"\r\n [disabled]=\"control?.disabled || false\"></p-dropdown>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'autocomplete'\">\r\n <p-autoComplete [showEmptyMessage]=\"true\" [suggestions]=\"dataFromService\" appendTo=\"body\"\r\n (completeMethod)=\"loadDataFromControlBusquedaService($event)\" [field]=\"control.field\"\r\n [minLength]=\"1\" (onSelect)=\"sendValueFromObject($event.value)\" [(ngModel)]=\"tempValue\"\r\n [disabled]=\"control?.disabled || false\"></p-autoComplete>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'input:search'\">\r\n <div class=\"p-inputgroup\">\r\n <input type=\"text\" pInputText [(ngModel)]=\"value\" (focusout)=\"sendValue()\" />\r\n <button type=\"button\" pButton icon=\"pi pi-search\" (click)=\"searchValue(value)\"></button>\r\n </div>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'date'\">\r\n <ng-container [ngSwitch]=\"control.subtype\">\r\n <ng-container *ngSwitchCase=\"'calendar'\">\r\n <p-calendar [(ngModel)]=\"value\" (onSelect)=\"sendValue()\" (onBlur)=\"sendValue()\" [monthNavigator]=\"true\"\r\n [yearNavigator]=\"true\" yearRange=\"1900:2035\" [dateFormat]=\"control?.format || 'yy-mm-dd'\"\r\n appendTo=\"body\" [disabled]=\"control?.disabled || false\" [showOnFocus]=\"!control?.hide\"\r\n [placeholder]=\"control?.placeholder || 'aaaa-mm-dd'\" [touchUI]=\"control?.touchUI || false\"\r\n [showIcon]=\"control?.showIcon || false\"></p-calendar>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'numeric'\">\r\n <ng-container [ngSwitch]=\"control.subtype\">\r\n <ng-container *ngSwitchCase=\"'currency'\">\r\n <p-inputNumber [(ngModel)]=\"value\" mode=\"currency\" [minFractionDigits]=\"control?.minFractionDigits || 0\"\r\n [min]=\"control?.min || null\" [max]=\"control?.max || null\" (focusout)=\"sendValue()\" [locale]=\"control?.locale || undefined\"\r\n [currency]=\"control?.currency || 'USD'\" [disabled]=\"control?.disabled || false\"></p-inputNumber>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'decimal'\">\r\n <p-inputNumber [(ngModel)]=\"value\" mode=\"decimal\" (focusout)=\"sendValue()\" [min]=\"control?.min || null\"\r\n [max]=\"control?.max || null\" [minFractionDigits]=\"control?.minFractionDigits || 0\" [locale]=\"control?.locale || undefined\"\r\n [disabled]=\"control?.disabled || false\"></p-inputNumber>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'percentage'\">\r\n <p-inputNumber [(ngModel)]=\"value\" suffix=\" %\" (focusout)=\"sendValue()\" [min]=\"control?.min || null\"\r\n [max]=\"control?.max || null\" [minFractionDigits]=\"control?.minFractionDigits || 2\" [locale]=\"control?.locale || undefined\"\r\n [disabled]=\"control?.disabled || false\"></p-inputNumber>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'decimal:search'\">\r\n <div class=\"p-inputgroup\">\r\n <input type=\"number\" pInputText [(ngModel)]=\"value\" (focusout)=\"sendValue()\" />\r\n <button type=\"button\" pButton icon=\"pi pi-search\" (click)=\"searchValue(value)\"></button>\r\n </div>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'file'\">\r\n <ng-container [ngSwitch]=\"control.subtype\">\r\n <ng-container *ngSwitchCase=\"'filetmp'\">\r\n <p-fileUpload [accept]=\"control.config.accept\" [customUpload]=\"true\" (uploadHandler)=\"onUpload($event)\"\r\n [maxFileSize]=\"control.config?.maxFileSize || null\" fileLimit=\"1\">\r\n <ng-template pTemplate=\"content\">\r\n <ul *ngIf=\"uploadedFiles.length\">\r\n <li *ngFor=\"let file of uploadedFiles\">{{file.name}} - {{file.size}} bytes</li>\r\n </ul>\r\n </ng-template>\r\n </p-fileUpload>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'boolean'\">\r\n <ng-container [ngSwitch]=\"control.subtype\">\r\n <ng-container *ngSwitchCase=\"'switch'\">\r\n <p-inputSwitch [(ngModel)]=\"value\" (onChange)=\"sendValue()\" [id]=\"label\"></p-inputSwitch>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n</ng-container>", components: [{ type: i2__namespace$2.InputMask, selector: "p-inputMask", inputs: ["type", "slotChar", "autoClear", "style", "inputId", "styleClass", "placeholder", "size", "maxlength", "tabindex", "title", "ariaLabel", "ariaRequired", "disabled", "readonly", "unmask", "name", "required", "characterPattern", "autoFocus", "autocomplete", "mask"], outputs: ["onComplete", "onFocus", "onBlur", "onInput", "onKeydown"] }, { type: i3__namespace$1.Dropdown, selector: "p-dropdown", inputs: ["scrollHeight", "filter", "name", "style", "panelStyle", "styleClass", "panelStyleClass", "readonly", "required", "editable", "appendTo", "tabindex", "placeholder", "filterPlaceholder", "filterLocale", "inputId", "selectId", "dataKey", "filterBy", "autofocus", "resetFilterOnHide", "dropdownIcon", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "autoDisplayFirst", "group", "showClear", "emptyFilterMessage", "emptyMessage", "virtualScroll", "itemSize", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "ariaFilterLabel", "ariaLabelledBy", "filterMatchMode", "maxlength", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "autofocusFilter", "disabled", "options", "filterValue"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onShow", "onHide"] }, { type: i4__namespace$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__namespace$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__namespace$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__namespace$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__namespace.InputSwitch, selector: "p-inputSwitch", inputs: ["style", "styleClass", "tabindex", "inputId", "name", "disabled", "readonly", "ariaLabelledBy"], outputs: ["onChange"] }], directives: [{ type: i7__namespace.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i7__namespace.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i10__namespace$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__namespace.InputText, selector: "[pInputText]" }, { type: i10__namespace$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i10__namespace$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i12__namespace.InputTextarea, selector: "[pInputTextarea]", inputs: ["autoResize"], outputs: ["onResize"] }, { type: i9__namespace.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { type: i10__namespace$1.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { type: i2__namespace$1.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { type: i7__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i7__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
605
863
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ControlComponent, decorators: [{
606
864
  type: i0.Component,
607
865
  args: [{
@@ -614,46 +872,652 @@
614
872
  type: i0.Input
615
873
  }], value: [{
616
874
  type: i0.Input
875
+ }], appendTo: [{
876
+ type: i0.Input
617
877
  }], setValue: [{
618
878
  type: i0.Output
879
+ }], sendNotification: [{
880
+ type: i0.Output
881
+ }], sendObject: [{
882
+ type: i0.Output
619
883
  }] } });
620
884
 
885
+ var RegistroDetalleComponent = /** @class */ (function () {
886
+ function RegistroDetalleComponent(ref, config, messageService) {
887
+ this.ref = ref;
888
+ this.config = config;
889
+ this.messageService = messageService;
890
+ this.esquema = new Shema();
891
+ }
892
+ RegistroDetalleComponent.prototype.ngOnInit = function () {
893
+ var _a;
894
+ this.uiEsquema = this.config.data.uiEsquema[0];
895
+ this.esquema = this.config.data.esquema;
896
+ this.data = (_a = this.config.data) === null || _a === void 0 ? void 0 : _a.data;
897
+ if (!this.data) {
898
+ this.data = this.createObject(this.esquema);
899
+ jsonpath__namespace.value(this.data, '$..id', this.config.data.id);
900
+ }
901
+ };
902
+ RegistroDetalleComponent.prototype.getControl = function (scope) {
903
+ return jsonpath__namespace.query(this.esquema, scope)[0];
904
+ };
905
+ RegistroDetalleComponent.prototype.getValue = function (scope) {
906
+ return jsonpath__namespace.query(this.data, scope.replace('.properties', ''))[0];
907
+ };
908
+ RegistroDetalleComponent.prototype.setValue = function (value, scope) {
909
+ var _this = this;
910
+ switch (typeof (value)) {
911
+ case 'object':
912
+ if (Array.isArray(value))
913
+ value.forEach(function (val) { return jsonpath__namespace.value(_this.data, val.scope.replace('.properties', ''), val.value); });
914
+ else
915
+ jsonpath__namespace.value(this.data, scope.replace('.properties', ''), value);
916
+ break;
917
+ default:
918
+ jsonpath__namespace.value(this.data, scope.replace('.properties', ''), value);
919
+ break;
920
+ }
921
+ this.applyValuesOnEvent('onChange', this.esquema, scope.replace('$..properties.', ''));
922
+ };
923
+ RegistroDetalleComponent.prototype.createObject = function (esquema) {
924
+ var object = {};
925
+ var resultArray = [];
926
+ switch (esquema.type) {
927
+ case 'numeric':
928
+ return (esquema === null || esquema === void 0 ? void 0 : esquema.default) || 0;
929
+ case 'string':
930
+ case 'date':
931
+ return (esquema === null || esquema === void 0 ? void 0 : esquema.default) ? this.setDefaultValue(esquema.default) : null;
932
+ case 'boolean':
933
+ return (esquema === null || esquema === void 0 ? void 0 : esquema.default) || false;
934
+ case 'file':
935
+ return null;
936
+ case 'array':
937
+ case 'object':
938
+ for (var key in esquema === null || esquema === void 0 ? void 0 : esquema.properties) {
939
+ Object.defineProperty(object, key, { value: this.createObject(esquema === null || esquema === void 0 ? void 0 : esquema.properties[key]), writable: true, enumerable: true, configurable: true });
940
+ }
941
+ break;
942
+ default:
943
+ break;
944
+ }
945
+ return object;
946
+ };
947
+ RegistroDetalleComponent.prototype.setDefaultValue = function (value) {
948
+ var data = null;
949
+ var uactivo;
950
+ switch (value) {
951
+ case '@uactivo':
952
+ uactivo = JSON.parse(localStorage.getItem('oSessionTFM') || '{}');
953
+ if (!uactivo)
954
+ console.log('Validar configuracion de sesion');
955
+ else
956
+ data = uactivo.UsuarioSistema.TDOC + "-" + uactivo.UsuarioSistema.NDOC;
957
+ break;
958
+ case '@tdocactivo':
959
+ uactivo = JSON.parse(sessionStorage.getItem('usrSesion') || '{}');
960
+ if (!uactivo)
961
+ console.log('Validar configuracion de sesion');
962
+ else
963
+ data = uactivo.UsuarioSistema.TDOC;
964
+ break;
965
+ case '@ndocactivo':
966
+ uactivo = JSON.parse(sessionStorage.getItem('usrSesion') || '{}');
967
+ if (!uactivo)
968
+ console.log('Validar configuracion de sesion');
969
+ else
970
+ data = uactivo.UsuarioSistema.NDOC;
971
+ break;
972
+ case '@hoy':
973
+ data = new Date();
974
+ break;
975
+ default:
976
+ data = value;
977
+ break;
978
+ }
979
+ return data;
980
+ };
981
+ RegistroDetalleComponent.prototype.submit = function () {
982
+ this.applyValuesOnEvent('onSubmit', this.esquema);
983
+ if (!this.validateData())
984
+ return;
985
+ this.ref.close(this.data);
986
+ };
987
+ RegistroDetalleComponent.prototype.cancel = function () {
988
+ this.applyValuesOnEvent('onCancel', this.esquema);
989
+ this.ref.close();
990
+ };
991
+ RegistroDetalleComponent.prototype.validateData = function () {
992
+ if (this.esquema.validations.type == 'local')
993
+ return this.validateDataLocal();
994
+ return true;
995
+ };
996
+ RegistroDetalleComponent.prototype.validateDataLocal = function () {
997
+ var _this = this;
998
+ var err = [];
999
+ this.esquema.validations.required.forEach(function (x) {
1000
+ if (!jsonpath__namespace.query(_this.data, x.field)[0])
1001
+ err.push(x.message);
1002
+ });
1003
+ if (err.length != 0)
1004
+ this.messageService.add({ severity: 'warn', detail: err.join('. ') });
1005
+ return err.length == 0;
1006
+ };
1007
+ RegistroDetalleComponent.prototype.applyValuesOnEvent = function (event, esquema, scope) {
1008
+ var _this = this;
1009
+ if (scope) {
1010
+ if (esquema.properties[scope][event]) {
1011
+ esquema.properties[scope][event].forEach(function (value) {
1012
+ _this.setValueEvent(_this.data, value);
1013
+ });
1014
+ }
1015
+ }
1016
+ else {
1017
+ for (var key in esquema.properties) {
1018
+ if (esquema.properties[key][event]) {
1019
+ esquema.properties[key][event].forEach(function (value) {
1020
+ _this.setValueEvent(_this.data, value);
1021
+ });
1022
+ }
1023
+ }
1024
+ }
1025
+ };
1026
+ RegistroDetalleComponent.prototype.setValueEvent = function (data, params) {
1027
+ var _a;
1028
+ var value;
1029
+ var date = moment__namespace(new Date());
1030
+ switch (params.op) {
1031
+ case 'sum':
1032
+ value = jsonpath__namespace.query(data, params === null || params === void 0 ? void 0 : params.scope[0]).reduce(function (acc, cur) { return acc += (params === null || params === void 0 ? void 0 : params.key) ? cur[params.key] : cur; }, 0);
1033
+ break;
1034
+ case 'concat':
1035
+ var array_1 = [];
1036
+ (_a = params === null || params === void 0 ? void 0 : params.key) === null || _a === void 0 ? void 0 : _a.reduce(function (acc, cur) {
1037
+ array_1.push(jsonpath__namespace.query(data, cur)[0]);
1038
+ }, []);
1039
+ if (params === null || params === void 0 ? void 0 : params.separator)
1040
+ jsonpath__namespace.value(data, params.scope[0], array_1.join((params === null || params === void 0 ? void 0 : params.separator) || ' '));
1041
+ break;
1042
+ case 'enable':
1043
+ jsonpath__namespace.value(this.esquema, params.scope[0], false);
1044
+ break;
1045
+ case 'disabled':
1046
+ jsonpath__namespace.value(this.esquema, params.scope[0], true);
1047
+ break;
1048
+ case 'replace:endpoint':
1049
+ jsonpath__namespace.value(this.esquema, params.scope[0], jsonpath__namespace.query(this.esquema, params.scope[1])[0].replace(params.scope[2], jsonpath__namespace.query(data, "$.." + params.key)));
1050
+ break;
1051
+ case 'setNull':
1052
+ jsonpath__namespace.value(this.data, "$." + params.key, null);
1053
+ break;
1054
+ case 'datediff:years':
1055
+ jsonpath__namespace.value(this.data, params.scope[0], date.diff(moment__namespace(jsonpath__namespace.query(this.data, params.scope[1])[0]), 'years'));
1056
+ break;
1057
+ case 'datediff:months':
1058
+ jsonpath__namespace.value(this.data, params.scope[0], date.diff(moment__namespace(jsonpath__namespace.query(this.data, params.scope[1])[0]), 'months'));
1059
+ break;
1060
+ case 'datediff:weeks':
1061
+ jsonpath__namespace.value(this.data, params.scope[0], date.diff(moment__namespace(jsonpath__namespace.query(this.data, params.scope[1])[0]), 'weeks'));
1062
+ break;
1063
+ case 'datediff:days':
1064
+ jsonpath__namespace.value(this.data, params.scope[0], date.diff(moment__namespace(jsonpath__namespace.query(this.data, params.scope[1])[0]), 'days'));
1065
+ break;
1066
+ default:
1067
+ break;
1068
+ }
1069
+ return value;
1070
+ };
1071
+ RegistroDetalleComponent.prototype.sendNotification = function (message) {
1072
+ this.messageService.add(message);
1073
+ };
1074
+ RegistroDetalleComponent.prototype.applyValuesFromObject = function (event) {
1075
+ var _this = this;
1076
+ if (event.data)
1077
+ event.optionValue.forEach(function (value) { return jsonpath__namespace.value(_this.data, value.scope.replace('.properties', ''), _this.aplyFormatValue(value.scope, event.data[value.key])); });
1078
+ else
1079
+ event.optionValue.forEach(function (value) { return jsonpath__namespace.value(_this.data, value.scope.replace('.properties', ''), null); });
1080
+ };
1081
+ RegistroDetalleComponent.prototype.aplyFormatValue = function (scope, value) {
1082
+ var control = jsonpath__namespace.query(this.esquema, scope)[0];
1083
+ var resp;
1084
+ switch (control.type) {
1085
+ case 'date':
1086
+ resp = new Date("" + value);
1087
+ break;
1088
+ case 'numeric':
1089
+ resp = +value;
1090
+ break;
1091
+ default:
1092
+ resp = value;
1093
+ break;
1094
+ }
1095
+ return resp;
1096
+ };
1097
+ return RegistroDetalleComponent;
1098
+ }());
1099
+ RegistroDetalleComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RegistroDetalleComponent, deps: [{ token: i1__namespace$1.DynamicDialogRef }, { token: i1__namespace$1.DynamicDialogConfig }, { token: i2__namespace$1.MessageService }], target: i0__namespace.ɵɵFactoryTarget.Component });
1100
+ RegistroDetalleComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: RegistroDetalleComponent, selector: "lib-registro-detalle", ngImport: i0__namespace, template: "<p-toast></p-toast>\r\n<div *ngFor=\"let element of uiEsquema.elements\" [class]=\"element?.class\" #a>\r\n <ng-container [ngSwitch]=\"element.type\">\r\n <div *ngSwitchCase=\"'Label'\" [style]=\"element?.style\">\r\n {{element?.label}}\r\n </div>\r\n <ng-container *ngSwitchCase=\"'HorizontalLayout'\">\r\n <div *ngFor=\"let el of element.elements\" [class]=\"el?.class\">\r\n <ng-container [ngSwitch]=\"el.type\">\r\n <sf-control *ngSwitchCase=\"'Control'\" [control]=\"getControl(el.scope)\" [label]=\"el.label\"\r\n [value]=\"getValue(el.scope)\" (setValue)=\"setValue($event, el.scope)\"\r\n (sendNotification)=\"sendNotification($event)\" (sendObject)=\"applyValuesFromObject($event)\"></sf-control>\r\n </ng-container>\r\n </div>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'VerticalLayout'\">\r\n <div *ngFor=\"let el of element.elements\" [class]=\"el?.class\">\r\n <ng-container [ngSwitch]=\"el.type\">\r\n <sf-control *ngSwitchCase=\"'Control'\" [control]=\"getControl(el.scope)\" [label]=\"el.label\"\r\n [value]=\"getValue(el.scope)\" (setValue)=\"setValue($event, el.scope)\"\r\n (sendNotification)=\"sendNotification($event)\" (sendObject)=\"applyValuesFromObject($event)\"></sf-control>\r\n </ng-container>\r\n </div>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'Control'\">\r\n <sf-control [control]=\"getControl(element.scope)\" [label]=\"element.label\"></sf-control>\r\n </ng-container>\r\n </ng-container>\r\n</div>\r\n<div class=\"card-footer mt-2\">\r\n <button pButton pRipple type=\"button\" label=\"Guardar\" (click)=\"submit()\" class=\"mr-2\"></button>\r\n <button pButton pRipple type=\"button\" label=\"Cancelar\" (click)=\"cancel()\" class=\"p-button-danger\"></button>\r\n</div>", styles: [""], components: [{ type: i3__namespace$2.Toast, selector: "p-toast", inputs: ["key", "autoZIndex", "baseZIndex", "style", "styleClass", "position", "preventOpenDuplicates", "preventDuplicates", "showTransformOptions", "hideTransformOptions", "showTransitionOptions", "hideTransitionOptions", "breakpoints"], outputs: ["onClose"] }, { type: ControlComponent, selector: "sf-control", inputs: ["control", "label", "value", "appendTo"], outputs: ["setValue", "sendNotification", "sendObject"] }], directives: [{ type: i7__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i7__namespace.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i7__namespace.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i9__namespace.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { type: i10__namespace.Ripple, selector: "[pRipple]" }] });
1101
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RegistroDetalleComponent, decorators: [{
1102
+ type: i0.Component,
1103
+ args: [{
1104
+ selector: 'lib-registro-detalle',
1105
+ templateUrl: './registro-detalle.component.html',
1106
+ styleUrls: ['./registro-detalle.component.css']
1107
+ }]
1108
+ }], ctorParameters: function () { return [{ type: i1__namespace$1.DynamicDialogRef }, { type: i1__namespace$1.DynamicDialogConfig }, { type: i2__namespace$1.MessageService }]; } });
1109
+
1110
+ var RegistroChildComponent = /** @class */ (function () {
1111
+ function RegistroChildComponent(ref, config, messageService, dialogService) {
1112
+ this.ref = ref;
1113
+ this.config = config;
1114
+ this.messageService = messageService;
1115
+ this.dialogService = dialogService;
1116
+ this.esquema = new Shema();
1117
+ this.trx = 'c';
1118
+ this.controlsLoaded = false;
1119
+ }
1120
+ RegistroChildComponent.prototype.ngOnInit = function () {
1121
+ var _a;
1122
+ this.uiEsquema = this.config.data.uiEsquema[0];
1123
+ this.esquema = this.config.data.esquema;
1124
+ this.data = (_a = this.config.data) === null || _a === void 0 ? void 0 : _a.data;
1125
+ if (!this.data) {
1126
+ this.data = this.createObject(this.esquema);
1127
+ jsonpath__namespace.value(this.data, '$..id', this.config.data.id);
1128
+ }
1129
+ this.buildControls();
1130
+ };
1131
+ RegistroChildComponent.prototype.buildControls = function () {
1132
+ var _this = this;
1133
+ this.controlsLoaded = false;
1134
+ this.controls = [];
1135
+ this.values = [];
1136
+ this.uiEsquema.elements.forEach(function (layout, i) {
1137
+ var _a;
1138
+ _this.controls.push([]);
1139
+ _this.values.push([]);
1140
+ (_a = layout.elements) === null || _a === void 0 ? void 0 : _a.forEach(function (element) {
1141
+ if (!element.scope)
1142
+ console.log("CONFIGURAR BIEN " + element);
1143
+ _this.controls[i].push(_this.getControl(element.scope));
1144
+ _this.values[i].push(_this.getValue(element.scope));
1145
+ });
1146
+ });
1147
+ this.controlsLoaded = true;
1148
+ };
1149
+ RegistroChildComponent.prototype.getControl = function (scope) {
1150
+ return jsonpath__namespace.query(this.esquema, scope)[0];
1151
+ };
1152
+ RegistroChildComponent.prototype.getValue = function (scope) {
1153
+ return jsonpath__namespace.query(this.data, scope.replace('.properties', ''))[0];
1154
+ };
1155
+ RegistroChildComponent.prototype.setValue = function (value, scope, i, j) {
1156
+ var _this = this;
1157
+ switch (typeof (value)) {
1158
+ case 'object':
1159
+ if (Array.isArray(value))
1160
+ value.forEach(function (val) { return jsonpath__namespace.value(_this.data, val.scope.replace('.properties', ''), val.value); });
1161
+ else
1162
+ jsonpath__namespace.value(this.data, scope.replace('.properties', ''), value);
1163
+ break;
1164
+ default:
1165
+ this.values[i][j] = value;
1166
+ jsonpath__namespace.value(this.data, scope.replace('.properties', ''), value);
1167
+ break;
1168
+ }
1169
+ this.applyValuesOnEvent('onChange', this.esquema, scope.replace('$..properties.', ''));
1170
+ };
1171
+ RegistroChildComponent.prototype.createObject = function (esquema) {
1172
+ var object = {};
1173
+ var resultArray = [];
1174
+ switch (esquema.type) {
1175
+ case 'numeric':
1176
+ return (esquema === null || esquema === void 0 ? void 0 : esquema.default) || 0;
1177
+ case 'string':
1178
+ case 'date':
1179
+ return (esquema === null || esquema === void 0 ? void 0 : esquema.default) ? this.setDefaultValue(esquema.default) : null;
1180
+ case 'boolean':
1181
+ return (esquema === null || esquema === void 0 ? void 0 : esquema.default) || false;
1182
+ case 'file':
1183
+ return null;
1184
+ case 'array':
1185
+ case 'object':
1186
+ for (var key in esquema === null || esquema === void 0 ? void 0 : esquema.properties) {
1187
+ Object.defineProperty(object, key, { value: this.createObjectChild(esquema === null || esquema === void 0 ? void 0 : esquema.properties[key]), writable: true, enumerable: true, configurable: true });
1188
+ }
1189
+ break;
1190
+ default:
1191
+ break;
1192
+ }
1193
+ return object;
1194
+ };
1195
+ RegistroChildComponent.prototype.createObjectChild = function (esquema) {
1196
+ var object = {};
1197
+ var resultArray = [];
1198
+ switch (esquema.type) {
1199
+ case 'numeric':
1200
+ return (esquema === null || esquema === void 0 ? void 0 : esquema.default) || 0;
1201
+ case 'string':
1202
+ case 'date':
1203
+ return (esquema === null || esquema === void 0 ? void 0 : esquema.default) ? this.setDefaultValue(esquema.default) : null;
1204
+ case 'boolean':
1205
+ return (esquema === null || esquema === void 0 ? void 0 : esquema.default) || false;
1206
+ case 'file':
1207
+ return null;
1208
+ case 'array':
1209
+ return [];
1210
+ case 'object':
1211
+ for (var key in esquema === null || esquema === void 0 ? void 0 : esquema.properties) {
1212
+ Object.defineProperty(object, key, { value: this.createObject(esquema === null || esquema === void 0 ? void 0 : esquema.properties[key]), writable: true, enumerable: true, configurable: true });
1213
+ }
1214
+ break;
1215
+ default:
1216
+ break;
1217
+ }
1218
+ return object;
1219
+ };
1220
+ RegistroChildComponent.prototype.setDefaultValue = function (value) {
1221
+ var data = null;
1222
+ var uactivo;
1223
+ switch (value) {
1224
+ case '@uactivo':
1225
+ uactivo = JSON.parse(localStorage.getItem('oSessionTFM') || '{}');
1226
+ if (!uactivo)
1227
+ console.log('Validar configuracion de sesion');
1228
+ else
1229
+ data = uactivo.UsuarioSistema.TDOC + "-" + uactivo.UsuarioSistema.NDOC;
1230
+ break;
1231
+ case '@tdocactivo':
1232
+ uactivo = JSON.parse(sessionStorage.getItem('usrSesion') || '{}');
1233
+ if (!uactivo)
1234
+ console.log('Validar configuracion de sesion');
1235
+ else
1236
+ data = uactivo.UsuarioSistema.TDOC;
1237
+ break;
1238
+ case '@ndocactivo':
1239
+ uactivo = JSON.parse(sessionStorage.getItem('usrSesion') || '{}');
1240
+ if (!uactivo)
1241
+ console.log('Validar configuracion de sesion');
1242
+ else
1243
+ data = uactivo.UsuarioSistema.NDOC;
1244
+ break;
1245
+ case '@hoy':
1246
+ data = new Date();
1247
+ break;
1248
+ default:
1249
+ data = value;
1250
+ break;
1251
+ }
1252
+ return data;
1253
+ };
1254
+ RegistroChildComponent.prototype.submit = function () {
1255
+ this.applyValuesOnEvent('onSubmit', this.esquema);
1256
+ if (!this.validateData())
1257
+ return;
1258
+ this.ref.close(this.data);
1259
+ };
1260
+ RegistroChildComponent.prototype.cancel = function () {
1261
+ this.applyValuesOnEvent('onCancel', this.esquema);
1262
+ this.ref.close();
1263
+ };
1264
+ RegistroChildComponent.prototype.validateData = function () {
1265
+ if (this.esquema.validations.type == 'local')
1266
+ return this.validateDataLocal();
1267
+ return true;
1268
+ };
1269
+ RegistroChildComponent.prototype.validateDataLocal = function () {
1270
+ var _this = this;
1271
+ var err = [];
1272
+ this.esquema.validations.required.forEach(function (x) {
1273
+ if (!jsonpath__namespace.query(_this.data, x.field)[0])
1274
+ err.push(x.message);
1275
+ });
1276
+ if (err.length != 0)
1277
+ this.messageService.add({ severity: 'warn', detail: err.join('. ') });
1278
+ return err.length == 0;
1279
+ };
1280
+ RegistroChildComponent.prototype.applyValuesOnEvent = function (event, esquema, scope) {
1281
+ var _this = this;
1282
+ if (scope) {
1283
+ if (esquema.properties[scope][event]) {
1284
+ esquema.properties[scope][event].forEach(function (value) {
1285
+ _this.setValueEvent(_this.data, value);
1286
+ });
1287
+ }
1288
+ }
1289
+ else {
1290
+ for (var key in esquema.properties) {
1291
+ if (esquema.properties[key][event]) {
1292
+ esquema.properties[key][event].forEach(function (value) {
1293
+ _this.setValueEvent(_this.data, value);
1294
+ });
1295
+ }
1296
+ }
1297
+ }
1298
+ };
1299
+ RegistroChildComponent.prototype.setValueEvent = function (data, params) {
1300
+ var _a;
1301
+ var value;
1302
+ var date = moment__namespace(new Date());
1303
+ switch (params.op) {
1304
+ case 'sum':
1305
+ value = jsonpath__namespace.query(data, params === null || params === void 0 ? void 0 : params.scope[0]).reduce(function (acc, cur) { return acc += (params === null || params === void 0 ? void 0 : params.key) ? cur[params.key] : cur; }, 0);
1306
+ break;
1307
+ case 'concat':
1308
+ var array_1 = [];
1309
+ (_a = params === null || params === void 0 ? void 0 : params.key) === null || _a === void 0 ? void 0 : _a.reduce(function (acc, cur) {
1310
+ array_1.push(jsonpath__namespace.query(data, cur)[0]);
1311
+ }, []);
1312
+ if (params === null || params === void 0 ? void 0 : params.separator)
1313
+ jsonpath__namespace.value(data, params.scope[0], array_1.join((params === null || params === void 0 ? void 0 : params.separator) || ' '));
1314
+ break;
1315
+ case 'enable':
1316
+ jsonpath__namespace.value(this.esquema, params.scope[0], false);
1317
+ break;
1318
+ case 'disabled':
1319
+ jsonpath__namespace.value(this.esquema, params.scope[0], true);
1320
+ break;
1321
+ case 'replace:endpoint':
1322
+ jsonpath__namespace.value(this.esquema, params.scope[0], jsonpath__namespace.query(this.esquema, params.scope[1])[0].replace(params.scope[2], jsonpath__namespace.query(data, "$.." + params.key)));
1323
+ break;
1324
+ case 'setNull':
1325
+ jsonpath__namespace.value(this.data, "$." + params.key, null);
1326
+ break;
1327
+ case 'datediff:years':
1328
+ jsonpath__namespace.value(this.data, params.scope[0], date.diff(moment__namespace(jsonpath__namespace.query(this.data, params.scope[1])[0]), 'years'));
1329
+ break;
1330
+ case 'datediff:months':
1331
+ jsonpath__namespace.value(this.data, params.scope[0], date.diff(moment__namespace(jsonpath__namespace.query(this.data, params.scope[1])[0]), 'months'));
1332
+ break;
1333
+ case 'datediff:weeks':
1334
+ jsonpath__namespace.value(this.data, params.scope[0], date.diff(moment__namespace(jsonpath__namespace.query(this.data, params.scope[1])[0]), 'weeks'));
1335
+ break;
1336
+ case 'datediff:days':
1337
+ jsonpath__namespace.value(this.data, params.scope[0], date.diff(moment__namespace(jsonpath__namespace.query(this.data, params.scope[1])[0]), 'days'));
1338
+ break;
1339
+ default:
1340
+ break;
1341
+ }
1342
+ return value;
1343
+ };
1344
+ RegistroChildComponent.prototype.sendNotification = function (message) {
1345
+ this.messageService.add(message);
1346
+ };
1347
+ RegistroChildComponent.prototype.addObjectArray = function (element) {
1348
+ var _this = this;
1349
+ this.dialogRef = this.dialogService.open(RegistroDetalleComponent, {
1350
+ header: element.label ? element.label : 'Detalle',
1351
+ width: '70%',
1352
+ modal: true,
1353
+ closable: false,
1354
+ data: {
1355
+ uiEsquema: Object.assign({}, element.elements),
1356
+ esquema: this.getControl(element.scope),
1357
+ id: this.getValue(element.scope).length + 1
1358
+ }
1359
+ });
1360
+ this.dialogRef.onClose.subscribe(function (data) {
1361
+ if (data)
1362
+ _this.data[element.scope.replace('$..properties.', '')].push(data);
1363
+ _this.applyValuesOnEvent('onChange', _this.esquema, element.scope.replace('$..properties.', ''));
1364
+ });
1365
+ };
1366
+ RegistroChildComponent.prototype.editRow = function (element, data, index) {
1367
+ var _this = this;
1368
+ this.dialogRef = this.dialogService.open(RegistroDetalleComponent, {
1369
+ header: element.label ? element.label : 'Detalle',
1370
+ width: '70%',
1371
+ modal: true,
1372
+ closable: false,
1373
+ data: {
1374
+ uiEsquema: Object.assign({}, element.elements),
1375
+ esquema: this.getControl(element.scope),
1376
+ data: Object.assign({}, data)
1377
+ }
1378
+ });
1379
+ this.dialogRef.onClose.subscribe(function (data) {
1380
+ if (data)
1381
+ _this.data[element.scope.replace('$..properties.', '')][index] = data;
1382
+ _this.applyValuesOnEvent('onChange', _this.esquema, element.scope.replace('$..properties.', ''));
1383
+ });
1384
+ };
1385
+ RegistroChildComponent.prototype.deleteRow = function (element, index) {
1386
+ this.data[element.scope.replace('$..properties.', '')].splice(index, 1);
1387
+ index = 1;
1388
+ this.data[element.scope.replace('$..properties.', '')].forEach(function (el) {
1389
+ el.id = index;
1390
+ index++;
1391
+ });
1392
+ this.applyValuesOnEvent('onChange', this.esquema, element.scope.replace('$..properties.', ''));
1393
+ };
1394
+ RegistroChildComponent.prototype.applyValuesFromObject = function (event) {
1395
+ var _this = this;
1396
+ if (event.data)
1397
+ event.optionValue.forEach(function (value) { return jsonpath__namespace.value(_this.data, value.scope.replace('.properties', ''), _this.aplyFormatValue(value.scope, event.data[value.key])); });
1398
+ else
1399
+ event.optionValue.forEach(function (value) { return jsonpath__namespace.value(_this.data, value.scope.replace('.properties', ''), null); });
1400
+ };
1401
+ RegistroChildComponent.prototype.aplyFormatValue = function (scope, value) {
1402
+ var control = jsonpath__namespace.query(this.esquema, scope)[0];
1403
+ var resp;
1404
+ switch (control.type) {
1405
+ case 'date':
1406
+ resp = new Date("" + value);
1407
+ break;
1408
+ case 'numeric':
1409
+ resp = +value;
1410
+ break;
1411
+ default:
1412
+ resp = value;
1413
+ break;
1414
+ }
1415
+ return resp;
1416
+ };
1417
+ return RegistroChildComponent;
1418
+ }());
1419
+ RegistroChildComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RegistroChildComponent, deps: [{ token: i1__namespace$1.DynamicDialogRef }, { token: i1__namespace$1.DynamicDialogConfig }, { token: i2__namespace$1.MessageService }, { token: i1__namespace$1.DialogService }], target: i0__namespace.ɵɵFactoryTarget.Component });
1420
+ RegistroChildComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: RegistroChildComponent, selector: "lib-registro-child", providers: [i2$1.MessageService, i1$1.DialogService], ngImport: i0__namespace, template: "<p-toast></p-toast>\r\n<div *ngIf=\"controlsLoaded\">\r\n<div *ngFor=\"let element of uiEsquema.elements; let i = index\" [class]=\"element?.class\" #a>\r\n <ng-container [ngSwitch]=\"element.type\">\r\n <div *ngSwitchCase=\"'Label'\" [style]=\"element?.style\">\r\n {{element?.label}}\r\n </div>\r\n <ng-container *ngSwitchCase=\"'HorizontalLayout'\">\r\n <div *ngFor=\"let el of element.elements; let j =index\" [class]=\"el?.class\">\r\n <ng-container [ngSwitch]=\"el.type\">\r\n <sf-control *ngSwitchCase=\"'Control'\" [control]=\"controls[i][j]\" [label]=\"el.label\" [value]=\"values[i][j]\"\r\n (setValue)=\"setValue($event, el.scope, i, j)\" (sendNotification)=\"sendNotification($event)\"\r\n (sendObject)=\"applyValuesFromObject($event)\"></sf-control>\r\n </ng-container>\r\n </div>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'VerticalLayout'\">\r\n <div *ngFor=\"let el of element.elements; let k =index\" [class]=\"el?.class\">\r\n <ng-container [ngSwitch]=\"el.type\">\r\n <sf-control *ngSwitchCase=\"'Control'\" [control]=\"controls[i][k]\" [label]=\"el.label\"\r\n [value]=\"values[i][k]\" (setValue)=\"setValue($event, el.scope, i, k)\"\r\n (sendNotification)=\"sendNotification($event)\"\r\n (sendObject)=\"applyValuesFromObject($event)\"></sf-control>\r\n <ng-container *ngSwitchCase=\"'Table'\">\r\n <p-table [value]=\"getValue(el.scope)\" [columns]=\"getControl(el.scope).config.columns\">\r\n <ng-template pTemplate=\"caption\">\r\n <div class=\"flex align-items-center justify-content-between\">\r\n <button pButton pRipple icon=\"pi pi-plus\" (click)=\"addObjectArray(el)\"\r\n class=\"p-button-success\"></button>\r\n </div>\r\n </ng-template>\r\n <ng-template pTemplate=\"header\" let-columns>\r\n <tr>\r\n <th *ngFor=\"let col of columns\">\r\n {{col.label}}\r\n </th>\r\n <ng-container *ngIf=\"trx == 'c' || trx == 'u'\">\r\n <th></th>\r\n </ng-container>\r\n </tr>\r\n </ng-template>\r\n <ng-template pTemplate=\"body\" let-rowData let-columns=\"columns\" let-rowIndex=\"rowIndex\">\r\n <tr>\r\n <ng-container *ngFor=\"let col of columns\" [ngSwitch]=\"col.type\">\r\n <ng-container *ngSwitchCase=\"'text'\">\r\n <td>{{rowData[col.col]}}</td>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'currency:USD'\">\r\n <td>{{rowData[col.col] | currency: 'USD'}}</td>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'date:yyyy-mm-dd'\">\r\n <td>{{rowData[col.col] | date: 'yyyy-mm-dd'}}</td>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'date:dd/mm/yyyy'\">\r\n <td>{{rowData[col.col] | date: 'dd/MM/yyyy'}}</td>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'boolean'\">\r\n <td>\r\n <i *ngIf=\"rowData[col.col]\" class=\"pi pi-check\"></i>\r\n <i *ngIf=\"!rowData[col.col]\" class=\"pi pi-times\"></i>\r\n </td>\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"trx == 'c' || trx == 'u'\">\r\n <td>\r\n <button pButton pRipple type=\"button\"\r\n (click)=\"editRow(el, rowData, rowIndex)\" icon=\"pi pi-pencil\"\r\n class=\"p-button-rounded p-button-info mr-1\"></button>\r\n <button pButton pRipple type=\"button\" (click)=\"deleteRow(el, rowIndex)\"\r\n icon=\"pi pi-trash\" class=\"p-button-rounded p-button-danger\"></button>\r\n </td>\r\n </ng-container>\r\n </tr>\r\n </ng-template>\r\n </p-table>\r\n </ng-container>\r\n </ng-container>\r\n </div>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'Control'\">\r\n <sf-control [control]=\"getControl(element.scope)\" [label]=\"element.label\"></sf-control>\r\n </ng-container>\r\n </ng-container>\r\n</div>\r\n<div class=\"card-footer mt-2\">\r\n <button pButton pRipple type=\"button\" label=\"Guardar\" (click)=\"submit()\" class=\"mr-2\"></button>\r\n <button pButton pRipple type=\"button\" label=\"Cancelar\" (click)=\"cancel()\" class=\"p-button-danger\"></button>\r\n</div>\r\n</div>\r\n", components: [{ type: i3__namespace$2.Toast, selector: "p-toast", inputs: ["key", "autoZIndex", "baseZIndex", "style", "styleClass", "position", "preventOpenDuplicates", "preventDuplicates", "showTransformOptions", "hideTransformOptions", "showTransitionOptions", "hideTransitionOptions", "breakpoints"], outputs: ["onClose"] }, { type: ControlComponent, selector: "sf-control", inputs: ["control", "label", "value", "appendTo"], outputs: ["setValue", "sendNotification", "sendObject"] }, { type: i5__namespace.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__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i7__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i7__namespace.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i7__namespace.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i2__namespace$1.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { type: i9__namespace.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { type: i10__namespace.Ripple, selector: "[pRipple]" }], pipes: { "currency": i7__namespace.CurrencyPipe, "date": i7__namespace.DatePipe } });
1421
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RegistroChildComponent, decorators: [{
1422
+ type: i0.Component,
1423
+ args: [{
1424
+ selector: 'lib-registro-child',
1425
+ templateUrl: './registro-child.component.html',
1426
+ providers: [i2$1.MessageService, i1$1.DialogService]
1427
+ }]
1428
+ }], ctorParameters: function () { return [{ type: i1__namespace$1.DynamicDialogRef }, { type: i1__namespace$1.DynamicDialogConfig }, { type: i2__namespace$1.MessageService }, { type: i1__namespace$1.DialogService }]; } });
1429
+
1430
+ var SfCrudService = /** @class */ (function () {
1431
+ function SfCrudService() {
1432
+ this._dataTemp = [];
1433
+ }
1434
+ SfCrudService.prototype.saveDataTemp = function (scope, value) {
1435
+ this._dataTemp.push({ scope: scope, value: value });
1436
+ sessionStorage.setItem('dataTemp', JSON.stringify(this._dataTemp));
1437
+ };
1438
+ SfCrudService.prototype.getDataTemp = function () {
1439
+ var dataTemp = sessionStorage.getItem('dataTemp');
1440
+ sessionStorage.removeItem('dataTemp');
1441
+ return dataTemp ? JSON.parse(dataTemp) : [];
1442
+ };
1443
+ SfCrudService.prototype.cleanDataTemp = function () {
1444
+ sessionStorage.removeItem('dataTemp');
1445
+ };
1446
+ return SfCrudService;
1447
+ }());
1448
+ SfCrudService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: SfCrudService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1449
+ SfCrudService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: SfCrudService, providedIn: 'root' });
1450
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: SfCrudService, decorators: [{
1451
+ type: i0.Injectable,
1452
+ args: [{
1453
+ providedIn: 'root'
1454
+ }]
1455
+ }], ctorParameters: function () { return []; } });
1456
+
621
1457
  var RegistroComponent = /** @class */ (function () {
622
- function RegistroComponent(generalService, router, messageSerice) {
1458
+ function RegistroComponent(generalService, router, messageSerice, dialogService, sfCrudService) {
623
1459
  this.generalService = generalService;
624
1460
  this.router = router;
625
1461
  this.messageSerice = messageSerice;
1462
+ this.dialogService = dialogService;
1463
+ this.sfCrudService = sfCrudService;
626
1464
  this.idKatios = '';
627
1465
  this.idEntidad = '';
628
1466
  this.trx = '';
629
1467
  this.id = '';
630
- this.enProceso = false;
1468
+ this.sendData = new i0.EventEmitter();
1469
+ this.onSubmit = new i0.EventEmitter();
1470
+ this.dataTemp = [];
631
1471
  this.crudConfig = new CrudConfig();
1472
+ this.enProceso = false;
632
1473
  this.configOperation = new Operations();
1474
+ this.isLocal = false;
1475
+ this.controlsLoaded = false;
1476
+ this.dataTemp = this.sfCrudService.getDataTemp();
633
1477
  }
634
1478
  RegistroComponent.prototype.ngOnInit = function () {
635
1479
  this.loadConfigCrud();
636
- this.setLabelSumbit();
637
1480
  };
638
1481
  RegistroComponent.prototype.loadConfigCrud = function () {
639
1482
  var _this = this;
640
1483
  this.enProceso = true;
641
1484
  this.generalService.getCrudByEntidad(this.idKatios, this.idEntidad)
642
1485
  .then(function (res) {
1486
+ _this.setDataTemp(res.esquema, _this.dataTemp);
643
1487
  _this.crudConfig = res;
644
- if (_this.trx != 'c')
645
- _this.getInfoRegistro(_this.crudConfig.registro);
646
- else {
1488
+ if (_this.trx == 'c') {
647
1489
  _this.data = _this.createObject(_this.crudConfig.esquema);
1490
+ _this.setLabelSumbit();
648
1491
  _this.enProceso = false;
1492
+ _this.configOperation = _this.crudConfig.registro.operations.find(function (x) { return x.type.startsWith(_this.trx); }) || new Operations();
1493
+ _this.buildControls();
649
1494
  }
650
- _this.configOperation = _this.crudConfig.registro.operations.find(function (x) { return x.type.startsWith(_this.trx); }) || new Operations();
1495
+ else
1496
+ _this.getInfoRegistro(_this.crudConfig.registro);
651
1497
  })
652
1498
  .catch(function (err) {
653
1499
  console.log(err);
654
1500
  _this.enProceso = false;
655
1501
  });
656
1502
  };
1503
+ RegistroComponent.prototype.buildControls = function () {
1504
+ var _this = this;
1505
+ this.controlsLoaded = false;
1506
+ this.controls = [];
1507
+ this.values = [];
1508
+ this.crudConfig.uiEsquema.elements.forEach(function (layout, i) {
1509
+ var _a;
1510
+ _this.controls.push([]);
1511
+ _this.values.push([]);
1512
+ (_a = layout.elements) === null || _a === void 0 ? void 0 : _a.forEach(function (element) {
1513
+ if (!element.scope)
1514
+ console.log("CONFIGURAR BIEN " + element);
1515
+ _this.controls[i].push(_this.getControl(element.scope));
1516
+ _this.values[i].push(_this.getValue(element.scope));
1517
+ });
1518
+ });
1519
+ this.controlsLoaded = true;
1520
+ };
657
1521
  RegistroComponent.prototype.setLabelSumbit = function () {
658
1522
  if (this.trx == 'c')
659
1523
  this.btnSubmit = { label: 'Guardar', icon: 'pi pi-save' };
@@ -669,11 +1533,26 @@
669
1533
  var op = configRegistro.operations.find(function (x) { return x.type == 'read'; });
670
1534
  var endpoint = (op === null || op === void 0 ? void 0 : op.endpoint) || '';
671
1535
  endpoint = endpoint.replace('@idKatios', this.idKatios);
1536
+ endpoint = endpoint.replace('@ndocactivo', this.user.UsuarioSistema.NDOC);
672
1537
  endpoint = endpoint.replace('@id', this.id);
673
1538
  this.generalService.genericRequest((op === null || op === void 0 ? void 0 : op.method) || '', (op === null || op === void 0 ? void 0 : op.server) || '', endpoint)
674
1539
  .then(function (res) {
675
- _this.data = res.data;
1540
+ if (res === null || res === void 0 ? void 0 : res.data) {
1541
+ if (Array.isArray(res.data))
1542
+ _this.data = res.data[0];
1543
+ else
1544
+ _this.data = res.data;
1545
+ _this.trx = 'u';
1546
+ }
1547
+ else {
1548
+ _this.trx = 'c';
1549
+ _this.data = _this.createObject(_this.crudConfig.esquema);
1550
+ console.log(_this.data);
1551
+ }
1552
+ _this.buildControls();
676
1553
  _this.enProceso = false;
1554
+ _this.configOperation = _this.crudConfig.registro.operations.find(function (x) { return x.type.startsWith(_this.trx); }) || new Operations();
1555
+ _this.setLabelSumbit();
677
1556
  })
678
1557
  .catch(function (err) {
679
1558
  console.log(err);
@@ -689,10 +1568,24 @@
689
1568
  RegistroComponent.prototype.getValue = function (scope) {
690
1569
  return jsonpath__namespace.query(this.data, scope.replace('.properties', ''))[0];
691
1570
  };
692
- RegistroComponent.prototype.setValue = function (value, scope) {
693
- jsonpath__namespace.value(this.data, scope.replace('.properties', ''), value);
1571
+ RegistroComponent.prototype.setValue = function (value, scope, i, j) {
1572
+ var _this = this;
1573
+ switch (typeof (value)) {
1574
+ case 'object':
1575
+ if (Array.isArray(value))
1576
+ value.forEach(function (val) { return jsonpath__namespace.value(_this.data, val.scope.replace('.properties', ''), val.value); });
1577
+ else
1578
+ jsonpath__namespace.value(this.data, scope.replace('.properties', ''), value);
1579
+ break;
1580
+ default:
1581
+ this.values[i][j] = value;
1582
+ jsonpath__namespace.value(this.data, scope.replace('.properties', ''), value);
1583
+ break;
1584
+ }
1585
+ this.applyValuesOnEvent('onChange', this.crudConfig.esquema);
694
1586
  };
695
1587
  RegistroComponent.prototype.createObject = function (esquema) {
1588
+ var _this = this;
696
1589
  var object = {};
697
1590
  switch (esquema.type) {
698
1591
  case 'numeric':
@@ -704,38 +1597,83 @@
704
1597
  return (esquema === null || esquema === void 0 ? void 0 : esquema.default) || false;
705
1598
  case 'array':
706
1599
  return [];
1600
+ case 'file':
1601
+ return null;
707
1602
  case 'object':
708
- for (var key in esquema === null || esquema === void 0 ? void 0 : esquema.properties) {
709
- Object.defineProperty(object, key, { value: this.createObject(esquema === null || esquema === void 0 ? void 0 : esquema.properties[key]), writable: true, enumerable: true, configurable: true });
710
- }
711
- break;
1603
+ Object.getOwnPropertyNames(esquema === null || esquema === void 0 ? void 0 : esquema.properties).forEach(function (key) {
1604
+ var aux = esquema === null || esquema === void 0 ? void 0 : esquema.properties[key];
1605
+ if (aux)
1606
+ object[key] = _this.createObject(aux);
1607
+ });
1608
+ return object;
712
1609
  default:
713
- break;
1610
+ return null;
714
1611
  }
715
- return object;
716
1612
  };
717
1613
  RegistroComponent.prototype.submit = function () {
718
1614
  var _this = this;
1615
+ console.log(this.data);
719
1616
  if (!this.validateData())
720
1617
  return;
1618
+ this.applyValuesOnEvent('onSubmit', this.crudConfig.esquema);
721
1619
  this.enProceso = true;
722
1620
  var endpoint = this.configOperation.endpoint;
723
1621
  endpoint = endpoint.replace('@idKatios', this.idKatios);
724
1622
  endpoint = endpoint.replace('@id', this.id);
725
1623
  this.generalService.genericRequest(this.configOperation.method, this.configOperation.server, endpoint, this.data)
726
- .then(function () {
727
- _this.messageSerice.add({ severity: 'success', detail: "Proceso exitoso!" });
1624
+ .then(function (res) {
1625
+ _this.generateMessage({ severity: 'success', detail: "Proceso exitoso!" }, res, _this.configOperation.answerChecking);
1626
+ _this.enProceso = false;
728
1627
  setTimeout(function () {
729
- _this.enProceso = false;
730
- _this.back();
1628
+ var _a, _b;
1629
+ if ((_a = _this.configOperation) === null || _a === void 0 ? void 0 : _a.redirect)
1630
+ _this.router.navigate([(_b = _this.configOperation) === null || _b === void 0 ? void 0 : _b.redirect]);
1631
+ else
1632
+ _this.onSubmit.emit(_this.data);
731
1633
  }, 2000);
732
1634
  })
733
1635
  .catch(function (err) {
734
- var _a;
735
- _this.messageSerice.add({ severity: 'warn', detail: "" + (((_a = err === null || err === void 0 ? void 0 : err.error) === null || _a === void 0 ? void 0 : _a.message) || 'Error no controlado, por favor comunicarse con del admin.') });
1636
+ var operation = _this.crudConfig.registro.operations.find(function (op) { return op.type.startsWith(_this.trx); });
1637
+ _this.generateMessage({ severity: "error", detail: "Por favor comunicarse con el admin", summary: "Error no controlado" }, err.error, operation.errorChecking);
736
1638
  _this.enProceso = false;
737
1639
  });
738
1640
  };
1641
+ /**
1642
+ * Generates message using answerchecking
1643
+ * @param currentMsg Default message: Message
1644
+ * @param rta Resquest's response
1645
+ * @param answerChecking
1646
+ */
1647
+ RegistroComponent.prototype.generateMessage = function (currentMsg, rta, requestChecking) {
1648
+ if (requestChecking) {
1649
+ if (requestChecking.statics)
1650
+ Object.assign(currentMsg, requestChecking.statics);
1651
+ //mapear los dinamicos
1652
+ if (requestChecking.dynamics) {
1653
+ var dynamics = requestChecking.dynamics;
1654
+ try {
1655
+ if (dynamics && typeof (rta) == "string")
1656
+ rta = JSON.parse(rta);
1657
+ if (dynamics) {
1658
+ for (var property in dynamics) {
1659
+ currentMsg[property] = jsonpath__namespace.query(rta, dynamics[property])[0];
1660
+ }
1661
+ }
1662
+ }
1663
+ catch (error) { //es una respuesta sin JSON
1664
+ if (dynamics)
1665
+ currentMsg.detail = rta;
1666
+ }
1667
+ }
1668
+ }
1669
+ if ((requestChecking === null || requestChecking === void 0 ? void 0 : requestChecking.redirect) || (requestChecking === null || requestChecking === void 0 ? void 0 : requestChecking.swal))
1670
+ Swal__default["default"].fire(currentMsg.summary, currentMsg.detail, currentMsg.severity).then(function (res) {
1671
+ if (res.isConfirmed && requestChecking.redirect)
1672
+ window.location.href = requestChecking.redirect;
1673
+ });
1674
+ else
1675
+ this.messageSerice.add(currentMsg);
1676
+ };
739
1677
  RegistroComponent.prototype.validateData = function () {
740
1678
  if (this.configOperation.validations.type == 'local')
741
1679
  return this.validateDataLocal();
@@ -743,11 +1681,24 @@
743
1681
  };
744
1682
  RegistroComponent.prototype.validateDataLocal = function () {
745
1683
  var _this = this;
1684
+ var _a, _b, _c, _d;
746
1685
  var err = [];
747
- this.configOperation.validations.required.forEach(function (x) {
1686
+ (_b = (_a = this.configOperation.validations) === null || _a === void 0 ? void 0 : _a.required) === null || _b === void 0 ? void 0 : _b.forEach(function (x) {
748
1687
  if (!jsonpath__namespace.query(_this.data, x.field)[0])
749
1688
  err.push(x.message);
750
1689
  });
1690
+ (_d = (_c = this.configOperation.validations) === null || _c === void 0 ? void 0 : _c.operations) === null || _d === void 0 ? void 0 : _d.forEach(function (op) {
1691
+ switch (op.action) {
1692
+ case 'sumArray':
1693
+ var var1 = jsonpath__namespace.query(_this.data, op.scope[0]).reduce(function (acc, cur) { return acc += cur[op.key]; }, 0);
1694
+ var var2 = jsonpath__namespace.query(_this.data, op.scope[1]).reduce(function (acc, cur) { return acc += cur[op.key]; }, 0);
1695
+ if (var1 != var2)
1696
+ err.push(op.message);
1697
+ break;
1698
+ default:
1699
+ break;
1700
+ }
1701
+ });
751
1702
  if (err.length != 0)
752
1703
  this.messageSerice.add({ severity: 'warn', detail: err.join('. ') });
753
1704
  return err.length == 0;
@@ -756,11 +1707,13 @@
756
1707
  var data = null;
757
1708
  switch (value) {
758
1709
  case '@uactivo':
759
- var uactivo = JSON.parse(localStorage.getItem('oSessionTFM') || '{}');
760
- if (!uactivo)
761
- console.log('Validar configuracion de sesion');
762
- else
763
- data = uactivo.UsuarioSistema.TDOC + "-" + uactivo.UsuarioSistema.NDOC;
1710
+ data = this.user.UsuarioSistema.TDOC + "-" + this.user.UsuarioSistema.NDOC;
1711
+ break;
1712
+ case '@tdocactivo':
1713
+ data = this.user.UsuarioSistema.TDOC;
1714
+ break;
1715
+ case '@ndocactivo':
1716
+ data = this.user.UsuarioSistema.NDOC;
764
1717
  break;
765
1718
  case '@hoy':
766
1719
  data = new Date();
@@ -771,18 +1724,159 @@
771
1724
  }
772
1725
  return data;
773
1726
  };
1727
+ RegistroComponent.prototype.sendNotification = function (message) {
1728
+ this.messageSerice.add(message);
1729
+ };
1730
+ RegistroComponent.prototype.addObjectArray = function (element) {
1731
+ var _this = this;
1732
+ this.dialogRef = this.dialogService.open(RegistroChildComponent, {
1733
+ header: element.label ? element.label : 'Detalle',
1734
+ width: '70%',
1735
+ modal: true,
1736
+ closable: false,
1737
+ data: {
1738
+ uiEsquema: Object.assign({}, element.elements),
1739
+ esquema: this.getControl(element.scope),
1740
+ id: this.getValue(element.scope).length + 1
1741
+ }
1742
+ });
1743
+ this.dialogRef.onClose.subscribe(function (data) {
1744
+ if (data)
1745
+ _this.data[element.scope.replace('$..properties.', '')].push(data);
1746
+ _this.applyValuesOnEvent('onChange', _this.crudConfig.esquema, element.scope.replace('$..properties.', ''));
1747
+ });
1748
+ };
1749
+ RegistroComponent.prototype.editRow = function (element, data, index) {
1750
+ var _this = this;
1751
+ this.dialogRef = this.dialogService.open(RegistroChildComponent, {
1752
+ header: element.label ? element.label : 'Detalle',
1753
+ width: '70%',
1754
+ modal: true,
1755
+ closable: false,
1756
+ data: {
1757
+ uiEsquema: Object.assign({}, element.elements),
1758
+ esquema: this.getControl(element.scope),
1759
+ data: Object.assign({}, data)
1760
+ }
1761
+ });
1762
+ this.dialogRef.onClose.subscribe(function (data) {
1763
+ if (data)
1764
+ _this.data[element.scope.replace('$..properties.', '')][index] = data;
1765
+ _this.applyValuesOnEvent('onChange', _this.crudConfig.esquema, element.scope.replace('$..properties.', ''));
1766
+ });
1767
+ };
1768
+ RegistroComponent.prototype.deleteRow = function (element, index) {
1769
+ this.data[element.scope.replace('$..properties.', '')].splice(index, 1);
1770
+ index = 1;
1771
+ this.data[element.scope.replace('$..properties.', '')].forEach(function (el) {
1772
+ el.id = index;
1773
+ index++;
1774
+ });
1775
+ this.applyValuesOnEvent('onChange', this.crudConfig.esquema, element.scope.replace('$..properties.', ''));
1776
+ };
1777
+ RegistroComponent.prototype.applyValuesOnEvent = function (event, esquema, key) {
1778
+ var _this = this;
1779
+ if (key) {
1780
+ if (esquema.properties[key][event]) {
1781
+ esquema.properties[key][event].forEach(function (value) {
1782
+ _this.setValueEvent(_this.data, value);
1783
+ });
1784
+ }
1785
+ }
1786
+ else {
1787
+ for (var key_1 in esquema.properties) {
1788
+ if (esquema.properties[key_1][event]) {
1789
+ esquema.properties[key_1][event].forEach(function (value) {
1790
+ _this.setValueEvent(_this.data, value);
1791
+ });
1792
+ }
1793
+ }
1794
+ }
1795
+ };
1796
+ RegistroComponent.prototype.setValueEvent = function (data, params) {
1797
+ var _a;
1798
+ var date = moment__namespace(new Date());
1799
+ switch (params.op) {
1800
+ case 'sum':
1801
+ jsonpath__namespace.value(data, params.scope[1], jsonpath__namespace.query(data, params.scope[0]).reduce(function (acc, cur) { return acc += (params === null || params === void 0 ? void 0 : params.key) ? cur[params.key] : cur; }, 0));
1802
+ break;
1803
+ case 'concat':
1804
+ var array_1 = [];
1805
+ (_a = params === null || params === void 0 ? void 0 : params.key) === null || _a === void 0 ? void 0 : _a.reduce(function (acc, cur) {
1806
+ array_1.push(jsonpath__namespace.query(data, cur)[0]);
1807
+ }, []);
1808
+ if (params === null || params === void 0 ? void 0 : params.separator)
1809
+ jsonpath__namespace.value(data, params.scope[0], array_1.join((params === null || params === void 0 ? void 0 : params.separator) || ' '));
1810
+ break;
1811
+ case 'enable':
1812
+ jsonpath__namespace.value(this.crudConfig.esquema, params.scope[0], false);
1813
+ break;
1814
+ case 'disabled':
1815
+ jsonpath__namespace.value(this.crudConfig.esquema, params.scope[0], true);
1816
+ break;
1817
+ case 'replace:endpoint':
1818
+ jsonpath__namespace.value(this.crudConfig.esquema, params.scope[0], this.crudConfig.esquema.config.endpointtemp.replace(params.scope[1], jsonpath__namespace.query(data, "$.." + params.key)));
1819
+ break;
1820
+ case 'setNull':
1821
+ jsonpath__namespace.value(this.data, "$." + params.key, null);
1822
+ break;
1823
+ case 'datediff:years':
1824
+ jsonpath__namespace.value(this.data, params.scope[0], date.diff(moment__namespace(jsonpath__namespace.query(this.data, params.scope[1])[0]), 'years'));
1825
+ break;
1826
+ case 'datediff:months':
1827
+ jsonpath__namespace.value(this.data, params.scope[0], date.diff(moment__namespace(jsonpath__namespace.query(this.data, params.scope[1])[0]), 'months'));
1828
+ break;
1829
+ case 'datediff:weeks':
1830
+ jsonpath__namespace.value(this.data, params.scope[0], date.diff(moment__namespace(jsonpath__namespace.query(this.data, params.scope[1])[0]), 'weeks'));
1831
+ break;
1832
+ case 'datediff:days':
1833
+ jsonpath__namespace.value(this.data, params.scope[0], date.diff(moment__namespace(jsonpath__namespace.query(this.data, params.scope[1])[0]), 'days'));
1834
+ break;
1835
+ default:
1836
+ break;
1837
+ }
1838
+ };
1839
+ RegistroComponent.prototype.setDataTemp = function (esquema, dataTemp) {
1840
+ dataTemp.forEach(function (data) {
1841
+ jsonpath__namespace.value(esquema, data.scope, data.value);
1842
+ });
1843
+ };
1844
+ RegistroComponent.prototype.applyValuesFromObject = function (event) {
1845
+ var _this = this;
1846
+ if (event.data)
1847
+ event.optionValue.forEach(function (value) { return jsonpath__namespace.value(_this.data, value.scope.replace('.properties', ''), _this.aplyFormatValue(value.scope, event.data[value.key])); });
1848
+ else
1849
+ event.optionValue.forEach(function (value) { return jsonpath__namespace.value(_this.data, value.scope.replace('.properties', ''), null); });
1850
+ };
1851
+ RegistroComponent.prototype.aplyFormatValue = function (scope, value) {
1852
+ var control = jsonpath__namespace.query(this.crudConfig.esquema, scope)[0];
1853
+ var resp;
1854
+ switch (control.type) {
1855
+ case 'date':
1856
+ resp = new Date("" + value);
1857
+ break;
1858
+ case 'numeric':
1859
+ resp = +value;
1860
+ break;
1861
+ default:
1862
+ resp = value;
1863
+ break;
1864
+ }
1865
+ return resp;
1866
+ };
774
1867
  return RegistroComponent;
775
1868
  }());
776
- RegistroComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RegistroComponent, deps: [{ token: GeneralService }, { token: i2__namespace.Router }, { token: i3__namespace$1.MessageService }], target: i0__namespace.ɵɵFactoryTarget.Component });
777
- RegistroComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: RegistroComponent, selector: "sf-registro", inputs: { idKatios: "idKatios", idEntidad: "idEntidad", trx: "trx", id: "id" }, providers: [i3$1.MessageService], ngImport: i0__namespace, 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__namespace.BlockUI, selector: "p-blockUI", inputs: ["autoZIndex", "baseZIndex", "blocked", "target", "styleClass"] }, { type: i5__namespace$2.Toast, selector: "p-toast", inputs: ["autoZIndex", "baseZIndex", "position", "preventOpenDuplicates", "preventDuplicates", "showTransformOptions", "hideTransformOptions", "showTransitionOptions", "hideTransitionOptions", "key", "style", "styleClass", "breakpoints"], outputs: ["onClose"] }, { type: ControlComponent, selector: "sf-control", inputs: ["control", "label", "value"], outputs: ["setValue"] }], directives: [{ type: i6__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i8__namespace.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { type: i9__namespace.Ripple, selector: "[pRipple]" }, { type: i6__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i6__namespace.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i6__namespace.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }] });
1869
+ RegistroComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RegistroComponent, deps: [{ token: GeneralService }, { token: i2__namespace.Router }, { token: i2__namespace$1.MessageService }, { token: i1__namespace$1.DialogService }, { token: SfCrudService }], target: i0__namespace.ɵɵFactoryTarget.Component });
1870
+ RegistroComponent.ɵcmp = i0__namespace.ɵɵ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: [i2$1.MessageService, i1$1.DialogService, i1$1.DynamicDialogConfig, i1$1.DynamicDialogRef], ngImport: i0__namespace, template: "<p-blockUI [blocked]=\"enProceso\">\r\n <i class=\"pi pi-cog pi-spin\" style=\"font-size: 50px\"></i>\r\n</p-blockUI>\r\n\r\n<p-toast></p-toast>\r\n\r\n<div class=\"card\" *ngIf=\"!enProceso && controlsLoaded\">\r\n <h5 class=\"card-header mb-2\" style=\"display: flex; justify-content: space-between;align-items: center;\">\r\n <span>{{crudConfig.registro?.label || idEntidad}} {{id != '' ? '-' + id : ''}}</span>\r\n <button *ngIf=\"crudConfig.registro?.canBack\" pButton pRipple type=\"button\" icon=\"pi pi-arrow-left\" (click)=\"back()\"></button>\r\n </h5>\r\n <div *ngFor=\"let element of crudConfig.uiEsquema.elements; let i = index\" [class]=\"element?.class\">\r\n <ng-container [ngSwitch]=\"element.type\">\r\n <div *ngSwitchCase=\"'Label'\" [style]=\"element?.style\">\r\n {{element?.label}}\r\n </div>\r\n <ng-container *ngSwitchCase=\"'HorizontalLayout'\">\r\n <div *ngFor=\"let el of element.elements;let j = index\" [class]=\"el?.class\">\r\n <ng-container [ngSwitch]=\"el.type\">\r\n <sf-control *ngSwitchCase=\"'Control'\" [control]=\"controls[i][j]\" [label]=\"el.label\"\r\n [value]=\"values[i][j]\" (setValue)=\"setValue($event, el.scope, i, j)\"\r\n (sendNotification)=\"sendNotification($event)\" (sendObject)=\"applyValuesFromObject($event)\"></sf-control>\r\n </ng-container>\r\n </div>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'VerticalLayout'\">\r\n <div *ngFor=\"let el of element.elements;let j = index\" [class]=\"el?.class\">\r\n <ng-container [ngSwitch]=\"el.type\">\r\n <sf-control *ngSwitchCase=\"'Control'\" [control]=\"controls[i][j]\" [label]=\"el.label\"\r\n [value]=\"values[i][j]\" (setValue)=\"setValue($event, el.scope, i, j)\"\r\n (sendNotification)=\"sendNotification($event)\" (sendObject)=\"applyValuesFromObject($event)\"></sf-control>\r\n <ng-container *ngSwitchCase=\"'Table'\">\r\n <p-table [value]=\"getValue(el.scope)\" [columns]=\"getControl(el.scope).config.columns\">\r\n <ng-template pTemplate=\"caption\">\r\n <div class=\"flex align-items-center justify-content-between\">\r\n <button pButton pRipple icon=\"pi pi-plus\" (click)=\"addObjectArray(el)\"\r\n class=\"p-button-success\"></button>\r\n </div>\r\n </ng-template>\r\n <ng-template pTemplate=\"header\" let-columns>\r\n <tr>\r\n <th *ngFor=\"let col of columns\">\r\n {{col.label}}\r\n </th>\r\n <ng-container *ngIf=\"trx == 'c' || trx == 'u'\">\r\n <th></th>\r\n </ng-container>\r\n </tr>\r\n </ng-template>\r\n <ng-template pTemplate=\"body\" let-rowData let-columns=\"columns\" let-rowIndex=\"rowIndex\">\r\n <tr>\r\n <ng-container *ngFor=\"let col of columns\" [ngSwitch]=\"col.type\">\r\n <ng-container *ngSwitchCase=\"'text'\">\r\n <td>{{rowData[col.col]}}</td>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'currency:USD'\">\r\n <td>{{rowData[col.col] | currency: 'USD'}}</td>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'date:yyyy-mm-dd'\">\r\n <td>{{rowData[col.col] | date: 'yyyy-mm-dd'}}</td>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'date:dd/mm/yyyy'\">\r\n <td>{{rowData[col.col] | date: 'dd/MM/yyyy'}}</td>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'boolean'\">\r\n <td>\r\n <i *ngIf=\"rowData[col.col]\" class=\"pi pi-check\"></i>\r\n <i *ngIf=\"!rowData[col.col]\" class=\"pi pi-times\"></i>\r\n </td>\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"trx == 'c' || trx == 'u'\">\r\n <td>\r\n <button pButton pRipple type=\"button\" (click)=\"editRow(el, rowData, rowIndex)\" icon=\"pi pi-pencil\" class=\"p-button-rounded p-button-info mr-1\"></button>\r\n <button pButton pRipple type=\"button\" (click)=\"deleteRow(el, rowIndex)\" icon=\"pi pi-trash\" class=\"p-button-rounded p-button-danger\"></button>\r\n </td>\r\n </ng-container>\r\n </tr>\r\n </ng-template>\r\n </p-table>\r\n </ng-container>\r\n </ng-container>\r\n </div>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'Control'\">\r\n <sf-control [control]=\"getControl(element.scope)\" [label]=\"element.label\"></sf-control>\r\n </ng-container>\r\n </ng-container>\r\n </div>\r\n <div class=\"card-footer mt-2\" *ngIf=\"btnSubmit\">\r\n <button pButton pRipple type=\"button\" [icon]=\"btnSubmit.icon\" [label]=\"btnSubmit.label\"\r\n (click)=\"submit()\"></button>\r\n </div>\r\n</div>\r\n", components: [{ type: i3__namespace.BlockUI, selector: "p-blockUI", inputs: ["target", "autoZIndex", "baseZIndex", "styleClass", "blocked"] }, { type: i3__namespace$2.Toast, selector: "p-toast", inputs: ["key", "autoZIndex", "baseZIndex", "style", "styleClass", "position", "preventOpenDuplicates", "preventDuplicates", "showTransformOptions", "hideTransformOptions", "showTransitionOptions", "hideTransitionOptions", "breakpoints"], outputs: ["onClose"] }, { type: ControlComponent, selector: "sf-control", inputs: ["control", "label", "value", "appendTo"], outputs: ["setValue", "sendNotification", "sendObject"] }, { type: i5__namespace.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__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i9__namespace.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { type: i10__namespace.Ripple, selector: "[pRipple]" }, { type: i7__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i7__namespace.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i7__namespace.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i2__namespace$1.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }], pipes: { "currency": i7__namespace.CurrencyPipe, "date": i7__namespace.DatePipe } });
778
1871
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RegistroComponent, decorators: [{
779
1872
  type: i0.Component,
780
1873
  args: [{
781
1874
  selector: 'sf-registro',
782
1875
  templateUrl: './registro.component.html',
783
- providers: [i3$1.MessageService]
1876
+ providers: [i2$1.MessageService, i1$1.DialogService, i1$1.DynamicDialogConfig, i1$1.DynamicDialogRef],
1877
+ entryComponents: [RegistroComponent]
784
1878
  }]
785
- }], ctorParameters: function () { return [{ type: GeneralService }, { type: i2__namespace.Router }, { type: i3__namespace$1.MessageService }]; }, propDecorators: { idKatios: [{
1879
+ }], ctorParameters: function () { return [{ type: GeneralService }, { type: i2__namespace.Router }, { type: i2__namespace$1.MessageService }, { type: i1__namespace$1.DialogService }, { type: SfCrudService }]; }, propDecorators: { idKatios: [{
786
1880
  type: i0.Input
787
1881
  }], idEntidad: [{
788
1882
  type: i0.Input
@@ -790,6 +1884,12 @@
790
1884
  type: i0.Input
791
1885
  }], id: [{
792
1886
  type: i0.Input
1887
+ }], user: [{
1888
+ type: i0.Input
1889
+ }], sendData: [{
1890
+ type: i0.Output
1891
+ }], onSubmit: [{
1892
+ type: i0.Output
793
1893
  }] } });
794
1894
 
795
1895
  var SfCrudComponent = /** @class */ (function () {
@@ -819,42 +1919,43 @@
819
1919
  SfCrudModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: SfCrudModule, declarations: [SfCrudComponent,
820
1920
  TableroComponent,
821
1921
  RegistroComponent,
822
- ControlComponent], imports: [accordion.AccordionModule,
823
- i3$2.AutoCompleteModule,
1922
+ ControlComponent,
1923
+ RegistroChildComponent,
1924
+ RegistroDetalleComponent], imports: [accordion.AccordionModule,
1925
+ i4$1.AutoCompleteModule,
824
1926
  avatargroup.AvatarGroupModule,
825
1927
  avatar.AvatarModule,
826
1928
  badge.BadgeModule,
827
1929
  i3.BlockUIModule,
828
1930
  breadcrumb.BreadcrumbModule,
829
- i8.ButtonModule,
830
- i4$1.CalendarModule,
1931
+ i9.ButtonModule,
1932
+ i5$1.CalendarModule,
831
1933
  card.CardModule,
832
1934
  carousel.CarouselModule,
833
1935
  cascadeselect.CascadeSelectModule,
834
1936
  checkbox.CheckboxModule,
835
1937
  chip.ChipModule,
836
1938
  chips.ChipsModule,
837
- codehighlighter.CodeHighlighterModule,
838
1939
  colorpicker.ColorPickerModule,
839
1940
  confirmdialog.ConfirmDialogModule,
840
1941
  confirmpopup.ConfirmPopupModule,
841
1942
  contextmenu.ContextMenuModule,
842
1943
  dialog.DialogModule,
843
1944
  divider.DividerModule,
844
- i2$1.DropdownModule,
1945
+ i3$1.DropdownModule,
1946
+ i1$1.DynamicDialogModule,
845
1947
  fieldset.FieldsetModule,
846
- fileupload.FileUploadModule,
847
- i7.FormsModule,
1948
+ i7$1.FileUploadModule,
1949
+ i10$1.FormsModule,
848
1950
  galleria.GalleriaModule,
849
1951
  i1.HttpClientModule,
850
1952
  inplace.InplaceModule,
851
- inputmask.InputMaskModule,
852
- i5$1.InputNumberModule,
853
- inputswitch.InputSwitchModule,
854
- inputtextarea.InputTextareaModule,
855
- i10.InputTextModule,
1953
+ i2$2.InputMaskModule,
1954
+ i6$1.InputNumberModule,
1955
+ i8.InputSwitchModule,
1956
+ i12.InputTextareaModule,
1957
+ i11.InputTextModule,
856
1958
  knob.KnobModule,
857
- lightbox.LightboxModule,
858
1959
  listbox.ListboxModule,
859
1960
  megamenu.MegaMenuModule,
860
1961
  menubar.MenubarModule,
@@ -870,7 +1971,7 @@
870
1971
  progressbar.ProgressBarModule,
871
1972
  radiobutton.RadioButtonModule,
872
1973
  rating.RatingModule,
873
- i9.RippleModule,
1974
+ i10.RippleModule,
874
1975
  scrollpanel.ScrollPanelModule,
875
1976
  scrolltop.ScrollTopModule,
876
1977
  selectbutton.SelectButtonModule,
@@ -878,6 +1979,7 @@
878
1979
  skeleton.SkeletonModule,
879
1980
  slidemenu.SlideMenuModule,
880
1981
  slider.SliderModule,
1982
+ i6.SplitButtonModule,
881
1983
  splitter.SplitterModule,
882
1984
  steps.StepsModule,
883
1985
  i5.TableModule,
@@ -887,50 +1989,50 @@
887
1989
  terminal.TerminalModule,
888
1990
  tieredmenu.TieredMenuModule,
889
1991
  timeline.TimelineModule,
890
- i5$2.ToastModule,
1992
+ i3$2.ToastModule,
891
1993
  togglebutton.ToggleButtonModule,
892
1994
  i4.ToolbarModule,
893
- i11.TooltipModule,
1995
+ tooltip.TooltipModule,
894
1996
  tree.TreeModule], exports: [SfCrudComponent,
895
1997
  TableroComponent,
896
- RegistroComponent] });
1998
+ RegistroComponent,
1999
+ ControlComponent] });
897
2000
  SfCrudModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: SfCrudModule, imports: [[
898
2001
  accordion.AccordionModule,
899
- i3$2.AutoCompleteModule,
2002
+ i4$1.AutoCompleteModule,
900
2003
  avatargroup.AvatarGroupModule,
901
2004
  avatar.AvatarModule,
902
2005
  badge.BadgeModule,
903
2006
  i3.BlockUIModule,
904
2007
  breadcrumb.BreadcrumbModule,
905
- i8.ButtonModule,
906
- i4$1.CalendarModule,
2008
+ i9.ButtonModule,
2009
+ i5$1.CalendarModule,
907
2010
  card.CardModule,
908
2011
  carousel.CarouselModule,
909
2012
  cascadeselect.CascadeSelectModule,
910
2013
  checkbox.CheckboxModule,
911
2014
  chip.ChipModule,
912
2015
  chips.ChipsModule,
913
- codehighlighter.CodeHighlighterModule,
914
2016
  colorpicker.ColorPickerModule,
915
2017
  confirmdialog.ConfirmDialogModule,
916
2018
  confirmpopup.ConfirmPopupModule,
917
2019
  contextmenu.ContextMenuModule,
918
2020
  dialog.DialogModule,
919
2021
  divider.DividerModule,
920
- i2$1.DropdownModule,
2022
+ i3$1.DropdownModule,
2023
+ i1$1.DynamicDialogModule,
921
2024
  fieldset.FieldsetModule,
922
- fileupload.FileUploadModule,
923
- i7.FormsModule,
2025
+ i7$1.FileUploadModule,
2026
+ i10$1.FormsModule,
924
2027
  galleria.GalleriaModule,
925
2028
  i1.HttpClientModule,
926
2029
  inplace.InplaceModule,
927
- inputmask.InputMaskModule,
928
- i5$1.InputNumberModule,
929
- inputswitch.InputSwitchModule,
930
- inputtextarea.InputTextareaModule,
931
- i10.InputTextModule,
2030
+ i2$2.InputMaskModule,
2031
+ i6$1.InputNumberModule,
2032
+ i8.InputSwitchModule,
2033
+ i12.InputTextareaModule,
2034
+ i11.InputTextModule,
932
2035
  knob.KnobModule,
933
- lightbox.LightboxModule,
934
2036
  listbox.ListboxModule,
935
2037
  megamenu.MegaMenuModule,
936
2038
  menubar.MenubarModule,
@@ -946,7 +2048,7 @@
946
2048
  progressbar.ProgressBarModule,
947
2049
  radiobutton.RadioButtonModule,
948
2050
  rating.RatingModule,
949
- i9.RippleModule,
2051
+ i10.RippleModule,
950
2052
  scrollpanel.ScrollPanelModule,
951
2053
  scrolltop.ScrollTopModule,
952
2054
  selectbutton.SelectButtonModule,
@@ -954,6 +2056,7 @@
954
2056
  skeleton.SkeletonModule,
955
2057
  slidemenu.SlideMenuModule,
956
2058
  slider.SliderModule,
2059
+ i6.SplitButtonModule,
957
2060
  splitter.SplitterModule,
958
2061
  steps.StepsModule,
959
2062
  i5.TableModule,
@@ -963,10 +2066,10 @@
963
2066
  terminal.TerminalModule,
964
2067
  tieredmenu.TieredMenuModule,
965
2068
  timeline.TimelineModule,
966
- i5$2.ToastModule,
2069
+ i3$2.ToastModule,
967
2070
  togglebutton.ToggleButtonModule,
968
2071
  i4.ToolbarModule,
969
- i11.TooltipModule,
2072
+ tooltip.TooltipModule,
970
2073
  tree.TreeModule,
971
2074
  ]] });
972
2075
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: SfCrudModule, decorators: [{
@@ -976,45 +2079,46 @@
976
2079
  SfCrudComponent,
977
2080
  TableroComponent,
978
2081
  RegistroComponent,
979
- ControlComponent
2082
+ ControlComponent,
2083
+ RegistroChildComponent,
2084
+ RegistroDetalleComponent
980
2085
  ],
981
2086
  imports: [
982
2087
  accordion.AccordionModule,
983
- i3$2.AutoCompleteModule,
2088
+ i4$1.AutoCompleteModule,
984
2089
  avatargroup.AvatarGroupModule,
985
2090
  avatar.AvatarModule,
986
2091
  badge.BadgeModule,
987
2092
  i3.BlockUIModule,
988
2093
  breadcrumb.BreadcrumbModule,
989
- i8.ButtonModule,
990
- i4$1.CalendarModule,
2094
+ i9.ButtonModule,
2095
+ i5$1.CalendarModule,
991
2096
  card.CardModule,
992
2097
  carousel.CarouselModule,
993
2098
  cascadeselect.CascadeSelectModule,
994
2099
  checkbox.CheckboxModule,
995
2100
  chip.ChipModule,
996
2101
  chips.ChipsModule,
997
- codehighlighter.CodeHighlighterModule,
998
2102
  colorpicker.ColorPickerModule,
999
2103
  confirmdialog.ConfirmDialogModule,
1000
2104
  confirmpopup.ConfirmPopupModule,
1001
2105
  contextmenu.ContextMenuModule,
1002
2106
  dialog.DialogModule,
1003
2107
  divider.DividerModule,
1004
- i2$1.DropdownModule,
2108
+ i3$1.DropdownModule,
2109
+ i1$1.DynamicDialogModule,
1005
2110
  fieldset.FieldsetModule,
1006
- fileupload.FileUploadModule,
1007
- i7.FormsModule,
2111
+ i7$1.FileUploadModule,
2112
+ i10$1.FormsModule,
1008
2113
  galleria.GalleriaModule,
1009
2114
  i1.HttpClientModule,
1010
2115
  inplace.InplaceModule,
1011
- inputmask.InputMaskModule,
1012
- i5$1.InputNumberModule,
1013
- inputswitch.InputSwitchModule,
1014
- inputtextarea.InputTextareaModule,
1015
- i10.InputTextModule,
2116
+ i2$2.InputMaskModule,
2117
+ i6$1.InputNumberModule,
2118
+ i8.InputSwitchModule,
2119
+ i12.InputTextareaModule,
2120
+ i11.InputTextModule,
1016
2121
  knob.KnobModule,
1017
- lightbox.LightboxModule,
1018
2122
  listbox.ListboxModule,
1019
2123
  megamenu.MegaMenuModule,
1020
2124
  menubar.MenubarModule,
@@ -1030,7 +2134,7 @@
1030
2134
  progressbar.ProgressBarModule,
1031
2135
  radiobutton.RadioButtonModule,
1032
2136
  rating.RatingModule,
1033
- i9.RippleModule,
2137
+ i10.RippleModule,
1034
2138
  scrollpanel.ScrollPanelModule,
1035
2139
  scrolltop.ScrollTopModule,
1036
2140
  selectbutton.SelectButtonModule,
@@ -1038,6 +2142,7 @@
1038
2142
  skeleton.SkeletonModule,
1039
2143
  slidemenu.SlideMenuModule,
1040
2144
  slider.SliderModule,
2145
+ i6.SplitButtonModule,
1041
2146
  splitter.SplitterModule,
1042
2147
  steps.StepsModule,
1043
2148
  i5.TableModule,
@@ -1047,34 +2152,24 @@
1047
2152
  terminal.TerminalModule,
1048
2153
  tieredmenu.TieredMenuModule,
1049
2154
  timeline.TimelineModule,
1050
- i5$2.ToastModule,
2155
+ i3$2.ToastModule,
1051
2156
  togglebutton.ToggleButtonModule,
1052
2157
  i4.ToolbarModule,
1053
- i11.TooltipModule,
2158
+ tooltip.TooltipModule,
1054
2159
  tree.TreeModule,
1055
2160
  ],
1056
2161
  exports: [
1057
2162
  SfCrudComponent,
1058
2163
  TableroComponent,
1059
- RegistroComponent
2164
+ RegistroComponent,
2165
+ ControlComponent
2166
+ ],
2167
+ entryComponents: [
2168
+ RegistroChildComponent
1060
2169
  ]
1061
2170
  }]
1062
2171
  }] });
1063
2172
 
1064
- var SfCrudService = /** @class */ (function () {
1065
- function SfCrudService() {
1066
- }
1067
- return SfCrudService;
1068
- }());
1069
- SfCrudService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: SfCrudService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1070
- SfCrudService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: SfCrudService, providedIn: 'root' });
1071
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: SfCrudService, decorators: [{
1072
- type: i0.Injectable,
1073
- args: [{
1074
- providedIn: 'root'
1075
- }]
1076
- }], ctorParameters: function () { return []; } });
1077
-
1078
2173
  /*
1079
2174
  * Public API Surface of sf-crud
1080
2175
  */
@@ -1083,6 +2178,7 @@
1083
2178
  * Generated bundle index. Do not edit.
1084
2179
  */
1085
2180
 
2181
+ exports.ControlComponent = ControlComponent;
1086
2182
  exports.RegistroComponent = RegistroComponent;
1087
2183
  exports.SfCrudComponent = SfCrudComponent;
1088
2184
  exports.SfCrudModule = SfCrudModule;