@flow97/react-toolkit 0.0.10 → 0.1.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 +16 -0
- package/lib/index.d.ts +19 -2
- package/lib/index.js +958 -8578
- package/lib/index.js.map +1 -1
- package/locale/context.js +2 -1473
- package/locale/hooks.js +18 -3755
- package/locale/index.js +18 -3755
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# react-toolkits
|
|
2
2
|
|
|
3
|
+
## 0.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 70ab18a:
|
|
8
|
+
|
|
9
|
+
## 0.1.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- c968c89: refactor: enhance navigation component with permission support
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- 5dbf4e5: refactor: enhance QueryList component with error handling configuration
|
|
18
|
+
|
|
3
19
|
## 0.0.10
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/lib/index.d.ts
CHANGED
|
@@ -246,11 +246,13 @@ interface Game {
|
|
|
246
246
|
}
|
|
247
247
|
/**
|
|
248
248
|
* 导航菜单项类型
|
|
249
|
-
* 扩展 antd MenuItemType
|
|
249
|
+
* 扩展 antd MenuItemType,添加路由和权限支持
|
|
250
250
|
*/
|
|
251
251
|
type NavMenuItemType = Merge<MenuItemType, {
|
|
252
252
|
/** react-router 路由地址,用于菜单项点击时跳转 */
|
|
253
253
|
route?: string;
|
|
254
|
+
/** 权限码,用于 useAuth 检测,无权限时该项自动隐藏 */
|
|
255
|
+
code?: string;
|
|
254
256
|
}>;
|
|
255
257
|
/**
|
|
256
258
|
* 导航子菜单类型
|
|
@@ -259,6 +261,8 @@ type NavMenuItemType = Merge<MenuItemType, {
|
|
|
259
261
|
interface NavSubMenuType extends Omit<SubMenuType, 'children'> {
|
|
260
262
|
/** 子菜单项数组,支持嵌套结构 */
|
|
261
263
|
children?: NavItem[];
|
|
264
|
+
/** 权限码,用于 useAuth 检测,无权限时该子菜单及子项自动隐藏 */
|
|
265
|
+
code?: string;
|
|
262
266
|
}
|
|
263
267
|
/**
|
|
264
268
|
* 导航菜单组类型
|
|
@@ -267,6 +271,8 @@ interface NavSubMenuType extends Omit<SubMenuType, 'children'> {
|
|
|
267
271
|
interface NavMenuItemGroupType extends Omit<MenuItemGroupType, 'children'> {
|
|
268
272
|
/** 菜单组内的菜单项数组 */
|
|
269
273
|
children?: NavItem[];
|
|
274
|
+
/** 权限码,用于 useAuth 检测,无权限时该菜单组及子项自动隐藏 */
|
|
275
|
+
code?: string;
|
|
270
276
|
}
|
|
271
277
|
/**
|
|
272
278
|
* 导航项联合类型
|
|
@@ -687,6 +693,15 @@ interface QueryListDataAdapter<Item extends AnyObject = AnyObject> {
|
|
|
687
693
|
* @template Data 响应数据类型
|
|
688
694
|
*/
|
|
689
695
|
type QueryListDataAdapterConfig<Item extends AnyObject = AnyObject, Data = ListResponse<Item>> = QueryListDataAdapter<Item> | ((data: Data) => QueryListDataAdapter<Item>);
|
|
696
|
+
/**
|
|
697
|
+
* 错误处理配置
|
|
698
|
+
* - formatError: 抛错时,返回 string 则显示,null 则不显示;未提供则用默认逻辑并显示
|
|
699
|
+
* - getErrorFromSuccess: 成功响应中检测业务错误,返回非空 string 则显示并转为错误
|
|
700
|
+
*/
|
|
701
|
+
interface QueryListErrorConfig<Data = unknown> {
|
|
702
|
+
formatError?: (error: Error, data?: unknown) => string | null;
|
|
703
|
+
getErrorFromSuccess?: (data: Data) => string | null;
|
|
704
|
+
}
|
|
690
705
|
/**
|
|
691
706
|
* QueryList 组件的 Props
|
|
692
707
|
* @template Item 列表项类型
|
|
@@ -722,6 +737,8 @@ interface QueryListProps<Item extends AnyObject = AnyObject, Values = AnyObject,
|
|
|
722
737
|
dataAdapter?: QueryListDataAdapterConfig<Item, Data>;
|
|
723
738
|
/** 表格底部内容 */
|
|
724
739
|
footer?: (data: Data | undefined) => ReactNode;
|
|
740
|
+
/** 错误处理配置 */
|
|
741
|
+
errorConfig?: QueryListErrorConfig<Data>;
|
|
725
742
|
}
|
|
726
743
|
declare const QueryList: <Item extends AnyObject = AnyObject, Values extends object | undefined = undefined, Data = any>(props: QueryListProps<Item, Values, Data> & {
|
|
727
744
|
ref?: Ref<QueryListRef<Item, Values, Data>>;
|
|
@@ -1508,4 +1525,4 @@ declare function useAuth(code?: string | string[], config?: RequestOptions): {
|
|
|
1508
1525
|
declare function useMenuList(): _tanstack_react_query.UseQueryResult<MenuListItem[], Error>;
|
|
1509
1526
|
declare const useGames: () => _tanstack_react_query.UseQueryResult<Game[], Error>;
|
|
1510
1527
|
|
|
1511
|
-
export { APP_ID_HEADER, AuthButton, type AuthButtonProps, type AuthConfig, AuthMode, CheckEndpoint, DynamicTags, type DynamicTagsProps, ExpandableParagraph, type ExpandableParagraphProps, FRONTEND_ROUTE_PREFIX, FilterFormWrapper, type FilterFormWrapperProps, type Game, type GameSelectConfig, type GameSelectProps, type HeaderExtra, type HeaderExtraConfig, Highlight, type HighlightProps, 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, Layout, type LayoutProps, Logo, type LogoProps, type MenuListItem, type NavItem, type NavMenuItemGroupType, type NavMenuItemType, type NavSubMenuType, type NavigationConfig, NotFound, OperationLogList, type PageParam, type Permission, QueryList, QueryListAction, type QueryListPayload, type QueryListProps, type QueryListRef, type RecursivePartial, RequireAuth, type RequireAuthProps, RequireGame, type RouteMatchRule, SSO_URL, SelectAll, type SelectAllProps, type ShowFormOptions$1 as ShowFormDrawerOptions, type ShowFormOptions as ShowFormModalOptions, SignIn, ToolkitProvider, type ToolkitProviderProps, type UseDrawerOperation, type UseDrawerProps, type UseFormDrawerProps, type UseFormDrawerReturn, type UseFormModalProps, type UseFormModalReturn, type UseKeepAliveReturn, type UseModalOperation, type UseModalProps, UserDropdown, type VisibilityState, WILDCARD, createVisibilityStoreConfig, generateId, _default$1 as menuRoutes, mixedStorage, _default as permissionRoutes, toolkitStore, useAuth, useAuthConfig, useAuthMode, useDrawer, useDrawerStore, useFormDrawer, useFormModal, useGames, useInfiniteListStore, useIsDirectRole, useIsGameScoped, useIsGroupBased, useIsRoleWithGame, useKeepAlive, useKeepAliveContext, useMenuList, useModal, useModalStore, useQueryListStore, useToolkitStore };
|
|
1528
|
+
export { APP_ID_HEADER, AuthButton, type AuthButtonProps, type AuthConfig, AuthMode, CheckEndpoint, DynamicTags, type DynamicTagsProps, ExpandableParagraph, type ExpandableParagraphProps, FRONTEND_ROUTE_PREFIX, FilterFormWrapper, type FilterFormWrapperProps, type Game, type GameSelectConfig, type GameSelectProps, type HeaderExtra, type HeaderExtraConfig, Highlight, type HighlightProps, 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, Layout, type LayoutProps, Logo, type LogoProps, type MenuListItem, type NavItem, type NavMenuItemGroupType, type NavMenuItemType, type NavSubMenuType, type NavigationConfig, NotFound, OperationLogList, type PageParam, type Permission, QueryList, QueryListAction, type QueryListErrorConfig, type QueryListPayload, type QueryListProps, type QueryListRef, type RecursivePartial, RequireAuth, type RequireAuthProps, RequireGame, type RouteMatchRule, SSO_URL, SelectAll, type SelectAllProps, type ShowFormOptions$1 as ShowFormDrawerOptions, type ShowFormOptions as ShowFormModalOptions, SignIn, ToolkitProvider, type ToolkitProviderProps, type UseDrawerOperation, type UseDrawerProps, type UseFormDrawerProps, type UseFormDrawerReturn, type UseFormModalProps, type UseFormModalReturn, type UseKeepAliveReturn, type UseModalOperation, type UseModalProps, UserDropdown, type VisibilityState, WILDCARD, createVisibilityStoreConfig, generateId, _default$1 as menuRoutes, mixedStorage, _default as permissionRoutes, toolkitStore, useAuth, useAuthConfig, useAuthMode, useDrawer, useDrawerStore, useFormDrawer, useFormModal, useGames, useInfiniteListStore, useIsDirectRole, useIsGameScoped, useIsGroupBased, useIsRoleWithGame, useKeepAlive, useKeepAliveContext, useMenuList, useModal, useModalStore, useQueryListStore, useToolkitStore };
|