react-crud-mui 0.2.56 → 0.2.58
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.
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ButtonGroup, ButtonProps } from '@mui/material';
|
|
3
|
+
export interface DropdownButtonProps extends ButtonProps {
|
|
4
|
+
options: DropdownOption[];
|
|
5
|
+
buttonGroupProps?: React.ComponentProps<typeof ButtonGroup>;
|
|
6
|
+
}
|
|
7
|
+
export type DropdownOption = {
|
|
8
|
+
label: string;
|
|
9
|
+
icon?: React.ReactNode;
|
|
10
|
+
value: string;
|
|
11
|
+
helperText?: string;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
onClick?: (value: string, event: React.MouseEvent<HTMLLIElement>) => void;
|
|
14
|
+
};
|
|
15
|
+
declare function DropdownButton({ options, disabled, size, buttonGroupProps, color, variant, ...buttonProps }: DropdownButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export default DropdownButton;
|
|
@@ -2,6 +2,7 @@ import { default as React, ReactNode } from 'react';
|
|
|
2
2
|
import { FieldArray, FieldArrayPath, FieldValues, UseFieldArrayReturn } from 'react-hook-form';
|
|
3
3
|
import { default as ActionCommands, ActionCommandsProps } from '../action-commands/ActionCommands';
|
|
4
4
|
import { UseDetailPageModalReturn } from '../detail-page/hooks/useDetailPageModal';
|
|
5
|
+
import { NeedDataReason } from '../detail-page/pages/DetailPageContent';
|
|
5
6
|
import { DataResult, DeletePayload, SavePayload } from '../detail-page/pages/DetailPageData';
|
|
6
7
|
import { DetailPageModalProps } from '../detail-page/pages/DetailPageModal';
|
|
7
8
|
import { UNIQUE_IDENTIFIER_FIELD_NAME } from '../form/hooks/useArrayFieldHelpers';
|
|
@@ -45,6 +46,10 @@ export interface EditableListProps<TModel extends FieldValues, TArrayModel exten
|
|
|
45
46
|
* Show delete all button
|
|
46
47
|
*/
|
|
47
48
|
enableDeleteAllButton?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Open detailPage in view mode as default or in which reason provided
|
|
51
|
+
*/
|
|
52
|
+
enableRowClickToDetails?: boolean | NeedDataReason | ((model: TArrayModel) => boolean);
|
|
48
53
|
/**
|
|
49
54
|
* Searching level of binded array model,default 1
|
|
50
55
|
*/
|
|
@@ -75,10 +80,14 @@ export interface EditableListProps<TModel extends FieldValues, TArrayModel exten
|
|
|
75
80
|
* Custom Commands on header
|
|
76
81
|
*/
|
|
77
82
|
onCommands?: (props: EditableListCommandsProps<TModel, TFieldArrayName>) => React.ReactNode;
|
|
83
|
+
/**
|
|
84
|
+
* Show columns of create and delete-all commands
|
|
85
|
+
*/
|
|
86
|
+
showCommands?: boolean;
|
|
78
87
|
/**
|
|
79
88
|
* Custom commands when needed to override the default buttons
|
|
80
89
|
*/
|
|
81
|
-
|
|
90
|
+
onRowCommands?: (props: EditingListCommandsProps<TArrayModel>) => ReactNode;
|
|
82
91
|
/**
|
|
83
92
|
* Column props of commands
|
|
84
93
|
*/
|
|
@@ -88,7 +97,7 @@ export interface EditableListProps<TModel extends FieldValues, TArrayModel exten
|
|
|
88
97
|
*/
|
|
89
98
|
children?: ReactNode;
|
|
90
99
|
}
|
|
91
|
-
declare function EditableList<TModel extends FieldValues, TArrayModel extends FieldArray<TModel, TFieldArrayName> & FieldValues, TFieldArrayName extends FieldArrayPath<TModel> = FieldArrayPath<TModel>>({ canCopy, canDelete, canEdit, showCopy, showDelete, showEdit, children, columns, commandColProps, onCommands, onLayout, detailPageProps, detailType, disabled, enableDeleteAllButton, headerProps, name, newItemTitle, onDelete, onSave,
|
|
100
|
+
declare function EditableList<TModel extends FieldValues, TArrayModel extends FieldArray<TModel, TFieldArrayName> & FieldValues, TFieldArrayName extends FieldArrayPath<TModel> = FieldArrayPath<TModel>>({ canCopy, canDelete, canEdit, showCopy, showDelete, showEdit, children, columns, commandColProps, onCommands, onLayout, detailPageProps, detailType, disabled, enableDeleteAllButton, enableRowClickToDetails, headerProps, name, newItemTitle, onDelete, onSave, onRowCommands, showCommands, uniqueFields, ...tableProps }: EditableListProps<TModel, TArrayModel, TFieldArrayName>): import("react/jsx-runtime").JSX.Element;
|
|
92
101
|
declare namespace EditableList {
|
|
93
102
|
var Commands: typeof EditableListCommands;
|
|
94
103
|
var RowCommands: typeof ActionCommands;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ReactNode, Ref } from 'react';
|
|
2
2
|
import { FieldValues, Path } from 'react-hook-form';
|
|
3
3
|
import { AvatarProps } from '@mui/material/Avatar';
|
|
4
|
+
import { FormControlProps } from '@mui/material/FormControl';
|
|
4
5
|
import { SelectProps as MuiSelectProps } from '@mui/material/Select';
|
|
5
6
|
import { ComboboxTemplate } from '../combobox/hooks/useComboboxTemplate';
|
|
6
7
|
export type SelectSize = MuiSelectProps['size'] | 'smaller';
|
|
@@ -20,7 +21,8 @@ export type SelectProps<T extends FieldValues = FieldValues> = Partial<Omit<MuiS
|
|
|
20
21
|
optionAsValue?: boolean;
|
|
21
22
|
size?: SelectSize;
|
|
22
23
|
selectInitialOption?: boolean | ((model: T) => boolean);
|
|
24
|
+
labelWrapperProps?: Omit<FormControlProps, 'children'>;
|
|
23
25
|
};
|
|
24
|
-
declare function Select<T extends FieldValues = FieldValues>({ allowClear, children, data, descriptionTemplate, disabled, displayTemplate, dropDownHeight, error, groupBy: groupByFn, helperText, id, label, onChange, optionImg, optionImgProps, optionTemplate, optionAsValue, selectInitialOption, selectRef, sx, value, valueField, multiple, size, ...rest }: SelectProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
declare function Select<T extends FieldValues = FieldValues>({ allowClear, children, data, descriptionTemplate, disabled, displayTemplate, dropDownHeight, error, groupBy: groupByFn, helperText, labelWrapperProps, id, label, onChange, optionImg, optionImgProps, optionTemplate, optionAsValue, selectInitialOption, selectRef, sx, value, valueField, multiple, size, ...rest }: SelectProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
25
27
|
declare const _default: typeof Select;
|
|
26
28
|
export default _default;
|