sf-crud 12.0.1-beta9 → 12.0.3

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 +1225 -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 +309 -43
  5. package/esm2015/lib/components/registro-child/registro-child.component.js +330 -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 +1078 -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 && !(this.value instanceof Date)) {
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\" [showEmptyMessage]=\"true\" [suggestions]=\"dataFromService\"\r\n (completeMethod)=\"loadDataFromControlBusquedaService($event)\" [field]=\"control.field\"\r\n [minLength]=\"1\" (onSelect)=\"sendValueFromObject()\"></p-autoComplete>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'date'\">\r\n <ng-container [ngSwitch]=\"control.subtype\">\r\n <ng-container *ngSwitchCase=\"'calendar'\">\r\n <p-calendar [(ngModel)]=\"value\" (onSelect)=\"sendValue()\"\r\n [format]=\"control?.format || 'yy-mm-dd'\"></p-calendar>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'numeric'\">\r\n <ng-container [ngSwitch]=\"control.subtype\">\r\n <ng-container *ngSwitchCase=\"'currency'\">\r\n <p-inputNumber [(ngModel)]=\"value\" mode=\"currency\" [minFractionDigits]=\"control?.minFractionDigits || 0\"\r\n (onChange)=\"sendValue()\" [currency]=\"control?.currency || 'USD'\"></p-inputNumber>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'decimal'\">\r\n <p-inputNumber [(ngModel)]=\"value\" mode=\"decimal\" (onChange)=\"sendValue()\"\r\n [minFractionDigits]=\"control?.minFractionDigits || 0\"></p-inputNumber>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'percentage'\">\r\n <p-inputNumber [(ngModel)]=\"value\" suffix=\" %\" (onChange)=\"sendValue()\"\r\n [minFractionDigits]=\"control?.minFractionDigits || 2\"></p-inputNumber>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n</ng-container>", components: [{ type: i2__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,654 @@
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
+ this.values[i][j] = value;
1163
+ jsonpath__namespace.value(this.data, scope.replace('.properties', ''), value);
1164
+ }
1165
+ break;
1166
+ default:
1167
+ this.values[i][j] = value;
1168
+ jsonpath__namespace.value(this.data, scope.replace('.properties', ''), value);
1169
+ break;
1170
+ }
1171
+ this.applyValuesOnEvent('onChange', this.esquema, scope.replace('$..properties.', ''));
1172
+ };
1173
+ RegistroChildComponent.prototype.createObject = function (esquema) {
1174
+ var object = {};
1175
+ var resultArray = [];
1176
+ switch (esquema.type) {
1177
+ case 'numeric':
1178
+ return (esquema === null || esquema === void 0 ? void 0 : esquema.default) || 0;
1179
+ case 'string':
1180
+ case 'date':
1181
+ return (esquema === null || esquema === void 0 ? void 0 : esquema.default) ? this.setDefaultValue(esquema.default) : null;
1182
+ case 'boolean':
1183
+ return (esquema === null || esquema === void 0 ? void 0 : esquema.default) || false;
1184
+ case 'file':
1185
+ return null;
1186
+ case 'array':
1187
+ case 'object':
1188
+ for (var key in esquema === null || esquema === void 0 ? void 0 : esquema.properties) {
1189
+ Object.defineProperty(object, key, { value: this.createObjectChild(esquema === null || esquema === void 0 ? void 0 : esquema.properties[key]), writable: true, enumerable: true, configurable: true });
1190
+ }
1191
+ break;
1192
+ default:
1193
+ break;
1194
+ }
1195
+ return object;
1196
+ };
1197
+ RegistroChildComponent.prototype.createObjectChild = function (esquema) {
1198
+ var object = {};
1199
+ var resultArray = [];
1200
+ switch (esquema.type) {
1201
+ case 'numeric':
1202
+ return (esquema === null || esquema === void 0 ? void 0 : esquema.default) || 0;
1203
+ case 'string':
1204
+ case 'date':
1205
+ return (esquema === null || esquema === void 0 ? void 0 : esquema.default) ? this.setDefaultValue(esquema.default) : null;
1206
+ case 'boolean':
1207
+ return (esquema === null || esquema === void 0 ? void 0 : esquema.default) || false;
1208
+ case 'file':
1209
+ return null;
1210
+ case 'array':
1211
+ return [];
1212
+ case 'object':
1213
+ for (var key in esquema === null || esquema === void 0 ? void 0 : esquema.properties) {
1214
+ Object.defineProperty(object, key, { value: this.createObject(esquema === null || esquema === void 0 ? void 0 : esquema.properties[key]), writable: true, enumerable: true, configurable: true });
1215
+ }
1216
+ break;
1217
+ default:
1218
+ break;
1219
+ }
1220
+ return object;
1221
+ };
1222
+ RegistroChildComponent.prototype.setDefaultValue = function (value) {
1223
+ var data = null;
1224
+ var uactivo;
1225
+ switch (value) {
1226
+ case '@uactivo':
1227
+ uactivo = JSON.parse(localStorage.getItem('oSessionTFM') || '{}');
1228
+ if (!uactivo)
1229
+ console.log('Validar configuracion de sesion');
1230
+ else
1231
+ data = uactivo.UsuarioSistema.TDOC + "-" + uactivo.UsuarioSistema.NDOC;
1232
+ break;
1233
+ case '@tdocactivo':
1234
+ uactivo = JSON.parse(sessionStorage.getItem('usrSesion') || '{}');
1235
+ if (!uactivo)
1236
+ console.log('Validar configuracion de sesion');
1237
+ else
1238
+ data = uactivo.UsuarioSistema.TDOC;
1239
+ break;
1240
+ case '@ndocactivo':
1241
+ uactivo = JSON.parse(sessionStorage.getItem('usrSesion') || '{}');
1242
+ if (!uactivo)
1243
+ console.log('Validar configuracion de sesion');
1244
+ else
1245
+ data = uactivo.UsuarioSistema.NDOC;
1246
+ break;
1247
+ case '@hoy':
1248
+ data = new Date();
1249
+ break;
1250
+ default:
1251
+ data = value;
1252
+ break;
1253
+ }
1254
+ return data;
1255
+ };
1256
+ RegistroChildComponent.prototype.submit = function () {
1257
+ this.applyValuesOnEvent('onSubmit', this.esquema);
1258
+ if (!this.validateData())
1259
+ return;
1260
+ this.ref.close(this.data);
1261
+ };
1262
+ RegistroChildComponent.prototype.cancel = function () {
1263
+ this.applyValuesOnEvent('onCancel', this.esquema);
1264
+ this.ref.close();
1265
+ };
1266
+ RegistroChildComponent.prototype.validateData = function () {
1267
+ if (this.esquema.validations.type == 'local')
1268
+ return this.validateDataLocal();
1269
+ return true;
1270
+ };
1271
+ RegistroChildComponent.prototype.validateDataLocal = function () {
1272
+ var _this = this;
1273
+ var err = [];
1274
+ this.esquema.validations.required.forEach(function (x) {
1275
+ if (!jsonpath__namespace.query(_this.data, x.field)[0])
1276
+ err.push(x.message);
1277
+ });
1278
+ if (err.length != 0)
1279
+ this.messageService.add({ severity: 'warn', detail: err.join('. ') });
1280
+ return err.length == 0;
1281
+ };
1282
+ RegistroChildComponent.prototype.applyValuesOnEvent = function (event, esquema, scope) {
1283
+ var _this = this;
1284
+ if (scope) {
1285
+ if (esquema.properties[scope][event]) {
1286
+ esquema.properties[scope][event].forEach(function (value) {
1287
+ _this.setValueEvent(_this.data, value);
1288
+ });
1289
+ }
1290
+ }
1291
+ else {
1292
+ for (var key in esquema.properties) {
1293
+ if (esquema.properties[key][event]) {
1294
+ esquema.properties[key][event].forEach(function (value) {
1295
+ _this.setValueEvent(_this.data, value);
1296
+ });
1297
+ }
1298
+ }
1299
+ }
1300
+ };
1301
+ RegistroChildComponent.prototype.setValueEvent = function (data, params) {
1302
+ var _a;
1303
+ var value;
1304
+ var date = moment__namespace(new Date());
1305
+ switch (params.op) {
1306
+ case 'sum':
1307
+ 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);
1308
+ break;
1309
+ case 'concat':
1310
+ var array_1 = [];
1311
+ (_a = params === null || params === void 0 ? void 0 : params.key) === null || _a === void 0 ? void 0 : _a.reduce(function (acc, cur) {
1312
+ array_1.push(jsonpath__namespace.query(data, cur)[0]);
1313
+ }, []);
1314
+ if (params === null || params === void 0 ? void 0 : params.separator)
1315
+ jsonpath__namespace.value(data, params.scope[0], array_1.join((params === null || params === void 0 ? void 0 : params.separator) || ' '));
1316
+ break;
1317
+ case 'enable':
1318
+ jsonpath__namespace.value(this.esquema, params.scope[0], false);
1319
+ break;
1320
+ case 'disabled':
1321
+ jsonpath__namespace.value(this.esquema, params.scope[0], true);
1322
+ break;
1323
+ case 'replace:endpoint':
1324
+ 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)));
1325
+ break;
1326
+ case 'setNull':
1327
+ jsonpath__namespace.value(this.data, "$." + params.key, null);
1328
+ break;
1329
+ case 'datediff:years':
1330
+ jsonpath__namespace.value(this.data, params.scope[0], date.diff(moment__namespace(jsonpath__namespace.query(this.data, params.scope[1])[0]), 'years'));
1331
+ break;
1332
+ case 'datediff:months':
1333
+ jsonpath__namespace.value(this.data, params.scope[0], date.diff(moment__namespace(jsonpath__namespace.query(this.data, params.scope[1])[0]), 'months'));
1334
+ break;
1335
+ case 'datediff:weeks':
1336
+ jsonpath__namespace.value(this.data, params.scope[0], date.diff(moment__namespace(jsonpath__namespace.query(this.data, params.scope[1])[0]), 'weeks'));
1337
+ break;
1338
+ case 'datediff:days':
1339
+ jsonpath__namespace.value(this.data, params.scope[0], date.diff(moment__namespace(jsonpath__namespace.query(this.data, params.scope[1])[0]), 'days'));
1340
+ break;
1341
+ default:
1342
+ break;
1343
+ }
1344
+ return value;
1345
+ };
1346
+ RegistroChildComponent.prototype.sendNotification = function (message) {
1347
+ this.messageService.add(message);
1348
+ };
1349
+ RegistroChildComponent.prototype.addObjectArray = function (element) {
1350
+ var _this = this;
1351
+ this.dialogRef = this.dialogService.open(RegistroDetalleComponent, {
1352
+ header: element.label ? element.label : 'Detalle',
1353
+ width: '70%',
1354
+ modal: true,
1355
+ closable: false,
1356
+ data: {
1357
+ uiEsquema: Object.assign({}, element.elements),
1358
+ esquema: this.getControl(element.scope),
1359
+ id: this.getValue(element.scope).length + 1
1360
+ }
1361
+ });
1362
+ this.dialogRef.onClose.subscribe(function (data) {
1363
+ if (data)
1364
+ _this.data[element.scope.replace('$..properties.', '')].push(data);
1365
+ _this.applyValuesOnEvent('onChange', _this.esquema, element.scope.replace('$..properties.', ''));
1366
+ });
1367
+ };
1368
+ RegistroChildComponent.prototype.editRow = function (element, data, index) {
1369
+ var _this = this;
1370
+ this.dialogRef = this.dialogService.open(RegistroDetalleComponent, {
1371
+ header: element.label ? element.label : 'Detalle',
1372
+ width: '70%',
1373
+ modal: true,
1374
+ closable: false,
1375
+ data: {
1376
+ uiEsquema: Object.assign({}, element.elements),
1377
+ esquema: this.getControl(element.scope),
1378
+ data: Object.assign({}, data)
1379
+ }
1380
+ });
1381
+ this.dialogRef.onClose.subscribe(function (data) {
1382
+ if (data)
1383
+ _this.data[element.scope.replace('$..properties.', '')][index] = data;
1384
+ _this.applyValuesOnEvent('onChange', _this.esquema, element.scope.replace('$..properties.', ''));
1385
+ });
1386
+ };
1387
+ RegistroChildComponent.prototype.deleteRow = function (element, index) {
1388
+ this.data[element.scope.replace('$..properties.', '')].splice(index, 1);
1389
+ index = 1;
1390
+ this.data[element.scope.replace('$..properties.', '')].forEach(function (el) {
1391
+ el.id = index;
1392
+ index++;
1393
+ });
1394
+ this.applyValuesOnEvent('onChange', this.esquema, element.scope.replace('$..properties.', ''));
1395
+ };
1396
+ RegistroChildComponent.prototype.applyValuesFromObject = function (event) {
1397
+ var _this = this;
1398
+ if (event.data)
1399
+ event.optionValue.forEach(function (value) { return jsonpath__namespace.value(_this.data, value.scope.replace('.properties', ''), _this.aplyFormatValue(value.scope, event.data[value.key])); });
1400
+ else
1401
+ event.optionValue.forEach(function (value) { return jsonpath__namespace.value(_this.data, value.scope.replace('.properties', ''), null); });
1402
+ };
1403
+ RegistroChildComponent.prototype.aplyFormatValue = function (scope, value) {
1404
+ var control = jsonpath__namespace.query(this.esquema, scope)[0];
1405
+ var resp;
1406
+ switch (control.type) {
1407
+ case 'date':
1408
+ resp = new Date("" + value);
1409
+ break;
1410
+ case 'numeric':
1411
+ resp = +value;
1412
+ break;
1413
+ default:
1414
+ resp = value;
1415
+ break;
1416
+ }
1417
+ return resp;
1418
+ };
1419
+ return RegistroChildComponent;
1420
+ }());
1421
+ 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 });
1422
+ 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 } });
1423
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RegistroChildComponent, decorators: [{
1424
+ type: i0.Component,
1425
+ args: [{
1426
+ selector: 'lib-registro-child',
1427
+ templateUrl: './registro-child.component.html',
1428
+ providers: [i2$1.MessageService, i1$1.DialogService]
1429
+ }]
1430
+ }], ctorParameters: function () { return [{ type: i1__namespace$1.DynamicDialogRef }, { type: i1__namespace$1.DynamicDialogConfig }, { type: i2__namespace$1.MessageService }, { type: i1__namespace$1.DialogService }]; } });
1431
+
1432
+ var SfCrudService = /** @class */ (function () {
1433
+ function SfCrudService() {
1434
+ this._dataTemp = [];
1435
+ }
1436
+ SfCrudService.prototype.saveDataTemp = function (scope, value) {
1437
+ this._dataTemp.push({ scope: scope, value: value });
1438
+ sessionStorage.setItem('dataTemp', JSON.stringify(this._dataTemp));
1439
+ };
1440
+ SfCrudService.prototype.getDataTemp = function () {
1441
+ var dataTemp = sessionStorage.getItem('dataTemp');
1442
+ sessionStorage.removeItem('dataTemp');
1443
+ return dataTemp ? JSON.parse(dataTemp) : [];
1444
+ };
1445
+ SfCrudService.prototype.cleanDataTemp = function () {
1446
+ sessionStorage.removeItem('dataTemp');
1447
+ };
1448
+ return SfCrudService;
1449
+ }());
1450
+ SfCrudService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: SfCrudService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1451
+ SfCrudService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: SfCrudService, providedIn: 'root' });
1452
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: SfCrudService, decorators: [{
1453
+ type: i0.Injectable,
1454
+ args: [{
1455
+ providedIn: 'root'
1456
+ }]
1457
+ }], ctorParameters: function () { return []; } });
1458
+
621
1459
  var RegistroComponent = /** @class */ (function () {
622
- function RegistroComponent(generalService, router, messageSerice) {
1460
+ function RegistroComponent(generalService, router, messageSerice, dialogService, sfCrudService) {
623
1461
  this.generalService = generalService;
624
1462
  this.router = router;
625
1463
  this.messageSerice = messageSerice;
1464
+ this.dialogService = dialogService;
1465
+ this.sfCrudService = sfCrudService;
626
1466
  this.idKatios = '';
627
1467
  this.idEntidad = '';
628
1468
  this.trx = '';
629
1469
  this.id = '';
630
- this.enProceso = false;
1470
+ this.sendData = new i0.EventEmitter();
1471
+ this.onSubmit = new i0.EventEmitter();
1472
+ this.dataTemp = [];
631
1473
  this.crudConfig = new CrudConfig();
1474
+ this.enProceso = false;
632
1475
  this.configOperation = new Operations();
1476
+ this.isLocal = false;
1477
+ this.controlsLoaded = false;
1478
+ this.dataTemp = this.sfCrudService.getDataTemp();
633
1479
  }
634
1480
  RegistroComponent.prototype.ngOnInit = function () {
635
1481
  this.loadConfigCrud();
636
- this.setLabelSumbit();
637
1482
  };
638
1483
  RegistroComponent.prototype.loadConfigCrud = function () {
639
1484
  var _this = this;
640
1485
  this.enProceso = true;
641
1486
  this.generalService.getCrudByEntidad(this.idKatios, this.idEntidad)
642
1487
  .then(function (res) {
1488
+ _this.setDataTemp(res.esquema, _this.dataTemp);
643
1489
  _this.crudConfig = res;
644
- if (_this.trx != 'c')
645
- _this.getInfoRegistro(_this.crudConfig.registro);
646
- else {
1490
+ if (_this.trx == 'c') {
647
1491
  _this.data = _this.createObject(_this.crudConfig.esquema);
1492
+ _this.setLabelSumbit();
648
1493
  _this.enProceso = false;
1494
+ _this.configOperation = _this.crudConfig.registro.operations.find(function (x) { return x.type.startsWith(_this.trx); }) || new Operations();
1495
+ _this.buildControls();
649
1496
  }
650
- _this.configOperation = _this.crudConfig.registro.operations.find(function (x) { return x.type.startsWith(_this.trx); }) || new Operations();
1497
+ else
1498
+ _this.getInfoRegistro(_this.crudConfig.registro);
651
1499
  })
652
1500
  .catch(function (err) {
653
1501
  console.log(err);
654
1502
  _this.enProceso = false;
655
1503
  });
656
1504
  };
1505
+ RegistroComponent.prototype.buildControls = function () {
1506
+ var _this = this;
1507
+ this.controlsLoaded = false;
1508
+ this.controls = [];
1509
+ this.values = [];
1510
+ this.crudConfig.uiEsquema.elements.forEach(function (layout, i) {
1511
+ var _a;
1512
+ _this.controls.push([]);
1513
+ _this.values.push([]);
1514
+ (_a = layout.elements) === null || _a === void 0 ? void 0 : _a.forEach(function (element) {
1515
+ if (!element.scope)
1516
+ console.log("CONFIGURAR BIEN " + element);
1517
+ _this.controls[i].push(_this.getControl(element.scope));
1518
+ _this.values[i].push(_this.getValue(element.scope));
1519
+ });
1520
+ });
1521
+ this.controlsLoaded = true;
1522
+ };
657
1523
  RegistroComponent.prototype.setLabelSumbit = function () {
658
1524
  if (this.trx == 'c')
659
1525
  this.btnSubmit = { label: 'Guardar', icon: 'pi pi-save' };
@@ -669,11 +1535,26 @@
669
1535
  var op = configRegistro.operations.find(function (x) { return x.type == 'read'; });
670
1536
  var endpoint = (op === null || op === void 0 ? void 0 : op.endpoint) || '';
671
1537
  endpoint = endpoint.replace('@idKatios', this.idKatios);
1538
+ endpoint = endpoint.replace('@ndocactivo', this.user.UsuarioSistema.NDOC);
672
1539
  endpoint = endpoint.replace('@id', this.id);
673
1540
  this.generalService.genericRequest((op === null || op === void 0 ? void 0 : op.method) || '', (op === null || op === void 0 ? void 0 : op.server) || '', endpoint)
674
1541
  .then(function (res) {
675
- _this.data = res.data;
1542
+ if (res === null || res === void 0 ? void 0 : res.data) {
1543
+ if (Array.isArray(res.data))
1544
+ _this.data = res.data[0];
1545
+ else
1546
+ _this.data = res.data;
1547
+ _this.trx = 'u';
1548
+ }
1549
+ else {
1550
+ _this.trx = 'c';
1551
+ _this.data = _this.createObject(_this.crudConfig.esquema);
1552
+ console.log(_this.data);
1553
+ }
1554
+ _this.buildControls();
676
1555
  _this.enProceso = false;
1556
+ _this.configOperation = _this.crudConfig.registro.operations.find(function (x) { return x.type.startsWith(_this.trx); }) || new Operations();
1557
+ _this.setLabelSumbit();
677
1558
  })
678
1559
  .catch(function (err) {
679
1560
  console.log(err);
@@ -689,10 +1570,26 @@
689
1570
  RegistroComponent.prototype.getValue = function (scope) {
690
1571
  return jsonpath__namespace.query(this.data, scope.replace('.properties', ''))[0];
691
1572
  };
692
- RegistroComponent.prototype.setValue = function (value, scope) {
693
- jsonpath__namespace.value(this.data, scope.replace('.properties', ''), value);
1573
+ RegistroComponent.prototype.setValue = function (value, scope, i, j) {
1574
+ var _this = this;
1575
+ switch (typeof (value)) {
1576
+ case 'object':
1577
+ if (Array.isArray(value))
1578
+ value.forEach(function (val) { return jsonpath__namespace.value(_this.data, val.scope.replace('.properties', ''), val.value); });
1579
+ else {
1580
+ jsonpath__namespace.value(this.data, scope.replace('.properties', ''), value);
1581
+ this.values[i][j] = value;
1582
+ }
1583
+ break;
1584
+ default:
1585
+ this.values[i][j] = value;
1586
+ jsonpath__namespace.value(this.data, scope.replace('.properties', ''), value);
1587
+ break;
1588
+ }
1589
+ this.applyValuesOnEvent('onChange', this.crudConfig.esquema);
694
1590
  };
695
1591
  RegistroComponent.prototype.createObject = function (esquema) {
1592
+ var _this = this;
696
1593
  var object = {};
697
1594
  switch (esquema.type) {
698
1595
  case 'numeric':
@@ -704,38 +1601,83 @@
704
1601
  return (esquema === null || esquema === void 0 ? void 0 : esquema.default) || false;
705
1602
  case 'array':
706
1603
  return [];
1604
+ case 'file':
1605
+ return null;
707
1606
  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;
1607
+ Object.getOwnPropertyNames(esquema === null || esquema === void 0 ? void 0 : esquema.properties).forEach(function (key) {
1608
+ var aux = esquema === null || esquema === void 0 ? void 0 : esquema.properties[key];
1609
+ if (aux)
1610
+ object[key] = _this.createObject(aux);
1611
+ });
1612
+ return object;
712
1613
  default:
713
- break;
1614
+ return null;
714
1615
  }
715
- return object;
716
1616
  };
717
1617
  RegistroComponent.prototype.submit = function () {
718
1618
  var _this = this;
1619
+ console.log(this.data);
719
1620
  if (!this.validateData())
720
1621
  return;
1622
+ this.applyValuesOnEvent('onSubmit', this.crudConfig.esquema);
721
1623
  this.enProceso = true;
722
1624
  var endpoint = this.configOperation.endpoint;
723
1625
  endpoint = endpoint.replace('@idKatios', this.idKatios);
724
1626
  endpoint = endpoint.replace('@id', this.id);
725
1627
  this.generalService.genericRequest(this.configOperation.method, this.configOperation.server, endpoint, this.data)
726
- .then(function () {
727
- _this.messageSerice.add({ severity: 'success', detail: "Proceso exitoso!" });
1628
+ .then(function (res) {
1629
+ _this.generateMessage({ severity: 'success', detail: "Proceso exitoso!" }, res, _this.configOperation.answerChecking);
1630
+ _this.enProceso = false;
728
1631
  setTimeout(function () {
729
- _this.enProceso = false;
730
- _this.back();
1632
+ var _a, _b;
1633
+ if ((_a = _this.configOperation) === null || _a === void 0 ? void 0 : _a.redirect)
1634
+ _this.router.navigate([(_b = _this.configOperation) === null || _b === void 0 ? void 0 : _b.redirect]);
1635
+ else
1636
+ _this.onSubmit.emit(_this.data);
731
1637
  }, 2000);
732
1638
  })
733
1639
  .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.') });
1640
+ var operation = _this.crudConfig.registro.operations.find(function (op) { return op.type.startsWith(_this.trx); });
1641
+ _this.generateMessage({ severity: "error", detail: "Por favor comunicarse con el admin", summary: "Error no controlado" }, err.error, operation.errorChecking);
736
1642
  _this.enProceso = false;
737
1643
  });
738
1644
  };
1645
+ /**
1646
+ * Generates message using answerchecking
1647
+ * @param currentMsg Default message: Message
1648
+ * @param rta Resquest's response
1649
+ * @param answerChecking
1650
+ */
1651
+ RegistroComponent.prototype.generateMessage = function (currentMsg, rta, requestChecking) {
1652
+ if (requestChecking) {
1653
+ if (requestChecking.statics)
1654
+ Object.assign(currentMsg, requestChecking.statics);
1655
+ //mapear los dinamicos
1656
+ if (requestChecking.dynamics) {
1657
+ var dynamics = requestChecking.dynamics;
1658
+ try {
1659
+ if (dynamics && typeof (rta) == "string")
1660
+ rta = JSON.parse(rta);
1661
+ if (dynamics) {
1662
+ for (var property in dynamics) {
1663
+ currentMsg[property] = jsonpath__namespace.query(rta, dynamics[property])[0];
1664
+ }
1665
+ }
1666
+ }
1667
+ catch (error) { //es una respuesta sin JSON
1668
+ if (dynamics)
1669
+ currentMsg.detail = rta;
1670
+ }
1671
+ }
1672
+ }
1673
+ if ((requestChecking === null || requestChecking === void 0 ? void 0 : requestChecking.redirect) || (requestChecking === null || requestChecking === void 0 ? void 0 : requestChecking.swal))
1674
+ Swal__default["default"].fire(currentMsg.summary, currentMsg.detail, currentMsg.severity).then(function (res) {
1675
+ if (res.isConfirmed && requestChecking.redirect)
1676
+ window.location.href = requestChecking.redirect;
1677
+ });
1678
+ else
1679
+ this.messageSerice.add(currentMsg);
1680
+ };
739
1681
  RegistroComponent.prototype.validateData = function () {
740
1682
  if (this.configOperation.validations.type == 'local')
741
1683
  return this.validateDataLocal();
@@ -743,11 +1685,24 @@
743
1685
  };
744
1686
  RegistroComponent.prototype.validateDataLocal = function () {
745
1687
  var _this = this;
1688
+ var _a, _b, _c, _d;
746
1689
  var err = [];
747
- this.configOperation.validations.required.forEach(function (x) {
1690
+ (_b = (_a = this.configOperation.validations) === null || _a === void 0 ? void 0 : _a.required) === null || _b === void 0 ? void 0 : _b.forEach(function (x) {
748
1691
  if (!jsonpath__namespace.query(_this.data, x.field)[0])
749
1692
  err.push(x.message);
750
1693
  });
1694
+ (_d = (_c = this.configOperation.validations) === null || _c === void 0 ? void 0 : _c.operations) === null || _d === void 0 ? void 0 : _d.forEach(function (op) {
1695
+ switch (op.action) {
1696
+ case 'sumArray':
1697
+ var var1 = jsonpath__namespace.query(_this.data, op.scope[0]).reduce(function (acc, cur) { return acc += cur[op.key]; }, 0);
1698
+ var var2 = jsonpath__namespace.query(_this.data, op.scope[1]).reduce(function (acc, cur) { return acc += cur[op.key]; }, 0);
1699
+ if (var1 != var2)
1700
+ err.push(op.message);
1701
+ break;
1702
+ default:
1703
+ break;
1704
+ }
1705
+ });
751
1706
  if (err.length != 0)
752
1707
  this.messageSerice.add({ severity: 'warn', detail: err.join('. ') });
753
1708
  return err.length == 0;
@@ -756,11 +1711,13 @@
756
1711
  var data = null;
757
1712
  switch (value) {
758
1713
  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;
1714
+ data = this.user.UsuarioSistema.TDOC + "-" + this.user.UsuarioSistema.NDOC;
1715
+ break;
1716
+ case '@tdocactivo':
1717
+ data = this.user.UsuarioSistema.TDOC;
1718
+ break;
1719
+ case '@ndocactivo':
1720
+ data = this.user.UsuarioSistema.NDOC;
764
1721
  break;
765
1722
  case '@hoy':
766
1723
  data = new Date();
@@ -771,18 +1728,159 @@
771
1728
  }
772
1729
  return data;
773
1730
  };
1731
+ RegistroComponent.prototype.sendNotification = function (message) {
1732
+ this.messageSerice.add(message);
1733
+ };
1734
+ RegistroComponent.prototype.addObjectArray = function (element) {
1735
+ var _this = this;
1736
+ this.dialogRef = this.dialogService.open(RegistroChildComponent, {
1737
+ header: element.label ? element.label : 'Detalle',
1738
+ width: '70%',
1739
+ modal: true,
1740
+ closable: false,
1741
+ data: {
1742
+ uiEsquema: Object.assign({}, element.elements),
1743
+ esquema: this.getControl(element.scope),
1744
+ id: this.getValue(element.scope).length + 1
1745
+ }
1746
+ });
1747
+ this.dialogRef.onClose.subscribe(function (data) {
1748
+ if (data)
1749
+ _this.data[element.scope.replace('$..properties.', '')].push(data);
1750
+ _this.applyValuesOnEvent('onChange', _this.crudConfig.esquema, element.scope.replace('$..properties.', ''));
1751
+ });
1752
+ };
1753
+ RegistroComponent.prototype.editRow = function (element, data, index) {
1754
+ var _this = this;
1755
+ this.dialogRef = this.dialogService.open(RegistroChildComponent, {
1756
+ header: element.label ? element.label : 'Detalle',
1757
+ width: '70%',
1758
+ modal: true,
1759
+ closable: false,
1760
+ data: {
1761
+ uiEsquema: Object.assign({}, element.elements),
1762
+ esquema: this.getControl(element.scope),
1763
+ data: Object.assign({}, data)
1764
+ }
1765
+ });
1766
+ this.dialogRef.onClose.subscribe(function (data) {
1767
+ if (data)
1768
+ _this.data[element.scope.replace('$..properties.', '')][index] = data;
1769
+ _this.applyValuesOnEvent('onChange', _this.crudConfig.esquema, element.scope.replace('$..properties.', ''));
1770
+ });
1771
+ };
1772
+ RegistroComponent.prototype.deleteRow = function (element, index) {
1773
+ this.data[element.scope.replace('$..properties.', '')].splice(index, 1);
1774
+ index = 1;
1775
+ this.data[element.scope.replace('$..properties.', '')].forEach(function (el) {
1776
+ el.id = index;
1777
+ index++;
1778
+ });
1779
+ this.applyValuesOnEvent('onChange', this.crudConfig.esquema, element.scope.replace('$..properties.', ''));
1780
+ };
1781
+ RegistroComponent.prototype.applyValuesOnEvent = function (event, esquema, key) {
1782
+ var _this = this;
1783
+ if (key) {
1784
+ if (esquema.properties[key][event]) {
1785
+ esquema.properties[key][event].forEach(function (value) {
1786
+ _this.setValueEvent(_this.data, value);
1787
+ });
1788
+ }
1789
+ }
1790
+ else {
1791
+ for (var key_1 in esquema.properties) {
1792
+ if (esquema.properties[key_1][event]) {
1793
+ esquema.properties[key_1][event].forEach(function (value) {
1794
+ _this.setValueEvent(_this.data, value);
1795
+ });
1796
+ }
1797
+ }
1798
+ }
1799
+ };
1800
+ RegistroComponent.prototype.setValueEvent = function (data, params) {
1801
+ var _a;
1802
+ var date = moment__namespace(new Date());
1803
+ switch (params.op) {
1804
+ case 'sum':
1805
+ 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));
1806
+ break;
1807
+ case 'concat':
1808
+ var array_1 = [];
1809
+ (_a = params === null || params === void 0 ? void 0 : params.key) === null || _a === void 0 ? void 0 : _a.reduce(function (acc, cur) {
1810
+ array_1.push(jsonpath__namespace.query(data, cur)[0]);
1811
+ }, []);
1812
+ if (params === null || params === void 0 ? void 0 : params.separator)
1813
+ jsonpath__namespace.value(data, params.scope[0], array_1.join((params === null || params === void 0 ? void 0 : params.separator) || ' '));
1814
+ break;
1815
+ case 'enable':
1816
+ jsonpath__namespace.value(this.crudConfig.esquema, params.scope[0], false);
1817
+ break;
1818
+ case 'disabled':
1819
+ jsonpath__namespace.value(this.crudConfig.esquema, params.scope[0], true);
1820
+ break;
1821
+ case 'replace:endpoint':
1822
+ jsonpath__namespace.value(this.crudConfig.esquema, params.scope[0], this.crudConfig.esquema.config.endpointtemp.replace(params.scope[1], jsonpath__namespace.query(data, "$.." + params.key)));
1823
+ break;
1824
+ case 'setNull':
1825
+ jsonpath__namespace.value(this.data, "$." + params.key, null);
1826
+ break;
1827
+ case 'datediff:years':
1828
+ jsonpath__namespace.value(this.data, params.scope[0], date.diff(moment__namespace(jsonpath__namespace.query(this.data, params.scope[1])[0]), 'years'));
1829
+ break;
1830
+ case 'datediff:months':
1831
+ jsonpath__namespace.value(this.data, params.scope[0], date.diff(moment__namespace(jsonpath__namespace.query(this.data, params.scope[1])[0]), 'months'));
1832
+ break;
1833
+ case 'datediff:weeks':
1834
+ jsonpath__namespace.value(this.data, params.scope[0], date.diff(moment__namespace(jsonpath__namespace.query(this.data, params.scope[1])[0]), 'weeks'));
1835
+ break;
1836
+ case 'datediff:days':
1837
+ jsonpath__namespace.value(this.data, params.scope[0], date.diff(moment__namespace(jsonpath__namespace.query(this.data, params.scope[1])[0]), 'days'));
1838
+ break;
1839
+ default:
1840
+ break;
1841
+ }
1842
+ };
1843
+ RegistroComponent.prototype.setDataTemp = function (esquema, dataTemp) {
1844
+ dataTemp.forEach(function (data) {
1845
+ jsonpath__namespace.value(esquema, data.scope, data.value);
1846
+ });
1847
+ };
1848
+ RegistroComponent.prototype.applyValuesFromObject = function (event) {
1849
+ var _this = this;
1850
+ if (event.data)
1851
+ event.optionValue.forEach(function (value) { return jsonpath__namespace.value(_this.data, value.scope.replace('.properties', ''), _this.aplyFormatValue(value.scope, event.data[value.key])); });
1852
+ else
1853
+ event.optionValue.forEach(function (value) { return jsonpath__namespace.value(_this.data, value.scope.replace('.properties', ''), null); });
1854
+ };
1855
+ RegistroComponent.prototype.aplyFormatValue = function (scope, value) {
1856
+ var control = jsonpath__namespace.query(this.crudConfig.esquema, scope)[0];
1857
+ var resp;
1858
+ switch (control.type) {
1859
+ case 'date':
1860
+ resp = new Date("" + value);
1861
+ break;
1862
+ case 'numeric':
1863
+ resp = +value;
1864
+ break;
1865
+ default:
1866
+ resp = value;
1867
+ break;
1868
+ }
1869
+ return resp;
1870
+ };
774
1871
  return RegistroComponent;
775
1872
  }());
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"] }] });
1873
+ 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 });
1874
+ 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
1875
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RegistroComponent, decorators: [{
779
1876
  type: i0.Component,
780
1877
  args: [{
781
1878
  selector: 'sf-registro',
782
1879
  templateUrl: './registro.component.html',
783
- providers: [i3$1.MessageService]
1880
+ providers: [i2$1.MessageService, i1$1.DialogService, i1$1.DynamicDialogConfig, i1$1.DynamicDialogRef],
1881
+ entryComponents: [RegistroComponent]
784
1882
  }]
785
- }], ctorParameters: function () { return [{ type: GeneralService }, { type: i2__namespace.Router }, { type: i3__namespace$1.MessageService }]; }, propDecorators: { idKatios: [{
1883
+ }], ctorParameters: function () { return [{ type: GeneralService }, { type: i2__namespace.Router }, { type: i2__namespace$1.MessageService }, { type: i1__namespace$1.DialogService }, { type: SfCrudService }]; }, propDecorators: { idKatios: [{
786
1884
  type: i0.Input
787
1885
  }], idEntidad: [{
788
1886
  type: i0.Input
@@ -790,6 +1888,12 @@
790
1888
  type: i0.Input
791
1889
  }], id: [{
792
1890
  type: i0.Input
1891
+ }], user: [{
1892
+ type: i0.Input
1893
+ }], sendData: [{
1894
+ type: i0.Output
1895
+ }], onSubmit: [{
1896
+ type: i0.Output
793
1897
  }] } });
794
1898
 
795
1899
  var SfCrudComponent = /** @class */ (function () {
@@ -819,42 +1923,43 @@
819
1923
  SfCrudModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: SfCrudModule, declarations: [SfCrudComponent,
820
1924
  TableroComponent,
821
1925
  RegistroComponent,
822
- ControlComponent], imports: [accordion.AccordionModule,
823
- i3$2.AutoCompleteModule,
1926
+ ControlComponent,
1927
+ RegistroChildComponent,
1928
+ RegistroDetalleComponent], imports: [accordion.AccordionModule,
1929
+ i4$1.AutoCompleteModule,
824
1930
  avatargroup.AvatarGroupModule,
825
1931
  avatar.AvatarModule,
826
1932
  badge.BadgeModule,
827
1933
  i3.BlockUIModule,
828
1934
  breadcrumb.BreadcrumbModule,
829
- i8.ButtonModule,
830
- i4$1.CalendarModule,
1935
+ i9.ButtonModule,
1936
+ i5$1.CalendarModule,
831
1937
  card.CardModule,
832
1938
  carousel.CarouselModule,
833
1939
  cascadeselect.CascadeSelectModule,
834
1940
  checkbox.CheckboxModule,
835
1941
  chip.ChipModule,
836
1942
  chips.ChipsModule,
837
- codehighlighter.CodeHighlighterModule,
838
1943
  colorpicker.ColorPickerModule,
839
1944
  confirmdialog.ConfirmDialogModule,
840
1945
  confirmpopup.ConfirmPopupModule,
841
1946
  contextmenu.ContextMenuModule,
842
1947
  dialog.DialogModule,
843
1948
  divider.DividerModule,
844
- i2$1.DropdownModule,
1949
+ i3$1.DropdownModule,
1950
+ i1$1.DynamicDialogModule,
845
1951
  fieldset.FieldsetModule,
846
- fileupload.FileUploadModule,
847
- i7.FormsModule,
1952
+ i7$1.FileUploadModule,
1953
+ i10$1.FormsModule,
848
1954
  galleria.GalleriaModule,
849
1955
  i1.HttpClientModule,
850
1956
  inplace.InplaceModule,
851
- inputmask.InputMaskModule,
852
- i5$1.InputNumberModule,
853
- inputswitch.InputSwitchModule,
854
- inputtextarea.InputTextareaModule,
855
- i10.InputTextModule,
1957
+ i2$2.InputMaskModule,
1958
+ i6$1.InputNumberModule,
1959
+ i8.InputSwitchModule,
1960
+ i12.InputTextareaModule,
1961
+ i11.InputTextModule,
856
1962
  knob.KnobModule,
857
- lightbox.LightboxModule,
858
1963
  listbox.ListboxModule,
859
1964
  megamenu.MegaMenuModule,
860
1965
  menubar.MenubarModule,
@@ -870,7 +1975,7 @@
870
1975
  progressbar.ProgressBarModule,
871
1976
  radiobutton.RadioButtonModule,
872
1977
  rating.RatingModule,
873
- i9.RippleModule,
1978
+ i10.RippleModule,
874
1979
  scrollpanel.ScrollPanelModule,
875
1980
  scrolltop.ScrollTopModule,
876
1981
  selectbutton.SelectButtonModule,
@@ -878,6 +1983,7 @@
878
1983
  skeleton.SkeletonModule,
879
1984
  slidemenu.SlideMenuModule,
880
1985
  slider.SliderModule,
1986
+ i6.SplitButtonModule,
881
1987
  splitter.SplitterModule,
882
1988
  steps.StepsModule,
883
1989
  i5.TableModule,
@@ -887,50 +1993,50 @@
887
1993
  terminal.TerminalModule,
888
1994
  tieredmenu.TieredMenuModule,
889
1995
  timeline.TimelineModule,
890
- i5$2.ToastModule,
1996
+ i3$2.ToastModule,
891
1997
  togglebutton.ToggleButtonModule,
892
1998
  i4.ToolbarModule,
893
- i11.TooltipModule,
1999
+ tooltip.TooltipModule,
894
2000
  tree.TreeModule], exports: [SfCrudComponent,
895
2001
  TableroComponent,
896
- RegistroComponent] });
2002
+ RegistroComponent,
2003
+ ControlComponent] });
897
2004
  SfCrudModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: SfCrudModule, imports: [[
898
2005
  accordion.AccordionModule,
899
- i3$2.AutoCompleteModule,
2006
+ i4$1.AutoCompleteModule,
900
2007
  avatargroup.AvatarGroupModule,
901
2008
  avatar.AvatarModule,
902
2009
  badge.BadgeModule,
903
2010
  i3.BlockUIModule,
904
2011
  breadcrumb.BreadcrumbModule,
905
- i8.ButtonModule,
906
- i4$1.CalendarModule,
2012
+ i9.ButtonModule,
2013
+ i5$1.CalendarModule,
907
2014
  card.CardModule,
908
2015
  carousel.CarouselModule,
909
2016
  cascadeselect.CascadeSelectModule,
910
2017
  checkbox.CheckboxModule,
911
2018
  chip.ChipModule,
912
2019
  chips.ChipsModule,
913
- codehighlighter.CodeHighlighterModule,
914
2020
  colorpicker.ColorPickerModule,
915
2021
  confirmdialog.ConfirmDialogModule,
916
2022
  confirmpopup.ConfirmPopupModule,
917
2023
  contextmenu.ContextMenuModule,
918
2024
  dialog.DialogModule,
919
2025
  divider.DividerModule,
920
- i2$1.DropdownModule,
2026
+ i3$1.DropdownModule,
2027
+ i1$1.DynamicDialogModule,
921
2028
  fieldset.FieldsetModule,
922
- fileupload.FileUploadModule,
923
- i7.FormsModule,
2029
+ i7$1.FileUploadModule,
2030
+ i10$1.FormsModule,
924
2031
  galleria.GalleriaModule,
925
2032
  i1.HttpClientModule,
926
2033
  inplace.InplaceModule,
927
- inputmask.InputMaskModule,
928
- i5$1.InputNumberModule,
929
- inputswitch.InputSwitchModule,
930
- inputtextarea.InputTextareaModule,
931
- i10.InputTextModule,
2034
+ i2$2.InputMaskModule,
2035
+ i6$1.InputNumberModule,
2036
+ i8.InputSwitchModule,
2037
+ i12.InputTextareaModule,
2038
+ i11.InputTextModule,
932
2039
  knob.KnobModule,
933
- lightbox.LightboxModule,
934
2040
  listbox.ListboxModule,
935
2041
  megamenu.MegaMenuModule,
936
2042
  menubar.MenubarModule,
@@ -946,7 +2052,7 @@
946
2052
  progressbar.ProgressBarModule,
947
2053
  radiobutton.RadioButtonModule,
948
2054
  rating.RatingModule,
949
- i9.RippleModule,
2055
+ i10.RippleModule,
950
2056
  scrollpanel.ScrollPanelModule,
951
2057
  scrolltop.ScrollTopModule,
952
2058
  selectbutton.SelectButtonModule,
@@ -954,6 +2060,7 @@
954
2060
  skeleton.SkeletonModule,
955
2061
  slidemenu.SlideMenuModule,
956
2062
  slider.SliderModule,
2063
+ i6.SplitButtonModule,
957
2064
  splitter.SplitterModule,
958
2065
  steps.StepsModule,
959
2066
  i5.TableModule,
@@ -963,10 +2070,10 @@
963
2070
  terminal.TerminalModule,
964
2071
  tieredmenu.TieredMenuModule,
965
2072
  timeline.TimelineModule,
966
- i5$2.ToastModule,
2073
+ i3$2.ToastModule,
967
2074
  togglebutton.ToggleButtonModule,
968
2075
  i4.ToolbarModule,
969
- i11.TooltipModule,
2076
+ tooltip.TooltipModule,
970
2077
  tree.TreeModule,
971
2078
  ]] });
972
2079
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: SfCrudModule, decorators: [{
@@ -976,45 +2083,46 @@
976
2083
  SfCrudComponent,
977
2084
  TableroComponent,
978
2085
  RegistroComponent,
979
- ControlComponent
2086
+ ControlComponent,
2087
+ RegistroChildComponent,
2088
+ RegistroDetalleComponent
980
2089
  ],
981
2090
  imports: [
982
2091
  accordion.AccordionModule,
983
- i3$2.AutoCompleteModule,
2092
+ i4$1.AutoCompleteModule,
984
2093
  avatargroup.AvatarGroupModule,
985
2094
  avatar.AvatarModule,
986
2095
  badge.BadgeModule,
987
2096
  i3.BlockUIModule,
988
2097
  breadcrumb.BreadcrumbModule,
989
- i8.ButtonModule,
990
- i4$1.CalendarModule,
2098
+ i9.ButtonModule,
2099
+ i5$1.CalendarModule,
991
2100
  card.CardModule,
992
2101
  carousel.CarouselModule,
993
2102
  cascadeselect.CascadeSelectModule,
994
2103
  checkbox.CheckboxModule,
995
2104
  chip.ChipModule,
996
2105
  chips.ChipsModule,
997
- codehighlighter.CodeHighlighterModule,
998
2106
  colorpicker.ColorPickerModule,
999
2107
  confirmdialog.ConfirmDialogModule,
1000
2108
  confirmpopup.ConfirmPopupModule,
1001
2109
  contextmenu.ContextMenuModule,
1002
2110
  dialog.DialogModule,
1003
2111
  divider.DividerModule,
1004
- i2$1.DropdownModule,
2112
+ i3$1.DropdownModule,
2113
+ i1$1.DynamicDialogModule,
1005
2114
  fieldset.FieldsetModule,
1006
- fileupload.FileUploadModule,
1007
- i7.FormsModule,
2115
+ i7$1.FileUploadModule,
2116
+ i10$1.FormsModule,
1008
2117
  galleria.GalleriaModule,
1009
2118
  i1.HttpClientModule,
1010
2119
  inplace.InplaceModule,
1011
- inputmask.InputMaskModule,
1012
- i5$1.InputNumberModule,
1013
- inputswitch.InputSwitchModule,
1014
- inputtextarea.InputTextareaModule,
1015
- i10.InputTextModule,
2120
+ i2$2.InputMaskModule,
2121
+ i6$1.InputNumberModule,
2122
+ i8.InputSwitchModule,
2123
+ i12.InputTextareaModule,
2124
+ i11.InputTextModule,
1016
2125
  knob.KnobModule,
1017
- lightbox.LightboxModule,
1018
2126
  listbox.ListboxModule,
1019
2127
  megamenu.MegaMenuModule,
1020
2128
  menubar.MenubarModule,
@@ -1030,7 +2138,7 @@
1030
2138
  progressbar.ProgressBarModule,
1031
2139
  radiobutton.RadioButtonModule,
1032
2140
  rating.RatingModule,
1033
- i9.RippleModule,
2141
+ i10.RippleModule,
1034
2142
  scrollpanel.ScrollPanelModule,
1035
2143
  scrolltop.ScrollTopModule,
1036
2144
  selectbutton.SelectButtonModule,
@@ -1038,6 +2146,7 @@
1038
2146
  skeleton.SkeletonModule,
1039
2147
  slidemenu.SlideMenuModule,
1040
2148
  slider.SliderModule,
2149
+ i6.SplitButtonModule,
1041
2150
  splitter.SplitterModule,
1042
2151
  steps.StepsModule,
1043
2152
  i5.TableModule,
@@ -1047,34 +2156,24 @@
1047
2156
  terminal.TerminalModule,
1048
2157
  tieredmenu.TieredMenuModule,
1049
2158
  timeline.TimelineModule,
1050
- i5$2.ToastModule,
2159
+ i3$2.ToastModule,
1051
2160
  togglebutton.ToggleButtonModule,
1052
2161
  i4.ToolbarModule,
1053
- i11.TooltipModule,
2162
+ tooltip.TooltipModule,
1054
2163
  tree.TreeModule,
1055
2164
  ],
1056
2165
  exports: [
1057
2166
  SfCrudComponent,
1058
2167
  TableroComponent,
1059
- RegistroComponent
2168
+ RegistroComponent,
2169
+ ControlComponent
2170
+ ],
2171
+ entryComponents: [
2172
+ RegistroChildComponent
1060
2173
  ]
1061
2174
  }]
1062
2175
  }] });
1063
2176
 
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
2177
  /*
1079
2178
  * Public API Surface of sf-crud
1080
2179
  */
@@ -1083,6 +2182,7 @@
1083
2182
  * Generated bundle index. Do not edit.
1084
2183
  */
1085
2184
 
2185
+ exports.ControlComponent = ControlComponent;
1086
2186
  exports.RegistroComponent = RegistroComponent;
1087
2187
  exports.SfCrudComponent = SfCrudComponent;
1088
2188
  exports.SfCrudModule = SfCrudModule;