@apexcura/ui-components 0.0.16-Beta3 → 0.0.16-Beta5
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/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -92347,16 +92347,17 @@ var CheckboxGroup2 = checkbox_default.Group;
|
|
|
92347
92347
|
var defaultCheckedList = [];
|
|
92348
92348
|
var CheckboxElement = (props) => {
|
|
92349
92349
|
const [checkedList, setCheckedList] = (0, import_react140.useState)(defaultCheckedList);
|
|
92350
|
-
const
|
|
92350
|
+
const options = props.options || [];
|
|
92351
|
+
const checkAll = options.length > 0 && options.length === checkedList.length;
|
|
92351
92352
|
const handleChange = (list) => {
|
|
92352
92353
|
setCheckedList(list);
|
|
92353
92354
|
if (props.onChange) {
|
|
92354
|
-
const selectedOptions =
|
|
92355
|
+
const selectedOptions = options.filter((option) => list.includes(option.value));
|
|
92355
92356
|
props.onChange(selectedOptions);
|
|
92356
92357
|
}
|
|
92357
92358
|
};
|
|
92358
92359
|
const onHandleAllChanges = (e) => {
|
|
92359
|
-
const newList = e.target.checked ?
|
|
92360
|
+
const newList = e.target.checked ? options.map((option) => option.value) : [];
|
|
92360
92361
|
setCheckedList(newList);
|
|
92361
92362
|
if (props.onChange) {
|
|
92362
92363
|
props.onChange(newList);
|
|
@@ -92379,7 +92380,7 @@ var CheckboxElement = (props) => {
|
|
|
92379
92380
|
disabled: props.disabled,
|
|
92380
92381
|
style: props.styles,
|
|
92381
92382
|
className: props.className,
|
|
92382
|
-
options
|
|
92383
|
+
options,
|
|
92383
92384
|
value: checkedList,
|
|
92384
92385
|
onChange: handleChange
|
|
92385
92386
|
}
|