Skip to main content

SettingProvider

Provides unified default settings for components. Wrap once at the outer level to take effect globally.

SchemaForm

For example, you can uniformly configure the default validation messages for SchemaForm.

ModalForm

For example, you can uniformly configure the default layout for modal forms.

Or you can uniformly configure the default width for modal forms.

ProTable

For example, you can uniformly configure pagination options.

User List
UsernamePhoneNicknameGenderCreated AtActions
No data
No data

Or uniformly configure the search area.

User List
UsernamePhoneNicknameGenderCreated AtActions
No data
No data

Or uniformly configure the table size.

User List
UsernamePhoneNicknameGenderCreated AtActions
No data
No data

FormUpload

You can uniformly set properties like action, header, children, responseToFileList here.

API

SettingProvider

PropertyDescriptionTypeDefault
localeLanguage package setting, you can find the packages in react-admin-kit/locale-zhCN
schemaFormSettingSettings for SchemaForm component-
modalFormSettingSettings for ModalForm component-
proTableSettingSettings for ProTable component-
formUploadSettingSettings for FormUpload component-

SchemaFormSettingProps

PropertyDescriptionTypeDefault
name--string--
initialValues--Store--
component--string | false | FC<any> | ComponentClass<any, any>--
fields--FieldData<any>[]--
validateMessages--ValidateMessages--
onValuesChange--((changedValues: any, values: Record<string, any>) => void)--
onFieldsChange--((changedFields: FieldData<any>[], allFields: FieldData<any>[]) => void)--
onFinishFailed--((errorInfo: ValidateErrorEntity<Record<string, any>>) => void)--
validateTrigger--string | false | string[]--
preserve--boolean--
clearOnDestroy--boolean--
prefixCls--string--
colon--boolean--
layout--FormLayout--
labelAlign--FormLabelAlign--
labelWrap--boolean--
labelCol--ColProps--
wrapperCol--ColProps--
feedbackIcons--FeedbackIcons--
size--SizeType--
disabled--boolean--
scrollToFirstError--boolean | ScrollFocusOptions--
requiredMark--RequiredMark--
hideRequiredMarkWill warning in future branch. Pls use `requiredMark` instead.boolean--
rootClassName--string--
variant--"outlined" | "borderless" | "filled" | "underlined"--
submitterSubmit button related configuration.boolean | SubmitterProps & { style: React.CSSProperties }false
loading表单按钮的 loading 状态boolean--
onLoadingChange这是一个可选的属性(onLoadingChange),它接受一个名为loading的参数,类型为boolean,表示加载状态是否改变。((loading: boolean) => void)--
syncToUrl同步结果到 url 中boolean | ((values: Record<string, any>, type: "get" | "set") => Record<string, any>)--
syncToUrlAsImportant当 syncToUrl 为 true,在页面回显示时,以url上的参数为主,默认为falseboolean--
extraUrlParams额外的 url 参数 中Record<string, any>--
syncToInitialValues同步结果到 initialValues,默认为true如果为false,reset的时将会忽略从url上获取的数据boolean--
omitNil如果为 false,会原样保存。booleantrue
dateFormatter格式化 Date 的方式,默认转化为 stringfalse | "string" | "number" | (string & {}) | ((value: Dayjs, valueType: string) => string | number)--
onInit表单初始化成功,比如布局,label等计算完成((values: Record<string, any>, form: ProFormInstance<any>) => void)--
params发起网络请求的参数Record<string, any>--
request发起网络请求的参数,返回值会覆盖给 initialValuesProRequestData<Record<string, any>, Record<string, any>>--
isKeyPressSubmit是否回车提交boolean--
formKey用于控制form 是否相同的key,高阶用法string--
autoFocusFirstInput--boolean--
readonlyWhether it is readonly modebooleanfalse
gridopen grid layoutbooleanfalse
colPropsonly works when grid is enabledColProps{ xs: 24 }
rowPropsonly works when grid is enabledRowProps{ gutter: 8 }
embedWhether it is embed modebooleanfalse
valueBaseNameWhen embed is enabled, handle nested data structure; when collecting data in onFinish, it will be attached under this field. Only applicable in embed mode.stringfalse
readonlyTypeDisplay type when readonly. Options: form or descriptions"form" | "descriptions"form
descriptionsPropsTable style configuration in descriptions mode
Omit<DescriptionsProps, 'items' | 'columns'>
--

ModalFormSettingProps

PropertyDescriptionTypeDefault
className--string--
style--CSSProperties--
titleThe modal dialog's titleReactNode--
prefixCls--string--
rootClassName--string--
loading5.18.0boolean--
footer--ReactNode | ((originNode: ReactNode, extra: { OkBtn: FC<{}>; CancelBtn: FC<{}>; }) => ReactNode)--
widthWidth of the modal dialogstring | number | Partial<Record<Breakpoint, string | number>>--
transitionName--string--
maskTransitionName--string--
keyboard--boolean--
mask--boolean--
afterClose--(() => void)--
afterOpenChangeCallback when the animation ends when Modal is turned on and off((open: boolean) => void)--
closable--boolean | ({ closeIcon?: ReactNode; disabled?: boolean; } & AriaAttributes) | undefined--
maskClosableWhether to close the modal dialog when the mask (area outside the modal) is clickedboolean--
visiblePlease use `open` instead.boolean--
destroyOnClosePlease use `destroyOnHidden` insteadboolean--
mousePosition--MousePosition--
wrapStyle--Record<string, any>--
bodyStylePlease use `styles.body` insteadCSSProperties--
maskStylePlease use `styles.mask` insteadCSSProperties--
wrapClassName--string--
height--string | number--
zIndex--number--
bodyProps--any--
maskProps--any--
classNames--ModalClassNames--
styles--ModalStyles--
wrapProps--any--
getContainer--string | false | HTMLElement | getContainerFunc--
closeIcon--ReactNode--
modalRender--((node: ReactNode) => ReactNode)--
forceRenderForce render Modalboolean--
focusTriggerAfterClose--boolean--
panelRef--Ref<HTMLDivElement>--
openWhether the modal dialog is visible or notboolean--
confirmLoadingWhether to apply loading visual effect for OK button or notboolean--
onCancelSpecify a function that will be called when a user clicks mask, close button on top right or Cancel button((e: MouseEvent<HTMLButtonElement, MouseEvent>) => void)--
centeredCentered Modalboolean--
okTextText of the OK buttonReactNode--
okTypeButton `type` of the OK buttonLegacyButtonType--
cancelTextText of the Cancel buttonReactNode--
okButtonProps--ButtonProps--
cancelButtonProps--ButtonProps--
destroyOnHidden5.25.0boolean--
onOpenCallback after opening the modal, you can request data here;(formType, formRef, formData) => Promise | void--
formPropsParameters passed to the form, please refer to the SchemaForm component APIOmit<SchemaFormProps, 'innerRef' | 'formRef' | 'onFinish' | 'columns' | 'form'>--
confirmOnCloseClose modal confirmation, a confirmation dialog will appear when form items are modifiedboolean | { title?: string; content?: string }{ title: '确认关闭', content: '表单项内容未保存, 是否确认关闭?' }

ProTableSettingProps

PropertyDescriptionTypeDefault
nameUsed for table headerTitle display and modal title display; can be used with locale to modify text.string--
className--string--
id--string--
style--CSSProperties--
title--PanelRender<any>--
onChange--((pagination: TablePaginationConfig, filters: Record<string, FilterValue | null>, sorter: SorterResult<any> | SorterResult<...>[], extra: TableCurrentDataSource<...>) => void)--
onReset重置表单时触发(() => void)--
onLoad数据加载完成后触发((dataSource: any[]) => void)--
onScroll--UIEventHandler<HTMLDivElement>--
prefixCls--string--
size--SizeType--
rootClassName--string--
loading--boolean | SpinProps--
onLoadingChangeloading 被修改时触发,一般是网络请求导致的((loading: boolean | SpinProps) => void) | undefined--
formRef操作自带的 formMutableRefObject<ProFormInstance> | undefined--
dateFormatter暂时只支持 dayjs - string 会格式化为 YYYY-DD-MM - number 代表时间戳false | "string" | "number" | (string & {}) | ((value: Dayjs, valueType: string) => string | number)--
paramsrequest 的参数,修改之后会触发更新any--
footer--PanelRender<any>--
onOpenCallback after opening the modal, you can request data here;(formType, formRef, formData) => Promise | void--
rowSelection选择项配置false | (TableRowSelection<any> & { alwaysShowAlert?: boolean; }) | undefined--
scroll--({ x?: string | number | true; y?: string | number | undefined; } & { scrollToFirstRowOnChange?: boolean | undefined; }) | undefined--
indentSize--number--
rowKey--string | number | symbol | GetRowKey<any>--
tableLayout--TableLayout--
expandableConfig expand rowsExpandableConfig<any>--
rowClassName--string | RowClassName<any>--
summary--((data: readonly any[]) => ReactNode)--
caption--ReactNode--
showHeader--boolean--
components--TableComponents<any>--
onRow--GetComponentProps<any>--
onHeaderRow--GetComponentProps<readonly ColumnType<any>[]>--
direction--Direction--
sticky--boolean | TableSticky--
rowHoverable--boolean--
dropdownPrefixCls--string--
dataSource--readonly any[]--
pagination--false | TablePaginationConfig--
bordered--boolean--
locale--TableLocale--
getPopupContainer--GetPopupContainer--
sortDirections--SortOrder[]--
showSorterTooltip--boolean | SorterTooltipProps--
virtual--boolean--
tableAlertOptionRenderCustom table alert right area;false | ((option: { selectedRowKeys: any[]; selectedRows: any[]; onCleanSelected: () => void; }, doms: { delDom?: ReactNode; cancelDom: ReactNode; }) => ReactNode)--
searchOptions for search area;
false | {labelWrap?: boolean} & SearchConfig
--
toolbarListToolBar 的属性ListToolBarProps--
ghost幽灵模式,即是否取消卡片内容区域的 padding 和 卡片的背景颜色。boolean--
columnsStateMap列状态配置,可以配置是否浮动和是否展示Record<string, ColumnsState>--
onColumnsStateChange列状态配置修改触发事件((map: Record<string, ColumnsState>) => void)--
columnsState列状态的配置,可以用来操作列功能ColumnStateType--
onSizeChange--((size: DensitySize) => void)--
cardPropstable 外面卡片的设置false | CardProps--
tableRender渲染 table((props: ProTableProps<any, any, "text">, defaultDom: Element, domList: { toolbar: Element; alert: Element | undefined; table: Element | undefined; }) => ReactNode) | undefined--
tableViewRender渲染 table 视图,用于定制 ProList,不推荐直接使用((props: TableProps<any>, defaultDom: Element) => Element) | undefined--
tableExtraRendertable 和搜索表单之间的 dom 渲染((props: ProTableProps<any, any, "text">, dataSource: any[]) => ReactNode)--
searchFormRender渲染搜索表单((props: ProTableProps<any, any, "text">, defaultDom: Element) => ReactNode)--
postData对数据进行一些处理any--
defaultData默认的数据any[]--
toolBarRender渲染操作栏false | ((action: ActionType, rows: { selectedRowKeys?: (string | number)[] | undefined; selectedRows?: any[] | undefined; }) => ReactNode[]) | undefined--
optionsRender--((props: ToolBarProps<any>, defaultDom: ReactNode[]) => ReactNode[])--
onRequestError数据加载失败时触发((e: Error) => void)--
polling是否轮询 ProTable 它不会自动提交表单,如果你想自动提交表单的功能,需要在 onValueChange 中调用 formRef.current?.submit()number | ((dataSource: any[]) => number)--
tableClassName给封装的 table 的 classNamestring--
tableStyle给封装的 table 的 styleCSSProperties--
headerTitle左上角的 titleReactNode--
tooltip标题旁边的 tooltipLabelTooltipType--
options操作栏配置false | OptionConfig--
beforeSearchSubmit格式化搜索表单提交数据((params: Partial<any>) => any)--
tableAlertRender设置或者返回false 即可关闭AlertRenderType<any>--
type支持 ProTable 的类型ProSchemaComponentTypes--
columnEmptyText空值时显示ProFieldEmptyText--
manualRequest是否手动触发请求boolean--
editable编辑行相关的配置RowEditableConfig<any>--
onDataSourceChange可编辑表格修改数据的改变((dataSource: any[]) => void)--
cardBordered查询表单和 Table 的卡片 border 配置Bordered--
debounceTime去抖时间number--
revalidateOnFocus只在request 存在的时候生效,可编辑表格也不会生效booleanfalse
defaultSize默认的表格大小SizeType--
ErrorBoundary错误边界自定义false | ComponentClass<any, any>--
delFunctionThe delete function passed in;((selectedIds: (string | number)[], record: any) => void | Promise<any>)--
delPermissionWhether has delete permission; defaults to true if not passed;(() => boolean)--
tableAlertOptionOptions for multi-select delete functionality;--
modalFormPropsProperties passed to the ModalForm component.
Omit<ModalFormProps, 'innerRef' | 'onFinish' | 'onOpen' | 'columns'>
--
noPaddingRemove Card wrapper padding; deprecated; use cardStyle = false instead;boolean--
delConfirmTypeType of delete confirmation popup."popconfirm" | "modal"popconfirm
delPopconfirmPropsProperties passed to delete confirmation popover. title and description can be functions;(Omit<PopconfirmProps, "title" | "description"> & { title?: ReactNode | ((record: any, index: any) => ReactNode); description?: ReactNode | ((record: any, index: any) => ReactNode); })--
delModalConfirmPropsProperties passed to delete confirmation modal. title and content can be functions;(Omit<ModalFuncProps, "title" | "content"> & { title?: ReactNode | ((record: any, index: any) => ReactNode); content?: ReactNode | ((record: any, index: any) => ReactNode); })--
delSuccessPropsMessage properties after successful deletion (passed to Message component). false to disable message.{content: "删除成功", type: "success"}
optionColumnSpacePropsProperties passed to the Space component that wraps buttons in the action column.{size: 'small'}
defaultHideInSearchWhether columns are hidden in search area by default.booleanfalse
rakLocaleUsed to modify the suffix text of headerTitle and corresponding text for formType, etc.LocaleTypezh_CH

FormUploadSettingProps

PropertyDescriptionTypeDefault
onFinishCallback after all files are uploaded (all files are not uploading)((files: UploadFile<any>[]) => void)--
childrenchildren({ loading: boolean }) => Element | Element--
actionUploading URLstring--
method--"POST" | "PUT" | "PATCH" | "post" | "put" | "patch"--
name--string--
className--string--
id--string--
style--CSSProperties--
onDrop--((event: DragEvent<HTMLDivElement>) => void)--
prefixCls--string--
disabled--boolean--
rootClassName--string--
data--Record<string, unknown> | ((file: UploadFile<any>) => Record<string, unknown> | Promise<Record<string, unknown>>)--
locale--UploadLocale--
type--UploadType--
hasControlInside--boolean--
pastable--boolean--
accept--string--
multiple--boolean--
defaultFileList--UploadFile<any>[]--
directory--boolean--
headers--HttpRequestHeader--
showUploadList--boolean | ShowUploadListInterface<any>--
beforeUpload--((file: RcFile, fileList: RcFile[]) => BeforeUploadValueType | Promise<BeforeUploadValueType>)--
listType--UploadListType--
onPreview--((file: UploadFile<any>) => void)--
onDownload--((file: UploadFile<any>) => void)--
onRemove--((file: UploadFile<any>) => boolean | void | Promise<boolean | void>)--
supportServerRender--boolean--
customRequest--((options: UploadRequestOption<any>) => void)--
withCredentials--boolean--
openFileDialogOnClick--boolean--
previewFile--PreviewFileHandler--
transformFilePlease use `beforeUpload` directlyTransformFileHandler--
iconRender--((file: UploadFile<any>, listType?: UploadListType) => ReactNode) | undefined--
isImageUrl--((file: UploadFile<any>) => boolean)--
progress--UploadListProgressProps--
itemRender--ItemRender<any>--
maxCountConfig max count of `fileList`. Will replace current one when `maxCount` is 1number--
nameKeyCustom field for file list namestringname
urlKeyCustom field for file list urlstringurl
responseToFileListYou can merge the data returned by the background into fileList((res: any) => Record<string, any>)--
errorHandleError handling function after upload failure((res: any) => void)--