@legalplace/wizardx-core 4.7.12 → 4.8.0
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/dist/componentsConnectors/connectVariable.d.ts +3 -1
- package/dist/componentsConnectors/connectVariable.js +5 -0
- package/dist/helpers/mandatoryVariable.js +1 -0
- package/dist/redux/selectors/inputs.d.ts +2 -0
- package/dist/redux/selectors/inputs.js +4 -0
- package/dist/redux/selectors/library.d.ts +2 -0
- package/package.json +6 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { VariableV3 } from "@legalplace/models-v3-types";
|
|
1
|
+
import type { AutocompleteDatasetType, VariableV3 } from "@legalplace/models-v3-types";
|
|
2
2
|
import type { ConnectorMapSelectors } from "./connector/componentConnector";
|
|
3
3
|
export declare type ConnectVariableOwnProps = {
|
|
4
4
|
id: number;
|
|
@@ -15,6 +15,8 @@ export declare type ConnectVariableMapProps = {
|
|
|
15
15
|
validatorMessage: string;
|
|
16
16
|
mandatoryValidated: boolean;
|
|
17
17
|
mandatoryIgnore: boolean;
|
|
18
|
+
linkedVariables?: Record<string, number>;
|
|
19
|
+
autocompleteDataset?: AutocompleteDatasetType;
|
|
18
20
|
display: boolean;
|
|
19
21
|
meta: VariableV3;
|
|
20
22
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { componentConnector } from "./connector/componentConnector";
|
|
2
2
|
import { isStepAvailable } from "../redux/selectors/app";
|
|
3
3
|
import { parseRawWithVariables, parseVariableLabel, } from "../helpers/outputsParsing";
|
|
4
|
+
import { selectAutocompleteDataset, selectLinkedVariables } from "../redux";
|
|
4
5
|
export const canVariableDisplay = (id, index, selectors) => {
|
|
5
6
|
const { selectVariableReference, isLevelAccessibleForUser } = selectors;
|
|
6
7
|
const variable = selectVariableReference(id);
|
|
@@ -21,6 +22,8 @@ const stateToProps = (selectors) => (state, ownProps) => {
|
|
|
21
22
|
const value = selectVariableInputByIndex(id, index) || "";
|
|
22
23
|
const condition = selectVariableConditionValue(id, index);
|
|
23
24
|
const validator = selectVariableValidatorConditionValue(id, index);
|
|
25
|
+
const linkedVariables = selectLinkedVariables(id);
|
|
26
|
+
const autocompleteDataset = selectAutocompleteDataset(id);
|
|
24
27
|
const { type } = variable;
|
|
25
28
|
const mandatoryValidated = selectMandatoryVariableByIndex(id, index);
|
|
26
29
|
const mandatoryIgnore = selectors.selectMandatoryIgnore();
|
|
@@ -46,6 +49,8 @@ const stateToProps = (selectors) => (state, ownProps) => {
|
|
|
46
49
|
validatorMessage,
|
|
47
50
|
mandatoryValidated,
|
|
48
51
|
mandatoryIgnore,
|
|
52
|
+
linkedVariables,
|
|
53
|
+
autocompleteDataset,
|
|
49
54
|
display,
|
|
50
55
|
};
|
|
51
56
|
};
|
|
@@ -7,6 +7,7 @@ const formatsCheck = {
|
|
|
7
7
|
date: (value) => checkDateValidity(value),
|
|
8
8
|
mask: (value, maskFormula) => value.toString().trim().length === (maskFormula === null || maskFormula === void 0 ? void 0 : maskFormula.length),
|
|
9
9
|
phone_number: (value) => checkPhoneNumberValidity(value.toString()),
|
|
10
|
+
autocomplete: (value) => value.length > 0,
|
|
10
11
|
};
|
|
11
12
|
export const checkMandatoryVariable = (variable, value) => {
|
|
12
13
|
const { type, mask, mandatory } = variable;
|
|
@@ -5,3 +5,5 @@ export declare const selectOptionInput: (id: number) => readonly boolean[];
|
|
|
5
5
|
export declare const selectOptionInputByIndex: (id: number, index: number) => Readonly<boolean | undefined>;
|
|
6
6
|
export declare const selectVariableInput: (id: number) => readonly (string | number)[];
|
|
7
7
|
export declare const selectVariableInputByIndex: (id: number, index: number) => Readonly<string | number>;
|
|
8
|
+
export declare const selectLinkedVariables: (id: number) => Readonly<Record<string, number>>;
|
|
9
|
+
export declare const selectAutocompleteDataset: (id: number) => Readonly<"datagouv_addresses" | undefined>;
|
|
@@ -18,3 +18,7 @@ export const selectVariableInput = createSelector((state, id) => {
|
|
|
18
18
|
return `${state.inputs.variables[id].reduce((p, c) => `${p}-${c}`, "")}_${id.toString()}`;
|
|
19
19
|
});
|
|
20
20
|
export const selectVariableInputByIndex = createSelector((state, id, index) => state.inputs.variables[id][index], (state, id, index) => `${state.inputs.variables[id].reduce((p, c) => `${p}-${c}`, "")}_${id.toString()}_${index}`);
|
|
21
|
+
export const selectLinkedVariables = createSelector((state, id) => state.references.variables[id].linkedVariables || {}, (state, id) => Object.entries(state.references.variables[id].linkedVariables || {}).length
|
|
22
|
+
? "1"
|
|
23
|
+
: "0");
|
|
24
|
+
export const selectAutocompleteDataset = createSelector((state, id) => state.references.variables[id].autocompleteDataset, (state, id) => state.references.variables[id].autocompleteDataset ? "1" : "0");
|
|
@@ -50,6 +50,8 @@ export declare const selectorsLibrary: {
|
|
|
50
50
|
selectOptionInputByIndex: (id: number, index: number) => Readonly<boolean | undefined>;
|
|
51
51
|
selectVariableInput: (id: number) => readonly (string | number)[];
|
|
52
52
|
selectVariableInputByIndex: (id: number, index: number) => Readonly<string | number>;
|
|
53
|
+
selectLinkedVariables: (id: number) => Readonly<Record<string, number>>;
|
|
54
|
+
selectAutocompleteDataset: (id: number) => Readonly<"datagouv_addresses" | undefined>;
|
|
53
55
|
selectOptionConditionValue(id: number): Readonly<boolean[] | undefined>;
|
|
54
56
|
selectOptionConditionValue(id: number, index: number): Readonly<boolean | undefined>;
|
|
55
57
|
selectVariableConditionValue(id: number): boolean[] | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legalplace/wizardx-core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.8.0",
|
|
4
4
|
"author": "Moncef Hammou (moncef@legalplace.fr)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"@legalplace/model-healthcheck": "^1.1.5",
|
|
27
27
|
"@legalplace/referencesparser": "^3.1.9",
|
|
28
28
|
"@legalplace/storybook": "^2.171.0",
|
|
29
|
-
"@legalplace/typeorm-constants": "^3.25.
|
|
29
|
+
"@legalplace/typeorm-constants": "^3.25.2",
|
|
30
30
|
"@loadable/component": "^5.15.0",
|
|
31
31
|
"@redux-saga/core": "^1.1.3",
|
|
32
32
|
"connected-react-router": "^6.8.0",
|
|
@@ -54,10 +54,11 @@
|
|
|
54
54
|
"xss": "^1.0.9"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
+
"@legalplace/data-gouv": "^1.5.0",
|
|
57
58
|
"@legalplace/eslint-config": "^2.2.0",
|
|
58
|
-
"@legalplace/models-v3-types": "^5.6.
|
|
59
|
+
"@legalplace/models-v3-types": "^5.6.1",
|
|
59
60
|
"@legalplace/prettier-config": "^2.1.3",
|
|
60
|
-
"@legalplace/typeorm-entities": "^5.
|
|
61
|
+
"@legalplace/typeorm-entities": "^5.28.0",
|
|
61
62
|
"@swc-node/jest": "^1.3.2",
|
|
62
63
|
"@swc/core": "^1.2.93",
|
|
63
64
|
"@swc/jest": "^0.2.4",
|
|
@@ -95,5 +96,5 @@
|
|
|
95
96
|
"*.test.ts",
|
|
96
97
|
"*.test.tsx"
|
|
97
98
|
],
|
|
98
|
-
"gitHead": "
|
|
99
|
+
"gitHead": "2d03c92563b648c22b8118b0faf68df26f227f91"
|
|
99
100
|
}
|