@legalplace/wizardx-core 4.27.0 → 4.28.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.
|
@@ -4,6 +4,11 @@ export declare type ConnectVariableOwnProps = {
|
|
|
4
4
|
id: number;
|
|
5
5
|
index: number;
|
|
6
6
|
};
|
|
7
|
+
declare type AutocompleteParent = {
|
|
8
|
+
id?: number;
|
|
9
|
+
condition?: boolean;
|
|
10
|
+
value?: string | number;
|
|
11
|
+
};
|
|
7
12
|
export declare type ConnectVariableMapProps = {
|
|
8
13
|
id: number;
|
|
9
14
|
index: number;
|
|
@@ -21,6 +26,7 @@ export declare type ConnectVariableMapProps = {
|
|
|
21
26
|
autocompleteDataset?: AutocompleteDatasetType;
|
|
22
27
|
display: boolean;
|
|
23
28
|
meta: VariableV3;
|
|
29
|
+
autocompleteParents?: AutocompleteParent[];
|
|
24
30
|
};
|
|
25
31
|
export declare type ConnectVariableDispatchProps = {
|
|
26
32
|
updateVariable: (value: string | number) => void;
|
|
@@ -31,3 +37,4 @@ export declare const connectVariable: <AdditionnalProps = {}>(Component: import(
|
|
|
31
37
|
} | undefined) => ((props: any) => JSX.Element) | import("react-redux").ConnectedComponent<import("react").ComponentClass<any, any> | import("react").FunctionComponent<any>, import("react-redux").Omit<any, never> & ConnectVariableOwnProps & AdditionnalProps & {
|
|
32
38
|
store?: import("redux").Store<any, import("redux").AnyAction> | undefined;
|
|
33
39
|
}>;
|
|
40
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { componentConnector } from "./connector/componentConnector";
|
|
2
2
|
import { isStepAvailable } from "../redux/selectors/app";
|
|
3
|
-
import { selectVariableParents } from "../redux/selectors/references";
|
|
3
|
+
import { selectOptionReference, selectVariableParents, selectVariablesReference, } from "../redux/selectors/references";
|
|
4
4
|
import { parseRawWithRelatedVariables, parseVariableLabel, } from "../helpers/outputsParsing";
|
|
5
5
|
import { selectAutocompleteDataset, selectIsVariableDisabledByIndex, selectLinkedVariables, selectVariableDisabledTooltipByIndex, } from "../redux";
|
|
6
6
|
export const canVariableDisplay = (id, index, selectors) => {
|
|
@@ -35,6 +35,16 @@ const stateToProps = (selectors) => (state, ownProps) => {
|
|
|
35
35
|
const mandatoryValidated = selectMandatoryVariableByIndex(id, index);
|
|
36
36
|
const mandatoryIgnore = selectors.selectMandatoryIgnore();
|
|
37
37
|
const parentOptionId = selectVariableParents(id)[0];
|
|
38
|
+
const optionData = selectOptionReference(parentOptionId);
|
|
39
|
+
const variablesSection = selectVariablesReference(optionData.variables);
|
|
40
|
+
const autocompleteParents = variablesSection
|
|
41
|
+
.filter((variableItem) => variableItem.type === "autocomplete" &&
|
|
42
|
+
Object.values((variableItem === null || variableItem === void 0 ? void 0 : variableItem.linkedVariables) || []).includes(id))
|
|
43
|
+
.map((autoParent) => ({
|
|
44
|
+
id: autoParent.id,
|
|
45
|
+
value: selectVariableInputByIndex(autoParent.id, index) || "",
|
|
46
|
+
condition: selectVariableConditionValue(autoParent.id, index),
|
|
47
|
+
}));
|
|
38
48
|
const validatorMessage = typeof ((_a = variable.validator) === null || _a === void 0 ? void 0 : _a.message) === "string"
|
|
39
49
|
? parseRawWithRelatedVariables(variable.validator.message, parentOptionId, index)
|
|
40
50
|
: "";
|
|
@@ -44,14 +54,11 @@ const stateToProps = (selectors) => (state, ownProps) => {
|
|
|
44
54
|
const warning = variable.warning
|
|
45
55
|
? parseRawWithRelatedVariables(variable.warning, parentOptionId, index, undefined, "________________")
|
|
46
56
|
: undefined;
|
|
47
|
-
return {
|
|
48
|
-
id,
|
|
57
|
+
return Object.assign({ id,
|
|
49
58
|
index,
|
|
50
59
|
label,
|
|
51
|
-
type,
|
|
52
|
-
|
|
53
|
-
warning }),
|
|
54
|
-
value,
|
|
60
|
+
type, meta: Object.assign(Object.assign(Object.assign({}, variable), (selectValues && { selectValues })), { helper,
|
|
61
|
+
warning }), value,
|
|
55
62
|
condition,
|
|
56
63
|
validator,
|
|
57
64
|
validatorMessage,
|
|
@@ -61,8 +68,7 @@ const stateToProps = (selectors) => (state, ownProps) => {
|
|
|
61
68
|
disabled,
|
|
62
69
|
disabledTooltip,
|
|
63
70
|
autocompleteDataset,
|
|
64
|
-
display,
|
|
65
|
-
};
|
|
71
|
+
display }, ((autocompleteParents === null || autocompleteParents === void 0 ? void 0 : autocompleteParents.length) && { autocompleteParents }));
|
|
66
72
|
};
|
|
67
73
|
const dispatchToProps = (actions) => (dispatch, ownProps) => ({
|
|
68
74
|
updateVariable: (value) => dispatch(actions.updateVariableAction(ownProps.id, value, ownProps.index)),
|
|
@@ -18,6 +18,7 @@ export declare const selectorsLibrary: {
|
|
|
18
18
|
selectOptionParents: (id: number) => readonly number[];
|
|
19
19
|
selectRadioSiblings: (id: number) => Readonly<number[] | undefined>;
|
|
20
20
|
selectVariableReference: (id: number, noThrow?: any) => Readonly<import("@legalplace/models-v3-types").VariableV3>;
|
|
21
|
+
selectVariablesReference: (ids: number[], noThrow?: any) => readonly import("@legalplace/models-v3-types").VariableV3[];
|
|
21
22
|
selectVariableRelations: (id: number) => Readonly<import("@legalplace/referencesparser/dist/libs/References.type").ReferencesRelationsVariablesType>;
|
|
22
23
|
selectVariableParents: (id: number) => readonly number[];
|
|
23
24
|
selectAllDocumentsReferences: () => Readonly<import("@legalplace/referencesparser/dist/libs/References.type").ReferencesDocumentsListType>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { VariableV3 } from "@legalplace/models-v3-types";
|
|
1
2
|
export declare const selectReferences: () => Readonly<import("@legalplace/referencesparser/dist/libs/References.type").ReferencesType>;
|
|
2
3
|
export declare const selectOutputReference: (id: number) => Readonly<import("@legalplace/referencesparser/dist/libs/References.type").ReferencesSingleOutputType | undefined>;
|
|
3
4
|
export declare const selectBoxReference: (id: number) => Readonly<import("@legalplace/referencesparser/dist/libs/References.type").ReferencesSingleBoxType>;
|
|
@@ -7,7 +8,8 @@ export declare const selectOptionRelations: (id: number) => Readonly<import("@le
|
|
|
7
8
|
export declare const selectSectionRelations: (id: number) => Readonly<import("@legalplace/referencesparser/dist/libs/References.type").ReferencesRelationsSectionsType>;
|
|
8
9
|
export declare const selectOptionParents: (id: number) => readonly number[];
|
|
9
10
|
export declare const selectRadioSiblings: (id: number) => Readonly<number[] | undefined>;
|
|
10
|
-
export declare const selectVariableReference: (id: number, noThrow?: any) => Readonly<
|
|
11
|
+
export declare const selectVariableReference: (id: number, noThrow?: any) => Readonly<VariableV3>;
|
|
12
|
+
export declare const selectVariablesReference: (ids: number[], noThrow?: any) => readonly VariableV3[];
|
|
11
13
|
export declare const selectVariableRelations: (id: number) => Readonly<import("@legalplace/referencesparser/dist/libs/References.type").ReferencesRelationsVariablesType>;
|
|
12
14
|
export declare const selectVariableParents: (id: number) => readonly number[];
|
|
13
15
|
export declare const selectAllDocumentsReferences: () => Readonly<import("@legalplace/referencesparser/dist/libs/References.type").ReferencesDocumentsListType>;
|
|
@@ -47,6 +47,15 @@ export const selectVariableReference = createSelector((state, id, noThrow = fals
|
|
|
47
47
|
throw new Error(`Variable ${id} does not exist`);
|
|
48
48
|
return state.references.variables[id];
|
|
49
49
|
}, false);
|
|
50
|
+
export const selectVariablesReference = createSelector((state, ids, noThrow = false) => {
|
|
51
|
+
const variables = [];
|
|
52
|
+
ids.forEach((id) => {
|
|
53
|
+
if (state.references.variables[id] === undefined && noThrow === false)
|
|
54
|
+
throw new Error(`Variable ${id} does not exist`);
|
|
55
|
+
variables.push(state.references.variables[id]);
|
|
56
|
+
});
|
|
57
|
+
return variables;
|
|
58
|
+
}, false);
|
|
50
59
|
export const selectVariableRelations = createSelector((state, id) => {
|
|
51
60
|
if (state.references.relations.variables[id] === undefined)
|
|
52
61
|
throw new Error(`Variable ${id} relations do not exist`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legalplace/wizardx-core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.28.1",
|
|
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.31",
|
|
28
28
|
"@legalplace/storybook": "2.298.0",
|
|
29
|
-
"@legalplace/typeorm-constants": "^3.
|
|
29
|
+
"@legalplace/typeorm-constants": "^3.50.0",
|
|
30
30
|
"@loadable/component": "^5.15.0",
|
|
31
31
|
"@redux-saga/core": "^1.1.3",
|
|
32
32
|
"connected-react-router": "^6.8.0",
|
|
@@ -54,11 +54,11 @@
|
|
|
54
54
|
"xss": "^1.0.9"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@legalplace/data-gouv": "^1.6.
|
|
57
|
+
"@legalplace/data-gouv": "^1.6.2",
|
|
58
58
|
"@legalplace/eslint-config": "^2.3.0",
|
|
59
|
-
"@legalplace/models-v3-types": "^5.13.
|
|
59
|
+
"@legalplace/models-v3-types": "^5.13.10",
|
|
60
60
|
"@legalplace/prettier-config": "^2.1.3",
|
|
61
|
-
"@legalplace/typeorm-entities": "^5.
|
|
61
|
+
"@legalplace/typeorm-entities": "^5.46.0",
|
|
62
62
|
"@swc-node/jest": "^1.3.2",
|
|
63
63
|
"@swc/core": "^1.2.93",
|
|
64
64
|
"@swc/jest": "^0.2.4",
|
|
@@ -96,5 +96,5 @@
|
|
|
96
96
|
"*.test.ts",
|
|
97
97
|
"*.test.tsx"
|
|
98
98
|
],
|
|
99
|
-
"gitHead": "
|
|
99
|
+
"gitHead": "fedf6fbd4fa689143d92f26e82a31a109d38a826"
|
|
100
100
|
}
|