tuain-ng-forms-lib 12.0.2 → 12.0.6

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.
@@ -54,230 +54,6 @@
54
54
  showLabel: [{ type: core.Input }]
55
55
  };
56
56
 
57
- var MONITORED_ATTRIBUTES = {
58
- _maxLength: 'maxLength',
59
- _onValidation: 'onValidation',
60
- _fieldValue: 'value',
61
- captureType: 'captureType',
62
- fieldTitle: 'title',
63
- fieldType: 'type',
64
- errorMessage: 'errorMessage',
65
- errorType: 'errorType',
66
- errorCode: 'errorCode',
67
- visibleLabel: 'visibleLabel',
68
- fieldRequired: 'required',
69
- fieldOptions: 'options',
70
- };
71
- var FieldComponent = /** @class */ (function () {
72
- function FieldComponent() {
73
- }
74
- FieldComponent.prototype.ngOnInit = function () {
75
- var _this = this;
76
- var _a;
77
- if (this.fieldObject) {
78
- this.formConfig = (_a = this.fieldObject) === null || _a === void 0 ? void 0 : _a._formConfig;
79
- // Atributos estáticos
80
- this.code = this.fieldObject.fieldCode;
81
- this.fieldInfo = this.fieldObject.fieldInfo;
82
- this.fieldAlignment = this.fieldObject.fieldAlignment;
83
- this.tooltipText = this.fieldObject.tooltipText;
84
- // Cargue inicial
85
- this.maxLength = this.fieldObject._maxLength;
86
- this.onValidation = this.fieldObject._onValidation;
87
- this.value = this.fieldObject._fieldValue;
88
- this.captureType = this.fieldObject.captureType;
89
- this.title = this.fieldObject.fieldTitle;
90
- this.type = this.fieldObject.fieldType;
91
- this.errorMessage = this.fieldObject.errorMessage;
92
- this.errorType = this.fieldObject.errorType;
93
- this.errorCode = this.fieldObject.errorCode;
94
- this.visibleLabel = this.fieldObject.visibleLabel;
95
- this.required = this.fieldObject.fieldRequired;
96
- this.options = this.fieldObject.fieldOptions;
97
- this.fieldObject.widget = this;
98
- // Atributos dinámicos
99
- this.fieldObject.attributeChange.subscribe(function (event) {
100
- var name = event.name, value = event.value;
101
- if (_this[MONITORED_ATTRIBUTES[name]]) {
102
- _this[MONITORED_ATTRIBUTES[name]] = value;
103
- }
104
- });
105
- }
106
- this.start();
107
- };
108
- FieldComponent.prototype.start = function () { };
109
- FieldComponent.prototype.focus = function () { };
110
- FieldComponent.prototype.onInputChange = function () {
111
- var _this = this;
112
- setTimeout(function () { return _this.fieldObject.notifyEditionPartial(); }, 50);
113
- };
114
- FieldComponent.prototype.onChangeContent = function () {
115
- var _this = this;
116
- setTimeout(function () { return _this.fieldObject.notifyEditionFinish(); }, 50);
117
- };
118
- FieldComponent.prototype.onShowInfo = function () {
119
- var _this = this;
120
- setTimeout(function () { return _this.fieldObject.notifyEditionDetailRequest(); }, 50);
121
- };
122
- FieldComponent.prototype.numberInputValidation = function (event) {
123
- var k = event.charCode;
124
- return (k > 47 && k < 58);
125
- };
126
- return FieldComponent;
127
- }());
128
- FieldComponent.decorators = [
129
- { type: core.Component, args: [{
130
- selector: 'lib-field',
131
- template: "<ng-content></ng-content>"
132
- },] }
133
- ];
134
- FieldComponent.propDecorators = {
135
- fieldObject: [{ type: core.Input }],
136
- disabled: [{ type: core.Input }]
137
- };
138
-
139
- var ElementComponent = /** @class */ (function () {
140
- function ElementComponent() {
141
- }
142
- ElementComponent.prototype.ngOnInit = function () {
143
- var _a;
144
- this.formConfig = (_a = this.formElement) === null || _a === void 0 ? void 0 : _a._formConfig;
145
- this.start();
146
- };
147
- ElementComponent.prototype.start = function () { };
148
- Object.defineProperty(ElementComponent.prototype, "visible", {
149
- get: function () {
150
- var _a, _b, _c, _d;
151
- var visible = (_b = (_a = this.formElement) === null || _a === void 0 ? void 0 : _a.visible) !== null && _b !== void 0 ? _b : true;
152
- return visible && ((_c = this.formElement) === null || _c === void 0 ? void 0 : _c.viewOnState((_d = this.formManager) === null || _d === void 0 ? void 0 : _d.currentState));
153
- },
154
- enumerable: false,
155
- configurable: true
156
- });
157
- Object.defineProperty(ElementComponent.prototype, "disabled", {
158
- get: function () {
159
- var _a, _b, _c, _d;
160
- var disabled = (_b = (_a = this.formElement) === null || _a === void 0 ? void 0 : _a.disabled) !== null && _b !== void 0 ? _b : false;
161
- return disabled || !((_c = this.formElement) === null || _c === void 0 ? void 0 : _c.enabledOnState((_d = this.formManager) === null || _d === void 0 ? void 0 : _d.currentState));
162
- },
163
- enumerable: false,
164
- configurable: true
165
- });
166
- return ElementComponent;
167
- }());
168
- ElementComponent.decorators = [
169
- { type: core.Component, args: [{
170
- selector: 'lib-element',
171
- template: "<ng-content></ng-content>"
172
- },] }
173
- ];
174
- ElementComponent.propDecorators = {
175
- formElement: [{ type: core.Input }],
176
- formManager: [{ type: core.Input }]
177
- };
178
-
179
- var FormErrorComponent = /** @class */ (function () {
180
- function FormErrorComponent() {
181
- }
182
- return FormErrorComponent;
183
- }());
184
- FormErrorComponent.decorators = [
185
- { type: core.Component, args: [{
186
- selector: 'lib-form-error',
187
- template: "<ng-content></ng-content>"
188
- },] }
189
- ];
190
- FormErrorComponent.propDecorators = {
191
- errorTitle: [{ type: core.Input }],
192
- errorMessage: [{ type: core.Input }],
193
- errorType: [{ type: core.Input }]
194
- };
195
-
196
- var FormHeaderComponent = /** @class */ (function () {
197
- function FormHeaderComponent() {
198
- this.goBackEvent = new core.EventEmitter();
199
- }
200
- FormHeaderComponent.prototype.goBackForm = function () {
201
- this.goBackEvent.emit();
202
- };
203
- return FormHeaderComponent;
204
- }());
205
- FormHeaderComponent.decorators = [
206
- { type: core.Component, args: [{
207
- selector: 'lib-form-header',
208
- template: "<ng-content></ng-content>"
209
- },] }
210
- ];
211
- FormHeaderComponent.propDecorators = {
212
- formManager: [{ type: core.Input }],
213
- goBackAction: [{ type: core.Input }],
214
- showTitle: [{ type: core.Input }],
215
- headerActions: [{ type: core.Input }],
216
- goBackEvent: [{ type: core.Output }]
217
- };
218
-
219
- var SectionComponent = /** @class */ (function () {
220
- function SectionComponent() {
221
- }
222
- SectionComponent.prototype.ngOnInit = function () {
223
- this.start();
224
- };
225
- SectionComponent.prototype.start = function () { };
226
- return SectionComponent;
227
- }());
228
- SectionComponent.decorators = [
229
- { type: core.Component, args: [{
230
- selector: 'lib-section',
231
- template: "<ng-content></ng-content>"
232
- },] }
233
- ];
234
- SectionComponent.propDecorators = {
235
- sectionObject: [{ type: core.Input }],
236
- formManager: [{ type: core.Input }]
237
- };
238
-
239
- var SubSectionComponent = /** @class */ (function () {
240
- function SubSectionComponent() {
241
- }
242
- SubSectionComponent.prototype.ngOnInit = function () {
243
- this.start();
244
- };
245
- SubSectionComponent.prototype.start = function () { };
246
- return SubSectionComponent;
247
- }());
248
- SubSectionComponent.decorators = [
249
- { type: core.Component, args: [{
250
- selector: 'lib-subsection',
251
- template: "<ng-content></ng-content>"
252
- },] }
253
- ];
254
- SubSectionComponent.propDecorators = {
255
- subSection: [{ type: core.Input }],
256
- showHeader: [{ type: core.Input }],
257
- formManager: [{ type: core.Input }]
258
- };
259
-
260
- var FieldSearch = /** @class */ (function () {
261
- function FieldSearch(filterDefinition) {
262
- this.fieldCode = filterDefinition.fieldCode;
263
- this.fieldAlias = filterDefinition.fieldAlias || filterDefinition.fieldCode;
264
- this.fieldTitle = filterDefinition.fieldTitle;
265
- this.fieldTypeCode = filterDefinition.fieldTypeCode;
266
- this.operators = filterDefinition.operators;
267
- this.alignment = filterDefinition.alignment;
268
- this.format = filterDefinition.format;
269
- }
270
- return FieldSearch;
271
- }());
272
- var Filter = /** @class */ (function () {
273
- function Filter() {
274
- this.filterModeSimple = true;
275
- this.advancedFilter = [];
276
- this.simpleFilterWords = [];
277
- }
278
- return Filter;
279
- }());
280
-
281
57
  /*! *****************************************************************************
282
58
  Copyright (c) Microsoft Corporation.
283
59
 
@@ -596,6 +372,204 @@
596
372
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
597
373
  }
598
374
 
375
+ var FieldComponent = /** @class */ (function () {
376
+ function FieldComponent() {
377
+ }
378
+ FieldComponent.prototype.ngOnInit = function () {
379
+ var _this = this;
380
+ var _a, _b;
381
+ if (this.fieldObject) {
382
+ this.formConfig = (_a = this.fieldObject) === null || _a === void 0 ? void 0 : _a._formConfig;
383
+ // Inicialización
384
+ var mapping = Object.entries(this.formConfig.componentFieldAttrMap);
385
+ for (var index = 0; index < mapping.length; index++) {
386
+ var _c = __read(mapping[index], 2), fieldAttr = _c[0], compAttr = _c[1];
387
+ this[compAttr.toString()] = (_b = this.fieldObject) === null || _b === void 0 ? void 0 : _b[fieldAttr.toString()];
388
+ }
389
+ // Subscripción a cambios en atributos
390
+ this.fieldObject.attributeChange.subscribe(function (event) {
391
+ var fieldAttr = event.name, value = event.value;
392
+ var compAttr = _this.formConfig.componentFieldAttrMap[fieldAttr];
393
+ _this.hasOwnProperty(compAttr) && (_this[compAttr] = value);
394
+ });
395
+ }
396
+ this.start();
397
+ };
398
+ FieldComponent.prototype.start = function () { };
399
+ FieldComponent.prototype.focus = function () { };
400
+ FieldComponent.prototype.onInputChange = function () {
401
+ var _this = this;
402
+ setTimeout(function () { return _this.fieldObject.notifyEditionPartial(); }, 50);
403
+ };
404
+ FieldComponent.prototype.onChangeContent = function () {
405
+ var _this = this;
406
+ setTimeout(function () { return _this.fieldObject.notifyEditionFinish(); }, 50);
407
+ };
408
+ FieldComponent.prototype.onShowInfo = function () {
409
+ var _this = this;
410
+ setTimeout(function () { return _this.fieldObject.notifyEditionDetailRequest(); }, 50);
411
+ };
412
+ FieldComponent.prototype.numberInputValidation = function (event) {
413
+ var k = event.charCode;
414
+ return (k > 47 && k < 58);
415
+ };
416
+ return FieldComponent;
417
+ }());
418
+ FieldComponent.decorators = [
419
+ { type: core.Component, args: [{
420
+ selector: 'lib-field',
421
+ template: "<ng-content></ng-content>"
422
+ },] }
423
+ ];
424
+ FieldComponent.propDecorators = {
425
+ fieldObject: [{ type: core.Input }],
426
+ disabled: [{ type: core.Input }]
427
+ };
428
+
429
+ var ElementComponent = /** @class */ (function () {
430
+ function ElementComponent() {
431
+ }
432
+ ElementComponent.prototype.ngOnInit = function () {
433
+ var _a;
434
+ this.formConfig = (_a = this.formElement) === null || _a === void 0 ? void 0 : _a._formConfig;
435
+ this.start();
436
+ };
437
+ ElementComponent.prototype.start = function () { };
438
+ Object.defineProperty(ElementComponent.prototype, "visible", {
439
+ get: function () {
440
+ var _a, _b, _c, _d;
441
+ var visible = (_b = (_a = this.formElement) === null || _a === void 0 ? void 0 : _a.visible) !== null && _b !== void 0 ? _b : true;
442
+ return visible && ((_c = this.formElement) === null || _c === void 0 ? void 0 : _c.viewOnState((_d = this.formManager) === null || _d === void 0 ? void 0 : _d.currentState));
443
+ },
444
+ enumerable: false,
445
+ configurable: true
446
+ });
447
+ Object.defineProperty(ElementComponent.prototype, "disabled", {
448
+ get: function () {
449
+ var _a, _b, _c, _d;
450
+ var disabled = (_b = (_a = this.formElement) === null || _a === void 0 ? void 0 : _a.disabled) !== null && _b !== void 0 ? _b : false;
451
+ return disabled || !((_c = this.formElement) === null || _c === void 0 ? void 0 : _c.enabledOnState((_d = this.formManager) === null || _d === void 0 ? void 0 : _d.currentState));
452
+ },
453
+ enumerable: false,
454
+ configurable: true
455
+ });
456
+ return ElementComponent;
457
+ }());
458
+ ElementComponent.decorators = [
459
+ { type: core.Component, args: [{
460
+ selector: 'lib-element',
461
+ template: "<ng-content></ng-content>"
462
+ },] }
463
+ ];
464
+ ElementComponent.propDecorators = {
465
+ formElement: [{ type: core.Input }],
466
+ formManager: [{ type: core.Input }]
467
+ };
468
+
469
+ var FormErrorComponent = /** @class */ (function () {
470
+ function FormErrorComponent() {
471
+ }
472
+ return FormErrorComponent;
473
+ }());
474
+ FormErrorComponent.decorators = [
475
+ { type: core.Component, args: [{
476
+ selector: 'lib-form-error',
477
+ template: "<ng-content></ng-content>"
478
+ },] }
479
+ ];
480
+ FormErrorComponent.propDecorators = {
481
+ errorTitle: [{ type: core.Input }],
482
+ errorMessage: [{ type: core.Input }],
483
+ errorType: [{ type: core.Input }]
484
+ };
485
+
486
+ var FormHeaderComponent = /** @class */ (function () {
487
+ function FormHeaderComponent() {
488
+ this.goBackEvent = new core.EventEmitter();
489
+ }
490
+ FormHeaderComponent.prototype.goBackForm = function () {
491
+ this.goBackEvent.emit();
492
+ };
493
+ return FormHeaderComponent;
494
+ }());
495
+ FormHeaderComponent.decorators = [
496
+ { type: core.Component, args: [{
497
+ selector: 'lib-form-header',
498
+ template: "<ng-content></ng-content>"
499
+ },] }
500
+ ];
501
+ FormHeaderComponent.propDecorators = {
502
+ formManager: [{ type: core.Input }],
503
+ goBackAction: [{ type: core.Input }],
504
+ showTitle: [{ type: core.Input }],
505
+ headerActions: [{ type: core.Input }],
506
+ goBackEvent: [{ type: core.Output }]
507
+ };
508
+
509
+ var SectionComponent = /** @class */ (function () {
510
+ function SectionComponent() {
511
+ }
512
+ SectionComponent.prototype.ngOnInit = function () {
513
+ this.start();
514
+ };
515
+ SectionComponent.prototype.start = function () { };
516
+ return SectionComponent;
517
+ }());
518
+ SectionComponent.decorators = [
519
+ { type: core.Component, args: [{
520
+ selector: 'lib-section',
521
+ template: "<ng-content></ng-content>"
522
+ },] }
523
+ ];
524
+ SectionComponent.propDecorators = {
525
+ sectionObject: [{ type: core.Input }],
526
+ formManager: [{ type: core.Input }]
527
+ };
528
+
529
+ var SubSectionComponent = /** @class */ (function () {
530
+ function SubSectionComponent() {
531
+ }
532
+ SubSectionComponent.prototype.ngOnInit = function () {
533
+ this.start();
534
+ };
535
+ SubSectionComponent.prototype.start = function () { };
536
+ return SubSectionComponent;
537
+ }());
538
+ SubSectionComponent.decorators = [
539
+ { type: core.Component, args: [{
540
+ selector: 'lib-subsection',
541
+ template: "<ng-content></ng-content>"
542
+ },] }
543
+ ];
544
+ SubSectionComponent.propDecorators = {
545
+ subSection: [{ type: core.Input }],
546
+ showHeader: [{ type: core.Input }],
547
+ formManager: [{ type: core.Input }]
548
+ };
549
+
550
+ var FieldSearch = /** @class */ (function () {
551
+ function FieldSearch(filterDefinition) {
552
+ this.fieldCode = filterDefinition.fieldCode;
553
+ this.fieldAlias = filterDefinition.fieldAlias || filterDefinition.fieldCode;
554
+ this.fieldTitle = filterDefinition.fieldTitle;
555
+ this.fieldTypeCode = filterDefinition.fieldTypeCode;
556
+ this.operators = filterDefinition.operators;
557
+ this.alignment = filterDefinition.alignment;
558
+ this.format = filterDefinition.format;
559
+ }
560
+ return FieldSearch;
561
+ }());
562
+ var Filter = /** @class */ (function () {
563
+ function Filter() {
564
+ this.filterModeSimple = true;
565
+ this.advancedFilter = [];
566
+ this.simpleFilterWords = [];
567
+ }
568
+ return Filter;
569
+ }());
570
+
571
+ var NO_ERROR = '00';
572
+ var HEADER$1 = 'HEADER';
599
573
  var elementTypes = {
600
574
  action: 'ACTION',
601
575
  field: 'FIELD',
@@ -961,13 +935,13 @@
961
935
  _this._recordSelectionTrigger = new rxjs.Subject();
962
936
  _this._selectionActionTrigger = new rxjs.Subject();
963
937
  _this._getDataTrigger = new rxjs.Subject();
938
+ _this._attributeChange = new rxjs.Subject();
964
939
  _this.tableRecordObj = {};
965
940
  _this._tableColumnObj = {};
966
941
  _this._actionsObj = {};
967
942
  _this.allSelected = false;
968
943
  _this.elementType = elementTypes.table;
969
944
  _this.waiting = false;
970
- _this.complexFilter = false;
971
945
  _this.currentPage = 1;
972
946
  _this.totalPages = 1;
973
947
  _this.requestedPage = 1;
@@ -975,26 +949,29 @@
975
949
  _this._tableColumnObj = {};
976
950
  _this._actions = [];
977
951
  _this._actionsObj = {};
978
- _this.filterConfig = [];
979
- _this.filterObject = new Filter();
980
952
  _this.tableRecords = [];
981
- _this.tableCode = tableReceived.tableCode;
953
+ _this.setAttr('allSelected', false);
954
+ _this.setAttr('filterObject', new Filter());
955
+ _this.setAttr('filterConfig', []);
956
+ _this.setAttr('tableCode', tableReceived.tableCode);
982
957
  _this.tableTitle = tableReceived.tableTitle;
983
- _this.clientPaging = (_a = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.clientPaging) !== null && _a !== void 0 ? _a : true;
984
- _this.simpleFilter = (_b = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.simpleFilter) !== null && _b !== void 0 ? _b : false;
958
+ _this.setAttr('clientPaging', (_a = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.clientPaging) !== null && _a !== void 0 ? _a : true);
959
+ _this.setAttr('simpleFilter', (_b = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.simpleFilter) !== null && _b !== void 0 ? _b : false);
960
+ _this.setAttr('complexFilter', false);
985
961
  _this._appendPages = (_c = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.append) !== null && _c !== void 0 ? _c : false;
986
962
  _this.selectable = (_d = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.selectable) !== null && _d !== void 0 ? _d : false;
987
- _this.selectionBackend = (_e = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.selectionBackend) !== null && _e !== void 0 ? _e : false;
963
+ _this.setAttr('selectionBackend', (_e = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.selectionBackend) !== null && _e !== void 0 ? _e : false);
988
964
  _this.customAttributes = (_f = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.customAttributes) !== null && _f !== void 0 ? _f : {};
989
- _this.sortable = (_g = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.sortable) !== null && _g !== void 0 ? _g : false;
990
- _this.sorting = { columnName: '', direction: '' };
991
- _this.recordsPerPage = formConfig.defaultRecordsPerPage;
965
+ _this.setAttr('sortable', (_g = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.sortable) !== null && _g !== void 0 ? _g : false);
966
+ _this.setAttr('sorting', { columnName: '', direction: '' });
967
+ _this.setAttr('recordsPerPage', formConfig.defaultRecordsPerPage);
992
968
  if (tableReceived.fields) {
969
+ var columns = [];
993
970
  try {
994
971
  for (var _l = __values(tableReceived.fields), _m = _l.next(); !_m.done; _m = _l.next()) {
995
972
  var columnReceived = _m.value;
996
973
  var columnDefinition = new RecordTableColumn(columnReceived, _this._formConfig);
997
- _this.columns.push(columnDefinition);
974
+ columns.push(columnDefinition);
998
975
  _this._tableColumnObj[columnDefinition.fieldCode] = columnDefinition;
999
976
  }
1000
977
  }
@@ -1005,6 +982,7 @@
1005
982
  }
1006
983
  finally { if (e_1) throw e_1.error; }
1007
984
  }
985
+ _this.setAttr('columns', columns);
1008
986
  }
1009
987
  if (tableReceived.actions) {
1010
988
  var tableActions = tableReceived.actions.map(function (objDef) {
@@ -1037,12 +1015,13 @@
1037
1015
  }
1038
1016
  }
1039
1017
  if (tableReceived.filters && tableReceived.filters.length > 0) {
1040
- _this.complexFilter = true;
1018
+ _this.setAttr('complexFilter', true);
1019
+ var filterConfig = _this.filterConfig;
1041
1020
  try {
1042
1021
  for (var _o = __values(tableReceived.filters), _p = _o.next(); !_p.done; _p = _o.next()) {
1043
1022
  var filterReceived = _p.value;
1044
1023
  var filterItem = new FieldSearch(filterReceived);
1045
- _this.filterConfig.push(filterItem);
1024
+ filterConfig.push(filterItem);
1046
1025
  }
1047
1026
  }
1048
1027
  catch (e_3_1) { e_3 = { error: e_3_1 }; }
@@ -1052,6 +1031,7 @@
1052
1031
  }
1053
1032
  finally { if (e_3) throw e_3.error; }
1054
1033
  }
1034
+ _this.setAttr('filterConfig', filterConfig);
1055
1035
  }
1056
1036
  if (_this.selectable) {
1057
1037
  _this.selectionField = _this.columns
@@ -1084,6 +1064,11 @@
1084
1064
  enumerable: false,
1085
1065
  configurable: true
1086
1066
  });
1067
+ Object.defineProperty(RecordTable.prototype, "attributeChange", {
1068
+ get: function () { return this._attributeChange; },
1069
+ enumerable: false,
1070
+ configurable: true
1071
+ });
1087
1072
  Object.defineProperty(RecordTable.prototype, "hasActions", {
1088
1073
  get: function () { return (this._actions.length > 0); },
1089
1074
  enumerable: false,
@@ -1113,6 +1098,12 @@
1113
1098
  enumerable: false,
1114
1099
  configurable: true
1115
1100
  });
1101
+ RecordTable.prototype.setAttr = function (name, value) {
1102
+ this[name] = value;
1103
+ if (this._formConfig.monitoredTableAttributes.includes(name)) {
1104
+ this._attributeChange.next({ name: name, value: value });
1105
+ }
1106
+ };
1116
1107
  RecordTable.prototype.appendRecords = function (records) { this.setTableRecords(records, true); };
1117
1108
  RecordTable.prototype.replaceRecords = function (records) { this.setTableRecords(records, false); };
1118
1109
  RecordTable.prototype.columnDefinition = function (fieldCode) { return this._tableColumnObj[fieldCode]; };
@@ -1180,11 +1171,11 @@
1180
1171
  this.tableRecordObj = {};
1181
1172
  };
1182
1173
  RecordTable.prototype.selectAll = function () {
1183
- this.allSelected = true;
1174
+ this.setAttr('allSelected', true);
1184
1175
  this.tableRecords.forEach(function (record) { return record.select(); });
1185
1176
  };
1186
1177
  RecordTable.prototype.unSelectAll = function () {
1187
- this.allSelected = false;
1178
+ this.setAttr('allSelected', false);
1188
1179
  this.tableRecords.forEach(function (record) { return record.unselect(); });
1189
1180
  };
1190
1181
  RecordTable.prototype.setTableRecords = function (tableRecords, append) {
@@ -1218,21 +1209,24 @@
1218
1209
  RecordTable.prototype.updateVisibleRecords = function () {
1219
1210
  var _this = this;
1220
1211
  if (!this.clientPaging || !this.tableRecords || this.tableRecords.length === 0) {
1221
- this.visibleRecords = this.tableRecords;
1212
+ this.setAttr('visibleRecords', this.tableRecords);
1222
1213
  }
1223
- this.visibleRecords = (this.filterObject.filterModeSimple)
1214
+ var recordsVisible = (this.filterObject.filterModeSimple)
1224
1215
  ? this.tableRecords.filter(function (record) { return record.hasPattern(_this.filterObject.simpleFilterWords); })
1225
1216
  : this.tableRecords.filter(function (record) { return record.hasCondition(_this.filterObject.advancedFilter); });
1217
+ this.setAttr('visibleRecords', recordsVisible);
1226
1218
  };
1227
1219
  RecordTable.prototype.updateFromServer = function (tableReceived) {
1228
1220
  this.visible = (tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.visible) || true;
1229
- this.currentPage = parseInt(tableReceived.currentPage, 10) || 1;
1221
+ this.setAttr('currentPage', parseInt(tableReceived.currentPage, 10) || 1);
1230
1222
  this.totalPages = tableReceived.totalPages || 1;
1231
- this.recordsPerPage = tableReceived.recordsPerPage;
1223
+ this.setAttr('recordsPerPage', tableReceived.recordsPerPage);
1232
1224
  this.recordsNumber = tableReceived.recordsNumber;
1233
- this.totalRecordsNumber = tableReceived.totalRecordsNumber;
1234
- this.sorting.columnName = tableReceived.sortingColumn || '';
1235
- this.sorting.direction = tableReceived.sortingDirection || '';
1225
+ this.setAttr('totalRecordsNumber', tableReceived.totalRecordsNumber);
1226
+ this.setAttr('sorting', {
1227
+ columnName: tableReceived.sortingColumn || '',
1228
+ direction: tableReceived.sortingDirection || ''
1229
+ });
1236
1230
  this.requestedPage = 1;
1237
1231
  this.waiting = false;
1238
1232
  this.clean();
@@ -1327,16 +1321,15 @@
1327
1321
  // Ordenamiento
1328
1322
  RecordTable.prototype.setRequiredOrder = function (columnField) {
1329
1323
  if (columnField !== this.sorting.columnName) {
1330
- this.sorting.columnName = columnField;
1331
- this.sorting.direction = TABLE_SORT_ASCENDING;
1324
+ this.setAttr('sorting', {
1325
+ columnName: columnField,
1326
+ direction: TABLE_SORT_ASCENDING
1327
+ });
1332
1328
  }
1333
1329
  else {
1334
- if (this.sorting.direction === TABLE_SORT_ASCENDING) {
1335
- this.sorting.direction = TABLE_SORT_DESCENDING;
1336
- }
1337
- else {
1338
- this.sorting.direction = TABLE_SORT_ASCENDING;
1339
- }
1330
+ var tableSort = this.sorting;
1331
+ tableSort.direction = (tableSort.direction === TABLE_SORT_ASCENDING) ? TABLE_SORT_DESCENDING : TABLE_SORT_ASCENDING;
1332
+ this.setAttr('sorting', tableSort);
1340
1333
  }
1341
1334
  };
1342
1335
  RecordTable.prototype.localSortData = function () {
@@ -1520,15 +1513,30 @@
1520
1513
  this.hasActions = false;
1521
1514
  }
1522
1515
  LibTableComponent.prototype.ngOnInit = function () {
1523
- var _a;
1524
- this.formConfig = (_a = this.tableObject) === null || _a === void 0 ? void 0 : _a._formConfig;
1525
- this.tableFieldStyles = this.formConfig.tableFieldStyles;
1526
- this.selectable = this.tableObject.selectable;
1527
- this.hasActions = this.tableObject.hasActions;
1528
- this.tableObject.widget = this;
1529
- this.inlineActions = this.tableObject.getActions(this.formConfig.tableActions.inline);
1530
- this.globalActions = this.tableObject.getActions(this.formConfig.tableActions.global);
1531
- this.selectionActions = this.tableObject.getActions(this.formConfig.tableActions.selection);
1516
+ var _this = this;
1517
+ var _a, _b;
1518
+ if (this.tableObject) {
1519
+ this.formConfig = (_a = this.tableObject) === null || _a === void 0 ? void 0 : _a._formConfig;
1520
+ this.tableFieldStyles = this.formConfig.tableFieldStyles;
1521
+ this.selectable = this.tableObject.selectable;
1522
+ this.hasActions = this.tableObject.hasActions;
1523
+ this.tableObject.widget = this;
1524
+ this.inlineActions = this.tableObject.getActions(this.formConfig.tableActions.inline);
1525
+ this.globalActions = this.tableObject.getActions(this.formConfig.tableActions.global);
1526
+ this.selectionActions = this.tableObject.getActions(this.formConfig.tableActions.selection);
1527
+ // Inicialización de campos mapeados del objeto
1528
+ var mapping = Object.entries(this.formConfig.componentTableAttrMap);
1529
+ for (var index = 0; index < mapping.length; index++) {
1530
+ var _c = __read(mapping[index], 2), tableAttr = _c[0], compAttr = _c[1];
1531
+ this[compAttr.toString()] = (_b = this.tableObject) === null || _b === void 0 ? void 0 : _b[tableAttr.toString()];
1532
+ }
1533
+ // Subscripción a cambios en atributos
1534
+ this.tableObject.attributeChange.subscribe(function (event) {
1535
+ var tableAttr = event.name, value = event.value;
1536
+ var compAttr = _this.formConfig.componentTableAttrMap[tableAttr];
1537
+ _this.hasOwnProperty(compAttr) && (_this[compAttr] = value);
1538
+ });
1539
+ }
1532
1540
  this.start();
1533
1541
  };
1534
1542
  LibTableComponent.prototype.start = function () { };
@@ -1543,23 +1551,23 @@
1543
1551
  };
1544
1552
  LibTableComponent.prototype.tableColumnSort = function (columnFieldCode) {
1545
1553
  this.tableObject.setRequiredOrder(columnFieldCode);
1546
- if (this.tableObject.clientPaging) {
1554
+ if (this.clientPaging) {
1547
1555
  return this.tableObject.localSortData();
1548
1556
  }
1549
1557
  this.tableObject.notifyGetDataAction();
1550
1558
  };
1551
1559
  LibTableComponent.prototype.changePage = function (requestedPage) {
1552
- if (!this.tableObject.clientPaging) {
1560
+ if (!this.clientPaging) {
1553
1561
  this.tableObject.notifyGetDataAction(requestedPage);
1554
1562
  }
1555
1563
  };
1556
1564
  Object.defineProperty(LibTableComponent.prototype, "records", {
1557
1565
  get: function () {
1558
- var currentPageRecords = this.tableObject.records;
1559
- if (this.tableObject.clientPaging && currentPageRecords && currentPageRecords.length > 0) {
1560
- this.tableObject.totalRecordsNumber = currentPageRecords.length;
1566
+ var currentPageRecords = this.visibleRecords;
1567
+ if (this.clientPaging && currentPageRecords && currentPageRecords.length > 0) {
1568
+ this.totalRecordsNumber = currentPageRecords.length;
1561
1569
  return currentPageRecords.map(function (record, i) { return (Object.assign({ id: i + 1 }, record)); })
1562
- .slice((this.tableObject.currentPage - 1) * this.tableObject.recordsPerPage, (this.tableObject.currentPage - 1) * this.tableObject.recordsPerPage + this.tableObject.recordsPerPage);
1570
+ .slice((this.currentPage - 1) * this.recordsPerPage, (this.currentPage - 1) * this.recordsPerPage + this.recordsPerPage);
1563
1571
  }
1564
1572
  return currentPageRecords;
1565
1573
  },
@@ -1571,8 +1579,8 @@
1571
1579
  var triggerDataUpdate = false;
1572
1580
  if (eventType === TABLE_FILTER_TYPES.simpleFilterChange || eventType === TABLE_FILTER_TYPES.simpleFilterFinish) {
1573
1581
  this.tableObject.simpleFilterText = tableFilterEvent.simpleFilterString.trim();
1574
- if (this.tableObject.clientPaging) {
1575
- this.tableObject.currentPage = 1;
1582
+ if (this.clientPaging) {
1583
+ this.tableObject.setAttr('currentPage', 1);
1576
1584
  this.tableObject.updateVisibleRecords();
1577
1585
  }
1578
1586
  else if (eventType === TABLE_FILTER_TYPES.simpleFilterFinish) {
@@ -1597,13 +1605,27 @@
1597
1605
  this.tableObject.notifyRecordSelection(recordId);
1598
1606
  };
1599
1607
  LibTableComponent.prototype.toggleSelectAll = function () {
1600
- if (this.tableObject.allSelected) {
1608
+ if (this.allSelected) {
1601
1609
  this.tableObject.unSelectAll();
1602
1610
  }
1603
1611
  else {
1604
1612
  this.tableObject.selectAll();
1605
1613
  }
1606
1614
  };
1615
+ Object.defineProperty(LibTableComponent.prototype, "availableFilters", {
1616
+ get: function () {
1617
+ return this.tableObject.availableFilters;
1618
+ },
1619
+ enumerable: false,
1620
+ configurable: true
1621
+ });
1622
+ Object.defineProperty(LibTableComponent.prototype, "selectedRecords", {
1623
+ get: function () {
1624
+ return this.tableObject.selectedRecords;
1625
+ },
1626
+ enumerable: false,
1627
+ configurable: true
1628
+ });
1607
1629
  return LibTableComponent;
1608
1630
  }());
1609
1631
  LibTableComponent.decorators = [
@@ -1861,7 +1883,7 @@
1861
1883
  return RecordFormSection;
1862
1884
  }());
1863
1885
 
1864
- var HEADER$1 = 'HEADER';
1886
+ var HEADER = 'HEADER';
1865
1887
  var FormAction = /** @class */ (function (_super) {
1866
1888
  __extends(FormAction, _super);
1867
1889
  function FormAction(actionDefinition, formConfig) {
@@ -1874,7 +1896,7 @@
1874
1896
  _this.actionCode = actionDefinition.actionCode ? actionDefinition.actionCode.toString() : '';
1875
1897
  _this.actionName = actionDefinition.actionTitle;
1876
1898
  _this.iconName = actionDefinition.iconName || _this.actionCode;
1877
- _this.location = actionDefinition.position || HEADER$1;
1899
+ _this.location = actionDefinition.position || HEADER;
1878
1900
  _this.backend = (_a = actionDefinition === null || actionDefinition === void 0 ? void 0 : actionDefinition.serverAction) !== null && _a !== void 0 ? _a : false;
1879
1901
  _this.newState = actionDefinition === null || actionDefinition === void 0 ? void 0 : actionDefinition.newState;
1880
1902
  _this.customAttributes = (_b = actionDefinition === null || actionDefinition === void 0 ? void 0 : actionDefinition.customAttributes) !== null && _b !== void 0 ? _b : null;
@@ -2097,11 +2119,12 @@
2097
2119
  if (editable === void 0) { editable = true; }
2098
2120
  (editable) ? this.enable() : this.disable();
2099
2121
  };
2100
- FieldDescriptor.prototype.hasError = function () { return this.errorCode !== '00'; };
2122
+ FieldDescriptor.prototype.hasError = function () { return this.errorCode !== NO_ERROR; };
2123
+ FieldDescriptor.prototype.resetError = function () { (this.errorCode !== NO_ERROR) && this.setError(NO_ERROR, null); };
2101
2124
  FieldDescriptor.prototype.setError = function (code, message, type) {
2102
2125
  if (type === void 0) { type = DEFAULT_ERROR_TYPE; }
2103
- this.setAttr(fldAttr.errorCode, code !== null && code !== void 0 ? code : '00');
2104
- this.setAttr(fldAttr.errorType, (this.errorCode === '00') ? '' : type);
2126
+ this.setAttr(fldAttr.errorCode, code !== null && code !== void 0 ? code : NO_ERROR);
2127
+ this.setAttr(fldAttr.errorType, (this.errorCode === NO_ERROR) ? '' : type);
2105
2128
  this.setAttr(fldAttr.errorMessage, message !== null && message !== void 0 ? message : '');
2106
2129
  };
2107
2130
  FieldDescriptor.prototype.getError = function () { return { type: this.errorType, code: this.errorCode, message: this.errorMessage }; };
@@ -2150,20 +2173,20 @@
2150
2173
  for (var index = 0; index < fieldKeys.length; index++) {
2151
2174
  var attrName = fieldKeys[index];
2152
2175
  var attrValue = fld[attrName];
2153
- (attrName === this._formConfig.apifieldattrs.visible) && this.setVisibility(attrValue);
2154
- (attrName === this._formConfig.apifieldattrs.labelVisible) && this.setVisibleLabel(fld.visibleLabel);
2155
- (attrName === this._formConfig.apifieldattrs.required) && this.setAttr(fldAttr.required, (_a = fld.required) !== null && _a !== void 0 ? _a : false);
2156
- (attrName === this._formConfig.apifieldattrs.errorCode) && this.setAttr(fldAttr.errorCode, fld.errorCode);
2157
- (attrName === this._formConfig.apifieldattrs.errorMessage) && this.setAttr(fldAttr.errorMessage, fld.errorMessage);
2158
- (attrName === this._formConfig.apifieldattrs.tooltip) && this.setAttr(fldAttr.tooltipText, fld.tooltip);
2159
- (attrName === this._formConfig.apifieldattrs.info) && this.setAttr(fldAttr.info, fld.info);
2160
- (attrName === this._formConfig.apifieldattrs.editable) && this.setEditable(fld.editable);
2161
- (attrName === this._formConfig.apifieldattrs.title) && this.setLabel(fld.fieldTitle.toString());
2162
- (attrName === this._formConfig.apifieldattrs.value) && (this.setValue(fld._fieldValue) && this.setChanged(false));
2163
- (attrName === this._formConfig.apifieldattrs.options) && this.setFieldOptions(fld.fieldOptions);
2164
- (attrName === this._formConfig.apifieldattrs.captureType) && this.setAttr(fldAttr.captureType, fld.captureType || 'INPUT');
2165
- (attrName === this._formConfig.apifieldattrs.type) && this.setFieldType(fld.fieldTypeCode);
2166
- (attrName === this._formConfig.apifieldattrs.maxLength) && this.setAttr(fldAttr.maxLength, fld.maxLength);
2176
+ (attrName === this._formConfig.apiFieldAttrs.visible) && this.setVisibility(attrValue);
2177
+ (attrName === this._formConfig.apiFieldAttrs.labelVisible) && this.setVisibleLabel(fld.visibleLabel);
2178
+ (attrName === this._formConfig.apiFieldAttrs.required) && this.setAttr(fldAttr.required, (_a = fld.required) !== null && _a !== void 0 ? _a : false);
2179
+ (attrName === this._formConfig.apiFieldAttrs.errorCode) && this.setAttr(fldAttr.errorCode, fld.errorCode);
2180
+ (attrName === this._formConfig.apiFieldAttrs.errorMessage) && this.setAttr(fldAttr.errorMessage, fld.errorMessage);
2181
+ (attrName === this._formConfig.apiFieldAttrs.tooltip) && this.setAttr(fldAttr.tooltipText, fld.tooltip);
2182
+ (attrName === this._formConfig.apiFieldAttrs.info) && this.setAttr(fldAttr.info, fld.info);
2183
+ (attrName === this._formConfig.apiFieldAttrs.editable) && this.setEditable(fld.editable);
2184
+ (attrName === this._formConfig.apiFieldAttrs.title) && this.setLabel(fld.fieldTitle.toString());
2185
+ (attrName === this._formConfig.apiFieldAttrs.value) && (this.setValue(fld.fieldValue) && this.setChanged(false));
2186
+ (attrName === this._formConfig.apiFieldAttrs.options) && this.setFieldOptions(fld.fieldOptions);
2187
+ (attrName === this._formConfig.apiFieldAttrs.captureType) && this.setAttr(fldAttr.captureType, fld.captureType || 'INPUT');
2188
+ (attrName === this._formConfig.apiFieldAttrs.type) && this.setFieldType(fld.fieldTypeCode);
2189
+ (attrName === this._formConfig.apiFieldAttrs.maxLength) && this.setAttr(fldAttr.maxLength, fld.maxLength);
2167
2190
  }
2168
2191
  };
2169
2192
  FieldDescriptor.prototype.setFieldType = function (inputFieldType) {
@@ -2301,8 +2324,6 @@
2301
2324
  return FieldDescriptor;
2302
2325
  }(FormElement));
2303
2326
 
2304
- var HEADER = 'HEADER';
2305
- var NO_ERROR = '00';
2306
2327
  var FormStructureAndData = /** @class */ (function () {
2307
2328
  function FormStructureAndData(definitionReceived, formConfig) {
2308
2329
  var e_1, _d, e_2, _e, e_3, _f, e_4, _g;
@@ -2551,7 +2572,7 @@
2551
2572
  return this._actions;
2552
2573
  };
2553
2574
  FormStructureAndData.prototype.getHeaderActions = function () {
2554
- return this._actions.filter(function (actionItem) { return actionItem.location === HEADER; });
2575
+ return this._actions.filter(function (actionItem) { return actionItem.location === HEADER$1; });
2555
2576
  };
2556
2577
  FormStructureAndData.prototype.getFieldObject = function (elementId) {
2557
2578
  return (this._fieldsObj && elementId && this._fieldsObj[elementId])
@@ -3085,8 +3106,6 @@
3085
3106
  }
3086
3107
  // Métodos virtuales para las aplicaciones
3087
3108
  LibFormManagerService.prototype.getFormDefinition = function (formCode) { };
3088
- LibFormManagerService.prototype.getFormRoute = function (formCode) { };
3089
- LibFormManagerService.prototype.getRouteForm = function (path) { };
3090
3109
  LibFormManagerService.prototype.execServerAction = function (actionDetail) { };
3091
3110
  LibFormManagerService.prototype.goToForm = function (formCode, token, subject) { };
3092
3111
  LibFormManagerService.prototype.loadStack = function () { };
@@ -3427,41 +3446,6 @@
3427
3446
  target.extra = (_h = target === null || target === void 0 ? void 0 : target.extra) !== null && _h !== void 0 ? _h : {};
3428
3447
  this.formManagerService.openForm(origin, target);
3429
3448
  };
3430
- /**
3431
- * @deprecated Este método ya no debería ser utilizado. Use openForm con el nombre del formulario
3432
- */
3433
- BasicFormComponent.prototype.goToPage = function (navigationArray, predefinedFields, options) {
3434
- if (options === void 0) { options = null; }
3435
- var _a;
3436
- var origin = null;
3437
- var cleanStack = (_a = options === null || options === void 0 ? void 0 : options.cleanStack) !== null && _a !== void 0 ? _a : false;
3438
- if (!cleanStack) {
3439
- origin = {
3440
- name: this.name,
3441
- url: this._formRoute,
3442
- token: this.controlToken,
3443
- fields: this.inputDataFields,
3444
- extra: this.extraData
3445
- };
3446
- }
3447
- var target = {
3448
- name: this.formManagerService.getRouteForm(navigationArray === null || navigationArray === void 0 ? void 0 : navigationArray[0]),
3449
- url: navigationArray === null || navigationArray === void 0 ? void 0 : navigationArray[0],
3450
- state: navigationArray === null || navigationArray === void 0 ? void 0 : navigationArray[1],
3451
- subject: navigationArray === null || navigationArray === void 0 ? void 0 : navigationArray[2],
3452
- fields: predefinedFields,
3453
- extra: null,
3454
- };
3455
- this.formManagerService.openForm(origin, target);
3456
- };
3457
- /**
3458
- * @deprecated Este método ya no debería ser utilizado. Use openForm con el nombre del formulario
3459
- */
3460
- BasicFormComponent.prototype.goToNewPage = function (nav, flds) { return this.goToPage(nav, flds, { cleanStack: true }); };
3461
- /**
3462
- * @deprecated Este método ya no debería ser utilizado. Use openForm con el nombre del formulario
3463
- */
3464
- BasicFormComponent.prototype.goToSubPage = function (nav, flds) { return this.goToPage(nav, flds, { cleanStack: false }); };
3465
3449
  BasicFormComponent.prototype.canGoBack = function () { return this.originToken !== null; };
3466
3450
  BasicFormComponent.prototype.goBack = function () { return this.formManagerService.backTo(); };
3467
3451
  BasicFormComponent.prototype.goBackForm = function () { return this.goBack(); };
@@ -3507,7 +3491,8 @@
3507
3491
  this.controlToken = (_a = params === null || params === void 0 ? void 0 : params[TOKEN]) !== null && _a !== void 0 ? _a : null;
3508
3492
  var _j = this.formManagerService.getFormInfo(this.controlToken), token = _j.token, subject = _j.subject, state = _j.state, fields = _j.fields, extra = _j.extra, originToken = _j.originToken;
3509
3493
  if (!this.controlToken || this.controlToken !== token) {
3510
- console.log("No se obtuvo un token v\u00E1lido para abrir el formulario " + this.controlToken + "->" + token);
3494
+ console.log("No se obtuvo un token v\u00E1lido para abrir el formulario " + this.name + ":" + this.controlToken + "->" + token);
3495
+ return;
3511
3496
  }
3512
3497
  this.formSubject = (_c = (_b = params === null || params === void 0 ? void 0 : params[SUBJECT]) !== null && _b !== void 0 ? _b : subject) !== null && _c !== void 0 ? _c : null;
3513
3498
  this.inputDataFields = fields;
@@ -3622,7 +3607,7 @@
3622
3607
  this.errorDetail = recordResponse.errorDetail;
3623
3608
  };
3624
3609
  BasicFormComponent.prototype.errorOccured = function () {
3625
- return (this.errorCode !== '00');
3610
+ return (this.errorCode !== NO_ERROR);
3626
3611
  };
3627
3612
  BasicFormComponent.prototype.changeState = function (state) { return this.formStructure.changeState(state); };
3628
3613
  BasicFormComponent.prototype.changeFormMode = function (state) { return this.changeState(state); };
@@ -3643,7 +3628,7 @@
3643
3628
  formData: this.formStructure.getPayload(),
3644
3629
  immutableData: this.formStructure.immutableData,
3645
3630
  };
3646
- this.errorCode = '00';
3631
+ this.errorCode = NO_ERROR;
3647
3632
  this.errorMessage = '';
3648
3633
  this.errorDetail = '';
3649
3634
  this.inServerProcess = true;
@@ -3994,8 +3979,7 @@
3994
3979
  if (!fieldToValidate) {
3995
3980
  return [2 /*return*/, false];
3996
3981
  }
3997
- fieldToValidate.setErrorMessage('');
3998
- fieldToValidate.setErrorCode('00');
3982
+ fieldToValidate.resetError();
3999
3983
  validationCallbacks = this.fieldInputValidation[fieldCode];
4000
3984
  if (!validationCallbacks) return [3 /*break*/, 2];
4001
3985
  clientValidationPromises = [];
@@ -4034,8 +4018,7 @@
4034
4018
  if (!fieldToValidate || !intrinsicValidation) {
4035
4019
  return [2 /*return*/];
4036
4020
  }
4037
- fieldToValidate.setErrorMessage('');
4038
- fieldToValidate.setErrorCode('00');
4021
+ fieldToValidate.resetError();
4039
4022
  validationCallbacks = this.fieldValidationsStart[fieldCode];
4040
4023
  if (!validationCallbacks) return [3 /*break*/, 2];
4041
4024
  clientValidationPromises = [];