react-toolkits 2.14.0 → 2.14.2

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.14.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 2df5864: feat: change QueryList generics
8
+
9
+ ## 2.14.1
10
+
11
+ ### Patch Changes
12
+
13
+ - 751ca52: fix: cancel games fetching when current permission is V1
14
+
3
15
  ## 2.14.0
4
16
 
5
17
  ### Minor Changes
package/lib/index.d.ts CHANGED
@@ -203,12 +203,12 @@ declare enum QueryListAction {
203
203
  Jump = 2,
204
204
  Init = 3
205
205
  }
206
- interface QueryListRef<Item extends AnyObject = AnyObject, Values = AnyObject, Data = any> {
206
+ interface QueryListRef<Item extends AnyObject = AnyObject, Data = any, Values = AnyObject> {
207
207
  data: Data | undefined;
208
208
  dataSource: Item[] | undefined;
209
209
  form: FormInstance<Values>;
210
210
  }
211
- interface QueryListProps<Item extends AnyObject = AnyObject, Values = AnyObject, Data = any> extends Omit<TableProps<Item>, 'pagination' | 'dataSource' | 'loading' | 'footer'>, Pick<FilterFormWrapperProps, 'buttonsAlign' | 'showReset'> {
211
+ interface QueryListProps<Item extends AnyObject = AnyObject, Data = any, Values = AnyObject> extends Omit<TableProps<Item>, 'pagination' | 'dataSource' | 'loading' | 'footer'>, Pick<FilterFormWrapperProps, 'buttonsAlign' | 'showReset'> {
212
212
  code?: string;
213
213
  url?: string;
214
214
  form?: FormInstance<Values>;
@@ -230,7 +230,7 @@ interface QueryListProps<Item extends AnyObject = AnyObject, Values = AnyObject,
230
230
  getDataSource?: (data: Data | undefined, form: FormInstance<Values>) => Item[] | undefined;
231
231
  footer?: (data: Data | undefined) => ReactNode;
232
232
  }
233
- declare const QueryList: <Item extends AnyObject = AnyObject, Values extends object | undefined = undefined, Data = any>(props: QueryListProps<Item, Values, Data> & {
233
+ declare const QueryList: <Item extends AnyObject = AnyObject, Data = any, Values extends object | undefined = undefined>(props: QueryListProps<Item, Values, Data> & {
234
234
  ref?: Ref<QueryListRef<Item, Values, Data>>;
235
235
  }) => ReactElement;
236
236
 
package/lib/index.js CHANGED
@@ -665,16 +665,19 @@ var init_hooks3 = __esm({
665
665
  "src/components/layout/hooks.ts"() {
666
666
  init_toolkitsProvider();
667
667
  useGames = () => {
668
- const { axios: axios2, gameApiV2 } = useToolkitsStore((s) => s);
669
- return useSWR6(gameApiV2 ? "/api/game/list" : "/api/usystem/game/all", async (url4) => {
670
- if (gameApiV2) {
671
- const response = await axios2(url4);
672
- return response.data.data.list ?? [];
673
- } else {
674
- const response = await axios2(url4);
675
- return response.data.data ?? [];
668
+ const { axios: axios2, gameApiV2, permissionVersion } = useToolkitsStore((s) => s);
669
+ return useSWR6(
670
+ permissionVersion !== "v1" /* V1 */ ? gameApiV2 ? "/api/game/list" : "/api/usystem/game/all" : null,
671
+ async (url4) => {
672
+ if (gameApiV2) {
673
+ const response = await axios2(url4);
674
+ return response.data.data.list ?? [];
675
+ } else {
676
+ const response = await axios2(url4);
677
+ return response.data.data ?? [];
678
+ }
676
679
  }
677
- });
680
+ );
678
681
  };
679
682
  useFindGame = (id2) => {
680
683
  const { data } = useGames();