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