@para-ui/core 5.0.0-beta.8 → 5.0.0-beta.9
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/README.md +0 -5
- package/es/DynamicMultiBox/index.d.ts +2 -2
- package/es/DynamicMultiBox/interface.d.ts +76 -76
- package/es/_virtual/index3.js +2 -2
- package/es/_virtual/index4.js +2 -2
- package/es/node_modules/@para-snack/core/dist/index.js +1 -1
- package/es/node_modules/classnames/index.js +1 -1
- package/lib/DynamicMultiBox/index.d.ts +2 -2
- package/lib/DynamicMultiBox/interface.d.ts +76 -76
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { default as React } from 'react';
|
|
2
2
|
import { IMultiValueProps } from './interface';
|
|
3
|
-
declare const DynamicMultiBox:
|
|
3
|
+
declare const DynamicMultiBox: <T extends Record<string, unknown> = Record<string, unknown>>(props: IMultiValueProps<T>) => React.ReactElement | null;
|
|
4
4
|
export default DynamicMultiBox;
|
|
5
5
|
export type * from './interface';
|
|
@@ -1,38 +1,48 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import { ReactNode, CSSProperties } from 'react';
|
|
2
2
|
import { TextFieldProps, SelectProps, SwitchProps, InputNumberProps, InputLangProps, ComboSelectProps, DatePickerProps } from '../index';
|
|
3
3
|
import { LabelProps } from '../Label';
|
|
4
4
|
import { TooltipProps } from '../Tooltip';
|
|
5
5
|
/**组件类型:输入框,下拉框,开关,数字输入框,国际化输入框,日期框,时间选择框,组合选择器,自定义组件*/
|
|
6
6
|
export type IInputType = 'TextField' | 'Select' | 'Switch' | 'InputNumber' | 'InputLang' | 'ComboSelect' | 'DatePicker' | 'custom';
|
|
7
|
-
/**
|
|
8
|
-
export type
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
/** value集合 —— 单行 value 值集合,name 映射 configItem 中的 name */
|
|
8
|
+
export type IValueList<T extends Record<string, unknown> = Record<string, unknown>> = T;
|
|
9
|
+
/** error集合 —— 单行错误集合,name 映射 configItem 中的 name;按 keyof T 精确收窄,rowKey 字段通过 cast 访问 */
|
|
10
|
+
export type IErrors<T extends Record<string, unknown> = Record<string, unknown>> = {
|
|
11
|
+
[K in keyof T]?: unknown;
|
|
12
|
+
};
|
|
13
|
+
/** 配置项 */
|
|
14
|
+
export type IConfig<T extends Record<string, unknown> = Record<string, unknown>> = {
|
|
15
|
+
/** 字段名,用于匹配 valueList 中的 key */
|
|
16
|
+
name?: keyof T & string;
|
|
17
|
+
/** 组件类型 */
|
|
12
18
|
inputType?: IInputType;
|
|
13
|
-
/**
|
|
14
|
-
customRender?: (name: string, rowIndex: number, valueList: IValueList[], errors?: IErrors[]) => ReactNode;
|
|
15
|
-
/**
|
|
16
|
-
isDisabled?: boolean | ((rowIndex: number, name: string, valueList: IValueList[]) => boolean);
|
|
17
|
-
/** 固定字段,不需要显示在筛选器中的需要设置为true
|
|
19
|
+
/** 渲染自定义组件 */
|
|
20
|
+
customRender?: (name: keyof T & string, rowIndex: number, valueList: IValueList<T>[], errors?: IErrors<T>[]) => ReactNode;
|
|
21
|
+
/** 禁用置灰组件 */
|
|
22
|
+
isDisabled?: boolean | ((rowIndex: number, name: keyof T & string, valueList: IValueList<T>[]) => boolean);
|
|
23
|
+
/** 固定字段,不需要显示在筛选器中的需要设置为 true,若不设置无法显示表单 */
|
|
18
24
|
isFixed?: boolean;
|
|
19
|
-
/** 用于switch*/
|
|
20
|
-
text?: ReactNode | ((rowIndex: number, name: string, valueList: IValueList[]) => ReactNode);
|
|
21
|
-
/**
|
|
25
|
+
/** 用于 switch */
|
|
26
|
+
text?: ReactNode | ((rowIndex: number, name: keyof T & string, valueList: IValueList<T>[]) => ReactNode);
|
|
27
|
+
/** 是否必填 */
|
|
22
28
|
required?: boolean;
|
|
23
|
-
/**
|
|
24
|
-
list?: ((rowIndex: number, id: string, name: string, valueList: IValueList[]) => unknown[]) | unknown[];
|
|
29
|
+
/** 下拉列表数据,若某一列的每一行的下拉列表数据一致,则只需传入数组;若需要自定义任意下拉列表数据,则传入函数 */
|
|
30
|
+
list?: ((rowIndex: number, id: string, name: keyof T & string, valueList: IValueList<T>[]) => unknown[]) | unknown[];
|
|
25
31
|
/** 样式 */
|
|
26
|
-
style?:
|
|
32
|
+
style?: CSSProperties;
|
|
27
33
|
/** 标题样式 */
|
|
28
34
|
labelProps?: LabelProps;
|
|
29
|
-
/**
|
|
30
|
-
otherProps?: (rowIndex: number, name: string, valueList: IValueList[]) => Record<string, unknown>;
|
|
31
|
-
/**
|
|
35
|
+
/** 组件其他样式,返回每个组件的样式 */
|
|
36
|
+
otherProps?: (rowIndex: number, name: keyof T & string, valueList: IValueList<T>[]) => Record<string, unknown>;
|
|
37
|
+
/**
|
|
38
|
+
* 其他字段
|
|
39
|
+
* 索引签名保留:IConfig 与 (TextFieldProps | SelectProps | ...) 多态子组件 props 交叉,
|
|
40
|
+
* 业务方需要透传不同子组件的 props(如 placeholder、suffix 等),与 Tabs/Table/Button 移除索引签名的情境不同
|
|
41
|
+
*/
|
|
32
42
|
[name: string]: unknown;
|
|
33
43
|
} & (TextFieldProps | SelectProps | SwitchProps | InputNumberProps | InputLangProps | ComboSelectProps | DatePickerProps);
|
|
34
44
|
/** 操作按钮配置项 */
|
|
35
|
-
export interface IOperationButton {
|
|
45
|
+
export interface IOperationButton<T extends Record<string, unknown> = Record<string, unknown>> {
|
|
36
46
|
/** 按钮标识 */
|
|
37
47
|
key: string;
|
|
38
48
|
/** 按钮图标 */
|
|
@@ -40,11 +50,11 @@ export interface IOperationButton {
|
|
|
40
50
|
/** 按钮文本 */
|
|
41
51
|
text?: string;
|
|
42
52
|
/** 是否禁用 */
|
|
43
|
-
disabled?: boolean | ((rowIndex: number, item: IValueList
|
|
53
|
+
disabled?: boolean | ((rowIndex: number, item: IValueList<T>, valueList: IValueList<T>[]) => boolean);
|
|
44
54
|
/** 点击事件 */
|
|
45
|
-
onClick: (rowIndex: number, item: IValueList
|
|
55
|
+
onClick: (rowIndex: number, item: IValueList<T>, valueList: IValueList<T>[]) => void;
|
|
46
56
|
/** 自定义渲染 */
|
|
47
|
-
render?: (rowIndex: number, item: IValueList
|
|
57
|
+
render?: (rowIndex: number, item: IValueList<T>, valueList: IValueList<T>[]) => ReactNode;
|
|
48
58
|
/** 样式 */
|
|
49
59
|
className?: string;
|
|
50
60
|
/** 提示 */
|
|
@@ -57,96 +67,86 @@ export interface IOperationButton {
|
|
|
57
67
|
*/
|
|
58
68
|
order?: number;
|
|
59
69
|
}
|
|
60
|
-
/**
|
|
61
|
-
export interface
|
|
62
|
-
/**
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
[name: string]: unknown;
|
|
68
|
-
}
|
|
69
|
-
export interface ICurrentItem {
|
|
70
|
-
/** 表单名*/
|
|
71
|
-
name?: string;
|
|
72
|
-
/** 表单值*/
|
|
73
|
-
value?: unknown;
|
|
74
|
-
/** 表单所处下标*/
|
|
70
|
+
/** 当前操作表单项;显式声明字段,禁止挂未声明字段 */
|
|
71
|
+
export interface ICurrentItem<T extends Record<string, unknown> = Record<string, unknown>> {
|
|
72
|
+
/** 表单名 */
|
|
73
|
+
name?: keyof T & string;
|
|
74
|
+
/** 表单值 */
|
|
75
|
+
value?: T[keyof T];
|
|
76
|
+
/** 表单所处下标 */
|
|
75
77
|
rowIndex?: number;
|
|
76
|
-
|
|
78
|
+
/** 表单所处行的 rowKey 值(默认 rowKey 为 'id') */
|
|
79
|
+
id?: string;
|
|
77
80
|
}
|
|
78
|
-
/**
|
|
79
|
-
export interface IFilterParams {
|
|
80
|
-
/**
|
|
81
|
+
/** 过滤回调出参 */
|
|
82
|
+
export interface IFilterParams<T extends Record<string, unknown> = Record<string, unknown>> {
|
|
83
|
+
/** 当前过滤操作项 */
|
|
81
84
|
name?: string;
|
|
82
|
-
/**
|
|
85
|
+
/** 是否选中 */
|
|
83
86
|
checkedVal?: string[];
|
|
84
|
-
/** 更新后的valueList*/
|
|
85
|
-
valueList?: IValueList[];
|
|
86
|
-
/**
|
|
87
|
-
errors?: IErrors[];
|
|
87
|
+
/** 更新后的 valueList */
|
|
88
|
+
valueList?: IValueList<T>[];
|
|
89
|
+
/** 更新后的错误信息 */
|
|
90
|
+
errors?: IErrors<T>[];
|
|
88
91
|
}
|
|
89
|
-
/**
|
|
90
|
-
export interface IMultiValueProps {
|
|
91
|
-
/** 指定每行key */
|
|
92
|
+
/** 主体接口定义 */
|
|
93
|
+
export interface IMultiValueProps<T extends Record<string, unknown> = Record<string, unknown>> {
|
|
94
|
+
/** 指定每行 key */
|
|
92
95
|
rowKey?: string;
|
|
93
96
|
/**
|
|
94
97
|
* 组件配置项
|
|
95
98
|
*/
|
|
96
|
-
config?: IConfig[];
|
|
99
|
+
config?: IConfig<T>[];
|
|
97
100
|
/**
|
|
98
101
|
* 筛选配置
|
|
99
102
|
*/
|
|
100
|
-
filterConfig?: IConfig[];
|
|
103
|
+
filterConfig?: IConfig<T>[];
|
|
101
104
|
/**
|
|
102
105
|
* @desc 回调
|
|
103
|
-
* @param valueList 整个value值集合
|
|
106
|
+
* @param valueList 整个 value 值集合
|
|
104
107
|
* @param currentItem 当前操作表单项
|
|
105
108
|
* */
|
|
106
|
-
onChange?: (valueList: IValueList[], currentItem?: ICurrentItem) => void;
|
|
109
|
+
onChange?: (valueList: IValueList<T>[], currentItem?: ICurrentItem<T>) => void;
|
|
107
110
|
/**
|
|
108
111
|
* @desc 新增
|
|
109
|
-
* @param valueList 新增前valueList值集合
|
|
112
|
+
* @param valueList 新增前 valueList 值集合
|
|
110
113
|
* @param errors 新增后错误集合
|
|
111
114
|
* */
|
|
112
|
-
onAdd?: (valueList: IValueList[], errors: IErrors[]) => void;
|
|
115
|
+
onAdd?: (valueList: IValueList<T>[], errors: IErrors<T>[]) => void;
|
|
113
116
|
/**
|
|
114
117
|
* 自定义删除
|
|
115
118
|
* */
|
|
116
|
-
deleteRender?: (index: number, item: IValueList
|
|
119
|
+
deleteRender?: (index: number, item: IValueList<T>, valueList: IValueList<T>[]) => ReactNode;
|
|
117
120
|
/**
|
|
118
|
-
* @desc
|
|
119
|
-
* @param valueList 删除后整个valueList值集合
|
|
120
|
-
* @param
|
|
121
|
+
* @desc 删除
|
|
122
|
+
* @param valueList 删除后整个 valueList 值集合
|
|
123
|
+
* @param errors 删除后错误集合
|
|
121
124
|
*/
|
|
122
|
-
onDelete?: (valueList: IValueList[], errors: IErrors[]) => void;
|
|
125
|
+
onDelete?: (valueList: IValueList<T>[], errors: IErrors<T>[]) => void;
|
|
123
126
|
/**
|
|
124
127
|
* @desc 筛选函数
|
|
125
|
-
* @param name 当前筛选项的name
|
|
126
|
-
* @param checked 是否选中, true选中, false反选
|
|
127
|
-
* @param valueList 筛选后的value
|
|
128
128
|
* */
|
|
129
|
-
onFilter?: (data: IFilterParams) => void;
|
|
129
|
+
onFilter?: (data: IFilterParams<T>) => void;
|
|
130
130
|
/**
|
|
131
131
|
* @desc 排序
|
|
132
132
|
* @param newValueList
|
|
133
133
|
* @param swapIds 交换顺序的两个下标
|
|
134
134
|
* */
|
|
135
|
-
onSort?: (newValueList: IValueList[], swapIds?: number[]) => void;
|
|
135
|
+
onSort?: (newValueList: IValueList<T>[], swapIds?: number[]) => void;
|
|
136
136
|
/**
|
|
137
137
|
* @desc 筛选值的集合
|
|
138
138
|
* */
|
|
139
139
|
checkedValue?: string[];
|
|
140
140
|
/**
|
|
141
|
-
* 表单value集合
|
|
141
|
+
* 表单 value 集合
|
|
142
142
|
*/
|
|
143
|
-
valueList?: IValueList[];
|
|
143
|
+
valueList?: IValueList<T>[];
|
|
144
144
|
/**
|
|
145
145
|
* 表单错误集合
|
|
146
146
|
*/
|
|
147
|
-
errors?: IErrors[];
|
|
147
|
+
errors?: IErrors<T>[];
|
|
148
148
|
/**
|
|
149
|
-
*
|
|
149
|
+
* 是否需要支持排序,默认不支持
|
|
150
150
|
*/
|
|
151
151
|
isSort?: boolean;
|
|
152
152
|
/**
|
|
@@ -154,7 +154,7 @@ export interface IMultiValueProps {
|
|
|
154
154
|
*/
|
|
155
155
|
isFilter?: boolean;
|
|
156
156
|
/**
|
|
157
|
-
* 标题模式 none 不显示,
|
|
157
|
+
* 标题模式 none 不显示,single 只有第一列才显示,all 每列都显示
|
|
158
158
|
*/
|
|
159
159
|
titleMode?: 'none' | 'single' | 'all';
|
|
160
160
|
/**
|
|
@@ -166,11 +166,11 @@ export interface IMultiValueProps {
|
|
|
166
166
|
*/
|
|
167
167
|
disabledAddTooltip?: TooltipProps;
|
|
168
168
|
/**
|
|
169
|
-
* 列之间icon
|
|
169
|
+
* 列之间 icon
|
|
170
170
|
* */
|
|
171
171
|
icon?: ReactNode;
|
|
172
172
|
/**
|
|
173
|
-
* 隐藏删除icon
|
|
173
|
+
* 隐藏删除 icon,string[] 指定某些行隐藏删除按钮,入参为 valueList 中的 id 集合
|
|
174
174
|
* */
|
|
175
175
|
deleteDisable?: string[];
|
|
176
176
|
/**
|
|
@@ -187,7 +187,7 @@ export interface IMultiValueProps {
|
|
|
187
187
|
/**
|
|
188
188
|
* 新增项行表单的默认值
|
|
189
189
|
*/
|
|
190
|
-
initValue?:
|
|
190
|
+
initValue?: Partial<T>;
|
|
191
191
|
/**
|
|
192
192
|
* 筛选器弹出框样式
|
|
193
193
|
*/
|
|
@@ -199,5 +199,5 @@ export interface IMultiValueProps {
|
|
|
199
199
|
/**
|
|
200
200
|
* 自定义操作按钮,支持每行配置多个操作按钮
|
|
201
201
|
*/
|
|
202
|
-
operationButtons?: IOperationButton[];
|
|
202
|
+
operationButtons?: IOperationButton<T>[];
|
|
203
203
|
}
|
package/es/_virtual/index3.js
CHANGED
package/es/_virtual/index4.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { default as React } from 'react';
|
|
2
2
|
import { IMultiValueProps } from './interface';
|
|
3
|
-
declare const DynamicMultiBox:
|
|
3
|
+
declare const DynamicMultiBox: <T extends Record<string, unknown> = Record<string, unknown>>(props: IMultiValueProps<T>) => React.ReactElement | null;
|
|
4
4
|
export default DynamicMultiBox;
|
|
5
5
|
export type * from './interface';
|
|
@@ -1,38 +1,48 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import { ReactNode, CSSProperties } from 'react';
|
|
2
2
|
import { TextFieldProps, SelectProps, SwitchProps, InputNumberProps, InputLangProps, ComboSelectProps, DatePickerProps } from '../index';
|
|
3
3
|
import { LabelProps } from '../Label';
|
|
4
4
|
import { TooltipProps } from '../Tooltip';
|
|
5
5
|
/**组件类型:输入框,下拉框,开关,数字输入框,国际化输入框,日期框,时间选择框,组合选择器,自定义组件*/
|
|
6
6
|
export type IInputType = 'TextField' | 'Select' | 'Switch' | 'InputNumber' | 'InputLang' | 'ComboSelect' | 'DatePicker' | 'custom';
|
|
7
|
-
/**
|
|
8
|
-
export type
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
/** value集合 —— 单行 value 值集合,name 映射 configItem 中的 name */
|
|
8
|
+
export type IValueList<T extends Record<string, unknown> = Record<string, unknown>> = T;
|
|
9
|
+
/** error集合 —— 单行错误集合,name 映射 configItem 中的 name;按 keyof T 精确收窄,rowKey 字段通过 cast 访问 */
|
|
10
|
+
export type IErrors<T extends Record<string, unknown> = Record<string, unknown>> = {
|
|
11
|
+
[K in keyof T]?: unknown;
|
|
12
|
+
};
|
|
13
|
+
/** 配置项 */
|
|
14
|
+
export type IConfig<T extends Record<string, unknown> = Record<string, unknown>> = {
|
|
15
|
+
/** 字段名,用于匹配 valueList 中的 key */
|
|
16
|
+
name?: keyof T & string;
|
|
17
|
+
/** 组件类型 */
|
|
12
18
|
inputType?: IInputType;
|
|
13
|
-
/**
|
|
14
|
-
customRender?: (name: string, rowIndex: number, valueList: IValueList[], errors?: IErrors[]) => ReactNode;
|
|
15
|
-
/**
|
|
16
|
-
isDisabled?: boolean | ((rowIndex: number, name: string, valueList: IValueList[]) => boolean);
|
|
17
|
-
/** 固定字段,不需要显示在筛选器中的需要设置为true
|
|
19
|
+
/** 渲染自定义组件 */
|
|
20
|
+
customRender?: (name: keyof T & string, rowIndex: number, valueList: IValueList<T>[], errors?: IErrors<T>[]) => ReactNode;
|
|
21
|
+
/** 禁用置灰组件 */
|
|
22
|
+
isDisabled?: boolean | ((rowIndex: number, name: keyof T & string, valueList: IValueList<T>[]) => boolean);
|
|
23
|
+
/** 固定字段,不需要显示在筛选器中的需要设置为 true,若不设置无法显示表单 */
|
|
18
24
|
isFixed?: boolean;
|
|
19
|
-
/** 用于switch*/
|
|
20
|
-
text?: ReactNode | ((rowIndex: number, name: string, valueList: IValueList[]) => ReactNode);
|
|
21
|
-
/**
|
|
25
|
+
/** 用于 switch */
|
|
26
|
+
text?: ReactNode | ((rowIndex: number, name: keyof T & string, valueList: IValueList<T>[]) => ReactNode);
|
|
27
|
+
/** 是否必填 */
|
|
22
28
|
required?: boolean;
|
|
23
|
-
/**
|
|
24
|
-
list?: ((rowIndex: number, id: string, name: string, valueList: IValueList[]) => unknown[]) | unknown[];
|
|
29
|
+
/** 下拉列表数据,若某一列的每一行的下拉列表数据一致,则只需传入数组;若需要自定义任意下拉列表数据,则传入函数 */
|
|
30
|
+
list?: ((rowIndex: number, id: string, name: keyof T & string, valueList: IValueList<T>[]) => unknown[]) | unknown[];
|
|
25
31
|
/** 样式 */
|
|
26
|
-
style?:
|
|
32
|
+
style?: CSSProperties;
|
|
27
33
|
/** 标题样式 */
|
|
28
34
|
labelProps?: LabelProps;
|
|
29
|
-
/**
|
|
30
|
-
otherProps?: (rowIndex: number, name: string, valueList: IValueList[]) => Record<string, unknown>;
|
|
31
|
-
/**
|
|
35
|
+
/** 组件其他样式,返回每个组件的样式 */
|
|
36
|
+
otherProps?: (rowIndex: number, name: keyof T & string, valueList: IValueList<T>[]) => Record<string, unknown>;
|
|
37
|
+
/**
|
|
38
|
+
* 其他字段
|
|
39
|
+
* 索引签名保留:IConfig 与 (TextFieldProps | SelectProps | ...) 多态子组件 props 交叉,
|
|
40
|
+
* 业务方需要透传不同子组件的 props(如 placeholder、suffix 等),与 Tabs/Table/Button 移除索引签名的情境不同
|
|
41
|
+
*/
|
|
32
42
|
[name: string]: unknown;
|
|
33
43
|
} & (TextFieldProps | SelectProps | SwitchProps | InputNumberProps | InputLangProps | ComboSelectProps | DatePickerProps);
|
|
34
44
|
/** 操作按钮配置项 */
|
|
35
|
-
export interface IOperationButton {
|
|
45
|
+
export interface IOperationButton<T extends Record<string, unknown> = Record<string, unknown>> {
|
|
36
46
|
/** 按钮标识 */
|
|
37
47
|
key: string;
|
|
38
48
|
/** 按钮图标 */
|
|
@@ -40,11 +50,11 @@ export interface IOperationButton {
|
|
|
40
50
|
/** 按钮文本 */
|
|
41
51
|
text?: string;
|
|
42
52
|
/** 是否禁用 */
|
|
43
|
-
disabled?: boolean | ((rowIndex: number, item: IValueList
|
|
53
|
+
disabled?: boolean | ((rowIndex: number, item: IValueList<T>, valueList: IValueList<T>[]) => boolean);
|
|
44
54
|
/** 点击事件 */
|
|
45
|
-
onClick: (rowIndex: number, item: IValueList
|
|
55
|
+
onClick: (rowIndex: number, item: IValueList<T>, valueList: IValueList<T>[]) => void;
|
|
46
56
|
/** 自定义渲染 */
|
|
47
|
-
render?: (rowIndex: number, item: IValueList
|
|
57
|
+
render?: (rowIndex: number, item: IValueList<T>, valueList: IValueList<T>[]) => ReactNode;
|
|
48
58
|
/** 样式 */
|
|
49
59
|
className?: string;
|
|
50
60
|
/** 提示 */
|
|
@@ -57,96 +67,86 @@ export interface IOperationButton {
|
|
|
57
67
|
*/
|
|
58
68
|
order?: number;
|
|
59
69
|
}
|
|
60
|
-
/**
|
|
61
|
-
export interface
|
|
62
|
-
/**
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
[name: string]: unknown;
|
|
68
|
-
}
|
|
69
|
-
export interface ICurrentItem {
|
|
70
|
-
/** 表单名*/
|
|
71
|
-
name?: string;
|
|
72
|
-
/** 表单值*/
|
|
73
|
-
value?: unknown;
|
|
74
|
-
/** 表单所处下标*/
|
|
70
|
+
/** 当前操作表单项;显式声明字段,禁止挂未声明字段 */
|
|
71
|
+
export interface ICurrentItem<T extends Record<string, unknown> = Record<string, unknown>> {
|
|
72
|
+
/** 表单名 */
|
|
73
|
+
name?: keyof T & string;
|
|
74
|
+
/** 表单值 */
|
|
75
|
+
value?: T[keyof T];
|
|
76
|
+
/** 表单所处下标 */
|
|
75
77
|
rowIndex?: number;
|
|
76
|
-
|
|
78
|
+
/** 表单所处行的 rowKey 值(默认 rowKey 为 'id') */
|
|
79
|
+
id?: string;
|
|
77
80
|
}
|
|
78
|
-
/**
|
|
79
|
-
export interface IFilterParams {
|
|
80
|
-
/**
|
|
81
|
+
/** 过滤回调出参 */
|
|
82
|
+
export interface IFilterParams<T extends Record<string, unknown> = Record<string, unknown>> {
|
|
83
|
+
/** 当前过滤操作项 */
|
|
81
84
|
name?: string;
|
|
82
|
-
/**
|
|
85
|
+
/** 是否选中 */
|
|
83
86
|
checkedVal?: string[];
|
|
84
|
-
/** 更新后的valueList*/
|
|
85
|
-
valueList?: IValueList[];
|
|
86
|
-
/**
|
|
87
|
-
errors?: IErrors[];
|
|
87
|
+
/** 更新后的 valueList */
|
|
88
|
+
valueList?: IValueList<T>[];
|
|
89
|
+
/** 更新后的错误信息 */
|
|
90
|
+
errors?: IErrors<T>[];
|
|
88
91
|
}
|
|
89
|
-
/**
|
|
90
|
-
export interface IMultiValueProps {
|
|
91
|
-
/** 指定每行key */
|
|
92
|
+
/** 主体接口定义 */
|
|
93
|
+
export interface IMultiValueProps<T extends Record<string, unknown> = Record<string, unknown>> {
|
|
94
|
+
/** 指定每行 key */
|
|
92
95
|
rowKey?: string;
|
|
93
96
|
/**
|
|
94
97
|
* 组件配置项
|
|
95
98
|
*/
|
|
96
|
-
config?: IConfig[];
|
|
99
|
+
config?: IConfig<T>[];
|
|
97
100
|
/**
|
|
98
101
|
* 筛选配置
|
|
99
102
|
*/
|
|
100
|
-
filterConfig?: IConfig[];
|
|
103
|
+
filterConfig?: IConfig<T>[];
|
|
101
104
|
/**
|
|
102
105
|
* @desc 回调
|
|
103
|
-
* @param valueList 整个value值集合
|
|
106
|
+
* @param valueList 整个 value 值集合
|
|
104
107
|
* @param currentItem 当前操作表单项
|
|
105
108
|
* */
|
|
106
|
-
onChange?: (valueList: IValueList[], currentItem?: ICurrentItem) => void;
|
|
109
|
+
onChange?: (valueList: IValueList<T>[], currentItem?: ICurrentItem<T>) => void;
|
|
107
110
|
/**
|
|
108
111
|
* @desc 新增
|
|
109
|
-
* @param valueList 新增前valueList值集合
|
|
112
|
+
* @param valueList 新增前 valueList 值集合
|
|
110
113
|
* @param errors 新增后错误集合
|
|
111
114
|
* */
|
|
112
|
-
onAdd?: (valueList: IValueList[], errors: IErrors[]) => void;
|
|
115
|
+
onAdd?: (valueList: IValueList<T>[], errors: IErrors<T>[]) => void;
|
|
113
116
|
/**
|
|
114
117
|
* 自定义删除
|
|
115
118
|
* */
|
|
116
|
-
deleteRender?: (index: number, item: IValueList
|
|
119
|
+
deleteRender?: (index: number, item: IValueList<T>, valueList: IValueList<T>[]) => ReactNode;
|
|
117
120
|
/**
|
|
118
|
-
* @desc
|
|
119
|
-
* @param valueList 删除后整个valueList值集合
|
|
120
|
-
* @param
|
|
121
|
+
* @desc 删除
|
|
122
|
+
* @param valueList 删除后整个 valueList 值集合
|
|
123
|
+
* @param errors 删除后错误集合
|
|
121
124
|
*/
|
|
122
|
-
onDelete?: (valueList: IValueList[], errors: IErrors[]) => void;
|
|
125
|
+
onDelete?: (valueList: IValueList<T>[], errors: IErrors<T>[]) => void;
|
|
123
126
|
/**
|
|
124
127
|
* @desc 筛选函数
|
|
125
|
-
* @param name 当前筛选项的name
|
|
126
|
-
* @param checked 是否选中, true选中, false反选
|
|
127
|
-
* @param valueList 筛选后的value
|
|
128
128
|
* */
|
|
129
|
-
onFilter?: (data: IFilterParams) => void;
|
|
129
|
+
onFilter?: (data: IFilterParams<T>) => void;
|
|
130
130
|
/**
|
|
131
131
|
* @desc 排序
|
|
132
132
|
* @param newValueList
|
|
133
133
|
* @param swapIds 交换顺序的两个下标
|
|
134
134
|
* */
|
|
135
|
-
onSort?: (newValueList: IValueList[], swapIds?: number[]) => void;
|
|
135
|
+
onSort?: (newValueList: IValueList<T>[], swapIds?: number[]) => void;
|
|
136
136
|
/**
|
|
137
137
|
* @desc 筛选值的集合
|
|
138
138
|
* */
|
|
139
139
|
checkedValue?: string[];
|
|
140
140
|
/**
|
|
141
|
-
* 表单value集合
|
|
141
|
+
* 表单 value 集合
|
|
142
142
|
*/
|
|
143
|
-
valueList?: IValueList[];
|
|
143
|
+
valueList?: IValueList<T>[];
|
|
144
144
|
/**
|
|
145
145
|
* 表单错误集合
|
|
146
146
|
*/
|
|
147
|
-
errors?: IErrors[];
|
|
147
|
+
errors?: IErrors<T>[];
|
|
148
148
|
/**
|
|
149
|
-
*
|
|
149
|
+
* 是否需要支持排序,默认不支持
|
|
150
150
|
*/
|
|
151
151
|
isSort?: boolean;
|
|
152
152
|
/**
|
|
@@ -154,7 +154,7 @@ export interface IMultiValueProps {
|
|
|
154
154
|
*/
|
|
155
155
|
isFilter?: boolean;
|
|
156
156
|
/**
|
|
157
|
-
* 标题模式 none 不显示,
|
|
157
|
+
* 标题模式 none 不显示,single 只有第一列才显示,all 每列都显示
|
|
158
158
|
*/
|
|
159
159
|
titleMode?: 'none' | 'single' | 'all';
|
|
160
160
|
/**
|
|
@@ -166,11 +166,11 @@ export interface IMultiValueProps {
|
|
|
166
166
|
*/
|
|
167
167
|
disabledAddTooltip?: TooltipProps;
|
|
168
168
|
/**
|
|
169
|
-
* 列之间icon
|
|
169
|
+
* 列之间 icon
|
|
170
170
|
* */
|
|
171
171
|
icon?: ReactNode;
|
|
172
172
|
/**
|
|
173
|
-
* 隐藏删除icon
|
|
173
|
+
* 隐藏删除 icon,string[] 指定某些行隐藏删除按钮,入参为 valueList 中的 id 集合
|
|
174
174
|
* */
|
|
175
175
|
deleteDisable?: string[];
|
|
176
176
|
/**
|
|
@@ -187,7 +187,7 @@ export interface IMultiValueProps {
|
|
|
187
187
|
/**
|
|
188
188
|
* 新增项行表单的默认值
|
|
189
189
|
*/
|
|
190
|
-
initValue?:
|
|
190
|
+
initValue?: Partial<T>;
|
|
191
191
|
/**
|
|
192
192
|
* 筛选器弹出框样式
|
|
193
193
|
*/
|
|
@@ -199,5 +199,5 @@ export interface IMultiValueProps {
|
|
|
199
199
|
/**
|
|
200
200
|
* 自定义操作按钮,支持每行配置多个操作按钮
|
|
201
201
|
*/
|
|
202
|
-
operationButtons?: IOperationButton[];
|
|
202
|
+
operationButtons?: IOperationButton<T>[];
|
|
203
203
|
}
|