fix(striker-ui): allow diable delete in List

main
Tsu-ba-me 2 years ago
parent 0711d8a63a
commit d5baae790c
  1. 4
      striker-ui/components/List.tsx
  2. 1
      striker-ui/types/List.d.ts

@ -38,6 +38,7 @@ const List = forwardRef(
allowCheckAll: isAllowCheckAll = false, allowCheckAll: isAllowCheckAll = false,
allowEdit: isAllowEdit = false, allowEdit: isAllowEdit = false,
allowItemButton: isAllowItemButton = false, allowItemButton: isAllowItemButton = false,
disableDelete = false,
edit: isEdit = false, edit: isEdit = false,
flexBoxProps, flexBoxProps,
getListItemCheckboxProps, getListItemCheckboxProps,
@ -88,6 +89,7 @@ const List = forwardRef(
() => () =>
isEdit && isAllowDelete ? ( isEdit && isAllowDelete ? (
<IconButton <IconButton
disabled={disableDelete}
onClick={onDelete} onClick={onDelete}
size="small" size="small"
sx={{ sx={{
@ -100,7 +102,7 @@ const List = forwardRef(
<MUIDeleteIcon /> <MUIDeleteIcon />
</IconButton> </IconButton>
) : undefined, ) : undefined,
[isAllowDelete, isEdit, onDelete], [disableDelete, isAllowDelete, isEdit, onDelete],
); );
const editItemButton = useMemo(() => { const editItemButton = useMemo(() => {
if (isAllowEditItem) { if (isAllowEditItem) {

@ -13,6 +13,7 @@ type ListOptionalProps<T extends unknown = unknown> = {
allowEdit?: boolean; allowEdit?: boolean;
allowEditItem?: boolean; allowEditItem?: boolean;
allowItemButton?: boolean; allowItemButton?: boolean;
disableDelete?: boolean;
edit?: boolean; edit?: boolean;
flexBoxProps?: import('../components/FlexBox').FlexBoxProps; flexBoxProps?: import('../components/FlexBox').FlexBoxProps;
getListItemCheckboxProps?: (key: string, value: T) => CheckboxProps; getListItemCheckboxProps?: (key: string, value: T) => CheckboxProps;

Loading…
Cancel
Save