tuain-ng-forms-lib 12.0.25 → 12.0.29

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.
@@ -294,7 +294,7 @@ class FormElement {
294
294
  this.disabled = (_a = elementDefinition === null || elementDefinition === void 0 ? void 0 : elementDefinition.disabled) !== null && _a !== void 0 ? _a : false;
295
295
  this.setVisibility((_b = elementDefinition === null || elementDefinition === void 0 ? void 0 : elementDefinition.visible) !== null && _b !== void 0 ? _b : true);
296
296
  this.widget = null;
297
- this.customAttributes = (_c = elementDefinition === null || elementDefinition === void 0 ? void 0 : elementDefinition.customAttributes) !== null && _c !== void 0 ? _c : null;
297
+ this.customAttributes = (_c = elementDefinition === null || elementDefinition === void 0 ? void 0 : elementDefinition.customAttributes) !== null && _c !== void 0 ? _c : {};
298
298
  }
299
299
  getCustomAttribute(name) { var _a, _b; return (_b = (_a = this.customAttributes) === null || _a === void 0 ? void 0 : _a[name]) !== null && _b !== void 0 ? _b : null; }
300
300
  setCustomAttribute(name, value) { if (name) {
@@ -1491,15 +1491,15 @@ class RecordFormSubSection {
1491
1491
  const { type, code } = receivedElement;
1492
1492
  switch (type) {
1493
1493
  case elementTypes.field:
1494
- elementObject = formObject.getFieldObject(code);
1494
+ elementObject = formObject.getField(code);
1495
1495
  arrayToAdd = this.subSectionFields;
1496
1496
  break;
1497
1497
  case elementTypes.table:
1498
- elementObject = formObject.getTableObject(code);
1498
+ elementObject = formObject.getTable(code);
1499
1499
  arrayToAdd = this.subSectionTables;
1500
1500
  break;
1501
1501
  case elementTypes.action:
1502
- elementObject = formObject.getActionObject(code);
1502
+ elementObject = formObject.getAction(code);
1503
1503
  arrayToAdd = this.subSectionActions;
1504
1504
  break;
1505
1505
  }
@@ -2813,8 +2813,8 @@ class BasicFormComponent {
2813
2813
  /**
2814
2814
  * Manejo de event handlers para acciones sobre el formulario
2815
2815
  */
2816
- addSectionActivation(sectionCodes, callbackMethod) {
2817
- const sectionSet = (Array.isArray(sectionCodes)) ? sectionCodes : [sectionCodes];
2816
+ addSectionActivation(codes, callbackMethod) {
2817
+ const sectionSet = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
2818
2818
  sectionSet.forEach((sectionName) => {
2819
2819
  if (!this._formSectionsActivate[sectionName]) {
2820
2820
  this._formSectionsActivate[sectionName] = [];
@@ -2822,8 +2822,8 @@ class BasicFormComponent {
2822
2822
  this._formSectionsActivate[sectionName].push(callbackMethod);
2823
2823
  });
2824
2824
  }
2825
- addSectionInactivation(sectionCodes, callbackMethod) {
2826
- const sectionSet = (Array.isArray(sectionCodes)) ? sectionCodes : [sectionCodes];
2825
+ addSectionInactivation(codes, callbackMethod) {
2826
+ const sectionSet = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
2827
2827
  sectionSet.forEach((sectionName) => {
2828
2828
  if (!this._formSectionsInactivate[sectionName]) {
2829
2829
  this._formSectionsInactivate[sectionName] = [];
@@ -2831,8 +2831,8 @@ class BasicFormComponent {
2831
2831
  this._formSectionsInactivate[sectionName].push(callbackMethod);
2832
2832
  });
2833
2833
  }
2834
- addActionMethodStart(actions, callbackMethod) {
2835
- const actionSet = (Array.isArray(actions)) ? actions : [actions];
2834
+ addActionMethodStart(codes, callbackMethod) {
2835
+ const actionSet = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
2836
2836
  actionSet.forEach((actionName) => {
2837
2837
  if (!this._formActionsStart[actionName]) {
2838
2838
  this._formActionsStart[actionName] = [];
@@ -2840,8 +2840,8 @@ class BasicFormComponent {
2840
2840
  this._formActionsStart[actionName].push(callbackMethod);
2841
2841
  });
2842
2842
  }
2843
- addActionMethodFinish(actions, callbackMethod) {
2844
- const actionSet = (Array.isArray(actions)) ? actions : [actions];
2843
+ addActionMethodFinish(codes, callbackMethod) {
2844
+ const actionSet = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
2845
2845
  actionSet.forEach((actionName) => {
2846
2846
  if (!this._formActionsFinish[actionName]) {
2847
2847
  this._formActionsFinish[actionName] = [];
@@ -2940,8 +2940,8 @@ class BasicFormComponent {
2940
2940
  /**
2941
2941
  * Manejadores de eventos para validaciones sobre campos
2942
2942
  */
2943
- addFieldInputValidation(fields, callbackMethod) {
2944
- const fieldSet = (Array.isArray(fields)) ? fields : [fields];
2943
+ addFieldInputValidation(codes, callbackMethod) {
2944
+ const fieldSet = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
2945
2945
  fieldSet.forEach((fieldCode) => {
2946
2946
  if (!this._fieldInputValidation[fieldCode]) {
2947
2947
  this._fieldInputValidation[fieldCode] = [];
@@ -2949,8 +2949,8 @@ class BasicFormComponent {
2949
2949
  this._fieldInputValidation[fieldCode].push(callbackMethod);
2950
2950
  });
2951
2951
  }
2952
- addFieldValidationStart(fields, callbackMethod) {
2953
- const fieldSet = (Array.isArray(fields)) ? fields : [fields];
2952
+ addFieldValidationStart(codes, callbackMethod) {
2953
+ const fieldSet = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
2954
2954
  fieldSet.forEach((fieldCode) => {
2955
2955
  if (!this._fieldValidationsStart[fieldCode]) {
2956
2956
  this._fieldValidationsStart[fieldCode] = [];
@@ -2958,8 +2958,8 @@ class BasicFormComponent {
2958
2958
  this._fieldValidationsStart[fieldCode].push(callbackMethod);
2959
2959
  });
2960
2960
  }
2961
- addFieldValidationFinish(fields, callbackMethod) {
2962
- const fieldSet = (Array.isArray(fields)) ? fields : [fields];
2961
+ addFieldValidationFinish(codes, callbackMethod) {
2962
+ const fieldSet = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
2963
2963
  fieldSet.forEach((fieldCode) => {
2964
2964
  if (!this._fieldValidationsFinish[fieldCode]) {
2965
2965
  this._fieldValidationsFinish[fieldCode] = [];
@@ -3051,8 +3051,8 @@ class BasicFormComponent {
3051
3051
  /**
3052
3052
  * Manejadores de eventos para acciones sobre Tablas
3053
3053
  */
3054
- addTableActionStart(tableName, actionCode, callbackMethod) {
3055
- const tableObject = this.getTable(tableName);
3054
+ addTableActionStart(code, actionCode, callbackMethod) {
3055
+ const tableObject = this.getTable(code);
3056
3056
  if (!tableObject) {
3057
3057
  return;
3058
3058
  }
@@ -3061,20 +3061,20 @@ class BasicFormComponent {
3061
3061
  return;
3062
3062
  }
3063
3063
  let tableEventHandlers = null;
3064
- if (this._tableActionsStart[tableName]) {
3065
- tableEventHandlers = this._tableActionsStart[tableName];
3064
+ if (this._tableActionsStart[code]) {
3065
+ tableEventHandlers = this._tableActionsStart[code];
3066
3066
  }
3067
3067
  else {
3068
3068
  tableEventHandlers = {};
3069
- this._tableActionsStart[tableName] = tableEventHandlers;
3069
+ this._tableActionsStart[code] = tableEventHandlers;
3070
3070
  }
3071
3071
  if (!tableEventHandlers[actionCode]) {
3072
3072
  tableEventHandlers[actionCode] = [];
3073
3073
  }
3074
3074
  tableEventHandlers[actionCode].push(callbackMethod);
3075
3075
  }
3076
- addTableActionFinish(tableName, actionCode, callbackMethod) {
3077
- const tableObject = this.getTable(tableName);
3076
+ addTableActionFinish(code, actionCode, callbackMethod) {
3077
+ const tableObject = this.getTable(code);
3078
3078
  if (!tableObject) {
3079
3079
  return;
3080
3080
  }
@@ -3083,75 +3083,75 @@ class BasicFormComponent {
3083
3083
  return;
3084
3084
  }
3085
3085
  let tableEventHandlers = null;
3086
- if (this._tableActionsFinish[tableName]) {
3087
- tableEventHandlers = this._tableActionsFinish[tableName];
3086
+ if (this._tableActionsFinish[code]) {
3087
+ tableEventHandlers = this._tableActionsFinish[code];
3088
3088
  }
3089
3089
  else {
3090
3090
  tableEventHandlers = {};
3091
- this._tableActionsFinish[tableName] = tableEventHandlers;
3091
+ this._tableActionsFinish[code] = tableEventHandlers;
3092
3092
  }
3093
3093
  if (!tableEventHandlers[actionCode]) {
3094
3094
  tableEventHandlers[actionCode] = [];
3095
3095
  }
3096
3096
  tableEventHandlers[actionCode].push(callbackMethod);
3097
3097
  }
3098
- addTableSelectionStart(tableName, callbackMethod) {
3099
- const tableObject = this.getTable(tableName);
3098
+ addTableSelectionStart(code, callbackMethod) {
3099
+ const tableObject = this.getTable(code);
3100
3100
  if (!tableObject) {
3101
3101
  return;
3102
3102
  }
3103
3103
  let tableEventHandlers = null;
3104
- if (this._tableSelectionsStart[tableName]) {
3105
- tableEventHandlers = this._tableSelectionsStart[tableName];
3104
+ if (this._tableSelectionsStart[code]) {
3105
+ tableEventHandlers = this._tableSelectionsStart[code];
3106
3106
  }
3107
3107
  else {
3108
3108
  tableEventHandlers = [];
3109
- this._tableSelectionsStart[tableName] = tableEventHandlers;
3109
+ this._tableSelectionsStart[code] = tableEventHandlers;
3110
3110
  }
3111
3111
  tableEventHandlers.push(callbackMethod);
3112
3112
  }
3113
- addTableSelectionFinish(tableName, callbackMethod) {
3114
- const tableObject = this.getTable(tableName);
3113
+ addTableSelectionFinish(code, callbackMethod) {
3114
+ const tableObject = this.getTable(code);
3115
3115
  if (!tableObject) {
3116
3116
  return;
3117
3117
  }
3118
3118
  let tableEventHandlers = null;
3119
- if (this._tableSelectionsFinish[tableName]) {
3120
- tableEventHandlers = this._tableSelectionsFinish[tableName];
3119
+ if (this._tableSelectionsFinish[code]) {
3120
+ tableEventHandlers = this._tableSelectionsFinish[code];
3121
3121
  }
3122
3122
  else {
3123
3123
  tableEventHandlers = [];
3124
- this._tableSelectionsFinish[tableName] = tableEventHandlers;
3124
+ this._tableSelectionsFinish[code] = tableEventHandlers;
3125
3125
  }
3126
3126
  tableEventHandlers.push(callbackMethod);
3127
3127
  }
3128
- addTableGetDataStart(tableName, callbackMethod) {
3129
- const tableObject = this.getTable(tableName);
3128
+ addTableGetDataStart(code, callbackMethod) {
3129
+ const tableObject = this.getTable(code);
3130
3130
  if (!tableObject) {
3131
3131
  return;
3132
3132
  }
3133
3133
  let tableEventHandlers = null;
3134
- if (this._tableGetDataStart[tableName]) {
3135
- tableEventHandlers = this._tableGetDataStart[tableName];
3134
+ if (this._tableGetDataStart[code]) {
3135
+ tableEventHandlers = this._tableGetDataStart[code];
3136
3136
  }
3137
3137
  else {
3138
3138
  tableEventHandlers = [];
3139
- this._tableGetDataStart[tableName] = tableEventHandlers;
3139
+ this._tableGetDataStart[code] = tableEventHandlers;
3140
3140
  }
3141
3141
  tableEventHandlers.push(callbackMethod);
3142
3142
  }
3143
- addTableGetDataFinish(tableName, callbackMethod) {
3144
- const tableObject = this.getTable(tableName);
3143
+ addTableGetDataFinish(code, callbackMethod) {
3144
+ const tableObject = this.getTable(code);
3145
3145
  if (!tableObject) {
3146
3146
  return;
3147
3147
  }
3148
3148
  let tableEventHandlers = null;
3149
- if (this._tableGetDataFinish[tableName]) {
3150
- tableEventHandlers = this._tableGetDataFinish[tableName];
3149
+ if (this._tableGetDataFinish[code]) {
3150
+ tableEventHandlers = this._tableGetDataFinish[code];
3151
3151
  }
3152
3152
  else {
3153
3153
  tableEventHandlers = {};
3154
- this._tableGetDataFinish[tableName] = tableEventHandlers;
3154
+ this._tableGetDataFinish[code] = tableEventHandlers;
3155
3155
  }
3156
3156
  tableEventHandlers[GET_DATA_ACTION] = callbackMethod;
3157
3157
  }
@@ -3584,108 +3584,6 @@ class BasicFormComponent {
3584
3584
  }
3585
3585
  return true;
3586
3586
  }
3587
- /**
3588
- * Soporte registros en tablas que se editan en campos del formulario
3589
- */
3590
- defineEditionTable(tableEditionDef) {
3591
- const { columnFieldMapping, recordCaptureFields, startCollapsed } = tableEditionDef;
3592
- tableEditionDef.startCollapsed = (typeof startCollapsed !== 'undefined')
3593
- ? startCollapsed : true;
3594
- const fieldsMappingTable = {};
3595
- const fieldsToClear = [];
3596
- for (const columnMap of columnFieldMapping) {
3597
- const [columnName, formField] = columnMap;
3598
- fieldsMappingTable[columnName] = formField;
3599
- fieldsToClear.push(formField);
3600
- }
3601
- tableEditionDef.fieldsMappingTable = fieldsMappingTable;
3602
- tableEditionDef.fieldsToClear = fieldsToClear;
3603
- const { tableName, newRecordActionName, saveRecordActionName, cancelSaveRecordActionName, tableEditRecordActionName, enableRecordEdition } = tableEditionDef;
3604
- this.addActionMethodStart(newRecordActionName, () => {
3605
- this.cleanFields(fieldsToClear, null);
3606
- this.showFields(recordCaptureFields);
3607
- if (!enableRecordEdition) {
3608
- this.enableRecordEdition(tableEditionDef);
3609
- }
3610
- else {
3611
- enableRecordEdition(tableEditionDef);
3612
- }
3613
- this.hideAction(newRecordActionName);
3614
- this.showAction(cancelSaveRecordActionName);
3615
- this.showAction(saveRecordActionName);
3616
- return true;
3617
- });
3618
- const { recordEditionValidate, disableRecordEdition } = tableEditionDef;
3619
- this.addActionMethodStart(saveRecordActionName, () => {
3620
- return (!recordEditionValidate) ? this.recordEditionValidate(tableEditionDef)
3621
- : recordEditionValidate(tableEditionDef);
3622
- });
3623
- this.addActionMethodFinish(saveRecordActionName, () => {
3624
- if (!this.errorOccured()) {
3625
- return (!disableRecordEdition) ? this.disableRecordEdition(tableEditionDef)
3626
- : disableRecordEdition(tableEditionDef);
3627
- }
3628
- });
3629
- this.addActionMethodStart(cancelSaveRecordActionName, () => {
3630
- return (!disableRecordEdition) ? this.disableRecordEdition(tableEditionDef)
3631
- : disableRecordEdition(tableEditionDef);
3632
- });
3633
- this.addTableActionStart(tableName, tableEditRecordActionName, (tblActObj) => {
3634
- return (!enableRecordEdition)
3635
- ? this.enableRecordEdition(tableEditionDef, tblActObj)
3636
- : enableRecordEdition(tableEditionDef, tblActObj);
3637
- });
3638
- if (tableEditionDef.startCollapsed) {
3639
- return (!tableEditionDef.disableRecordEdition)
3640
- ? this.disableRecordEdition(tableEditionDef)
3641
- : tableEditionDef.disableRecordEdition(tableEditionDef);
3642
- }
3643
- else {
3644
- return (!tableEditionDef.enableRecordEdition)
3645
- ? this.enableRecordEdition(tableEditionDef)
3646
- : tableEditionDef.enableRecordEdition(tableEditionDef, null);
3647
- }
3648
- }
3649
- enableRecordEdition(tableEditionDef, tableActionObject = null) {
3650
- if (tableActionObject) {
3651
- this.copyTableRecordToFields(tableActionObject, tableEditionDef.fieldsMappingTable);
3652
- }
3653
- this.showFields(tableEditionDef.recordCaptureFields);
3654
- this.hideAction(tableEditionDef.newRecordActionName);
3655
- this.showAction(tableEditionDef.cancelSaveRecordActionName);
3656
- this.showAction(tableEditionDef.saveRecordActionName);
3657
- if (tableEditionDef.fieldsToTriggerValidation
3658
- && tableEditionDef.fieldsToTriggerValidation.length > 0) {
3659
- for (const fieldName of tableEditionDef.fieldsToTriggerValidation) {
3660
- this.startFieldValidation(fieldName);
3661
- }
3662
- }
3663
- return true;
3664
- }
3665
- disableRecordEdition(tableDefinition) {
3666
- this.cleanFields(tableDefinition.fieldsToClear, null);
3667
- this.hideFields(tableDefinition.recordCaptureFields);
3668
- this.showAction(tableDefinition.newRecordActionName);
3669
- this.hideAction(tableDefinition.cancelSaveRecordActionName);
3670
- this.hideAction(tableDefinition.saveRecordActionName);
3671
- return true;
3672
- }
3673
- recordEditionValidate(tableEditionDef) {
3674
- const { recordCaptureFields } = tableEditionDef;
3675
- let validationOk = true;
3676
- const requiredEmptyFields = this.getRequiredEmptyFields(recordCaptureFields, null);
3677
- if (requiredEmptyFields.length > 0) {
3678
- validationOk = false;
3679
- this.setError(this.formConfig.formStandardErrors.typeWarning, this.formConfig.formStandardErrors.validationTitle, this.formConfig.formStandardErrors.requiredFields);
3680
- this.tagFieldsWithError(requiredEmptyFields, null, this.formConfig.formStandardErrors.requiredField);
3681
- }
3682
- const validationIssueFields = this.getFieldsWithValidationIssues(recordCaptureFields, null);
3683
- if (validationIssueFields.length > 0) {
3684
- validationOk = false;
3685
- this.setError(this.formConfig.formStandardErrors.typeWarning, this.formConfig.formStandardErrors.validationTitle, this.formConfig.formStandardErrors.validationFields);
3686
- }
3687
- return validationOk;
3688
- }
3689
3587
  }
3690
3588
  BasicFormComponent.decorators = [
3691
3589
  { type: Component, args: [{