xph-crud 0.3.0 → 0.3.2

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.
Files changed (61) hide show
  1. package/dist/index.js +1 -1
  2. package/dist/index.umd.cjs +1 -1
  3. package/dist/types/common/index.d.ts +1 -1
  4. package/dist/types/common/src/{componnets → components}/actions/types/actionItem.d.ts +58 -17
  5. package/dist/types/common/src/components/actions/types/actions.d.ts +30 -0
  6. package/dist/types/common/src/{componnets → components}/dialog/hooks/useDialogContentMaxHeight.d.ts +1 -1
  7. package/dist/types/common/src/{componnets → components}/dialog/hooks/useDialogFooter.d.ts +1 -1
  8. package/dist/types/common/src/{componnets → components}/dialog/hooks/useDialogPosition.d.ts +1 -1
  9. package/dist/types/common/src/{componnets → components}/dialog/hooks/useDialogSize.d.ts +1 -1
  10. package/dist/types/common/src/{componnets → components}/dialog/hooks/useDialogZoom.d.ts +1 -1
  11. package/dist/types/common/src/{componnets → components}/dialog/hooks/useDragDialog.d.ts +1 -1
  12. package/dist/types/common/src/{componnets → components}/dialog/hooks/useResizeDialog.d.ts +1 -1
  13. package/dist/types/common/src/components/dialog/types/dialog.d.ts +87 -0
  14. package/dist/types/common/src/hooks/useExtendCompProps.d.ts +1 -1
  15. package/dist/types/common/src/types/extendComponent.d.ts +3 -1
  16. package/dist/types/common/src/utils/getValueByPath.d.ts +4 -4
  17. package/dist/types/form/src/types/form.d.ts +68 -19
  18. package/dist/types/form/src/types/formItem.d.ts +100 -23
  19. package/dist/types/table/src/components/crudFormDialog/index.d.ts +2 -2
  20. package/dist/types/table/src/components/table/components/cellFunc/types/cellFunc.d.ts +23 -17
  21. package/dist/types/table/src/types/apiTable.d.ts +72 -21
  22. package/dist/types/table/src/types/column.d.ts +6 -2
  23. package/dist/types/table/src/types/crudFormDialog.d.ts +10 -7
  24. package/dist/types/table/src/types/searchForm.d.ts +3 -1
  25. package/dist/types/table/src/types/table.d.ts +22 -18
  26. package/package.json +1 -1
  27. package/dist/types/common/src/componnets/actions/types/actions.d.ts +0 -18
  28. package/dist/types/common/src/componnets/dialog/types/dialog.d.ts +0 -32
  29. /package/dist/types/common/src/{componnets → components}/actions/actions.d.ts +0 -0
  30. /package/dist/types/common/src/{componnets → components}/actions/components/button.d.ts +0 -0
  31. /package/dist/types/common/src/{componnets → components}/actions/components/dropdown.d.ts +0 -0
  32. /package/dist/types/common/src/{componnets → components}/actions/components/index.d.ts +0 -0
  33. /package/dist/types/common/src/{componnets → components}/actions/components/more.d.ts +0 -0
  34. /package/dist/types/common/src/{componnets → components}/actions/hooks/index.d.ts +0 -0
  35. /package/dist/types/common/src/{componnets → components}/actions/hooks/useActionItems.d.ts +0 -0
  36. /package/dist/types/common/src/{componnets → components}/actions/hooks/useActionsProps.d.ts +0 -0
  37. /package/dist/types/common/src/{componnets → components}/actions/hooks/useExtendActions.d.ts +0 -0
  38. /package/dist/types/common/src/{componnets → components}/actions/hooks/useRenderContent.d.ts +0 -0
  39. /package/dist/types/common/src/{componnets → components}/actions/types/index.d.ts +0 -0
  40. /package/dist/types/common/src/{componnets → components}/auth/auth.d.ts +0 -0
  41. /package/dist/types/common/src/{componnets → components}/auth/hooks/index.d.ts +0 -0
  42. /package/dist/types/common/src/{componnets → components}/auth/hooks/useAuthProps.d.ts +0 -0
  43. /package/dist/types/common/src/{componnets → components}/auth/hooks/useExtendAuth.d.ts +0 -0
  44. /package/dist/types/common/src/{componnets → components}/auth/types/index.d.ts +0 -0
  45. /package/dist/types/common/src/{componnets → components}/dialog/components/headerBtns/index.d.ts +0 -0
  46. /package/dist/types/common/src/{componnets → components}/dialog/components/minimizeDialog/index.d.ts +0 -0
  47. /package/dist/types/common/src/{componnets → components}/dialog/dialog.d.ts +0 -0
  48. /package/dist/types/common/src/{componnets → components}/dialog/hooks/index.d.ts +0 -0
  49. /package/dist/types/common/src/{componnets → components}/dialog/hooks/useDialogActions.d.ts +0 -0
  50. /package/dist/types/common/src/{componnets → components}/dialog/hooks/useDialogChangeRecord.d.ts +0 -0
  51. /package/dist/types/common/src/{componnets → components}/dialog/hooks/useDialogProps.d.ts +0 -0
  52. /package/dist/types/common/src/{componnets → components}/dialog/hooks/useExtendDialog.d.ts +0 -0
  53. /package/dist/types/common/src/{componnets → components}/dialog/hooks/useMinResizeRecord.d.ts +0 -0
  54. /package/dist/types/common/src/{componnets → components}/dialog/hooks/useMinimizeDialog.d.ts +0 -0
  55. /package/dist/types/common/src/{componnets → components}/dialog/hooks/useOnContainerSizeChange.d.ts +0 -0
  56. /package/dist/types/common/src/{componnets → components}/dialog/hooks/useOnPropsSizeChange.d.ts +0 -0
  57. /package/dist/types/common/src/{componnets → components}/dialog/hooks/usePopperContainerSize.d.ts +0 -0
  58. /package/dist/types/common/src/{componnets → components}/dialog/hooks/useTopShowDialog.d.ts +0 -0
  59. /package/dist/types/common/src/{componnets → components}/dialog/types/index.d.ts +0 -0
  60. /package/dist/types/common/src/{componnets → components}/index.d.ts +0 -0
  61. /package/dist/types/common/src/{componnets → components}/portal/portal.d.ts +0 -0
@@ -0,0 +1,87 @@
1
+ import { ButtonProps } from 'antd';
2
+
3
+ export interface IDialogProps {
4
+ /**
5
+ * @default 700
6
+ * @description 弹窗的宽度
7
+ */
8
+ width?: number;
9
+ /**
10
+ * @default -
11
+ * @description 弹窗的高度
12
+ */
13
+ height?: number;
14
+ /**
15
+ * @default false
16
+ * @description 是否显示遮罩
17
+ */
18
+ mask?: boolean;
19
+ /**
20
+ * @default -
21
+ * @description 弹窗的标题
22
+ */
23
+ title?: string;
24
+ /**
25
+ * @default -
26
+ * @description 确定按钮属性
27
+ */
28
+ okProps?: Omit<ButtonProps, "children" | "onClick">;
29
+ /**
30
+ * @default -
31
+ * @description 取消按钮属性
32
+ */
33
+ cancelProps?: Omit<ButtonProps, "children" | "onClick">;
34
+ /**
35
+ * @default "确定"
36
+ * @description 确定按钮文字
37
+ */
38
+ okText?: string;
39
+ /**
40
+ * @default "取消"
41
+ * @description 取消按钮文字
42
+ */
43
+ cancelText?: string;
44
+ /**
45
+ * @default -
46
+ * @description 点击确定按钮触发该事件
47
+ */
48
+ onOk?: (args: any) => Promise<void>;
49
+ /**
50
+ * @default -
51
+ * @description 点击取消按钮触发该事件
52
+ */
53
+ onCancel?: (args: any) => Promise<void>;
54
+ /**
55
+ * @default -
56
+ * @description 底部按钮自定义渲染函数
57
+ */
58
+ renderFooter?: ({ loading }: {
59
+ loading: boolean;
60
+ }) => React.ReactElement;
61
+ /**
62
+ * @default -
63
+ * @description 顶部标题自定义渲染函数
64
+ */
65
+ renderTitle?: () => React.ReactElement;
66
+ /**
67
+ * @default -
68
+ * @description 打开的时候会触发该事件
69
+ */
70
+ onOpen?: () => void;
71
+ /**
72
+ * @default -
73
+ * @description 关闭的时候会触发该事件
74
+ */
75
+ onClose?: () => void;
76
+ /**
77
+ * @default () => document.body
78
+ * @description 挂载弹窗的容器
79
+ */
80
+ getPopperContainer?: () => HTMLElement | null;
81
+ }
82
+ export interface IDialogActionType {
83
+ open: () => Promise<void>;
84
+ close: () => void;
85
+ setLoading: (loading: boolean) => void;
86
+ getVisible: () => boolean;
87
+ }
@@ -1,5 +1,5 @@
1
1
  import { default as React } from 'react';
2
- import { IXphActionsProps } from '../componnets';
2
+ import { IXphActionsProps } from '../components';
3
3
  import { IXphFormProps } from '../../../form';
4
4
  import { TXphTableProps } from '../../../table';
5
5
  import { IXphDialogProps, IXphAuthProps } from '../..';
@@ -1,2 +1,4 @@
1
- /** 扩展组件的props映射(共用) */
1
+ /**
2
+ * @description 扩展组件的props映射(共用)
3
+ */
2
4
  export type TExtendComponentPropsMap = Record<string, any>;
@@ -1,9 +1,9 @@
1
1
  export declare const getValueByPath: (obj: Record<string, any>, path: string) => any;
2
2
  /**
3
3
  * @description 通过属性为包含.的字符串的对象从值对象中获取值
4
- * @param fields = { current: 'data.current', pageSize: 'data.pageSize' }
5
- * @param values = { data: { current: 1, pageSize: 10 } }
6
- * @returns = { current: 1, pageSize: 10 }
7
- *
4
+ * @example
5
+ * fields { current: 'data.current', pageSize: 'data.pageSize' }
6
+ * values { data: { current: 1, pageSize: 10 } }
7
+ * return { current: 1, pageSize: 10 }
8
8
  */
9
9
  export declare const getValuesByPathObj: (fields: Record<string, string>, values: Record<string, any>) => Record<string, any>;
@@ -7,42 +7,88 @@ export interface IRegister {
7
7
  (methods: IFormActionType): void;
8
8
  }
9
9
  export interface IFormProps<T extends TXphExtendComponentPropsMap = {}> {
10
- items: TFormItemProps<T>[] /** 表单项配置集合 */;
11
10
  /**
12
- * @description 表单布局方式(默认horizontal)
13
- * @description 排除了antd的inline,因为可以使用colProps实现inline布局
11
+ * @default []
12
+ * @description 表单项配置集合
13
+ */
14
+ items: TFormItemProps<T>[];
15
+ /**
16
+ * @default "horizontal"
17
+ * @description 表单布局方式,排除了antd的inline,因为可以使用colProps实现inline布局
14
18
  */
15
19
  layout?: "horizontal" | "vertical";
16
- /** 表示是否显示 label 后面的冒号 (只有在属性 layout 为 horizontal 时有效) */
20
+ /**
21
+ * @default false
22
+ * @description 表示是否显示 label 后面的冒号 (只有在属性 layout 为 horizontal 时有效)
23
+ */
17
24
  colon?: boolean;
18
- /** 设置表单组件禁用,仅对 antd 组件有效 */
25
+ /**
26
+ * @default -
27
+ * @description 设置表单组件禁用,仅对 antd 组件有效
28
+ */
19
29
  disabled?: boolean;
20
- /** 表单项组件布局方式(wrapperCol的span与labelCol的span形成24栅格布局) */
30
+ /**
31
+ * @default -
32
+ * @description 表单项组件布局方式(wrapperCol的span与labelCol的span形成24栅格布局)
33
+ */
21
34
  wrapperCol?: ColProps;
22
- /** label 标签的文本换行方式 */
35
+ /**
36
+ * @default true
37
+ * @description label 标签的文本换行方式
38
+ */
23
39
  labelWrap?: boolean;
24
- /** label 标签的文本对齐方式 */
40
+ /**
41
+ * @default -
42
+ * @description label 标签的文本对齐方式
43
+ */
25
44
  labelAlign?: "left" | "right";
26
- /** 表单项label标签布局方式(wrapperCol的span与labelCol的span形成24栅格布局) */
45
+ /**
46
+ * @default -
47
+ * @description 表单项label标签布局方式(wrapperCol的span与labelCol的span形成24栅格布局)
48
+ */
27
49
  labelCol?: ColProps;
28
- /** 表单项的栅格配置 */
50
+ /**
51
+ * @default -
52
+ * @description 表单项的栅格配置
53
+ */
29
54
  colProps?: ColProps;
30
- /** 提交失败自动滚动到第一个错误字段 */
55
+ /**
56
+ * @default -
57
+ * @description 提交失败自动滚动到第一个错误字段
58
+ */
31
59
  scrollToFirstError?: boolean;
32
- /** 设置字段组件的尺寸(仅限 antd 组件) */
60
+ /**
61
+ * @default -
62
+ * @description 设置字段组件的尺寸(仅限 antd 组件)
63
+ */
33
64
  size?: "large" | "middle" | "small";
34
- /** 是否可折叠,默认超过5个折叠 */
65
+ /**
66
+ * @default -
67
+ * @description 是否可折叠,默认超过5个折叠
68
+ */
35
69
  collapsible?: boolean;
36
- /** 超过多少进行折叠,collapsible为true才生效 */
70
+ /**
71
+ * @default 5
72
+ * @description 超过多少进行折叠,collapsible为true才生效
73
+ */
37
74
  collapseNum?: number;
38
- /** 渲染操作组,用于渲染表单项的操作,这是一个预留项,是否需要操作组由业务自己决定(会跟折叠同行显示) */
75
+ /**
76
+ * @default -
77
+ * @description 渲染操作组,用于渲染表单项的操作,这是一个预留项,是否需要操作组由业务自己决定(会跟折叠同行显示)
78
+ */
39
79
  renderActions?: () => React.ReactElement;
40
- /** 时间返回统一处理函数 */
80
+ /**
81
+ * @default (date: any, format: string) => { return date?.format?.(format || "YYYY-MM-DD HH:mm:ss") ?? date; }
82
+ * @description 时间返回统一处理函数
83
+ */
41
84
  transformDateFunc?: (date: any, format: string) => string;
42
85
  /**
43
- * @description 用于将表单内时间区域的应设成 2 个字段,见下方说明
44
- * @description 如果表单内有时间区间组件,获取到的值是一个数组,但是往往我们传递到后台需要是 2 个字段
86
+ * @default -
87
+ * @description 用于将表单内时间区域的应设成 2 个字段,见下方案例
45
88
  * @example
89
+ *
90
+ * // 场景:如果表单内有时间区间组件,获取到的值是一个数组,但是往往我们传递到后台需要是 2 个字段
91
+ *
46
92
  * fieldMapToTime: [
47
93
  * // data为时间组件在表单内的字段,startTime,endTime为转化后的开始时间与结束时间
48
94
  * // 'YYYY-MM-DD'为时间格式,参考moment
@@ -75,7 +121,10 @@ export interface IFormProps<T extends TXphExtendComponentPropsMap = {}> {
75
121
  * }
76
122
  */
77
123
  fieldMapToTime?: [string, [string, string], (string | [string, string])?][];
78
- /** 注册事件(useForm使用,form组件会在挂载后调用) */
124
+ /**
125
+ * @default -
126
+ * @description 注册事件(useForm使用,form组件会在挂载后调用)
127
+ */
79
128
  register?: IRegister;
80
129
  }
81
130
  export interface IFormActionType {
@@ -5,45 +5,122 @@ import { ColProps } from 'antd';
5
5
  import { IFormActionType } from './form';
6
6
  import { TXphExtendComponentPropsMap } from '../../../common';
7
7
 
8
- /**
9
- * 字符串类型对象
10
- */
11
8
  export type Recordable<T> = Record<string, T>;
12
9
  export type TFunction<T> = T | ((args: Recordable<any>) => T);
13
10
  export interface IBaseFormItemProps {
14
- name: string /** 字段名 */;
15
- label: string /** 标签名 */;
16
- valuePropName?: string /** 子节点的值的属性,如 Switch、Checkbox 的是 checked */;
17
- show?: TFunction<boolean> /** 是否显示(相当于display:none) */;
18
- ifShow?: TFunction<boolean> /** 是否显示(会新增或删除节点) */;
19
- required?: TFunction<boolean> /** 是否必填 */;
20
- disabled?: TFunction<boolean> /** 是否禁用(当和 Form 同时设置时,以 Item 为准) */;
21
- componentProps?: TFunction<Recordable<any>> /** 组件属性 */;
22
- rules?: Rule[] /** 校验规则 */;
23
- wrapperCol?: ColProps /** 表单项组件的布局方式(当和 Form 同时设置时,以 Item 为准) */;
24
- labelCol?: ColProps /** 表单项label标签布局方式(当和 Form 同时设置时,以 Item 为准) */;
25
- colProps?: ColProps /** 表单项的栅格配置(当和 Form 同时设置时,以 Item 为准) */;
26
- forceRow?: boolean /** 是否强制换一行显示该表单项(强制换行后续会跟随换行表单项) */;
27
- initialValue?: any /** 默认值 */;
11
+ /**
12
+ * @default -
13
+ * @description 字段名
14
+ */
15
+ name: string;
16
+ /**
17
+ * @default -
18
+ * @description 标签名
19
+ */
20
+ label: string;
21
+ /**
22
+ * @default -
23
+ * @description 子节点的值的属性,如 Switch、Checkbox 的是 checked
24
+ */
25
+ valuePropName?: string;
26
+ /**
27
+ * @default -
28
+ * @description 是否显示(相当于display:none)
29
+ */
30
+ show?: TFunction<boolean>;
31
+ /**
32
+ * @default -
33
+ * @description 是否显示(会新增或删除节点)
34
+ */
35
+ ifShow?: TFunction<boolean>;
36
+ /**
37
+ * @default -
38
+ * @description 是否必填
39
+ */
40
+ required?: TFunction<boolean>;
41
+ /**
42
+ * @default -
43
+ * @description 是否禁用(当和 Form 同时设置时,以 Item 为准)
44
+ */
45
+ disabled?: TFunction<boolean>;
46
+ /**
47
+ * @default -
48
+ * @description 组件属性
49
+ */
50
+ componentProps?: TFunction<Recordable<any>>;
51
+ /**
52
+ * @default -
53
+ * @description 校验规则
54
+ */
55
+ rules?: Rule[];
56
+ /**
57
+ * @default -
58
+ * @description 表单项组件的布局方式(当和 Form 同时设置时,以 Item 为准)
59
+ */
60
+ wrapperCol?: ColProps;
61
+ /**
62
+ * @default -
63
+ * @description 表单项label标签布局方式(当和 Form 同时设置时,以 Item 为准)
64
+ */
65
+ labelCol?: ColProps;
66
+ /**
67
+ * @default -
68
+ * @description 表单项的栅格配置(当和 Form 同时设置时,以 Item 为准)
69
+ */
70
+ colProps?: ColProps;
71
+ /**
72
+ * @default -
73
+ * @description 是否强制换一行显示该表单项(强制换行后续会跟随换行表单项)
74
+ */
75
+ forceRow?: boolean;
76
+ /**
77
+ * @default -
78
+ * @description 默认值
79
+ */
80
+ initialValue?: any;
28
81
  }
29
- /** 自定义渲染函数的props */
82
+ /**
83
+ * @description 自定义渲染函数的props
84
+ */
30
85
  export interface IFRenderProps {
86
+ /**
87
+ * @description 当前项name
88
+ */
31
89
  name: string;
90
+ /**
91
+ * @description 当前项状态
92
+ */
32
93
  disabled: boolean;
94
+ /**
95
+ * @description 组件属性
96
+ */
33
97
  componentProps: Recordable<any>;
98
+ /**
99
+ * @description 表单值
100
+ */
34
101
  model: any;
102
+ /**
103
+ * @description 表单方法实例
104
+ */
35
105
  methods: IFormActionType;
36
106
  }
37
- /** render props */
38
107
  /**
39
- * @description: 自定义渲染组件,若根节点为antd组件,就会和form组件进行双向绑定,model也是响应式的;若根节点为非antd组件,就不会和form组件进行双向绑定,需根据实际业务手动处理表单项的值
108
+ * @description render props(自定义渲染函数,若根节点为antd组件,就会和form组件进行双向绑定,model也是响应式的;若根节点为非antd组件,就不会和form组件进行双向绑定,需根据实际业务手动处理表单项的值)
40
109
  */
41
110
  export interface IRenderFormItemProps extends IBaseFormItemProps {
42
- render: (props: IFRenderProps) => React.ReactNode /** 自定义渲染组件 */;
111
+ /**
112
+ * @description 自定义渲染函数
113
+ */
114
+ render: (props: IFRenderProps) => React.ReactNode;
43
115
  }
44
- /** component props */
116
+ /**
117
+ * @description component props
118
+ */
45
119
  export interface IComponentFormItemProps<T extends TXphExtendComponentPropsMap = {}> extends IBaseFormItemProps {
46
- component: keyof TComponentPropsMap<T> /** 映射组件 */;
120
+ /**
121
+ * @description 映射组件
122
+ */
123
+ component: keyof TComponentPropsMap<T>;
47
124
  }
48
125
  type Without<T, K> = {
49
126
  [P in Exclude<keyof T, K>]?: never;
@@ -5,11 +5,11 @@ import { TXphExtendComponentPropsMap } from '../../../../common';
5
5
  declare const CrudFormDialog: (props: TCrudFormDialogProps, ref: ForwardedRef<ICrudFormDialogActionType>) => import("react/jsx-runtime").JSX.Element;
6
6
  declare const ForwardedCrudFormDialog: <T extends TXphExtendComponentPropsMap = {}>(props: Omit<import('../../../../common').IXphDialogProps, "onOk" | "onCancel"> & {
7
7
  formProps: import('../../../../form').IXphFormProps<T>;
8
- onOk?: (({ values, data }: {
8
+ onOk?: ((event: {
9
9
  values: any;
10
10
  data: any;
11
11
  }) => Promise<any>) | undefined;
12
- onCancel?: (({ values, data }: {
12
+ onCancel?: ((event: {
13
13
  values: any;
14
14
  data: any;
15
15
  }) => Promise<any>) | undefined;
@@ -1,17 +1,25 @@
1
1
  import { IXphActionsProps, TXphExtendComponentPropsMap } from '../../../../../../../common';
2
2
  import { IComponentColumnProps, TDataSourceItem } from '../../../../../types';
3
3
 
4
- /** cellFunc中每一项对应的组件componentProps属性映射 */
4
+ /**
5
+ * @description cellFunc中每一项对应的组件componentProps属性映射
6
+ */
5
7
  export type TCellComponentPropsMap<CellFuncExtendPropsMap extends TXphExtendComponentPropsMap = {}, ActionsExtendPropsMap extends TXphExtendComponentPropsMap = {}> = {
6
8
  link: {
7
- /** 超链接,点击超链接跳转 */
9
+ /**
10
+ * @description 超链接,点击超链接跳转
11
+ */
8
12
  url?: string;
9
- /** 点击事件(优先级最高) */
13
+ /**
14
+ * @description 点击事件(优先级最高)
15
+ */
10
16
  onClick?: () => void;
11
17
  };
12
18
  actions: IXphActionsProps<ActionsExtendPropsMap>;
13
19
  tag: {
14
- /** 标签的枚举 */
20
+ /**
21
+ * @description 标签的枚举
22
+ */
15
23
  enums: Array<{
16
24
  label: string;
17
25
  value: any;
@@ -25,7 +33,9 @@ type Without<T, K> = {
25
33
  [P in Exclude<keyof T, K>]?: never;
26
34
  };
27
35
  type XOR<T extends any[]> = T extends [infer A, infer B, ...infer Rest] ? A | B extends object ? (Without<A, keyof B> & B) | (Without<B, keyof A> & A) | XOR<[A | B, ...Rest]> : A | B : T extends [infer A] ? A : never;
28
- /** cellFunc中每一项的配置 */
36
+ /**
37
+ * @description cellFunc中每一项的配置
38
+ */
29
39
  interface ICellProps<T extends keyof TCellComponentPropsMap<J, K>, J extends TXphExtendComponentPropsMap = {}, K extends TXphExtendComponentPropsMap = {}> {
30
40
  component: T;
31
41
  componentProps?: TCellComponentPropsMap<J, K>[T];
@@ -34,14 +44,10 @@ type TCellFuncPropsMap<J extends TXphExtendComponentPropsMap = {}, K extends TXp
34
44
  [T in keyof TCellComponentPropsMap<J, K>]: ICellProps<T, J, K>;
35
45
  }[keyof TCellComponentPropsMap<J, K>];
36
46
  export type TCellProps<J extends TXphExtendComponentPropsMap = {}, K extends TXphExtendComponentPropsMap = {}> = XOR<[TCellFuncPropsMap<J, K>]>;
37
- /** CellFunc组件的props */
38
- export interface ICellFuncProps<
39
- /** 行数据类型 */
40
- T = TDataSourceItem,
41
- /** 单元格的扩展组件props映射 */
42
- J extends TXphExtendComponentPropsMap = {},
43
- /** 操作组的扩展组件props映射 */
44
- K extends TXphExtendComponentPropsMap = {}> {
47
+ /**
48
+ * @description CellFunc组件的props
49
+ */
50
+ export interface ICellFuncProps<T = TDataSourceItem, J extends TXphExtendComponentPropsMap = {}, K extends TXphExtendComponentPropsMap = {}> {
45
51
  dslConfig: TCellProps<J, K>[];
46
52
  renderPrams: {
47
53
  text: any;
@@ -50,15 +56,15 @@ K extends TXphExtendComponentPropsMap = {}> {
50
56
  column: Omit<IComponentColumnProps<T, K, K>, "cellFunc">;
51
57
  };
52
58
  }
53
- /** cellFunc中每一项对应的组件的props */
59
+ /**
60
+ * @description cellFunc中每一项对应的组件的props
61
+ */
54
62
  export interface ICurCellFuncProps<J extends TXphExtendComponentPropsMap = {}, K extends TXphExtendComponentPropsMap = {}, T extends keyof TCellComponentPropsMap<J, K> = keyof TCellComponentPropsMap<J, K>> {
55
63
  curComponentProps?: TCellComponentPropsMap<J, K>[T];
56
64
  cellFuncProps: ICellFuncProps<TDataSourceItem, J, K>;
57
65
  }
58
66
  /**
59
- *
60
- * 因为渲染是从cellFuncs中的最后一项开始的,所以mainClick是排在后面的组件传递到前面的
61
- *
67
+ * @description 因为渲染是从cellFuncs中的最后一项开始的,所以mainClick是排在后面的组件传递到前面的
62
68
  * 目的:目的是为了将自定义组件的点击事件交给最底层的组件进行调用
63
69
  * 注意:因为多个自定义组件可能都有mainClick,所以也需要保证其他组件的正常调用(即:传递给子组件Comp的时候,需要把父组件传递过来的mainClick给手动执行一下)
64
70
  */
@@ -9,47 +9,98 @@ export interface IFunctionToolbarParams<T = TDataSourceItem> {
9
9
  loading: boolean;
10
10
  selection: T[];
11
11
  }
12
- /** 扩展antd table的属性 */
12
+ /**
13
+ * @description 扩展antd table的属性
14
+ */
13
15
  export type TApiTableProps<T = TDataSourceItem, J extends TXphExtendComponentPropsMap = {}, K extends TXphExtendComponentPropsMap = {}, L extends TXphExtendComponentPropsMap = {}> = {
14
- /** 列配置项 */
16
+ /**
17
+ * @default []
18
+ * @description 列配置项
19
+ */
15
20
  columns?: TColumnProps<T, J, K>[];
16
- /** 首次是否自动请求 */
21
+ /**
22
+ * @default true
23
+ * @description 首次是否自动请求
24
+ */
17
25
  autoRequest?: boolean;
18
- /** 获取datasource的api */
26
+ /**
27
+ * @default -
28
+ * @description 获取datasource的api
29
+ */
19
30
  api?: (params: any) => Promise<any>;
20
- /** 格式化返回的datasource */
31
+ /**
32
+ * @default -
33
+ * @description 格式化返回的datasource
34
+ */
21
35
  formatDataSource?: (data: any) => any[];
22
- /** 是否开启前端自动分页(当api不支持分页时可用) */
36
+ /**
37
+ * @default -
38
+ * @description 是否开启前端自动分页(当api不支持分页时可用)
39
+ */
23
40
  autoPagination?: boolean;
24
- /** 单选 / 多选 */
41
+ /**
42
+ * @default -
43
+ * @description 单选 / 多选
44
+ */
25
45
  rowSelection?: RowSelectionType | TableRowSelection<T>;
26
- /** 分页配置(因为分页器是独立出来的,使用table的分页器布局需要修改样式) */
46
+ /**
47
+ * @default { pageSize: 20, total: 0, showTotal: (total) => `共:${total} 条`, current: 1, pageSizeOptions: [10, 20, 50, 100], showSizeChanger: true, showQuickJumper: true, }
48
+ * @description 分页配置(因为分页器是独立出来的,使用table的分页器布局需要修改样式)
49
+ */
27
50
  pagination?: false | PaginationProps;
28
- /** 表格撑满父容器(virtual为true时,默认fullHeight为true) */
51
+ /**
52
+ * @default false
53
+ * @description 表格撑满父容器(virtual为true时,默认fullHeight为true)
54
+ */
29
55
  fullHeight?: boolean;
30
- /** 顶部操作栏配置,函数时可以传递参数,参数是什么由调用方决定 */
56
+ /**
57
+ * @default -
58
+ * @description 顶部操作栏配置,函数时可以传递参数,参数是什么由调用方决定
59
+ */
31
60
  toolbar?: IXphActionsProps<L> | ((e: IFunctionToolbarParams<T>) => IXphActionsProps<L>);
32
- /** 分页请求参数中传递到接口的属性名 */
61
+ /**
62
+ * @default { pageSize: "pageSize", current: "current", }
63
+ * @description 分页请求参数中传递到接口的属性名
64
+ */
33
65
  requestFields?: {
34
- /** 当前页 */
66
+ /**
67
+ * @default "current"
68
+ * @description 当前页
69
+ */
35
70
  current?: string;
36
- /** 当前页大小 */
71
+ /**
72
+ * @default "pageSize"
73
+ * @description 当前页大小
74
+ */
37
75
  pageSize?: string;
38
76
  };
39
- /** 响应结果中获取数据的属性名 */
77
+ /**
78
+ * @default { current: "current", list: "data", total: "total", }
79
+ * @description 响应结果中获取数据的属性名
80
+ */
40
81
  responseFields?: {
41
- /** 当前页 */
82
+ /**
83
+ * @default "current"
84
+ * @description 当前页
85
+ */
42
86
  current?: string;
43
- /** 列表 */
87
+ /**
88
+ * @default "data"
89
+ * @description 列表
90
+ */
44
91
  list?: string;
45
- /** 所有页总数 */
92
+ /**
93
+ * @default "total"
94
+ * @description 所有页总数
95
+ */
46
96
  total?: string;
47
97
  };
48
- /** 排序、筛选变化时触发 */
98
+ /**
99
+ * @default -
100
+ * @description 排序、筛选变化时触发
101
+ */
49
102
  onChange?: (filters: any, sorter: any, extra: any) => void;
50
- } & Omit<TableProps<T>,
51
- /** 内部控制的属性/重写的属性 */
52
- "rowSelection" | "columns" | "loading" | "dataSource" | "pagination">;
103
+ } & Omit<TableProps<T>, "rowSelection" | "columns" | "loading" | "dataSource" | "pagination">;
53
104
  export type TApiTableActionType = {
54
105
  resetAllData: () => Promise<void>;
55
106
  resetData: () => Promise<void>;
@@ -3,10 +3,14 @@ import { TDataSourceItem } from './table';
3
3
  import { TCellProps } from '../components/table/components/cellFunc/types';
4
4
  import { TXphExtendComponentPropsMap } from '../../../common';
5
5
 
6
- /** 扩展一下antd column的属性,不一定要扩展,只是预留 */
6
+ /**
7
+ * @description 扩展一下antd column的属性,不一定要扩展,只是预留
8
+ */
7
9
  type TBaseColumnType<T> = {} & ColumnType<T>;
8
10
  export interface IComponentColumnProps<T, J extends TXphExtendComponentPropsMap = {}, K extends TXphExtendComponentPropsMap = {}> extends Omit<TBaseColumnType<T>, "render"> {
9
- /** 单元格渲染属性(原理也是使用render渲染不同的内容) */
11
+ /**
12
+ * @description 单元格渲染属性(原理也是使用render渲染不同的内容)
13
+ */
10
14
  cellFunc: ((props: {
11
15
  text: any;
12
16
  record: T;
@@ -3,27 +3,30 @@ import { TXphExtendComponentPropsMap, IXphDialogProps, IXphDialogActionType } fr
3
3
 
4
4
  export type TCrudFormDialogProps<T extends TXphExtendComponentPropsMap = {}> = Omit<IXphDialogProps, "onOk" | "onCancel"> & {
5
5
  formProps: IXphFormProps<T>;
6
- onOk?: ({ values, data }: {
6
+ onOk?: (event: {
7
7
  values: any;
8
8
  data: any;
9
9
  }) => Promise<any>;
10
- onCancel?: ({ values, data }: {
10
+ onCancel?: (event: {
11
11
  values: any;
12
12
  data: any;
13
13
  }) => Promise<any>;
14
14
  };
15
15
  export interface IOpenActionConfig {
16
- /** 回填表单的内容 */
16
+ /**
17
+ * @description 回填表单的内容
18
+ */
17
19
  data: any;
18
20
  /**
19
21
  * @description 点击确定的回调(如果弹窗传递了onOk属性就不用传这个了,这个是为了方便所有操作都在open函数中处理)
20
- * @param values 表单项的值(如果弹窗传递了onCancel属性就不用传这个了,这个是为了方便所有操作都在close函数中处理)
21
22
  */
22
- ok?: ({ values }: {
23
+ ok?: (event: {
23
24
  values: any;
24
25
  }) => Promise<any>;
25
- /** 点击取消的回调 */
26
- cancel?: ({ values }: {
26
+ /**
27
+ * @description 点击取消的回调(如果弹窗传递了onCancel属性就不用传这个了,这个是为了方便所有操作都在open函数中处理)
28
+ */
29
+ cancel?: (event: {
27
30
  values: any;
28
31
  }) => Promise<any>;
29
32
  }
@@ -5,6 +5,8 @@ export type TSearchFormActionType = IXphFormActionType & {
5
5
  setFormLoading: (loading: boolean) => void;
6
6
  };
7
7
  export type TSearchFormProps<T extends TXphExtendComponentPropsMap = {}> = IXphFormProps<T> & {
8
- /** 是否显示搜索 & 重置按钮 */
8
+ /**
9
+ * @description 是否显示搜索 & 重置按钮
10
+ */
9
11
  showSearch?: boolean;
10
12
  };