tuain-ng-forms-lib 17.0.0 → 17.1.0

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 (28) hide show
  1. package/esm2022/lib/classes/forms/action.mjs +66 -40
  2. package/esm2022/lib/classes/forms/element.mjs +8 -3
  3. package/esm2022/lib/classes/forms/field.mjs +81 -71
  4. package/esm2022/lib/classes/forms/section.mjs +51 -39
  5. package/esm2022/lib/classes/forms/subsection.mjs +45 -27
  6. package/esm2022/lib/classes/forms/table/table.mjs +124 -82
  7. package/esm2022/lib/components/elements/action.component.mjs +29 -19
  8. package/esm2022/lib/components/elements/field.component.mjs +56 -69
  9. package/esm2022/lib/components/elements/layout/piece.component.mjs +43 -19
  10. package/esm2022/lib/components/elements/layout/section.component.mjs +21 -13
  11. package/esm2022/lib/components/elements/layout/sub-section.component.mjs +21 -13
  12. package/esm2022/lib/components/elements/tables/table-record-action.component.mjs +13 -8
  13. package/esm2022/lib/components/elements/tables/table.component.mjs +38 -35
  14. package/fesm2022/tuain-ng-forms-lib.mjs +581 -423
  15. package/fesm2022/tuain-ng-forms-lib.mjs.map +1 -1
  16. package/lib/classes/forms/action.d.ts +30 -14
  17. package/lib/classes/forms/field.d.ts +9 -4
  18. package/lib/classes/forms/section.d.ts +18 -6
  19. package/lib/classes/forms/subsection.d.ts +28 -10
  20. package/lib/classes/forms/table/table.d.ts +63 -21
  21. package/lib/components/elements/action.component.d.ts +8 -1
  22. package/lib/components/elements/field.component.d.ts +21 -15
  23. package/lib/components/elements/layout/piece.component.d.ts +8 -4
  24. package/lib/components/elements/layout/section.component.d.ts +1 -0
  25. package/lib/components/elements/layout/sub-section.component.d.ts +1 -0
  26. package/lib/components/elements/tables/table-record-action.component.d.ts +1 -0
  27. package/lib/components/elements/tables/table.component.d.ts +12 -5
  28. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Component, Input, EventEmitter, Output, ChangeDetectionStrategy, NgModule } from '@angular/core';
2
+ import { signal, computed, Component, Input, EventEmitter, Output, ChangeDetectionStrategy, NgModule } from '@angular/core';
3
3
  import { BehaviorSubject, Subject, ReplaySubject } from 'rxjs';
4
4
  import yn from 'yn';
5
5
  import { nanoid } from 'nanoid';
@@ -7,33 +7,57 @@ import { CommonModule } from '@angular/common';
7
7
  import { RouterModule } from '@angular/router';
8
8
  import { FormsModule } from '@angular/forms';
9
9
 
10
- const CUSTOM_ATTRIBUTES = 'customAttributes';
10
+ const CUSTOM_ATTRIBUTES$6 = 'customAttributes';
11
11
  class PieceComponent {
12
12
  form;
13
13
  formConfig;
14
- visible = true;
15
- disabled = false;
16
- customAttributes = {};
14
+ visible = signal(false);
15
+ disabled = signal(false);
16
+ enabled = computed(() => !this.disabled());
17
+ customAttributes = signal({});
17
18
  setForm(form) { this.form = form; }
18
- defaultProcessAttributeChange(attribute, value) {
19
- if (!attribute || attribute.trim() === '') {
20
- return false;
19
+ propagatedAttributeChange(attribute, value) { }
20
+ updatePieceAttribute(signaledAttributes, signaledAttribute, value) {
21
+ if (!signaledAttributes.includes(signaledAttribute)) {
22
+ return;
21
23
  }
22
- const attributeParts = attribute.split('.');
23
- if (attributeParts?.length > 1) {
24
- const [attributeType, subAttribute] = attributeParts;
25
- if (attributeType === CUSTOM_ATTRIBUTES) {
26
- this.customAttributes[subAttribute] = value;
27
- this.customAttributeChange(subAttribute, value);
28
- }
24
+ this[signaledAttribute]?.set(value);
25
+ this.propagatedAttributeChange(signaledAttribute, value);
26
+ }
27
+ updatePieceAttributes(piece, signaledAttributes) {
28
+ if (!piece) {
29
+ return;
29
30
  }
30
- else {
31
- this[attribute] = value;
31
+ // Se recore el conjunto de los atributos propagados desde el piece y se asigna el valor respectivo
32
+ for (let index = 0; index < signaledAttributes.length; index++) {
33
+ const signaledAttribute = signaledAttributes[index];
34
+ try {
35
+ this[signaledAttribute]?.set(piece?.[signaledAttribute]);
36
+ this.propagatedAttributeChange(signaledAttribute, piece?.[signaledAttribute]);
37
+ }
38
+ catch (e) {
39
+ console.log(`Señal ${signaledAttribute} invalida en el componente. ${e}`);
40
+ }
32
41
  }
33
- return true;
34
42
  }
35
- customProcessAttributeChange(attribute, value) { }
43
+ // Función que las subclases pueden sobrecargar para manejar un comportamiento específico
36
44
  customAttributeChange(subAttribute, value) { }
45
+ updateCustomAttribute(attrName, attrValue) {
46
+ this.customAttributes.update(oldCustomAttr => {
47
+ oldCustomAttr[attrName] = attrValue;
48
+ return oldCustomAttr;
49
+ });
50
+ // Ejecución de función personalizada ante un cambio de atributo personalizado
51
+ this.customAttributeChange(attrName, attrValue);
52
+ }
53
+ replaceCustomAttributes(customAttributes) {
54
+ this.customAttributes.set(customAttributes ?? {});
55
+ Object.keys(customAttributes).forEach(attrName => {
56
+ const attrValue = customAttributes[attrName];
57
+ // Ejecución de función personalizada ante un cambio de atributo personalizado
58
+ this.customAttributeChange(attrName, attrValue);
59
+ });
60
+ }
37
61
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: PieceComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
38
62
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: PieceComponent, selector: "lib-piece", ngImport: i0, template: `<ng-content></ng-content>`, isInline: true });
39
63
  }
@@ -63,32 +87,42 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
63
87
  type: Input
64
88
  }] } });
65
89
 
90
+ const CUSTOM_ATTRIBUTES$5 = 'customAttributes';
91
+ const signaledAttributes$5 = [
92
+ 'actionCode', 'actionName', 'iconName', 'inProgress', 'restrictedOnField', 'restrictedOnOperator',
93
+ 'restrictedOnValue', 'visible', 'disabled',
94
+ ];
66
95
  class ActionComponent extends ElementComponent {
67
- inProgress = false;
96
+ actionCode = signal(null);
97
+ actionName = signal(null);
98
+ iconName = signal(null);
99
+ inProgress = signal(false);
100
+ restrictedOnField = signal(null);
101
+ restrictedOnOperator = signal(null);
102
+ restrictedOnValue = signal(null);
68
103
  action = null;
104
+ updatePropagatedAttributes() {
105
+ this.updatePieceAttributes(this.action, signaledAttributes$5);
106
+ }
69
107
  ngOnInit() {
70
108
  if (!this.action) {
71
109
  return;
72
110
  }
111
+ this.action.widget = this;
73
112
  this.formConfig = this.action?._formConfig;
74
- const mapping = Object.entries(this.formConfig?.actionPropagateAttributes);
75
- for (let index = 0; index < mapping.length; index++) {
76
- const actionAttr = mapping[index]?.[0];
77
- const componentAttr = mapping[index]?.[1]?.toString() ?? '';
78
- if (componentAttr) {
79
- const value = this.action?.[actionAttr];
80
- this.defaultProcessAttributeChange(componentAttr, value);
81
- this.customProcessAttributeChange(componentAttr, value);
113
+ this.updatePropagatedAttributes();
114
+ this.replaceCustomAttributes(this.action?.customAttributes);
115
+ this.action?.attributeChange.subscribe(event => {
116
+ const { name: attribute, value = null } = event ?? {};
117
+ const attributeParts = attribute?.split('.') ?? [];
118
+ if (signaledAttributes$5.includes(attribute)) {
119
+ this.updatePieceAttribute(signaledAttributes$5, attribute, value);
120
+ }
121
+ else if (attributeParts?.length > 1 && attributeParts?.[0] === CUSTOM_ATTRIBUTES$5) {
122
+ const subAttribute = attributeParts?.[1] ?? null;
123
+ this.updateCustomAttribute(subAttribute, value);
82
124
  }
83
- }
84
- this.action?.attributeChange?.subscribe(event => {
85
- const { name: componentAttr, value } = event;
86
- this.defaultProcessAttributeChange(componentAttr, value);
87
- this.customProcessAttributeChange(componentAttr, value);
88
125
  });
89
- if (this.action) {
90
- this.action.widget = this;
91
- }
92
126
  this.start();
93
127
  }
94
128
  start() {
@@ -112,85 +146,76 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
112
146
  type: Input
113
147
  }] } });
114
148
 
149
+ const CUSTOM_ATTRIBUTES$4 = 'customAttributes';
150
+ const signaledAttributes$4 = ['captureType', 'errorCode', 'errorMessage', 'errorType', 'defaultValue',
151
+ 'defaultEditable', 'alignment', 'code', 'info', 'required', 'title', 'type', 'format', 'options',
152
+ 'hasChanged', 'maxLength', 'maxValue', 'minLength', 'minValue', 'onValidation', 'outputOnly',
153
+ 'placeholder', 'tooltip', 'validateOnServer', 'visibleLabel', 'visible', 'disabled',
154
+ ];
115
155
  const VALUE = 'value';
116
156
  const FOCUS = 'focus';
117
157
  class FieldComponent extends ElementComponent {
118
- // Atributos obtenidos estáticamente
119
- code = '';
120
- value;
121
- info = '';
122
- alignment = '';
123
- tooltip = '';
124
- // Atributos actualizados por subscripción
125
- minLength;
126
- maxLength;
127
- minValue;
128
- maxValue;
129
- onValidation;
130
- captureType;
131
- title;
132
- type;
133
- visibleLabel;
134
- required;
135
- options;
136
- errorType;
137
- errorCode;
138
- errorMessage;
158
+ // Atributos propagados desde el campo
159
+ captureType = signal('');
160
+ errorCode = signal('');
161
+ errorMessage = signal('');
162
+ errorType = signal('');
163
+ defaultValue = signal(null);
164
+ defaultEditable = signal(false);
165
+ alignment = signal('');
166
+ code = signal('');
167
+ info = signal(null);
168
+ required = signal(false);
169
+ title = signal('');
170
+ type = signal('');
171
+ format = signal(null);
172
+ options = signal(null);
173
+ hasChanged = signal(false);
174
+ minLength = signal(0);
175
+ maxLength = signal(0);
176
+ minValue = signal(null);
177
+ maxValue = signal(null);
178
+ onValidation = signal(false);
179
+ outputOnly = signal(false);
180
+ placeholder = signal('');
181
+ tooltip = signal('');
182
+ validateOnServer = signal(false);
183
+ visibleLabel = signal(true);
184
+ value; // Valor del componente relacionado con el campo (pueden diferir en formato y tipo)
139
185
  field = null;
186
+ updatePropagatedAttributes() {
187
+ this.updatePieceAttributes(this.field, signaledAttributes$4);
188
+ }
140
189
  ngOnInit() {
141
190
  if (!this.field) {
142
191
  return;
143
192
  }
193
+ this.field.widget = this;
144
194
  this.formConfig = this.field?._formConfig;
145
- const mapping = Object.entries(this.formConfig?.fieldPropagateAttributes);
146
- const customAttributesMapping = this.formConfig?.propagationCustomAttributes.fields ?? [];
147
- for (let index = 0; index < mapping.length; index++) {
148
- const fieldAttr = mapping[index]?.[0];
149
- const componentAttr = mapping[index]?.[1]?.toString() ?? '';
150
- if (componentAttr) {
151
- const value = this.field?.[fieldAttr];
152
- this.defaultProcessAttributeChange(componentAttr, value);
153
- this.customProcessAttributeChange(componentAttr, value);
195
+ this.updatePropagatedAttributes();
196
+ this.replaceCustomAttributes(this.field?.customAttributes);
197
+ this.field?.attributeChange.subscribe(event => {
198
+ const { name: attribute, value = null } = event ?? {};
199
+ const attributeParts = attribute?.split('.') ?? [];
200
+ if (attribute === VALUE) {
201
+ this.updateValue();
154
202
  }
155
- }
156
- // Atributos personalizados
157
- for (let index = 0; index < customAttributesMapping.length; index++) {
158
- const customAttribute = customAttributesMapping[index];
159
- if (customAttribute) {
160
- const value = this.field?.getCustomAttribute(customAttribute);
161
- const fullName = `customAttributes.${customAttribute}`;
162
- if (value) {
163
- this.defaultProcessAttributeChange(fullName, value);
164
- this.customProcessAttributeChange(fullName, value);
165
- }
203
+ else if (attribute === FOCUS) {
204
+ this.focus();
166
205
  }
167
- }
168
- // Subscripción a cambios en atributos
169
- this.field?.attributeChange.subscribe(event => {
170
- const { name: componentAttr, value = null } = event ?? {};
171
- if (componentAttr) {
172
- this.defaultProcessAttributeChange(componentAttr, value);
173
- this.customProcessAttributeChange(componentAttr, value);
206
+ else if (signaledAttributes$4.includes(attribute)) {
207
+ this.updatePieceAttribute(signaledAttributes$4, attribute, value);
208
+ }
209
+ else if (attributeParts?.length > 1 && attributeParts?.[0] === CUSTOM_ATTRIBUTES$4) {
210
+ const subAttribute = attributeParts?.[1] ?? null;
211
+ this.updateCustomAttribute(subAttribute, value);
174
212
  }
175
213
  });
176
- if (this.field) {
177
- this.field.widget = this;
178
- }
179
214
  this.start();
180
215
  }
181
- defaultProcessAttributeChange(attribute, value) {
182
- if (attribute === VALUE) {
183
- this.updateValue();
184
- }
185
- else if (attribute === FOCUS) {
186
- this.focus();
187
- }
188
- else {
189
- return super.defaultProcessAttributeChange(attribute, value);
190
- }
191
- return true;
216
+ updateValue() {
217
+ this.value = this.field?.value;
192
218
  }
193
- updateValue() { this.value = this.field?.value; }
194
219
  onInputChange() { setTimeout(() => this.field?.notifyEditionPartial(), 50); }
195
220
  onChangeContent() { setTimeout(() => this.field?.notifyEditionFinish(), 50); }
196
221
  onShowInfo(detail = null) { setTimeout(() => this.field?.notifyEditionDetailRequest(detail), 50); }
@@ -204,10 +229,6 @@ class FieldComponent extends ElementComponent {
204
229
  this.updateObject(false);
205
230
  this.onInputChange();
206
231
  }
207
- numberInputValidation(event) {
208
- const k = event.charCode;
209
- return (k > 47 && k < 58);
210
- }
211
232
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: FieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
212
233
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: FieldComponent, selector: "lib-field", inputs: { field: "field" }, usesInheritance: true, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true });
213
234
  }
@@ -263,23 +284,31 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
263
284
  type: Output
264
285
  }] } });
265
286
 
287
+ const CUSTOM_ATTRIBUTES$3 = 'customAttributes';
288
+ const signaledAttributes$3 = [
289
+ 'visible', 'disabled',
290
+ ];
266
291
  class SectionComponent extends PieceComponent {
267
292
  section;
293
+ updatePropagatedAttributes() {
294
+ this.updatePieceAttributes(this.section, signaledAttributes$3);
295
+ }
268
296
  ngOnInit() {
297
+ if (!this.section) {
298
+ return;
299
+ }
269
300
  this.formConfig = this.section?._formConfig;
270
- const mapping = this.formConfig?.sectionPropagateAttributes;
271
- for (let index = 0; index < mapping.length; index++) {
272
- const attrName = mapping[index].toString();
273
- const attributeValue = this.section?.[attrName];
274
- this.defaultProcessAttributeChange(attrName, attributeValue);
275
- this.customProcessAttributeChange(attrName, attributeValue);
276
- }
277
- // Subscripción a cambios en atributos
301
+ this.updatePropagatedAttributes();
302
+ this.replaceCustomAttributes(this.section?.customAttributes);
278
303
  this.section?.attributeChange.subscribe(event => {
279
- const { name: attrName, value = null } = event ?? {};
280
- if (attrName) {
281
- this.defaultProcessAttributeChange(attrName, value);
282
- this.customProcessAttributeChange(attrName, value);
304
+ const { name: attribute, value = null } = event ?? {};
305
+ const attributeParts = attribute?.split('.') ?? [];
306
+ if (signaledAttributes$3.includes(attribute)) {
307
+ this.updatePieceAttribute(signaledAttributes$3, attribute, value);
308
+ }
309
+ else if (attributeParts?.length > 1 && attributeParts?.[0] === CUSTOM_ATTRIBUTES$3) {
310
+ const subAttribute = attributeParts?.[1] ?? null;
311
+ this.updateCustomAttribute(subAttribute, value);
283
312
  }
284
313
  });
285
314
  this.start();
@@ -300,23 +329,31 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
300
329
  type: Input
301
330
  }] } });
302
331
 
332
+ const CUSTOM_ATTRIBUTES$2 = 'customAttributes';
333
+ const signaledAttributes$2 = [
334
+ 'visible', 'disabled',
335
+ ];
303
336
  class SubSectionComponent extends PieceComponent {
304
337
  subSection;
338
+ updatePropagatedAttributes() {
339
+ this.updatePieceAttributes(this.subSection, signaledAttributes$2);
340
+ }
305
341
  ngOnInit() {
342
+ if (!this.subSection) {
343
+ return;
344
+ }
306
345
  this.formConfig = this.subSection?._formConfig;
307
- const mapping = this.formConfig?.subSectionPropagateAttributes;
308
- for (let index = 0; index < mapping.length; index++) {
309
- const attrName = mapping[index].toString();
310
- const attributeValue = this.subSection?.[attrName];
311
- this.defaultProcessAttributeChange(attrName, attributeValue);
312
- this.customProcessAttributeChange(attrName, attributeValue);
313
- }
314
- // Subscripción a cambios en atributos
346
+ this.updatePropagatedAttributes();
347
+ this.replaceCustomAttributes(this.subSection?.customAttributes);
315
348
  this.subSection?.attributeChange.subscribe(event => {
316
- const { name: attrName, value = null } = event ?? {};
317
- if (attrName) {
318
- this.defaultProcessAttributeChange(attrName, value);
319
- this.customProcessAttributeChange(attrName, value);
349
+ const { name: attribute, value = null } = event ?? {};
350
+ const attributeParts = attribute?.split('.') ?? [];
351
+ if (signaledAttributes$2.includes(attribute)) {
352
+ this.updatePieceAttribute(signaledAttributes$2, attribute, value);
353
+ }
354
+ else if (attributeParts?.length > 1 && attributeParts?.[0] === CUSTOM_ATTRIBUTES$2) {
355
+ const subAttribute = attributeParts?.[1] ?? null;
356
+ this.updateCustomAttribute(subAttribute, value);
320
357
  }
321
358
  });
322
359
  this.start();
@@ -338,21 +375,26 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
338
375
  }] } });
339
376
 
340
377
  const INLINE_ACTION$1 = 'INLINE';
378
+ const CUSTOM_ATTRIBUTES$1 = 'customAttributes';
379
+ const signaledAttributes$1 = [
380
+ 'visible', 'disabled',
381
+ ];
341
382
  class LibTableRecordActionComponent extends PieceComponent {
342
383
  isVisible = true;
343
384
  recordId;
344
385
  recordData;
345
386
  action;
346
387
  actionSelected = new EventEmitter();
388
+ updatePropagatedAttributes() {
389
+ this.updatePieceAttributes(this.action, signaledAttributes$1);
390
+ }
347
391
  ngOnInit() {
348
- this.formConfig = this.action?._formConfig;
349
- const mapping = this.formConfig?.actionPropagateAttributes;
350
- for (let index = 0; index < mapping.length; index++) {
351
- const attrName = mapping[index].toString();
352
- const attributeValue = this.action?.[attrName];
353
- this.defaultProcessAttributeChange(attrName, attributeValue);
354
- this.customProcessAttributeChange(attrName, attributeValue);
392
+ if (!this.action) {
393
+ return;
355
394
  }
395
+ this.formConfig = this.action?._formConfig;
396
+ this.updatePropagatedAttributes();
397
+ this.replaceCustomAttributes(this.action?.customAttributes);
356
398
  this.start();
357
399
  }
358
400
  start() {
@@ -430,10 +472,25 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
430
472
  type: Input
431
473
  }] } });
432
474
 
475
+ const CUSTOM_ATTRIBUTES = 'customAttributes';
476
+ const signaledAttributes = [
477
+ 'allSelected', 'code', 'globalSearch', 'globalFilterString', 'recordsPerPage', 'layout',
478
+ 'columns', 'selectedRecords', 'currentPage', 'totalRecordsNumber', 'visibleRecords',
479
+ 'visible', 'disabled',
480
+ ];
433
481
  class LibTableComponent extends ElementComponent {
434
482
  // Atributos sincronizados del objeto
435
- code;
436
- globalFilterString = '';
483
+ allSelected = signal(null);
484
+ code = signal('');
485
+ globalSearch = signal(null);
486
+ globalFilterString = signal('');
487
+ recordsPerPage = signal(null);
488
+ layout = signal(null);
489
+ columns = signal(null);
490
+ selectedRecords = signal(null);
491
+ currentPage = signal(null);
492
+ totalRecordsNumber = signal(null);
493
+ visibleRecords = signal(null);
437
494
  tableFieldStyles;
438
495
  loaded = false;
439
496
  selectable = false;
@@ -442,7 +499,6 @@ class LibTableComponent extends ElementComponent {
442
499
  globalActions;
443
500
  selectionActions;
444
501
  table = null;
445
- visibleRecords = [];
446
502
  waiting = false;
447
503
  ngOnInit() {
448
504
  if (!this.table) {
@@ -451,51 +507,42 @@ class LibTableComponent extends ElementComponent {
451
507
  this.table.setWidget(this);
452
508
  this.formConfig = this.table?._formConfig;
453
509
  this.tableFieldStyles = this.formConfig?.tableFieldStyles;
454
- this.selectable = this.table?.selectable;
510
+ this.selectable = this.table?._selectable;
455
511
  this.hasActions = this.table?.hasActions();
456
512
  this.inlineActions = this.table?.getActions(this.formConfig?.tableActions.inline);
457
513
  this.globalActions = this.table?.getActions(this.formConfig?.tableActions.global);
458
514
  this.selectionActions = this.table?.getActions(this.formConfig?.tableActions.selection);
459
- // Inicialización de campos mapeados del objeto
460
- const mapping = Object.entries(this.formConfig?.tablePropagationAttributes);
461
- for (let index = 0; index < mapping.length; index++) {
462
- const tableAttr = mapping[index]?.[0];
463
- const componentAttr = mapping[index]?.[1]?.toString() ?? '';
464
- const attributeValue = this.table?.[tableAttr];
465
- this.defaultProcessAttributeChange(componentAttr, attributeValue);
466
- this.customProcessAttributeChange(componentAttr, attributeValue);
467
- }
468
- // Subscripción a cambios en atributos
515
+ this.updatePropagatedAttributes();
516
+ this.replaceCustomAttributes(this.table?.customAttributes);
469
517
  this.table?.attributeChange.subscribe(event => {
470
- const { name: attrName, value = null } = event ?? {};
471
- if (attrName) {
472
- this.defaultProcessAttributeChange(attrName, value);
473
- this.customProcessAttributeChange(attrName, value);
518
+ const { name: attribute, value = null } = event ?? {};
519
+ const attributeParts = attribute?.split('.') ?? [];
520
+ if (attribute === 'visibleRecords') {
521
+ this.updateTableData();
522
+ }
523
+ else if (signaledAttributes.includes(attribute)) {
524
+ this.updatePieceAttribute(signaledAttributes, attribute, value);
525
+ }
526
+ else if (attributeParts?.length > 1 && attributeParts?.[0] === CUSTOM_ATTRIBUTES) {
527
+ const subAttribute = attributeParts?.[1] ?? null;
528
+ this.updateCustomAttribute(subAttribute, value);
474
529
  }
475
530
  });
476
531
  this.start();
477
532
  }
533
+ updatePropagatedAttributes() {
534
+ this.updatePieceAttributes(this.table, signaledAttributes);
535
+ }
478
536
  updateTableData() { }
479
537
  tableGlobalAction(actionCode) { this.table?.notifyGlobalAction(actionCode); }
480
538
  tableSelectionAction(actionCode) { this.table?.notifySelectionAction(actionCode); }
481
539
  tableActionSelected(actionEvent) { this.table?.notifyInlineAction(actionEvent); }
482
540
  tableSelectionToggle(recordId) { this.table?.notifyRecordSelection(recordId); }
483
- toggleSelectAll() { return (this.table?.allSelected) ? this.table?.unSelectAll() : this.table?.selectAll(); }
541
+ toggleSelectAll() { return (this.table?._allSelected) ? this.table?.unSelectAll() : this.table?.selectAll(); }
484
542
  globalFilterCompleted() { this.changePage(1); }
485
543
  changePage(requestedPage) { this.table?.changePage(requestedPage); }
486
544
  tableColumnSort(columnName, direction = null) { this.table?.sort(columnName, direction ?? 'ascend'); }
487
545
  globalFilterChanged() { this.table?.setGlobalFilterString(this.globalFilterString?.trim() ?? '', false); }
488
- defaultProcessAttributeChange(attribute, value) {
489
- try {
490
- if (attribute === 'visibleRecords') {
491
- this.updateTableData();
492
- }
493
- return super.defaultProcessAttributeChange(attribute, value);
494
- }
495
- catch {
496
- return false;
497
- }
498
- }
499
546
  filterHasChanged(column, values) {
500
547
  if (!values || values.length === 0) {
501
548
  this.table?.removeColumnFilter(column.fieldCode);
@@ -505,7 +552,7 @@ class LibTableComponent extends ElementComponent {
505
552
  }
506
553
  }
507
554
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: LibTableComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
508
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: LibTableComponent, selector: "lib-table", inputs: { table: "table", visibleRecords: "visibleRecords", waiting: "waiting" }, usesInheritance: true, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
555
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: LibTableComponent, selector: "lib-table", inputs: { table: "table", waiting: "waiting" }, usesInheritance: true, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
509
556
  }
510
557
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: LibTableComponent, decorators: [{
511
558
  type: Component,
@@ -516,8 +563,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
516
563
  }]
517
564
  }], propDecorators: { table: [{
518
565
  type: Input
519
- }], visibleRecords: [{
520
- type: Input
521
566
  }], waiting: [{
522
567
  type: Input
523
568
  }] } });
@@ -719,8 +764,13 @@ class FormElement extends FormPiecePropagate {
719
764
  }
720
765
  setAttr(attr, value) {
721
766
  const { name: attrName, propagate: name } = attr;
722
- this[attrName] = value;
723
- name && this.propagateAttribute(name, value);
767
+ try {
768
+ this[attrName] = value;
769
+ name && this.propagateAttribute(name, value);
770
+ }
771
+ catch (e) {
772
+ console.log(`Atributo ${attrName} no presente o valor ${value} inconsistente. ${e}`);
773
+ }
724
774
  }
725
775
  isField() { return this.elementType === elementTypes.field; }
726
776
  isAction() { return this.elementType === elementTypes.action; }
@@ -728,60 +778,84 @@ class FormElement extends FormPiecePropagate {
728
778
  }
729
779
 
730
780
  const HEADER = 'HEADER';
781
+ const attrs$2 = {
782
+ actionCode: { name: '_actionCode', propagate: 'actionCode' },
783
+ actionName: { name: '_actionName', propagate: 'actionName' },
784
+ iconName: { name: '_iconName', propagate: 'iconName' },
785
+ inProgress: { name: '_inProgress', propagate: 'inProgress' },
786
+ restrictedOnField: { name: '_restrictedOnField', propagate: 'restrictedOnField' },
787
+ restrictedOnOperator: { name: '_restrictedOnOperator', propagate: 'restrictedOnOperator' },
788
+ restrictedOnValue: { name: '_restrictedOnValue', propagate: 'restrictedOnValue' },
789
+ };
731
790
  class FormAction extends FormElement {
732
791
  _actionActivated = new Subject();
733
- actionCode;
734
- actionName;
735
- iconName;
736
- inProgress = false;
737
- newState;
738
- backend;
739
- restrictedOnField = null;
740
- restrictedOnOperator = null;
741
- restrictedOnValue = null;
742
- customValidation;
792
+ _actionCode = '';
793
+ _actionName = '';
794
+ _iconName = '';
795
+ _inProgress = false;
796
+ _newState;
797
+ _backend;
798
+ _restrictedOnField = null;
799
+ _restrictedOnOperator = null;
800
+ _restrictedOnValue = null;
743
801
  constructor(actionDefinition, formConfig) {
744
802
  super(actionDefinition, formConfig);
745
803
  this.propagationCustomAttributes = this._formConfig?.propagationCustomAttributes?.actions ?? [];
746
804
  this.elementType = elementTypes.action;
747
- this.actionCode = actionDefinition.actionCode ? actionDefinition.actionCode.toString() : '';
748
- this.actionName = actionDefinition.actionTitle;
749
- this.iconName = actionDefinition.iconName || this.actionCode;
805
+ this.setAttr(attrs$2.actionCode, actionDefinition.actionCode ? actionDefinition.actionCode.toString() : '');
806
+ this.setAttr(attrs$2.actionName, actionDefinition.actionTitle);
807
+ this.setAttr(attrs$2.iconName, actionDefinition.iconName || this._actionCode);
808
+ this.setAttr(attrs$2.restrictedOnField, actionDefinition.fieldRestrictedCode?.toString() ?? null);
809
+ if (this._restrictedOnField) {
810
+ this.setAttr(attrs$2.restrictedOnOperator, actionDefinition.operatorRestricted || '');
811
+ this.setAttr(attrs$2.restrictedOnValue, actionDefinition.valueRestricted ?? '');
812
+ }
813
+ this._backend = actionDefinition?.serverAction ?? false;
814
+ this._newState = actionDefinition?.newState;
750
815
  this.setCustomAttribute('location', actionDefinition.position || HEADER);
751
- this.backend = actionDefinition?.serverAction ?? false;
752
- this.newState = actionDefinition?.newState;
753
- this.restrictedOnField = actionDefinition.fieldRestrictedCode?.toString() ?? null;
754
- if (this.restrictedOnField) {
755
- this.restrictedOnOperator = actionDefinition.operatorRestricted || '';
756
- this.restrictedOnValue = actionDefinition.valueRestricted ?? '';
757
- }
758
- this.customValidation = () => true;
759
816
  }
817
+ get actionCode() { return this._actionCode; }
818
+ get actionName() { return this._actionName; }
819
+ get iconName() { return this._iconName; }
820
+ get inProgress() { return this._inProgress; }
821
+ get newState() { return this._newState; }
822
+ get backend() { return this._backend; }
823
+ get restrictedOnField() { return this._restrictedOnField; }
824
+ get restrictedOnOperator() { return this._restrictedOnOperator; }
825
+ get restrictedOnValue() { return this._restrictedOnValue; }
826
+ set actionCode(actionCode) { this.setAttr(attrs$2.actionCode, actionCode); }
827
+ set actionName(actionName) { this.setAttr(attrs$2.actionName, actionName); }
828
+ set iconName(iconName) { this.setAttr(attrs$2.iconName, iconName); }
829
+ set inProgress(inProgress) { this.setAttr(attrs$2.inProgress, inProgress); }
830
+ set newState(newState) { this._newState, newState; }
831
+ set backend(backend) { this._backend, backend; }
832
+ set restrictedOnField(restrictedOnField) { this.setAttr(attrs$2.restrictedOnField, restrictedOnField); }
833
+ set restrictedOnOperator(restrictedOnOperator) { this.setAttr(attrs$2.restrictedOnOperator, restrictedOnOperator); }
834
+ set restrictedOnValue(restrictedOnValue) { this.setAttr(attrs$2.restrictedOnValue, restrictedOnValue); }
835
+ start() { this.inProgress = true; }
836
+ stop() { this.inProgress = false; }
760
837
  connectWithParentForm(form, formChangeSubject) {
761
838
  super.connectWithParentForm(form, formChangeSubject);
762
- if (this.restrictedOnField) {
763
- const relatedField = this._form.fields?.[this.restrictedOnField];
839
+ if (this._restrictedOnField) {
840
+ const relatedField = this._form.fields?.[this._restrictedOnField];
764
841
  if (relatedField) {
765
- relatedField.editionFinish.subscribe(event => this.updateRestrictedVisibility());
766
- relatedField.editionPartial.subscribe(event => this.updateRestrictedVisibility());
842
+ relatedField.editionFinish.subscribe(event => this.updateRestrictedVisibility(event));
843
+ relatedField.editionPartial.subscribe(event => this.updateRestrictedVisibility(event));
767
844
  }
768
845
  }
769
846
  }
770
- updateRestrictedVisibility() {
771
- const lastVisible = this._visible;
847
+ updateRestrictedVisibility(event) {
772
848
  const newVisible = this._absoluteVisible && this.viewOnState(this._formState);
773
- if (lastVisible !== newVisible) {
774
- this.setVisibility(newVisible);
775
- }
849
+ (this._visible !== newVisible) && this.setVisibility(newVisible);
776
850
  }
777
851
  viewOnState(state) {
778
852
  const actionVisible = (this.visibleStates && state) ? this.visibleStates.includes(state) : false;
779
- if (actionVisible && this._form && this.restrictedOnField) {
780
- const relatedField = this._form.fields?.[this.restrictedOnField];
853
+ if (actionVisible && this._form && this._restrictedOnField) {
854
+ const relatedField = this._form.fields?.[this._restrictedOnField];
781
855
  if (relatedField) {
782
856
  const fieldValue = relatedField.value;
783
- if ((this.restrictedOnOperator === '==' && fieldValue !== this.restrictedOnValue)
784
- || (this.restrictedOnOperator === '!=' && fieldValue === this.restrictedOnValue)) {
857
+ if ((this._restrictedOnOperator === '==' && fieldValue !== this._restrictedOnValue)
858
+ || (this._restrictedOnOperator === '!=' && fieldValue === this._restrictedOnValue)) {
785
859
  return false;
786
860
  }
787
861
  }
@@ -789,17 +863,19 @@ class FormAction extends FormElement {
789
863
  return actionVisible;
790
864
  }
791
865
  get actionActivated() { return this._actionActivated; }
792
- start() { this.inProgress = true; }
793
- stop() { this.inProgress = false; }
794
- notifyActivation() { this._actionActivated.next(this.actionCode); }
866
+ notifyActivation() { this._actionActivated.next(this._actionCode); }
795
867
  updateFromServer(receivedAction) {
796
868
  for (const propertyName in receivedAction) {
797
869
  if (propertyName !== 'actionCode' && propertyName !== 'actionId') {
798
- this[propertyName] = receivedAction[propertyName];
870
+ try {
871
+ this[propertyName] = receivedAction[propertyName];
872
+ }
873
+ catch (e) {
874
+ console.log(`Error actualizando la propiedad ${propertyName} de la acción ${this.actionCode}. ${e}`);
875
+ }
799
876
  }
800
877
  }
801
878
  }
802
- setCustomValidation(callback) { this.customValidation = () => callback(); }
803
879
  }
804
880
 
805
881
  const UNDEFINED = 'undefined';
@@ -815,34 +891,34 @@ const directChanges = [
815
891
  'options', 'placeholder',
816
892
  ];
817
893
  const attrs$1 = {
818
- _captureType: { name: '_captureType', propagate: 'captureType' },
819
- _errorCode: { name: '_errorCode', propagate: 'errorCode' },
820
- _errorMessage: { name: '_errorMessage', propagate: 'errorMessage' },
821
- _errorType: { name: '_errorType', propagate: 'errorType' },
822
- _defaultValue: { name: '_defaultValue', propagate: 'defaultValue' },
823
- _defaultEditable: { name: '_defaultEditable', propagate: 'defaultEditable' },
824
- _fieldAlignment: { name: '_fieldAlignment', propagate: 'alignment' },
825
- fieldCode: { name: 'fieldCode', propagate: 'code' },
826
- _fieldInfo: { name: '_fieldInfo', propagate: 'info' },
827
- _fieldRequired: { name: '_fieldRequired', propagate: 'required' },
828
- _fieldTitle: { name: '_fieldTitle', propagate: 'title' },
829
- _fieldType: { name: '_fieldType', propagate: 'type' },
830
- _fieldFormat: { name: '_fieldFormat', propagate: 'format' },
831
- fieldOptions: { name: 'fieldOptions', propagate: 'options' },
832
- _focus: { name: '_focus', propagate: 'focus' },
833
- _hasChanged: { name: '_hasChanged', propagate: 'hasChanged' },
834
- _intrinsicErrorMessage: { name: '_intrinsicErrorMessage', propagate: null },
835
- _maxLength: { name: '_maxLength', propagate: 'maxLength' },
836
- _maxValue: { name: '_maxValue', propagate: 'maxValue' },
837
- _minLength: { name: '_minLength', propagate: 'minLength' },
838
- _minValue: { name: '_minValue', propagate: 'minValue' },
839
- _onValidation: { name: '_onValidation', propagate: 'onValidation' },
840
- _outputOnly: { name: '_outputOnly', propagate: 'outputOnly' },
841
- _placeholder: { name: '_placeholder', propagate: 'placeholder' },
842
- _tooltipText: { name: '_tooltipText', propagate: 'tooltip' },
843
- _validateOnServer: { name: '_validateOnServer', propagate: 'validateOnServer' },
844
- _value: { name: '_value', propagate: 'value' },
845
- _visibleLabel: { name: '_visibleLabel', propagate: 'visibleLabel' },
894
+ captureType: { name: '_captureType', propagate: 'captureType' },
895
+ errorCode: { name: '_errorCode', propagate: 'errorCode' },
896
+ errorMessage: { name: '_errorMessage', propagate: 'errorMessage' },
897
+ errorType: { name: '_errorType', propagate: 'errorType' },
898
+ defaultValue: { name: '_defaultValue', propagate: 'defaultValue' },
899
+ defaultEditable: { name: '_defaultEditable', propagate: 'defaultEditable' },
900
+ fieldAlignment: { name: '_fieldAlignment', propagate: 'alignment' },
901
+ fieldCode: { name: '_fieldCode', propagate: 'code' },
902
+ fieldInfo: { name: '_fieldInfo', propagate: 'info' },
903
+ fieldRequired: { name: '_fieldRequired', propagate: 'required' },
904
+ fieldTitle: { name: '_fieldTitle', propagate: 'title' },
905
+ fieldType: { name: '_fieldType', propagate: 'type' },
906
+ fieldFormat: { name: '_fieldFormat', propagate: 'format' },
907
+ fieldOptions: { name: '_fieldOptions', propagate: 'options' },
908
+ focus: { name: '_focus', propagate: 'focus' },
909
+ hasChanged: { name: '_hasChanged', propagate: 'hasChanged' },
910
+ intrinsicErrorMessage: { name: '_intrinsicErrorMessage', propagate: null },
911
+ maxLength: { name: '_maxLength', propagate: 'maxLength' },
912
+ maxValue: { name: '_maxValue', propagate: 'maxValue' },
913
+ minLength: { name: '_minLength', propagate: 'minLength' },
914
+ minValue: { name: '_minValue', propagate: 'minValue' },
915
+ onValidation: { name: '_onValidation', propagate: 'onValidation' },
916
+ outputOnly: { name: '_outputOnly', propagate: 'outputOnly' },
917
+ placeholder: { name: '_placeholder', propagate: 'placeholder' },
918
+ tooltipText: { name: '_tooltipText', propagate: 'tooltip' },
919
+ validateOnServer: { name: '_validateOnServer', propagate: 'validateOnServer' },
920
+ value: { name: '_value', propagate: 'value' },
921
+ visibleLabel: { name: '_visibleLabel', propagate: 'visibleLabel' },
846
922
  };
847
923
  class FieldDescriptor extends FormElement {
848
924
  _editionFinish = new Subject();
@@ -875,15 +951,15 @@ class FieldDescriptor extends FormElement {
875
951
  _outputOnly = false;
876
952
  _tooltipText = '';
877
953
  _placeholder = '';
878
- fieldCode = '';
879
- fieldOptions = null;
954
+ _fieldCode = '';
955
+ _fieldOptions = null;
880
956
  constructor(inputFieldReceived, formConfig) {
881
957
  super(inputFieldReceived, formConfig);
882
958
  this.propagationCustomAttributes = this._formConfig?.propagationCustomAttributes?.fields ?? [];
883
959
  this.elementType = elementTypes.field;
884
960
  const fld = (inputFieldReceived) ? inputFieldReceived : {};
885
961
  this.setAttr(attrs$1.fieldCode, fld.fieldCode);
886
- this.title = fld.fieldTitle ?? this.fieldCode;
962
+ this.title = fld.fieldTitle ?? this._fieldCode;
887
963
  this.placeholder = fld.placeholder ?? this.title;
888
964
  this.type = fld.fieldTypeCode;
889
965
  this.captureType = fld.captureType ?? DEFAULT_CAPTURE_TYPE;
@@ -901,7 +977,12 @@ class FieldDescriptor extends FormElement {
901
977
  this.info = fld.info || '';
902
978
  let fieldFormat;
903
979
  try {
904
- fieldFormat = (fld.format) ? new RegExp(fld.format) : null;
980
+ if (fld.format && typeof fld.format === 'string') {
981
+ fieldFormat = new RegExp(fld.format);
982
+ }
983
+ else if (fld.format?.regExp) {
984
+ fieldFormat = new RegExp(fld.format?.regExp);
985
+ }
905
986
  }
906
987
  catch (e) {
907
988
  fieldFormat = null;
@@ -924,17 +1005,17 @@ class FieldDescriptor extends FormElement {
924
1005
  this._setValue(fld.fieldValue ?? this._defaultValue ?? '');
925
1006
  }
926
1007
  get alignment() { return this._fieldAlignment; }
927
- set alignment(alignment) { this.setAttr(attrs$1._fieldAlignment, alignment); }
1008
+ set alignment(alignment) { this.setAttr(attrs$1.fieldAlignment, alignment); }
928
1009
  get backend() { return this._validateOnServer; }
929
1010
  get captureType() { return this._captureType; }
930
- set captureType(captureType) { this.setAttr(attrs$1._captureType, captureType); }
1011
+ set captureType(captureType) { this.setAttr(attrs$1.captureType, captureType); }
931
1012
  get placeholder() { return this._placeholder; }
932
- set placeholder(placeholder) { this.setAttr(attrs$1._placeholder, placeholder); }
933
- get code() { return this.fieldCode; }
1013
+ set placeholder(placeholder) { this.setAttr(attrs$1.placeholder, placeholder); }
1014
+ get code() { return this._fieldCode; }
934
1015
  get defaultValue() { return this._defaultValue; }
935
- set defaultValue(defaultValue) { this.setAttr(attrs$1._defaultValue, defaultValue); }
1016
+ set defaultValue(defaultValue) { this.setAttr(attrs$1.defaultValue, defaultValue); }
936
1017
  get defaultEditable() { return this._defaultEditable; }
937
- set defaultEditable(editable) { this.setAttr(attrs$1._defaultEditable, editable); }
1018
+ set defaultEditable(editable) { this.setAttr(attrs$1.defaultEditable, editable); }
938
1019
  get detailRequest() { return this._detailRequest; }
939
1020
  get editionFinish() { return this._editionFinish; }
940
1021
  get editionPartial() { return this._editionPartial; }
@@ -979,25 +1060,25 @@ class FieldDescriptor extends FormElement {
979
1060
  get errorType() { return this._errorType; }
980
1061
  get externalValue() { return this._externalValue; }
981
1062
  get format() { return this._fieldFormat; }
982
- set format(format) { this.setAttr(attrs$1._fieldFormat, format); }
1063
+ set format(format) { this.setAttr(attrs$1.fieldFormat, format); }
983
1064
  get hasChanged() { return this._hasChanged; }
984
- set hasChanged(hasChanged) { this.setAttr(attrs$1._hasChanged, hasChanged); }
1065
+ set hasChanged(hasChanged) { this.setAttr(attrs$1.hasChanged, hasChanged); }
985
1066
  get info() { return this._fieldInfo; }
986
- set info(newInfo) { this.setAttr(attrs$1._fieldInfo, newInfo); }
987
- set intrinsicErrorMessage(message) { this.setAttr(attrs$1._intrinsicErrorMessage, message); }
1067
+ set info(newInfo) { this.setAttr(attrs$1.fieldInfo, newInfo); }
1068
+ set intrinsicErrorMessage(message) { this.setAttr(attrs$1.intrinsicErrorMessage, message); }
988
1069
  get maxLength() { return (this._maxLength > 0) ? this._maxLength.toString() : ''; }
989
- set maxLength(requiredMaxLength) { this.setAttr(attrs$1._maxLength, requiredMaxLength ? +requiredMaxLength : null); }
1070
+ set maxLength(requiredMaxLength) { this.setAttr(attrs$1.maxLength, requiredMaxLength ? +requiredMaxLength : null); }
990
1071
  get maxValue() { return this._maxValue; }
991
1072
  set maxValue(inputMaxValue) {
992
1073
  let maxValue = inputMaxValue;
993
1074
  if (this._fieldType === this._formConfig.fieldTypes.date) {
994
1075
  maxValue = new Date(maxValue);
995
1076
  }
996
- this.setAttr(attrs$1._maxValue, maxValue);
1077
+ this.setAttr(attrs$1.maxValue, maxValue);
997
1078
  }
998
1079
  get minLength() { return this._minLength; }
999
1080
  set minLength(requiredMinLength) {
1000
- this.setAttr(attrs$1._minLength, requiredMinLength ? +requiredMinLength : null);
1081
+ this.setAttr(attrs$1.minLength, requiredMinLength ? +requiredMinLength : null);
1001
1082
  }
1002
1083
  get minValue() { return this._minValue; }
1003
1084
  set minValue(inputMinValue) {
@@ -1005,11 +1086,11 @@ class FieldDescriptor extends FormElement {
1005
1086
  if (this._fieldType === this._formConfig.fieldTypes.date) {
1006
1087
  minValue = new Date(minValue);
1007
1088
  }
1008
- this.setAttr(attrs$1._minValue, minValue);
1089
+ this.setAttr(attrs$1.minValue, minValue);
1009
1090
  }
1010
- get name() { return this.fieldCode; }
1091
+ get name() { return this._fieldCode; }
1011
1092
  get options() {
1012
- return this.fieldOptions?.map(option => {
1093
+ return this._fieldOptions?.map(option => {
1013
1094
  const optionCopy = { ...option };
1014
1095
  return optionCopy;
1015
1096
  }) ?? null;
@@ -1032,45 +1113,46 @@ class FieldDescriptor extends FormElement {
1032
1113
  this.setAttr(attrs$1.fieldOptions, fieldOptions);
1033
1114
  if (this._value) {
1034
1115
  if (this._fieldType === this._formConfig.fieldTypes.array && Array.isArray(this._value)) {
1035
- const fieldValue = this._value?.filter(item => this.fieldOptions?.find(opt => opt.fieldOptionId === item));
1036
- this.setAttr(attrs$1._value, fieldValue);
1116
+ const fieldValue = this._value?.filter(item => this._fieldOptions?.find(opt => opt.fieldOptionId === item));
1117
+ this.setAttr(attrs$1.value, fieldValue);
1037
1118
  }
1038
1119
  else {
1039
- const valInOptions = this.fieldOptions?.find(item => item.fieldOptionId === this._value);
1120
+ const valInOptions = this._fieldOptions?.find(item => item.fieldOptionId === this._value);
1040
1121
  if (!valInOptions) {
1041
1122
  this._setValue('');
1042
1123
  }
1043
1124
  }
1044
1125
  }
1045
- if (this._fieldRequired && this.fieldOptions?.length === 1 && this._value !== this.fieldOptions?.[0].fieldOptionId) {
1046
- this._setValue(this.fieldOptions?.[0].fieldOptionId);
1126
+ if (this._fieldRequired && this._fieldOptions?.length === 1 && this._value !== this._fieldOptions?.[0].fieldOptionId) {
1127
+ this._setValue(this._fieldOptions?.[0].fieldOptionId);
1047
1128
  this.notifyEditionFinish();
1048
1129
  }
1049
1130
  }
1050
- get optionText() { return this.fieldOptions?.find(item => item.fieldOptionId === this._value)?.fieldOptionValue ?? null; }
1131
+ get optionText() { return this._fieldOptions?.find(item => item.fieldOptionId === this._value)?.fieldOptionValue ?? null; }
1051
1132
  get outputOnly() { return this._outputOnly; }
1052
- set outputOnly(outputOnly) { this.setAttr(attrs$1._outputOnly, outputOnly); }
1133
+ set outputOnly(outputOnly) { this.setAttr(attrs$1.outputOnly, outputOnly); }
1053
1134
  get required() { return this._fieldRequired; }
1054
- set required(required) { this.setAttr(attrs$1._fieldRequired, required ?? false); }
1135
+ set required(required) { this.setAttr(attrs$1.fieldRequired, required ?? false); }
1055
1136
  get title() { return this._fieldTitle; }
1056
- set title(title) { this.setAttr(attrs$1._fieldTitle, title?.toString() ?? ''); }
1137
+ set title(title) { this.setAttr(attrs$1.fieldTitle, title?.toString() ?? ''); }
1057
1138
  get tooltip() { return this._tooltipText; }
1058
- set tooltip(tooltip) { this.setAttr(attrs$1._tooltipText, tooltip); }
1139
+ set tooltip(tooltip) { this.setAttr(attrs$1.tooltipText, tooltip); }
1059
1140
  get type() { return this._fieldType; }
1060
- set type(fieldType) { this.setAttr(attrs$1._fieldType, fieldType); }
1141
+ set type(fieldType) { this.setAttr(attrs$1.fieldType, fieldType); }
1142
+ get onValidation() { return this._onValidation; }
1061
1143
  get validating() { return this._onValidation; }
1062
- set validating(isValidating) { this.setAttr(attrs$1._onValidation, isValidating); }
1144
+ set validating(isValidating) { this.setAttr(attrs$1.onValidation, isValidating); }
1063
1145
  get value() {
1064
1146
  return (this._fieldType === this._formConfig.fieldTypes.boolean
1065
1147
  || this._fieldType === this._formConfig.fieldTypes.check) ? yn(this._value) : this._value;
1066
1148
  }
1067
1149
  get validateOnServer() { return this._validateOnServer; }
1068
- set validateOnServer(validateOnServer) { this.setAttr(attrs$1._validateOnServer, validateOnServer); }
1150
+ set validateOnServer(validateOnServer) { this.setAttr(attrs$1.validateOnServer, validateOnServer); }
1069
1151
  get serverAction() { return this._validateOnServer; }
1070
1152
  set serverAction(validateOnServer) { this.validateOnServer = validateOnServer; }
1071
1153
  set value(newValue) { this._setValue(newValue); }
1072
1154
  get visibleLabel() { return this._visibleLabel; }
1073
- set visibleLabel(visibleLabel) { this.setAttr(attrs$1._visibleLabel, visibleLabel); }
1155
+ set visibleLabel(visibleLabel) { this.setAttr(attrs$1.visibleLabel, visibleLabel); }
1074
1156
  /**
1075
1157
  * @deprecated Use value
1076
1158
  */
@@ -1080,7 +1162,7 @@ class FieldDescriptor extends FormElement {
1080
1162
  */
1081
1163
  changed(hasChanged = true) { this.hasChanged = hasChanged; }
1082
1164
  clean() { this._setValue(this._defaultValue || ''); this.resetError(); }
1083
- focus() { this.setAttr(attrs$1._focus, true); }
1165
+ focus() { this.setAttr(attrs$1.focus, true); }
1084
1166
  getErrorCode() { return this.error.code; }
1085
1167
  setErrorCode(code) { this.setError(code, this._errorMessage); }
1086
1168
  getErrorMessage() { return this.error.message; }
@@ -1092,6 +1174,10 @@ class FieldDescriptor extends FormElement {
1092
1174
  setEditable(editable = true) { (editable) ? this.enable() : this.disable(); }
1093
1175
  setValue(newValue, widgetUpdate = true) { this._setValue(newValue, widgetUpdate); }
1094
1176
  showLabel() { this.visibleLabel = true; }
1177
+ /**
1178
+ * @deprecated Use code
1179
+ */
1180
+ get fieldCode() { return this._fieldCode; }
1095
1181
  /**
1096
1182
  * @deprecated Use title
1097
1183
  */
@@ -1146,7 +1232,7 @@ class FieldDescriptor extends FormElement {
1146
1232
  setVisibleLabel(visibleLabel) { this.visibleLabel = visibleLabel; }
1147
1233
  notifyEditionPartial() {
1148
1234
  this.resetError();
1149
- this._editionPartial.next({ code: this.fieldCode, intrinsicValidation: true });
1235
+ this._editionPartial.next({ code: this._fieldCode, intrinsicValidation: true });
1150
1236
  }
1151
1237
  notifyEditionFinish() {
1152
1238
  const fieldValue = this.value;
@@ -1182,16 +1268,16 @@ class FieldDescriptor extends FormElement {
1182
1268
  intrinsicValidation = false;
1183
1269
  this.setError('99', `Longitud de ${this._fieldTitle} debe ser de al menos ${this._minLength}`);
1184
1270
  }
1185
- this._editionFinish.next({ code: this.fieldCode, intrinsicValidation });
1271
+ this._editionFinish.next({ code: this._fieldCode, intrinsicValidation });
1186
1272
  }
1187
1273
  notifyEditionDetailRequest(detail) {
1188
- const detailEvent = { code: this.fieldCode, detail };
1274
+ const detailEvent = { code: this._fieldCode, detail };
1189
1275
  this._detailRequest.next(detailEvent);
1190
1276
  }
1191
1277
  setError(code, message, type = DEFAULT_ERROR_TYPE) {
1192
- this.setAttr(attrs$1._errorCode, code ?? NO_ERROR);
1193
- this.setAttr(attrs$1._errorType, (this._errorCode === NO_ERROR) ? '' : type);
1194
- this.setAttr(attrs$1._errorMessage, message ?? '');
1278
+ this.setAttr(attrs$1.errorCode, code ?? NO_ERROR);
1279
+ this.setAttr(attrs$1.errorType, (this._errorCode === NO_ERROR) ? '' : type);
1280
+ this.setAttr(attrs$1.errorMessage, message ?? '');
1195
1281
  }
1196
1282
  updateFromServer(fld) {
1197
1283
  const fieldKeys = Object.keys(fld);
@@ -1246,7 +1332,7 @@ class FieldDescriptor extends FormElement {
1246
1332
  if (this._value !== newFinalValue) {
1247
1333
  this.hasChanged = true;
1248
1334
  if (widgetUpdate) {
1249
- this.setAttr(attrs$1._value, newFinalValue);
1335
+ this.setAttr(attrs$1.value, newFinalValue);
1250
1336
  }
1251
1337
  else {
1252
1338
  this._value = newFinalValue;
@@ -1514,47 +1600,47 @@ class RecordTable extends FormElement {
1514
1600
  selectedRecords;
1515
1601
  restrictedId;
1516
1602
  layout = null;
1517
- globalSearch;
1518
- tableRecords;
1519
- tableRecordObj = {};
1520
- visibleRecords = null;
1521
- columns;
1522
- selectable;
1523
- selectionBackend;
1524
- selectionField;
1525
- allSelected = false;
1526
- tableCode = '';
1527
- tableTitle;
1528
- currentPage;
1529
- totalPages;
1530
- requestedPage;
1531
- recordsPerPage = 10;
1532
- totalRecordsNumber = 0;
1533
- recordsNumber = 0;
1534
- sorting;
1535
- waiting;
1536
- clientPaging = true;
1537
- sortable;
1603
+ _globalSearch;
1604
+ _tableRecords;
1605
+ _tableRecordObj = {};
1606
+ _visibleRecords = null;
1607
+ _columns;
1608
+ _selectable;
1609
+ _selectionBackend;
1610
+ _selectionField;
1611
+ _allSelected = false;
1612
+ _tableCode = '';
1613
+ _tableTitle;
1614
+ _currentPage;
1615
+ _totalPages;
1616
+ _requestedPage;
1617
+ _recordsPerPage = 10;
1618
+ _totalRecordsNumber = 0;
1619
+ _recordsNumber = 0;
1620
+ _sorting;
1621
+ _waiting;
1622
+ _clientPaging = true;
1623
+ _sortable;
1538
1624
  constructor(tableReceived, formConfig) {
1539
1625
  super(tableReceived, formConfig);
1540
1626
  this.propagationCustomAttributes = this._formConfig?.propagationCustomAttributes?.tables ?? [];
1541
1627
  this.elementType = elementTypes.table;
1542
- this.waiting = false;
1543
- this.currentPage = 1;
1544
- this.totalPages = 1;
1545
- this.requestedPage = 1;
1546
- this.columns = [];
1628
+ this._waiting = false;
1629
+ this._currentPage = 1;
1630
+ this._totalPages = 1;
1631
+ this._requestedPage = 1;
1632
+ this._columns = [];
1547
1633
  this._tableColumnObj = {};
1548
1634
  this._actions = [];
1549
1635
  this._actionsObj = {};
1550
- this.tableRecords = [];
1551
- this.globalSearch = false;
1636
+ this._tableRecords = [];
1637
+ this._globalSearch = false;
1552
1638
  this.restrictedId = null;
1553
- this.tableTitle = tableReceived.tableTitle;
1639
+ this._tableTitle = tableReceived.tableTitle;
1554
1640
  this._appendPages = tableReceived?.append ?? false;
1555
- this.selectable = tableReceived?.selectable ?? false;
1556
- this.selectionBackend = tableReceived?.selectionBackend ?? false;
1557
- this.sortable = tableReceived?.sortable ?? false;
1641
+ this._selectable = tableReceived?.selectable ?? false;
1642
+ this._selectionBackend = tableReceived?.selectionBackend ?? false;
1643
+ this._sortable = tableReceived?.sortable ?? false;
1558
1644
  this.setAttr(attrs.allSelected, false);
1559
1645
  this.setAttr(attrs.tableCode, tableReceived.tableCode);
1560
1646
  this.setAttr(attrs.clientPaging, tableReceived?.clientPaging ?? true);
@@ -1597,7 +1683,7 @@ class RecordTable extends FormElement {
1597
1683
  this._actionsObj[inlineAction.actionCode] = inlineAction;
1598
1684
  }
1599
1685
  }
1600
- this.selectionField = (this.selectable) ? tableReceived?.selectionField : null;
1686
+ this._selectionField = (this._selectable) ? tableReceived?.selectionField : null;
1601
1687
  // Filtros predefinidos en el formulario
1602
1688
  if (tableReceived.filters) {
1603
1689
  for (let index = 0; index < tableReceived.filters.length; index++) {
@@ -1611,19 +1697,61 @@ class RecordTable extends FormElement {
1611
1697
  get selectionActionTrigger() { return this._selectionActionTrigger; }
1612
1698
  get recordSelectionTrigger() { return this._recordSelectionTrigger; }
1613
1699
  get getDataTrigger() { return this._getDataTrigger; }
1700
+ get globalSearch() { return this._globalSearch; }
1701
+ get tableRecords() { return this._tableRecords; }
1702
+ get tableRecordObj() { return this._tableRecordObj; }
1703
+ get visibleRecords() { return this._visibleRecords; }
1704
+ get columns() { return this._columns; }
1705
+ get selectable() { return this._selectable; }
1706
+ get selectionBackend() { return this._selectionBackend; }
1707
+ get selectionField() { return this._selectionField; }
1708
+ get allSelected() { return this._allSelected; }
1709
+ get tableCode() { return this._tableCode; }
1710
+ get tableTitle() { return this._tableTitle; }
1711
+ get currentPage() { return this._currentPage; }
1712
+ get totalPages() { return this._totalPages; }
1713
+ get requestedPage() { return this._requestedPage; }
1714
+ get recordsPerPage() { return this._recordsPerPage; }
1715
+ get totalRecordsNumber() { return this._totalRecordsNumber; }
1716
+ get recordsNumber() { return this._recordsNumber; }
1717
+ get sorting() { return this._sorting; }
1718
+ get waiting() { return this._waiting; }
1719
+ get clientPaging() { return this._clientPaging; }
1720
+ get sortable() { return this._sortable; }
1721
+ set globalSearch(globalSearch) { this._globalSearch = globalSearch; }
1722
+ set tableRecords(tableRecords) { this._tableRecords = tableRecords; }
1723
+ set tableRecordObj(tableRecordObj) { this._tableRecordObj = tableRecordObj; }
1724
+ set visibleRecords(visibleRecords) { this._visibleRecords = visibleRecords; }
1725
+ set columns(columns) { this._columns = columns; }
1726
+ set selectable(selectable) { this._selectable = selectable; }
1727
+ set selectionBackend(selectionBackend) { this._selectionBackend = selectionBackend; }
1728
+ set selectionField(selectionField) { this._selectionField = selectionField; }
1729
+ set allSelected(allSelected) { this._allSelected = allSelected; }
1730
+ set tableCode(tableCode) { this._tableCode = tableCode; }
1731
+ set tableTitle(tableTitle) { this._tableTitle = tableTitle; }
1732
+ set currentPage(currentPage) { this._currentPage = currentPage; }
1733
+ set totalPages(totalPages) { this._totalPages = totalPages; }
1734
+ set requestedPage(requestedPage) { this._requestedPage = requestedPage; }
1735
+ set recordsPerPage(recordsPerPage) { this._recordsPerPage = recordsPerPage; }
1736
+ set totalRecordsNumber(totalRecordsNumber) { this._totalRecordsNumber = totalRecordsNumber; }
1737
+ set recordsNumber(recordsNumber) { this._recordsNumber = recordsNumber; }
1738
+ set sorting(sorting) { this._sorting = sorting; }
1739
+ set waiting(waiting) { this._waiting = waiting; }
1740
+ set clientPaging(clientPaging) { this._clientPaging = clientPaging; }
1741
+ set sortable(sortable) { this._sortable = sortable; }
1614
1742
  getLayout() { return this.layout; }
1615
1743
  setLayout(layout) { this.setAttr(attrs.layout, layout); }
1616
1744
  hasActions() { return (this._actions.length > 0); }
1617
- getSelectedRecords() { return this.tableRecords.filter(rec => rec.selected).map(rec => rec.recordId); }
1618
- activateGlobalSearch() { this.globalSearch = true; }
1619
- inactivateGlobalSearch() { this.globalSearch = false; }
1745
+ getSelectedRecords() { return this._tableRecords.filter(rec => rec.selected).map(rec => rec.recordId); }
1746
+ activateGlobalSearch() { this._globalSearch = true; }
1747
+ inactivateGlobalSearch() { this._globalSearch = false; }
1620
1748
  columnDefinition(fieldCode) { return this._tableColumnObj[fieldCode]; }
1621
- putOnWait() { this.waiting = true; }
1622
- freeWaiting() { this.waiting = false; }
1749
+ putOnWait() { this._waiting = true; }
1750
+ freeWaiting() { this._waiting = false; }
1623
1751
  setWidget(widget) { this.widget = widget; }
1624
1752
  notifyGlobalAction(actionCode) {
1625
1753
  const tableEvent = {
1626
- tableCode: this.tableCode,
1754
+ tableCode: this._tableCode,
1627
1755
  actionCode,
1628
1756
  actionDetail: null
1629
1757
  };
@@ -1631,7 +1759,7 @@ class RecordTable extends FormElement {
1631
1759
  }
1632
1760
  notifyInlineAction(tableActionEvent) {
1633
1761
  const tableEvent = {
1634
- tableCode: this.tableCode,
1762
+ tableCode: this._tableCode,
1635
1763
  actionCode: tableActionEvent.actionCode,
1636
1764
  actionDetail: {
1637
1765
  recordId: tableActionEvent.recordId,
@@ -1646,9 +1774,9 @@ class RecordTable extends FormElement {
1646
1774
  return;
1647
1775
  }
1648
1776
  record.toggleSelect();
1649
- this.requestedPage = this.currentPage ?? 1;
1777
+ this._requestedPage = this._currentPage ?? 1;
1650
1778
  const tableEvent = {
1651
- tableCode: this.tableCode,
1779
+ tableCode: this._tableCode,
1652
1780
  actionCode: null,
1653
1781
  actionDetail: {
1654
1782
  recordId: record.recordId,
@@ -1659,7 +1787,7 @@ class RecordTable extends FormElement {
1659
1787
  }
1660
1788
  notifySelectionAction(actionCode) {
1661
1789
  const tableEvent = {
1662
- tableCode: this.tableCode,
1790
+ tableCode: this._tableCode,
1663
1791
  actionCode,
1664
1792
  actionDetail: {
1665
1793
  selectedRecords: this.selectedRecords
@@ -1669,9 +1797,9 @@ class RecordTable extends FormElement {
1669
1797
  }
1670
1798
  notifyGetDataAction(requestedPage = null) {
1671
1799
  this.updateVisibleRecords();
1672
- this.requestedPage = requestedPage || this.currentPage || 1;
1800
+ this._requestedPage = requestedPage || this._currentPage || 1;
1673
1801
  const tableEvent = {
1674
- tableCode: this.tableCode,
1802
+ tableCode: this._tableCode,
1675
1803
  actionCode: null,
1676
1804
  actionDetail: null,
1677
1805
  };
@@ -1679,49 +1807,49 @@ class RecordTable extends FormElement {
1679
1807
  return null;
1680
1808
  }
1681
1809
  clean() {
1682
- this.tableRecords = [];
1810
+ this._tableRecords = [];
1683
1811
  this.unSelectAll();
1684
- this.tableRecordObj = {};
1812
+ this._tableRecordObj = {};
1685
1813
  this.updateVisibleRecords();
1686
1814
  }
1687
1815
  selectAll() {
1688
1816
  this.setAttr(attrs.allSelected, true);
1689
- this.tableRecords.forEach(record => record.select());
1817
+ this._tableRecords.forEach(record => record.select());
1690
1818
  this.setAttr(attrs.selectedRecords, this.getSelectedRecords());
1691
1819
  return true;
1692
1820
  }
1693
1821
  unSelectAll() {
1694
1822
  this.setAttr(attrs.allSelected, false);
1695
- this.tableRecords.forEach(record => record.unselect());
1823
+ this._tableRecords.forEach(record => record.unselect());
1696
1824
  this.setAttr(attrs.selectedRecords, this.getSelectedRecords());
1697
1825
  return true;
1698
1826
  }
1699
1827
  setTableRecords(tableRecords, append) {
1700
1828
  if (!append) {
1701
- this.tableRecords = [];
1829
+ this._tableRecords = [];
1702
1830
  this.setAttr(attrs.allSelected, false);
1703
- this.tableRecords.forEach(record => record.unselect());
1831
+ this._tableRecords.forEach(record => record.unselect());
1704
1832
  this.setAttr(attrs.selectedRecords, []);
1705
- this.tableRecordObj = {};
1833
+ this._tableRecordObj = {};
1706
1834
  }
1707
- const newRecordsObj = { ...this.tableRecordObj };
1708
- const newRecords = [...this.tableRecords];
1835
+ const newRecordsObj = { ...this._tableRecordObj };
1836
+ const newRecords = [...this._tableRecords];
1709
1837
  for (const tableRecord of tableRecords) {
1710
- const recordReceived = new TableRecordData(tableRecord, this.columns, this.selectionField);
1838
+ const recordReceived = new TableRecordData(tableRecord, this._columns, this._selectionField);
1711
1839
  const recordIdKey = recordReceived.recordIdKey;
1712
1840
  newRecords.push(recordReceived);
1713
1841
  newRecordsObj[recordIdKey] = recordReceived;
1714
1842
  }
1715
- this.tableRecords = newRecords;
1843
+ this._tableRecords = newRecords;
1716
1844
  this.setAttr(attrs.selectedRecords, this.getSelectedRecords());
1717
- this.tableRecordObj = newRecordsObj;
1845
+ this._tableRecordObj = newRecordsObj;
1718
1846
  this.updateVisibleRecords();
1719
1847
  }
1720
1848
  appendRecords(records) { this.setTableRecords(records, true); }
1721
1849
  replaceRecords(records) { this.setTableRecords(records, false); }
1722
1850
  setTableAppend(append) { this._appendPages = append; }
1723
1851
  changePage(requestedPage) {
1724
- if (this.clientPaging) {
1852
+ if (this._clientPaging) {
1725
1853
  this.setAttr(attrs.currentPage, requestedPage);
1726
1854
  this.updateVisibleRecords();
1727
1855
  }
@@ -1731,25 +1859,25 @@ class RecordTable extends FormElement {
1731
1859
  }
1732
1860
  updateVisibleRecords() {
1733
1861
  let visibleRecords;
1734
- if (this.clientPaging) {
1862
+ if (this._clientPaging) {
1735
1863
  let filteredRecords = this.getFilteredRecords();
1736
1864
  this.setAttr(attrs.totalRecordsNumber, filteredRecords.length);
1737
- const sliceNumber1 = (this.currentPage - 1) * this.recordsPerPage;
1738
- const sliceNumber2 = (this.currentPage - 1) * this.recordsPerPage + this.recordsPerPage;
1865
+ const sliceNumber1 = (this._currentPage - 1) * this._recordsPerPage;
1866
+ const sliceNumber2 = (this._currentPage - 1) * this._recordsPerPage + this._recordsPerPage;
1739
1867
  visibleRecords = filteredRecords.slice(sliceNumber1, sliceNumber2);
1740
- const recordsLastPage = this.totalRecordsNumber % this.recordsPerPage;
1741
- const totalPages = Math.trunc(this.totalRecordsNumber / this.recordsPerPage + (recordsLastPage ? 1 : 0));
1742
- if (this.currentPage > totalPages) {
1743
- this.currentPage = totalPages || 1;
1868
+ const recordsLastPage = this._totalRecordsNumber % this._recordsPerPage;
1869
+ const totalPages = Math.trunc(this._totalRecordsNumber / this._recordsPerPage + (recordsLastPage ? 1 : 0));
1870
+ if (this._currentPage > totalPages) {
1871
+ this._currentPage = totalPages || 1;
1744
1872
  }
1745
1873
  }
1746
1874
  else {
1747
- visibleRecords = this.tableRecords;
1875
+ visibleRecords = this._tableRecords;
1748
1876
  }
1749
1877
  this.setAttr(attrs.visibleRecords, visibleRecords);
1750
1878
  }
1751
1879
  updateFromServer(tableReceived) {
1752
- this.requestedPage = 1;
1880
+ this._requestedPage = 1;
1753
1881
  const { visible = true, totalPages = 1, recordsNumber, currentPage = 1, recordsPerPage, totalRecordsNumber, sortingColumn, sortingDirection, tableRecords, actions, fields, } = tableReceived;
1754
1882
  this.visible = visible;
1755
1883
  if (actions) {
@@ -1797,11 +1925,11 @@ class RecordTable extends FormElement {
1797
1925
  });
1798
1926
  }
1799
1927
  if (tableRecords) {
1800
- this.totalPages = totalPages;
1801
- this.recordsNumber = recordsNumber;
1928
+ this._totalPages = totalPages;
1929
+ this._recordsNumber = recordsNumber;
1802
1930
  this.setAttr(attrs.currentPage, +currentPage);
1803
1931
  this.setAttr(attrs.recordsPerPage, +recordsPerPage);
1804
- this.setAttr(attrs.totalRecordsNumber, (this.clientPaging) ? tableRecords.length : +totalRecordsNumber);
1932
+ this.setAttr(attrs.totalRecordsNumber, (this._clientPaging) ? tableRecords.length : +totalRecordsNumber);
1805
1933
  this.setAttr(attrs.sorting, {
1806
1934
  columnName: sortingColumn || '',
1807
1935
  direction: sortingDirection || ''
@@ -1813,13 +1941,13 @@ class RecordTable extends FormElement {
1813
1941
  this.appendRecords(tableRecords);
1814
1942
  }
1815
1943
  }
1816
- this.waiting = false;
1944
+ this._waiting = false;
1817
1945
  this.updateVisibleRecords();
1818
1946
  }
1819
1947
  getTableRecord(recordId) {
1820
1948
  const recordIdKey = (typeof recordId === 'object') ? JSON.stringify(recordId) : recordId;
1821
- return (this.tableRecordObj && recordId && this.tableRecordObj[recordId])
1822
- ? this.tableRecordObj[recordId] : null;
1949
+ return (this._tableRecordObj && recordId && this._tableRecordObj[recordId])
1950
+ ? this._tableRecordObj[recordId] : null;
1823
1951
  }
1824
1952
  getAction(actionCode) {
1825
1953
  return (this._actionsObj && actionCode && this._actionsObj[actionCode])
@@ -1848,7 +1976,7 @@ class RecordTable extends FormElement {
1848
1976
  }
1849
1977
  setGlobalFilterString(text, notifyComponent = true) {
1850
1978
  this.globalFilterStrings = text.split(' ').filter(t => t && t.trim().length > 0).map(t => t.trim()) ?? [];
1851
- if (this.clientPaging) {
1979
+ if (this._clientPaging) {
1852
1980
  this.changePage(1);
1853
1981
  }
1854
1982
  if (notifyComponent) {
@@ -1860,14 +1988,14 @@ class RecordTable extends FormElement {
1860
1988
  tableColumn && tableColumn.addFilterDefinition(filterDefinition);
1861
1989
  }
1862
1990
  getFilteredRecords() {
1863
- let filteredRecords = this.tableRecords;
1991
+ let filteredRecords = this._tableRecords;
1864
1992
  if (this.restrictedId) {
1865
1993
  filteredRecords = filteredRecords.filter(record => record.recordId === this.restrictedId);
1866
1994
  }
1867
1995
  if (this.globalFilterStrings.length > 0) {
1868
1996
  filteredRecords = filteredRecords.filter(record => record.hasPattern(this.globalFilterStrings, this._tableColumnObj));
1869
1997
  }
1870
- const columnFilters = this.columns.filter(column => column.filter).map(column => column.filter);
1998
+ const columnFilters = this._columns.filter(column => column.filter).map(column => column.filter);
1871
1999
  if (columnFilters.length > 0) {
1872
2000
  filteredRecords = filteredRecords.filter(record => record.hasCondition(columnFilters));
1873
2001
  }
@@ -1896,7 +2024,7 @@ class RecordTable extends FormElement {
1896
2024
  simpleFilterWords: this.globalFilterStrings,
1897
2025
  advancedFilter: [],
1898
2026
  };
1899
- const columnFilters = this.columns.filter(column => column.filter).map(column => column.filter);
2027
+ const columnFilters = this._columns.filter(column => column.filter).map(column => column.filter);
1900
2028
  for (let index = 0; index < columnFilters.length; index++) {
1901
2029
  const columnFilter = columnFilters[index];
1902
2030
  compactFilter.advancedFilter.push({
@@ -1911,7 +2039,7 @@ class RecordTable extends FormElement {
1911
2039
  // Ordenamiento de registros local
1912
2040
  sort(columnName, direction) {
1913
2041
  this.setRequiredOrder(columnName, direction);
1914
- if (this.clientPaging) {
2042
+ if (this._clientPaging) {
1915
2043
  this.localSortData();
1916
2044
  }
1917
2045
  else {
@@ -1925,10 +2053,10 @@ class RecordTable extends FormElement {
1925
2053
  });
1926
2054
  }
1927
2055
  localSortData() {
1928
- if (!this.sorting.columnName || !this.sorting.direction) {
2056
+ if (!this._sorting.columnName || !this._sorting.direction) {
1929
2057
  return;
1930
2058
  }
1931
- this.tableRecords.sort((a, b) => this.recordCompare(a, b, this.sorting.columnName, this.sorting.direction));
2059
+ this._tableRecords.sort((a, b) => this.recordCompare(a, b, this._sorting.columnName, this._sorting.direction));
1932
2060
  //this.unSelectAll();
1933
2061
  this.updateVisibleRecords();
1934
2062
  }
@@ -1947,7 +2075,7 @@ class RecordTable extends FormElement {
1947
2075
  return direction === TABLE_SORT_ASCENDING ? result : -result;
1948
2076
  }
1949
2077
  formStateChangeCustomSubscribe(form, formChangeSubject) {
1950
- this.columns?.forEach(column => {
2078
+ this._columns?.forEach(column => {
1951
2079
  column?.connectWithParentForm(form, formChangeSubject);
1952
2080
  });
1953
2081
  this._actions?.forEach(action => {
@@ -1958,24 +2086,24 @@ class RecordTable extends FormElement {
1958
2086
 
1959
2087
  class RecordFormSubSection extends FormPiecePropagate {
1960
2088
  _customRender = null;
1961
- subsectionId = null;
1962
- subsectionCode = null;
1963
- subsectionTitle = null;
1964
- subSectionElements = [];
1965
- subSectionFields = [];
1966
- subSectionTables = [];
1967
- subSectionActions = [];
1968
- elementsArray = {};
1969
- active = false;
2089
+ _subsectionId = null;
2090
+ _subsectionCode = null;
2091
+ _subsectionTitle = null;
2092
+ _subSectionElements = [];
2093
+ _subSectionFields = [];
2094
+ _subSectionTables = [];
2095
+ _subSectionActions = [];
2096
+ _elementsArray = {};
2097
+ _active = false;
1970
2098
  constructor(subsectionReceived, formObject, formConfig) {
1971
2099
  super(subsectionReceived, formConfig);
1972
2100
  this.propagationCustomAttributes = this._formConfig?.propagationCustomAttributes?.subsections ?? [];
1973
2101
  if (!subsectionReceived) {
1974
2102
  return;
1975
2103
  }
1976
- this.subsectionId = (subsectionReceived.subsectionId) ? subsectionReceived.subsectionId.toString() : '';
1977
- this.subsectionCode = (subsectionReceived.subsectionCode) ? subsectionReceived.subsectionCode : '';
1978
- this.subsectionTitle = (subsectionReceived.subsectionTitle) ? subsectionReceived.subsectionTitle : '';
2104
+ this._subsectionId = (subsectionReceived.subsectionId) ? subsectionReceived.subsectionId.toString() : '';
2105
+ this._subsectionCode = (subsectionReceived.subsectionCode) ? subsectionReceived.subsectionCode : '';
2106
+ this._subsectionTitle = (subsectionReceived.subsectionTitle) ? subsectionReceived.subsectionTitle : '';
1979
2107
  if (subsectionReceived.elements) {
1980
2108
  for (const receivedElement of subsectionReceived.elements) {
1981
2109
  let elementObject = null;
@@ -1984,52 +2112,70 @@ class RecordFormSubSection extends FormPiecePropagate {
1984
2112
  switch (type) {
1985
2113
  case elementTypes.field:
1986
2114
  elementObject = formObject.getField(code);
1987
- arrayToAdd = this.subSectionFields;
2115
+ arrayToAdd = this._subSectionFields;
1988
2116
  break;
1989
2117
  case elementTypes.table:
1990
2118
  elementObject = formObject.getTable(code);
1991
- arrayToAdd = this.subSectionTables;
2119
+ arrayToAdd = this._subSectionTables;
1992
2120
  break;
1993
2121
  case elementTypes.action:
1994
2122
  elementObject = formObject.getAction(code);
1995
- arrayToAdd = this.subSectionActions;
2123
+ arrayToAdd = this._subSectionActions;
1996
2124
  break;
1997
2125
  }
1998
2126
  if (elementObject) {
1999
2127
  elementObject.elementType = type;
2000
2128
  arrayToAdd.push(elementObject);
2001
- this.subSectionElements.push(elementObject);
2002
- this.elementsArray[code] = elementObject;
2129
+ this._subSectionElements.push(elementObject);
2130
+ this._elementsArray[code] = elementObject;
2003
2131
  }
2004
2132
  }
2005
2133
  }
2006
2134
  }
2007
2135
  get customRender() { return this._customRender; }
2008
2136
  set customRender(customRenderName) { this._customRender = customRenderName; }
2137
+ get subsectionId() { return this._subsectionId; }
2138
+ get subsectionCode() { return this._subsectionCode; }
2139
+ get subsectionTitle() { return this._subsectionTitle; }
2140
+ get subSectionElements() { return this._subSectionElements; }
2141
+ get subSectionFields() { return this._subSectionFields; }
2142
+ get subSectionTables() { return this._subSectionTables; }
2143
+ get subSectionActions() { return this._subSectionActions; }
2144
+ get elementsArray() { return this._elementsArray; }
2145
+ get active() { return this._active; }
2146
+ set subsectionId(subsectionId) { this._subsectionId = subsectionId; }
2147
+ set subsectionCode(subsectionCode) { this._subsectionCode = subsectionCode; }
2148
+ set subsectionTitle(subsectionTitle) { this._subsectionTitle = subsectionTitle; }
2149
+ set subSectionElements(subSectionElements) { this._subSectionElements = subSectionElements; }
2150
+ set subSectionFields(subSectionFields) { this._subSectionFields = subSectionFields; }
2151
+ set subSectionTables(subSectionTables) { this._subSectionTables = subSectionTables; }
2152
+ set subSectionActions(subSectionActions) { this._subSectionActions = subSectionActions; }
2153
+ set elementsArray(elementsArray) { this._elementsArray = elementsArray; }
2154
+ set active(active) { this._active = active; }
2009
2155
  getField(name) {
2010
- return this.subSectionFields.find(fld => fld.name === name);
2156
+ return this._subSectionFields.find(fld => fld.name === name);
2011
2157
  }
2012
2158
  getFields() {
2013
- return this.subSectionFields;
2159
+ return this._subSectionFields;
2014
2160
  }
2015
2161
  getFieldNames() {
2016
- return this.subSectionFields.map(field => field.code);
2162
+ return this._subSectionFields.map(field => field.code);
2017
2163
  }
2018
2164
  getActions() {
2019
- return this.subSectionActions;
2165
+ return this._subSectionActions;
2020
2166
  }
2021
2167
  getActionNames() {
2022
- return this.subSectionActions.map(action => action.actionCode);
2168
+ return this._subSectionActions.map(action => action.actionCode);
2023
2169
  }
2024
2170
  activate() {
2025
- if (!this.active) {
2026
- this.active = true;
2171
+ if (!this._active) {
2172
+ this._active = true;
2027
2173
  // this.subsectionCode && this._activation.next(this.subsectionCode);
2028
2174
  }
2029
2175
  }
2030
2176
  inactivate() {
2031
- if (this.active) {
2032
- this.active = false;
2177
+ if (this._active) {
2178
+ this._active = false;
2033
2179
  // this.subsectionCode && this._inactivation.next(this.subsectionCode);
2034
2180
  }
2035
2181
  }
@@ -2039,12 +2185,12 @@ const ACTIVE$1 = 'active';
2039
2185
  class RecordFormSection extends FormPiecePropagate {
2040
2186
  _activation = new Subject();
2041
2187
  _inactivation = new Subject();
2042
- active = false;
2043
- sectionId = null;
2044
- sectionCode = null;
2045
- sectionTitle = null;
2046
- subSections = [];
2047
- subSectionsObj;
2188
+ _active = false;
2189
+ _sectionId = null;
2190
+ _sectionCode = null;
2191
+ _sectionTitle = null;
2192
+ _subSections = [];
2193
+ _subSectionsObj;
2048
2194
  _exclusiveSubSectionsByAttr = {};
2049
2195
  constructor(sectionReceived, formObject, formConfig) {
2050
2196
  super(sectionReceived, formConfig);
@@ -2052,11 +2198,11 @@ class RecordFormSection extends FormPiecePropagate {
2052
2198
  if (!sectionReceived) {
2053
2199
  return;
2054
2200
  }
2055
- this.sectionId = (sectionReceived.sectionId) ? sectionReceived.sectionId.toString() : '';
2056
- this.sectionCode = (sectionReceived.sectionCode) ? sectionReceived.sectionCode : '';
2057
- this.sectionTitle = (sectionReceived.sectionTitle) ? sectionReceived.sectionTitle : '';
2058
- this.subSections = [];
2059
- this.subSectionsObj = {};
2201
+ this._sectionId = (sectionReceived.sectionId) ? sectionReceived.sectionId.toString() : '';
2202
+ this._sectionCode = (sectionReceived.sectionCode) ? sectionReceived.sectionCode : '';
2203
+ this._sectionTitle = (sectionReceived.sectionTitle) ? sectionReceived.sectionTitle : '';
2204
+ this._subSections = [];
2205
+ this._subSectionsObj = {};
2060
2206
  if (sectionReceived.subsections) {
2061
2207
  const subsections = sectionReceived.subsections.map(subSecDef => {
2062
2208
  const visibleStates = subSecDef.visibleStates ?? [];
@@ -2069,42 +2215,54 @@ class RecordFormSection extends FormPiecePropagate {
2069
2215
  const subSectionToAdd = new RecordFormSubSection(subsectionReceived, formObject, formConfig);
2070
2216
  const subsectionCode = subSectionToAdd.subsectionCode;
2071
2217
  if (subsectionCode) {
2072
- this.subSections.push(subSectionToAdd);
2073
- this.subSectionsObj[subsectionCode] = subSectionToAdd;
2218
+ this._subSections.push(subSectionToAdd);
2219
+ this._subSectionsObj[subsectionCode] = subSectionToAdd;
2074
2220
  }
2075
2221
  }
2076
2222
  }
2077
2223
  }
2078
- get code() { return this.sectionCode; }
2224
+ get code() { return this._sectionCode; }
2079
2225
  get activation() { return this._activation; }
2080
2226
  get inactivation() { return this._inactivation; }
2227
+ get active() { return this._active; }
2228
+ get sectionId() { return this._sectionId; }
2229
+ get sectionCode() { return this._sectionCode; }
2230
+ get sectionTitle() { return this._sectionTitle; }
2231
+ get subSections() { return this._subSections; }
2232
+ get subSectionsObj() { return this._subSectionsObj; }
2233
+ set active(active) { this._active = active; }
2234
+ set sectionId(sectionId) { this._sectionId = sectionId; }
2235
+ set sectionCode(sectionCode) { this._sectionCode = sectionCode; }
2236
+ set sectionTitle(sectionTitle) { this._sectionTitle = sectionTitle; }
2237
+ set subSections(subSections) { this._subSections = subSections; }
2238
+ set subSectionsObj(subSectionsObj) { this._subSectionsObj = subSectionsObj; }
2081
2239
  activate() {
2082
- if (!this.active) {
2083
- this.active = true;
2084
- this.sectionCode && this._activation.next(this.sectionCode);
2240
+ if (!this._active) {
2241
+ this._active = true;
2242
+ this._sectionCode && this._activation.next(this._sectionCode);
2085
2243
  }
2086
2244
  }
2087
2245
  inactivate() {
2088
- if (this.active) {
2089
- this.active = false;
2090
- this.sectionCode && this._inactivation.next(this.sectionCode);
2246
+ if (this._active) {
2247
+ this._active = false;
2248
+ this._sectionCode && this._inactivation.next(this._sectionCode);
2091
2249
  }
2092
2250
  }
2093
- get title() { return this.sectionTitle; }
2094
- set title(title) { this.sectionTitle = title; }
2251
+ get title() { return this._sectionTitle; }
2252
+ set title(title) { this._sectionTitle = title; }
2095
2253
  getVisibleSubsections(state) {
2096
- return this.subSections.filter(subSection => subSection.visible);
2254
+ return this._subSections.filter(subSection => subSection.visible);
2097
2255
  }
2098
2256
  getSubsection(subSectionCode) {
2099
- return (this.subSectionsObj && this.subSectionsObj[subSectionCode])
2100
- ? this.subSectionsObj[subSectionCode] : null;
2257
+ return (this._subSectionsObj && this._subSectionsObj[subSectionCode])
2258
+ ? this._subSectionsObj[subSectionCode] : null;
2101
2259
  }
2102
2260
  activateSubSection(subSectionCode) {
2103
2261
  if (subSectionCode === this._exclusiveSubSectionsByAttr[ACTIVE$1]) {
2104
2262
  return;
2105
2263
  }
2106
- const subSection = (this.subSectionsObj && this.subSectionsObj[subSectionCode])
2107
- ? this.subSectionsObj[subSectionCode] : null;
2264
+ const subSection = (this._subSectionsObj && this._subSectionsObj[subSectionCode])
2265
+ ? this._subSectionsObj[subSectionCode] : null;
2108
2266
  if (subSection) {
2109
2267
  subSection?.activate();
2110
2268
  this._exclusiveSubSectionsByAttr[ACTIVE$1] = subSectionCode;
@@ -2112,8 +2270,8 @@ class RecordFormSection extends FormPiecePropagate {
2112
2270
  }
2113
2271
  getFields() {
2114
2272
  let fieldsArray = [];
2115
- if (this.subSections && this.subSections.length > 0) {
2116
- for (const subSection of this.subSections) {
2273
+ if (this._subSections && this._subSections.length > 0) {
2274
+ for (const subSection of this._subSections) {
2117
2275
  const subsectionFields = subSection.getFields() ?? [];
2118
2276
  if (subsectionFields?.length > 0) {
2119
2277
  fieldsArray = fieldsArray.concat(subsectionFields);
@@ -2124,8 +2282,8 @@ class RecordFormSection extends FormPiecePropagate {
2124
2282
  }
2125
2283
  getActions() {
2126
2284
  let actionArray = [];
2127
- if (this.subSections && this.subSections.length > 0) {
2128
- for (const subSection of this.subSections) {
2285
+ if (this._subSections && this._subSections.length > 0) {
2286
+ for (const subSection of this._subSections) {
2129
2287
  const subSectionActions = subSection.getActions() ?? [];
2130
2288
  if (subSectionActions?.length > 0) {
2131
2289
  actionArray = actionArray.concat(subSectionActions);
@@ -2136,8 +2294,8 @@ class RecordFormSection extends FormPiecePropagate {
2136
2294
  }
2137
2295
  getActionNames() {
2138
2296
  let actionArray = [];
2139
- if (this.subSections && this.subSections.length > 0) {
2140
- for (const subSection of this.subSections) {
2297
+ if (this._subSections && this._subSections.length > 0) {
2298
+ for (const subSection of this._subSections) {
2141
2299
  actionArray = actionArray.concat(subSection.getActionNames());
2142
2300
  }
2143
2301
  }
@@ -2145,8 +2303,8 @@ class RecordFormSection extends FormPiecePropagate {
2145
2303
  }
2146
2304
  getFieldNames() {
2147
2305
  let fieldsArray = [];
2148
- if (this.subSections && this.subSections.length > 0) {
2149
- for (const subSection of this.subSections) {
2306
+ if (this._subSections && this._subSections.length > 0) {
2307
+ for (const subSection of this._subSections) {
2150
2308
  fieldsArray = fieldsArray.concat(subSection.getFieldNames());
2151
2309
  }
2152
2310
  }
@@ -2154,8 +2312,8 @@ class RecordFormSection extends FormPiecePropagate {
2154
2312
  }
2155
2313
  getField(name) {
2156
2314
  let field = null;
2157
- if (this.subSections && this.subSections.length > 0) {
2158
- for (const subSection of this.subSections) {
2315
+ if (this._subSections && this._subSections.length > 0) {
2316
+ for (const subSection of this._subSections) {
2159
2317
  field = subSection.getField(name);
2160
2318
  if (field) {
2161
2319
  return field;
@@ -2165,7 +2323,7 @@ class RecordFormSection extends FormPiecePropagate {
2165
2323
  return null;
2166
2324
  }
2167
2325
  formStateChangeCustomSubscribe(form, formChangeSubject) {
2168
- this.subSections?.forEach(subsection => {
2326
+ this._subSections?.forEach(subsection => {
2169
2327
  subsection?.connectWithParentForm(form, formChangeSubject);
2170
2328
  });
2171
2329
  }