react-toolkits 2.8.3 → 2.9.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 +12 -0
- package/lib/index.d.ts +43 -36
- package/lib/index.js +142 -192
- package/lib/index.js.map +1 -1
- package/locale/en_GB.d.ts +0 -1
- package/locale/en_GB.js +1 -1
- package/locale/en_GB.js.map +1 -1
- package/locale/hooks.d.ts +0 -1
- package/locale/hooks.js +11 -99
- package/locale/hooks.js.map +1 -1
- package/locale/index.d.ts +2 -9
- package/locale/index.js +13 -108
- package/locale/index.js.map +1 -1
- package/locale/ja_JP.d.ts +0 -1
- package/locale/ja_JP.js +1 -1
- package/locale/ja_JP.js.map +1 -1
- package/locale/ko_KR.d.ts +0 -1
- package/locale/ko_KR.js +1 -1
- package/locale/ko_KR.js.map +1 -1
- package/locale/zh_CN.d.ts +0 -1
- package/locale/zh_CN.js +1 -1
- package/locale/zh_CN.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/lib/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as react from 'react';
|
|
2
|
-
import { ReactNode, FC, PropsWithChildren, Key, ReactElement, Ref } from 'react';
|
|
3
1
|
import * as zustand from 'zustand';
|
|
2
|
+
import * as react from 'react';
|
|
3
|
+
import { FC, PropsWithChildren, Key, ReactNode, ReactElement, Ref } from 'react';
|
|
4
4
|
import { ParagraphProps } from 'antd/es/typography/Paragraph';
|
|
5
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
6
|
import { FormInstance, ButtonProps, ModalProps, FormProps } from 'antd';
|
|
@@ -13,6 +13,26 @@ import { AnyObject } from 'antd/es/_util/type';
|
|
|
13
13
|
import * as swr from 'swr';
|
|
14
14
|
import { MutatorCallback, MutatorOptions } from 'swr';
|
|
15
15
|
|
|
16
|
+
declare class RequestError extends Error {
|
|
17
|
+
status: number;
|
|
18
|
+
code?: number;
|
|
19
|
+
constructor(opts: {
|
|
20
|
+
message?: string;
|
|
21
|
+
status: number;
|
|
22
|
+
code?: number;
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
interface RequestOptions extends Omit<RequestInit, 'body'> {
|
|
26
|
+
body?: Record<string | number, any> | FormData | null;
|
|
27
|
+
params?: Record<string | number, any> | URLSearchParams | null;
|
|
28
|
+
responseType?: 'json' | 'blob' | 'text';
|
|
29
|
+
isGlobal?: boolean;
|
|
30
|
+
}
|
|
31
|
+
type RequestResponse<T> = Pick<Response, 'headers' | 'status' | 'statusText' | 'url'> & {
|
|
32
|
+
data: T;
|
|
33
|
+
};
|
|
34
|
+
declare function request<T = any, R = RequestResponse<T>>(url: string, opts?: RequestOptions): Promise<R>;
|
|
35
|
+
|
|
16
36
|
type Locale = {
|
|
17
37
|
global: {
|
|
18
38
|
noEntitlement: string;
|
|
@@ -40,7 +60,7 @@ type Locale = {
|
|
|
40
60
|
title: string;
|
|
41
61
|
thirdParty: string;
|
|
42
62
|
signInWithIDass: string;
|
|
43
|
-
|
|
63
|
+
unregistered: string;
|
|
44
64
|
welcome: string;
|
|
45
65
|
};
|
|
46
66
|
NotFound: {
|
|
@@ -102,15 +122,22 @@ type Locale = {
|
|
|
102
122
|
};
|
|
103
123
|
};
|
|
104
124
|
|
|
105
|
-
interface
|
|
125
|
+
interface ContextProps {
|
|
126
|
+
locale: Locale;
|
|
106
127
|
usePermissionApiV2: boolean;
|
|
107
|
-
|
|
108
|
-
|
|
128
|
+
interceptor?: {
|
|
129
|
+
response?: (response: Response, opts: RequestOptions) => Promise<any>;
|
|
130
|
+
};
|
|
109
131
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
declare const
|
|
132
|
+
interface ContextState extends ContextProps {
|
|
133
|
+
setContext: (props: Partial<ContextProps>) => void;
|
|
134
|
+
}
|
|
135
|
+
declare const createContextStore: (initProps?: Partial<ContextProps>) => zustand.StoreApi<ContextState>;
|
|
136
|
+
type ContextStore = ReturnType<typeof createContextStore>;
|
|
137
|
+
declare let contextStore: ContextStore;
|
|
138
|
+
declare function useToolkitsContext<T>(selector: (state: ContextState) => T): T;
|
|
139
|
+
type ContextProviderProps = PropsWithChildren<Partial<ContextProps>>;
|
|
140
|
+
declare const ContextProvider: FC<ContextProviderProps>;
|
|
114
141
|
|
|
115
142
|
interface DynamicTagsProps {
|
|
116
143
|
initialTags?: string[];
|
|
@@ -252,26 +279,6 @@ interface PermissionGuardProps {
|
|
|
252
279
|
}
|
|
253
280
|
declare const PermissionGuard: FC<PropsWithChildren<PermissionGuardProps>>;
|
|
254
281
|
|
|
255
|
-
declare class RequestError extends Error {
|
|
256
|
-
status: number;
|
|
257
|
-
code?: number;
|
|
258
|
-
constructor(opts: {
|
|
259
|
-
message?: string;
|
|
260
|
-
status: number;
|
|
261
|
-
code?: number;
|
|
262
|
-
});
|
|
263
|
-
}
|
|
264
|
-
interface RequestOptions extends Omit<RequestInit, 'body'> {
|
|
265
|
-
body?: Record<string | number, any> | FormData | null;
|
|
266
|
-
params?: Record<string | number, any> | URLSearchParams | null;
|
|
267
|
-
responseType?: 'json' | 'blob' | 'text';
|
|
268
|
-
isGlobal?: boolean;
|
|
269
|
-
}
|
|
270
|
-
type RequestResponse<T> = Pick<Response, 'headers' | 'status' | 'statusText' | 'url'> & {
|
|
271
|
-
data: T;
|
|
272
|
-
};
|
|
273
|
-
declare function request<T = any>(url: string, opts?: RequestOptions): Promise<RequestResponse<T>>;
|
|
274
|
-
|
|
275
282
|
interface ListResponse<T = any> {
|
|
276
283
|
list: T[];
|
|
277
284
|
total: number;
|
|
@@ -337,8 +344,6 @@ interface UserWidgetProps {
|
|
|
337
344
|
}
|
|
338
345
|
declare const UserWidget: FC<UserWidgetProps>;
|
|
339
346
|
|
|
340
|
-
declare const NOT_REGISTERED = "notRegistered";
|
|
341
|
-
|
|
342
347
|
interface ModalState {
|
|
343
348
|
open: Map<number, boolean>;
|
|
344
349
|
getOpen: (uuid: number) => boolean;
|
|
@@ -416,9 +421,9 @@ declare const useTokenStore: zustand.UseBoundStore<Omit<zustand.StoreApi<TokenSt
|
|
|
416
421
|
}>>;
|
|
417
422
|
};
|
|
418
423
|
}>;
|
|
419
|
-
declare function useTokenValidation(
|
|
420
|
-
|
|
421
|
-
}>;
|
|
424
|
+
declare function useTokenValidation(options?: {
|
|
425
|
+
skip: false;
|
|
426
|
+
}): swr.SWRResponse<RequestResponse<any>, any, any>;
|
|
422
427
|
|
|
423
428
|
interface NotFoundProps {
|
|
424
429
|
redirectUrl?: string;
|
|
@@ -432,9 +437,11 @@ declare const PermissionRoutes: () => react_jsx_runtime.JSX.Element;
|
|
|
432
437
|
interface SignInProps {
|
|
433
438
|
title?: ReactNode;
|
|
434
439
|
successRedirectUrl: string;
|
|
440
|
+
extra?: ReactNode;
|
|
441
|
+
unregistered?: boolean;
|
|
435
442
|
}
|
|
436
443
|
declare const SignIn: FC<SignInProps>;
|
|
437
444
|
|
|
438
445
|
declare const mixedStorage: StateStorage;
|
|
439
446
|
|
|
440
|
-
export { ContextProvider, type ContextState, DynamicTags, type DynamicTagsProps, ExpandableParagraph, FilterFormWrapper, type FilterFormWrapperProps, type Game, Highlight, type HighlightTextsProps, InfiniteList, type InfiniteListProps, Layout,
|
|
447
|
+
export { ContextProvider, type ContextState, DynamicTags, type DynamicTagsProps, ExpandableParagraph, FilterFormWrapper, type FilterFormWrapperProps, type Game, Highlight, type HighlightTextsProps, InfiniteList, type InfiniteListProps, Layout, NavMenu, type NavMenuItem, NotFound, OperationLogList, PermissionButton, type PermissionButtonProps, PermissionGuard, type PermissionGuardProps, PermissionRoutes, QueryList, QueryListAction, type QueryListProps, type QueryListRef, RequestError, type RequestOptions, type RequestResponse, SignIn, type TokenState, type UseFormModalProps, UserWidget, contextStore, mixedStorage, request, useFormModal, useGameStore, useModal, useModalStore, usePermission, usePermissions, useQueryListStore, useTokenStore, useTokenValidation, useToolkitsContext };
|