tuain-ng-forms-lib 13.0.9 → 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/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
|
@@ -684,8 +684,7 @@ class FieldDescriptor extends FormElement {
|
|
|
684
684
|
get value() { return this.getValue(); }
|
|
685
685
|
set value(newValue) { this.setValue(newValue); }
|
|
686
686
|
notifyEditionPartial() {
|
|
687
|
-
|
|
688
|
-
this._editionPartial.next({ code: this.fieldCode, intrinsicValidation });
|
|
687
|
+
this._editionPartial.next({ code: this.fieldCode, intrinsicValidation: true });
|
|
689
688
|
}
|
|
690
689
|
notifyEditionFinish() {
|
|
691
690
|
var _a, _b, _c, _d, _e;
|
|
@@ -2795,40 +2794,40 @@ class BasicFormComponent {
|
|
|
2795
2794
|
/**
|
|
2796
2795
|
* Manejo de event handlers para acciones sobre el formulario
|
|
2797
2796
|
*/
|
|
2798
|
-
addSectionActivation(codes,
|
|
2797
|
+
addSectionActivation(codes, callback, properties = null) {
|
|
2799
2798
|
const sectionSet = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
|
|
2800
2799
|
sectionSet.forEach((sectionName) => {
|
|
2801
2800
|
if (!this._formSectionsActivate[sectionName]) {
|
|
2802
2801
|
this._formSectionsActivate[sectionName] = [];
|
|
2803
2802
|
}
|
|
2804
|
-
this._formSectionsActivate[sectionName].push(
|
|
2803
|
+
this._formSectionsActivate[sectionName].push({ callback, properties });
|
|
2805
2804
|
});
|
|
2806
2805
|
}
|
|
2807
|
-
addSectionInactivation(codes,
|
|
2806
|
+
addSectionInactivation(codes, callback, properties = null) {
|
|
2808
2807
|
const sectionSet = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
|
|
2809
2808
|
sectionSet.forEach((sectionName) => {
|
|
2810
2809
|
if (!this._formSectionsInactivate[sectionName]) {
|
|
2811
2810
|
this._formSectionsInactivate[sectionName] = [];
|
|
2812
2811
|
}
|
|
2813
|
-
this._formSectionsInactivate[sectionName].push(
|
|
2812
|
+
this._formSectionsInactivate[sectionName].push({ callback, properties });
|
|
2814
2813
|
});
|
|
2815
2814
|
}
|
|
2816
|
-
addActionMethodStart(codes,
|
|
2815
|
+
addActionMethodStart(codes, callback, properties = null) {
|
|
2817
2816
|
const actionSet = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
|
|
2818
2817
|
actionSet.forEach((actionName) => {
|
|
2819
2818
|
if (!this._formActionsStart[actionName]) {
|
|
2820
2819
|
this._formActionsStart[actionName] = [];
|
|
2821
2820
|
}
|
|
2822
|
-
this._formActionsStart[actionName].push(
|
|
2821
|
+
this._formActionsStart[actionName].push({ callback, properties });
|
|
2823
2822
|
});
|
|
2824
2823
|
}
|
|
2825
|
-
addActionMethodFinish(codes,
|
|
2824
|
+
addActionMethodFinish(codes, callback, properties = null) {
|
|
2826
2825
|
const actionSet = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
|
|
2827
2826
|
actionSet.forEach((actionName) => {
|
|
2828
2827
|
if (!this._formActionsFinish[actionName]) {
|
|
2829
2828
|
this._formActionsFinish[actionName] = [];
|
|
2830
2829
|
}
|
|
2831
|
-
this._formActionsFinish[actionName].push(
|
|
2830
|
+
this._formActionsFinish[actionName].push({ callback, properties });
|
|
2832
2831
|
});
|
|
2833
2832
|
}
|
|
2834
2833
|
launchSectionActivation(code) {
|
|
@@ -2840,7 +2839,8 @@ class BasicFormComponent {
|
|
|
2840
2839
|
const clientSectionMethods = this._formSectionsActivate[code];
|
|
2841
2840
|
if (clientSectionMethods) {
|
|
2842
2841
|
for (const clientSectionMethod of clientSectionMethods) {
|
|
2843
|
-
clientSectionMethod
|
|
2842
|
+
const { callback, properties } = clientSectionMethod;
|
|
2843
|
+
callback(sectionObject);
|
|
2844
2844
|
}
|
|
2845
2845
|
}
|
|
2846
2846
|
});
|
|
@@ -2854,7 +2854,8 @@ class BasicFormComponent {
|
|
|
2854
2854
|
const clientSectionMethods = this._formSectionsInactivate[code];
|
|
2855
2855
|
if (clientSectionMethods) {
|
|
2856
2856
|
for (const clientSectionMethod of clientSectionMethods) {
|
|
2857
|
-
clientSectionMethod
|
|
2857
|
+
const { callback, properties } = clientSectionMethod;
|
|
2858
|
+
callback(sectionObject);
|
|
2858
2859
|
}
|
|
2859
2860
|
}
|
|
2860
2861
|
});
|
|
@@ -2871,11 +2872,12 @@ class BasicFormComponent {
|
|
|
2871
2872
|
if (clientActionMethods) {
|
|
2872
2873
|
const clientActionPromises = [];
|
|
2873
2874
|
for (const clientActionMethod of clientActionMethods) {
|
|
2874
|
-
const
|
|
2875
|
+
const { callback, properties } = clientActionMethod;
|
|
2876
|
+
const continueActionPromise = callback(actionObject);
|
|
2875
2877
|
clientActionPromises.push(continueActionPromise);
|
|
2876
2878
|
}
|
|
2877
2879
|
const clientActionResults = yield Promise.all(clientActionPromises);
|
|
2878
|
-
const continueAction = clientActionResults.reduce((total, curr) => (total && curr), true);
|
|
2880
|
+
const continueAction = clientActionResults.reduce((total, curr) => (total && (curr !== false)), true);
|
|
2879
2881
|
if (!continueAction) {
|
|
2880
2882
|
actionObject.stop();
|
|
2881
2883
|
return;
|
|
@@ -2888,14 +2890,14 @@ class BasicFormComponent {
|
|
|
2888
2890
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2889
2891
|
const action = (typeof actionInput === 'string')
|
|
2890
2892
|
? this.getAction(actionInput) : actionInput;
|
|
2891
|
-
let
|
|
2893
|
+
let serverError = false;
|
|
2892
2894
|
let actionResult = null;
|
|
2893
2895
|
if (action.backend) {
|
|
2894
2896
|
actionResult = yield this.requestFormAction(action.actionCode);
|
|
2895
|
-
|
|
2897
|
+
serverError = !!this.errorOccured();
|
|
2896
2898
|
}
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
+
yield this.finishAction(action, actionResult, serverError);
|
|
2900
|
+
if (!serverError) {
|
|
2899
2901
|
action.newState && this.changeState(action.newState);
|
|
2900
2902
|
}
|
|
2901
2903
|
else {
|
|
@@ -2904,13 +2906,18 @@ class BasicFormComponent {
|
|
|
2904
2906
|
action.stop();
|
|
2905
2907
|
});
|
|
2906
2908
|
}
|
|
2907
|
-
finishAction(action, actionResult) {
|
|
2909
|
+
finishAction(action, actionResult, serverError = false) {
|
|
2910
|
+
var _a;
|
|
2908
2911
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2909
2912
|
const finishActionMethods = this._formActionsFinish[action.actionCode];
|
|
2910
2913
|
if (finishActionMethods) {
|
|
2911
2914
|
const clientActionPromises = [];
|
|
2912
2915
|
for (const clientActionMethod of finishActionMethods) {
|
|
2913
|
-
|
|
2916
|
+
const { callback, properties } = clientActionMethod;
|
|
2917
|
+
const continueOnError = (_a = properties === null || properties === void 0 ? void 0 : properties.continueOnError) !== null && _a !== void 0 ? _a : false;
|
|
2918
|
+
if (!serverError || continueOnError) {
|
|
2919
|
+
clientActionPromises.push(callback(action, actionResult));
|
|
2920
|
+
}
|
|
2914
2921
|
}
|
|
2915
2922
|
yield Promise.all(clientActionPromises);
|
|
2916
2923
|
}
|
|
@@ -2922,31 +2929,31 @@ class BasicFormComponent {
|
|
|
2922
2929
|
/**
|
|
2923
2930
|
* Manejadores de eventos para validaciones sobre campos
|
|
2924
2931
|
*/
|
|
2925
|
-
addFieldInputValidation(codes,
|
|
2932
|
+
addFieldInputValidation(codes, callback, properties = null) {
|
|
2926
2933
|
const fieldSet = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
|
|
2927
2934
|
fieldSet.forEach((fieldCode) => {
|
|
2928
2935
|
if (!this._fieldInputValidation[fieldCode]) {
|
|
2929
2936
|
this._fieldInputValidation[fieldCode] = [];
|
|
2930
2937
|
}
|
|
2931
|
-
this._fieldInputValidation[fieldCode].push(
|
|
2938
|
+
this._fieldInputValidation[fieldCode].push({ callback, properties });
|
|
2932
2939
|
});
|
|
2933
2940
|
}
|
|
2934
|
-
addFieldValidationStart(codes,
|
|
2941
|
+
addFieldValidationStart(codes, callback, properties = null) {
|
|
2935
2942
|
const fieldSet = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
|
|
2936
2943
|
fieldSet.forEach((fieldCode) => {
|
|
2937
2944
|
if (!this._fieldValidationsStart[fieldCode]) {
|
|
2938
2945
|
this._fieldValidationsStart[fieldCode] = [];
|
|
2939
2946
|
}
|
|
2940
|
-
this._fieldValidationsStart[fieldCode].push(
|
|
2947
|
+
this._fieldValidationsStart[fieldCode].push({ callback, properties });
|
|
2941
2948
|
});
|
|
2942
2949
|
}
|
|
2943
|
-
addFieldValidationFinish(codes,
|
|
2950
|
+
addFieldValidationFinish(codes, callback, properties = null) {
|
|
2944
2951
|
const fieldSet = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
|
|
2945
2952
|
fieldSet.forEach((fieldCode) => {
|
|
2946
2953
|
if (!this._fieldValidationsFinish[fieldCode]) {
|
|
2947
2954
|
this._fieldValidationsFinish[fieldCode] = [];
|
|
2948
2955
|
}
|
|
2949
|
-
this._fieldValidationsFinish[fieldCode].push(
|
|
2956
|
+
this._fieldValidationsFinish[fieldCode].push({ callback, properties });
|
|
2950
2957
|
});
|
|
2951
2958
|
}
|
|
2952
2959
|
startFieldInputValidation(fieldCode, intrinsicValidation = true) {
|
|
@@ -2960,7 +2967,8 @@ class BasicFormComponent {
|
|
|
2960
2967
|
if (validationCallbacks) {
|
|
2961
2968
|
const clientValidationPromises = [];
|
|
2962
2969
|
for (const validationMethod of validationCallbacks) {
|
|
2963
|
-
const
|
|
2970
|
+
const { callback, properties } = validationMethod;
|
|
2971
|
+
const continueValidationPromise = callback(fieldToValidate);
|
|
2964
2972
|
clientValidationPromises.push(continueValidationPromise);
|
|
2965
2973
|
}
|
|
2966
2974
|
yield Promise.all(clientValidationPromises);
|
|
@@ -2971,7 +2979,7 @@ class BasicFormComponent {
|
|
|
2971
2979
|
startFieldValidation(fieldCode, intrinsicValidation = true) {
|
|
2972
2980
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2973
2981
|
const fieldToValidate = this.getField(fieldCode);
|
|
2974
|
-
if (!fieldToValidate
|
|
2982
|
+
if (!fieldToValidate) {
|
|
2975
2983
|
return;
|
|
2976
2984
|
}
|
|
2977
2985
|
fieldToValidate.resetError();
|
|
@@ -2979,34 +2987,35 @@ class BasicFormComponent {
|
|
|
2979
2987
|
if (validationCallbacks) {
|
|
2980
2988
|
const clientValidationPromises = [];
|
|
2981
2989
|
for (const validationMethod of validationCallbacks) {
|
|
2982
|
-
const
|
|
2990
|
+
const { callback, properties } = validationMethod;
|
|
2991
|
+
const clientValidationPromise = callback(fieldToValidate);
|
|
2983
2992
|
clientValidationPromises.push(clientValidationPromise);
|
|
2984
2993
|
}
|
|
2985
2994
|
const clientValidationResults = yield Promise.all(clientValidationPromises);
|
|
2986
|
-
const continueValidation = clientValidationResults.reduce((total, curr) => (total && curr), true);
|
|
2995
|
+
const continueValidation = clientValidationResults.reduce((total, curr) => (total && (curr !== false)), true);
|
|
2987
2996
|
if (!continueValidation) {
|
|
2988
2997
|
return;
|
|
2989
2998
|
}
|
|
2990
2999
|
}
|
|
2991
|
-
|
|
3000
|
+
if (intrinsicValidation) {
|
|
3001
|
+
this.startServerFieldValidation(fieldToValidate);
|
|
3002
|
+
}
|
|
2992
3003
|
});
|
|
2993
3004
|
}
|
|
2994
3005
|
startServerFieldValidation(inputField) {
|
|
2995
3006
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2996
3007
|
const fieldObj = (typeof inputField === 'string')
|
|
2997
3008
|
? this.getField(inputField) : inputField;
|
|
2998
|
-
let
|
|
2999
|
-
let validationResult =
|
|
3009
|
+
let serverError = false;
|
|
3010
|
+
let validationResult = true;
|
|
3000
3011
|
if (fieldObj.backend) {
|
|
3001
3012
|
fieldObj.validating = true;
|
|
3002
3013
|
validationResult = yield this
|
|
3003
3014
|
.requestFormAction(formActions.validate, fieldObj.fieldCode);
|
|
3004
|
-
|
|
3005
|
-
}
|
|
3006
|
-
if (finish) {
|
|
3007
|
-
yield this.finishFieldValidation(fieldObj, validationResult);
|
|
3015
|
+
serverError = !!this.errorOccured();
|
|
3008
3016
|
}
|
|
3009
|
-
|
|
3017
|
+
yield this.finishFieldValidation(fieldObj, validationResult, serverError);
|
|
3018
|
+
if (serverError) {
|
|
3010
3019
|
fieldObj.setErrorCode(this.errorCode);
|
|
3011
3020
|
fieldObj.setErrorMessage(this.errorMessage);
|
|
3012
3021
|
this.displayValidationServerError();
|
|
@@ -3014,13 +3023,18 @@ class BasicFormComponent {
|
|
|
3014
3023
|
fieldObj.validating = false;
|
|
3015
3024
|
});
|
|
3016
3025
|
}
|
|
3017
|
-
finishFieldValidation(fieldObject, validationResult) {
|
|
3026
|
+
finishFieldValidation(fieldObject, validationResult, serverError = false) {
|
|
3027
|
+
var _a;
|
|
3018
3028
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3019
3029
|
const validationCallbacks = this._fieldValidationsFinish[fieldObject.fieldCode];
|
|
3020
3030
|
if (validationCallbacks) {
|
|
3021
3031
|
const clientActionPromises = [];
|
|
3022
3032
|
for (const validationMethod of validationCallbacks) {
|
|
3023
|
-
|
|
3033
|
+
const { callback, properties } = validationMethod;
|
|
3034
|
+
const continueOnError = (_a = properties === null || properties === void 0 ? void 0 : properties.continueOnError) !== null && _a !== void 0 ? _a : false;
|
|
3035
|
+
if (!serverError || continueOnError) {
|
|
3036
|
+
clientActionPromises.push(callback(fieldObject, validationResult));
|
|
3037
|
+
}
|
|
3024
3038
|
}
|
|
3025
3039
|
yield Promise.all(clientActionPromises);
|
|
3026
3040
|
}
|
|
@@ -3034,7 +3048,7 @@ class BasicFormComponent {
|
|
|
3034
3048
|
/**
|
|
3035
3049
|
* Manejadores de eventos para acciones sobre Tablas
|
|
3036
3050
|
*/
|
|
3037
|
-
addTableActionStart(code, actionCode,
|
|
3051
|
+
addTableActionStart(code, actionCode, callback, properties = null) {
|
|
3038
3052
|
const tableObject = this.getTable(code);
|
|
3039
3053
|
if (!tableObject) {
|
|
3040
3054
|
return;
|
|
@@ -3043,7 +3057,7 @@ class BasicFormComponent {
|
|
|
3043
3057
|
if (!inlineActionObject) {
|
|
3044
3058
|
return;
|
|
3045
3059
|
}
|
|
3046
|
-
let tableEventHandlers
|
|
3060
|
+
let tableEventHandlers;
|
|
3047
3061
|
if (this._tableActionsStart[code]) {
|
|
3048
3062
|
tableEventHandlers = this._tableActionsStart[code];
|
|
3049
3063
|
}
|
|
@@ -3054,9 +3068,9 @@ class BasicFormComponent {
|
|
|
3054
3068
|
if (!tableEventHandlers[actionCode]) {
|
|
3055
3069
|
tableEventHandlers[actionCode] = [];
|
|
3056
3070
|
}
|
|
3057
|
-
tableEventHandlers[actionCode].push(
|
|
3071
|
+
tableEventHandlers[actionCode].push({ callback, properties });
|
|
3058
3072
|
}
|
|
3059
|
-
addTableActionFinish(code, actionCode,
|
|
3073
|
+
addTableActionFinish(code, actionCode, callback, properties = null) {
|
|
3060
3074
|
const tableObject = this.getTable(code);
|
|
3061
3075
|
if (!tableObject) {
|
|
3062
3076
|
return;
|
|
@@ -3065,7 +3079,7 @@ class BasicFormComponent {
|
|
|
3065
3079
|
if (!inlineActionObject) {
|
|
3066
3080
|
return;
|
|
3067
3081
|
}
|
|
3068
|
-
let tableEventHandlers
|
|
3082
|
+
let tableEventHandlers;
|
|
3069
3083
|
if (this._tableActionsFinish[code]) {
|
|
3070
3084
|
tableEventHandlers = this._tableActionsFinish[code];
|
|
3071
3085
|
}
|
|
@@ -3076,14 +3090,14 @@ class BasicFormComponent {
|
|
|
3076
3090
|
if (!tableEventHandlers[actionCode]) {
|
|
3077
3091
|
tableEventHandlers[actionCode] = [];
|
|
3078
3092
|
}
|
|
3079
|
-
tableEventHandlers[actionCode].push(
|
|
3093
|
+
tableEventHandlers[actionCode].push({ callback, properties });
|
|
3080
3094
|
}
|
|
3081
|
-
addTableSelectionStart(code,
|
|
3095
|
+
addTableSelectionStart(code, callback, properties = null) {
|
|
3082
3096
|
const tableObject = this.getTable(code);
|
|
3083
3097
|
if (!tableObject) {
|
|
3084
3098
|
return;
|
|
3085
3099
|
}
|
|
3086
|
-
let tableEventHandlers
|
|
3100
|
+
let tableEventHandlers;
|
|
3087
3101
|
if (this._tableSelectionsStart[code]) {
|
|
3088
3102
|
tableEventHandlers = this._tableSelectionsStart[code];
|
|
3089
3103
|
}
|
|
@@ -3091,14 +3105,14 @@ class BasicFormComponent {
|
|
|
3091
3105
|
tableEventHandlers = [];
|
|
3092
3106
|
this._tableSelectionsStart[code] = tableEventHandlers;
|
|
3093
3107
|
}
|
|
3094
|
-
tableEventHandlers.push(
|
|
3108
|
+
tableEventHandlers.push({ callback, properties });
|
|
3095
3109
|
}
|
|
3096
|
-
addTableSelectionFinish(code,
|
|
3110
|
+
addTableSelectionFinish(code, callback, properties = null) {
|
|
3097
3111
|
const tableObject = this.getTable(code);
|
|
3098
3112
|
if (!tableObject) {
|
|
3099
3113
|
return;
|
|
3100
3114
|
}
|
|
3101
|
-
let tableEventHandlers
|
|
3115
|
+
let tableEventHandlers;
|
|
3102
3116
|
if (this._tableSelectionsFinish[code]) {
|
|
3103
3117
|
tableEventHandlers = this._tableSelectionsFinish[code];
|
|
3104
3118
|
}
|
|
@@ -3106,14 +3120,14 @@ class BasicFormComponent {
|
|
|
3106
3120
|
tableEventHandlers = [];
|
|
3107
3121
|
this._tableSelectionsFinish[code] = tableEventHandlers;
|
|
3108
3122
|
}
|
|
3109
|
-
tableEventHandlers.push(
|
|
3123
|
+
tableEventHandlers.push({ callback, properties });
|
|
3110
3124
|
}
|
|
3111
|
-
addTableGetDataStart(code,
|
|
3125
|
+
addTableGetDataStart(code, callback, properties = null) {
|
|
3112
3126
|
const tableObject = this.getTable(code);
|
|
3113
3127
|
if (!tableObject) {
|
|
3114
3128
|
return;
|
|
3115
3129
|
}
|
|
3116
|
-
let tableEventHandlers
|
|
3130
|
+
let tableEventHandlers;
|
|
3117
3131
|
if (this._tableGetDataStart[code]) {
|
|
3118
3132
|
tableEventHandlers = this._tableGetDataStart[code];
|
|
3119
3133
|
}
|
|
@@ -3121,14 +3135,14 @@ class BasicFormComponent {
|
|
|
3121
3135
|
tableEventHandlers = [];
|
|
3122
3136
|
this._tableGetDataStart[code] = tableEventHandlers;
|
|
3123
3137
|
}
|
|
3124
|
-
tableEventHandlers.push(
|
|
3138
|
+
tableEventHandlers.push({ callback, properties });
|
|
3125
3139
|
}
|
|
3126
|
-
addTableGetDataFinish(code,
|
|
3140
|
+
addTableGetDataFinish(code, callback, properties = null) {
|
|
3127
3141
|
const tableObject = this.getTable(code);
|
|
3128
3142
|
if (!tableObject) {
|
|
3129
3143
|
return;
|
|
3130
3144
|
}
|
|
3131
|
-
let tableEventHandlers
|
|
3145
|
+
let tableEventHandlers;
|
|
3132
3146
|
if (this._tableGetDataFinish[code]) {
|
|
3133
3147
|
tableEventHandlers = this._tableGetDataFinish[code];
|
|
3134
3148
|
}
|
|
@@ -3136,7 +3150,7 @@ class BasicFormComponent {
|
|
|
3136
3150
|
tableEventHandlers = {};
|
|
3137
3151
|
this._tableGetDataFinish[code] = tableEventHandlers;
|
|
3138
3152
|
}
|
|
3139
|
-
tableEventHandlers[GET_DATA_ACTION] =
|
|
3153
|
+
tableEventHandlers[GET_DATA_ACTION] = { callback, properties };
|
|
3140
3154
|
}
|
|
3141
3155
|
startTableGlobalAction(tableActionEvent) {
|
|
3142
3156
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -3161,11 +3175,12 @@ class BasicFormComponent {
|
|
|
3161
3175
|
if (tableActionMethods) {
|
|
3162
3176
|
const clientActionPromises = [];
|
|
3163
3177
|
for (const tableActionMethod of tableActionMethods) {
|
|
3164
|
-
const
|
|
3178
|
+
const { callback, properties } = tableActionMethod;
|
|
3179
|
+
const clientActionPromise = callback(tableActionDetail);
|
|
3165
3180
|
clientActionPromises.push(clientActionPromise);
|
|
3166
3181
|
}
|
|
3167
3182
|
const clientActionResults = yield Promise.all(clientActionPromises);
|
|
3168
|
-
const continueAction = clientActionResults.reduce((total, curr) => (total && curr), true);
|
|
3183
|
+
const continueAction = clientActionResults.reduce((total, curr) => (total && (curr !== false)), true);
|
|
3169
3184
|
if (!continueAction) {
|
|
3170
3185
|
return;
|
|
3171
3186
|
}
|
|
@@ -3180,7 +3195,7 @@ class BasicFormComponent {
|
|
|
3180
3195
|
return;
|
|
3181
3196
|
}
|
|
3182
3197
|
tableObject.putOnWait();
|
|
3183
|
-
let
|
|
3198
|
+
let serverError = false;
|
|
3184
3199
|
let actionResult = null;
|
|
3185
3200
|
if (action.backend) {
|
|
3186
3201
|
const actionSubject = {
|
|
@@ -3190,10 +3205,10 @@ class BasicFormComponent {
|
|
|
3190
3205
|
};
|
|
3191
3206
|
actionResult = yield this
|
|
3192
3207
|
.requestFormAction(formActions.tableAction, actionSubject);
|
|
3193
|
-
|
|
3208
|
+
serverError = !!this.errorOccured();
|
|
3194
3209
|
}
|
|
3195
|
-
|
|
3196
|
-
|
|
3210
|
+
yield this.finishTableGlobalAction(tableActionDetail, actionResult, serverError);
|
|
3211
|
+
if (!serverError) {
|
|
3197
3212
|
action.newState && this.changeState(action.newState);
|
|
3198
3213
|
}
|
|
3199
3214
|
else {
|
|
@@ -3202,7 +3217,8 @@ class BasicFormComponent {
|
|
|
3202
3217
|
tableObject.freeWaiting();
|
|
3203
3218
|
});
|
|
3204
3219
|
}
|
|
3205
|
-
finishTableGlobalAction(tableActionDetail, actionResult) {
|
|
3220
|
+
finishTableGlobalAction(tableActionDetail, actionResult, serverError = false) {
|
|
3221
|
+
var _a;
|
|
3206
3222
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3207
3223
|
const { tableCode, actionCode } = tableActionDetail;
|
|
3208
3224
|
const tableEventHandlers = this._tableActionsFinish[tableCode];
|
|
@@ -3210,7 +3226,11 @@ class BasicFormComponent {
|
|
|
3210
3226
|
if (tableActionMethods) {
|
|
3211
3227
|
const clientActionPromises = [];
|
|
3212
3228
|
for (const tableActionMethod of tableActionMethods) {
|
|
3213
|
-
|
|
3229
|
+
const { callback, properties } = tableActionMethod;
|
|
3230
|
+
const continueOnError = (_a = properties === null || properties === void 0 ? void 0 : properties.continueOnError) !== null && _a !== void 0 ? _a : false;
|
|
3231
|
+
if (!serverError || continueOnError) {
|
|
3232
|
+
clientActionPromises.push(callback(tableActionDetail, actionResult));
|
|
3233
|
+
}
|
|
3214
3234
|
}
|
|
3215
3235
|
yield Promise.all(clientActionPromises);
|
|
3216
3236
|
}
|
|
@@ -3242,11 +3262,12 @@ class BasicFormComponent {
|
|
|
3242
3262
|
if (tableActionMethods) {
|
|
3243
3263
|
const clientActionPromises = [];
|
|
3244
3264
|
for (const tableActionMethod of tableActionMethods) {
|
|
3245
|
-
const
|
|
3265
|
+
const { callback, properties } = tableActionMethod;
|
|
3266
|
+
const clientActionPromise = callback(tableActionDetail);
|
|
3246
3267
|
clientActionPromises.push(clientActionPromise);
|
|
3247
3268
|
}
|
|
3248
3269
|
const clientActionResults = yield Promise.all(clientActionPromises);
|
|
3249
|
-
const continueAction = clientActionResults.reduce((total, curr) => (total && curr), true);
|
|
3270
|
+
const continueAction = clientActionResults.reduce((total, curr) => (total && (curr !== false)), true);
|
|
3250
3271
|
if (!continueAction) {
|
|
3251
3272
|
return;
|
|
3252
3273
|
}
|
|
@@ -3261,7 +3282,7 @@ class BasicFormComponent {
|
|
|
3261
3282
|
return;
|
|
3262
3283
|
}
|
|
3263
3284
|
tableObject.putOnWait();
|
|
3264
|
-
let
|
|
3285
|
+
let serverError = false;
|
|
3265
3286
|
let actionResult = null;
|
|
3266
3287
|
if (action.backend) {
|
|
3267
3288
|
const actionSubject = {
|
|
@@ -3273,10 +3294,10 @@ class BasicFormComponent {
|
|
|
3273
3294
|
};
|
|
3274
3295
|
actionResult = yield this
|
|
3275
3296
|
.requestFormAction(formActions.tableAction, actionSubject);
|
|
3276
|
-
|
|
3297
|
+
serverError = !!this.errorOccured();
|
|
3277
3298
|
}
|
|
3278
|
-
|
|
3279
|
-
|
|
3299
|
+
yield this.finishTableAction(tableActionDetail, actionResult, serverError);
|
|
3300
|
+
if (!serverError) {
|
|
3280
3301
|
action.newState && this.changeState(action.newState);
|
|
3281
3302
|
}
|
|
3282
3303
|
else {
|
|
@@ -3288,7 +3309,8 @@ class BasicFormComponent {
|
|
|
3288
3309
|
completeInlineAction(tableAction) {
|
|
3289
3310
|
return this.startTableServerAction(tableAction);
|
|
3290
3311
|
}
|
|
3291
|
-
finishTableAction(tableActionDetail, actionResult) {
|
|
3312
|
+
finishTableAction(tableActionDetail, actionResult, serverError = false) {
|
|
3313
|
+
var _a;
|
|
3292
3314
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3293
3315
|
const { tableCode, actionCode } = tableActionDetail;
|
|
3294
3316
|
const tableEventHandlers = this._tableActionsFinish[tableCode];
|
|
@@ -3296,7 +3318,11 @@ class BasicFormComponent {
|
|
|
3296
3318
|
if (tableActionMethods) {
|
|
3297
3319
|
const clientActionPromises = [];
|
|
3298
3320
|
for (const tableActionMethod of tableActionMethods) {
|
|
3299
|
-
|
|
3321
|
+
const { callback, properties } = tableActionMethod;
|
|
3322
|
+
const continueOnError = (_a = properties === null || properties === void 0 ? void 0 : properties.continueOnError) !== null && _a !== void 0 ? _a : false;
|
|
3323
|
+
if (!serverError || continueOnError) {
|
|
3324
|
+
clientActionPromises.push(callback(tableActionDetail, actionResult));
|
|
3325
|
+
}
|
|
3300
3326
|
}
|
|
3301
3327
|
yield Promise.all(clientActionPromises);
|
|
3302
3328
|
}
|
|
@@ -3321,11 +3347,12 @@ class BasicFormComponent {
|
|
|
3321
3347
|
if (tableEventHandlers) {
|
|
3322
3348
|
const clientActionPromises = [];
|
|
3323
3349
|
for (const tableSelectionMethod of tableEventHandlers) {
|
|
3324
|
-
const
|
|
3350
|
+
const { callback, properties } = tableSelectionMethod;
|
|
3351
|
+
const clientActionPromise = callback(tableSelectionDetail);
|
|
3325
3352
|
clientActionPromises.push(clientActionPromise);
|
|
3326
3353
|
}
|
|
3327
3354
|
const clientActionResults = yield Promise.all(clientActionPromises);
|
|
3328
|
-
const continueAction = clientActionResults.reduce((total, curr) => (total && curr), true);
|
|
3355
|
+
const continueAction = clientActionResults.reduce((total, curr) => (total && (curr !== false)), true);
|
|
3329
3356
|
if (!continueAction) {
|
|
3330
3357
|
return;
|
|
3331
3358
|
}
|
|
@@ -3340,7 +3367,7 @@ class BasicFormComponent {
|
|
|
3340
3367
|
return;
|
|
3341
3368
|
}
|
|
3342
3369
|
tableObject.putOnWait();
|
|
3343
|
-
let
|
|
3370
|
+
let serverError = false;
|
|
3344
3371
|
let actionResult = null;
|
|
3345
3372
|
if (tableObject.selectionBackend) {
|
|
3346
3373
|
const actionSubject = {
|
|
@@ -3352,25 +3379,28 @@ class BasicFormComponent {
|
|
|
3352
3379
|
};
|
|
3353
3380
|
actionResult = yield this
|
|
3354
3381
|
.requestFormAction(formActions.tableAction, actionSubject);
|
|
3355
|
-
|
|
3356
|
-
}
|
|
3357
|
-
if (finish) {
|
|
3358
|
-
this.finishTableRecordSelection(tableSelectionDetail, actionResult);
|
|
3382
|
+
serverError = !!this.errorOccured();
|
|
3359
3383
|
}
|
|
3360
|
-
|
|
3384
|
+
yield this.finishTableRecordSelection(tableSelectionDetail, actionResult, serverError);
|
|
3385
|
+
if (serverError) {
|
|
3361
3386
|
this.displayTableServerError();
|
|
3362
3387
|
}
|
|
3363
3388
|
tableObject.freeWaiting();
|
|
3364
3389
|
});
|
|
3365
3390
|
}
|
|
3366
|
-
finishTableRecordSelection(tableSelectionDetail, actionResult) {
|
|
3391
|
+
finishTableRecordSelection(tableSelectionDetail, actionResult, serverError = false) {
|
|
3392
|
+
var _a;
|
|
3367
3393
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3368
3394
|
const { tableCode } = tableSelectionDetail;
|
|
3369
3395
|
const tableEventHandlers = this._tableSelectionsFinish[tableCode];
|
|
3370
3396
|
if (tableEventHandlers) {
|
|
3371
3397
|
const clientActionPromises = [];
|
|
3372
3398
|
for (const tableSelectionMethod of tableEventHandlers) {
|
|
3373
|
-
|
|
3399
|
+
const { callback, properties } = tableSelectionMethod;
|
|
3400
|
+
const continueOnError = (_a = properties === null || properties === void 0 ? void 0 : properties.continueOnError) !== null && _a !== void 0 ? _a : false;
|
|
3401
|
+
if (!serverError || continueOnError) {
|
|
3402
|
+
clientActionPromises.push(callback(tableSelectionDetail, actionResult));
|
|
3403
|
+
}
|
|
3374
3404
|
}
|
|
3375
3405
|
yield Promise.all(clientActionPromises);
|
|
3376
3406
|
}
|
|
@@ -3401,11 +3431,12 @@ class BasicFormComponent {
|
|
|
3401
3431
|
if (tableActionMethods) {
|
|
3402
3432
|
const clientActionPromises = [];
|
|
3403
3433
|
for (const tableActionMethod of tableActionMethods) {
|
|
3404
|
-
const
|
|
3434
|
+
const { callback, properties } = tableActionMethod;
|
|
3435
|
+
const clientActionPromise = callback(tableActionDetail);
|
|
3405
3436
|
clientActionPromises.push(clientActionPromise);
|
|
3406
3437
|
}
|
|
3407
3438
|
const clientActionResults = yield Promise.all(clientActionPromises);
|
|
3408
|
-
const continueAction = clientActionResults.reduce((total, curr) => (total && curr), true);
|
|
3439
|
+
const continueAction = clientActionResults.reduce((total, curr) => (total && (curr !== false)), true);
|
|
3409
3440
|
if (!continueAction) {
|
|
3410
3441
|
return;
|
|
3411
3442
|
}
|
|
@@ -3420,7 +3451,7 @@ class BasicFormComponent {
|
|
|
3420
3451
|
return;
|
|
3421
3452
|
}
|
|
3422
3453
|
tableObject.putOnWait();
|
|
3423
|
-
let
|
|
3454
|
+
let serverError = false;
|
|
3424
3455
|
let actionResult = null;
|
|
3425
3456
|
if (action.backend) {
|
|
3426
3457
|
const actionSubject = {
|
|
@@ -3431,10 +3462,10 @@ class BasicFormComponent {
|
|
|
3431
3462
|
};
|
|
3432
3463
|
actionResult = yield this
|
|
3433
3464
|
.requestFormAction(formActions.tableAction, actionSubject);
|
|
3434
|
-
|
|
3465
|
+
serverError = !!this.errorOccured();
|
|
3435
3466
|
}
|
|
3436
|
-
|
|
3437
|
-
|
|
3467
|
+
yield this.finishTableSelectionAction(tableActionDetail, actionResult, serverError);
|
|
3468
|
+
if (!serverError) {
|
|
3438
3469
|
action.newState && this.changeState(action.newState);
|
|
3439
3470
|
}
|
|
3440
3471
|
else {
|
|
@@ -3443,7 +3474,8 @@ class BasicFormComponent {
|
|
|
3443
3474
|
tableObject.freeWaiting();
|
|
3444
3475
|
});
|
|
3445
3476
|
}
|
|
3446
|
-
finishTableSelectionAction(tableActionDetail, actionResult) {
|
|
3477
|
+
finishTableSelectionAction(tableActionDetail, actionResult, serverError = false) {
|
|
3478
|
+
var _a;
|
|
3447
3479
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3448
3480
|
const { tableCode, actionCode } = tableActionDetail;
|
|
3449
3481
|
const tableEventHandlers = this._tableActionsFinish[tableCode];
|
|
@@ -3451,7 +3483,11 @@ class BasicFormComponent {
|
|
|
3451
3483
|
if (tableActionMethods) {
|
|
3452
3484
|
const clientActionPromises = [];
|
|
3453
3485
|
for (const tableActionMethod of tableActionMethods) {
|
|
3454
|
-
|
|
3486
|
+
const { callback, properties } = tableActionMethod;
|
|
3487
|
+
const continueOnError = (_a = properties === null || properties === void 0 ? void 0 : properties.continueOnError) !== null && _a !== void 0 ? _a : false;
|
|
3488
|
+
if (!serverError || continueOnError) {
|
|
3489
|
+
clientActionPromises.push(callback(tableActionDetail, actionResult));
|
|
3490
|
+
}
|
|
3455
3491
|
}
|
|
3456
3492
|
yield Promise.all(clientActionPromises);
|
|
3457
3493
|
}
|
|
@@ -3470,11 +3506,12 @@ class BasicFormComponent {
|
|
|
3470
3506
|
if (tableEventHandlers) {
|
|
3471
3507
|
const clientActionPromises = [];
|
|
3472
3508
|
for (const tableActionMethod of tableEventHandlers) {
|
|
3473
|
-
const
|
|
3509
|
+
const { callback, properties } = tableActionMethod;
|
|
3510
|
+
const clientActionPromise = callback(tableActionDetail);
|
|
3474
3511
|
clientActionPromises.push(clientActionPromise);
|
|
3475
3512
|
}
|
|
3476
3513
|
const clientActionResults = yield Promise.all(clientActionPromises);
|
|
3477
|
-
const continueAction = clientActionResults.reduce((total, curr) => (total && curr), true);
|
|
3514
|
+
const continueAction = clientActionResults.reduce((total, curr) => (total && (curr !== false)), true);
|
|
3478
3515
|
if (!continueAction) {
|
|
3479
3516
|
return;
|
|
3480
3517
|
}
|
|
@@ -3486,19 +3523,20 @@ class BasicFormComponent {
|
|
|
3486
3523
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3487
3524
|
const { tableObject, tableCode } = tableActionDetail;
|
|
3488
3525
|
tableObject.putOnWait();
|
|
3526
|
+
let serverError = false;
|
|
3489
3527
|
const actionSubject = { tableCode };
|
|
3490
3528
|
const actionResult = yield this
|
|
3491
3529
|
.requestFormAction(formActions.getTableData, actionSubject);
|
|
3492
|
-
|
|
3530
|
+
serverError = !!this.errorOccured();
|
|
3531
|
+
yield this.finishTableGetData(tableActionDetail, actionResult, serverError);
|
|
3532
|
+
if (serverError) {
|
|
3493
3533
|
this.displayTableServerError();
|
|
3494
3534
|
}
|
|
3495
|
-
else {
|
|
3496
|
-
this.finishTableGetData(tableActionDetail, actionResult);
|
|
3497
|
-
}
|
|
3498
3535
|
tableObject.freeWaiting();
|
|
3499
3536
|
});
|
|
3500
3537
|
}
|
|
3501
|
-
finishTableGetData(tableActionDetail, actionResult) {
|
|
3538
|
+
finishTableGetData(tableActionDetail, actionResult, serverError = false) {
|
|
3539
|
+
var _a;
|
|
3502
3540
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3503
3541
|
const { tableCode, tableActionCode } = tableActionDetail;
|
|
3504
3542
|
const tableEventHandlers = this._tableActionsFinish[tableCode];
|
|
@@ -3506,7 +3544,11 @@ class BasicFormComponent {
|
|
|
3506
3544
|
if (tableActionMethods) {
|
|
3507
3545
|
const clientActionPromises = [];
|
|
3508
3546
|
for (const tableActionMethod of tableActionMethods) {
|
|
3509
|
-
|
|
3547
|
+
const { callback, properties } = tableActionMethod;
|
|
3548
|
+
const continueOnError = (_a = properties === null || properties === void 0 ? void 0 : properties.continueOnError) !== null && _a !== void 0 ? _a : false;
|
|
3549
|
+
if (!serverError || continueOnError) {
|
|
3550
|
+
clientActionPromises.push(callback(tableActionDetail, actionResult));
|
|
3551
|
+
}
|
|
3510
3552
|
}
|
|
3511
3553
|
yield Promise.all(clientActionPromises);
|
|
3512
3554
|
}
|