@legalplace/wizardx-core 4.14.0 → 4.14.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,7 +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, selectIsVariableDisabled, selectLinkedVariables, selectVariableDisabledTooltip, } from "../redux";
4
+ import { selectAutocompleteDataset, selectIsVariableDisabledByIndex, selectLinkedVariables, selectVariableDisabledTooltipByIndex, } from "../redux";
5
5
  export const canVariableDisplay = (id, index, selectors) => {
6
6
  const { selectVariableReference, isLevelAccessibleForUser } = selectors;
7
7
  const variable = selectVariableReference(id);
@@ -24,8 +24,8 @@ const stateToProps = (selectors) => (state, ownProps) => {
24
24
  const validator = selectVariableValidatorConditionValue(id, index);
25
25
  const linkedVariables = selectLinkedVariables(id);
26
26
  const autocompleteDataset = selectAutocompleteDataset(id);
27
- const disabled = selectIsVariableDisabled(id);
28
- const disabledTooltip = selectVariableDisabledTooltip(id);
27
+ const disabled = selectIsVariableDisabledByIndex(id, index);
28
+ const disabledTooltip = selectVariableDisabledTooltipByIndex(id, index);
29
29
  const { type } = variable;
30
30
  const mandatoryValidated = selectMandatoryVariableByIndex(id, index);
31
31
  const mandatoryIgnore = selectors.selectMandatoryIgnore();
@@ -1,7 +1,10 @@
1
1
  export const setDisabledVariableReducer = (state, action) => {
2
- const { id, disabled, disabledTooltip } = action;
2
+ var _a;
3
+ const { id, disabled, index } = action;
3
4
  if (state.variables[id].disabled === disabled)
4
5
  return state;
5
- return Object.assign(Object.assign({}, state), { variables: Object.assign(Object.assign({}, state.variables), { [id]: Object.assign(Object.assign({}, state.variables[id]), { disabledTooltip,
6
- disabled }) }) });
6
+ const disabledIndexes = ((_a = state.variables[id].extraInformations) === null || _a === void 0 ? void 0 : _a.disabledIndexes) || [];
7
+ const extraInformations = Object.assign(Object.assign({}, state.variables[id].extraInformations), { disabledIndexes });
8
+ extraInformations.disabledIndexes[index] = disabled;
9
+ return Object.assign(Object.assign({}, state), { variables: Object.assign(Object.assign({}, state.variables), { [id]: Object.assign(Object.assign({}, state.variables[id]), { extraInformations }) }) });
7
10
  };
@@ -7,5 +7,5 @@ export declare const selectVariableInput: (id: number) => readonly (string | num
7
7
  export declare const selectVariableInputByIndex: (id: number, index: number) => Readonly<string | number>;
8
8
  export declare const selectLinkedVariables: (id: number) => Readonly<Record<string, number>>;
9
9
  export declare const selectAutocompleteDataset: (id: number) => Readonly<import("@legalplace/models-v3-types").AutocompleteDatasetType | undefined>;
10
- export declare const selectIsVariableDisabled: (id: number) => Readonly<boolean>;
11
- export declare const selectVariableDisabledTooltip: (id: number) => string;
10
+ export declare const selectIsVariableDisabledByIndex: (id: number, index: number) => Readonly<boolean>;
11
+ export declare const selectVariableDisabledTooltipByIndex: (id: number, index: number) => Readonly<string | undefined>;
@@ -20,5 +20,27 @@ export const selectVariableInput = createSelector((state, id) => {
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
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
- export const selectIsVariableDisabled = createSelector((state, id) => state.references.variables[id].disabled || false, (state, id) => state.references.variables[id].disabled ? "1" : "0");
24
- export const selectVariableDisabledTooltip = createSelector((state, id) => state.references.variables[id].disabledTooltip || "", (state, id) => { var _a; return ((_a = state.references.variables[id].disabledTooltip) === null || _a === void 0 ? void 0 : _a.length) ? "1" : "0"; });
23
+ export const selectIsVariableDisabledByIndex = createSelector((state, id, index) => {
24
+ var _a;
25
+ return state.references.variables[id].disabled ||
26
+ ((_a = state.references.variables[id].extraInformations) === null || _a === void 0 ? void 0 : _a.disabledIndexes[index]) ||
27
+ false;
28
+ }, (state, id, index) => {
29
+ var _a;
30
+ return state.references.variables[id].disabled ||
31
+ ((_a = state.references.variables[id].extraInformations) === null || _a === void 0 ? void 0 : _a.disabledIndexes[index])
32
+ ? "1"
33
+ : "0";
34
+ });
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])
38
+ ? state.references.variables[id].disabledTooltip
39
+ : "";
40
+ }, (state, id, index) => {
41
+ var _a;
42
+ return state.references.variables[id].disabledTooltip ||
43
+ ((_a = state.references.variables[id].extraInformations) === null || _a === void 0 ? void 0 : _a.disabledIndexes[index])
44
+ ? "1"
45
+ : "0";
46
+ });
@@ -52,8 +52,8 @@ export declare const selectorsLibrary: {
52
52
  selectVariableInputByIndex: (id: number, index: number) => Readonly<string | number>;
53
53
  selectLinkedVariables: (id: number) => Readonly<Record<string, number>>;
54
54
  selectAutocompleteDataset: (id: number) => Readonly<import("@legalplace/models-v3-types").AutocompleteDatasetType | undefined>;
55
- selectIsVariableDisabled: (id: number) => Readonly<boolean>;
56
- selectVariableDisabledTooltip: (id: number) => string;
55
+ selectIsVariableDisabledByIndex: (id: number, index: number) => Readonly<boolean>;
56
+ selectVariableDisabledTooltipByIndex: (id: number, index: number) => Readonly<string | undefined>;
57
57
  selectOptionConditionValue(id: number): Readonly<boolean[] | undefined>;
58
58
  selectOptionConditionValue(id: number, index: number): Readonly<boolean | undefined>;
59
59
  selectVariableConditionValue(id: number): boolean[] | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legalplace/wizardx-core",
3
- "version": "4.14.0",
3
+ "version": "4.14.1",
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.17",
27
+ "@legalplace/referencesparser": "^3.1.18",
28
28
  "@legalplace/storybook": "^2.171.0",
29
- "@legalplace/typeorm-constants": "^3.32.0",
29
+ "@legalplace/typeorm-constants": "^3.32.1",
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.11",
58
58
  "@legalplace/eslint-config": "^2.2.0",
59
- "@legalplace/models-v3-types": "^5.11.4",
59
+ "@legalplace/models-v3-types": "^5.11.5",
60
60
  "@legalplace/prettier-config": "^2.1.3",
61
- "@legalplace/typeorm-entities": "^5.29.7",
61
+ "@legalplace/typeorm-entities": "^5.29.8",
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": "9c5402206e418e9aba10b90da7c95d088d85961f"
99
+ "gitHead": "1c66efb5a8066dc72f28eeb9758edc577d039df5"
100
100
  }