react-toolkits 2.4.14 → 2.6.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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # react-toolkits
2
2
 
3
+ ## 2.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - b57f1ca: feat: remove "signInPageTitle" prop
8
+
9
+ ## 2.5.0
10
+
11
+ ### Minor Changes
12
+
13
+ - f7f8ea8: feat: remove some props in ContextProvider
14
+
3
15
  ## 2.4.14
4
16
 
5
17
  ### Patch Changes
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,9 @@ type Locale = {
123
103
  };
124
104
 
125
105
  interface ContextState {
126
- appTitle: ReactNode;
127
- signInPageTitle?: ReactNode;
128
106
  usePermissionApiV2: boolean;
129
107
  locale?: Locale;
130
108
  localeDropdownMenu?: ReactNode;
131
- signInUrl: string;
132
- signInSuccessRedirectUrl: string;
133
- notFoundRedirectUrl?: string;
134
- responseInterceptor?: (response: Response, opts: RequestOptions) => Promise<any>;
135
109
  }
136
110
 
137
111
  declare const contextStore: zustand.StoreApi<ContextState>;
@@ -241,13 +215,15 @@ type HeaderExtra = {
241
215
  children: ReactNode;
242
216
  };
243
217
  interface LayoutProps extends Pick<GameSelectProps, 'filter' | 'onGameChange'> {
218
+ title?: ReactNode;
244
219
  items?: NavMenuItem[];
245
220
  hideGameSelect?: boolean;
221
+ navWidth?: string | number;
222
+ logoutRedirectUrl: string;
246
223
  headerExtra?: {
247
224
  left?: HeaderExtra[];
248
225
  right?: HeaderExtra[];
249
226
  };
250
- navWidth?: string | number;
251
227
  }
252
228
  declare const Layout: FC<PropsWithChildren<LayoutProps>>;
253
229
 
@@ -276,6 +252,26 @@ interface PermissionGuardProps {
276
252
  }
277
253
  declare const PermissionGuard: FC<PropsWithChildren<PermissionGuardProps>>;
278
254
 
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
+
279
275
  interface ListResponse<T = any> {
280
276
  list: T[];
281
277
  total: number;
@@ -333,7 +329,7 @@ interface QueryListState {
333
329
  }
334
330
  declare const useQueryListStore: zustand.UseBoundStore<zustand.StoreApi<QueryListState>>;
335
331
 
336
- declare const UserWidget: FC;
332
+ declare const NOT_REGISTERED = "notRegistered";
337
333
 
338
334
  interface ModalState {
339
335
  open: Map<number, boolean>;
@@ -416,15 +412,21 @@ declare function useTokenValidation(skip?: boolean): swr.SWRResponse<RequestResp
416
412
  onError: (error: any) => void;
417
413
  }>;
418
414
 
419
- declare const NotFound: () => react_jsx_runtime.JSX.Element;
415
+ interface NotFoundProps {
416
+ redirectUrl?: string;
417
+ }
418
+ declare const NotFound: FC<NotFoundProps>;
420
419
 
421
420
  declare const OperationLogList: FC;
422
421
 
423
422
  declare const PermissionRoutes: () => react_jsx_runtime.JSX.Element;
424
423
 
425
- declare const useRedirectToSignIn: () => (notRegistered?: boolean) => void;
426
- declare const SignIn: FC;
424
+ interface SignInProps {
425
+ title?: ReactNode;
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, UserWidget, contextStore, mixedStorage, request, useFormModal, useGameStore, useModal, useModalStore, usePermission, usePermissions, useQueryListStore, useRedirectToSignIn, useTokenStore, useTokenValidation, useToolkitsContext };
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 };