react-toolkits 2.20.0 → 2.21.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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # react-toolkits
2
2
 
3
+ ## 2.21.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 29987ae: 优化FilterFormWrapper组件,修改确认按钮为禁用状态以防止重复点击。同时更新InfiniteList组件的加载状态变量名称,增强代码可读性。调整NotFound页面的样式,使其居中显示。修正UserDetail和useGames钩子中的store访问方式,提升一致性。
8
+
9
+ ## 2.21.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 01b6652: 重构InfiniteList和QueryList组件,采用dataAdapter模式优化数据源处理逻辑,提升代码可读性和一致性。同时更新相关页面以使用新的dataAdapter配置。
14
+
3
15
  ## 2.20.0
4
16
 
5
17
  ### Minor Changes
package/lib/index.d.ts CHANGED
@@ -136,6 +136,11 @@ declare enum InfiniteListAction {
136
136
  LoadMore = 2,
137
137
  Init = 3
138
138
  }
139
+ interface InfiniteListDataAdapter<Item = any, Values = any, Data = any> {
140
+ items?: (data: Data[] | undefined, form: FormInstance<Values>) => Item[] | undefined;
141
+ hasMore?: (lastPage: Data | undefined, allPages: Data[]) => boolean;
142
+ nextPageParam?: (lastPage: Data | undefined, allPages: Data[], pageParam: any) => any;
143
+ }
139
144
  interface InfiniteListRef<Item = any, Values = any, Data = any> {
140
145
  data: Data[] | undefined;
141
146
  dataSource: Item[] | undefined;
@@ -155,9 +160,7 @@ interface InfiniteListProps<Item, Values, Data> extends Pick<TableProps<Item>, '
155
160
  renderForm?: (form: FormInstance<Values>) => ReactElement;
156
161
  afterSuccess?: (action: InfiniteListAction, form: FormInstance<Values>, data?: Data[]) => void;
157
162
  afterError?: (error: Error, action: InfiniteListAction, form: FormInstance<Values>) => void;
158
- getDataSource?: (data: Data[] | undefined, form: FormInstance<Values>) => Item[] | undefined;
159
- getHasMore?: (lastPage: Data | undefined, allPages: Data[]) => boolean;
160
- getNextPageParam?: (lastPage: Data | undefined, allPages: Data[], pageParam: any) => any;
163
+ dataAdapter?: InfiniteListDataAdapter<Item, Values, Data>;
161
164
  initialPageParam?: any;
162
165
  footer?: (data: Data[] | undefined) => ReactNode;
163
166
  }
@@ -348,6 +351,10 @@ interface QueryListRef<Item extends AnyObject = AnyObject, Values = AnyObject, D
348
351
  dataSource: Item[] | undefined;
349
352
  form: FormInstance<Values>;
350
353
  }
354
+ interface QueryListDataAdapter<Item extends AnyObject = AnyObject, Values = AnyObject, Data = any> {
355
+ total?: (data: Data | undefined) => number | undefined;
356
+ items?: (data: Data | undefined, form: FormInstance<Values>) => Item[] | undefined;
357
+ }
351
358
  interface QueryListProps<Item extends AnyObject = AnyObject, Values = AnyObject, Data = any> extends Omit<TableProps<Item>, 'pagination' | 'dataSource' | 'loading' | 'footer'>, Pick<FilterFormWrapperProps, 'buttonsAlign' | 'showReset'> {
352
359
  identifier: string;
353
360
  code?: string;
@@ -361,8 +368,7 @@ interface QueryListProps<Item extends AnyObject = AnyObject, Values = AnyObject,
361
368
  renderForm?: (form: FormInstance<Values>) => ReactElement;
362
369
  afterSuccess?: (action: QueryListAction, form: FormInstance<Values>, data?: Data) => void;
363
370
  afterError?: (error: Error, action: QueryListAction, form: FormInstance<Values>) => void;
364
- getTotal?: (data: Data | undefined) => number | undefined;
365
- getDataSource?: (data: Data | undefined, form: FormInstance<Values>) => Item[] | undefined;
371
+ dataAdapter?: QueryListDataAdapter<Item, Values, Data>;
366
372
  footer?: (data: Data | undefined) => ReactNode;
367
373
  }
368
374
  declare const QueryList: <Item extends AnyObject = AnyObject, Values extends object | undefined = undefined, Data = any>(props: QueryListProps<Item, Values, Data> & {