@legalplace/wizardx-core 4.29.6 → 4.30.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.
|
@@ -21,11 +21,14 @@ export declare type ConnectOptionMapProps = {
|
|
|
21
21
|
selectedRadioChild: number;
|
|
22
22
|
childOptions: number[];
|
|
23
23
|
childVariables: number[];
|
|
24
|
+
isSelected?: boolean;
|
|
25
|
+
parentId?: number;
|
|
24
26
|
};
|
|
25
27
|
export declare type ConnectOptionDispatchProps = {
|
|
26
28
|
updateOption: (value: boolean, id?: number, index?: number) => void;
|
|
27
29
|
addMultipleOccurency: () => void;
|
|
28
30
|
deleteMultipleOccurency: () => void;
|
|
31
|
+
setMandatoryOptionAction: (parentId: number, index: number, value: boolean) => void;
|
|
29
32
|
};
|
|
30
33
|
export declare const canOptionDisplay: (id: number, index: number, selectors: ConnectorMapSelectors) => Readonly<boolean>;
|
|
31
34
|
export declare const connectOption: <AdditionnalProps = {}>(Component: import("react").ComponentType<ConnectOptionOwnProps & ConnectOptionMapProps & ConnectOptionDispatchProps & AdditionnalProps>, connectorOptions?: {
|
|
@@ -25,6 +25,12 @@ const selectedRadioChilds = (id, index, selectors) => {
|
|
|
25
25
|
const stateToProps = (selectors) => (state, ownProps) => {
|
|
26
26
|
const { id, index } = ownProps;
|
|
27
27
|
const option = selectors.selectOptionReference(id);
|
|
28
|
+
const [parentId] = selectors.selectOptionParents(id);
|
|
29
|
+
let isSelected = false;
|
|
30
|
+
if (parentId) {
|
|
31
|
+
const selectedRadioChild = selectedRadioChilds(parentId, index, selectors);
|
|
32
|
+
isSelected = selectedRadioChild === id;
|
|
33
|
+
}
|
|
28
34
|
const display = canOptionDisplay(id, index, selectors);
|
|
29
35
|
const selectedRadioChild = selectedRadioChilds(id, index, selectors);
|
|
30
36
|
const label = parseOptionLabel(id, index);
|
|
@@ -56,10 +62,13 @@ const stateToProps = (selectors) => (state, ownProps) => {
|
|
|
56
62
|
selectedRadioChild,
|
|
57
63
|
childOptions,
|
|
58
64
|
childVariables,
|
|
65
|
+
isSelected,
|
|
66
|
+
parentId,
|
|
59
67
|
};
|
|
60
68
|
};
|
|
61
69
|
const dispatchToProps = (actions) => (dispatch, ownProps) => ({
|
|
62
70
|
updateOption: (value, id = ownProps.id, index = ownProps.index) => dispatch(actions.updateOptionAction(id, value, index)),
|
|
71
|
+
setMandatoryOptionAction: (parentId, index, value) => dispatch(actions.setMandatoryOptionAction(parentId, index, value)),
|
|
63
72
|
addMultipleOccurency: () => {
|
|
64
73
|
dispatch(actions.addMultipleOccurencyAction(ownProps.id));
|
|
65
74
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legalplace/wizardx-core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.30.0",
|
|
4
4
|
"author": "Moncef Hammou (moncef@legalplace.fr)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -96,5 +96,5 @@
|
|
|
96
96
|
"*.test.ts",
|
|
97
97
|
"*.test.tsx"
|
|
98
98
|
],
|
|
99
|
-
"gitHead": "
|
|
99
|
+
"gitHead": "b3137bea1529304909680d5ddf597ae2d86f5900"
|
|
100
100
|
}
|