tuain-ng-forms-lib 14.4.45 → 14.4.91

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/esm2020/lib/classes/forms/element.mjs +3 -3
  2. package/esm2020/lib/classes/forms/field.mjs +5 -5
  3. package/esm2020/lib/classes/forms/form.mjs +7 -7
  4. package/esm2020/lib/classes/forms/piece-propagate.mjs +30 -0
  5. package/esm2020/lib/classes/forms/piece.mjs +26 -46
  6. package/esm2020/lib/classes/forms/section.mjs +23 -20
  7. package/esm2020/lib/classes/forms/subsection.mjs +16 -3
  8. package/esm2020/lib/classes/forms/table/column.mjs +5 -2
  9. package/esm2020/lib/classes/forms/table/row-data.mjs +14 -9
  10. package/esm2020/lib/classes/forms/table/table.mjs +17 -10
  11. package/esm2020/lib/components/elements/field.component.mjs +3 -3
  12. package/esm2020/lib/components/elements/tables/table.component.mjs +3 -27
  13. package/esm2020/lib/components/forms/basic-form.mjs +2 -2
  14. package/fesm2015/tuain-ng-forms-lib.mjs +146 -131
  15. package/fesm2015/tuain-ng-forms-lib.mjs.map +1 -1
  16. package/fesm2020/tuain-ng-forms-lib.mjs +135 -119
  17. package/fesm2020/tuain-ng-forms-lib.mjs.map +1 -1
  18. package/lib/classes/forms/element.d.ts +2 -2
  19. package/lib/classes/forms/piece-propagate.d.ts +11 -0
  20. package/lib/classes/forms/piece.d.ts +11 -13
  21. package/lib/classes/forms/section.d.ts +5 -3
  22. package/lib/classes/forms/subsection.d.ts +5 -2
  23. package/lib/classes/forms/table/column.d.ts +2 -0
  24. package/lib/classes/forms/table/row-data.d.ts +1 -1
  25. package/lib/classes/forms/table/table.d.ts +3 -2
  26. package/lib/components/elements/field.component.d.ts +1 -1
  27. package/lib/components/elements/tables/table.component.d.ts +0 -8
  28. package/package.json +1 -1
@@ -168,15 +168,14 @@ class FieldComponent extends ElementComponent {
168
168
  onChangeContent() { setTimeout(() => { var _a; return (_a = this.field) === null || _a === void 0 ? void 0 : _a.notifyEditionFinish(); }, 50); }
169
169
  onShowInfo(detail = null) { setTimeout(() => { var _a; return (_a = this.field) === null || _a === void 0 ? void 0 : _a.notifyEditionDetailRequest(detail); }, 50); }
170
170
  focus() { }
171
- updateObject() { var _a; (_a = this.field) === null || _a === void 0 ? void 0 : _a.setValue(this.value); }
171
+ updateObject(widgetUpdate = true) { var _a; (_a = this.field) === null || _a === void 0 ? void 0 : _a.setValue(this.value, widgetUpdate); }
172
172
  inputChanged() {
173
173
  var _a;
174
174
  (_a = this.field) === null || _a === void 0 ? void 0 : _a.setValue(this.value);
175
175
  this.onChangeContent();
176
176
  }
177
177
  inputTyped() {
178
- var _a;
179
- (_a = this.field) === null || _a === void 0 ? void 0 : _a.setValue(this.value);
178
+ this.updateObject(false);
180
179
  this.onInputChange();
181
180
  }
182
181
  numberInputValidation(event) {
@@ -395,18 +394,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImpor
395
394
  type: Input
396
395
  }] } });
397
396
 
398
- const changeViewAttributes = ['visibleRecords', 'currentPage', 'recordsPerPage'];
399
397
  class LibTableComponent extends ElementComponent {
400
398
  constructor() {
401
399
  super(...arguments);
402
- this.currentPage = 1;
403
- this.globalSearch = false;
404
400
  this.globalFilterString = '';
405
- // visibleRecords: any[] = [];
406
- this.selectedRecords = [];
407
- this.totalRecordsNumber = 0;
408
- this.allSelected = false;
409
- this.layout = '';
410
401
  this.loaded = false;
411
402
  this.selectable = false;
412
403
  this.hasActions = false;
@@ -427,7 +418,7 @@ class LibTableComponent extends ElementComponent {
427
418
  this.globalActions = (_g = this.table) === null || _g === void 0 ? void 0 : _g.getActions((_h = this.formConfig) === null || _h === void 0 ? void 0 : _h.tableActions.global);
428
419
  this.selectionActions = (_j = this.table) === null || _j === void 0 ? void 0 : _j.getActions((_k = this.formConfig) === null || _k === void 0 ? void 0 : _k.tableActions.selection);
429
420
  // Inicialización de campos mapeados del objeto
430
- const mapping = Object.entries((_l = this.formConfig) === null || _l === void 0 ? void 0 : _l.actionPropagateAttributes);
421
+ const mapping = Object.entries((_l = this.formConfig) === null || _l === void 0 ? void 0 : _l.tablePropagationAttributes);
431
422
  for (let index = 0; index < mapping.length; index++) {
432
423
  const tableAttr = (_m = mapping[index]) === null || _m === void 0 ? void 0 : _m[0];
433
424
  const componentAttr = (_q = (_p = (_o = mapping[index]) === null || _o === void 0 ? void 0 : _o[1]) === null || _p === void 0 ? void 0 : _p.toString()) !== null && _q !== void 0 ? _q : '';
@@ -441,30 +432,14 @@ class LibTableComponent extends ElementComponent {
441
432
  this.defaultProcessAttributeChange(attrName, value);
442
433
  this.customProcessAttributeChange(attrName, value);
443
434
  });
444
- // Suscripción a los cambios de atributos de las columnas
445
- // this.table.columns.forEach(column => {
446
- // mapping = this.formConfig?.tableColumnPropagateAttributes;
447
- // for (let index = 0; index < mapping.length; index++) {
448
- // const attrName = mapping[index].toString();
449
- // const attributeValue = column?.[attrName];
450
- // this.defaultColumnAttributeChange(column, attrName, attributeValue);
451
- // }
452
- // column?.attributeChange.subscribe(event => {
453
- // const { name: attrName, value } = event;
454
- // this.defaultColumnAttributeChange(column, attrName, value);
455
- // });
456
- // });
457
435
  this.start();
458
436
  }
459
- // defaultColumnAttributeChange(column: any, attribute: string, value?: any) {
460
- // attribute && (column[attribute] = value);
461
- // }
462
437
  updateTableData() { }
463
438
  tableGlobalAction(actionCode) { var _a; (_a = this.table) === null || _a === void 0 ? void 0 : _a.notifyGlobalAction(actionCode); }
464
439
  tableSelectionAction(actionCode) { var _a; (_a = this.table) === null || _a === void 0 ? void 0 : _a.notifySelectionAction(actionCode); }
465
440
  tableActionSelected(actionEvent) { var _a; (_a = this.table) === null || _a === void 0 ? void 0 : _a.notifyInlineAction(actionEvent); }
466
441
  tableSelectionToggle(recordId) { var _a; (_a = this.table) === null || _a === void 0 ? void 0 : _a.notifyRecordSelection(recordId); }
467
- toggleSelectAll() { var _a, _b; return (this.allSelected) ? (_a = this.table) === null || _a === void 0 ? void 0 : _a.unSelectAll() : (_b = this.table) === null || _b === void 0 ? void 0 : _b.selectAll(); }
442
+ toggleSelectAll() { var _a, _b, _c; return ((_a = this.table) === null || _a === void 0 ? void 0 : _a.allSelected) ? (_b = this.table) === null || _b === void 0 ? void 0 : _b.unSelectAll() : (_c = this.table) === null || _c === void 0 ? void 0 : _c.selectAll(); }
468
443
  globalFilterCompleted() { this.changePage(1); }
469
444
  changePage(requestedPage) { var _a; (_a = this.table) === null || _a === void 0 ? void 0 : _a.changePage(requestedPage); }
470
445
  tableColumnSort(columnName, direction = null) { var _a; (_a = this.table) === null || _a === void 0 ? void 0 : _a.sort(columnName, direction !== null && direction !== void 0 ? direction : 'ascend'); }
@@ -540,14 +515,13 @@ const operators = {
540
515
  class FormPiece {
541
516
  constructor(pieceDefinition, formConfig) {
542
517
  var _a, _b, _c, _d;
543
- this._attributeChange = new BehaviorSubject(null);
544
518
  this._formState = '';
545
- this._visible = true;
546
- this._disabled = false;
519
+ this._absoluteVisible = true;
520
+ this._absoluteDisabled = false;
547
521
  this.visibleStates = null;
548
522
  this.enabledStates = null;
549
- this.visibleOnState = true;
550
- this.disabledOnState = false;
523
+ this._visible = true;
524
+ this._disabled = false;
551
525
  this.customAttributes = {};
552
526
  this._formConfig = formConfig;
553
527
  this._isForced = false;
@@ -573,10 +547,6 @@ class FormPiece {
573
547
  });
574
548
  }
575
549
  matchAttribute(name, value) { var _a; return ((_a = this.customAttributes) === null || _a === void 0 ? void 0 : _a[name]) === value; }
576
- get attributeChange() { return this._attributeChange; }
577
- propagateAttribute(name, value) {
578
- this._attributeChange.next({ name, value });
579
- }
580
550
  setVisibleStates(newStates) {
581
551
  const visibleStates = (!Array.isArray(newStates) && typeof newStates === 'string')
582
552
  ? newStates.split(',').map(state => state.trim()).filter(state => state.length > 0)
@@ -591,26 +561,23 @@ class FormPiece {
591
561
  }
592
562
  viewOnState(state) { return (this.visibleStates && state) ? this.visibleStates.includes(state) : false; }
593
563
  enabledOnState(state) { return (this.enabledStates && state) ? this.enabledStates.includes(state) : false; }
564
+ get absoluteVisible() { return this._absoluteVisible; }
565
+ get absoluteDisabled() { return this._absoluteDisabled; }
594
566
  get visible() { return this._visible; }
595
567
  set visible(visible) { this.setVisibility(visible); }
596
568
  visibleOn(state) {
597
- return this.visible && this.viewOnState(state);
569
+ return this._absoluteVisible && this.viewOnState(state);
598
570
  }
599
571
  enabledOn(state) {
600
- return !this._disabled && this.enabledOnState(state);
572
+ return !this._absoluteDisabled && this.enabledOnState(state);
601
573
  }
602
574
  setVisibility(visible, forced = null) {
603
- this._visible = visible && true;
604
- this.propagateVisible();
575
+ this._absoluteVisible = !!visible;
605
576
  if (forced !== null) {
606
577
  this._isForced = forced;
607
578
  this._visibleForced = visible;
608
579
  }
609
- const formerVisibleOnState = this.visibleOnState;
610
- this.visibleOnState = this.visible && this.viewOnState(this._formState);
611
- if (formerVisibleOnState !== this.visibleOnState) {
612
- this.propagateAttribute('visible', this.visibleOnState);
613
- }
580
+ this._visible = this._absoluteVisible && this.viewOnState(this._formState);
614
581
  }
615
582
  show(forced = null) {
616
583
  this.setVisibility(true, forced);
@@ -618,42 +585,60 @@ class FormPiece {
618
585
  hide(forced = null) {
619
586
  this.setVisibility(false, forced);
620
587
  }
621
- get disabled() { return this._disabled; }
622
588
  get enabled() { return !this._disabled; }
623
- get editable() { return !this._disabled; }
624
589
  set enabled(enabled) {
625
- this._disabled = !enabled;
626
- const formerDisableOnState = this.disabledOnState;
627
- this.disabledOnState = this._disabled || !this.enabledOnState(this._formState);
628
- if (formerDisableOnState !== this.disabledOnState) {
629
- this.propagateDisabled();
630
- }
590
+ this._absoluteDisabled = !enabled;
591
+ this._disabled = this._absoluteDisabled || !this.enabledOnState(this._formState);
631
592
  }
593
+ get editable() { return !this._disabled; }
594
+ get disabled() { return this._disabled; }
595
+ set disabled(disabled) { this.enabled = !disabled; }
632
596
  enable() { this.enabled = true; }
633
597
  disable() { this.enabled = false; }
598
+ formStateChangeCustomSubscribe(formChangeSubject) { }
599
+ formStateChange(state) {
600
+ if (state) {
601
+ this._formState = state;
602
+ this._visible = this._absoluteVisible && this.viewOnState(state);
603
+ this._disabled = this._absoluteDisabled || !this.enabledOnState(state);
604
+ }
605
+ }
634
606
  subscribeFormStateChange(formChangeSubject) {
635
- this.formStateChangeCustom(formChangeSubject);
636
- formChangeSubject.subscribe(event => {
637
- const { state } = event !== null && event !== void 0 ? event : {};
638
- if (state) {
639
- this._formState = state;
640
- this.visibleOnState = this.visible && this.viewOnState(state);
641
- this.disabledOnState = this._disabled || !this.enabledOnState(state);
642
- this.propagateVisible();
643
- this.propagateDisabled();
644
- }
645
- });
607
+ this.formStateChangeCustomSubscribe(formChangeSubject);
608
+ formChangeSubject.subscribe(event => this.formStateChange(event === null || event === void 0 ? void 0 : event.state));
646
609
  }
647
- formStateChangeCustom(formChangeSubject) { }
648
- propagateVisible() {
649
- this.propagateAttribute('visible', this.visibleOnState);
610
+ }
611
+
612
+ const VISIBLE = 'visible';
613
+ const DISABLED = 'disabled';
614
+ class FormPiecePropagate extends FormPiece {
615
+ constructor(pieceDefinition, formConfig) {
616
+ super(pieceDefinition, formConfig);
617
+ this._attributeChange = new BehaviorSubject(null);
650
618
  }
651
- propagateDisabled() {
652
- this.propagateAttribute('disabled', this.disabledOnState);
619
+ get attributeChange() { return this._attributeChange; }
620
+ propagateAttribute(name, value) {
621
+ var _a;
622
+ (_a = this._attributeChange) === null || _a === void 0 ? void 0 : _a.next({ name, value });
623
+ }
624
+ setVisibility(visible, forced = null) {
625
+ super.setVisibility(visible, forced);
626
+ this.propagateAttribute(VISIBLE, this._visible);
627
+ }
628
+ set enabled(enabled) {
629
+ super.enabled = enabled;
630
+ this.propagateAttribute(DISABLED, this._disabled);
631
+ }
632
+ formStateChange(state) {
633
+ super.formStateChange(state);
634
+ if (state) {
635
+ this.propagateAttribute(VISIBLE, this._visible);
636
+ this.propagateAttribute(DISABLED, this._disabled);
637
+ }
653
638
  }
654
639
  }
655
640
 
656
- class FormElement extends FormPiece {
641
+ class FormElement extends FormPiecePropagate {
657
642
  constructor(elementDefinition, formConfig) {
658
643
  super(elementDefinition, formConfig);
659
644
  this.elementType = null;
@@ -753,7 +738,7 @@ const attrs$1 = {
753
738
  };
754
739
  class FieldDescriptor extends FormElement {
755
740
  constructor(inputFieldReceived, formConfig) {
756
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
741
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
757
742
  super(inputFieldReceived, formConfig);
758
743
  this._editionFinish = new Subject();
759
744
  this._editionPartial = new Subject();
@@ -813,14 +798,14 @@ class FieldDescriptor extends FormElement {
813
798
  this.defaultEditable = this.enabled;
814
799
  this.required = (_e = fld.required) !== null && _e !== void 0 ? _e : false;
815
800
  this.outputOnly = (_f = fld.outputOnly) !== null && _f !== void 0 ? _f : false;
816
- this.maxLength = (_g = fld.maxLength) !== null && _g !== void 0 ? _g : (this._captureType === 'TEXTAREA' ? BIG_MAX_LENGTH : STD_MAX_LENGTH);
817
- this.intrinsicErrorMessage = (_q = (_l = (_k = (_j = (_h = this._formConfig) === null || _h === void 0 ? void 0 : _h.fieldValidations) === null || _j === void 0 ? void 0 : _j[this._fieldType]) === null || _k === void 0 ? void 0 : _k.message) !== null && _l !== void 0 ? _l : (_p = (_o = (_m = this._formConfig) === null || _m === void 0 ? void 0 : _m.fieldValidations) === null || _o === void 0 ? void 0 : _o.DEFAULT) === null || _p === void 0 ? void 0 : _p.message) !== null && _q !== void 0 ? _q : '';
818
- this.setError(fld.errorCode, fld.errorMessage, (_r = fld.errorType) !== null && _r !== void 0 ? _r : DEFAULT_ERROR_TYPE);
819
- this.setEditable((_s = fld.editable) !== null && _s !== void 0 ? _s : true);
820
- this.visibleLabel = (_t = fld.visibleLabel) !== null && _t !== void 0 ? _t : true;
801
+ this.maxLength = fld.maxLength || (this._captureType === 'TEXTAREA' ? BIG_MAX_LENGTH : STD_MAX_LENGTH);
802
+ this.intrinsicErrorMessage = (_p = (_k = (_j = (_h = (_g = this._formConfig) === null || _g === void 0 ? void 0 : _g.fieldValidations) === null || _h === void 0 ? void 0 : _h[this._fieldType]) === null || _j === void 0 ? void 0 : _j.message) !== null && _k !== void 0 ? _k : (_o = (_m = (_l = this._formConfig) === null || _l === void 0 ? void 0 : _l.fieldValidations) === null || _m === void 0 ? void 0 : _m.DEFAULT) === null || _o === void 0 ? void 0 : _o.message) !== null && _p !== void 0 ? _p : '';
803
+ this.setError(fld.errorCode, fld.errorMessage, (_q = fld.errorType) !== null && _q !== void 0 ? _q : DEFAULT_ERROR_TYPE);
804
+ this.setEditable((_r = fld.editable) !== null && _r !== void 0 ? _r : true);
805
+ this.visibleLabel = (_s = fld.visibleLabel) !== null && _s !== void 0 ? _s : true;
821
806
  this.setVisibility(fld.visible);
822
807
  this.options = fld.fieldOptions;
823
- this._setValue((_v = (_u = fld.fieldValue) !== null && _u !== void 0 ? _u : this._defaultValue) !== null && _v !== void 0 ? _v : '');
808
+ this._setValue((_u = (_t = fld.fieldValue) !== null && _t !== void 0 ? _t : this._defaultValue) !== null && _u !== void 0 ? _u : '');
824
809
  }
825
810
  get alignment() { return this._fieldAlignment; }
826
811
  set alignment(alignment) { this.setAttr(attrs$1._fieldAlignment, alignment); }
@@ -874,7 +859,7 @@ class FieldDescriptor extends FormElement {
874
859
  set info(newInfo) { this.setAttr(attrs$1._fieldInfo, newInfo); }
875
860
  set intrinsicErrorMessage(message) { this.setAttr(attrs$1._intrinsicErrorMessage, message); }
876
861
  get maxLength() { return (this._maxLength > 0) ? this._maxLength.toString() : ''; }
877
- set maxLength(requiredMaxLength) { this.setAttr(attrs$1._maxLength, +requiredMaxLength); }
862
+ set maxLength(requiredMaxLength) { this.setAttr(attrs$1._maxLength, requiredMaxLength ? +requiredMaxLength : null); }
878
863
  get maxValue() { return this._maxValue; }
879
864
  set maxValue(inputMaxValue) {
880
865
  let maxValue = inputMaxValue;
@@ -884,7 +869,7 @@ class FieldDescriptor extends FormElement {
884
869
  this.setAttr(attrs$1._maxValue, maxValue);
885
870
  }
886
871
  get minLength() { return this._minLength; }
887
- set minLength(requiredMinLength) { this.setAttr(attrs$1._minLength, +requiredMinLength); }
872
+ set minLength(requiredMinLength) { this.setAttr(attrs$1._minLength, requiredMinLength ? +requiredMinLength : null); }
888
873
  get minValue() { return this._minValue; }
889
874
  set minValue(inputMinValue) {
890
875
  let minValue = inputMinValue;
@@ -902,7 +887,7 @@ class FieldDescriptor extends FormElement {
902
887
  })) !== null && _b !== void 0 ? _b : null;
903
888
  }
904
889
  set options(newOptions) {
905
- var _a, _b, _c, _d;
890
+ var _a, _b, _c, _d, _e;
906
891
  if ((!this._formConfig.captureTypesWithOptions.includes(this._captureType))
907
892
  || typeof newOptions === UNDEFINED || !newOptions
908
893
  || !Array.isArray(newOptions)) {
@@ -930,8 +915,8 @@ class FieldDescriptor extends FormElement {
930
915
  }
931
916
  }
932
917
  }
933
- if (this._fieldRequired && ((_c = this._fieldOptions) === null || _c === void 0 ? void 0 : _c.length) === 1) {
934
- this._setValue((_d = this._fieldOptions) === null || _d === void 0 ? void 0 : _d[0].fieldOptionId);
918
+ if (this._fieldRequired && ((_c = this._fieldOptions) === null || _c === void 0 ? void 0 : _c.length) === 1 && this._value !== ((_d = this._fieldOptions) === null || _d === void 0 ? void 0 : _d[0].fieldOptionId)) {
919
+ this._setValue((_e = this._fieldOptions) === null || _e === void 0 ? void 0 : _e[0].fieldOptionId);
935
920
  this.notifyEditionFinish();
936
921
  }
937
922
  }
@@ -1156,7 +1141,7 @@ class FieldDescriptor extends FormElement {
1156
1141
 
1157
1142
  class RecordTableColumn extends FormPiece {
1158
1143
  constructor(recTableColReceived, formConfig) {
1159
- var _a, _b, _c;
1144
+ var _a, _b, _c, _d;
1160
1145
  super(recTableColReceived, formConfig);
1161
1146
  this.fieldCode = '';
1162
1147
  this.fieldTitle = '';
@@ -1164,6 +1149,7 @@ class RecordTableColumn extends FormPiece {
1164
1149
  this.fieldAlignment = '';
1165
1150
  this.fieldFormat = '';
1166
1151
  this.sortable = true;
1152
+ this.searchable = true;
1167
1153
  this.sortDirections = [];
1168
1154
  // Filtros
1169
1155
  this.filterVisible = false;
@@ -1176,13 +1162,15 @@ class RecordTableColumn extends FormPiece {
1176
1162
  this.fieldType = recTableColReceived.fieldTypeCode || this._formConfig.fieldTypes.text;
1177
1163
  const defaultTypeAlignment = (this._formConfig.tableFieldStyles[this.fieldType] != null) ? this._formConfig.tableFieldStyles[this.fieldType]['text-align'] : 'left';
1178
1164
  this.fieldAlignment = (recTableColReceived.alignment != null) ? recTableColReceived.alignment.toLowerCase() : defaultTypeAlignment;
1179
- this.visible = (_a = recTableColReceived === null || recTableColReceived === void 0 ? void 0 : recTableColReceived.visible) !== null && _a !== void 0 ? _a : true;
1165
+ this._absoluteVisible = (_a = recTableColReceived === null || recTableColReceived === void 0 ? void 0 : recTableColReceived.visible) !== null && _a !== void 0 ? _a : true;
1180
1166
  this.sortable = (_b = recTableColReceived === null || recTableColReceived === void 0 ? void 0 : recTableColReceived.sortable) !== null && _b !== void 0 ? _b : false;
1167
+ this.searchable = (_c = recTableColReceived === null || recTableColReceived === void 0 ? void 0 : recTableColReceived.searchable) !== null && _c !== void 0 ? _c : true;
1181
1168
  this.sortDirections = (this.sortable) ? ['ascend', 'descend'] : [];
1182
1169
  this.fieldFormat = recTableColReceived.format || '';
1183
- this.customAttributes = (_c = recTableColReceived === null || recTableColReceived === void 0 ? void 0 : recTableColReceived.customAttributes) !== null && _c !== void 0 ? _c : {};
1170
+ this.customAttributes = (_d = recTableColReceived === null || recTableColReceived === void 0 ? void 0 : recTableColReceived.customAttributes) !== null && _d !== void 0 ? _d : {};
1184
1171
  }
1185
1172
  }
1173
+ setSearchable(searchable = true) { this.searchable = searchable; }
1186
1174
  hideFilter() {
1187
1175
  this.filterVisible = false;
1188
1176
  }
@@ -1248,11 +1236,11 @@ class TableAction extends FormPiece {
1248
1236
 
1249
1237
  class TableRecordData {
1250
1238
  constructor(recordReceived, recordDefinition, selectionFieldName = null) {
1239
+ this.recordId = null;
1240
+ this.selected = false;
1251
1241
  this.recordData = {};
1252
1242
  const { tableRecordId, recordData } = recordReceived;
1253
1243
  this.recordId = tableRecordId;
1254
- this.selected = false;
1255
- this.recordData = {};
1256
1244
  if (!recordDefinition || recordDefinition.length === 0 || !recordData || recordData.length === 0) {
1257
1245
  return;
1258
1246
  }
@@ -1291,10 +1279,11 @@ class TableRecordData {
1291
1279
  if (!words || words.length === 0) {
1292
1280
  return true;
1293
1281
  }
1294
- for (const fieldCode in this.recordData) {
1295
- const columnDef = columnObj === null || columnObj === void 0 ? void 0 : columnObj[fieldCode];
1296
- if (columnDef && (columnDef === null || columnDef === void 0 ? void 0 : columnDef.visible) && this.recordData.hasOwnProperty(fieldCode)) {
1297
- for (const word of words) {
1282
+ for (const word of words) {
1283
+ let wordIsPresent = false;
1284
+ for (const fieldCode in this.recordData) {
1285
+ const columnDef = columnObj === null || columnObj === void 0 ? void 0 : columnObj[fieldCode];
1286
+ if ((columnDef === null || columnDef === void 0 ? void 0 : columnDef.searchable) && this.recordData.hasOwnProperty(fieldCode)) {
1298
1287
  const term = word.toUpperCase();
1299
1288
  let fieldValue;
1300
1289
  if (columnDef.fieldType.toUpperCase().includes('DATE')) {
@@ -1304,12 +1293,16 @@ class TableRecordData {
1304
1293
  fieldValue = this.recordData[fieldCode];
1305
1294
  }
1306
1295
  if (fieldValue.toString().toUpperCase().includes(term)) {
1307
- return true;
1296
+ wordIsPresent = true;
1297
+ break;
1308
1298
  }
1309
1299
  }
1310
1300
  }
1301
+ if (!wordIsPresent) {
1302
+ return false;
1303
+ }
1311
1304
  }
1312
- return false;
1305
+ return true;
1313
1306
  }
1314
1307
  hasCondition(columnFilters) {
1315
1308
  if (!columnFilters || columnFilters.length === 0) {
@@ -1363,7 +1356,7 @@ const attrs = {
1363
1356
  tableCode: { name: 'tableCode', propagate: 'code' },
1364
1357
  clientPaging: { name: 'clientPaging', propagate: null },
1365
1358
  globalSearch: { name: 'globalSearch', propagate: 'globalSearch' },
1366
- globalFilterString: { name: 'globalFilterString', propagate: null },
1359
+ globalFilterString: { name: 'globalFilterString', propagate: 'globalFilterString' },
1367
1360
  sorting: { name: 'sorting', propagate: null },
1368
1361
  recordsPerPage: { name: 'recordsPerPage', propagate: 'recordsPerPage' },
1369
1362
  layout: { name: 'layout', propagate: 'layout' },
@@ -1385,6 +1378,7 @@ class RecordTable extends FormElement {
1385
1378
  this._tableColumnObj = {};
1386
1379
  this._actionsObj = {};
1387
1380
  // Mecanismos de filtrado nueva versión
1381
+ this.globalFilterString = '';
1388
1382
  this.globalFilterStrings = [];
1389
1383
  this.layout = null;
1390
1384
  this.tableRecordObj = {};
@@ -1423,7 +1417,7 @@ class RecordTable extends FormElement {
1423
1417
  if (tableReceived.fields) {
1424
1418
  const columns = [];
1425
1419
  for (const columnReceived of tableReceived.fields) {
1426
- const columnEnriched = Object.assign(Object.assign({}, columnReceived), { visibleStates: this.visibleStates });
1420
+ const columnEnriched = Object.assign(Object.assign({}, columnReceived), { visibleStates: this.visibleStates, enabledStates: this.enabledStates });
1427
1421
  const columnDefinition = new RecordTableColumn(columnEnriched, this._formConfig);
1428
1422
  columns.push(columnDefinition);
1429
1423
  this._tableColumnObj[columnDefinition.fieldCode] = columnDefinition;
@@ -1583,7 +1577,6 @@ class RecordTable extends FormElement {
1583
1577
  }
1584
1578
  }
1585
1579
  updateVisibleRecords() {
1586
- // updateView const changeViewAttributes = ['currentPage', 'recordsPerPage', 'sorting'];
1587
1580
  let visibleRecords;
1588
1581
  if (this.clientPaging) {
1589
1582
  let filteredRecords = this.getFilteredRecords();
@@ -1660,7 +1653,7 @@ class RecordTable extends FormElement {
1660
1653
  this.changePage(1);
1661
1654
  }
1662
1655
  if (notifyComponent) {
1663
- this.setAttr(attrs.globalFilterString, text);
1656
+ this.setAttr(attrs.globalFilterString, text.trim());
1664
1657
  }
1665
1658
  }
1666
1659
  addFilterDefinition(columnName, filterDefinition) {
@@ -1710,10 +1703,10 @@ class RecordTable extends FormElement {
1710
1703
  for (let index = 0; index < columnFilters.length; index++) {
1711
1704
  const columnFilter = columnFilters[index];
1712
1705
  compactFilter.advancedFilter.push({
1713
- fieldCode: columnFilter.fieldCode,
1714
- operator: columnFilter.operator,
1715
- fieldValue1: columnFilter.values[0],
1716
- fieldValue2: columnFilter.values[1],
1706
+ fieldCode: columnFilter === null || columnFilter === void 0 ? void 0 : columnFilter.fieldCode,
1707
+ operator: columnFilter === null || columnFilter === void 0 ? void 0 : columnFilter.operator,
1708
+ fieldValue1: columnFilter === null || columnFilter === void 0 ? void 0 : columnFilter.values[0],
1709
+ fieldValue2: columnFilter === null || columnFilter === void 0 ? void 0 : columnFilter.values[1],
1717
1710
  });
1718
1711
  }
1719
1712
  return compactFilter;
@@ -1756,15 +1749,18 @@ class RecordTable extends FormElement {
1756
1749
  }
1757
1750
  return direction === TABLE_SORT_ASCENDING ? result : -result;
1758
1751
  }
1759
- formStateChangeCustom(formChangeSubject) {
1760
- var _a;
1752
+ formStateChangeCustomSubscribe(formChangeSubject) {
1753
+ var _a, _b;
1761
1754
  (_a = this.columns) === null || _a === void 0 ? void 0 : _a.forEach(column => {
1762
1755
  column === null || column === void 0 ? void 0 : column.subscribeFormStateChange(formChangeSubject);
1763
1756
  });
1757
+ (_b = this._actions) === null || _b === void 0 ? void 0 : _b.forEach(action => {
1758
+ action === null || action === void 0 ? void 0 : action.subscribeFormStateChange(formChangeSubject);
1759
+ });
1764
1760
  }
1765
1761
  }
1766
1762
 
1767
- class RecordFormSubSection extends FormPiece {
1763
+ class RecordFormSubSection extends FormPiecePropagate {
1768
1764
  constructor(subsectionReceived, formObject, formConfig) {
1769
1765
  super(subsectionReceived, formConfig);
1770
1766
  this._customRender = null;
@@ -1776,6 +1772,7 @@ class RecordFormSubSection extends FormPiece {
1776
1772
  this.subSectionTables = [];
1777
1773
  this.subSectionActions = [];
1778
1774
  this.elementsArray = {};
1775
+ this.active = false;
1779
1776
  if (!subsectionReceived) {
1780
1777
  return;
1781
1778
  }
@@ -1827,9 +1824,22 @@ class RecordFormSubSection extends FormPiece {
1827
1824
  getActionNames() {
1828
1825
  return this.subSectionActions.map(action => action.actionCode);
1829
1826
  }
1827
+ activate() {
1828
+ if (!this.active) {
1829
+ this.active = true;
1830
+ // this.subsectionCode && this._activation.next(this.subsectionCode);
1831
+ }
1832
+ }
1833
+ inactivate() {
1834
+ if (this.active) {
1835
+ this.active = false;
1836
+ // this.subsectionCode && this._inactivation.next(this.subsectionCode);
1837
+ }
1838
+ }
1830
1839
  }
1831
1840
 
1832
- class RecordFormSection extends FormPiece {
1841
+ const ACTIVE$1 = 'active';
1842
+ class RecordFormSection extends FormPiecePropagate {
1833
1843
  constructor(sectionReceived, formObject, formConfig) {
1834
1844
  super(sectionReceived, formConfig);
1835
1845
  this._activation = new Subject();
@@ -1839,6 +1849,7 @@ class RecordFormSection extends FormPiece {
1839
1849
  this.sectionCode = null;
1840
1850
  this.sectionTitle = null;
1841
1851
  this.subSections = [];
1852
+ this._exclusiveSubSectionsByAttr = {};
1842
1853
  if (!sectionReceived) {
1843
1854
  return;
1844
1855
  }
@@ -1848,20 +1859,13 @@ class RecordFormSection extends FormPiece {
1848
1859
  this.subSections = [];
1849
1860
  this.subSectionsObj = {};
1850
1861
  if (sectionReceived.subsections) {
1851
- const subsections = sectionReceived.subsections.map(objDef => {
1852
- let visibleStates = objDef.visibleStates;
1853
- if (!visibleStates) {
1854
- visibleStates = (objDef.subsectionModes || '').split(',')
1855
- .map(state => state.trim())
1856
- .filter(state => state.length > 0);
1857
- }
1858
- if (!visibleStates || visibleStates.length === 0) {
1859
- visibleStates = this.visibleStates;
1860
- }
1861
- if (objDef.elements && Array.isArray(objDef.elements)) {
1862
- objDef.elements = objDef.elements.map(elm => ({ code: elm.elementCode, type: elm.elementTypeName }));
1862
+ const subsections = sectionReceived.subsections.map(subSecDef => {
1863
+ var _a;
1864
+ const visibleStates = (_a = subSecDef.visibleStates) !== null && _a !== void 0 ? _a : [];
1865
+ if (subSecDef.elements && Array.isArray(subSecDef.elements)) {
1866
+ subSecDef.elements = subSecDef.elements.map(elm => ({ code: elm.elementCode, type: elm.elementTypeName }));
1863
1867
  }
1864
- return Object.assign(Object.assign({}, objDef), { visibleStates });
1868
+ return Object.assign(Object.assign({}, subSecDef), { visibleStates });
1865
1869
  });
1866
1870
  for (const subsectionReceived of subsections) {
1867
1871
  const subSectionToAdd = new RecordFormSubSection(subsectionReceived, formObject, formConfig);
@@ -1891,14 +1895,23 @@ class RecordFormSection extends FormPiece {
1891
1895
  get title() { return this.sectionTitle; }
1892
1896
  set title(title) { this.sectionTitle = title; }
1893
1897
  getVisibleSubsections(state) {
1894
- return this.subSections.filter(subSection => {
1895
- return subSection.visible && subSection.viewOnState(state);
1896
- });
1898
+ return this.subSections.filter(subSection => subSection.visible);
1897
1899
  }
1898
1900
  getSubsection(subSectionCode) {
1899
1901
  return (this.subSectionsObj && this.subSectionsObj[subSectionCode])
1900
1902
  ? this.subSectionsObj[subSectionCode] : null;
1901
1903
  }
1904
+ activateSubSection(subSectionCode) {
1905
+ if (subSectionCode === this._exclusiveSubSectionsByAttr[ACTIVE$1]) {
1906
+ return;
1907
+ }
1908
+ const subSection = (this.subSectionsObj && this.subSectionsObj[subSectionCode])
1909
+ ? this.subSectionsObj[subSectionCode] : null;
1910
+ if (subSection) {
1911
+ subSection === null || subSection === void 0 ? void 0 : subSection.activate();
1912
+ this._exclusiveSubSectionsByAttr[ACTIVE$1] = subSectionCode;
1913
+ }
1914
+ }
1902
1915
  getFields() {
1903
1916
  var _a;
1904
1917
  let fieldsArray = [];
@@ -1955,7 +1968,7 @@ class RecordFormSection extends FormPiece {
1955
1968
  }
1956
1969
  return null;
1957
1970
  }
1958
- formStateChangeCustom(formChangeSubject) {
1971
+ formStateChangeCustomSubscribe(formChangeSubject) {
1959
1972
  var _a;
1960
1973
  (_a = this.subSections) === null || _a === void 0 ? void 0 : _a.forEach(subsection => {
1961
1974
  subsection === null || subsection === void 0 ? void 0 : subsection.subscribeFormStateChange(formChangeSubject);
@@ -2004,8 +2017,9 @@ class FormStructureAndData {
2004
2017
  this.extraInfo = definitionReceived.extraInfo;
2005
2018
  if (definitionReceived.actions) {
2006
2019
  const formActions = definitionReceived.actions.map(objDef => {
2020
+ var _a;
2007
2021
  let visibleStates = objDef.visibleStates;
2008
- let enabledStates = objDef.enabledStates;
2022
+ let enabledStates = (_a = objDef.enabledStates) !== null && _a !== void 0 ? _a : objDef.editableStates;
2009
2023
  if (!visibleStates) {
2010
2024
  visibleStates = (objDef.actionModes || '').split(',')
2011
2025
  .map(state => state.trim())
@@ -2025,8 +2039,9 @@ class FormStructureAndData {
2025
2039
  }
2026
2040
  if (definitionReceived.fields) {
2027
2041
  const formFields = definitionReceived.fields.map(objDef => {
2042
+ var _a;
2028
2043
  let visibleStates = objDef.visibleStates;
2029
- let enabledStates = objDef.enabledStates || objDef.editableStates;
2044
+ let enabledStates = (_a = objDef.enabledStates) !== null && _a !== void 0 ? _a : objDef.editableStates;
2030
2045
  if (!visibleStates) {
2031
2046
  visibleStates = (objDef.fieldModes || '').split(',')
2032
2047
  .map(state => state.trim())
@@ -2310,7 +2325,7 @@ class FormStructureAndData {
2310
2325
  getSections() { return this._sectionArray; }
2311
2326
  getSectionsByAttribute(name, value) { return this._sectionArray.filter(item => item.matchAttribute(name, value)); }
2312
2327
  get sectionTitles() { return this._sectionArray.map(formSection => formSection.sectionTitle); }
2313
- get visibleSections() { return this._sectionArray.filter(sec => sec.visible); }
2328
+ get visibleSections() { return this._sectionArray.filter(sec => sec.absoluteVisible); }
2314
2329
  getSection(code) { var _a; return (code && ((_a = this._sections) === null || _a === void 0 ? void 0 : _a[code])) ? this._sections[code] : null; }
2315
2330
  showSections(codes) { this.execOnSections(codes, SHOW); }
2316
2331
  hideSections(codes) { this.execOnSections(codes, HIDE); }
@@ -2373,8 +2388,8 @@ class FormStructureAndData {
2373
2388
  const fieldPayload = {
2374
2389
  fieldCode: fld === null || fld === void 0 ? void 0 : fld.code,
2375
2390
  fieldValue: fld === null || fld === void 0 ? void 0 : fld.value,
2376
- editable: !(fld === null || fld === void 0 ? void 0 : fld.disabled),
2377
- visible: fld === null || fld === void 0 ? void 0 : fld.visible,
2391
+ editable: !(fld === null || fld === void 0 ? void 0 : fld.absoluteDisabled),
2392
+ visible: fld === null || fld === void 0 ? void 0 : fld.absoluteVisible,
2378
2393
  required: fld === null || fld === void 0 ? void 0 : fld.required,
2379
2394
  fieldOptions: '',
2380
2395
  };
@@ -2383,7 +2398,7 @@ class FormStructureAndData {
2383
2398
  formData.tables = this.getTables().map(tbl => {
2384
2399
  const tablePayload = {
2385
2400
  tableCode: tbl.tableCode,
2386
- visible: tbl.visible,
2401
+ visible: tbl.absoluteVisible,
2387
2402
  currentPage: tbl.currentPage,
2388
2403
  requestedPage: tbl.requestedPage,
2389
2404
  recordsPerPage: tbl.recordsPerPage,
@@ -3344,7 +3359,7 @@ class BasicFormComponent {
3344
3359
  for (const clientActionMethod of finishActionMethods) {
3345
3360
  const { callback, properties } = clientActionMethod;
3346
3361
  const continueOnError = (_a = properties === null || properties === void 0 ? void 0 : properties.continueOnError) !== null && _a !== void 0 ? _a : false;
3347
- if (!serverError || continueOnError) {
3362
+ if (callback && (!serverError || continueOnError)) {
3348
3363
  clientActionPromises.push(callback(action, actionResult));
3349
3364
  }
3350
3365
  }