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