react-toolkits 0.8.67 → 0.8.69

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