fix(striker-ui): add form dialog open setters to CRUD list form tools

main
Tsu-ba-me 11 months ago
parent b4408e78ce
commit 7687803148
  1. 8
      striker-ui/components/CrudList.tsx
  2. 8
      striker-ui/types/CrudList.d.ts

@ -87,12 +87,18 @@ const CrudList = <
const formTools = useMemo<CrudListFormTools>( const formTools = useMemo<CrudListFormTools>(
() => ({ () => ({
add: {
open: (v = true) => addDialogRef?.current?.setOpen(v),
},
confirm: { confirm: {
finish: finishConfirm, finish: finishConfirm,
loading: setConfirmDialogLoading, loading: setConfirmDialogLoading,
open: setConfirmDialogOpen, open: (v = true) => setConfirmDialogOpen(v),
prepare: setConfirmDialogProps, prepare: setConfirmDialogProps,
}, },
edit: {
open: (v = true) => editDialogRef?.current?.setOpen(v),
},
}), }),
[ [
finishConfirm, finishConfirm,

@ -2,9 +2,15 @@ type CrudListFormTools = {
confirm: { confirm: {
finish: (header: React.ReactNode, message: Message) => void; finish: (header: React.ReactNode, message: Message) => void;
loading: (value: boolean) => void; loading: (value: boolean) => void;
open: (value: boolean) => void; open: (value?: boolean) => void;
prepare: (value: React.SetStateAction<ConfirmDialogProps>) => void; prepare: (value: React.SetStateAction<ConfirmDialogProps>) => void;
}; };
add: {
open: (value?: boolean) => void;
};
edit: {
open: (value?: boolean) => void;
};
}; };
type CrudListItemClickHandler = Exclude< type CrudListItemClickHandler = Exclude<

Loading…
Cancel
Save