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.
@@ -1,5 +1,5 @@
1
1
 
2
- > react-toolkits@0.0.3 build /home/runner/work/everythingflow/everythingflow/packages/react-toolkits
2
+ > react-toolkits@0.0.5 build /home/runner/work/everythingflow/everythingflow/packages/react-toolkits
3
3
  > tsup
4
4
 
5
5
  CLI Building entry: src/index.ts
@@ -13,8 +13,8 @@
13
13
  ESM dist/512_orange_nobackground-L6MFCL6M.png 9.49 KB
14
14
  ESM dist/index.css 4.51 KB
15
15
  ESM dist/index.css.map 7.65 KB
16
- ESM dist/index.esm.js 115.82 KB
17
- ESM dist/index.esm.js.map 160.66 KB
18
- ESM ⚡️ Build success in 1423ms
19
- DTS ⚡️ Build success in 7010ms
20
- DTS dist/index.d.mts 7.43 KB
16
+ ESM dist/index.esm.js 116.47 KB
17
+ ESM dist/index.esm.js.map 161.28 KB
18
+ ESM ⚡️ Build success in 1983ms
19
+ DTS ⚡️ Build success in 8777ms
20
+ DTS dist/index.d.mts 8.28 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # react-toolkits
2
2
 
3
+ ## 0.0.5
4
+
5
+ ### Patch Changes
6
+
7
+ - 3c0ff88: release react-toolkits
8
+
9
+ ## 0.0.4
10
+
11
+ ### Patch Changes
12
+
13
+ - a32af27: fix useFormModal hook can not set initialValues
14
+
3
15
  ## 0.0.3
4
16
 
5
17
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -1,10 +1,10 @@
1
- import * as react from 'react';
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
- } : any;
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
- }) => React.ReactElement;
50
+ }) => ReactElement;
51
51
 
52
- type UseFormModalProps<T> = Merge<Omit<FormModalProps<T>, 'open' | 'onCancel' | 'closeFn' | 'children' | 'onConfirm'>, {
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: react.ReactPortal;
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
- declare class FetcherError extends Error {
107
- code: number;
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: number, skip?: boolean);
102
+ constructor(message: string, code?: number, skip?: boolean);
110
103
  }
111
- declare function useFetcher(): <T = unknown>(config: AxiosRequestConfig) => Promise<T>;
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> | undefined;
118
- isLoading: boolean;
110
+ data: Record<string, boolean>;
111
+ isLoading: false;
119
112
  };
120
- declare function usePermission(code?: string): {
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
- export { DynamicTags, DynamicTagsProps, FetcherError, FilterForm, FilterFormProps, FormModal, FormModalProps, FormModalRef, Highlight, HighlightTextsProps, ItemType2, Layout, LayoutProps, Login, MenuState, NavBarProps, PermissionButton, PermissionButtonProps, PermissionCheckResult, QueryList, QueryListKey, QueryListProps, QueryTriggerState, TokenState, UseFormModalProps, routes as permission, useFetcher, useFormModal, useMenuStore, usePermission, usePermissions, useQueryTriggerStore, useTokenStore };
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 };