react-toolkits 2.4.14 → 2.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.
- package/CHANGELOG.md +6 -0
- package/lib/index.d.ts +33 -31
- package/lib/index.js +11 -11
- package/lib/index.js.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
package/lib/index.d.ts
CHANGED
|
@@ -13,26 +13,6 @@ 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>(url: string, opts?: RequestOptions): Promise<RequestResponse<T>>;
|
|
35
|
-
|
|
36
16
|
type Locale = {
|
|
37
17
|
global: {
|
|
38
18
|
noEntitlement: string;
|
|
@@ -123,15 +103,10 @@ type Locale = {
|
|
|
123
103
|
};
|
|
124
104
|
|
|
125
105
|
interface ContextState {
|
|
126
|
-
appTitle: ReactNode;
|
|
127
106
|
signInPageTitle?: ReactNode;
|
|
128
107
|
usePermissionApiV2: boolean;
|
|
129
108
|
locale?: Locale;
|
|
130
109
|
localeDropdownMenu?: ReactNode;
|
|
131
|
-
signInUrl: string;
|
|
132
|
-
signInSuccessRedirectUrl: string;
|
|
133
|
-
notFoundRedirectUrl?: string;
|
|
134
|
-
responseInterceptor?: (response: Response, opts: RequestOptions) => Promise<any>;
|
|
135
110
|
}
|
|
136
111
|
|
|
137
112
|
declare const contextStore: zustand.StoreApi<ContextState>;
|
|
@@ -241,13 +216,15 @@ type HeaderExtra = {
|
|
|
241
216
|
children: ReactNode;
|
|
242
217
|
};
|
|
243
218
|
interface LayoutProps extends Pick<GameSelectProps, 'filter' | 'onGameChange'> {
|
|
219
|
+
title?: ReactNode;
|
|
244
220
|
items?: NavMenuItem[];
|
|
245
221
|
hideGameSelect?: boolean;
|
|
222
|
+
navWidth?: string | number;
|
|
223
|
+
logoutRedirectUrl: string;
|
|
246
224
|
headerExtra?: {
|
|
247
225
|
left?: HeaderExtra[];
|
|
248
226
|
right?: HeaderExtra[];
|
|
249
227
|
};
|
|
250
|
-
navWidth?: string | number;
|
|
251
228
|
}
|
|
252
229
|
declare const Layout: FC<PropsWithChildren<LayoutProps>>;
|
|
253
230
|
|
|
@@ -276,6 +253,26 @@ interface PermissionGuardProps {
|
|
|
276
253
|
}
|
|
277
254
|
declare const PermissionGuard: FC<PropsWithChildren<PermissionGuardProps>>;
|
|
278
255
|
|
|
256
|
+
declare class RequestError extends Error {
|
|
257
|
+
status: number;
|
|
258
|
+
code?: number;
|
|
259
|
+
constructor(opts: {
|
|
260
|
+
message?: string;
|
|
261
|
+
status: number;
|
|
262
|
+
code?: number;
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
interface RequestOptions extends Omit<RequestInit, 'body'> {
|
|
266
|
+
body?: Record<string | number, any> | FormData | null;
|
|
267
|
+
params?: Record<string | number, any> | URLSearchParams | null;
|
|
268
|
+
responseType?: 'json' | 'blob' | 'text';
|
|
269
|
+
isGlobal?: boolean;
|
|
270
|
+
}
|
|
271
|
+
type RequestResponse<T> = Pick<Response, 'headers' | 'status' | 'statusText' | 'url'> & {
|
|
272
|
+
data: T;
|
|
273
|
+
};
|
|
274
|
+
declare function request<T = any>(url: string, opts?: RequestOptions): Promise<RequestResponse<T>>;
|
|
275
|
+
|
|
279
276
|
interface ListResponse<T = any> {
|
|
280
277
|
list: T[];
|
|
281
278
|
total: number;
|
|
@@ -333,7 +330,7 @@ interface QueryListState {
|
|
|
333
330
|
}
|
|
334
331
|
declare const useQueryListStore: zustand.UseBoundStore<zustand.StoreApi<QueryListState>>;
|
|
335
332
|
|
|
336
|
-
declare const
|
|
333
|
+
declare const NOT_REGISTERED = "notRegistered";
|
|
337
334
|
|
|
338
335
|
interface ModalState {
|
|
339
336
|
open: Map<number, boolean>;
|
|
@@ -416,15 +413,20 @@ declare function useTokenValidation(skip?: boolean): swr.SWRResponse<RequestResp
|
|
|
416
413
|
onError: (error: any) => void;
|
|
417
414
|
}>;
|
|
418
415
|
|
|
419
|
-
|
|
416
|
+
interface NotFoundProps {
|
|
417
|
+
redirectUrl?: string;
|
|
418
|
+
}
|
|
419
|
+
declare const NotFound: FC<NotFoundProps>;
|
|
420
420
|
|
|
421
421
|
declare const OperationLogList: FC;
|
|
422
422
|
|
|
423
423
|
declare const PermissionRoutes: () => react_jsx_runtime.JSX.Element;
|
|
424
424
|
|
|
425
|
-
|
|
426
|
-
|
|
425
|
+
interface SignInProps {
|
|
426
|
+
successRedirectUrl: string;
|
|
427
|
+
}
|
|
428
|
+
declare const SignIn: FC<SignInProps>;
|
|
427
429
|
|
|
428
430
|
declare const mixedStorage: StateStorage;
|
|
429
431
|
|
|
430
|
-
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,
|
|
432
|
+
export { ContextProvider, type ContextState, DynamicTags, type DynamicTagsProps, ExpandableParagraph, FilterFormWrapper, type FilterFormWrapperProps, type Game, Highlight, type HighlightTextsProps, InfiniteList, type InfiniteListProps, Layout, NOT_REGISTERED, 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, contextStore, mixedStorage, request, useFormModal, useGameStore, useModal, useModalStore, usePermission, usePermissions, useQueryListStore, useTokenStore, useTokenValidation, useToolkitsContext };
|