react-crud-mui 0.2.44 → 0.2.45

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.
@@ -3,6 +3,7 @@ import { ButtonProps } from '@mui/material';
3
3
  import { UseFormReturn } from '../../form/hooks/useForm';
4
4
  import { CloseReason } from '../../page/Page';
5
5
  import { DetailPageCommandsFlag } from '../hooks/useDetailPageStates';
6
+ import { NeedDataReason } from '../pages/DetailPageContent';
6
7
  import { SaveMode } from '../pages/DetailPageData';
7
8
  import { StepPane } from './DetailPageStepsHeader';
8
9
  export type DetailPageStandartCommandsOptions = {
@@ -20,6 +21,8 @@ export type DetailPageStepCommandsOptions = {
20
21
  currentForm?: UseFormReturn;
21
22
  };
22
23
  export type DetailPageCommandsOptions = DetailPageStandartCommandsOptions & DetailPageStepCommandsOptions;
24
+ export type CommandsProps = Partial<Record<keyof DetailPageCommandsFlag, ButtonProps>>;
25
+ export type CommandsPropsFn = (reason: NeedDataReason) => CommandsProps;
23
26
  export type DetailPageStandartCommandsEvents = {
24
27
  onSave?: () => void;
25
28
  onSaveCreate?: () => void;
@@ -38,7 +41,7 @@ export type DetailPageCommandsProps = DetailPageStandartCommandsEvents & DetailP
38
41
  options: DetailPageCommandsOptions;
39
42
  mode: 'standard' | 'steps';
40
43
  moreCommands?: Partial<Record<keyof DetailPageCommandsFlag, true>>;
41
- commandsProps?: Partial<Record<keyof DetailPageCommandsFlag, ButtonProps>>;
44
+ commandsProps?: CommandsProps;
42
45
  } & PropsWithChildren;
43
46
  declare function DetailPageCommands(props: DetailPageCommandsProps): import("react/jsx-runtime").JSX.Element;
44
47
  export default DetailPageCommands;
@@ -455,7 +455,7 @@ declare function useDetailPageModal<TModel extends FieldValues>({ models, unique
455
455
  readonly enableDiscardChanges?: boolean;
456
456
  readonly enableSave?: boolean;
457
457
  readonly activeSegmentIndex?: number;
458
- readonly commandsProps?: Partial<Record<keyof import('./useDetailPageStates').DetailPageCommandsFlag, import('@mui/material').ButtonProps>>;
458
+ readonly commandsProps?: import('../components/DetailPageCommands').CommandsPropsFn | Partial<Record<keyof import('./useDetailPageStates').DetailPageCommandsFlag, import('@mui/material').ButtonProps>> | undefined;
459
459
  readonly onCommands?: (props: import('../components/DetailPageCommands').DetailPageCommandsProps) => import('react').ReactNode;
460
460
  readonly onExtraCommands?: () => import('react').ReactNode;
461
461
  readonly alerts?: import('../../page/hooks/useNormalizeMessages').Message[];
@@ -5,7 +5,7 @@ import { Message } from '../../page/hooks/useNormalizeMessages';
5
5
  import { PageProps } from '../../page/Page';
6
6
  import { ServerError } from '../../utils';
7
7
  import { AutoSaveOptions } from '../components/AutoSave';
8
- import { DetailPageCommandsProps } from '../components/DetailPageCommands';
8
+ import { CommandsProps, CommandsPropsFn, DetailPageCommandsProps } from '../components/DetailPageCommands';
9
9
  import { DetailPageLayoutProps } from '../components/DetailPageDefaultLayout';
10
10
  import { DetailPageHeaderProps } from '../components/DetailPageHeader';
11
11
  import { DetailPageStepsHeaderProps, StepPane } from '../components/DetailPageStepsHeader';
@@ -17,7 +17,8 @@ export type DetailPageWrapperLayoutProps = {
17
17
  commandsContent: ReactNode;
18
18
  alertsContent: ReactNode;
19
19
  };
20
- export interface DetailPageContentProps<TModel extends FieldValues> extends Omit<PageProps, 'commandsContent' | 'alertsContent' | 'autoSave' | 'onHeader' | 'tabExtraContent'>, Pick<DetailPageCommandsProps, 'commandsProps'> {
20
+ export interface DetailPageContentProps<TModel extends FieldValues> extends Omit<PageProps, 'commandsContent' | 'alertsContent' | 'autoSave' | 'onHeader' | 'tabExtraContent'> {
21
+ commandsProps?: CommandsProps | CommandsPropsFn;
21
22
  /**
22
23
  * Custom commands node
23
24
  */
@@ -8,5 +8,5 @@ export interface ListPageRouteProps<TModel extends FieldValues, TFilter extends
8
8
  /**
9
9
  * ListPage with routing based on react-router
10
10
  */
11
- declare function ListPageRoute<TModel extends FieldValues, TFilter extends FieldValues = FieldValues>({ defaultFilter, defaultMeta, enableNestedSegments, enableQueryStringFilter, enableSegmentRouting, fallbackSegmentIndex, onNeedData, tabs, defaultValues, onActionClick, ...listPageProps }: ListPageRouteProps<TModel, TFilter>): import("react/jsx-runtime").JSX.Element;
11
+ declare function ListPageRoute<TModel extends FieldValues, TFilter extends FieldValues = FieldValues>({ defaultFilter, defaultMeta, enableNestedSegments, enableQueryStringFilter, enableSegmentRouting, fallbackSegmentIndex, onNeedData, tabs, onActionClick, ...listPageProps }: ListPageRouteProps<TModel, TFilter>): import("react/jsx-runtime").JSX.Element;
12
12
  export default ListPageRoute;