@pinuts/bsr-uikit-relaunch 0.2.80 → 0.2.82
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxField.d.ts","sourceRoot":"","sources":["../../../../../src/items/eventWizardItems/EventPicker/Components/CheckboxField.jsx"],"names":[],"mappings":";AAOA,
|
|
1
|
+
{"version":3,"file":"CheckboxField.d.ts","sourceRoot":"","sources":["../../../../../src/items/eventWizardItems/EventPicker/Components/CheckboxField.jsx"],"names":[],"mappings":";AAOA,8DA+FC;;;;;;kBAtGuD,OAAO;2BACpC,YAAY"}
|
|
@@ -29,23 +29,25 @@ const CheckboxField = props => {
|
|
|
29
29
|
} = config;
|
|
30
30
|
const inputProps = {
|
|
31
31
|
id: value,
|
|
32
|
-
name: config.name
|
|
32
|
+
name: `${config.name}_${value}`,
|
|
33
33
|
value: value
|
|
34
34
|
};
|
|
35
35
|
const {
|
|
36
36
|
values,
|
|
37
37
|
setFieldValue
|
|
38
38
|
} = useFormikContext();
|
|
39
|
-
const [field, meta] = useField(
|
|
39
|
+
const [field, meta] = useField(config.name);
|
|
40
40
|
const [initialized, setInitialized] = (0, _react.useState)(false);
|
|
41
41
|
const checked = (meta.value || []).indexOf(value) > -1;
|
|
42
42
|
(0, _react.useEffect)(() => {
|
|
43
|
-
if (!initialized && isPreselected
|
|
44
|
-
|
|
43
|
+
if (!initialized && isPreselected) {
|
|
44
|
+
const updatedComponents = new Set(values.components || []);
|
|
45
|
+
updatedComponents.add(value);
|
|
46
|
+
setFieldValue(field.name, Array.from(updatedComponents));
|
|
45
47
|
setInitialized(true);
|
|
46
48
|
}
|
|
47
|
-
}, [initialized, isPreselected,
|
|
48
|
-
const isCheckboxDisabled = isPreselected && !isDeselectable;
|
|
49
|
+
}, [initialized, isPreselected, setFieldValue, field.name, values.components, value]);
|
|
50
|
+
const isCheckboxDisabled = initialized && isPreselected && !isDeselectable;
|
|
49
51
|
|
|
50
52
|
// the special onChangeHandler is used when singleSelectionCheckbox is true
|
|
51
53
|
// so that only one checkbox can be selected, like RadioButtons
|