@legalplace/wizardx-core 4.17.5 → 4.18.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.js +6 -2
- package/dist/libs/SmartScriptStore.d.ts +1 -1
- package/dist/libs/SmartScriptStore.js +2 -2
- package/dist/redux/actions/library.d.ts +1 -1
- package/dist/redux/actions/references.d.ts +1 -1
- package/dist/redux/actions/references.js +2 -1
- package/dist/redux/reducers/references/updateVariableMeta.js +10 -3
- package/dist/redux/selectors/inputs.d.ts +1 -0
- package/dist/redux/selectors/inputs.js +19 -8
- package/dist/redux/selectors/library.d.ts +1 -0
- package/dist/types/Actions.type.d.ts +1 -0
- package/package.json +6 -6
|
@@ -14,7 +14,7 @@ export const canVariableDisplay = (id, index, selectors) => {
|
|
|
14
14
|
};
|
|
15
15
|
const stateToProps = (selectors) => (state, ownProps) => {
|
|
16
16
|
var _a;
|
|
17
|
-
const { selectVariableReference, selectVariableInputByIndex, selectVariableConditionValue, selectVariableValidatorConditionValue, selectMandatoryVariableByIndex, } = selectors;
|
|
17
|
+
const { selectVariableReference, selectVariableInputByIndex, selectVariableConditionValue, selectVariableValidatorConditionValue, selectMandatoryVariableByIndex, selectListSelectValuesByIndex, } = selectors;
|
|
18
18
|
const { id, index } = ownProps;
|
|
19
19
|
const variable = selectVariableReference(id);
|
|
20
20
|
const label = parseVariableLabel(id, index);
|
|
@@ -27,6 +27,10 @@ const stateToProps = (selectors) => (state, ownProps) => {
|
|
|
27
27
|
const disabled = selectIsVariableDisabledByIndex(id, index);
|
|
28
28
|
const disabledTooltip = selectVariableDisabledTooltipByIndex(id, index);
|
|
29
29
|
const { type } = variable;
|
|
30
|
+
let { selectValues } = variable;
|
|
31
|
+
if (type === "list" && typeof index !== "undefined") {
|
|
32
|
+
selectValues = [...selectListSelectValuesByIndex(id, index)];
|
|
33
|
+
}
|
|
30
34
|
const mandatoryValidated = selectMandatoryVariableByIndex(id, index);
|
|
31
35
|
const mandatoryIgnore = selectors.selectMandatoryIgnore();
|
|
32
36
|
const validatorMessage = typeof ((_a = variable.validator) === null || _a === void 0 ? void 0 : _a.message) === "string"
|
|
@@ -43,7 +47,7 @@ const stateToProps = (selectors) => (state, ownProps) => {
|
|
|
43
47
|
index,
|
|
44
48
|
label,
|
|
45
49
|
type,
|
|
46
|
-
meta: Object.assign(Object.assign({}, variable), { helper,
|
|
50
|
+
meta: Object.assign(Object.assign(Object.assign({}, variable), (selectValues && { selectValues })), { helper,
|
|
47
51
|
warning }),
|
|
48
52
|
value,
|
|
49
53
|
condition,
|
|
@@ -29,7 +29,7 @@ export declare class SmartScriptStore {
|
|
|
29
29
|
static onVariableChange(id: number | number[], callback: CallbackType): void;
|
|
30
30
|
static updateVariableInput: (id: number, value: string | number, index?: number) => void;
|
|
31
31
|
static updateOptionInput: (id: number, value: boolean, index?: number) => void;
|
|
32
|
-
static updateVariableMeta: (id: number, _meta: ActionsType.References.updateVariableMeta["meta"]) => void;
|
|
32
|
+
static updateVariableMeta: (id: number, _meta: ActionsType.References.updateVariableMeta["meta"], index?: number | undefined) => void;
|
|
33
33
|
static updateOptionMeta: (id: number, _meta: ActionsType.References.updateOptionMeta["meta"]) => void;
|
|
34
34
|
static hideOption: (id: number, index?: number | undefined) => void;
|
|
35
35
|
static displayOption: (id: number, index?: number | undefined) => void;
|
|
@@ -144,7 +144,7 @@ SmartScriptStore.updateOptionInput = (id, value, index = 0) => {
|
|
|
144
144
|
SmartScriptStore.actionsQueue.push(updateOptionAction(id, value, index));
|
|
145
145
|
}
|
|
146
146
|
};
|
|
147
|
-
SmartScriptStore.updateVariableMeta = (id, _meta) => {
|
|
147
|
+
SmartScriptStore.updateVariableMeta = (id, _meta, index) => {
|
|
148
148
|
var _a;
|
|
149
149
|
if (!Object.prototype.hasOwnProperty.call(SmartScriptStore.inputs.variables, id)) {
|
|
150
150
|
console.error(`SmartScript error: trying to update meta for undefined variable ${id}`);
|
|
@@ -161,7 +161,7 @@ SmartScriptStore.updateVariableMeta = (id, _meta) => {
|
|
|
161
161
|
delete meta.prefillings;
|
|
162
162
|
if (typeof ((_a = meta.validator) === null || _a === void 0 ? void 0 : _a.conditions) !== "undefined")
|
|
163
163
|
delete meta.validator.conditions;
|
|
164
|
-
SmartScriptStore.actionsQueue.push(updateVariableMetaAction(id, meta));
|
|
164
|
+
SmartScriptStore.actionsQueue.push(updateVariableMetaAction(id, meta, index));
|
|
165
165
|
};
|
|
166
166
|
SmartScriptStore.updateOptionMeta = (id, _meta) => {
|
|
167
167
|
var _a, _b;
|
|
@@ -19,7 +19,7 @@ export declare const actionsLibrary: {
|
|
|
19
19
|
updateSmartscriptOptionHiddenAction: (id: number, index: number, hide: boolean) => import("../..").ActionsType.SmartScript.updateSmartscriptOptionHidden;
|
|
20
20
|
updateSmartscriptVariableHiddenAction: (id: number, index: number, hide: boolean) => import("../..").ActionsType.SmartScript.updateSmartscriptVariableHidden;
|
|
21
21
|
initReferencesAction: (references: import("../..").StateType.References) => import("../..").ActionsType.References.initReferences;
|
|
22
|
-
updateVariableMetaAction: (id: number, meta: import("../..").ActionsType.References.VariableUpdatableMeta) => import("../..").ActionsType.References.updateVariableMeta;
|
|
22
|
+
updateVariableMetaAction: (id: number, meta: import("../..").ActionsType.References.VariableUpdatableMeta, index?: number | undefined) => import("../..").ActionsType.References.updateVariableMeta;
|
|
23
23
|
updateOptionMetaAction: (id: number, meta: import("../..").ActionsType.References.OptionUpdatableMeta) => import("../..").ActionsType.References.updateOptionMeta;
|
|
24
24
|
setDisabledVariableAction: (id: number, disabled: boolean, index: number, disabledTooltip?: string | undefined) => import("../..").ActionsType.References.setDisabledVariable;
|
|
25
25
|
initMandatoryOptionAction: (id: number, value: boolean[]) => import("../..").ActionsType.Mandatories.initMandatoryOption;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { StateType } from "../../types/State.type";
|
|
2
2
|
import type { ActionsType } from "../../types/Actions.type";
|
|
3
3
|
export declare const initReferencesAction: (references: StateType.References) => ActionsType.References.initReferences;
|
|
4
|
-
export declare const updateVariableMetaAction: (id: number, meta: ActionsType.References.updateVariableMeta["meta"]) => ActionsType.References.updateVariableMeta;
|
|
4
|
+
export declare const updateVariableMetaAction: (id: number, meta: ActionsType.References.updateVariableMeta["meta"], index?: number | undefined) => ActionsType.References.updateVariableMeta;
|
|
5
5
|
export declare const updateOptionMetaAction: (id: number, meta: ActionsType.References.updateOptionMeta["meta"]) => ActionsType.References.updateOptionMeta;
|
|
6
6
|
export declare const setDisabledVariableAction: (id: number, disabled: boolean, index: number, disabledTooltip?: string | undefined) => ActionsType.References.setDisabledVariable;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { INIT_REFERENCES, SET_DISABLED_VARIABLE, UPDATE_OPTION_META, UPDATE_VARIABLE_META, } from "../constants/references";
|
|
2
2
|
export const initReferencesAction = (references) => (Object.assign({ type: INIT_REFERENCES }, references));
|
|
3
|
-
export const updateVariableMetaAction = (id, meta) => ({
|
|
3
|
+
export const updateVariableMetaAction = (id, meta, index) => ({
|
|
4
4
|
type: UPDATE_VARIABLE_META,
|
|
5
5
|
id,
|
|
6
6
|
meta,
|
|
7
|
+
index,
|
|
7
8
|
});
|
|
8
9
|
export const updateOptionMetaAction = (id, meta) => ({
|
|
9
10
|
type: UPDATE_OPTION_META,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const updateVariableMetaReducer = (state, action) => {
|
|
2
|
-
var _a, _b;
|
|
3
|
-
const { id, meta } = action;
|
|
2
|
+
var _a, _b, _c, _d;
|
|
3
|
+
const { id, meta, index } = action;
|
|
4
4
|
const evaluations = Object.assign({}, state.evaluations);
|
|
5
5
|
if (((_a = state.variables[id]) === null || _a === void 0 ? void 0 : _a.type) === "eval") {
|
|
6
6
|
const formula = ((_b = meta.eval) === null || _b === void 0 ? void 0 : _b.formula) || "";
|
|
@@ -29,5 +29,12 @@ export const updateVariableMetaReducer = (state, action) => {
|
|
|
29
29
|
evaluations[newHookVariableId].push(id);
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
|
-
|
|
32
|
+
const selectedValuesIndexes = ((_c = state.variables[id].extraInformations) === null || _c === void 0 ? void 0 : _c.selectedValuesIndexes) || [];
|
|
33
|
+
if (meta.selectValues && typeof index !== "undefined") {
|
|
34
|
+
selectedValuesIndexes[index] = meta.selectValues;
|
|
35
|
+
meta.selectValues = state.variables[id].selectValues;
|
|
36
|
+
}
|
|
37
|
+
return Object.assign(Object.assign({}, state), { evaluations, variables: Object.assign(Object.assign({}, state.variables), { [id]: Object.assign(Object.assign(Object.assign({}, state.variables[id]), meta), (meta.selectValues && {
|
|
38
|
+
extraInformations: Object.assign(Object.assign({}, state.variables[id].extraInformations), { disabledIndexes: ((_d = state.variables[id].extraInformations) === null || _d === void 0 ? void 0 : _d.disabledIndexes) || [], selectedValuesIndexes }),
|
|
39
|
+
})) }) });
|
|
33
40
|
};
|
|
@@ -9,3 +9,4 @@ export declare const selectLinkedVariables: (id: number) => Readonly<Record<stri
|
|
|
9
9
|
export declare const selectAutocompleteDataset: (id: number) => Readonly<import("@legalplace/models-v3-types").AutocompleteDatasetType | undefined>;
|
|
10
10
|
export declare const selectIsVariableDisabledByIndex: (id: number, index: number) => Readonly<boolean>;
|
|
11
11
|
export declare const selectVariableDisabledTooltipByIndex: (id: number, index: number) => Readonly<string | undefined>;
|
|
12
|
+
export declare const selectListSelectValuesByIndex: (id: number, index: number) => readonly string[];
|
|
@@ -21,26 +21,37 @@ export const selectVariableInputByIndex = createSelector((state, id, index) => s
|
|
|
21
21
|
export const selectLinkedVariables = createSelector((state, id) => state.references.variables[id].linkedVariables || {}, (state, id) => `${Object.entries(state.references.variables[id].linkedVariables || {}).reduce((p, c) => `${p}-${c}`, "")}_${id.toString()}`);
|
|
22
22
|
export const selectAutocompleteDataset = createSelector((state, id) => state.references.variables[id].autocompleteDataset, (state, id) => `${state.references.variables[id].autocompleteDataset}_${id.toString()}`);
|
|
23
23
|
export const selectIsVariableDisabledByIndex = createSelector((state, id, index) => {
|
|
24
|
-
var _a;
|
|
24
|
+
var _a, _b;
|
|
25
25
|
return state.references.variables[id].disabled ||
|
|
26
|
-
((_a = state.references.variables[id].extraInformations) === null || _a === void 0 ? void 0 : _a.disabledIndexes[index]) ||
|
|
26
|
+
((_b = (_a = state.references.variables[id].extraInformations) === null || _a === void 0 ? void 0 : _a.disabledIndexes) === null || _b === void 0 ? void 0 : _b[index]) ||
|
|
27
27
|
false;
|
|
28
28
|
}, (state, id, index) => {
|
|
29
|
-
var _a;
|
|
29
|
+
var _a, _b;
|
|
30
30
|
return state.references.variables[id].disabled ||
|
|
31
|
-
((_a = state.references.variables[id].extraInformations) === null || _a === void 0 ? void 0 : _a.disabledIndexes[index])
|
|
31
|
+
((_b = (_a = state.references.variables[id].extraInformations) === null || _a === void 0 ? void 0 : _a.disabledIndexes) === null || _b === void 0 ? void 0 : _b[index])
|
|
32
32
|
? "1"
|
|
33
33
|
: "0";
|
|
34
34
|
});
|
|
35
35
|
export const selectVariableDisabledTooltipByIndex = createSelector((state, id, index) => {
|
|
36
|
-
var _a;
|
|
37
|
-
return ((_a = state.references.variables[id].extraInformations) === null || _a === void 0 ? void 0 : _a.disabledIndexes[index])
|
|
36
|
+
var _a, _b;
|
|
37
|
+
return ((_b = (_a = state.references.variables[id].extraInformations) === null || _a === void 0 ? void 0 : _a.disabledIndexes) === null || _b === void 0 ? void 0 : _b[index])
|
|
38
38
|
? state.references.variables[id].disabledTooltip
|
|
39
39
|
: "";
|
|
40
40
|
}, (state, id, index) => {
|
|
41
|
-
var _a;
|
|
41
|
+
var _a, _b;
|
|
42
42
|
return state.references.variables[id].disabledTooltip ||
|
|
43
|
-
((_a = state.references.variables[id].extraInformations) === null || _a === void 0 ? void 0 : _a.disabledIndexes[index])
|
|
43
|
+
((_b = (_a = state.references.variables[id].extraInformations) === null || _a === void 0 ? void 0 : _a.disabledIndexes) === null || _b === void 0 ? void 0 : _b[index])
|
|
44
44
|
? "1"
|
|
45
45
|
: "0";
|
|
46
46
|
});
|
|
47
|
+
export const selectListSelectValuesByIndex = createSelector((state, id, index) => {
|
|
48
|
+
var _a, _b;
|
|
49
|
+
return ((_b = (_a = state.references.variables[id].extraInformations) === null || _a === void 0 ? void 0 : _a.selectedValuesIndexes) === null || _b === void 0 ? void 0 : _b[index]) ||
|
|
50
|
+
state.references.variables[id].selectValues ||
|
|
51
|
+
[];
|
|
52
|
+
}, (state, id, index) => {
|
|
53
|
+
var _a, _b;
|
|
54
|
+
return (((_b = (_a = state.references.variables[id].extraInformations) === null || _a === void 0 ? void 0 : _a.selectedValuesIndexes) === null || _b === void 0 ? void 0 : _b[index]) ||
|
|
55
|
+
state.references.variables[id].selectValues ||
|
|
56
|
+
[]).join("-");
|
|
57
|
+
});
|
|
@@ -54,6 +54,7 @@ export declare const selectorsLibrary: {
|
|
|
54
54
|
selectAutocompleteDataset: (id: number) => Readonly<import("@legalplace/models-v3-types").AutocompleteDatasetType | undefined>;
|
|
55
55
|
selectIsVariableDisabledByIndex: (id: number, index: number) => Readonly<boolean>;
|
|
56
56
|
selectVariableDisabledTooltipByIndex: (id: number, index: number) => Readonly<string | undefined>;
|
|
57
|
+
selectListSelectValuesByIndex: (id: number, index: number) => readonly string[];
|
|
57
58
|
selectOptionConditionValue(id: number): Readonly<boolean[] | undefined>;
|
|
58
59
|
selectOptionConditionValue(id: number, index: number): Readonly<boolean | undefined>;
|
|
59
60
|
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.18.0",
|
|
4
4
|
"author": "Moncef Hammou (moncef@legalplace.fr)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
"@legalplace/lp-events": "1.14.0",
|
|
25
25
|
"@legalplace/lplogic": "2.3.1",
|
|
26
26
|
"@legalplace/model-healthcheck": "^1.1.5",
|
|
27
|
-
"@legalplace/referencesparser": "^3.1.
|
|
27
|
+
"@legalplace/referencesparser": "^3.1.21",
|
|
28
28
|
"@legalplace/storybook": "^2.171.0",
|
|
29
|
-
"@legalplace/typeorm-constants": "^3.36.
|
|
29
|
+
"@legalplace/typeorm-constants": "^3.36.2",
|
|
30
30
|
"@loadable/component": "^5.15.0",
|
|
31
31
|
"@redux-saga/core": "^1.1.3",
|
|
32
32
|
"connected-react-router": "^6.8.0",
|
|
@@ -56,9 +56,9 @@
|
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@legalplace/data-gouv": "^1.5.25",
|
|
58
58
|
"@legalplace/eslint-config": "^2.2.0",
|
|
59
|
-
"@legalplace/models-v3-types": "^5.
|
|
59
|
+
"@legalplace/models-v3-types": "^5.12.0",
|
|
60
60
|
"@legalplace/prettier-config": "^2.1.3",
|
|
61
|
-
"@legalplace/typeorm-entities": "^5.31.
|
|
61
|
+
"@legalplace/typeorm-entities": "^5.31.2",
|
|
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": "a42feaa8c5545c9c2d40e2fe5a02aaae887af43e"
|
|
100
100
|
}
|