react-toolkits 0.4.4 → 0.5.0

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.
@@ -1,360 +1,407 @@
1
- import * as zustand from 'zustand';
2
- import * as react_jsx_runtime from 'react/jsx-runtime';
3
- import * as zustand_middleware from 'zustand/middleware';
4
- import * as react from 'react';
5
- import { ReactNode, FC, PropsWithChildren, Key, Ref, ReactElement, ComponentType } from 'react';
6
- import { MenuDividerType, MenuItemType, SubMenuType, MenuItemGroupType } from 'antd/es/menu/hooks/useItems';
7
- import { Merge } from 'ts-essentials';
8
- import { FormInstance, ButtonProps, ModalFuncProps } from 'antd';
9
- import { TableProps } from 'antd/es/table';
10
- import { NamePath } from 'antd/es/form/interface';
11
- import { MutatorCallback, MutatorOptions } from 'swr/_internal';
12
- import { StateStorage } from 'zustand/esm/middleware';
13
-
14
- interface Game {
15
- id: string;
16
- name: string;
17
- area: 'cn' | 'global';
18
- Ctime: string;
19
- }
20
- interface GameState {
21
- game: Game | null;
22
- setGame: (game: Game | null) => void;
23
- }
24
- declare const useGameStore: zustand.UseBoundStore<Omit<zustand.StoreApi<GameState>, "persist"> & {
25
- persist: {
26
- setOptions: (options: Partial<zustand_middleware.PersistOptions<GameState, unknown>>) => void;
27
- clearStorage: () => void;
28
- rehydrate: () => void | Promise<void>;
29
- hasHydrated: () => boolean;
30
- onHydrate: (fn: (state: GameState) => void) => () => void;
31
- onFinishHydration: (fn: (state: GameState) => void) => () => void;
32
- getOptions: () => Partial<zustand_middleware.PersistOptions<GameState, unknown>>;
33
- };
34
- }>;
35
- declare const GameSelect: () => react_jsx_runtime.JSX.Element;
36
-
37
- type Locale = {
38
- global: {
39
- noEntitlement: string;
40
- name: string;
41
- creationTime: string;
42
- operation: string;
43
- update: string;
44
- edit: string;
45
- delete: string;
46
- selectAll: string;
47
- game: string;
48
- user: string;
49
- role: string;
50
- username: string;
51
- label: string;
52
- method: string;
53
- route: string;
54
- request: string;
55
- response: string;
56
- add: string;
57
- };
58
- Login: {
59
- title: string;
60
- thirdParty: string;
61
- loginWithIDass: string;
62
- notRegistered: string;
63
- };
64
- NotFound: {
65
- subTitle: string;
66
- buttonText: string;
67
- };
68
- FilterFormWrapper: {
69
- confirmText: string;
70
- resetText: string;
71
- };
72
- FormModal: {
73
- confirmText: string;
74
- cancelText: string;
75
- };
76
- GameSelect: {
77
- label: string;
78
- placeholder: string;
79
- };
80
- RequireGame: {
81
- description: string;
82
- };
83
- UserWidget: {
84
- signOutText: string;
85
- };
86
- UserList: {
87
- createTitle: string;
88
- createSuccessfully: string;
89
- updateTitle: string;
90
- updateSuccessfully: string;
91
- deleteTitle: string;
92
- deleteContent: string;
93
- deleteSuccessfully: string;
94
- };
95
- RoleList: {
96
- createTitle: string;
97
- createSuccessfully: string;
98
- updateTitle: string;
99
- updateSuccessfully: string;
100
- deleteTitle: string;
101
- deleteContent: string;
102
- deleteSuccessfully: string;
103
- };
104
- PermissionList: {
105
- failedDescription: string;
106
- baseSectionTitle: string;
107
- gameSectionTitle: string;
108
- gameSectionDescription: string;
109
- gameSelectPlaceholder: string;
110
- removeText: string;
111
- addText: string;
112
- };
113
- RoleDetail: {
114
- title: string;
115
- };
116
- InfiniteList: {
117
- loadingText: string;
118
- reachEndText: string;
119
- loadMoreText: string;
120
- };
121
- };
122
-
123
- type MenuItemType2 = Merge<MenuItemType, {
124
- code?: string;
125
- route?: string;
126
- }>;
127
- type SubMenuType2 = Merge<SubMenuType, {
128
- children?: NavMenuItem[];
129
- }>;
130
- type MenuItemGroupType2 = Merge<MenuItemGroupType, {
131
- children?: NavMenuItem[];
132
- }>;
133
- type NavMenuItem = MenuItemType2 | SubMenuType2 | MenuItemGroupType2 | MenuDividerType | null;
134
- declare const NavMenu: react.NamedExoticComponent<object>;
135
-
136
- interface ContextState {
137
- title: string;
138
- menuItems: NavMenuItem[];
139
- hideGameSelect: boolean;
140
- usePermissionApiV2: boolean;
141
- gameFilter?: (game: Game) => boolean;
142
- locale?: Locale;
143
- localeDropdownMenu?: ReactNode;
144
- }
145
- declare const contextStore: zustand.StoreApi<ContextState>;
146
- declare function useToolkitsContext(): ContextState;
147
- declare const ContextProvider: FC<PropsWithChildren<Partial<ContextState>>>;
148
-
149
- interface DynamicTagsProps {
150
- initialTags?: string[];
151
- addable?: boolean;
152
- removable?: boolean;
153
- addCallback?: (addedTag: string) => Promise<boolean>;
154
- removeCallback?: (removedTag: string) => Promise<boolean>;
155
- }
156
- declare const DynamicTags: FC<DynamicTagsProps>;
157
-
158
- interface FilterFormWrapperProps extends PropsWithChildren {
159
- confirmText?: ReactNode;
160
- onConfirm?: () => void | Promise<void>;
161
- onReset?: () => void;
162
- extras?: {
163
- key: Key;
164
- children: ReactNode;
165
- }[];
166
- }
167
- declare const FilterFormWrapper: (props: FilterFormWrapperProps) => react_jsx_runtime.JSX.Element;
168
-
169
- interface HighlightTextsProps extends PropsWithChildren {
170
- texts: Array<string | number>;
171
- }
172
- declare const Highlight: (props: HighlightTextsProps) => react_jsx_runtime.JSX.Element;
173
-
174
- interface InfiniteListExtra<Values> {
175
- key: Key;
176
- children: ReactNode | ((form: FormInstance<Values>) => ReactNode);
177
- }
178
- interface InfiniteListProps<Item, Values, Response> extends Pick<TableProps<Item>, 'columns' | 'rowKey' | 'tableLayout' | 'expandable' | 'rowSelection' | 'bordered'> {
179
- url: string;
180
- getRowKey: (response: Response) => any;
181
- getDataSource: (data: Response[] | undefined) => Item[];
182
- code?: string;
183
- headers?: Record<string, string> | ((form: FormInstance<Values>) => Record<string, string>);
184
- renderForm?: (form: FormInstance<Values>) => ReactNode;
185
- transformArg: (values: Values | undefined, rowKey?: string) => Record<any, any>;
186
- hasMore?: (data: Response[] | undefined) => boolean;
187
- isGlobalNS?: boolean;
188
- extras?: InfiniteListExtra<Values>[];
189
- }
190
- declare const InfiniteList: <Item extends object, Values extends object | undefined = undefined, Response_1 = any>(props: InfiniteListProps<Item, Values, Response_1>) => react_jsx_runtime.JSX.Element;
191
-
192
- interface LayoutProps extends PropsWithChildren {
193
- extras?: {
194
- key: Key;
195
- children: ReactNode;
196
- }[];
197
- }
198
- declare const Layout: FC<LayoutProps>;
199
-
200
- interface PermissionButtonProps extends Omit<ButtonProps, 'disabled'> {
201
- code: string;
202
- showLoading?: boolean;
203
- isGlobalNS?: boolean;
204
- }
205
- declare const PermissionButton: FC<PropsWithChildren<PermissionButtonProps>>;
206
-
207
- interface PermissionGuardProps {
208
- code: string;
209
- }
210
- declare const PermissionGuard: FC<PropsWithChildren<PermissionGuardProps>>;
211
-
212
- interface ListResponse<T = any> {
213
- list: T[];
214
- total: number;
215
- }
216
-
217
- type RecursivePartial$1<T> = NonNullable<T> extends object ? {
218
- [P in keyof T]?: NonNullable<T[P]> extends (infer U)[] ? RecursivePartial$1<U>[] : NonNullable<T[P]> extends object ? RecursivePartial$1<T[P]> : T[P];
219
- } : T;
220
- declare enum QueryListAction {
221
- Confirm = "confirm",
222
- Reset = "reset",
223
- Jump = "jump",
224
- Init = "init"
225
- }
226
- interface QueryListRef<Values = any> {
227
- form: FormInstance<Values>;
228
- setFieldValue: (name: NamePath, value: any) => void;
229
- setFieldsValue: (values: RecursivePartial$1<Values>) => void;
230
- }
231
- interface QueryListProps<Item = any, Values = any, Response = any> extends Pick<TableProps<Item>, 'columns' | 'rowKey' | 'tableLayout' | 'expandable' | 'rowSelection' | 'bordered'> {
232
- url: string;
233
- renderForm?: (form: FormInstance<Values>) => ReactNode;
234
- code?: string;
235
- isGlobalNS?: boolean;
236
- headers?: Record<string, string> | ((form: FormInstance<Values>) => Record<string, string>);
237
- transformArg?: (page: number, size: number, values: Values | undefined) => unknown;
238
- transformResponse?: (response: Response) => ListResponse<Item>;
239
- afterSuccess?: (response: ListResponse<Item>, action?: QueryListAction) => void;
240
- confirmText?: ReactNode;
241
- noPagination?: boolean;
242
- extra?: (response: Response | undefined, form: FormInstance<Values>) => ReactNode;
243
- }
244
- declare const QueryList: <Item extends object, Values extends object | undefined, Response_1 = ListResponse<Item>>(props: QueryListProps<Item, Values, Response_1> & {
245
- ref?: Ref<QueryListRef<Values>> | undefined;
246
- }) => ReactElement;
247
-
248
- declare const RequireGame: FC<PropsWithChildren>;
249
-
250
- declare const UserWidget: FC;
251
-
252
- type RecursivePartial<T> = NonNullable<T> extends object ? {
253
- [P in keyof T]?: NonNullable<T[P]> extends (infer U)[] ? RecursivePartial<U>[] : NonNullable<T[P]> extends object ? RecursivePartial<T[P]> : T[P];
254
- } : T;
255
- interface UseFormModalProps<Values> extends Omit<ModalFuncProps, 'icon' | 'className' | 'content' | 'type' | 'onOk' | 'onCancel'> {
256
- content?: (form: FormInstance<Values>) => ReactNode;
257
- onConfirm?: (values: Values, form: FormInstance<Values>, extraValues: any) => Promise<void>;
258
- onCancel?: (form: FormInstance<Values>) => void;
259
- }
260
- declare function useFormModal<Values>(props: UseFormModalProps<Values>): {
261
- show: (scopedProps?: Partial<Pick<UseFormModalProps<Values>, 'title'> & {
262
- initialValues?: RecursivePartial<Values>;
263
- extraValues?: any;
264
- }>) => {
265
- destroy: () => void;
266
- update: (configUpdate: ModalFuncProps | ((prevConfig: ModalFuncProps) => ModalFuncProps)) => void;
267
- } & {
268
- then<T>(resolve: (confirmed: boolean) => T, reject: VoidFunction): Promise<T>;
269
- };
270
- form: FormInstance<Values>;
271
- contextHolder: react_jsx_runtime.JSX.Element;
272
- };
273
-
274
- declare function usePermissions(codes: string[], opts?: {
275
- isGlobalNS?: boolean;
276
- suspense?: boolean;
277
- }): {
278
- data: Record<string, boolean> | undefined;
279
- isValidating: boolean;
280
- isLoading: boolean;
281
- };
282
- declare function usePermission(code: string | undefined, opts?: {
283
- isGlobalNS?: boolean;
284
- suspense?: boolean;
285
- }): {
286
- accessible: boolean;
287
- isValidating: boolean;
288
- isLoading: boolean;
289
- };
290
-
291
- type QueryListMutator = <T = any>(key: string, payload?: Partial<{
292
- page: number;
293
- size: number;
294
- }>, data?: ListResponse<T> | Promise<ListResponse<T>> | MutatorCallback<ListResponse<T>>, opts?: MutatorOptions<ListResponse<T>>) => void;
295
- interface QueryListState {
296
- keyMap: Map<string, string | null>;
297
- paginationMap: Map<string, {
298
- page: number;
299
- size: number;
300
- }>;
301
- mutate: QueryListMutator;
302
- }
303
- declare const useQueryListStore: zustand.UseBoundStore<zustand.StoreApi<QueryListState>>;
304
-
305
- interface UserInfo {
306
- authorityId: string;
307
- exp: number;
308
- }
309
- interface TokenState {
310
- token: string;
311
- getUser: () => UserInfo | null;
312
- setToken: (token: string) => void;
313
- clearToken: () => void;
314
- }
315
- declare const useTokenStore: zustand.UseBoundStore<Omit<zustand.StoreApi<TokenState>, "persist"> & {
316
- persist: {
317
- setOptions: (options: Partial<zustand_middleware.PersistOptions<TokenState, {
318
- token: string;
319
- }>>) => void;
320
- clearStorage: () => void;
321
- rehydrate: () => void | Promise<void>;
322
- hasHydrated: () => boolean;
323
- onHydrate: (fn: (state: TokenState) => void) => () => void;
324
- onFinishHydration: (fn: (state: TokenState) => void) => () => void;
325
- getOptions: () => Partial<zustand_middleware.PersistOptions<TokenState, {
326
- token: string;
327
- }>>;
328
- };
329
- }>;
330
- declare function useValidateToken(skip: boolean): void;
331
-
332
- type Join<K, P> = K extends string | number ? P extends string | number ? `${K}${'' extends P ? '' : '.'}${P}` : never : never;
333
- type Paths<T, D extends number = 10> = [D] extends [never] ? never : T extends object ? {
334
- [K in keyof T]-?: K extends string | number ? `${K}` | Join<K, Paths<T[K]>> : never;
335
- }[keyof T] : '';
336
- declare function useTranslation(): (key: Paths<Locale>, data?: Record<string, unknown>) => string;
337
-
338
- declare class RequestError extends Error {
339
- status?: number;
340
- constructor(opts?: {
341
- message?: string;
342
- status?: number;
343
- });
344
- }
345
- interface RequestOptions extends Omit<RequestInit, 'body'> {
346
- body?: Record<string | number, any> | FormData | null;
347
- params?: Record<string | number, any> | URLSearchParams | null;
348
- responseType?: 'json' | 'blob';
349
- isGlobalNS?: boolean;
350
- }
351
- type RequestResponse<T> = Pick<Response, 'headers' | 'status' | 'statusText' | 'url'> & {
352
- data: T;
353
- };
354
- declare function request<T = any>(url: string, opts?: RequestOptions): Promise<RequestResponse<T>>;
355
-
356
- declare function withBaseRoutes(WrappedComponent: ComponentType, props?: Partial<Omit<ContextState, 'hideGameSelect'>>): () => react_jsx_runtime.JSX.Element;
357
-
358
- declare const mixedStorage: StateStorage;
359
-
360
- export { ContextProvider, type ContextState, DynamicTags, type DynamicTagsProps, FilterFormWrapper, type FilterFormWrapperProps, type Game, GameSelect, type GameState, Highlight, type HighlightTextsProps, InfiniteList, type InfiniteListProps, Layout, type LayoutProps, type Locale, NavMenu, type NavMenuItem, PermissionButton, type PermissionButtonProps, PermissionGuard, type PermissionGuardProps, QueryList, QueryListAction, type QueryListProps, type QueryListRef, RequestError, RequireGame, type TokenState, type UseFormModalProps, UserWidget, contextStore, mixedStorage, request, useFormModal, useGameStore, usePermission, usePermissions, useQueryListStore, useTokenStore, useToolkitsContext, useTranslation, useValidateToken, withBaseRoutes };
1
+ import type { ButtonProps } from 'antd';
2
+ import type { FC } from 'react';
3
+ import type { FormInstance } from 'antd';
4
+ import { JSX as JSX_2 } from 'react/jsx-runtime';
5
+ import type { Key } from 'react';
6
+ import type { MenuDividerType } from 'antd/es/menu/hooks/useItems';
7
+ import type { MenuItemGroupType } from 'antd/es/menu/hooks/useItems';
8
+ import type { MenuItemType } from 'antd/es/menu/hooks/useItems';
9
+ import type { Merge } from 'ts-essentials';
10
+ import type { ModalFuncProps } from 'antd';
11
+ import type { MutatorCallback } from 'swr/_internal';
12
+ import type { MutatorOptions } from 'swr/_internal';
13
+ import { NamedExoticComponent } from 'react';
14
+ import type { NamePath } from 'antd/es/form/interface';
15
+ import { PersistOptions } from 'zustand/middleware';
16
+ import type { PropsWithChildren } from 'react';
17
+ import type { ReactElement } from 'react';
18
+ import type { ReactNode } from 'react';
19
+ import type { Ref } from 'react';
20
+ import type { StateStorage } from 'zustand/middleware';
21
+ import { StoreApi } from 'zustand';
22
+ import type { SubMenuType } from 'antd/es/menu/hooks/useItems';
23
+ import type { TableProps } from 'antd/es/table';
24
+ import { UseBoundStore } from 'zustand';
25
+
26
+ export declare const ContextProvider: FC<PropsWithChildren<Partial<ContextState>>>;
27
+
28
+ export declare interface ContextState {
29
+ title: string;
30
+ menuItems: NavMenuItem[];
31
+ hideGameSelect: boolean;
32
+ usePermissionApiV2: boolean;
33
+ gameFilter?: (game: Game) => boolean;
34
+ locale?: Locale;
35
+ localeDropdownMenu?: ReactNode;
36
+ }
37
+
38
+ export declare const contextStore: StoreApi<ContextState>;
39
+
40
+ export declare const DynamicTags: FC<DynamicTagsProps>;
41
+
42
+ export declare interface DynamicTagsProps {
43
+ initialTags?: string[];
44
+ addable?: boolean;
45
+ removable?: boolean;
46
+ addCallback?: (addedTag: string) => Promise<boolean>;
47
+ removeCallback?: (removedTag: string) => Promise<boolean>;
48
+ }
49
+
50
+ export declare const FilterFormWrapper: (props: FilterFormWrapperProps) => JSX_2.Element;
51
+
52
+ export declare interface FilterFormWrapperProps extends PropsWithChildren {
53
+ confirmText?: ReactNode;
54
+ onConfirm?: () => void | Promise<void>;
55
+ onReset?: () => void;
56
+ extras?: {
57
+ key: Key;
58
+ children: ReactNode;
59
+ }[];
60
+ }
61
+
62
+ export declare interface Game {
63
+ id: string;
64
+ name: string;
65
+ area: 'cn' | 'global';
66
+ Ctime: string;
67
+ }
68
+
69
+ export declare const GameSelect: () => JSX_2.Element;
70
+
71
+ export declare interface GameState {
72
+ game: Game | null;
73
+ setGame: (game: Game | null) => void;
74
+ }
75
+
76
+ export declare const Highlight: (props: HighlightTextsProps) => JSX_2.Element;
77
+
78
+ export declare interface HighlightTextsProps extends PropsWithChildren {
79
+ texts: Array<string | number>;
80
+ }
81
+
82
+ export declare const InfiniteList: <Item extends object, Values extends object | undefined = undefined, Response_1 = any>(props: InfiniteListProps<Item, Values, Response_1>) => JSX_2.Element;
83
+
84
+ declare interface InfiniteListExtra<Values> {
85
+ key: Key;
86
+ children: ReactNode | ((form: FormInstance<Values>) => ReactNode);
87
+ }
88
+
89
+ export declare interface InfiniteListProps<Item, Values, Response> extends Pick<TableProps<Item>, 'columns' | 'rowKey' | 'tableLayout' | 'expandable' | 'rowSelection' | 'bordered'> {
90
+ url: string;
91
+ getRowKey: (response: Response) => any;
92
+ getDataSource: (data: Response[] | undefined) => Item[];
93
+ code?: string;
94
+ headers?: Record<string, string> | ((form: FormInstance<Values>) => Record<string, string>);
95
+ renderForm?: (form: FormInstance<Values>) => ReactNode;
96
+ transformArg: (values: Values | undefined, rowKey?: string) => Record<any, any>;
97
+ hasMore?: (data: Response[] | undefined) => boolean;
98
+ isGlobalNS?: boolean;
99
+ extras?: InfiniteListExtra<Values>[];
100
+ }
101
+
102
+ declare type Join<K, P> = K extends string | number ? P extends string | number ? `${K}${'' extends P ? '' : '.'}${P}` : never : never;
103
+
104
+ export declare const Layout: FC<LayoutProps>;
105
+
106
+ export declare interface LayoutProps extends PropsWithChildren {
107
+ extras?: {
108
+ key: Key;
109
+ children: ReactNode;
110
+ }[];
111
+ }
112
+
113
+ declare interface ListResponse<T = any> {
114
+ list: T[];
115
+ total: number;
116
+ }
117
+
118
+ export declare type Locale = {
119
+ global: {
120
+ noEntitlement: string;
121
+ name: string;
122
+ creationTime: string;
123
+ operation: string;
124
+ update: string;
125
+ edit: string;
126
+ delete: string;
127
+ selectAll: string;
128
+ game: string;
129
+ user: string;
130
+ role: string;
131
+ username: string;
132
+ label: string;
133
+ method: string;
134
+ route: string;
135
+ request: string;
136
+ response: string;
137
+ add: string;
138
+ };
139
+ Login: {
140
+ title: string;
141
+ thirdParty: string;
142
+ loginWithIDass: string;
143
+ notRegistered: string;
144
+ };
145
+ NotFound: {
146
+ subTitle: string;
147
+ buttonText: string;
148
+ };
149
+ FilterFormWrapper: {
150
+ confirmText: string;
151
+ resetText: string;
152
+ };
153
+ FormModal: {
154
+ confirmText: string;
155
+ cancelText: string;
156
+ };
157
+ GameSelect: {
158
+ label: string;
159
+ placeholder: string;
160
+ };
161
+ RequireGame: {
162
+ description: string;
163
+ };
164
+ UserWidget: {
165
+ signOutText: string;
166
+ };
167
+ UserList: {
168
+ createTitle: string;
169
+ createSuccessfully: string;
170
+ updateTitle: string;
171
+ updateSuccessfully: string;
172
+ deleteTitle: string;
173
+ deleteContent: string;
174
+ deleteSuccessfully: string;
175
+ };
176
+ RoleList: {
177
+ createTitle: string;
178
+ createSuccessfully: string;
179
+ updateTitle: string;
180
+ updateSuccessfully: string;
181
+ deleteTitle: string;
182
+ deleteContent: string;
183
+ deleteSuccessfully: string;
184
+ };
185
+ PermissionList: {
186
+ failedDescription: string;
187
+ baseSectionTitle: string;
188
+ gameSectionTitle: string;
189
+ gameSectionDescription: string;
190
+ gameSelectPlaceholder: string;
191
+ removeText: string;
192
+ addText: string;
193
+ };
194
+ RoleDetail: {
195
+ title: string;
196
+ };
197
+ InfiniteList: {
198
+ loadingText: string;
199
+ reachEndText: string;
200
+ loadMoreText: string;
201
+ };
202
+ };
203
+
204
+ declare type MenuItemGroupType2 = Merge<MenuItemGroupType, {
205
+ children?: NavMenuItem[];
206
+ }>;
207
+
208
+ declare type MenuItemType2 = Merge<MenuItemType, {
209
+ code?: string;
210
+ route?: string;
211
+ }>;
212
+
213
+ export declare const mixedStorage: StateStorage;
214
+
215
+ export declare const NavMenu: NamedExoticComponent<object>;
216
+
217
+ export declare type NavMenuItem = MenuItemType2 | SubMenuType2 | MenuItemGroupType2 | MenuDividerType | null;
218
+
219
+ declare type Paths<T, D extends number = 10> = [D] extends [never] ? never : T extends object ? {
220
+ [K in keyof T]-?: K extends string | number ? `${K}` | Join<K, Paths<T[K]>> : never;
221
+ }[keyof T] : '';
222
+
223
+ export declare const PermissionButton: FC<PropsWithChildren<PermissionButtonProps>>;
224
+
225
+ export declare interface PermissionButtonProps extends Omit<ButtonProps, 'disabled'> {
226
+ code: string;
227
+ showLoading?: boolean;
228
+ isGlobalNS?: boolean;
229
+ }
230
+
231
+ export declare const PermissionGuard: FC<PropsWithChildren<PermissionGuardProps>>;
232
+
233
+ export declare interface PermissionGuardProps {
234
+ code: string;
235
+ }
236
+
237
+ export declare const QueryList: <Item extends object, Values extends object | undefined, Response_1 = ListResponse<Item>>(props: QueryListProps<Item, Values, Response_1> & {
238
+ ref?: Ref<QueryListRef<Values>> | undefined;
239
+ }) => ReactElement;
240
+
241
+ export declare enum QueryListAction {
242
+ Confirm = "confirm",
243
+ Reset = "reset",
244
+ Jump = "jump",
245
+ Init = "init"
246
+ }
247
+
248
+ declare type QueryListMutator = <T = any>(key: string, payload?: Partial<{
249
+ page: number;
250
+ size: number;
251
+ }>, data?: ListResponse<T> | Promise<ListResponse<T>> | MutatorCallback<ListResponse<T>>, opts?: MutatorOptions<ListResponse<T>>) => void;
252
+
253
+ export declare interface QueryListProps<Item = any, Values = any, Response = any> extends Pick<TableProps<Item>, 'columns' | 'rowKey' | 'tableLayout' | 'expandable' | 'rowSelection' | 'bordered'> {
254
+ url: string;
255
+ renderForm?: (form: FormInstance<Values>) => ReactNode;
256
+ code?: string;
257
+ isGlobalNS?: boolean;
258
+ headers?: Record<string, string> | ((form: FormInstance<Values>) => Record<string, string>);
259
+ transformArg?: (page: number, size: number, values: Values | undefined) => unknown;
260
+ transformResponse?: (response: Response) => ListResponse<Item>;
261
+ afterSuccess?: (response: ListResponse<Item>, action?: QueryListAction) => void;
262
+ confirmText?: ReactNode;
263
+ noPagination?: boolean;
264
+ extra?: (response: Response | undefined, form: FormInstance<Values>) => ReactNode;
265
+ }
266
+
267
+ export declare interface QueryListRef<Values = any> {
268
+ form: FormInstance<Values>;
269
+ setFieldValue: (name: NamePath, value: any) => void;
270
+ setFieldsValue: (values: RecursivePartial_2<Values>) => void;
271
+ }
272
+
273
+ declare interface QueryListState {
274
+ keyMap: Map<string, string | null>;
275
+ paginationMap: Map<string, {
276
+ page: number;
277
+ size: number;
278
+ }>;
279
+ mutate: QueryListMutator;
280
+ }
281
+
282
+ declare type RecursivePartial<T> = NonNullable<T> extends object ? {
283
+ [P in keyof T]?: NonNullable<T[P]> extends (infer U)[] ? RecursivePartial<U>[] : NonNullable<T[P]> extends object ? RecursivePartial<T[P]> : T[P];
284
+ } : T;
285
+
286
+ declare type RecursivePartial_2<T> = NonNullable<T> extends object ? {
287
+ [P in keyof T]?: NonNullable<T[P]> extends (infer U)[] ? RecursivePartial_2<U>[] : NonNullable<T[P]> extends object ? RecursivePartial_2<T[P]> : T[P];
288
+ } : T;
289
+
290
+ export declare function request<T = any>(url: string, opts?: RequestOptions): Promise<RequestResponse<T>>;
291
+
292
+ export declare class RequestError extends Error {
293
+ status?: number;
294
+ constructor(opts?: {
295
+ message?: string;
296
+ status?: number;
297
+ });
298
+ }
299
+
300
+ declare interface RequestOptions extends Omit<RequestInit, 'body'> {
301
+ body?: Record<string | number, any> | FormData | null;
302
+ params?: Record<string | number, any> | URLSearchParams | null;
303
+ responseType?: 'json' | 'blob';
304
+ isGlobalNS?: boolean;
305
+ }
306
+
307
+ declare type RequestResponse<T> = Pick<Response, 'headers' | 'status' | 'statusText' | 'url'> & {
308
+ data: T;
309
+ };
310
+
311
+ export declare const RequireGame: FC<PropsWithChildren>;
312
+
313
+ declare type SubMenuType2 = Merge<SubMenuType, {
314
+ children?: NavMenuItem[];
315
+ }>;
316
+
317
+ export declare interface TokenState {
318
+ token: string;
319
+ getUser: () => UserInfo | null;
320
+ setToken: (token: string) => void;
321
+ clearToken: () => void;
322
+ }
323
+
324
+ export declare function useFormModal<Values>(props: UseFormModalProps<Values>): {
325
+ show: (scopedProps?: Partial<Pick<UseFormModalProps<Values>, 'title'> & {
326
+ initialValues?: RecursivePartial<Values>;
327
+ extraValues?: any;
328
+ }>) => {
329
+ destroy: () => void;
330
+ update: (configUpdate: ModalFuncProps | ((prevConfig: ModalFuncProps) => ModalFuncProps)) => void;
331
+ } & {
332
+ then<T>(resolve: (confirmed: boolean) => T, reject: VoidFunction): Promise<T>;
333
+ };
334
+ form: FormInstance<Values>;
335
+ contextHolder: JSX_2.Element;
336
+ };
337
+
338
+ export declare interface UseFormModalProps<Values> extends Omit<ModalFuncProps, 'icon' | 'className' | 'content' | 'type' | 'onOk' | 'onCancel'> {
339
+ content?: (form: FormInstance<Values>) => ReactNode;
340
+ onConfirm?: (values: Values, form: FormInstance<Values>, extraValues: any) => Promise<void>;
341
+ onCancel?: (form: FormInstance<Values>) => void;
342
+ }
343
+
344
+ export declare const useGameStore: UseBoundStore<Omit<StoreApi<GameState>, "persist"> & {
345
+ persist: {
346
+ setOptions: (options: Partial<PersistOptions<GameState, unknown>>) => void;
347
+ clearStorage: () => void;
348
+ rehydrate: () => void | Promise<void>;
349
+ hasHydrated: () => boolean;
350
+ onHydrate: (fn: (state: GameState) => void) => () => void;
351
+ onFinishHydration: (fn: (state: GameState) => void) => () => void;
352
+ getOptions: () => Partial<PersistOptions<GameState, unknown>>;
353
+ };
354
+ }>;
355
+
356
+ export declare function usePermission(code: string | undefined, opts?: {
357
+ isGlobalNS?: boolean;
358
+ suspense?: boolean;
359
+ }): {
360
+ accessible: boolean;
361
+ isValidating: boolean;
362
+ isLoading: boolean;
363
+ };
364
+
365
+ export declare function usePermissions(codes: string[], opts?: {
366
+ isGlobalNS?: boolean;
367
+ suspense?: boolean;
368
+ }): {
369
+ data: Record<string, boolean> | undefined;
370
+ isValidating: boolean;
371
+ isLoading: boolean;
372
+ };
373
+
374
+ export declare const useQueryListStore: UseBoundStore<StoreApi<QueryListState>>;
375
+
376
+ declare interface UserInfo {
377
+ authorityId: string;
378
+ exp: number;
379
+ }
380
+
381
+ export declare const UserWidget: FC;
382
+
383
+ export declare const useTokenStore: UseBoundStore<Omit<StoreApi<TokenState>, "persist"> & {
384
+ persist: {
385
+ setOptions: (options: Partial<PersistOptions<TokenState, {
386
+ token: string;
387
+ }>>) => void;
388
+ clearStorage: () => void;
389
+ rehydrate: () => void | Promise<void>;
390
+ hasHydrated: () => boolean;
391
+ onHydrate: (fn: (state: TokenState) => void) => () => void;
392
+ onFinishHydration: (fn: (state: TokenState) => void) => () => void;
393
+ getOptions: () => Partial<PersistOptions<TokenState, {
394
+ token: string;
395
+ }>>;
396
+ };
397
+ }>;
398
+
399
+ export declare function useToolkitsContext(): ContextState;
400
+
401
+ export declare function useTranslation(): (key: Paths<Locale>, data?: Record<string, unknown>) => string;
402
+
403
+ export declare function useValidateToken(skip: boolean): void;
404
+
405
+ export declare function withBaseRoutes(routes: ReactNode, props?: Partial<Omit<ContextState, 'hideGameSelect'>>): () => JSX_2.Element;
406
+
407
+ export { }