@legalplace/wizardx-core 4.8.0 → 4.9.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 +2 -0
- package/dist/componentsConnectors/connectVariable.js +5 -1
- package/dist/redux/actions/library.d.ts +1 -0
- package/dist/redux/actions/references.d.ts +1 -0
- package/dist/redux/actions/references.js +8 -1
- package/dist/redux/constants/references.d.ts +1 -0
- package/dist/redux/constants/references.js +1 -0
- package/dist/redux/reducers/references/setDisabledVariable.d.ts +3 -0
- package/dist/redux/reducers/references/setDisabledVariable.js +7 -0
- package/dist/redux/reducers/references.js +3 -1
- package/dist/redux/selectors/inputs.d.ts +2 -0
- package/dist/redux/selectors/inputs.js +2 -0
- package/dist/redux/selectors/library.d.ts +2 -0
- package/dist/types/Actions.type.d.ts +9 -2
- package/package.json +3 -3
|
@@ -16,6 +16,8 @@ export declare type ConnectVariableMapProps = {
|
|
|
16
16
|
mandatoryValidated: boolean;
|
|
17
17
|
mandatoryIgnore: boolean;
|
|
18
18
|
linkedVariables?: Record<string, number>;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
disabledTooltip?: string;
|
|
19
21
|
autocompleteDataset?: AutocompleteDatasetType;
|
|
20
22
|
display: boolean;
|
|
21
23
|
meta: VariableV3;
|
|
@@ -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, selectLinkedVariables } from "../redux";
|
|
4
|
+
import { selectAutocompleteDataset, selectIsVariableDisabled, selectLinkedVariables, selectVariableDisabledTooltip, } from "../redux";
|
|
5
5
|
export const canVariableDisplay = (id, index, selectors) => {
|
|
6
6
|
const { selectVariableReference, isLevelAccessibleForUser } = selectors;
|
|
7
7
|
const variable = selectVariableReference(id);
|
|
@@ -24,6 +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
29
|
const { type } = variable;
|
|
28
30
|
const mandatoryValidated = selectMandatoryVariableByIndex(id, index);
|
|
29
31
|
const mandatoryIgnore = selectors.selectMandatoryIgnore();
|
|
@@ -50,6 +52,8 @@ const stateToProps = (selectors) => (state, ownProps) => {
|
|
|
50
52
|
mandatoryValidated,
|
|
51
53
|
mandatoryIgnore,
|
|
52
54
|
linkedVariables,
|
|
55
|
+
disabled,
|
|
56
|
+
disabledTooltip,
|
|
53
57
|
autocompleteDataset,
|
|
54
58
|
display,
|
|
55
59
|
};
|
|
@@ -21,6 +21,7 @@ export declare const actionsLibrary: {
|
|
|
21
21
|
initReferencesAction: (references: import("../..").StateType.References) => import("../..").ActionsType.References.initReferences;
|
|
22
22
|
updateVariableMetaAction: (id: number, meta: import("../..").ActionsType.References.VariableUpdatableMeta) => import("../..").ActionsType.References.updateVariableMeta;
|
|
23
23
|
updateOptionMetaAction: (id: number, meta: import("../..").ActionsType.References.OptionUpdatableMeta) => import("../..").ActionsType.References.updateOptionMeta;
|
|
24
|
+
setDisabledVariableAction: (id: number, disabled: boolean, index: number, disabledTooltip?: string | undefined) => import("../..").ActionsType.References.setDisabledVariable;
|
|
24
25
|
initMandatoryOptionAction: (id: number, value: boolean[]) => import("../..").ActionsType.Mandatories.initMandatoryOption;
|
|
25
26
|
initMandatoryVariableAction: (id: number, value: boolean[]) => import("../..").ActionsType.Mandatories.initMandatoryVariable;
|
|
26
27
|
setMandatoryIgnoreAction: (value: boolean) => import("../..").ActionsType.Mandatories.setMandatoryIgnore;
|
|
@@ -3,3 +3,4 @@ import type { ActionsType } from "../../types/Actions.type";
|
|
|
3
3
|
export declare const initReferencesAction: (references: StateType.References) => ActionsType.References.initReferences;
|
|
4
4
|
export declare const updateVariableMetaAction: (id: number, meta: ActionsType.References.updateVariableMeta["meta"]) => ActionsType.References.updateVariableMeta;
|
|
5
5
|
export declare const updateOptionMetaAction: (id: number, meta: ActionsType.References.updateOptionMeta["meta"]) => ActionsType.References.updateOptionMeta;
|
|
6
|
+
export declare const setDisabledVariableAction: (id: number, disabled: boolean, index: number, disabledTooltip?: string | undefined) => ActionsType.References.setDisabledVariable;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { INIT_REFERENCES, UPDATE_OPTION_META, UPDATE_VARIABLE_META, } from "../constants/references";
|
|
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
3
|
export const updateVariableMetaAction = (id, meta) => ({
|
|
4
4
|
type: UPDATE_VARIABLE_META,
|
|
@@ -10,3 +10,10 @@ export const updateOptionMetaAction = (id, meta) => ({
|
|
|
10
10
|
id,
|
|
11
11
|
meta,
|
|
12
12
|
});
|
|
13
|
+
export const setDisabledVariableAction = (id, disabled, index, disabledTooltip) => ({
|
|
14
|
+
type: SET_DISABLED_VARIABLE,
|
|
15
|
+
id,
|
|
16
|
+
disabled,
|
|
17
|
+
disabledTooltip,
|
|
18
|
+
index,
|
|
19
|
+
});
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ActionsType } from "../../../types/Actions.type";
|
|
2
|
+
import type { StateType } from "../../../types/State.type";
|
|
3
|
+
export declare const setDisabledVariableReducer: (state: StateType.References, action: ActionsType.References.setDisabledVariable) => StateType.References;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export const setDisabledVariableReducer = (state, action) => {
|
|
2
|
+
const { id, disabled, disabledTooltip } = action;
|
|
3
|
+
if (state.variables[id].disabled === disabled)
|
|
4
|
+
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 }) }) });
|
|
7
|
+
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { initReferencesReducer } from "./references/initReferences";
|
|
2
2
|
import { updateOptionMetaReducer } from "./references/updateOptionMeta";
|
|
3
3
|
import { updateVariableMetaReducer } from "./references/updateVariableMeta";
|
|
4
|
-
import { INIT_REFERENCES, UPDATE_OPTION_META, UPDATE_VARIABLE_META, } from "../constants/references";
|
|
4
|
+
import { INIT_REFERENCES, SET_DISABLED_VARIABLE, UPDATE_OPTION_META, UPDATE_VARIABLE_META, } from "../constants/references";
|
|
5
5
|
import { RESET_STATE } from "../constants/app";
|
|
6
|
+
import { setDisabledVariableReducer } from "./references/setDisabledVariable";
|
|
6
7
|
const initialState = {
|
|
7
8
|
options: {},
|
|
8
9
|
variables: {},
|
|
@@ -43,6 +44,7 @@ const reducersEnum = {
|
|
|
43
44
|
[INIT_REFERENCES]: initReferencesReducer,
|
|
44
45
|
[UPDATE_OPTION_META]: updateOptionMetaReducer,
|
|
45
46
|
[UPDATE_VARIABLE_META]: updateVariableMetaReducer,
|
|
47
|
+
[SET_DISABLED_VARIABLE]: setDisabledVariableReducer,
|
|
46
48
|
};
|
|
47
49
|
export const referencesReducer = (state = initialState, action) => {
|
|
48
50
|
if (action.type === RESET_STATE)
|
|
@@ -7,3 +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<"datagouv_addresses" | undefined>;
|
|
10
|
+
export declare const selectIsVariableDisabled: (id: number) => Readonly<boolean>;
|
|
11
|
+
export declare const selectVariableDisabledTooltip: (id: number) => string;
|
|
@@ -22,3 +22,5 @@ export const selectLinkedVariables = createSelector((state, id) => state.referen
|
|
|
22
22
|
? "1"
|
|
23
23
|
: "0");
|
|
24
24
|
export const selectAutocompleteDataset = createSelector((state, id) => state.references.variables[id].autocompleteDataset, (state, id) => state.references.variables[id].autocompleteDataset ? "1" : "0");
|
|
25
|
+
export const selectIsVariableDisabled = createSelector((state, id) => state.references.variables[id].disabled || false, (state, id) => state.references.variables[id].disabled ? "1" : "0");
|
|
26
|
+
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"; });
|
|
@@ -52,6 +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<"datagouv_addresses" | undefined>;
|
|
55
|
+
selectIsVariableDisabled: (id: number) => Readonly<boolean>;
|
|
56
|
+
selectVariableDisabledTooltip: (id: number) => string;
|
|
55
57
|
selectOptionConditionValue(id: number): Readonly<boolean[] | undefined>;
|
|
56
58
|
selectOptionConditionValue(id: number, index: number): Readonly<boolean | undefined>;
|
|
57
59
|
selectVariableConditionValue(id: number): boolean[] | undefined;
|
|
@@ -2,7 +2,7 @@ import type { ModelV3, OptionV3, VariableV3 } from "@legalplace/models-v3-types"
|
|
|
2
2
|
import type { StateType } from "./State.type";
|
|
3
3
|
import type { UPDATE_AVAILABLE_SECTIONS, UPDATE_AVAILABLE_APPSTATES, GO_PREVIOUS_PAGE, GO_NEXT_PAGE, GO_PAGE, INIT_PAGINATION, UPDATE_INSTANCE_PAID, INIT_INSTANCE, UPDATE_INSTANCE, INIT_META, UPDATE_CURRENT_APPSTATE, UPDATE_CURRENT_SECTION_ID, FETCH_MODEL_SUCCEEDED, FETCH_MODEL_FAILED, SET_DATA_STATUS, SET_FETCH_STATUS, INIT_CUSTOMIZATION_META, FETCH_MODEL_UNHEALTHY, FETCH_MODEL_USER_LOCKED, INIT_CUSTOMIZATION_AUTO_DEFAULT, FETCH_MODEL_NONBLOCKING, SET_MODEL_UUID, RESET_STATE } from "../redux/constants/app";
|
|
4
4
|
import type { INIT_USER, SET_USER_STATUS, SET_USER_VALID_TOKEN } from "../redux/constants/user";
|
|
5
|
-
import type { INIT_REFERENCES, UPDATE_VARIABLE_META, UPDATE_OPTION_META } from "../redux/constants/references";
|
|
5
|
+
import type { INIT_REFERENCES, UPDATE_VARIABLE_META, UPDATE_OPTION_META, SET_DISABLED_VARIABLE } from "../redux/constants/references";
|
|
6
6
|
import type { INIT_INPUTS, INIT_OPTION, UPDATE_OPTION_INPUT, INIT_VARIABLE, UPDATE_VARIABLE_INPUT, ADD_MULTIPLE_OCCURENCY, DELETE_MULTIPLE_OCCURENCY } from "../redux/constants/inputs";
|
|
7
7
|
import type { INIT_CONDITIONS, UPDATE_OPTION_CONDITION, UPDATE_VARIABLE_CONDITION, UPDATE_SECTION_CONDITION, UPDATE_PREFILLER_CONDITION, UPDATE_OPTION_VALIDATOR_CONDITION, UPDATE_VARIABLE_VALIDATOR_CONDITION, UPDATE_DOCUMENT_CONDITION } from "../redux/constants/conditions";
|
|
8
8
|
import type { FETCH_MODEL, FETCH_MODEL_PREREQUISITES } from "../redux/constants/sagas/model";
|
|
@@ -138,6 +138,13 @@ export declare namespace ActionsType {
|
|
|
138
138
|
id: number;
|
|
139
139
|
meta: VariableUpdatableMeta;
|
|
140
140
|
}
|
|
141
|
+
interface setDisabledVariable {
|
|
142
|
+
type: typeof SET_DISABLED_VARIABLE;
|
|
143
|
+
id: number;
|
|
144
|
+
disabled: boolean;
|
|
145
|
+
disabledTooltip?: string;
|
|
146
|
+
index: number;
|
|
147
|
+
}
|
|
141
148
|
interface OptionUpdatableMeta extends Omit<OptionV3["meta"], "id" | "label" | "step" | "type" | "conditions" | "repeatOption" | "validator" | "multiple"> {
|
|
142
149
|
label?: string;
|
|
143
150
|
step?: "*" | number[];
|
|
@@ -337,7 +344,7 @@ export declare namespace ActionsType {
|
|
|
337
344
|
}
|
|
338
345
|
export declare type ConditionsActions = ActionsType.Conditions.initConditions | ActionsType.Conditions.updateOptionCondition | ActionsType.Conditions.updateVariableCondition | ActionsType.Conditions.updateSectionCondition | ActionsType.Conditions.updateVariableValidatorCondition | ActionsType.Conditions.updatePrefillerCondition | ActionsType.Conditions.updateOptionValidatorCondition | ActionsType.App.resetState;
|
|
339
346
|
export declare type UserActions = ActionsType.User.initUser | ActionsType.User.setUserStatus | ActionsType.App.resetState;
|
|
340
|
-
export declare type ReferencesActions = ActionsType.References.initReferences | ActionsType.References.updateOptionMeta | ActionsType.References.updateVariableMeta | ActionsType.App.resetState;
|
|
347
|
+
export declare type ReferencesActions = ActionsType.References.initReferences | ActionsType.References.updateOptionMeta | ActionsType.References.updateVariableMeta | ActionsType.References.setDisabledVariable | ActionsType.App.resetState;
|
|
341
348
|
export declare type InputsActions = ActionsType.Inputs.initVariable | ActionsType.Inputs.updateVariableInput | ActionsType.Inputs.initOption | ActionsType.Inputs.updateOptionInput | ActionsType.App.resetState;
|
|
342
349
|
export declare type MandatoriesActions = ActionsType.Mandatories.initMandatoryOption | ActionsType.Mandatories.initMandatoryVariable | ActionsType.Mandatories.setMandatoryIgnore | ActionsType.Mandatories.setMandatorySection | ActionsType.Mandatories.setMandatoryOption | ActionsType.Mandatories.setMandatoryVariable | ActionsType.App.resetState;
|
|
343
350
|
export declare type SmartScriptActions = ActionsType.SmartScript.enableSmartScript | ActionsType.SmartScript.initSmartscriptTriggers | ActionsType.App.resetState;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legalplace/wizardx-core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.9.0",
|
|
4
4
|
"author": "Moncef Hammou (moncef@legalplace.fr)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"xss": "^1.0.9"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@legalplace/data-gouv": "^1.
|
|
57
|
+
"@legalplace/data-gouv": "^1.4.0",
|
|
58
58
|
"@legalplace/eslint-config": "^2.2.0",
|
|
59
59
|
"@legalplace/models-v3-types": "^5.6.1",
|
|
60
60
|
"@legalplace/prettier-config": "^2.1.3",
|
|
@@ -96,5 +96,5 @@
|
|
|
96
96
|
"*.test.ts",
|
|
97
97
|
"*.test.tsx"
|
|
98
98
|
],
|
|
99
|
-
"gitHead": "
|
|
99
|
+
"gitHead": "723959ac478d09dd6cde34a54b85ced150a196d9"
|
|
100
100
|
}
|