xph-crud 0.3.2 → 0.3.3
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.
- package/dist/index.js +6 -0
- package/dist/index.umd.cjs +8 -8
- package/dist/types/common/src/components/actions/types/actionItem.d.ts +13 -13
- package/dist/types/common/src/components/actions/types/actions.d.ts +6 -6
- package/dist/types/common/src/components/auth/types/index.d.ts +9 -0
- package/dist/types/common/src/components/dialog/types/dialog.d.ts +42 -30
- package/dist/types/common/src/components/index.d.ts +3 -0
- package/dist/types/common/src/hooks/useAsyncState.d.ts +2 -2
- package/dist/types/common/src/utils/getValueByPath.d.ts +3 -0
- package/dist/types/common/src/utils/uuid.d.ts +3 -0
- package/dist/types/form/index.d.ts +1 -0
- package/dist/types/form/src/helper.d.ts +1 -1
- package/dist/types/form/src/hooks/useApiComonentCache.d.ts +6 -9
- package/dist/types/form/src/hooks/useForm.d.ts +1 -1
- package/dist/types/form/src/types/form.d.ts +50 -37
- package/dist/types/form/src/types/formItem.d.ts +37 -35
- package/dist/types/table/index.d.ts +3 -2
- package/dist/types/table/src/components/table/components/cellFunc/types/cellFunc.d.ts +12 -3
- package/dist/types/table/src/types/apiTable.d.ts +24 -44
- package/dist/types/table/src/types/column.d.ts +1 -1
- package/dist/types/table/src/types/crudFormDialog.d.ts +13 -3
- package/dist/types/table/src/types/searchForm.d.ts +4 -1
- package/dist/types/table/src/types/table.d.ts +5 -5
- package/package.json +63 -63
|
@@ -2,86 +2,98 @@ import { ButtonProps } from 'antd';
|
|
|
2
2
|
|
|
3
3
|
export interface IDialogProps {
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
* @
|
|
5
|
+
* 弹窗的宽度
|
|
6
|
+
* @defaultValue `700`
|
|
7
7
|
*/
|
|
8
8
|
width?: number;
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
11
|
-
* @
|
|
10
|
+
* 弹窗的高度
|
|
11
|
+
* @defaultValue `-`
|
|
12
12
|
*/
|
|
13
13
|
height?: number;
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
16
|
-
* @
|
|
15
|
+
* 是否显示遮罩
|
|
16
|
+
* @defaultValue `false`
|
|
17
17
|
*/
|
|
18
18
|
mask?: boolean;
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
21
|
-
* @
|
|
20
|
+
* 弹窗的标题
|
|
21
|
+
* @defaultValue `-`
|
|
22
22
|
*/
|
|
23
23
|
title?: string;
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
26
|
-
* @
|
|
25
|
+
* 确定按钮属性
|
|
26
|
+
* @defaultValue `-`
|
|
27
27
|
*/
|
|
28
28
|
okProps?: Omit<ButtonProps, "children" | "onClick">;
|
|
29
29
|
/**
|
|
30
|
-
*
|
|
31
|
-
* @
|
|
30
|
+
* 取消按钮属性
|
|
31
|
+
* @defaultValue `-`
|
|
32
32
|
*/
|
|
33
33
|
cancelProps?: Omit<ButtonProps, "children" | "onClick">;
|
|
34
34
|
/**
|
|
35
|
-
*
|
|
36
|
-
* @
|
|
35
|
+
* 确定按钮文字
|
|
36
|
+
* @defaultValue `"确定"`
|
|
37
37
|
*/
|
|
38
38
|
okText?: string;
|
|
39
39
|
/**
|
|
40
|
-
*
|
|
41
|
-
* @
|
|
40
|
+
* 取消按钮文字
|
|
41
|
+
* @defaultValue `"取消"`
|
|
42
42
|
*/
|
|
43
43
|
cancelText?: string;
|
|
44
44
|
/**
|
|
45
|
-
*
|
|
46
|
-
* @
|
|
45
|
+
* 点击确定按钮触发该事件
|
|
46
|
+
* @defaultValue `-`
|
|
47
47
|
*/
|
|
48
48
|
onOk?: (args: any) => Promise<void>;
|
|
49
49
|
/**
|
|
50
|
-
*
|
|
51
|
-
* @
|
|
50
|
+
* 点击取消按钮触发该事件
|
|
51
|
+
* @defaultValue `-`
|
|
52
52
|
*/
|
|
53
53
|
onCancel?: (args: any) => Promise<void>;
|
|
54
54
|
/**
|
|
55
|
-
*
|
|
56
|
-
* @
|
|
55
|
+
* 底部按钮自定义渲染函数
|
|
56
|
+
* @defaultValue `-`
|
|
57
57
|
*/
|
|
58
58
|
renderFooter?: ({ loading }: {
|
|
59
59
|
loading: boolean;
|
|
60
60
|
}) => React.ReactElement;
|
|
61
61
|
/**
|
|
62
|
-
*
|
|
63
|
-
* @
|
|
62
|
+
* 顶部标题自定义渲染函数
|
|
63
|
+
* @defaultValue `-`
|
|
64
64
|
*/
|
|
65
65
|
renderTitle?: () => React.ReactElement;
|
|
66
66
|
/**
|
|
67
|
-
*
|
|
68
|
-
* @
|
|
67
|
+
* 打开的时候会触发该事件
|
|
68
|
+
* @defaultValue `-`
|
|
69
69
|
*/
|
|
70
70
|
onOpen?: () => void;
|
|
71
71
|
/**
|
|
72
|
-
*
|
|
73
|
-
* @
|
|
72
|
+
* 关闭的时候会触发该事件
|
|
73
|
+
* @defaultValue `-`
|
|
74
74
|
*/
|
|
75
75
|
onClose?: () => void;
|
|
76
76
|
/**
|
|
77
|
-
*
|
|
78
|
-
* @
|
|
77
|
+
* 挂载弹窗的容器
|
|
78
|
+
* @defaultValue `() => document.body`
|
|
79
79
|
*/
|
|
80
80
|
getPopperContainer?: () => HTMLElement | null;
|
|
81
81
|
}
|
|
82
82
|
export interface IDialogActionType {
|
|
83
|
+
/**
|
|
84
|
+
* 打开
|
|
85
|
+
*/
|
|
83
86
|
open: () => Promise<void>;
|
|
87
|
+
/**
|
|
88
|
+
* 关闭
|
|
89
|
+
*/
|
|
84
90
|
close: () => void;
|
|
91
|
+
/**
|
|
92
|
+
* 设置loading
|
|
93
|
+
*/
|
|
85
94
|
setLoading: (loading: boolean) => void;
|
|
95
|
+
/**
|
|
96
|
+
* 获取弹窗状态
|
|
97
|
+
*/
|
|
86
98
|
getVisible: () => boolean;
|
|
87
99
|
}
|
|
@@ -6,4 +6,7 @@ import { default as XphPortal } from './portal/portal';
|
|
|
6
6
|
import { default as XphAuth } from './auth/auth';
|
|
7
7
|
import { IAuthProps as IXphAuthProps } from './auth/types';
|
|
8
8
|
|
|
9
|
+
export * from './actions/types';
|
|
10
|
+
export * from './auth/types';
|
|
11
|
+
export * from './dialog/types';
|
|
9
12
|
export { XphActions, TXphActionItemProps, IXphActionsProps, XphDialog, IXphDialogProps, IXphDialogActionType, XphPortal, XphAuth, IXphAuthProps, };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 自定义 Hook 用于异步更新状态
|
|
3
|
-
* @param initialState 初始状态
|
|
2
|
+
* @description 自定义 Hook 用于异步更新状态
|
|
3
|
+
* @param initialState - 初始状态
|
|
4
4
|
* @returns [state, setAsyncState] state 是当前状态,setAsyncState 是更新状态的函数
|
|
5
5
|
*/
|
|
6
6
|
export declare const useAsyncState: <T>(initialState: T) => [T, (newState: T) => Promise<void>];
|
|
@@ -2,4 +2,5 @@ import { default as XphForm } from './src/form';
|
|
|
2
2
|
import { IFormProps as IXphFormProps, IFormActionType as IXphFormActionType, TFormItemProps as TXphFormItemProps } from './src/types';
|
|
3
3
|
import { useForm as useXphForm } from './src/hooks';
|
|
4
4
|
|
|
5
|
+
export * from './src/types';
|
|
5
6
|
export { XphForm, IXphFormProps, TXphFormItemProps, IXphFormActionType, useXphForm, };
|
|
@@ -2,7 +2,7 @@ import { RuleObject } from 'antd/es/form';
|
|
|
2
2
|
import { TComponentPropsMap, TFormItemProps } from './types';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* @description
|
|
5
|
+
* @description 生成placeholder
|
|
6
6
|
*/
|
|
7
7
|
export declare function createPlaceholderMessage(component: keyof TComponentPropsMap): "" | "请输入" | "请选择";
|
|
8
8
|
export declare function setComponentRuleType(rule: RuleObject, component: keyof TComponentPropsMap, valueFormat: string): void;
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 该钩子解决的问题:
|
|
2
|
+
* @description 该钩子解决的问题:
|
|
3
3
|
* 1、使用了Form.useWatch的FormItem,至少都会触发两次组件更新,导致api首次请求的情况不一致
|
|
4
4
|
* 2、每次value的更新,都会导致组件的重新渲染,导致api每次都会请求(处理成当params不一致才重新请求)
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*
|
|
8
|
-
* @param
|
|
9
|
-
* @param
|
|
10
|
-
* @param immediate 首次是否立即执行apiCallback
|
|
11
|
-
* @param params 请求的参数
|
|
12
|
-
* @param isUseWatch 是否使用了Form.useWatch
|
|
5
|
+
* @param api - 请求的api
|
|
6
|
+
* @param apiCallback - 请求之后的回调
|
|
7
|
+
* @param immediate - 首次是否立即执行apiCallback
|
|
8
|
+
* @param params - 请求的参数
|
|
9
|
+
* @param isUseWatch - 是否使用了Form.useWatch
|
|
13
10
|
*/
|
|
14
11
|
interface IUseComonentCacheProps {
|
|
15
12
|
api?: (...args: any[]) => Promise<any>;
|
|
@@ -13,7 +13,7 @@ export declare const useFormModel: (formProps: IFormProps, itemProps: TFormItemP
|
|
|
13
13
|
/**
|
|
14
14
|
*
|
|
15
15
|
* @description 用于注册form的方法
|
|
16
|
-
*
|
|
16
|
+
* form组件会先于parent组件挂载,挂载完后调用register方法,将methods注册到useForm中给parent使用
|
|
17
17
|
*
|
|
18
18
|
*/
|
|
19
19
|
declare const useForm: () => [IRegister, IFormActionType];
|
|
@@ -8,87 +8,85 @@ export interface IRegister {
|
|
|
8
8
|
}
|
|
9
9
|
export interface IFormProps<T extends TXphExtendComponentPropsMap = {}> {
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
12
|
-
* @
|
|
11
|
+
* 表单项配置集合
|
|
12
|
+
* @defaultValue `[]`
|
|
13
13
|
*/
|
|
14
14
|
items: TFormItemProps<T>[];
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
17
|
-
* @
|
|
16
|
+
* 表单布局方式,排除了antd的inline,因为可以使用colProps实现inline布局
|
|
17
|
+
* @defaultValue `"horizontal"`
|
|
18
18
|
*/
|
|
19
19
|
layout?: "horizontal" | "vertical";
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
22
|
-
* @
|
|
21
|
+
* 表示是否显示 label 后面的冒号 (只有在属性 layout 为 horizontal 时有效)
|
|
22
|
+
* @defaultValue `false`
|
|
23
23
|
*/
|
|
24
24
|
colon?: boolean;
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
27
|
-
* @
|
|
26
|
+
* 设置表单组件禁用,仅对 antd 组件有效
|
|
27
|
+
* @defaultValue `-`
|
|
28
28
|
*/
|
|
29
29
|
disabled?: boolean;
|
|
30
30
|
/**
|
|
31
|
-
*
|
|
32
|
-
* @
|
|
31
|
+
* 表单项组件布局方式(wrapperCol的span与labelCol的span形成24栅格布局)
|
|
32
|
+
* @defaultValue `-`
|
|
33
33
|
*/
|
|
34
34
|
wrapperCol?: ColProps;
|
|
35
35
|
/**
|
|
36
|
-
*
|
|
37
|
-
* @
|
|
36
|
+
* label 标签的文本换行方式
|
|
37
|
+
* @defaultValue `true`
|
|
38
38
|
*/
|
|
39
39
|
labelWrap?: boolean;
|
|
40
40
|
/**
|
|
41
|
-
*
|
|
42
|
-
* @
|
|
41
|
+
* label 标签的文本对齐方式
|
|
42
|
+
* @defaultValue `-`
|
|
43
43
|
*/
|
|
44
44
|
labelAlign?: "left" | "right";
|
|
45
45
|
/**
|
|
46
|
-
*
|
|
47
|
-
* @
|
|
46
|
+
* 表单项label标签布局方式(wrapperCol的span与labelCol的span形成24栅格布局)
|
|
47
|
+
* @defaultValue `-`
|
|
48
48
|
*/
|
|
49
49
|
labelCol?: ColProps;
|
|
50
50
|
/**
|
|
51
|
-
*
|
|
52
|
-
* @
|
|
51
|
+
* 表单项的栅格配置
|
|
52
|
+
* @defaultValue `-`
|
|
53
53
|
*/
|
|
54
54
|
colProps?: ColProps;
|
|
55
55
|
/**
|
|
56
|
-
*
|
|
57
|
-
* @
|
|
56
|
+
* 提交失败自动滚动到第一个错误字段
|
|
57
|
+
* @defaultValue `-`
|
|
58
58
|
*/
|
|
59
59
|
scrollToFirstError?: boolean;
|
|
60
60
|
/**
|
|
61
|
-
*
|
|
62
|
-
* @
|
|
61
|
+
* 设置字段组件的尺寸(仅限 antd 组件)
|
|
62
|
+
* @defaultValue `-`
|
|
63
63
|
*/
|
|
64
64
|
size?: "large" | "middle" | "small";
|
|
65
65
|
/**
|
|
66
|
-
*
|
|
67
|
-
* @
|
|
66
|
+
* 是否可折叠,默认超过5个折叠
|
|
67
|
+
* @defaultValue `-`
|
|
68
68
|
*/
|
|
69
69
|
collapsible?: boolean;
|
|
70
70
|
/**
|
|
71
|
-
*
|
|
72
|
-
* @
|
|
71
|
+
* 超过多少进行折叠,collapsible为true才生效
|
|
72
|
+
* @defaultValue `5`
|
|
73
73
|
*/
|
|
74
74
|
collapseNum?: number;
|
|
75
75
|
/**
|
|
76
|
-
*
|
|
77
|
-
* @
|
|
76
|
+
* 渲染操作组,用于渲染表单项的操作,这是一个预留项,是否需要操作组由业务自己决定(会跟折叠同行显示)
|
|
77
|
+
* @defaultValue `-`
|
|
78
78
|
*/
|
|
79
79
|
renderActions?: () => React.ReactElement;
|
|
80
80
|
/**
|
|
81
|
-
*
|
|
82
|
-
* @
|
|
81
|
+
* 时间返回统一处理函数
|
|
82
|
+
* @defaultValue `(date: any, format: string) => { return date?.format?.(format \|\| "YYYY-MM-DD HH:mm:ss") ?? date }`
|
|
83
83
|
*/
|
|
84
84
|
transformDateFunc?: (date: any, format: string) => string;
|
|
85
85
|
/**
|
|
86
|
-
*
|
|
87
|
-
* @
|
|
86
|
+
* 用于将表单内时间区域的应设成 2 个字段
|
|
87
|
+
* @defaultValue `-`
|
|
88
88
|
* @example
|
|
89
|
-
*
|
|
90
|
-
* // 场景:如果表单内有时间区间组件,获取到的值是一个数组,但是往往我们传递到后台需要是 2 个字段
|
|
91
|
-
*
|
|
89
|
+
* 场景:如果表单内有时间区间组件,获取到的值是一个数组,但是往往我们传递到后台需要是 2 个字段
|
|
92
90
|
* fieldMapToTime: [
|
|
93
91
|
* // data为时间组件在表单内的字段,startTime,endTime为转化后的开始时间与结束时间
|
|
94
92
|
* // 'YYYY-MM-DD'为时间格式,参考moment
|
|
@@ -122,15 +120,30 @@ export interface IFormProps<T extends TXphExtendComponentPropsMap = {}> {
|
|
|
122
120
|
*/
|
|
123
121
|
fieldMapToTime?: [string, [string, string], (string | [string, string])?][];
|
|
124
122
|
/**
|
|
125
|
-
*
|
|
126
|
-
* @
|
|
123
|
+
* 注册事件(useForm使用,form组件会在挂载后调用)
|
|
124
|
+
* @defaultValue `-`
|
|
127
125
|
*/
|
|
128
126
|
register?: IRegister;
|
|
129
127
|
}
|
|
130
128
|
export interface IFormActionType {
|
|
129
|
+
/**
|
|
130
|
+
* 获取表单值
|
|
131
|
+
*/
|
|
131
132
|
getFieldsValue: (...values: any[]) => Recordable<any>;
|
|
133
|
+
/**
|
|
134
|
+
* 设置表单值
|
|
135
|
+
*/
|
|
132
136
|
setFieldsValue: (values: Recordable<any>) => void;
|
|
137
|
+
/**
|
|
138
|
+
* 重置表单值
|
|
139
|
+
*/
|
|
133
140
|
resetFields: () => Promise<void>;
|
|
141
|
+
/**
|
|
142
|
+
* 表单校验
|
|
143
|
+
*/
|
|
134
144
|
validator: (nameList?: NamePath[]) => Promise<any>;
|
|
145
|
+
/**
|
|
146
|
+
* 滚动到指定字段
|
|
147
|
+
*/
|
|
135
148
|
scrollToField: (name: NamePath, options?: ScrollOptions) => Promise<void>;
|
|
136
149
|
}
|
|
@@ -9,73 +9,73 @@ export type Recordable<T> = Record<string, T>;
|
|
|
9
9
|
export type TFunction<T> = T | ((args: Recordable<any>) => T);
|
|
10
10
|
export interface IBaseFormItemProps {
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
13
|
-
* @
|
|
12
|
+
* 字段名
|
|
13
|
+
* @defaultValue `-`
|
|
14
14
|
*/
|
|
15
15
|
name: string;
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
18
|
-
* @
|
|
17
|
+
* 标签名
|
|
18
|
+
* @defaultValue `-`
|
|
19
19
|
*/
|
|
20
20
|
label: string;
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
23
|
-
* @
|
|
22
|
+
* 子节点的值的属性,如 Switch、Checkbox 的是 checked
|
|
23
|
+
* @defaultValue `-`
|
|
24
24
|
*/
|
|
25
25
|
valuePropName?: string;
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
28
|
-
* @
|
|
27
|
+
* 是否显示(相当于display:none)
|
|
28
|
+
* @defaultValue `-`
|
|
29
29
|
*/
|
|
30
30
|
show?: TFunction<boolean>;
|
|
31
31
|
/**
|
|
32
|
-
*
|
|
33
|
-
* @
|
|
32
|
+
* 是否显示(会新增或删除节点)
|
|
33
|
+
* @defaultValue `-`
|
|
34
34
|
*/
|
|
35
35
|
ifShow?: TFunction<boolean>;
|
|
36
36
|
/**
|
|
37
|
-
*
|
|
38
|
-
* @
|
|
37
|
+
* 是否必填
|
|
38
|
+
* @defaultValue `-`
|
|
39
39
|
*/
|
|
40
40
|
required?: TFunction<boolean>;
|
|
41
41
|
/**
|
|
42
|
-
*
|
|
43
|
-
* @
|
|
42
|
+
* 是否禁用(当和 Form 同时设置时,以 Item 为准)
|
|
43
|
+
* @defaultValue `-`
|
|
44
44
|
*/
|
|
45
45
|
disabled?: TFunction<boolean>;
|
|
46
46
|
/**
|
|
47
|
-
*
|
|
48
|
-
* @
|
|
47
|
+
* 组件属性
|
|
48
|
+
* @defaultValue `-`
|
|
49
49
|
*/
|
|
50
50
|
componentProps?: TFunction<Recordable<any>>;
|
|
51
51
|
/**
|
|
52
|
-
*
|
|
53
|
-
* @
|
|
52
|
+
* 校验规则
|
|
53
|
+
* @defaultValue `-`
|
|
54
54
|
*/
|
|
55
55
|
rules?: Rule[];
|
|
56
56
|
/**
|
|
57
|
-
*
|
|
58
|
-
* @
|
|
57
|
+
* 表单项组件的布局方式(当和 Form 同时设置时,以 Item 为准)
|
|
58
|
+
* @defaultValue `-`
|
|
59
59
|
*/
|
|
60
60
|
wrapperCol?: ColProps;
|
|
61
61
|
/**
|
|
62
|
-
*
|
|
63
|
-
* @
|
|
62
|
+
* 表单项label标签布局方式(当和 Form 同时设置时,以 Item 为准)
|
|
63
|
+
* @defaultValue `-`
|
|
64
64
|
*/
|
|
65
65
|
labelCol?: ColProps;
|
|
66
66
|
/**
|
|
67
|
-
*
|
|
68
|
-
* @
|
|
67
|
+
* 表单项的栅格配置(当和 Form 同时设置时,以 Item 为准)
|
|
68
|
+
* @defaultValue `-`
|
|
69
69
|
*/
|
|
70
70
|
colProps?: ColProps;
|
|
71
71
|
/**
|
|
72
|
-
*
|
|
73
|
-
* @
|
|
72
|
+
* 是否强制换一行显示该表单项(强制换行后续会跟随换行表单项)
|
|
73
|
+
* @defaultValue `-`
|
|
74
74
|
*/
|
|
75
75
|
forceRow?: boolean;
|
|
76
76
|
/**
|
|
77
|
-
*
|
|
78
|
-
* @
|
|
77
|
+
* 默认值
|
|
78
|
+
* @defaultValue `-`
|
|
79
79
|
*/
|
|
80
80
|
initialValue?: any;
|
|
81
81
|
}
|
|
@@ -84,23 +84,23 @@ export interface IBaseFormItemProps {
|
|
|
84
84
|
*/
|
|
85
85
|
export interface IFRenderProps {
|
|
86
86
|
/**
|
|
87
|
-
*
|
|
87
|
+
* 当前项name
|
|
88
88
|
*/
|
|
89
89
|
name: string;
|
|
90
90
|
/**
|
|
91
|
-
*
|
|
91
|
+
* 当前项状态
|
|
92
92
|
*/
|
|
93
93
|
disabled: boolean;
|
|
94
94
|
/**
|
|
95
|
-
*
|
|
95
|
+
* 组件属性
|
|
96
96
|
*/
|
|
97
97
|
componentProps: Recordable<any>;
|
|
98
98
|
/**
|
|
99
|
-
*
|
|
99
|
+
* 表单值
|
|
100
100
|
*/
|
|
101
101
|
model: any;
|
|
102
102
|
/**
|
|
103
|
-
*
|
|
103
|
+
* 表单方法实例
|
|
104
104
|
*/
|
|
105
105
|
methods: IFormActionType;
|
|
106
106
|
}
|
|
@@ -109,7 +109,8 @@ export interface IFRenderProps {
|
|
|
109
109
|
*/
|
|
110
110
|
export interface IRenderFormItemProps extends IBaseFormItemProps {
|
|
111
111
|
/**
|
|
112
|
-
*
|
|
112
|
+
* 自定义渲染函数
|
|
113
|
+
* @defaultValue `-`
|
|
113
114
|
*/
|
|
114
115
|
render: (props: IFRenderProps) => React.ReactNode;
|
|
115
116
|
}
|
|
@@ -118,7 +119,8 @@ export interface IRenderFormItemProps extends IBaseFormItemProps {
|
|
|
118
119
|
*/
|
|
119
120
|
export interface IComponentFormItemProps<T extends TXphExtendComponentPropsMap = {}> extends IBaseFormItemProps {
|
|
120
121
|
/**
|
|
121
|
-
*
|
|
122
|
+
* 映射组件
|
|
123
|
+
* @defaultValue `-`
|
|
122
124
|
*/
|
|
123
125
|
component: keyof TComponentPropsMap<T>;
|
|
124
126
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { default as XphTable } from './src/table';
|
|
2
2
|
import { default as XphCrudFormDialog } from './src/components/crudFormDialog';
|
|
3
|
-
import { TTableProps as TXphTableProps, TTableActionType as TXphTableActionType, TDataSourceItem as TXphDataSourceItem, TColumnProps as TXphColumnProps, TApiTableProps as TXphApiTableProps, TSearchFormProps as TXphSearchFormProps, IMainProps as IXphMainProps, TCrudFormDialogProps as TXphCrudFormDialogProps } from './src/types';
|
|
3
|
+
import { TTableProps as TXphTableProps, TTableActionType as TXphTableActionType, TDataSourceItem as TXphDataSourceItem, TColumnProps as TXphColumnProps, TApiTableProps as TXphApiTableProps, TSearchFormProps as TXphSearchFormProps, IMainProps as IXphMainProps, TCrudFormDialogProps as TXphCrudFormDialogProps, ICrudFormDialogActionType as IXphCrudFormDialogActionType } from './src/types';
|
|
4
4
|
|
|
5
|
-
export
|
|
5
|
+
export * from './src/types';
|
|
6
|
+
export { XphTable, TXphTableProps, TXphTableActionType, TXphDataSourceItem, TXphColumnProps, TXphApiTableProps, TXphSearchFormProps, IXphMainProps, XphCrudFormDialog, TXphCrudFormDialogProps, IXphCrudFormDialogActionType, };
|
|
@@ -7,18 +7,18 @@ import { IComponentColumnProps, TDataSourceItem } from '../../../../../types';
|
|
|
7
7
|
export type TCellComponentPropsMap<CellFuncExtendPropsMap extends TXphExtendComponentPropsMap = {}, ActionsExtendPropsMap extends TXphExtendComponentPropsMap = {}> = {
|
|
8
8
|
link: {
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* 超链接,点击超链接跳转
|
|
11
11
|
*/
|
|
12
12
|
url?: string;
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* 点击事件(优先级最高)
|
|
15
15
|
*/
|
|
16
16
|
onClick?: () => void;
|
|
17
17
|
};
|
|
18
18
|
actions: IXphActionsProps<ActionsExtendPropsMap>;
|
|
19
19
|
tag: {
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* 标签的枚举
|
|
22
22
|
*/
|
|
23
23
|
enums: Array<{
|
|
24
24
|
label: string;
|
|
@@ -69,8 +69,17 @@ export interface ICurCellFuncProps<J extends TXphExtendComponentPropsMap = {}, K
|
|
|
69
69
|
* 注意:因为多个自定义组件可能都有mainClick,所以也需要保证其他组件的正常调用(即:传递给子组件Comp的时候,需要把父组件传递过来的mainClick给手动执行一下)
|
|
70
70
|
*/
|
|
71
71
|
export interface IMainProps {
|
|
72
|
+
/**
|
|
73
|
+
* 点击事件
|
|
74
|
+
*/
|
|
72
75
|
mainClick?: () => void;
|
|
76
|
+
/**
|
|
77
|
+
* 内容样式
|
|
78
|
+
*/
|
|
73
79
|
mainStyle?: React.CSSProperties;
|
|
80
|
+
/**
|
|
81
|
+
* 内容
|
|
82
|
+
*/
|
|
74
83
|
mainHandleText?: () => any;
|
|
75
84
|
}
|
|
76
85
|
export {};
|