tuain-ng-forms-lib 13.0.10 → 13.0.11
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.
- package/esm2020/lib/classes/forms/field.mjs +2 -3
- package/esm2020/lib/classes/forms/table/table.mjs +3 -5
- package/esm2020/lib/components/forms/basic-form.mjs +135 -99
- package/fesm2015/tuain-ng-forms-lib.mjs +144 -104
- package/fesm2015/tuain-ng-forms-lib.mjs.map +1 -1
- package/fesm2020/tuain-ng-forms-lib.mjs +137 -104
- package/fesm2020/tuain-ng-forms-lib.mjs.map +1 -1
- package/lib/components/forms/basic-form.d.ts +20 -20
- package/package.json +1 -1
|
@@ -666,8 +666,7 @@ class FieldDescriptor extends FormElement {
|
|
|
666
666
|
get value() { return this.getValue(); }
|
|
667
667
|
set value(newValue) { this.setValue(newValue); }
|
|
668
668
|
notifyEditionPartial() {
|
|
669
|
-
|
|
670
|
-
this._editionPartial.next({ code: this.fieldCode, intrinsicValidation });
|
|
669
|
+
this._editionPartial.next({ code: this.fieldCode, intrinsicValidation: true });
|
|
671
670
|
}
|
|
672
671
|
notifyEditionFinish() {
|
|
673
672
|
let intrinsicValidation = true;
|
|
@@ -1417,10 +1416,8 @@ class RecordTable extends FormElement {
|
|
|
1417
1416
|
this.updateVisibleRecords();
|
|
1418
1417
|
}
|
|
1419
1418
|
recordCompare(recordA, recordB, columnCompare, direction) {
|
|
1420
|
-
const
|
|
1421
|
-
const
|
|
1422
|
-
const recordAColumn = isNaN(recordAValue) ? recordAValue.toLocaleLowerCase() : recordAValue;
|
|
1423
|
-
const recordBColumn = isNaN(recordBValue) ? recordBValue.toLocaleLowerCase() : recordBValue;
|
|
1419
|
+
const recordAColumn = recordA.getFieldValue(columnCompare).toLocaleLowerCase();
|
|
1420
|
+
const recordBColumn = recordB.getFieldValue(columnCompare).toLocaleLowerCase();
|
|
1424
1421
|
let result = 0;
|
|
1425
1422
|
if (recordAColumn < recordBColumn) {
|
|
1426
1423
|
result = -1;
|
|
@@ -2694,40 +2691,40 @@ class BasicFormComponent {
|
|
|
2694
2691
|
/**
|
|
2695
2692
|
* Manejo de event handlers para acciones sobre el formulario
|
|
2696
2693
|
*/
|
|
2697
|
-
addSectionActivation(codes,
|
|
2694
|
+
addSectionActivation(codes, callback, properties = null) {
|
|
2698
2695
|
const sectionSet = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
|
|
2699
2696
|
sectionSet.forEach((sectionName) => {
|
|
2700
2697
|
if (!this._formSectionsActivate[sectionName]) {
|
|
2701
2698
|
this._formSectionsActivate[sectionName] = [];
|
|
2702
2699
|
}
|
|
2703
|
-
this._formSectionsActivate[sectionName].push(
|
|
2700
|
+
this._formSectionsActivate[sectionName].push({ callback, properties });
|
|
2704
2701
|
});
|
|
2705
2702
|
}
|
|
2706
|
-
addSectionInactivation(codes,
|
|
2703
|
+
addSectionInactivation(codes, callback, properties = null) {
|
|
2707
2704
|
const sectionSet = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
|
|
2708
2705
|
sectionSet.forEach((sectionName) => {
|
|
2709
2706
|
if (!this._formSectionsInactivate[sectionName]) {
|
|
2710
2707
|
this._formSectionsInactivate[sectionName] = [];
|
|
2711
2708
|
}
|
|
2712
|
-
this._formSectionsInactivate[sectionName].push(
|
|
2709
|
+
this._formSectionsInactivate[sectionName].push({ callback, properties });
|
|
2713
2710
|
});
|
|
2714
2711
|
}
|
|
2715
|
-
addActionMethodStart(codes,
|
|
2712
|
+
addActionMethodStart(codes, callback, properties = null) {
|
|
2716
2713
|
const actionSet = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
|
|
2717
2714
|
actionSet.forEach((actionName) => {
|
|
2718
2715
|
if (!this._formActionsStart[actionName]) {
|
|
2719
2716
|
this._formActionsStart[actionName] = [];
|
|
2720
2717
|
}
|
|
2721
|
-
this._formActionsStart[actionName].push(
|
|
2718
|
+
this._formActionsStart[actionName].push({ callback, properties });
|
|
2722
2719
|
});
|
|
2723
2720
|
}
|
|
2724
|
-
addActionMethodFinish(codes,
|
|
2721
|
+
addActionMethodFinish(codes, callback, properties = null) {
|
|
2725
2722
|
const actionSet = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
|
|
2726
2723
|
actionSet.forEach((actionName) => {
|
|
2727
2724
|
if (!this._formActionsFinish[actionName]) {
|
|
2728
2725
|
this._formActionsFinish[actionName] = [];
|
|
2729
2726
|
}
|
|
2730
|
-
this._formActionsFinish[actionName].push(
|
|
2727
|
+
this._formActionsFinish[actionName].push({ callback, properties });
|
|
2731
2728
|
});
|
|
2732
2729
|
}
|
|
2733
2730
|
async launchSectionActivation(code) {
|
|
@@ -2738,7 +2735,8 @@ class BasicFormComponent {
|
|
|
2738
2735
|
const clientSectionMethods = this._formSectionsActivate[code];
|
|
2739
2736
|
if (clientSectionMethods) {
|
|
2740
2737
|
for (const clientSectionMethod of clientSectionMethods) {
|
|
2741
|
-
clientSectionMethod
|
|
2738
|
+
const { callback, properties } = clientSectionMethod;
|
|
2739
|
+
callback(sectionObject);
|
|
2742
2740
|
}
|
|
2743
2741
|
}
|
|
2744
2742
|
}
|
|
@@ -2750,7 +2748,8 @@ class BasicFormComponent {
|
|
|
2750
2748
|
const clientSectionMethods = this._formSectionsInactivate[code];
|
|
2751
2749
|
if (clientSectionMethods) {
|
|
2752
2750
|
for (const clientSectionMethod of clientSectionMethods) {
|
|
2753
|
-
clientSectionMethod
|
|
2751
|
+
const { callback, properties } = clientSectionMethod;
|
|
2752
|
+
callback(sectionObject);
|
|
2754
2753
|
}
|
|
2755
2754
|
}
|
|
2756
2755
|
}
|
|
@@ -2765,11 +2764,12 @@ class BasicFormComponent {
|
|
|
2765
2764
|
if (clientActionMethods) {
|
|
2766
2765
|
const clientActionPromises = [];
|
|
2767
2766
|
for (const clientActionMethod of clientActionMethods) {
|
|
2768
|
-
const
|
|
2767
|
+
const { callback, properties } = clientActionMethod;
|
|
2768
|
+
const continueActionPromise = callback(actionObject);
|
|
2769
2769
|
clientActionPromises.push(continueActionPromise);
|
|
2770
2770
|
}
|
|
2771
2771
|
const clientActionResults = await Promise.all(clientActionPromises);
|
|
2772
|
-
const continueAction = clientActionResults.reduce((total, curr) => (total && curr), true);
|
|
2772
|
+
const continueAction = clientActionResults.reduce((total, curr) => (total && (curr !== false)), true);
|
|
2773
2773
|
if (!continueAction) {
|
|
2774
2774
|
actionObject.stop();
|
|
2775
2775
|
return;
|
|
@@ -2780,14 +2780,14 @@ class BasicFormComponent {
|
|
|
2780
2780
|
async startServerAction(actionInput) {
|
|
2781
2781
|
const action = (typeof actionInput === 'string')
|
|
2782
2782
|
? this.getAction(actionInput) : actionInput;
|
|
2783
|
-
let
|
|
2783
|
+
let serverError = false;
|
|
2784
2784
|
let actionResult = null;
|
|
2785
2785
|
if (action.backend) {
|
|
2786
2786
|
actionResult = await this.requestFormAction(action.actionCode);
|
|
2787
|
-
|
|
2787
|
+
serverError = !!this.errorOccured();
|
|
2788
2788
|
}
|
|
2789
|
-
|
|
2790
|
-
|
|
2789
|
+
await this.finishAction(action, actionResult, serverError);
|
|
2790
|
+
if (!serverError) {
|
|
2791
2791
|
action.newState && this.changeState(action.newState);
|
|
2792
2792
|
}
|
|
2793
2793
|
else {
|
|
@@ -2795,12 +2795,16 @@ class BasicFormComponent {
|
|
|
2795
2795
|
}
|
|
2796
2796
|
action.stop();
|
|
2797
2797
|
}
|
|
2798
|
-
async finishAction(action, actionResult) {
|
|
2798
|
+
async finishAction(action, actionResult, serverError = false) {
|
|
2799
2799
|
const finishActionMethods = this._formActionsFinish[action.actionCode];
|
|
2800
2800
|
if (finishActionMethods) {
|
|
2801
2801
|
const clientActionPromises = [];
|
|
2802
2802
|
for (const clientActionMethod of finishActionMethods) {
|
|
2803
|
-
|
|
2803
|
+
const { callback, properties } = clientActionMethod;
|
|
2804
|
+
const continueOnError = properties?.continueOnError ?? false;
|
|
2805
|
+
if (!serverError || continueOnError) {
|
|
2806
|
+
clientActionPromises.push(callback(action, actionResult));
|
|
2807
|
+
}
|
|
2804
2808
|
}
|
|
2805
2809
|
await Promise.all(clientActionPromises);
|
|
2806
2810
|
}
|
|
@@ -2811,31 +2815,31 @@ class BasicFormComponent {
|
|
|
2811
2815
|
/**
|
|
2812
2816
|
* Manejadores de eventos para validaciones sobre campos
|
|
2813
2817
|
*/
|
|
2814
|
-
addFieldInputValidation(codes,
|
|
2818
|
+
addFieldInputValidation(codes, callback, properties = null) {
|
|
2815
2819
|
const fieldSet = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
|
|
2816
2820
|
fieldSet.forEach((fieldCode) => {
|
|
2817
2821
|
if (!this._fieldInputValidation[fieldCode]) {
|
|
2818
2822
|
this._fieldInputValidation[fieldCode] = [];
|
|
2819
2823
|
}
|
|
2820
|
-
this._fieldInputValidation[fieldCode].push(
|
|
2824
|
+
this._fieldInputValidation[fieldCode].push({ callback, properties });
|
|
2821
2825
|
});
|
|
2822
2826
|
}
|
|
2823
|
-
addFieldValidationStart(codes,
|
|
2827
|
+
addFieldValidationStart(codes, callback, properties = null) {
|
|
2824
2828
|
const fieldSet = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
|
|
2825
2829
|
fieldSet.forEach((fieldCode) => {
|
|
2826
2830
|
if (!this._fieldValidationsStart[fieldCode]) {
|
|
2827
2831
|
this._fieldValidationsStart[fieldCode] = [];
|
|
2828
2832
|
}
|
|
2829
|
-
this._fieldValidationsStart[fieldCode].push(
|
|
2833
|
+
this._fieldValidationsStart[fieldCode].push({ callback, properties });
|
|
2830
2834
|
});
|
|
2831
2835
|
}
|
|
2832
|
-
addFieldValidationFinish(codes,
|
|
2836
|
+
addFieldValidationFinish(codes, callback, properties = null) {
|
|
2833
2837
|
const fieldSet = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
|
|
2834
2838
|
fieldSet.forEach((fieldCode) => {
|
|
2835
2839
|
if (!this._fieldValidationsFinish[fieldCode]) {
|
|
2836
2840
|
this._fieldValidationsFinish[fieldCode] = [];
|
|
2837
2841
|
}
|
|
2838
|
-
this._fieldValidationsFinish[fieldCode].push(
|
|
2842
|
+
this._fieldValidationsFinish[fieldCode].push({ callback, properties });
|
|
2839
2843
|
});
|
|
2840
2844
|
}
|
|
2841
2845
|
async startFieldInputValidation(fieldCode, intrinsicValidation = true) {
|
|
@@ -2848,7 +2852,8 @@ class BasicFormComponent {
|
|
|
2848
2852
|
if (validationCallbacks) {
|
|
2849
2853
|
const clientValidationPromises = [];
|
|
2850
2854
|
for (const validationMethod of validationCallbacks) {
|
|
2851
|
-
const
|
|
2855
|
+
const { callback, properties } = validationMethod;
|
|
2856
|
+
const continueValidationPromise = callback(fieldToValidate);
|
|
2852
2857
|
clientValidationPromises.push(continueValidationPromise);
|
|
2853
2858
|
}
|
|
2854
2859
|
await Promise.all(clientValidationPromises);
|
|
@@ -2857,7 +2862,7 @@ class BasicFormComponent {
|
|
|
2857
2862
|
}
|
|
2858
2863
|
async startFieldValidation(fieldCode, intrinsicValidation = true) {
|
|
2859
2864
|
const fieldToValidate = this.getField(fieldCode);
|
|
2860
|
-
if (!fieldToValidate
|
|
2865
|
+
if (!fieldToValidate) {
|
|
2861
2866
|
return;
|
|
2862
2867
|
}
|
|
2863
2868
|
fieldToValidate.resetError();
|
|
@@ -2865,44 +2870,49 @@ class BasicFormComponent {
|
|
|
2865
2870
|
if (validationCallbacks) {
|
|
2866
2871
|
const clientValidationPromises = [];
|
|
2867
2872
|
for (const validationMethod of validationCallbacks) {
|
|
2868
|
-
const
|
|
2873
|
+
const { callback, properties } = validationMethod;
|
|
2874
|
+
const clientValidationPromise = callback(fieldToValidate);
|
|
2869
2875
|
clientValidationPromises.push(clientValidationPromise);
|
|
2870
2876
|
}
|
|
2871
2877
|
const clientValidationResults = await Promise.all(clientValidationPromises);
|
|
2872
|
-
const continueValidation = clientValidationResults.reduce((total, curr) => (total && curr), true);
|
|
2878
|
+
const continueValidation = clientValidationResults.reduce((total, curr) => (total && (curr !== false)), true);
|
|
2873
2879
|
if (!continueValidation) {
|
|
2874
2880
|
return;
|
|
2875
2881
|
}
|
|
2876
2882
|
}
|
|
2877
|
-
|
|
2883
|
+
if (intrinsicValidation) {
|
|
2884
|
+
this.startServerFieldValidation(fieldToValidate);
|
|
2885
|
+
}
|
|
2878
2886
|
}
|
|
2879
2887
|
async startServerFieldValidation(inputField) {
|
|
2880
2888
|
const fieldObj = (typeof inputField === 'string')
|
|
2881
2889
|
? this.getField(inputField) : inputField;
|
|
2882
|
-
let
|
|
2883
|
-
let validationResult =
|
|
2890
|
+
let serverError = false;
|
|
2891
|
+
let validationResult = true;
|
|
2884
2892
|
if (fieldObj.backend) {
|
|
2885
2893
|
fieldObj.validating = true;
|
|
2886
2894
|
validationResult = await this
|
|
2887
2895
|
.requestFormAction(formActions.validate, fieldObj.fieldCode);
|
|
2888
|
-
|
|
2889
|
-
}
|
|
2890
|
-
if (finish) {
|
|
2891
|
-
await this.finishFieldValidation(fieldObj, validationResult);
|
|
2896
|
+
serverError = !!this.errorOccured();
|
|
2892
2897
|
}
|
|
2893
|
-
|
|
2898
|
+
await this.finishFieldValidation(fieldObj, validationResult, serverError);
|
|
2899
|
+
if (serverError) {
|
|
2894
2900
|
fieldObj.setErrorCode(this.errorCode);
|
|
2895
2901
|
fieldObj.setErrorMessage(this.errorMessage);
|
|
2896
2902
|
this.displayValidationServerError();
|
|
2897
2903
|
}
|
|
2898
2904
|
fieldObj.validating = false;
|
|
2899
2905
|
}
|
|
2900
|
-
async finishFieldValidation(fieldObject, validationResult) {
|
|
2906
|
+
async finishFieldValidation(fieldObject, validationResult, serverError = false) {
|
|
2901
2907
|
const validationCallbacks = this._fieldValidationsFinish[fieldObject.fieldCode];
|
|
2902
2908
|
if (validationCallbacks) {
|
|
2903
2909
|
const clientActionPromises = [];
|
|
2904
2910
|
for (const validationMethod of validationCallbacks) {
|
|
2905
|
-
|
|
2911
|
+
const { callback, properties } = validationMethod;
|
|
2912
|
+
const continueOnError = properties?.continueOnError ?? false;
|
|
2913
|
+
if (!serverError || continueOnError) {
|
|
2914
|
+
clientActionPromises.push(callback(fieldObject, validationResult));
|
|
2915
|
+
}
|
|
2906
2916
|
}
|
|
2907
2917
|
await Promise.all(clientActionPromises);
|
|
2908
2918
|
}
|
|
@@ -2913,7 +2923,7 @@ class BasicFormComponent {
|
|
|
2913
2923
|
/**
|
|
2914
2924
|
* Manejadores de eventos para acciones sobre Tablas
|
|
2915
2925
|
*/
|
|
2916
|
-
addTableActionStart(code, actionCode,
|
|
2926
|
+
addTableActionStart(code, actionCode, callback, properties = null) {
|
|
2917
2927
|
const tableObject = this.getTable(code);
|
|
2918
2928
|
if (!tableObject) {
|
|
2919
2929
|
return;
|
|
@@ -2922,7 +2932,7 @@ class BasicFormComponent {
|
|
|
2922
2932
|
if (!inlineActionObject) {
|
|
2923
2933
|
return;
|
|
2924
2934
|
}
|
|
2925
|
-
let tableEventHandlers
|
|
2935
|
+
let tableEventHandlers;
|
|
2926
2936
|
if (this._tableActionsStart[code]) {
|
|
2927
2937
|
tableEventHandlers = this._tableActionsStart[code];
|
|
2928
2938
|
}
|
|
@@ -2933,9 +2943,9 @@ class BasicFormComponent {
|
|
|
2933
2943
|
if (!tableEventHandlers[actionCode]) {
|
|
2934
2944
|
tableEventHandlers[actionCode] = [];
|
|
2935
2945
|
}
|
|
2936
|
-
tableEventHandlers[actionCode].push(
|
|
2946
|
+
tableEventHandlers[actionCode].push({ callback, properties });
|
|
2937
2947
|
}
|
|
2938
|
-
addTableActionFinish(code, actionCode,
|
|
2948
|
+
addTableActionFinish(code, actionCode, callback, properties = null) {
|
|
2939
2949
|
const tableObject = this.getTable(code);
|
|
2940
2950
|
if (!tableObject) {
|
|
2941
2951
|
return;
|
|
@@ -2944,7 +2954,7 @@ class BasicFormComponent {
|
|
|
2944
2954
|
if (!inlineActionObject) {
|
|
2945
2955
|
return;
|
|
2946
2956
|
}
|
|
2947
|
-
let tableEventHandlers
|
|
2957
|
+
let tableEventHandlers;
|
|
2948
2958
|
if (this._tableActionsFinish[code]) {
|
|
2949
2959
|
tableEventHandlers = this._tableActionsFinish[code];
|
|
2950
2960
|
}
|
|
@@ -2955,14 +2965,14 @@ class BasicFormComponent {
|
|
|
2955
2965
|
if (!tableEventHandlers[actionCode]) {
|
|
2956
2966
|
tableEventHandlers[actionCode] = [];
|
|
2957
2967
|
}
|
|
2958
|
-
tableEventHandlers[actionCode].push(
|
|
2968
|
+
tableEventHandlers[actionCode].push({ callback, properties });
|
|
2959
2969
|
}
|
|
2960
|
-
addTableSelectionStart(code,
|
|
2970
|
+
addTableSelectionStart(code, callback, properties = null) {
|
|
2961
2971
|
const tableObject = this.getTable(code);
|
|
2962
2972
|
if (!tableObject) {
|
|
2963
2973
|
return;
|
|
2964
2974
|
}
|
|
2965
|
-
let tableEventHandlers
|
|
2975
|
+
let tableEventHandlers;
|
|
2966
2976
|
if (this._tableSelectionsStart[code]) {
|
|
2967
2977
|
tableEventHandlers = this._tableSelectionsStart[code];
|
|
2968
2978
|
}
|
|
@@ -2970,14 +2980,14 @@ class BasicFormComponent {
|
|
|
2970
2980
|
tableEventHandlers = [];
|
|
2971
2981
|
this._tableSelectionsStart[code] = tableEventHandlers;
|
|
2972
2982
|
}
|
|
2973
|
-
tableEventHandlers.push(
|
|
2983
|
+
tableEventHandlers.push({ callback, properties });
|
|
2974
2984
|
}
|
|
2975
|
-
addTableSelectionFinish(code,
|
|
2985
|
+
addTableSelectionFinish(code, callback, properties = null) {
|
|
2976
2986
|
const tableObject = this.getTable(code);
|
|
2977
2987
|
if (!tableObject) {
|
|
2978
2988
|
return;
|
|
2979
2989
|
}
|
|
2980
|
-
let tableEventHandlers
|
|
2990
|
+
let tableEventHandlers;
|
|
2981
2991
|
if (this._tableSelectionsFinish[code]) {
|
|
2982
2992
|
tableEventHandlers = this._tableSelectionsFinish[code];
|
|
2983
2993
|
}
|
|
@@ -2985,14 +2995,14 @@ class BasicFormComponent {
|
|
|
2985
2995
|
tableEventHandlers = [];
|
|
2986
2996
|
this._tableSelectionsFinish[code] = tableEventHandlers;
|
|
2987
2997
|
}
|
|
2988
|
-
tableEventHandlers.push(
|
|
2998
|
+
tableEventHandlers.push({ callback, properties });
|
|
2989
2999
|
}
|
|
2990
|
-
addTableGetDataStart(code,
|
|
3000
|
+
addTableGetDataStart(code, callback, properties = null) {
|
|
2991
3001
|
const tableObject = this.getTable(code);
|
|
2992
3002
|
if (!tableObject) {
|
|
2993
3003
|
return;
|
|
2994
3004
|
}
|
|
2995
|
-
let tableEventHandlers
|
|
3005
|
+
let tableEventHandlers;
|
|
2996
3006
|
if (this._tableGetDataStart[code]) {
|
|
2997
3007
|
tableEventHandlers = this._tableGetDataStart[code];
|
|
2998
3008
|
}
|
|
@@ -3000,14 +3010,14 @@ class BasicFormComponent {
|
|
|
3000
3010
|
tableEventHandlers = [];
|
|
3001
3011
|
this._tableGetDataStart[code] = tableEventHandlers;
|
|
3002
3012
|
}
|
|
3003
|
-
tableEventHandlers.push(
|
|
3013
|
+
tableEventHandlers.push({ callback, properties });
|
|
3004
3014
|
}
|
|
3005
|
-
addTableGetDataFinish(code,
|
|
3015
|
+
addTableGetDataFinish(code, callback, properties = null) {
|
|
3006
3016
|
const tableObject = this.getTable(code);
|
|
3007
3017
|
if (!tableObject) {
|
|
3008
3018
|
return;
|
|
3009
3019
|
}
|
|
3010
|
-
let tableEventHandlers
|
|
3020
|
+
let tableEventHandlers;
|
|
3011
3021
|
if (this._tableGetDataFinish[code]) {
|
|
3012
3022
|
tableEventHandlers = this._tableGetDataFinish[code];
|
|
3013
3023
|
}
|
|
@@ -3015,7 +3025,7 @@ class BasicFormComponent {
|
|
|
3015
3025
|
tableEventHandlers = {};
|
|
3016
3026
|
this._tableGetDataFinish[code] = tableEventHandlers;
|
|
3017
3027
|
}
|
|
3018
|
-
tableEventHandlers[GET_DATA_ACTION] =
|
|
3028
|
+
tableEventHandlers[GET_DATA_ACTION] = { callback, properties };
|
|
3019
3029
|
}
|
|
3020
3030
|
async startTableGlobalAction(tableActionEvent) {
|
|
3021
3031
|
const { tableCode, actionCode } = tableActionEvent;
|
|
@@ -3039,11 +3049,12 @@ class BasicFormComponent {
|
|
|
3039
3049
|
if (tableActionMethods) {
|
|
3040
3050
|
const clientActionPromises = [];
|
|
3041
3051
|
for (const tableActionMethod of tableActionMethods) {
|
|
3042
|
-
const
|
|
3052
|
+
const { callback, properties } = tableActionMethod;
|
|
3053
|
+
const clientActionPromise = callback(tableActionDetail);
|
|
3043
3054
|
clientActionPromises.push(clientActionPromise);
|
|
3044
3055
|
}
|
|
3045
3056
|
const clientActionResults = await Promise.all(clientActionPromises);
|
|
3046
|
-
const continueAction = clientActionResults.reduce((total, curr) => (total && curr), true);
|
|
3057
|
+
const continueAction = clientActionResults.reduce((total, curr) => (total && (curr !== false)), true);
|
|
3047
3058
|
if (!continueAction) {
|
|
3048
3059
|
return;
|
|
3049
3060
|
}
|
|
@@ -3056,7 +3067,7 @@ class BasicFormComponent {
|
|
|
3056
3067
|
return;
|
|
3057
3068
|
}
|
|
3058
3069
|
tableObject.putOnWait();
|
|
3059
|
-
let
|
|
3070
|
+
let serverError = false;
|
|
3060
3071
|
let actionResult = null;
|
|
3061
3072
|
if (action.backend) {
|
|
3062
3073
|
const actionSubject = {
|
|
@@ -3066,10 +3077,10 @@ class BasicFormComponent {
|
|
|
3066
3077
|
};
|
|
3067
3078
|
actionResult = await this
|
|
3068
3079
|
.requestFormAction(formActions.tableAction, actionSubject);
|
|
3069
|
-
|
|
3080
|
+
serverError = !!this.errorOccured();
|
|
3070
3081
|
}
|
|
3071
|
-
|
|
3072
|
-
|
|
3082
|
+
await this.finishTableGlobalAction(tableActionDetail, actionResult, serverError);
|
|
3083
|
+
if (!serverError) {
|
|
3073
3084
|
action.newState && this.changeState(action.newState);
|
|
3074
3085
|
}
|
|
3075
3086
|
else {
|
|
@@ -3077,14 +3088,18 @@ class BasicFormComponent {
|
|
|
3077
3088
|
}
|
|
3078
3089
|
tableObject.freeWaiting();
|
|
3079
3090
|
}
|
|
3080
|
-
async finishTableGlobalAction(tableActionDetail, actionResult) {
|
|
3091
|
+
async finishTableGlobalAction(tableActionDetail, actionResult, serverError = false) {
|
|
3081
3092
|
const { tableCode, actionCode } = tableActionDetail;
|
|
3082
3093
|
const tableEventHandlers = this._tableActionsFinish[tableCode];
|
|
3083
3094
|
const tableActionMethods = (tableEventHandlers) ? tableEventHandlers[actionCode] : null;
|
|
3084
3095
|
if (tableActionMethods) {
|
|
3085
3096
|
const clientActionPromises = [];
|
|
3086
3097
|
for (const tableActionMethod of tableActionMethods) {
|
|
3087
|
-
|
|
3098
|
+
const { callback, properties } = tableActionMethod;
|
|
3099
|
+
const continueOnError = properties?.continueOnError ?? false;
|
|
3100
|
+
if (!serverError || continueOnError) {
|
|
3101
|
+
clientActionPromises.push(callback(tableActionDetail, actionResult));
|
|
3102
|
+
}
|
|
3088
3103
|
}
|
|
3089
3104
|
await Promise.all(clientActionPromises);
|
|
3090
3105
|
}
|
|
@@ -3114,11 +3129,12 @@ class BasicFormComponent {
|
|
|
3114
3129
|
if (tableActionMethods) {
|
|
3115
3130
|
const clientActionPromises = [];
|
|
3116
3131
|
for (const tableActionMethod of tableActionMethods) {
|
|
3117
|
-
const
|
|
3132
|
+
const { callback, properties } = tableActionMethod;
|
|
3133
|
+
const clientActionPromise = callback(tableActionDetail);
|
|
3118
3134
|
clientActionPromises.push(clientActionPromise);
|
|
3119
3135
|
}
|
|
3120
3136
|
const clientActionResults = await Promise.all(clientActionPromises);
|
|
3121
|
-
const continueAction = clientActionResults.reduce((total, curr) => (total && curr), true);
|
|
3137
|
+
const continueAction = clientActionResults.reduce((total, curr) => (total && (curr !== false)), true);
|
|
3122
3138
|
if (!continueAction) {
|
|
3123
3139
|
return;
|
|
3124
3140
|
}
|
|
@@ -3131,7 +3147,7 @@ class BasicFormComponent {
|
|
|
3131
3147
|
return;
|
|
3132
3148
|
}
|
|
3133
3149
|
tableObject.putOnWait();
|
|
3134
|
-
let
|
|
3150
|
+
let serverError = false;
|
|
3135
3151
|
let actionResult = null;
|
|
3136
3152
|
if (action.backend) {
|
|
3137
3153
|
const actionSubject = {
|
|
@@ -3143,10 +3159,10 @@ class BasicFormComponent {
|
|
|
3143
3159
|
};
|
|
3144
3160
|
actionResult = await this
|
|
3145
3161
|
.requestFormAction(formActions.tableAction, actionSubject);
|
|
3146
|
-
|
|
3162
|
+
serverError = !!this.errorOccured();
|
|
3147
3163
|
}
|
|
3148
|
-
|
|
3149
|
-
|
|
3164
|
+
await this.finishTableAction(tableActionDetail, actionResult, serverError);
|
|
3165
|
+
if (!serverError) {
|
|
3150
3166
|
action.newState && this.changeState(action.newState);
|
|
3151
3167
|
}
|
|
3152
3168
|
else {
|
|
@@ -3157,14 +3173,18 @@ class BasicFormComponent {
|
|
|
3157
3173
|
completeInlineAction(tableAction) {
|
|
3158
3174
|
return this.startTableServerAction(tableAction);
|
|
3159
3175
|
}
|
|
3160
|
-
async finishTableAction(tableActionDetail, actionResult) {
|
|
3176
|
+
async finishTableAction(tableActionDetail, actionResult, serverError = false) {
|
|
3161
3177
|
const { tableCode, actionCode } = tableActionDetail;
|
|
3162
3178
|
const tableEventHandlers = this._tableActionsFinish[tableCode];
|
|
3163
3179
|
const tableActionMethods = (tableEventHandlers) ? tableEventHandlers[actionCode] : null;
|
|
3164
3180
|
if (tableActionMethods) {
|
|
3165
3181
|
const clientActionPromises = [];
|
|
3166
3182
|
for (const tableActionMethod of tableActionMethods) {
|
|
3167
|
-
|
|
3183
|
+
const { callback, properties } = tableActionMethod;
|
|
3184
|
+
const continueOnError = properties?.continueOnError ?? false;
|
|
3185
|
+
if (!serverError || continueOnError) {
|
|
3186
|
+
clientActionPromises.push(callback(tableActionDetail, actionResult));
|
|
3187
|
+
}
|
|
3168
3188
|
}
|
|
3169
3189
|
await Promise.all(clientActionPromises);
|
|
3170
3190
|
}
|
|
@@ -3187,11 +3207,12 @@ class BasicFormComponent {
|
|
|
3187
3207
|
if (tableEventHandlers) {
|
|
3188
3208
|
const clientActionPromises = [];
|
|
3189
3209
|
for (const tableSelectionMethod of tableEventHandlers) {
|
|
3190
|
-
const
|
|
3210
|
+
const { callback, properties } = tableSelectionMethod;
|
|
3211
|
+
const clientActionPromise = callback(tableSelectionDetail);
|
|
3191
3212
|
clientActionPromises.push(clientActionPromise);
|
|
3192
3213
|
}
|
|
3193
3214
|
const clientActionResults = await Promise.all(clientActionPromises);
|
|
3194
|
-
const continueAction = clientActionResults.reduce((total, curr) => (total && curr), true);
|
|
3215
|
+
const continueAction = clientActionResults.reduce((total, curr) => (total && (curr !== false)), true);
|
|
3195
3216
|
if (!continueAction) {
|
|
3196
3217
|
return;
|
|
3197
3218
|
}
|
|
@@ -3204,7 +3225,7 @@ class BasicFormComponent {
|
|
|
3204
3225
|
return;
|
|
3205
3226
|
}
|
|
3206
3227
|
tableObject.putOnWait();
|
|
3207
|
-
let
|
|
3228
|
+
let serverError = false;
|
|
3208
3229
|
let actionResult = null;
|
|
3209
3230
|
if (tableObject.selectionBackend) {
|
|
3210
3231
|
const actionSubject = {
|
|
@@ -3216,23 +3237,25 @@ class BasicFormComponent {
|
|
|
3216
3237
|
};
|
|
3217
3238
|
actionResult = await this
|
|
3218
3239
|
.requestFormAction(formActions.tableAction, actionSubject);
|
|
3219
|
-
|
|
3240
|
+
serverError = !!this.errorOccured();
|
|
3220
3241
|
}
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
}
|
|
3224
|
-
else {
|
|
3242
|
+
await this.finishTableRecordSelection(tableSelectionDetail, actionResult, serverError);
|
|
3243
|
+
if (serverError) {
|
|
3225
3244
|
this.displayTableServerError();
|
|
3226
3245
|
}
|
|
3227
3246
|
tableObject.freeWaiting();
|
|
3228
3247
|
}
|
|
3229
|
-
async finishTableRecordSelection(tableSelectionDetail, actionResult) {
|
|
3248
|
+
async finishTableRecordSelection(tableSelectionDetail, actionResult, serverError = false) {
|
|
3230
3249
|
const { tableCode } = tableSelectionDetail;
|
|
3231
3250
|
const tableEventHandlers = this._tableSelectionsFinish[tableCode];
|
|
3232
3251
|
if (tableEventHandlers) {
|
|
3233
3252
|
const clientActionPromises = [];
|
|
3234
3253
|
for (const tableSelectionMethod of tableEventHandlers) {
|
|
3235
|
-
|
|
3254
|
+
const { callback, properties } = tableSelectionMethod;
|
|
3255
|
+
const continueOnError = properties?.continueOnError ?? false;
|
|
3256
|
+
if (!serverError || continueOnError) {
|
|
3257
|
+
clientActionPromises.push(callback(tableSelectionDetail, actionResult));
|
|
3258
|
+
}
|
|
3236
3259
|
}
|
|
3237
3260
|
await Promise.all(clientActionPromises);
|
|
3238
3261
|
}
|
|
@@ -3261,11 +3284,12 @@ class BasicFormComponent {
|
|
|
3261
3284
|
if (tableActionMethods) {
|
|
3262
3285
|
const clientActionPromises = [];
|
|
3263
3286
|
for (const tableActionMethod of tableActionMethods) {
|
|
3264
|
-
const
|
|
3287
|
+
const { callback, properties } = tableActionMethod;
|
|
3288
|
+
const clientActionPromise = callback(tableActionDetail);
|
|
3265
3289
|
clientActionPromises.push(clientActionPromise);
|
|
3266
3290
|
}
|
|
3267
3291
|
const clientActionResults = await Promise.all(clientActionPromises);
|
|
3268
|
-
const continueAction = clientActionResults.reduce((total, curr) => (total && curr), true);
|
|
3292
|
+
const continueAction = clientActionResults.reduce((total, curr) => (total && (curr !== false)), true);
|
|
3269
3293
|
if (!continueAction) {
|
|
3270
3294
|
return;
|
|
3271
3295
|
}
|
|
@@ -3278,7 +3302,7 @@ class BasicFormComponent {
|
|
|
3278
3302
|
return;
|
|
3279
3303
|
}
|
|
3280
3304
|
tableObject.putOnWait();
|
|
3281
|
-
let
|
|
3305
|
+
let serverError = false;
|
|
3282
3306
|
let actionResult = null;
|
|
3283
3307
|
if (action.backend) {
|
|
3284
3308
|
const actionSubject = {
|
|
@@ -3289,10 +3313,10 @@ class BasicFormComponent {
|
|
|
3289
3313
|
};
|
|
3290
3314
|
actionResult = await this
|
|
3291
3315
|
.requestFormAction(formActions.tableAction, actionSubject);
|
|
3292
|
-
|
|
3316
|
+
serverError = !!this.errorOccured();
|
|
3293
3317
|
}
|
|
3294
|
-
|
|
3295
|
-
|
|
3318
|
+
await this.finishTableSelectionAction(tableActionDetail, actionResult, serverError);
|
|
3319
|
+
if (!serverError) {
|
|
3296
3320
|
action.newState && this.changeState(action.newState);
|
|
3297
3321
|
}
|
|
3298
3322
|
else {
|
|
@@ -3300,14 +3324,18 @@ class BasicFormComponent {
|
|
|
3300
3324
|
}
|
|
3301
3325
|
tableObject.freeWaiting();
|
|
3302
3326
|
}
|
|
3303
|
-
async finishTableSelectionAction(tableActionDetail, actionResult) {
|
|
3327
|
+
async finishTableSelectionAction(tableActionDetail, actionResult, serverError = false) {
|
|
3304
3328
|
const { tableCode, actionCode } = tableActionDetail;
|
|
3305
3329
|
const tableEventHandlers = this._tableActionsFinish[tableCode];
|
|
3306
3330
|
const tableActionMethods = (tableEventHandlers) ? tableEventHandlers[actionCode] : null;
|
|
3307
3331
|
if (tableActionMethods) {
|
|
3308
3332
|
const clientActionPromises = [];
|
|
3309
3333
|
for (const tableActionMethod of tableActionMethods) {
|
|
3310
|
-
|
|
3334
|
+
const { callback, properties } = tableActionMethod;
|
|
3335
|
+
const continueOnError = properties?.continueOnError ?? false;
|
|
3336
|
+
if (!serverError || continueOnError) {
|
|
3337
|
+
clientActionPromises.push(callback(tableActionDetail, actionResult));
|
|
3338
|
+
}
|
|
3311
3339
|
}
|
|
3312
3340
|
await Promise.all(clientActionPromises);
|
|
3313
3341
|
}
|
|
@@ -3324,11 +3352,12 @@ class BasicFormComponent {
|
|
|
3324
3352
|
if (tableEventHandlers) {
|
|
3325
3353
|
const clientActionPromises = [];
|
|
3326
3354
|
for (const tableActionMethod of tableEventHandlers) {
|
|
3327
|
-
const
|
|
3355
|
+
const { callback, properties } = tableActionMethod;
|
|
3356
|
+
const clientActionPromise = callback(tableActionDetail);
|
|
3328
3357
|
clientActionPromises.push(clientActionPromise);
|
|
3329
3358
|
}
|
|
3330
3359
|
const clientActionResults = await Promise.all(clientActionPromises);
|
|
3331
|
-
const continueAction = clientActionResults.reduce((total, curr) => (total && curr), true);
|
|
3360
|
+
const continueAction = clientActionResults.reduce((total, curr) => (total && (curr !== false)), true);
|
|
3332
3361
|
if (!continueAction) {
|
|
3333
3362
|
return;
|
|
3334
3363
|
}
|
|
@@ -3338,25 +3367,29 @@ class BasicFormComponent {
|
|
|
3338
3367
|
async startTableServerGetData(tableActionDetail) {
|
|
3339
3368
|
const { tableObject, tableCode } = tableActionDetail;
|
|
3340
3369
|
tableObject.putOnWait();
|
|
3370
|
+
let serverError = false;
|
|
3341
3371
|
const actionSubject = { tableCode };
|
|
3342
3372
|
const actionResult = await this
|
|
3343
3373
|
.requestFormAction(formActions.getTableData, actionSubject);
|
|
3344
|
-
|
|
3374
|
+
serverError = !!this.errorOccured();
|
|
3375
|
+
await this.finishTableGetData(tableActionDetail, actionResult, serverError);
|
|
3376
|
+
if (serverError) {
|
|
3345
3377
|
this.displayTableServerError();
|
|
3346
3378
|
}
|
|
3347
|
-
else {
|
|
3348
|
-
this.finishTableGetData(tableActionDetail, actionResult);
|
|
3349
|
-
}
|
|
3350
3379
|
tableObject.freeWaiting();
|
|
3351
3380
|
}
|
|
3352
|
-
async finishTableGetData(tableActionDetail, actionResult) {
|
|
3381
|
+
async finishTableGetData(tableActionDetail, actionResult, serverError = false) {
|
|
3353
3382
|
const { tableCode, tableActionCode } = tableActionDetail;
|
|
3354
3383
|
const tableEventHandlers = this._tableActionsFinish[tableCode];
|
|
3355
3384
|
const tableActionMethods = (tableEventHandlers) ? tableEventHandlers[tableActionCode] : null;
|
|
3356
3385
|
if (tableActionMethods) {
|
|
3357
3386
|
const clientActionPromises = [];
|
|
3358
3387
|
for (const tableActionMethod of tableActionMethods) {
|
|
3359
|
-
|
|
3388
|
+
const { callback, properties } = tableActionMethod;
|
|
3389
|
+
const continueOnError = properties?.continueOnError ?? false;
|
|
3390
|
+
if (!serverError || continueOnError) {
|
|
3391
|
+
clientActionPromises.push(callback(tableActionDetail, actionResult));
|
|
3392
|
+
}
|
|
3360
3393
|
}
|
|
3361
3394
|
await Promise.all(clientActionPromises);
|
|
3362
3395
|
}
|