fix(striker-ui): add get list item checkbox props callback to List

main
Tsu-ba-me 2 years ago
parent 4dece7aaf8
commit e1e03ba7f9
  1. 6
      striker-ui/components/List.tsx
  2. 1
      striker-ui/types/List.d.ts

@ -40,6 +40,7 @@ const List = forwardRef(
allowItemButton: isAllowItemButton = false,
edit: isEdit = false,
flexBoxProps,
getListItemCheckboxProps,
header,
headerSpacing = '.3em',
initialCheckAll = false,
@ -184,7 +185,7 @@ const List = forwardRef(
);
const listItemCheckbox = useCallback(
(key: string, checked?: boolean) =>
(key: string, checked?: boolean, props?: CheckboxProps) =>
isEdit && isAllowCheckItem ? (
<MUIListItemIcon sx={{ minWidth: listItemIconMinWidth }}>
<Checkbox
@ -193,6 +194,7 @@ const List = forwardRef(
onChange={(...args) =>
onItemCheckboxChange?.call(null, key, ...args)
}
{...props}
/>
</MUIListItemIcon>
) : undefined,
@ -218,6 +220,7 @@ const List = forwardRef(
{listItemCheckbox(
key,
renderListItemCheckboxState?.call(null, key, value),
getListItemCheckboxProps?.call(null, key, value),
)}
{isAllowItemButton ? (
<ListItemButton
@ -247,6 +250,7 @@ const List = forwardRef(
listItemSx,
listItemCheckbox,
renderListItemCheckboxState,
getListItemCheckboxProps,
isAllowItemButton,
onItemClick,
]);

@ -15,6 +15,7 @@ type ListOptionalProps<T extends unknown = unknown> = {
allowItemButton?: boolean;
edit?: boolean;
flexBoxProps?: import('../components/FlexBox').FlexBoxProps;
getListItemCheckboxProps?: (key: string, value: T) => CheckboxProps;
header?: import('react').ReactNode;
headerSpacing?: number | string;
initialCheckAll?: boolean;

Loading…
Cancel
Save