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

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

Loading…
Cancel
Save