react-toolkits 0.0.3 → 0.0.5
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/.turbo/turbo-build.log +6 -6
- package/CHANGELOG.md +12 -0
- package/dist/index.d.mts +44 -32
- package/dist/index.esm.js +159 -146
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/FilterForm/index.tsx +1 -0
- package/src/components/FormModal/hooks.tsx +2 -3
- package/src/components/FormModal/index.tsx +11 -12
- package/src/components/QueryList/index.tsx +8 -21
- package/src/constants/index.ts +0 -2
- package/src/features/permission/hooks/index.ts +13 -28
- package/src/hooks/index.ts +1 -1
- package/src/hooks/{use-fetcher.tsx → use-http-client.tsx} +16 -42
- package/src/hooks/use-permission.tsx +13 -4
- package/src/index.ts +1 -0
- package/src/layouts/Layout.tsx +75 -37
- package/src/layouts/NavBar.tsx +8 -21
- package/src/pages/Login/index.tsx +3 -0
- package/src/pages/NoMatch/index.tsx +27 -0
- package/src/pages/index.ts +2 -1
- package/src/pages/permission/RoleList.tsx +11 -11
- package/src/types/index.ts +0 -17
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> react-toolkits@0.0.
|
|
2
|
+
> react-toolkits@0.0.5 build /home/runner/work/everythingflow/everythingflow/packages/react-toolkits
|
|
3
3
|
> tsup
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
[32mESM[39m [1mdist/512_orange_nobackground-L6MFCL6M.png [22m[32m9.49 KB[39m
|
|
14
14
|
[32mESM[39m [1mdist/index.css [22m[32m4.51 KB[39m
|
|
15
15
|
[32mESM[39m [1mdist/index.css.map [22m[32m7.65 KB[39m
|
|
16
|
-
[32mESM[39m [1mdist/index.esm.js [22m[
|
|
17
|
-
[32mESM[39m [1mdist/index.esm.js.map [22m[
|
|
18
|
-
[32mESM[39m ⚡️ Build success in
|
|
19
|
-
[32mDTS[39m ⚡️ Build success in
|
|
20
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[
|
|
16
|
+
[32mESM[39m [1mdist/index.esm.js [22m[32m116.47 KB[39m
|
|
17
|
+
[32mESM[39m [1mdist/index.esm.js.map [22m[32m161.28 KB[39m
|
|
18
|
+
[32mESM[39m ⚡️ Build success in 1983ms
|
|
19
|
+
[32mDTS[39m ⚡️ Build success in 8777ms
|
|
20
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m8.28 KB[39m
|
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { FC, PropsWithChildren, ForwardedRef, ReactNode } from 'react';
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { FC, PropsWithChildren, ForwardedRef, ReactElement, ReactNode } from 'react';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import { FormProps, FormInstance, ModalProps, ButtonProps } from 'antd';
|
|
5
5
|
import { Merge } from 'ts-essentials';
|
|
6
6
|
import { TableProps } from 'antd/es/table';
|
|
7
|
-
import { AxiosRequestConfig } from 'axios';
|
|
7
|
+
import { AxiosRequestConfig, AxiosInstance } from 'axios';
|
|
8
8
|
import * as zustand_middleware from 'zustand/middleware';
|
|
9
9
|
import * as zustand from 'zustand';
|
|
10
10
|
import { RouteObject } from 'react-router-dom';
|
|
@@ -34,27 +34,26 @@ type RenderChildren<T> = (props: {
|
|
|
34
34
|
type ChildrenType<T> = RenderChildren<T> | JSX.Element | JSX.Element[];
|
|
35
35
|
type RecursivePartial<T> = T extends object ? {
|
|
36
36
|
[P in keyof T]?: T[P] extends (infer U)[] ? RecursivePartial<U>[] : T[P] extends object ? RecursivePartial<T[P]> : T[P];
|
|
37
|
-
} :
|
|
37
|
+
} : unknown;
|
|
38
38
|
interface FormModalProps<T> extends Pick<ModalProps, 'width' | 'title' | 'open' | 'afterClose' | 'bodyStyle' | 'maskClosable'>, Pick<FormProps, 'labelCol' | 'layout' | 'colon'> {
|
|
39
39
|
children?: ChildrenType<T>;
|
|
40
40
|
footer?: ModalProps['footer'];
|
|
41
41
|
closeFn?: VoidFunction;
|
|
42
42
|
initialValues?: RecursivePartial<T>;
|
|
43
|
-
onConfirm?: (values: T) => void
|
|
43
|
+
onConfirm?: (values: T) => Promise<void>;
|
|
44
44
|
}
|
|
45
45
|
interface FormModalRef<T = object> {
|
|
46
46
|
setFieldsValue: (values: RecursivePartial<T>) => void;
|
|
47
47
|
}
|
|
48
48
|
declare const FormModal: <T extends object>(props: FormModalProps<T> & {
|
|
49
49
|
ref?: ForwardedRef<FormModalRef<T>> | undefined;
|
|
50
|
-
}) =>
|
|
50
|
+
}) => ReactElement;
|
|
51
51
|
|
|
52
|
-
type UseFormModalProps<T> = Merge<Omit<FormModalProps<T>, 'open' | 'onCancel' | 'closeFn' | 'children'
|
|
52
|
+
type UseFormModalProps<T> = Merge<Omit<FormModalProps<T>, 'open' | 'onCancel' | 'closeFn' | 'children'>, {
|
|
53
53
|
content: FormModalProps<T>['children'];
|
|
54
|
-
onConfirm?: (values: T) => void;
|
|
55
54
|
}>;
|
|
56
55
|
declare function useFormModal<T extends object>(props: UseFormModalProps<T>): {
|
|
57
|
-
Modal:
|
|
56
|
+
Modal: React.ReactPortal;
|
|
58
57
|
showModal: (options?: {
|
|
59
58
|
initialValues?: RecursivePartial<T> | undefined;
|
|
60
59
|
title?: FormModalProps<T>['title'];
|
|
@@ -73,21 +72,6 @@ interface PermissionButtonProps extends Omit<ButtonProps, 'disabled'> {
|
|
|
73
72
|
}
|
|
74
73
|
declare const PermissionButton: FC<PropsWithChildren<PermissionButtonProps>>;
|
|
75
74
|
|
|
76
|
-
type MenuItemType2 = Merge<MenuItemType, {
|
|
77
|
-
code /** 权限编号 **/?: string;
|
|
78
|
-
route /** 前端路由地址 **/?: string;
|
|
79
|
-
}>;
|
|
80
|
-
type SubMenuType2 = Merge<SubMenuType, {
|
|
81
|
-
children?: ItemType2[];
|
|
82
|
-
}>;
|
|
83
|
-
type MenuItemGroupType2 = Merge<MenuItemGroupType, {
|
|
84
|
-
children?: ItemType2[];
|
|
85
|
-
}>;
|
|
86
|
-
type ItemType2 = MenuItemType2 | SubMenuType2 | MenuItemGroupType2 | MenuDividerType | null;
|
|
87
|
-
interface NavBarProps {
|
|
88
|
-
items: ItemType2[];
|
|
89
|
-
}
|
|
90
|
-
|
|
91
75
|
type PaginationParams = {
|
|
92
76
|
page: number;
|
|
93
77
|
perPage: number;
|
|
@@ -103,21 +87,30 @@ interface QueryListProps<Item, Values> extends Pick<TableProps<Item>, 'columns'
|
|
|
103
87
|
}
|
|
104
88
|
declare const QueryList: <Item extends object, Values = {}>(props: QueryListProps<Item, Values>) => react_jsx_runtime.JSX.Element;
|
|
105
89
|
|
|
106
|
-
|
|
107
|
-
|
|
90
|
+
type ShimmedAxiosInstance = Merge<AxiosInstance, {
|
|
91
|
+
request<T = unknown, D = unknown>(config: AxiosRequestConfig<D>): Promise<T>;
|
|
92
|
+
get<T = unknown, D = unknown>(url: string, config?: AxiosRequestConfig<D>): Promise<T>;
|
|
93
|
+
delete<T = unknown, D = unknown>(url: string, config?: AxiosRequestConfig<D>): Promise<T>;
|
|
94
|
+
head<T = unknown, D = unknown>(url: string, config?: AxiosRequestConfig<D>): Promise<T>;
|
|
95
|
+
post<T = unknown, D = unknown>(url: string, data?: unknown, config?: AxiosRequestConfig<D>): Promise<T>;
|
|
96
|
+
put<T = unknown, D = unknown>(url: string, data?: unknown, config?: AxiosRequestConfig<D>): Promise<T>;
|
|
97
|
+
patch<T = unknown, D = unknown>(url: string, data?: unknown, config?: AxiosRequestConfig<D>): Promise<T>;
|
|
98
|
+
}>;
|
|
99
|
+
declare class HttpClientError extends Error {
|
|
100
|
+
code?: number;
|
|
108
101
|
skip: boolean;
|
|
109
|
-
constructor(message: string, code
|
|
102
|
+
constructor(message: string, code?: number, skip?: boolean);
|
|
110
103
|
}
|
|
111
|
-
declare function
|
|
104
|
+
declare function useHttpClient(): ShimmedAxiosInstance;
|
|
112
105
|
|
|
113
106
|
interface PermissionCheckResult {
|
|
114
107
|
[k: string]: boolean;
|
|
115
108
|
}
|
|
116
109
|
declare function usePermissions(codes: string[]): {
|
|
117
|
-
data: Record<string, boolean
|
|
118
|
-
isLoading:
|
|
110
|
+
data: Record<string, boolean>;
|
|
111
|
+
isLoading: false;
|
|
119
112
|
};
|
|
120
|
-
declare function usePermission(code
|
|
113
|
+
declare function usePermission(code: string): {
|
|
121
114
|
accessible: boolean;
|
|
122
115
|
isValidating: boolean;
|
|
123
116
|
};
|
|
@@ -177,8 +170,25 @@ declare const useQueryTriggerStore: zustand.UseBoundStore<zustand.StoreApi<Query
|
|
|
177
170
|
|
|
178
171
|
declare const Login: FC<PropsWithChildren>;
|
|
179
172
|
|
|
173
|
+
declare const NoMatch: () => react_jsx_runtime.JSX.Element;
|
|
174
|
+
|
|
180
175
|
declare const routes: RouteObject;
|
|
181
176
|
|
|
177
|
+
type MenuItemType2 = Merge<MenuItemType, {
|
|
178
|
+
code /** 权限编号 **/?: string;
|
|
179
|
+
route /** 前端路由地址 **/?: string;
|
|
180
|
+
}>;
|
|
181
|
+
type SubMenuType2 = Merge<SubMenuType, {
|
|
182
|
+
children?: ItemType2[];
|
|
183
|
+
}>;
|
|
184
|
+
type MenuItemGroupType2 = Merge<MenuItemGroupType, {
|
|
185
|
+
children?: ItemType2[];
|
|
186
|
+
}>;
|
|
187
|
+
type ItemType2 = MenuItemType2 | SubMenuType2 | MenuItemGroupType2 | MenuDividerType | null;
|
|
188
|
+
interface NavBarProps {
|
|
189
|
+
items: ItemType2[];
|
|
190
|
+
}
|
|
191
|
+
|
|
182
192
|
interface LayoutProps {
|
|
183
193
|
title?: ReactNode;
|
|
184
194
|
items: ItemType2[];
|
|
@@ -186,4 +196,6 @@ interface LayoutProps {
|
|
|
186
196
|
}
|
|
187
197
|
declare const Layout: FC<PropsWithChildren<LayoutProps>>;
|
|
188
198
|
|
|
189
|
-
|
|
199
|
+
declare const SSO_URL = "https://idaas.ifunplus.cn/enduser/api/application/plugin_FunPlus/sso/v1";
|
|
200
|
+
|
|
201
|
+
export { DynamicTags, DynamicTagsProps, FilterForm, FilterFormProps, FormModal, FormModalProps, FormModalRef, Highlight, HighlightTextsProps, HttpClientError, ItemType2, Layout, LayoutProps, Login, MenuState, NavBarProps, NoMatch, PermissionButton, PermissionButtonProps, PermissionCheckResult, QueryList, QueryListKey, QueryListProps, QueryTriggerState, SSO_URL, TokenState, UseFormModalProps, routes as permission, useFormModal, useHttpClient, useMenuStore, usePermission, usePermissions, useQueryTriggerStore, useTokenStore };
|