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