Skip to content

Commit

Permalink
Merge pull request #103 from evan-lin9/master
Browse files Browse the repository at this point in the history
补充plugins types
  • Loading branch information
xz8la8 authored Apr 16, 2021
2 parents 4842061 + 19dd21a commit 70eabf2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/sula/src/types/form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ export type FieldNamePath = string | FieldNameList;

export type FieldSource = Array<{
text: string;
value: string;
value: string | number | boolean;
[key: string]: any;
}>;
10 changes: 6 additions & 4 deletions packages/sula/src/types/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type TableCtx = {
dataSource: Record<string, any>[];
}

type RenderCtx = FormCtx & TableCtx;
export type RenderCtx = FormCtx & TableCtx;

// Action Context
type ActionResultCtx = {
Expand All @@ -58,14 +58,16 @@ type ConverterCtx = {
type ConverterComboCtx = ConverterCtx & Partial<ActionResultComboCtx>;

// 渲染插件
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<string, any>;
funcProps?: Record<string, (ctx: RenderCtx) => string>;
confirm?: string | PopconfirmProps;
tooltip?: string | TooltipProps;
disabled?: boolean;
disabled?: boolean | DisabledFunction;
visible?: string | boolean;
action?: ActionPlugin | ActionPlugin[];
} | string | RenderPluginFunction;

Expand Down Expand Up @@ -168,4 +170,4 @@ export type ConverterPlugin = {
// 过滤插件
export type FilterPlugin = {
type: string;
} | string;
} | string;

0 comments on commit 70eabf2

Please sign in to comment.