@flatbiz/antd 2.3.16 → 2.3.19
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/esm/index.css +171 -18
- package/esm/index.js +1 -6
- package/esm/index.js.map +1 -1
- package/index.d.ts +484 -106
- package/package.json +6 -5
package/index.d.ts
CHANGED
|
@@ -2,12 +2,15 @@
|
|
|
2
2
|
/// <reference types="scheduler" />
|
|
3
3
|
|
|
4
4
|
import { API, ModelType } from '@dimjs/model';
|
|
5
|
-
import { ButtonProps, DrawerProps, ModalProps, SelectProps, SpaceProps, TreeProps, TreeSelectProps, UploadProps } from 'antd';
|
|
5
|
+
import { ButtonProps, DrawerProps, FormItemProps, InputNumberProps, InputProps, ModalProps, RadioGroupProps, SelectProps, SpaceProps, TableProps, TreeProps, TreeSelectProps, UploadProps } from 'antd';
|
|
6
|
+
import { CheckboxGroupProps } from 'antd/lib/checkbox';
|
|
6
7
|
import { PickerDateProps, RangePickerDateProps } from 'antd/lib/date-picker/generatePicker';
|
|
8
|
+
import { FormListFieldData, FormListOperation, FormListProps } from 'antd/lib/form/FormList';
|
|
9
|
+
import { TextAreaProps } from 'antd/lib/input';
|
|
10
|
+
import { ColumnsType } from 'antd/lib/table';
|
|
7
11
|
import { UploadChangeParam } from 'antd/lib/upload';
|
|
8
12
|
import { UploadFile } from 'antd/lib/upload/interface';
|
|
9
|
-
import
|
|
10
|
-
import { CSSProperties, DependencyList, EffectCallback, FC, ReactElement, VFC } from 'react';
|
|
13
|
+
import { CSSProperties, DependencyList, EffectCallback, FC, ReactElement, ReactNode, VFC } from 'react';
|
|
11
14
|
|
|
12
15
|
export declare const styles: () => void;
|
|
13
16
|
export interface ButtonOperateItem extends ButtonProps {
|
|
@@ -25,7 +28,7 @@ export interface ButtonOperateProps {
|
|
|
25
28
|
size?: SpaceProps["size"];
|
|
26
29
|
}
|
|
27
30
|
export declare const ButtonOperate: VFC<ButtonOperateProps>;
|
|
28
|
-
export declare type
|
|
31
|
+
export declare type DatePickerWrapperProps = {
|
|
29
32
|
value?: string;
|
|
30
33
|
onChange?: (value?: string) => void;
|
|
31
34
|
} & Omit<PickerDateProps<moment.Moment>, "value" | "onChange">;
|
|
@@ -38,8 +41,8 @@ export declare type DatePickerWraperProps = {
|
|
|
38
41
|
* 4. 其他格式化类型自定义format
|
|
39
42
|
* ```
|
|
40
43
|
*/
|
|
41
|
-
export declare const
|
|
42
|
-
export declare type
|
|
44
|
+
export declare const DatePickerWrapper: VFC<DatePickerWrapperProps>;
|
|
45
|
+
export declare type DateRangePickerWrapperProps = {
|
|
43
46
|
value?: [
|
|
44
47
|
string,
|
|
45
48
|
string
|
|
@@ -58,7 +61,7 @@ export declare type DateRangePickerWraperProps = {
|
|
|
58
61
|
* 4. 其他格式化类型自定义format
|
|
59
62
|
* ```
|
|
60
63
|
*/
|
|
61
|
-
export declare const
|
|
64
|
+
export declare const DateRangePickerWrapper: VFC<DateRangePickerWrapperProps>;
|
|
62
65
|
export interface DrawerStateType {
|
|
63
66
|
title: string;
|
|
64
67
|
/**
|
|
@@ -77,7 +80,7 @@ export interface DrawerActionsParamType {
|
|
|
77
80
|
closeDrawer: void;
|
|
78
81
|
setDrawerItemData: Record<string, any>;
|
|
79
82
|
}
|
|
80
|
-
export interface
|
|
83
|
+
export interface DrawerOperationOldProps {
|
|
81
84
|
loading?: boolean;
|
|
82
85
|
okText?: string;
|
|
83
86
|
cancelText?: string;
|
|
@@ -93,8 +96,15 @@ export declare type DrawerFormProps = {
|
|
|
93
96
|
* 整个drawer页面级的spinning <Page loading />
|
|
94
97
|
*/
|
|
95
98
|
pageLoading?: boolean;
|
|
96
|
-
operationProps?:
|
|
99
|
+
operationProps?: DrawerOperationOldProps;
|
|
97
100
|
} & DrawerProps;
|
|
101
|
+
/**
|
|
102
|
+
* 弹窗机制
|
|
103
|
+
* ```
|
|
104
|
+
* 1. 默认 destroyOnClose = true
|
|
105
|
+
* 2. 默认 forceRender = false
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
98
108
|
export declare const DrawerWraper: FC<DrawerFormProps>;
|
|
99
109
|
/**
|
|
100
110
|
* drawer弹窗模型
|
|
@@ -107,18 +117,61 @@ export declare const DrawerWraper: FC<DrawerFormProps>;
|
|
|
107
117
|
* ```
|
|
108
118
|
*/
|
|
109
119
|
export declare const createDrawerWraperModel: (key: string) => API<ModelType<DrawerStateType, DrawerActionsParamType, any>>;
|
|
110
|
-
export
|
|
111
|
-
|
|
112
|
-
|
|
120
|
+
export interface DrawerStateType {
|
|
121
|
+
title: string;
|
|
122
|
+
/**
|
|
123
|
+
* 显示drawer
|
|
124
|
+
*/
|
|
125
|
+
visible: boolean;
|
|
126
|
+
/**
|
|
127
|
+
* 用来处理form, `更新`的时候的传递当前item列表行的数据, 当`创建`的时候强制设置为 `undefined`
|
|
128
|
+
*/
|
|
129
|
+
itemData?: Record<string, any>;
|
|
130
|
+
operateType: "create" | "update" | "view" | null;
|
|
131
|
+
pageLoading?: boolean;
|
|
132
|
+
}
|
|
133
|
+
export interface DrawerActionsParamType {
|
|
134
|
+
openDrawerForm: Pick<DrawerStateType, "title" | "itemData" | "operateType" | "pageLoading">;
|
|
135
|
+
closeDrawer: void;
|
|
136
|
+
setDrawerItemData: Record<string, any>;
|
|
137
|
+
}
|
|
138
|
+
export interface DrawerOperationProps {
|
|
139
|
+
loading?: boolean;
|
|
140
|
+
okText?: string;
|
|
141
|
+
cancelText?: string;
|
|
142
|
+
onOk?: () => void;
|
|
143
|
+
onCancel?: () => void;
|
|
144
|
+
hideOkBtn?: boolean;
|
|
145
|
+
okButtonProps?: Omit<ButtonProps, "onClick" | "loading" | "className">;
|
|
146
|
+
cancelButtonProps?: Omit<ButtonProps, "onClick" | "loading" | "className">;
|
|
147
|
+
}
|
|
148
|
+
export declare type DrawerWrapperProps = {
|
|
149
|
+
className?: string;
|
|
150
|
+
/**
|
|
151
|
+
* 整个drawer页面级的spinning <Page loading />
|
|
152
|
+
*/
|
|
153
|
+
pageLoading?: boolean;
|
|
154
|
+
operationProps?: DrawerOperationProps;
|
|
155
|
+
} & DrawerProps;
|
|
113
156
|
/**
|
|
114
|
-
*
|
|
157
|
+
* 弹窗机制
|
|
115
158
|
* ```
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
* accept: '.xlsx,.xls',
|
|
159
|
+
* 1. 默认 destroyOnClose = true
|
|
160
|
+
* 2. 默认 forceRender = false
|
|
119
161
|
* ```
|
|
120
162
|
*/
|
|
121
|
-
export declare const
|
|
163
|
+
export declare const DrawerWrapper: FC<DrawerWrapperProps>;
|
|
164
|
+
/**
|
|
165
|
+
* drawer弹窗模型
|
|
166
|
+
* @param key 唯一值必传
|
|
167
|
+
* @returns
|
|
168
|
+
*
|
|
169
|
+
* ```
|
|
170
|
+
* 使用方式
|
|
171
|
+
* const [drawerState, drawerActions] = createDrawerWrapperModel('key值').useStore();
|
|
172
|
+
* ```
|
|
173
|
+
*/
|
|
174
|
+
export declare const createDrawerWrapperModel: (key: string) => API<ModelType<DrawerStateType, DrawerActionsParamType, any>>;
|
|
122
175
|
export declare type FileUploadItem = {
|
|
123
176
|
fileKey: string;
|
|
124
177
|
fileName: string;
|
|
@@ -129,6 +182,13 @@ export declare type FileUploadProps = {
|
|
|
129
182
|
value?: FileUploadItem[];
|
|
130
183
|
onPreview?: (item: FileUploadItem) => void;
|
|
131
184
|
onUploadChange?: (info: UploadChangeParam<UploadFile>) => void;
|
|
185
|
+
/**
|
|
186
|
+
* 属性映射
|
|
187
|
+
*/
|
|
188
|
+
fieldNames?: {
|
|
189
|
+
fileKey?: string;
|
|
190
|
+
fileName?: string;
|
|
191
|
+
};
|
|
132
192
|
} & Omit<UploadProps, "onChange" | "fileList" | "onPreview">;
|
|
133
193
|
/**
|
|
134
194
|
* 文件上传,结合Form使用最佳
|
|
@@ -141,6 +201,7 @@ export declare type FileUploadProps = {
|
|
|
141
201
|
* fileKey: '预览文件对应的fileKey'
|
|
142
202
|
* }
|
|
143
203
|
* }
|
|
204
|
+
* 可通过fieldNames配置接口返回值属性名称映射
|
|
144
205
|
* ```
|
|
145
206
|
* ```
|
|
146
207
|
* 最佳使用方式:
|
|
@@ -153,6 +214,283 @@ export declare type FileUploadProps = {
|
|
|
153
214
|
*
|
|
154
215
|
*/
|
|
155
216
|
export declare const FileUpload: FC<FileUploadProps>;
|
|
217
|
+
export declare type LabelValueItem<T extends string | number = string | number> = {
|
|
218
|
+
value: T;
|
|
219
|
+
label: string;
|
|
220
|
+
};
|
|
221
|
+
export declare type TPlainObject<T = any> = Record<string, T>;
|
|
222
|
+
export declare type SelectorServiceConfig = {
|
|
223
|
+
params?: TPlainObject;
|
|
224
|
+
requiredParamsKeys?: string[];
|
|
225
|
+
onRequest?: (params?: any) => any;
|
|
226
|
+
/**
|
|
227
|
+
* 响应数据适配器
|
|
228
|
+
*/
|
|
229
|
+
onRequestResultAdapter?: (respData: any) => TPlainObject[];
|
|
230
|
+
};
|
|
231
|
+
export declare type SelectorWrapperProps = Omit<SelectProps, "filterOption" | "onSearch" | "loading" | "notFoundContent" | "options" | "fieldNames"> & {
|
|
232
|
+
modelKey: string;
|
|
233
|
+
fieldNames?: {
|
|
234
|
+
label: string;
|
|
235
|
+
value: string;
|
|
236
|
+
};
|
|
237
|
+
/**
|
|
238
|
+
* useEffect依赖性数组
|
|
239
|
+
*/
|
|
240
|
+
effectDependencyList?: DependencyList;
|
|
241
|
+
/**
|
|
242
|
+
* 请求服务需求的数据,当设置`selectorList`后无效果
|
|
243
|
+
*/
|
|
244
|
+
serviceConfig?: SelectorServiceConfig;
|
|
245
|
+
/**
|
|
246
|
+
* 同步设置选择器选项列表
|
|
247
|
+
* ```
|
|
248
|
+
* 1. 当设置selectorList后,serviceConfig、operateType=search、onSelectorListChange将失效
|
|
249
|
+
* 2. 不支持异步数据,异步使用serviceConfig方式
|
|
250
|
+
* 3. 如果配置fieldNames,会转换后使用
|
|
251
|
+
* ```
|
|
252
|
+
*/
|
|
253
|
+
selectorList?: TPlainObject[];
|
|
254
|
+
/**
|
|
255
|
+
* 通过服务获取数据后回调,当设置`selectorList`后无效果
|
|
256
|
+
*/
|
|
257
|
+
onSelectorListChange?: (dataList: LabelValueItem[]) => void;
|
|
258
|
+
/**
|
|
259
|
+
* 添加全部选项
|
|
260
|
+
* ```
|
|
261
|
+
* 1. showAllOption = true,添加默认全部选项(value值为空字符串)
|
|
262
|
+
* 2. 可自定义全部选项
|
|
263
|
+
* ```
|
|
264
|
+
*/
|
|
265
|
+
showAllOption?: true | JSX.Element;
|
|
266
|
+
/**
|
|
267
|
+
* 输入操作类型,默认值:filter
|
|
268
|
+
* ```
|
|
269
|
+
* 1. search:根据输入项去服务端查询
|
|
270
|
+
* 2. filter:初始化已查询数据,根据输入内容筛选
|
|
271
|
+
* 3. 在设置`selectorList`后,operateType=search将失效
|
|
272
|
+
* ```
|
|
273
|
+
*/
|
|
274
|
+
operateType?: "search" | "filter";
|
|
275
|
+
searchFieldName?: string;
|
|
276
|
+
};
|
|
277
|
+
export declare type SelectorWrapperRefApi = {
|
|
278
|
+
onClearSelectorList: () => void;
|
|
279
|
+
getSelectorList: () => LabelValueItem<string | number>[];
|
|
280
|
+
};
|
|
281
|
+
/**
|
|
282
|
+
* 选择器包装组件
|
|
283
|
+
* @param props
|
|
284
|
+
* @returns
|
|
285
|
+
* ```
|
|
286
|
+
* 1. modelKey的配置是为了缓存数据;
|
|
287
|
+
* 1.1: 当有effectDependencyList依赖项时,依赖项的发生变化后,每次都会去调用接口获取数据
|
|
288
|
+
* 1.2: 当无effectDependencyList依赖项时,第一次调用接口成功后会有标记,下次访问存在标记,就不在调用接口,使用缓存数据;如果想强制刷新数据,可通过随便配置依赖项完成
|
|
289
|
+
* 2. selectorList属性
|
|
290
|
+
* 2.1 当设置selectorList属性后,serviceConfig、operateType=search、onSelectorListChange将失效
|
|
291
|
+
* 2.2 不支持异步数据,异步使用serviceConfig方式
|
|
292
|
+
* 3. operateType=search状态下,回填数据查询接口时,会在接口中默认添加id字段(id的值为回填的值)
|
|
293
|
+
* ```
|
|
294
|
+
*/
|
|
295
|
+
export declare const SelectorWrapper: import("react").ForwardRefExoticComponent<Omit<SelectProps<any, import("rc-select/lib/Select").DefaultOptionType>, "loading" | "options" | "filterOption" | "notFoundContent" | "onSearch" | "fieldNames"> & {
|
|
296
|
+
modelKey: string;
|
|
297
|
+
fieldNames?: {
|
|
298
|
+
label: string;
|
|
299
|
+
value: string;
|
|
300
|
+
} | undefined;
|
|
301
|
+
/**
|
|
302
|
+
* useEffect依赖性数组
|
|
303
|
+
*/
|
|
304
|
+
effectDependencyList?: DependencyList | undefined;
|
|
305
|
+
/**
|
|
306
|
+
* 请求服务需求的数据,当设置`selectorList`后无效果
|
|
307
|
+
*/
|
|
308
|
+
serviceConfig?: SelectorServiceConfig | undefined;
|
|
309
|
+
/**
|
|
310
|
+
* 同步设置选择器选项列表
|
|
311
|
+
* ```
|
|
312
|
+
* 1. 当设置selectorList后,serviceConfig、operateType=search、onSelectorListChange将失效
|
|
313
|
+
* 2. 不支持异步数据,异步使用serviceConfig方式
|
|
314
|
+
* 3. 如果配置fieldNames,会转换后使用
|
|
315
|
+
* ```
|
|
316
|
+
*/
|
|
317
|
+
selectorList?: TPlainObject<any>[] | undefined;
|
|
318
|
+
/**
|
|
319
|
+
* 通过服务获取数据后回调,当设置`selectorList`后无效果
|
|
320
|
+
*/
|
|
321
|
+
onSelectorListChange?: ((dataList: LabelValueItem[]) => void) | undefined;
|
|
322
|
+
/**
|
|
323
|
+
* 添加全部选项
|
|
324
|
+
* ```
|
|
325
|
+
* 1. showAllOption = true,添加默认全部选项(value值为空字符串)
|
|
326
|
+
* 2. 可自定义全部选项
|
|
327
|
+
* ```
|
|
328
|
+
*/
|
|
329
|
+
showAllOption?: true | JSX.Element | undefined;
|
|
330
|
+
/**
|
|
331
|
+
* 输入操作类型,默认值:filter
|
|
332
|
+
* ```
|
|
333
|
+
* 1. search:根据输入项去服务端查询
|
|
334
|
+
* 2. filter:初始化已查询数据,根据输入内容筛选
|
|
335
|
+
* 3. 在设置`selectorList`后,operateType=search将失效
|
|
336
|
+
* ```
|
|
337
|
+
*/
|
|
338
|
+
operateType?: "search" | "filter" | undefined;
|
|
339
|
+
searchFieldName?: string | undefined;
|
|
340
|
+
} & import("react").RefAttributes<SelectorWrapperRefApi>>;
|
|
341
|
+
export declare type EditableInputConfig = {
|
|
342
|
+
type: "input";
|
|
343
|
+
editableComptProps?: InputProps;
|
|
344
|
+
};
|
|
345
|
+
export declare type EditableInputNumberConfig = {
|
|
346
|
+
type: "inputNumber";
|
|
347
|
+
editableComptProps?: InputNumberProps;
|
|
348
|
+
};
|
|
349
|
+
export declare type EditableSelectWrapperConfig = {
|
|
350
|
+
type: "selectorWrapper";
|
|
351
|
+
editableComptProps: SelectorWrapperProps;
|
|
352
|
+
};
|
|
353
|
+
export declare type EditableDatePickerWrapperConfig = {
|
|
354
|
+
type: "datePickerWrapper";
|
|
355
|
+
editableComptProps?: DatePickerWrapperProps;
|
|
356
|
+
};
|
|
357
|
+
export declare type EditableDateRangePickerWrapperConfig = {
|
|
358
|
+
type: "dateRangePickerWrapper";
|
|
359
|
+
editableComptProps?: DateRangePickerWrapperProps;
|
|
360
|
+
};
|
|
361
|
+
export declare type EditableCheckboxGroupConfig = {
|
|
362
|
+
type: "checkboxGroup";
|
|
363
|
+
editableComptProps: CheckboxGroupProps;
|
|
364
|
+
};
|
|
365
|
+
export declare type EditableRadioGroupConfig = {
|
|
366
|
+
type: "radioGroup";
|
|
367
|
+
editableComptProps: RadioGroupProps;
|
|
368
|
+
};
|
|
369
|
+
export declare type EditableTextareaConfig = {
|
|
370
|
+
type: "textArea";
|
|
371
|
+
editableComptProps: TextAreaProps;
|
|
372
|
+
};
|
|
373
|
+
export declare type EditableFileUploadConfig = {
|
|
374
|
+
type: "fileUpload";
|
|
375
|
+
editableComptProps: FileUploadProps;
|
|
376
|
+
};
|
|
377
|
+
/**
|
|
378
|
+
* 自定义编辑组件
|
|
379
|
+
* ```
|
|
380
|
+
* 1.需要处理Form.Item
|
|
381
|
+
* 2. 例如
|
|
382
|
+
* editableConfig: {
|
|
383
|
+
type: 'custom',
|
|
384
|
+
editableComptProps: (props) => {
|
|
385
|
+
return (
|
|
386
|
+
<Form.Item name={props.name}>
|
|
387
|
+
<Input />
|
|
388
|
+
</Form.Item>
|
|
389
|
+
);
|
|
390
|
+
},
|
|
391
|
+
},
|
|
392
|
+
```
|
|
393
|
+
*/
|
|
394
|
+
export declare type EditableCustomConfig = {
|
|
395
|
+
type: "custom";
|
|
396
|
+
editableComptProps: (props: {
|
|
397
|
+
name: Array<number | string>;
|
|
398
|
+
editable?: boolean;
|
|
399
|
+
completeName: Array<number | string>;
|
|
400
|
+
}) => ReactElement;
|
|
401
|
+
};
|
|
402
|
+
export declare type EditableTypeConfig = EditableCustomConfig | EditableInputConfig | EditableSelectWrapperConfig | EditableDatePickerWrapperConfig | EditableDateRangePickerWrapperConfig | EditableCheckboxGroupConfig | EditableTextareaConfig | EditableInputNumberConfig | EditableRadioGroupConfig | EditableFileUploadConfig;
|
|
403
|
+
export declare type FieldSingleConfig = {
|
|
404
|
+
editable?: boolean | ((data: {
|
|
405
|
+
tableRowIndex: number;
|
|
406
|
+
}) => boolean);
|
|
407
|
+
editableConfig?: EditableTypeConfig;
|
|
408
|
+
/**
|
|
409
|
+
* 当editableConfig type=custom时,此配置无效
|
|
410
|
+
*/
|
|
411
|
+
formItemProps?: Omit<FormItemProps, "name">;
|
|
412
|
+
/**
|
|
413
|
+
* 1. 当editableConfig type=custom时,此配置无效
|
|
414
|
+
* 2. 只在editable=false的情况下有效
|
|
415
|
+
*/
|
|
416
|
+
render?: (params?: any) => ReactNode;
|
|
417
|
+
};
|
|
418
|
+
export declare type FormListItemMethodOperateProps = {
|
|
419
|
+
tableRowIndex: number;
|
|
420
|
+
add: FormListOperation["add"];
|
|
421
|
+
remove: () => void;
|
|
422
|
+
formListItemIndex: number;
|
|
423
|
+
value: any;
|
|
424
|
+
};
|
|
425
|
+
export declare type FormListMethodOperateProps = {
|
|
426
|
+
tableRowIndex: number;
|
|
427
|
+
add: FormListOperation["add"];
|
|
428
|
+
value: any;
|
|
429
|
+
};
|
|
430
|
+
export declare type FormListConfig = {
|
|
431
|
+
editableConfigList: Array<FieldSingleConfig & {
|
|
432
|
+
fieldName: string;
|
|
433
|
+
}>;
|
|
434
|
+
onFormListBeforeRender?: (data: FormListMethodOperateProps) => ReactElement | null;
|
|
435
|
+
onFormListAfterRender?: (data: FormListMethodOperateProps) => ReactElement | null;
|
|
436
|
+
onFormListItemBeforeRender?: (data: FormListItemMethodOperateProps) => void;
|
|
437
|
+
onFormListItemAfterRender?: (data: FormListItemMethodOperateProps) => void;
|
|
438
|
+
deleteOperateRender?: (data: {
|
|
439
|
+
remove: () => void;
|
|
440
|
+
formListItemIndex: number;
|
|
441
|
+
}) => ReactElement;
|
|
442
|
+
};
|
|
443
|
+
export declare type EditableTableDataSourceItem = FormListFieldData & {
|
|
444
|
+
operation: FormListOperation;
|
|
445
|
+
};
|
|
446
|
+
export declare type EditableTableColumn = Omit<ColumnsType["0"], "render"> & {
|
|
447
|
+
dataIndex: string;
|
|
448
|
+
fieldConfig?: FieldSingleConfig | FormListConfig;
|
|
449
|
+
/**
|
|
450
|
+
* 配置操作功能处理后,fieldConfig配置将失效
|
|
451
|
+
* ```
|
|
452
|
+
* 1. tableRowIndex:当前row的索引值
|
|
453
|
+
* 1. name:当前row的form.item的name值
|
|
454
|
+
* ```
|
|
455
|
+
*/
|
|
456
|
+
operateRender?: (item: {
|
|
457
|
+
tableRowIndex: number;
|
|
458
|
+
name: Array<string | number>;
|
|
459
|
+
operation: FormListOperation;
|
|
460
|
+
}) => ReactElement;
|
|
461
|
+
};
|
|
462
|
+
export declare type EditableTableProps = {
|
|
463
|
+
name: string;
|
|
464
|
+
/**
|
|
465
|
+
* ```
|
|
466
|
+
* antd table属性
|
|
467
|
+
* 1. 新增cellVerticalAlign,单元格竖直方向对齐方式,设置table components属性后失效
|
|
468
|
+
* ```
|
|
469
|
+
*/
|
|
470
|
+
tableProps: Omit<TableProps<any>, "dataSource" | "columns" | "rowKey"> & {
|
|
471
|
+
cellVerticalAlign?: "baseline" | "middle" | "top" | "bottom";
|
|
472
|
+
};
|
|
473
|
+
columns: EditableTableColumn[];
|
|
474
|
+
onTableBeforeRender?: (formListOperation: FormListOperation, nextRowIndex: number) => ReactElement | null;
|
|
475
|
+
/**
|
|
476
|
+
* 设置后,将覆盖底部`新增`按钮
|
|
477
|
+
*/
|
|
478
|
+
onTableAfterRender?: (formListOperation: FormListOperation, nextRowIndex: number) => ReactElement | null;
|
|
479
|
+
rules?: FormListProps["rules"];
|
|
480
|
+
};
|
|
481
|
+
export declare const EditableTable: (props: EditableTableProps) => JSX.Element;
|
|
482
|
+
export declare type FileImportProps = {
|
|
483
|
+
onImportFinish: (data?: any[]) => void;
|
|
484
|
+
} & Pick<UploadProps, "accept" | "action" | "beforeUpload" | "disabled" | "maxCount" | "method" | "name">;
|
|
485
|
+
/**
|
|
486
|
+
* 文件导入
|
|
487
|
+
* ```
|
|
488
|
+
* 默认值:
|
|
489
|
+
* name: 'file',
|
|
490
|
+
* accept: '.xlsx,.xls',
|
|
491
|
+
* ```
|
|
492
|
+
*/
|
|
493
|
+
export declare const FileImport: FC<FileImportProps>;
|
|
156
494
|
export declare type FlexLayoutProps = {
|
|
157
495
|
className?: string;
|
|
158
496
|
fullIndex?: number | number[];
|
|
@@ -218,6 +556,13 @@ export declare type ModalFormProps = {
|
|
|
218
556
|
operationProps?: ModalOperationProps;
|
|
219
557
|
footer?: null | React.ReactNode;
|
|
220
558
|
} & Omit<ModalProps, "footer" | "onOk" | "okText" | "cancelText" | "okButtonProps" | "cancelButtonProps" | "okType" | "confirmLoading">;
|
|
559
|
+
/**
|
|
560
|
+
* 弹窗机制
|
|
561
|
+
* ```
|
|
562
|
+
* 1. 默认 destroyOnClose = true
|
|
563
|
+
* 2. 默认 forceRender = false
|
|
564
|
+
* ```
|
|
565
|
+
*/
|
|
221
566
|
export declare const ModalWraper: FC<ModalFormProps>;
|
|
222
567
|
/**
|
|
223
568
|
* modal弹窗模型
|
|
@@ -230,6 +575,59 @@ export declare const ModalWraper: FC<ModalFormProps>;
|
|
|
230
575
|
* ```
|
|
231
576
|
*/
|
|
232
577
|
export declare const createModalWraperModel: (key: string) => API<ModelType<ModalStateType, ModalActionsParamType, any>>;
|
|
578
|
+
export interface ModalStateType {
|
|
579
|
+
title?: string;
|
|
580
|
+
/**
|
|
581
|
+
* 显示modal
|
|
582
|
+
*/
|
|
583
|
+
visible: boolean;
|
|
584
|
+
/**
|
|
585
|
+
* 用来处理form, `更新`的时候的传递当前item列表行的数据, 当`创建`的时候强制设置为 `undefined`
|
|
586
|
+
*/
|
|
587
|
+
itemData?: Record<string, unknown> | null;
|
|
588
|
+
operateType: "create" | "update" | "view";
|
|
589
|
+
pageLoading?: boolean;
|
|
590
|
+
}
|
|
591
|
+
export interface ModalActionsParamType {
|
|
592
|
+
openModalForm: Pick<ModalStateType, "title" | "itemData" | "operateType" | "pageLoading">;
|
|
593
|
+
closeModal: void;
|
|
594
|
+
setModalItemData: Record<string, unknown>;
|
|
595
|
+
}
|
|
596
|
+
export interface ModalOperationOldProps {
|
|
597
|
+
loading?: boolean;
|
|
598
|
+
okText?: string;
|
|
599
|
+
cancelText?: string;
|
|
600
|
+
onOk?: () => void;
|
|
601
|
+
onCancel?: () => void;
|
|
602
|
+
hideOkBtn?: boolean;
|
|
603
|
+
okButtonProps?: Omit<ButtonProps, "onClick" | "loading" | "className">;
|
|
604
|
+
cancelButtonProps?: Omit<ButtonProps, "onClick" | "loading" | "className">;
|
|
605
|
+
}
|
|
606
|
+
export declare type ModalWrapperProps = {
|
|
607
|
+
className?: string;
|
|
608
|
+
pageLoading?: boolean;
|
|
609
|
+
operationProps?: ModalOperationOldProps;
|
|
610
|
+
footer?: null | React.ReactNode;
|
|
611
|
+
} & Omit<ModalProps, "footer" | "onOk" | "okText" | "cancelText" | "okButtonProps" | "cancelButtonProps" | "okType" | "confirmLoading">;
|
|
612
|
+
/**
|
|
613
|
+
* 弹窗机制
|
|
614
|
+
* ```
|
|
615
|
+
* 1. 默认 destroyOnClose = true
|
|
616
|
+
* 2. 默认 forceRender = false
|
|
617
|
+
* ```
|
|
618
|
+
*/
|
|
619
|
+
export declare const ModalWrapper: FC<ModalWrapperProps>;
|
|
620
|
+
/**
|
|
621
|
+
* modal弹窗模型
|
|
622
|
+
* @param key 唯一值必传
|
|
623
|
+
* @returns
|
|
624
|
+
*
|
|
625
|
+
* ```
|
|
626
|
+
* 使用方式
|
|
627
|
+
* const [modalState, modalActions] = createModalWrapperModel('key值').useStore();
|
|
628
|
+
* ```
|
|
629
|
+
*/
|
|
630
|
+
export declare const createModalWrapperModel: (key: string) => API<ModelType<ModalStateType, ModalActionsParamType, any>>;
|
|
233
631
|
export declare type PageFixedFooterProps = {
|
|
234
632
|
className?: string;
|
|
235
633
|
style?: CSSProperties;
|
|
@@ -271,93 +669,11 @@ export declare const preDefinedClassName: {
|
|
|
271
669
|
label_width_auto: string;
|
|
272
670
|
};
|
|
273
671
|
};
|
|
274
|
-
export declare type TPlainObject<T = any> = Record<string, T>;
|
|
275
|
-
export declare type LabelValueItem<T extends string | number = string> = {
|
|
276
|
-
value: T;
|
|
277
|
-
label: string;
|
|
278
|
-
};
|
|
279
|
-
export declare type SelectorServiceConfig = {
|
|
280
|
-
params?: TPlainObject;
|
|
281
|
-
requiredParamsKeys?: string[];
|
|
282
|
-
fieldNames?: {
|
|
283
|
-
label: string;
|
|
284
|
-
value: string;
|
|
285
|
-
};
|
|
286
|
-
onRequest?: (params?: any) => any;
|
|
287
|
-
/**
|
|
288
|
-
* 响应数据适配器
|
|
289
|
-
*/
|
|
290
|
-
onRequestResultAdapter?: (respData: any) => TPlainObject[];
|
|
291
|
-
};
|
|
292
|
-
export declare type SelectorWrapperProps = SelectProps & {
|
|
293
|
-
effectDependencyList?: DependencyList[];
|
|
294
|
-
/**
|
|
295
|
-
* 请求服务需求的数据,当设置`selectorList`后无效果
|
|
296
|
-
*/
|
|
297
|
-
serviceConfig?: SelectorServiceConfig;
|
|
298
|
-
/**
|
|
299
|
-
* 当设置selectorList后,serviceConfig、operateType=search、onSelectorListChange将失效
|
|
300
|
-
*/
|
|
301
|
-
selectorList?: LabelValueItem<string | number>[];
|
|
302
|
-
/**
|
|
303
|
-
* 通过服务获取数据后回调,当设置`selectorList`后无效果
|
|
304
|
-
*/
|
|
305
|
-
onSelectorListChange?: (selectorList: LabelValueItem<string | number>[]) => void;
|
|
306
|
-
showAllOption?: true | JSX.Element;
|
|
307
|
-
/**
|
|
308
|
-
* 输入操作类型,默认值:filter
|
|
309
|
-
* ```
|
|
310
|
-
* 1. search:根据输入项去服务端查询
|
|
311
|
-
* 2. filter:初始化已查询数据,根据输入内容筛选
|
|
312
|
-
* 3. 在设置`selectorList`后,operateType=search将失效
|
|
313
|
-
* ```
|
|
314
|
-
*/
|
|
315
|
-
operateType?: "search" | "filter";
|
|
316
|
-
searchFieldName?: string;
|
|
317
|
-
};
|
|
318
|
-
export declare type SelectorWrapperRefApi = {
|
|
319
|
-
onClearSelectorList: () => void;
|
|
320
|
-
getSelectorList: () => LabelValueItem<string | number>[];
|
|
321
|
-
};
|
|
322
|
-
/**
|
|
323
|
-
* 选择器包装组件
|
|
324
|
-
* @param props
|
|
325
|
-
* @returns
|
|
326
|
-
* ```
|
|
327
|
-
* 1. 当设置selectorList属性后,serviceConfig、operateType=search、onSelectorListChange将失效
|
|
328
|
-
* 2. operateType=search状态下,回填数据查询接口时,会在接口中默认添加id字段(id的值为回填的值)
|
|
329
|
-
* ```
|
|
330
|
-
*/
|
|
331
|
-
export declare const SelectorWrapper: import("react").ForwardRefExoticComponent<SelectProps<any, import("rc-select/lib/Select").DefaultOptionType> & {
|
|
332
|
-
effectDependencyList?: DependencyList[] | undefined;
|
|
333
|
-
/**
|
|
334
|
-
* 请求服务需求的数据,当设置`selectorList`后无效果
|
|
335
|
-
*/
|
|
336
|
-
serviceConfig?: SelectorServiceConfig | undefined;
|
|
337
|
-
/**
|
|
338
|
-
* 当设置selectorList后,serviceConfig、operateType=search、onSelectorListChange将失效
|
|
339
|
-
*/
|
|
340
|
-
selectorList?: LabelValueItem<string | number>[] | undefined;
|
|
341
|
-
/**
|
|
342
|
-
* 通过服务获取数据后回调,当设置`selectorList`后无效果
|
|
343
|
-
*/
|
|
344
|
-
onSelectorListChange?: ((selectorList: LabelValueItem<string | number>[]) => void) | undefined;
|
|
345
|
-
showAllOption?: true | JSX.Element | undefined;
|
|
346
|
-
/**
|
|
347
|
-
* 输入操作类型,默认值:filter
|
|
348
|
-
* ```
|
|
349
|
-
* 1. search:根据输入项去服务端查询
|
|
350
|
-
* 2. filter:初始化已查询数据,根据输入内容筛选
|
|
351
|
-
* 3. 在设置`selectorList`后,operateType=search将失效
|
|
352
|
-
* ```
|
|
353
|
-
*/
|
|
354
|
-
operateType?: "search" | "filter" | undefined;
|
|
355
|
-
searchFieldName?: string | undefined;
|
|
356
|
-
} & import("react").RefAttributes<SelectorWrapperRefApi>>;
|
|
357
672
|
export declare type SimpleLayoutProps = {
|
|
358
673
|
className?: string;
|
|
359
674
|
style?: CSSProperties;
|
|
360
675
|
title?: string | ReactElement;
|
|
676
|
+
desc?: string | ReactElement;
|
|
361
677
|
formLabelAlign?: "left" | "right";
|
|
362
678
|
layoutType?: "layer" | "tight";
|
|
363
679
|
};
|
|
@@ -408,14 +724,18 @@ export declare type TreeSelectorServiceConfig = {
|
|
|
408
724
|
*/
|
|
409
725
|
onRequestResultAdapter?: (respData: any) => TPlainObject[];
|
|
410
726
|
};
|
|
411
|
-
export declare type TreeSelectorWrapperProps = TreeSelectProps & {
|
|
412
|
-
|
|
727
|
+
export declare type TreeSelectorWrapperProps = Omit<TreeSelectProps, "treeExpandedKeys" | "treeData" | "loading" | "onTreeExpand"> & {
|
|
728
|
+
modelKey: string;
|
|
729
|
+
effectDependencyList?: DependencyList;
|
|
413
730
|
/**
|
|
414
731
|
* 请求服务需求的数据,当设置`treeSelectorList`后无效果
|
|
415
732
|
*/
|
|
416
733
|
serviceConfig?: TreeSelectorServiceConfig;
|
|
417
734
|
/**
|
|
418
735
|
* 当设置treeSelectorList后,serviceConfig、onTreeSelectorListChange将失效
|
|
736
|
+
* ```
|
|
737
|
+
* 1. 不支持异步数据,异步使用serviceConfig方式
|
|
738
|
+
* ```
|
|
419
739
|
*/
|
|
420
740
|
treeSelectorList?: TreeSelectProps["treeData"];
|
|
421
741
|
/**
|
|
@@ -435,14 +755,18 @@ export declare type TreeSelectorWrapperRefApi = {
|
|
|
435
755
|
* 1. 当设置treeSelectorList属性后,serviceConfig、onTreeSelectorListChange将失效
|
|
436
756
|
* ```
|
|
437
757
|
*/
|
|
438
|
-
export declare const TreeSelectorWrapper: import("react").ForwardRefExoticComponent<TreeSelectProps<any, import("rc-tree-select/lib/TreeSelect").DefaultOptionType> & {
|
|
439
|
-
|
|
758
|
+
export declare const TreeSelectorWrapper: import("react").ForwardRefExoticComponent<Omit<TreeSelectProps<any, import("rc-tree-select/lib/TreeSelect").DefaultOptionType>, "loading" | "treeData" | "treeExpandedKeys" | "onTreeExpand"> & {
|
|
759
|
+
modelKey: string;
|
|
760
|
+
effectDependencyList?: DependencyList | undefined;
|
|
440
761
|
/**
|
|
441
762
|
* 请求服务需求的数据,当设置`treeSelectorList`后无效果
|
|
442
763
|
*/
|
|
443
764
|
serviceConfig?: TreeSelectorServiceConfig | undefined;
|
|
444
765
|
/**
|
|
445
766
|
* 当设置treeSelectorList后,serviceConfig、onTreeSelectorListChange将失效
|
|
767
|
+
* ```
|
|
768
|
+
* 1. 不支持异步数据,异步使用serviceConfig方式
|
|
769
|
+
* ```
|
|
446
770
|
*/
|
|
447
771
|
treeSelectorList?: TreeSelectProps["treeData"];
|
|
448
772
|
/**
|
|
@@ -460,13 +784,17 @@ export declare type TreeServiceConfig = {
|
|
|
460
784
|
onRequestResultAdapter?: (respData: any) => TPlainObject[];
|
|
461
785
|
};
|
|
462
786
|
export declare type TreeWrapperProps = Omit<TreeProps, "expandedKeys" | "treeData" | "onExpand" | "selectedKeys" | "checkedKeys" | "onCheck" | "onSelect" | "defaultCheckedKeys" | "defaultSelectedKeys" | "fieldNames"> & {
|
|
463
|
-
|
|
787
|
+
modelKey: string;
|
|
788
|
+
effectDependencyList?: DependencyList;
|
|
464
789
|
/**
|
|
465
790
|
* 请求服务需求的数据,当设置`selectorTreeList`后无效果
|
|
466
791
|
*/
|
|
467
792
|
serviceConfig?: TreeServiceConfig;
|
|
468
793
|
/**
|
|
469
794
|
* 当设置selectorTreeList后,serviceConfig将失效
|
|
795
|
+
* ```
|
|
796
|
+
* 1. 不支持异步数据,异步使用serviceConfig方式
|
|
797
|
+
* ```
|
|
470
798
|
*/
|
|
471
799
|
selectorTreeList?: TreeProps["treeData"];
|
|
472
800
|
value?: string | number | Array<string | number>;
|
|
@@ -494,13 +822,17 @@ export declare type TreeWrapperRefApi = {
|
|
|
494
822
|
* ```
|
|
495
823
|
*/
|
|
496
824
|
export declare const TreeWrapper: import("react").ForwardRefExoticComponent<Omit<TreeProps<import("antd").TreeDataNode>, "onSelect" | "checkedKeys" | "selectedKeys" | "fieldNames" | "defaultSelectedKeys" | "onExpand" | "expandedKeys" | "treeData" | "defaultCheckedKeys" | "onCheck"> & {
|
|
497
|
-
|
|
825
|
+
modelKey: string;
|
|
826
|
+
effectDependencyList?: DependencyList | undefined;
|
|
498
827
|
/**
|
|
499
828
|
* 请求服务需求的数据,当设置`selectorTreeList`后无效果
|
|
500
829
|
*/
|
|
501
830
|
serviceConfig?: TreeServiceConfig | undefined;
|
|
502
831
|
/**
|
|
503
832
|
* 当设置selectorTreeList后,serviceConfig将失效
|
|
833
|
+
* ```
|
|
834
|
+
* 1. 不支持异步数据,异步使用serviceConfig方式
|
|
835
|
+
* ```
|
|
504
836
|
*/
|
|
505
837
|
selectorTreeList?: TreeProps["treeData"];
|
|
506
838
|
value?: string | number | (string | number)[] | undefined;
|
|
@@ -515,5 +847,51 @@ export declare const TreeWrapper: import("react").ForwardRefExoticComponent<Omit
|
|
|
515
847
|
*/
|
|
516
848
|
filterLabel?: string | undefined;
|
|
517
849
|
} & import("react").RefAttributes<TreeWrapperRefApi>>;
|
|
850
|
+
export declare type UploadWrapperFileItem = {
|
|
851
|
+
uid: string;
|
|
852
|
+
name: string;
|
|
853
|
+
url: string;
|
|
854
|
+
};
|
|
855
|
+
export declare type UploadWrapperProps<T extends TPlainObject = TPlainObject> = {
|
|
856
|
+
value?: T[];
|
|
857
|
+
onChange?: (value?: T[]) => void;
|
|
858
|
+
onUploadError?: (message?: string) => void;
|
|
859
|
+
onUploadChange?: (info: UploadChangeParam<UploadFile>) => void;
|
|
860
|
+
/**
|
|
861
|
+
* 属性映射
|
|
862
|
+
*/
|
|
863
|
+
fieldNames?: {
|
|
864
|
+
uid: string;
|
|
865
|
+
name: string;
|
|
866
|
+
url: string;
|
|
867
|
+
};
|
|
868
|
+
/**
|
|
869
|
+
* 接口响应数据适配器,如果配置了fieldNames,适配器返回值会再进过fieldNames转换
|
|
870
|
+
*/
|
|
871
|
+
onRequestResultAdapter?: (respData: any) => TPlainObject;
|
|
872
|
+
} & Omit<UploadProps, "onChange" | "fileList">;
|
|
873
|
+
/**
|
|
874
|
+
* 文件上传
|
|
875
|
+
* ```
|
|
876
|
+
* 1. 可通过配置children替换默认上传触发布局
|
|
877
|
+
* 2. 接口返回结构:
|
|
878
|
+
* formData上传接口返回值
|
|
879
|
+
* {
|
|
880
|
+
* code: '0000',
|
|
881
|
+
* data: {
|
|
882
|
+
* uid: '唯一值,可使用fileKey值'
|
|
883
|
+
* name: '文件名称'
|
|
884
|
+
* url: '预览地址'
|
|
885
|
+
* }
|
|
886
|
+
* }
|
|
887
|
+
* 可通过fieldNames配置接口返回值属性名称映射
|
|
888
|
+
* 3. 最佳使用方式,与Form结合使用
|
|
889
|
+
* <Form.Item name="attachmentList" label="附件">
|
|
890
|
+
* <UploadWrapper action={uploadUrl} onPreview={onPreviewFile} />
|
|
891
|
+
* </Form.Item>
|
|
892
|
+
* ```
|
|
893
|
+
*
|
|
894
|
+
*/
|
|
895
|
+
export declare const UploadWrapper: FC<UploadWrapperProps>;
|
|
518
896
|
|
|
519
897
|
export {};
|