diff --git a/packages/sula/src/types/form.ts b/packages/sula/src/types/form.ts index 19a9dd7..64f68d9 100644 --- a/packages/sula/src/types/form.ts +++ b/packages/sula/src/types/form.ts @@ -5,6 +5,6 @@ export type FieldNamePath = string | FieldNameList; export type FieldSource = Array<{ text: string; - value: string; + value: string | number | boolean; [key: string]: any; }>; diff --git a/packages/sula/src/types/plugin.ts b/packages/sula/src/types/plugin.ts index 5b85cc3..50afe1a 100644 --- a/packages/sula/src/types/plugin.ts +++ b/packages/sula/src/types/plugin.ts @@ -35,7 +35,7 @@ type TableCtx = { dataSource: Record[]; } -type RenderCtx = FormCtx & TableCtx; +export type RenderCtx = FormCtx & TableCtx; // Action Context type ActionResultCtx = { @@ -58,14 +58,16 @@ type ConverterCtx = { type ConverterComboCtx = ConverterCtx & Partial; // 渲染插件 -export type RenderPluginFunction = (ctx: RenderCtx) => React.ReactElement; +export type RenderPluginFunction = (ctx: RenderCtx) => React.ReactElement | string; +export type DisabledFunction = (ctx: RenderCtx) => boolean export type RenderPlugin = { type: string | RenderPluginFunction; props?: Record; funcProps?: Record string>; confirm?: string | PopconfirmProps; tooltip?: string | TooltipProps; - disabled?: boolean; + disabled?: boolean | DisabledFunction; + visible?: string | boolean; action?: ActionPlugin | ActionPlugin[]; } | string | RenderPluginFunction; @@ -168,4 +170,4 @@ export type ConverterPlugin = { // 过滤插件 export type FilterPlugin = { type: string; -} | string; \ No newline at end of file +} | string;