react-toolkits 2.13.20 → 2.13.21

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,11 @@
1
1
  # react-toolkits
2
2
 
3
+ ## 2.13.21
4
+
5
+ ### Patch Changes
6
+
7
+ - fe15d49: feat: mutate swr store after game changed
8
+
3
9
  ## 2.13.20
4
10
 
5
11
  ### Patch Changes
package/lib/index.d.ts CHANGED
@@ -7,12 +7,11 @@ import { AnyObject } from 'antd/es/_util/type';
7
7
  import { TableProps } from 'antd/es/table';
8
8
  import { AxiosHeaderValue, AxiosRequestConfig, AxiosInstance, InternalAxiosRequestConfig, AxiosResponse, AxiosInterceptorOptions } from 'axios';
9
9
  import * as swr from 'swr';
10
- import { MutatorCallback, MutatorOptions } from 'swr';
10
+ import { MutatorCallback, MutatorOptions, SWRResponse } from 'swr';
11
11
  import { ItemType, SubMenuType, MenuItemGroupType, MenuItemType } from 'antd/es/menu/interface';
12
12
  import { Merge } from 'ts-essentials';
13
- import * as zustand_middleware from 'zustand/middleware';
14
- import { StateStorage } from 'zustand/middleware';
15
13
  import * as zustand from 'zustand';
14
+ import { StateStorage } from 'zustand/middleware';
16
15
 
17
16
  interface DynamicTagsProps {
18
17
  initialTags?: string[];
@@ -131,22 +130,6 @@ interface LayoutProps extends Pick<GameSelectProps, 'filter'> {
131
130
  }
132
131
  declare const Layout: FC<PropsWithChildren<LayoutProps>>;
133
132
 
134
- interface LayoutState {
135
- collapsed: boolean;
136
- setCollapsed: (collapsed: boolean) => void;
137
- }
138
- declare const useLayoutStore: zustand.UseBoundStore<Omit<zustand.StoreApi<LayoutState>, "persist"> & {
139
- persist: {
140
- setOptions: (options: Partial<zustand_middleware.PersistOptions<LayoutState, unknown>>) => void;
141
- clearStorage: () => void;
142
- rehydrate: () => Promise<void> | void;
143
- hasHydrated: () => boolean;
144
- onHydrate: (fn: (state: LayoutState) => void) => () => void;
145
- onFinishHydration: (fn: (state: LayoutState) => void) => () => void;
146
- getOptions: () => Partial<zustand_middleware.PersistOptions<LayoutState, unknown>>;
147
- };
148
- }>;
149
-
150
133
  interface UseModalOperation {
151
134
  hide: () => void;
152
135
  }
@@ -395,11 +378,6 @@ interface GameSlice {
395
378
  setGameId: (id?: string | number) => void;
396
379
  }
397
380
 
398
- interface SignInSlice {
399
- unregistered: boolean;
400
- setUnregistered: () => void;
401
- }
402
-
403
381
  interface UserInfo {
404
382
  authorityId: string;
405
383
  exp: number;
@@ -410,7 +388,12 @@ interface TokenSlice {
410
388
  setToken: (token: string) => void;
411
389
  }
412
390
 
413
- type ToolkitsState = TokenSlice & GameSlice & ContextSlice & AxiosSlice & SignInSlice & {
391
+ interface LayoutSlice {
392
+ collapsed: boolean;
393
+ setCollapsed: (collapsed: boolean) => void;
394
+ }
395
+
396
+ type ToolkitsState = TokenSlice & GameSlice & ContextSlice & AxiosSlice & LayoutSlice & {
414
397
  clearToken: () => void;
415
398
  };
416
399
 
@@ -447,21 +430,9 @@ interface MenuListItem {
447
430
  ext: string;
448
431
  }
449
432
 
450
- declare const usePermissions: (codes?: string[], config?: AxiosRequestConfig) => {
451
- data: Record<string, boolean>;
452
- error: any;
453
- mutate: swr.KeyedMutator<{
454
- has_all: true;
455
- } | Record<string, boolean>>;
456
- isValidating: boolean;
457
- isLoading: boolean;
458
- };
459
- declare const usePermission: (code?: string, config?: AxiosRequestConfig) => {
460
- accessible: boolean;
461
- isValidating: boolean;
462
- isLoading: boolean;
463
- };
464
- declare function useMenuList(): swr.SWRResponse<MenuListItem[], any, any>;
433
+ declare function usePermission(code?: string, config?: AxiosRequestConfig): SWRResponse<boolean>;
434
+ declare function usePermission(code?: string[], config?: AxiosRequestConfig): SWRResponse<true> | SWRResponse<Record<string, boolean>>;
435
+ declare function useMenuList(): SWRResponse<MenuListItem[], any, any>;
465
436
 
466
437
  declare const _default$2: react_jsx_runtime.JSX.Element;
467
438
 
@@ -483,4 +454,4 @@ declare const SignIn: FC<SignInProps>;
483
454
 
484
455
  declare const mixedStorage: StateStorage;
485
456
 
486
- export { APP_ID_HEADER, DynamicTags, type DynamicTagsProps, ExpandableParagraph, type ExpandableParagraphProps, FRONTEND_ROUTE_PREFIX, FilterFormWrapper, type FilterFormWrapperProps, type Game, Highlight, type HighlightProps, InfiniteList, type InfiniteListProps, type InfiniteListRef, type JsonData, Layout, type LayoutProps, type LayoutState, type MenuListItem, NavMenu, type NavMenuItem, NotFound, _default$1 as OperationLogList, type Permission, PermissionButton, type PermissionButtonProps, PermissionVersion, QueryList, QueryListAction, type QueryListPayload, type QueryListProps, type QueryListRef, RequireGame, RequirePermission, type RequirePermissionProps, SSO_URL, SignIn, ToolkitsProvider, type ToolkitsProviderProps, type UseFormModalProps, UserWidget, WILDCARD, _default$2 as menuRoutes, mixedStorage, _default as permissionRoutes, useFindGame, useFormModal, useGames, useLayoutStore, useMenuList, useModal, useModalStore, usePermission, usePermissions, useQueryListStore, useToolkitsStore, withContext };
457
+ export { APP_ID_HEADER, DynamicTags, type DynamicTagsProps, ExpandableParagraph, type ExpandableParagraphProps, FRONTEND_ROUTE_PREFIX, FilterFormWrapper, type FilterFormWrapperProps, type Game, Highlight, type HighlightProps, InfiniteList, type InfiniteListProps, type InfiniteListRef, type JsonData, Layout, type LayoutProps, type MenuListItem, NavMenu, type NavMenuItem, NotFound, _default$1 as OperationLogList, type Permission, PermissionButton, type PermissionButtonProps, PermissionVersion, QueryList, QueryListAction, type QueryListPayload, type QueryListProps, type QueryListRef, RequireGame, RequirePermission, type RequirePermissionProps, SSO_URL, SignIn, ToolkitsProvider, type ToolkitsProviderProps, type UseFormModalProps, UserWidget, WILDCARD, _default$2 as menuRoutes, mixedStorage, _default as permissionRoutes, useFindGame, useFormModal, useGames, useMenuList, useModal, useModalStore, usePermission, useQueryListStore, useToolkitsStore, withContext };