@legalplace/wizardx-core 4.13.3 → 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.
- package/dist/componentsConnectors/connectVariable.js +3 -3
- package/dist/helpers/redirectToLogin.d.ts +1 -0
- package/dist/helpers/redirectToLogin.js +12 -0
- package/dist/redux/reducers/references/setDisabledVariable.js +6 -3
- package/dist/redux/sagas/fetchModel.js +3 -8
- package/dist/redux/selectors/inputs.d.ts +2 -2
- package/dist/redux/selectors/inputs.js +24 -2
- package/dist/redux/selectors/library.d.ts +2 -2
- package/package.json +6 -6
|
@@ -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,
|
|
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 =
|
|
28
|
-
const disabledTooltip =
|
|
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();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const redirectToLogin: (redirectUrl: string, redirectParams?: boolean) => void;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export const redirectToLogin = (redirectUrl, redirectParams = false) => {
|
|
2
|
+
const currentParams = new URLSearchParams(window.location.search);
|
|
3
|
+
const redirectURL = new URL(redirectUrl, window.location.origin);
|
|
4
|
+
currentParams.forEach((value, key) => {
|
|
5
|
+
redirectURL.searchParams.append(key, value);
|
|
6
|
+
});
|
|
7
|
+
if (redirectParams) {
|
|
8
|
+
redirectURL.searchParams.append("redirectUrl", encodeURIComponent(window.location.href));
|
|
9
|
+
}
|
|
10
|
+
window.onbeforeunload = null;
|
|
11
|
+
window.location.href = redirectURL.toString();
|
|
12
|
+
};
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
export const setDisabledVariableReducer = (state, action) => {
|
|
2
|
-
|
|
2
|
+
var _a;
|
|
3
|
+
const { id, disabled, index } = action;
|
|
3
4
|
if (state.variables[id].disabled === disabled)
|
|
4
5
|
return state;
|
|
5
|
-
|
|
6
|
-
|
|
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
|
};
|
|
@@ -21,6 +21,7 @@ import { FETCH_MODEL, FETCH_MODEL_PREREQUISITES, } from "../constants/sagas/mode
|
|
|
21
21
|
import { fetchModelAction } from "../actions/sagas/model";
|
|
22
22
|
import { initInputsDecorator } from "./initInputs";
|
|
23
23
|
import { cancelOnResetState } from "../../helpers/sagaCancelOnResetState";
|
|
24
|
+
import { redirectToLogin } from "../../helpers/redirectToLogin";
|
|
24
25
|
const cookies = new Cookies();
|
|
25
26
|
function* setFetchModelToNonBlocking(firstCurrentAppState) {
|
|
26
27
|
yield put(initPaginationAction({
|
|
@@ -82,10 +83,7 @@ function* getWizardConfig(permalink, uniqidParam, prefix, queryParams) {
|
|
|
82
83
|
}
|
|
83
84
|
response = yield call([response, "json"]);
|
|
84
85
|
if (response.redirect) {
|
|
85
|
-
|
|
86
|
-
window.location.href = `${response.redirect}${response.redirectParams
|
|
87
|
-
? `?redirectUrl=${encodeURIComponent(window.location.href)}`
|
|
88
|
-
: ""}`;
|
|
86
|
+
redirectToLogin(response.redirect, response.redirectParams);
|
|
89
87
|
}
|
|
90
88
|
yield put(setModelUuidAction(response.modelUuid));
|
|
91
89
|
return { modelUuid: response.modelUuid };
|
|
@@ -132,10 +130,7 @@ function* fetchInstanceInformation(appStates, permalink, uniqid, uniqidParam, pr
|
|
|
132
130
|
}
|
|
133
131
|
response = yield call([response, "json"]);
|
|
134
132
|
if (response.redirect) {
|
|
135
|
-
|
|
136
|
-
window.location.href = `${response.redirect}${response.redirectParams
|
|
137
|
-
? `?redirectUrl=${encodeURIComponent(window.location.href)}`
|
|
138
|
-
: ""}`;
|
|
133
|
+
redirectToLogin(response.redirect, response.redirectParams);
|
|
139
134
|
}
|
|
140
135
|
if (response.errors || response.status === "error") {
|
|
141
136
|
throw new Error(`Unable to fetch ${permalink}${uniqid && uniqid.trim().length > 0 ? `/${uniqid}` : ""}`);
|
|
@@ -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
|
|
11
|
-
export declare const
|
|
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
|
|
24
|
-
|
|
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
|
-
|
|
56
|
-
|
|
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.
|
|
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.
|
|
27
|
+
"@legalplace/referencesparser": "^3.1.18",
|
|
28
28
|
"@legalplace/storybook": "^2.171.0",
|
|
29
|
-
"@legalplace/typeorm-constants": "^3.32.
|
|
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.
|
|
59
|
+
"@legalplace/models-v3-types": "^5.11.5",
|
|
60
60
|
"@legalplace/prettier-config": "^2.1.3",
|
|
61
|
-
"@legalplace/typeorm-entities": "^5.29.
|
|
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": "
|
|
99
|
+
"gitHead": "1c66efb5a8066dc72f28eeb9758edc577d039df5"
|
|
100
100
|
}
|