@legalplace/wizardx-core 4.5.0 → 4.5.1
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.
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { EMAIL_REGEX } from "../../constants/emailValidation";
|
|
2
1
|
import { UPDATE_OPTION_INPUT, UPDATE_VARIABLE_INPUT, ADD_MULTIPLE_OCCURENCY, DELETE_MULTIPLE_OCCURENCY, } from "../constants/inputs";
|
|
3
2
|
import { selectVariableInputByIndex, selectOptionInputByIndex, selectOptionInput, } from "../selectors/inputs";
|
|
4
3
|
import { SET_MANDATORY_OPTION, SET_MANDATORY_VARIABLE, } from "../constants/mandatories";
|
|
@@ -6,7 +5,7 @@ import { selectOptionRelations, selectOptionReference, selectSectionReference, s
|
|
|
6
5
|
import { selectMandatoryOption, selectMandatoryVariable, } from "../selectors/mandatories";
|
|
7
6
|
import { setMandatoryOptionAction, setMandatorySectionAction, setMandatoryVariableAction, } from "../actions/mandatories";
|
|
8
7
|
import { UPDATE_OPTION_CONDITION, UPDATE_VARIABLE_CONDITION, UPDATE_SECTION_CONDITION, } from "../constants/conditions";
|
|
9
|
-
import { selectOptionConditionValue, selectVariableConditionValue, selectIsOptionDisplayed, selectIsVariableDisplayed,
|
|
8
|
+
import { selectOptionConditionValue, selectVariableConditionValue, selectIsOptionDisplayed, selectIsVariableDisplayed, } from "../selectors/conditions";
|
|
10
9
|
import { FETCH_MODEL_SUCCEEDED } from "../constants/app";
|
|
11
10
|
import { checkDateValidity } from "../../helpers/date.helper";
|
|
12
11
|
import { checkPhoneNumberValidity } from "../../helpers/phoneNumber.helper";
|
|
@@ -121,7 +120,6 @@ const watchSectionMandatory = (mpi, next, action) => {
|
|
|
121
120
|
validateSectionMandatory(mpi, sectionId);
|
|
122
121
|
};
|
|
123
122
|
const watchUpdateVariableInputCondition = (mpi, next, action, ignoreNext) => {
|
|
124
|
-
var _a;
|
|
125
123
|
const { type, id, index, value } = action;
|
|
126
124
|
if (ignoreNext !== true)
|
|
127
125
|
next(action);
|
|
@@ -130,29 +128,19 @@ const watchUpdateVariableInputCondition = (mpi, next, action, ignoreNext) => {
|
|
|
130
128
|
const inputValue = type === UPDATE_VARIABLE_INPUT
|
|
131
129
|
? `${value}`.trim().length > 0
|
|
132
130
|
: `${selectVariableInputByIndex(id, index)}`.trim().length > 0;
|
|
133
|
-
const { type: variableType
|
|
131
|
+
const { type: variableType } = selectVariableReference(id);
|
|
134
132
|
const conditionValue = action.type === UPDATE_VARIABLE_CONDITION
|
|
135
133
|
? action.value
|
|
136
134
|
: selectVariableConditionValue(id, index) !== false;
|
|
137
135
|
let mandatoryValue = !conditionValue || (conditionValue && inputValue);
|
|
138
|
-
|
|
139
|
-
typeof value === "string" &&
|
|
140
|
-
!EMAIL_REGEX.test(value.toString());
|
|
141
|
-
const dateInvalidCheck = variableType === "date" &&
|
|
142
|
-
typeof value === "string" &&
|
|
143
|
-
!checkDateValidity(value);
|
|
144
|
-
const phoneNumberInvalidCheck = variableType === "phone_number" &&
|
|
136
|
+
if (variableType === "date" &&
|
|
145
137
|
typeof value === "string" &&
|
|
146
|
-
!
|
|
147
|
-
|
|
138
|
+
!checkDateValidity(value)) {
|
|
139
|
+
mandatoryValue = false;
|
|
140
|
+
}
|
|
141
|
+
if (variableType === "phone_number" &&
|
|
148
142
|
typeof value === "string" &&
|
|
149
|
-
!(value
|
|
150
|
-
const customValidatorInvalidCheck = selectVariableValidatorConditionValue(id, index) === false;
|
|
151
|
-
if (emailInvalidCheck ||
|
|
152
|
-
dateInvalidCheck ||
|
|
153
|
-
phoneNumberInvalidCheck ||
|
|
154
|
-
maskInvalidityCheck ||
|
|
155
|
-
customValidatorInvalidCheck) {
|
|
143
|
+
!checkPhoneNumberValidity(value)) {
|
|
156
144
|
mandatoryValue = false;
|
|
157
145
|
}
|
|
158
146
|
mpi.dispatch(setMandatoryVariableAction(id, index, mandatoryValue));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legalplace/wizardx-core",
|
|
3
|
-
"version": "4.5.
|
|
3
|
+
"version": "4.5.1",
|
|
4
4
|
"author": "Moncef Hammou (moncef@legalplace.fr)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -95,5 +95,5 @@
|
|
|
95
95
|
"*.test.ts",
|
|
96
96
|
"*.test.tsx"
|
|
97
97
|
],
|
|
98
|
-
"gitHead": "
|
|
98
|
+
"gitHead": "79072f7951fe55905df26668c1413cfd4b346d0e"
|
|
99
99
|
}
|