react-toolkits 2.21.1 → 2.22.1
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/CHANGELOG.md +12 -0
- package/lib/index.d.ts +16 -12
- package/lib/index.js +122 -122
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# react-toolkits
|
|
2
2
|
|
|
3
|
+
## 2.22.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 41e87c2: 重构QueryList组件,优化dataAdapter配置,支持更灵活的数据处理方式。同时更新相关页面以使用新的dataAdapter结构,提升代码可读性和一致性。
|
|
8
|
+
|
|
9
|
+
## 2.22.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- de4b454: 重构use-ky钩子的响应处理逻辑,简化对不同响应类型的处理,优化错误处理机制,确保在请求失败时能够正确提取并显示错误信息。
|
|
14
|
+
|
|
3
15
|
## 2.21.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/lib/index.d.ts
CHANGED
|
@@ -331,15 +331,18 @@ interface QueryListPayload<Values = any> {
|
|
|
331
331
|
size?: number;
|
|
332
332
|
formValue?: Values;
|
|
333
333
|
}
|
|
334
|
-
interface
|
|
335
|
-
url: string;
|
|
336
|
-
method?: 'GET' | 'POST';
|
|
337
|
-
body?: FormData | Record<string | number, any> | ((payload: QueryListPayload<Values>) => FormData | Record<string | number, any>);
|
|
338
|
-
params?: Record<string | number, any> | ((payload: QueryListPayload<Values>) => Record<string | number, any>);
|
|
339
|
-
headers?: Record<string, string> | ((form: FormInstance<Values>) => Record<string, string>);
|
|
334
|
+
interface CacheConfig {
|
|
340
335
|
cacheTime?: number;
|
|
341
336
|
staleTime?: number;
|
|
342
337
|
}
|
|
338
|
+
interface QueryListRequestConfig extends CacheConfig {
|
|
339
|
+
url: string;
|
|
340
|
+
method?: 'GET' | 'POST';
|
|
341
|
+
body?: FormData | Record<string | number, any>;
|
|
342
|
+
searchParams?: Record<string | number, any>;
|
|
343
|
+
headers?: Record<string, string>;
|
|
344
|
+
}
|
|
345
|
+
type QueryListRequestConfigType<Values = any> = QueryListRequestConfig | ((payload: QueryListPayload<Values>) => QueryListRequestConfig);
|
|
343
346
|
declare enum QueryListAction {
|
|
344
347
|
Confirm = 0,
|
|
345
348
|
Reset = 1,
|
|
@@ -351,24 +354,25 @@ interface QueryListRef<Item extends AnyObject = AnyObject, Values = AnyObject, D
|
|
|
351
354
|
dataSource: Item[] | undefined;
|
|
352
355
|
form: FormInstance<Values>;
|
|
353
356
|
}
|
|
354
|
-
interface QueryListDataAdapter<Item extends AnyObject = AnyObject
|
|
355
|
-
total?:
|
|
356
|
-
items?:
|
|
357
|
+
interface QueryListDataAdapter<Item extends AnyObject = AnyObject> {
|
|
358
|
+
total?: number;
|
|
359
|
+
items?: Item[];
|
|
357
360
|
}
|
|
361
|
+
type QueryListDataAdapterConfig<Item extends AnyObject = AnyObject, Values = AnyObject, Data = any> = QueryListDataAdapter<Item> | ((form: FormInstance<Values>, data: Data) => QueryListDataAdapter<Item>);
|
|
358
362
|
interface QueryListProps<Item extends AnyObject = AnyObject, Values = AnyObject, Data = any> extends Omit<TableProps<Item>, 'pagination' | 'dataSource' | 'loading' | 'footer'>, Pick<FilterFormWrapperProps, 'buttonsAlign' | 'showReset'> {
|
|
359
|
-
identifier
|
|
363
|
+
identifier?: string;
|
|
360
364
|
code?: string;
|
|
361
365
|
form?: FormInstance<Values>;
|
|
362
366
|
refreshInterval?: number;
|
|
363
367
|
onePage?: boolean;
|
|
364
368
|
defaultSize?: number;
|
|
365
369
|
pageSizeOptions?: number[];
|
|
366
|
-
request:
|
|
370
|
+
request: QueryListRequestConfigType<Values>;
|
|
367
371
|
tableExtra?: ReactNode | ((form: FormInstance<Values>, data?: Data) => ReactNode);
|
|
368
372
|
renderForm?: (form: FormInstance<Values>) => ReactElement;
|
|
369
373
|
afterSuccess?: (action: QueryListAction, form: FormInstance<Values>, data?: Data) => void;
|
|
370
374
|
afterError?: (error: Error, action: QueryListAction, form: FormInstance<Values>) => void;
|
|
371
|
-
dataAdapter?:
|
|
375
|
+
dataAdapter?: QueryListDataAdapterConfig<Item, Values, Data>;
|
|
372
376
|
footer?: (data: Data | undefined) => ReactNode;
|
|
373
377
|
}
|
|
374
378
|
declare const QueryList: <Item extends AnyObject = AnyObject, Values extends object | undefined = undefined, Data = any>(props: QueryListProps<Item, Values, Data> & {
|