react-toolkits 2.31.1 → 2.31.2
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 +7 -21
- package/lib/index.js +3 -3
- package/lib/index.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
package/lib/index.d.ts
CHANGED
|
@@ -20,16 +20,6 @@ interface RequestOptions extends Options {
|
|
|
20
20
|
/** 是否使用全局模式(覆盖 context 中的 isGlobalMode) */
|
|
21
21
|
isGlobalMode?: boolean;
|
|
22
22
|
}
|
|
23
|
-
/** React 上下文信息接口 */
|
|
24
|
-
interface KyClientContext {
|
|
25
|
-
token?: string;
|
|
26
|
-
isGlobalMode?: boolean;
|
|
27
|
-
loginPath?: string;
|
|
28
|
-
apiBaseUrl?: string;
|
|
29
|
-
appId?: string | number;
|
|
30
|
-
clear?: () => void;
|
|
31
|
-
notifyError?: (title: string, description: string) => void;
|
|
32
|
-
}
|
|
33
23
|
/** KyClient 构造函数配置 */
|
|
34
24
|
interface KyClientOptions {
|
|
35
25
|
/** 基础 URL */
|
|
@@ -51,8 +41,8 @@ interface KyMethods {
|
|
|
51
41
|
}) => Promise<T>;
|
|
52
42
|
instance: KyInstance;
|
|
53
43
|
}
|
|
54
|
-
/**
|
|
55
|
-
interface
|
|
44
|
+
/** useKy 配置选项 */
|
|
45
|
+
interface UseKyOptions {
|
|
56
46
|
/** 状态码字段配置:字段名 -> 成功码列表 */
|
|
57
47
|
statusFields?: Record<string, readonly number[]>;
|
|
58
48
|
/** 自定义响应成功判断函数 */
|
|
@@ -77,10 +67,10 @@ interface UseKyClientOptions {
|
|
|
77
67
|
hooks?: Partial<Hooks>;
|
|
78
68
|
}
|
|
79
69
|
/** 导出类型(向后兼容) */
|
|
80
|
-
type BusinessStatusCodeConfig = Pick<
|
|
81
|
-
type ErrorMessageConfig = Pick<
|
|
82
|
-
type HttpErrorHandlers = Pick<
|
|
83
|
-
type ResponseValidationConfig = Pick<
|
|
70
|
+
type BusinessStatusCodeConfig = Pick<UseKyOptions, 'statusFields'>;
|
|
71
|
+
type ErrorMessageConfig = Pick<UseKyOptions, 'errorFields' | 'extractErrorMessage'>;
|
|
72
|
+
type HttpErrorHandlers = Pick<UseKyOptions, 'onUnauthorized' | 'onForbidden' | 'onUnregistered' | 'onError' | 'onNetworkError'>;
|
|
73
|
+
type ResponseValidationConfig = Pick<UseKyOptions, 'isSuccess'>;
|
|
84
74
|
/**
|
|
85
75
|
* Ky HTTP 客户端类
|
|
86
76
|
*/
|
|
@@ -100,10 +90,6 @@ declare class KyClient implements KyMethods {
|
|
|
100
90
|
}) => Promise<T>;
|
|
101
91
|
private makeRequest;
|
|
102
92
|
}
|
|
103
|
-
/**
|
|
104
|
-
* 在组件中使用 KyClient 的 Hook
|
|
105
|
-
*/
|
|
106
|
-
declare function useKyClient(options?: UseKyClientOptions): KyClient;
|
|
107
93
|
|
|
108
94
|
interface AuthButtonProps extends ButtonProps {
|
|
109
95
|
/** 权限码,支持单个或多个 */
|
|
@@ -1476,4 +1462,4 @@ declare function useAuth(code?: string | string[], config?: RequestOptions): {
|
|
|
1476
1462
|
declare function useMenuList(): _tanstack_react_query.UseQueryResult<MenuListItem[], Error>;
|
|
1477
1463
|
declare const useGames: () => _tanstack_react_query.UseQueryResult<Game[], Error>;
|
|
1478
1464
|
|
|
1479
|
-
export { APP_ID_HEADER, AuthButton, type AuthButtonProps, type BusinessStatusCodeConfig, DynamicTags, type DynamicTagsProps, type ErrorMessageConfig, ExpandableParagraph, type ExpandableParagraphProps, FRONTEND_ROUTE_PREFIX, FilterFormWrapper, type FilterFormWrapperProps, type Game, type GameSelectConfig, type GameSelectProps, type HeaderExtra, type HeaderExtraConfig, Highlight, type HighlightProps, type HttpErrorHandlers, InfiniteList, type InfiniteListDataAdapter, type InfiniteListPayload, type InfiniteListProps, type InfiniteListRef, type InfiniteListRequestConfig, type InfiniteListRequestConfigType, type JsonResponse, KeepAlive, type KeepAliveCacheItem, KeepAliveOutlet, type KeepAliveOutletProps, type KeepAliveProps, KeepAliveProvider, type KeepAliveProviderProps, KyClient, type
|
|
1465
|
+
export { APP_ID_HEADER, AuthButton, type AuthButtonProps, type BusinessStatusCodeConfig, DynamicTags, type DynamicTagsProps, type ErrorMessageConfig, ExpandableParagraph, type ExpandableParagraphProps, FRONTEND_ROUTE_PREFIX, FilterFormWrapper, type FilterFormWrapperProps, type Game, type GameSelectConfig, type GameSelectProps, type HeaderExtra, type HeaderExtraConfig, Highlight, type HighlightProps, type HttpErrorHandlers, InfiniteList, type InfiniteListDataAdapter, type InfiniteListPayload, type InfiniteListProps, type InfiniteListRef, type InfiniteListRequestConfig, type InfiniteListRequestConfigType, type JsonResponse, KeepAlive, type KeepAliveCacheItem, KeepAliveOutlet, type KeepAliveOutletProps, type KeepAliveProps, KeepAliveProvider, type KeepAliveProviderProps, KyClient, type KyClientOptions, Layout, type LayoutProps, Logo, type LogoProps, type MenuListItem, type NavItem, type NavMenuItemGroupType, type NavMenuItemType, type NavSubMenuType, type NavigationConfig, NotFound, OperationLogList, type PageParam, type Permission, PermissionMode, QueryList, QueryListAction, type QueryListPayload, type QueryListProps, type QueryListRef, type RecursivePartial, type RequestOptions, RequireAuth, type RequireAuthProps, RequireGame, type ResponseType, type ResponseValidationConfig, type RouteMatchRule, SSO_URL, SelectAll, type SelectAllProps, type ShowFormOptions$1 as ShowFormDrawerOptions, type ShowFormOptions as ShowFormModalOptions, SignIn, ToolkitsProvider, type ToolkitsProviderProps, type UseDrawerOperation, type UseDrawerProps, type UseFormDrawerProps, type UseFormDrawerReturn, type UseFormModalProps, type UseFormModalReturn, type UseKeepAliveReturn, type UseKyOptions, type UseModalOperation, type UseModalProps, UserDropdown, type VisibilityState, WILDCARD, createVisibilityStoreConfig, generateId, _default$1 as menuRoutes, mixedStorage, _default as permissionRoutes, useAuth, useDrawer, useDrawerStore, useFormDrawer, useFormModal, useGames, useInfiniteListStore, useKeepAlive, useKeepAliveContext, useMenuList, useModal, useModalStore, useQueryListStore, useToolkitsStore };
|