From fec19ff412430405175ae71cce6e459e9097bccd Mon Sep 17 00:00:00 2001 From: evan-lin <470035056@qq.com> Date: Thu, 1 Apr 2021 12:13:37 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E8=A1=A5=E5=85=85plugins=20types?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 补充plugins types --- packages/sula/src/types/plugin.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/sula/src/types/plugin.ts b/packages/sula/src/types/plugin.ts index 5b85cc3..4e15fa9 100644 --- a/packages/sula/src/types/plugin.ts +++ b/packages/sula/src/types/plugin.ts @@ -59,13 +59,15 @@ type ConverterComboCtx = ConverterCtx & Partial; // 渲染插件 export type RenderPluginFunction = (ctx: RenderCtx) => React.ReactElement; +export declare 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; From a4a2f0fe0294b126017871d616dcc3d542eae1aa Mon Sep 17 00:00:00 2001 From: evan-lin <470035056@qq.com> Date: Thu, 1 Apr 2021 14:46:06 +0800 Subject: [PATCH 2/3] Update plugin.ts --- packages/sula/src/types/plugin.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/sula/src/types/plugin.ts b/packages/sula/src/types/plugin.ts index 4e15fa9..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,8 +58,8 @@ type ConverterCtx = { type ConverterComboCtx = ConverterCtx & Partial; // 渲染插件 -export type RenderPluginFunction = (ctx: RenderCtx) => React.ReactElement; -export declare type DisabledFunction = (ctx: RenderCtx) => boolean +export type RenderPluginFunction = (ctx: RenderCtx) => React.ReactElement | string; +export type DisabledFunction = (ctx: RenderCtx) => boolean export type RenderPlugin = { type: string | RenderPluginFunction; props?: Record; From 19dd21a329e0283bc609a3cc372c9b7a20045b4d Mon Sep 17 00:00:00 2001 From: evan-lin <470035056@qq.com> Date: Thu, 1 Apr 2021 14:46:41 +0800 Subject: [PATCH 3/3] Update form.ts --- packages/sula/src/types/form.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; }>;