react-toolkits 2.22.0 → 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 +6 -0
- package/lib/index.d.ts +16 -12
- package/lib/index.js +121 -121
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
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> & {
|