react-toolkits 2.22.8 → 2.22.10
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 +12 -0
- package/README.md +350 -26
- package/lib/chunk-4GULXGNG.js +1 -0
- package/lib/chunk-7NM3DK6A.js +1 -0
- package/lib/chunk-FXPGR372.js +0 -0
- package/lib/chunk-HZHE6R72.js +1 -0
- package/lib/chunk-JIBSYGRB.js +1 -0
- package/lib/chunk-JLHCYGWL.js +1 -0
- package/lib/chunk-JTDKSGJR.js +1 -0
- package/lib/chunk-LRMME3YZ.js +2 -0
- package/lib/chunk-MSKNHKMD.js +1 -0
- package/lib/chunk-O7AQM3CB.js +1 -0
- package/lib/chunk-OLM4QNJB.js +1 -0
- package/lib/chunk-RITI5HRV.js +1 -0
- package/lib/chunk-SJK2ZPEL.js +1 -0
- package/lib/chunk-WHOTHZUW.js +1 -0
- package/lib/chunk-X6ZI7RL7.js +1 -0
- package/lib/chunk-XQERUQGQ.js +1 -0
- package/lib/chunk-XWIQENHQ.js +2 -0
- package/lib/chunk-YIJSACFM.js +1 -0
- package/lib/chunk-ZCPZYTPN.js +1 -0
- package/lib/components.d.ts +429 -0
- package/lib/components.js +1 -0
- package/lib/constants.d.ts +11 -0
- package/lib/constants.js +1 -0
- package/lib/createMenuItem-HUQG2HQY.js +1 -0
- package/lib/hooks.d.ts +108 -0
- package/lib/hooks.js +1 -0
- package/lib/index.d.ts +21 -789
- package/lib/index.js +1 -2
- package/lib/menuItemList-AS6ZDOTZ.js +1 -0
- package/lib/modules.d.ts +7 -0
- package/lib/modules.js +1 -0
- package/lib/pages.d.ts +20 -0
- package/lib/pages.js +1 -0
- package/lib/roleDetail-2QUBILZK.js +1 -0
- package/lib/roleList-KWWVOLWJ.js +1 -0
- package/lib/services.d.ts +196 -0
- package/lib/services.js +1 -0
- package/lib/types-DVKf5poe.d.ts +19 -0
- package/lib/types.d.ts +23 -0
- package/lib/types.js +1 -0
- package/lib/updateMenuItem-7SUIOBXS.js +1 -0
- package/lib/userDetail-TXGT2W7X.js +1 -0
- package/lib/userList-ELLBMK76.js +1 -0
- package/lib/utils.d.ts +6 -0
- package/lib/utils.js +1 -0
- package/locale/chunk-GHHHKGNN.js +1 -0
- package/locale/hooks.js +1 -1
- package/locale/index.js +1 -1
- package/package.json +35 -3
package/lib/types.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
interface Permission {
|
|
2
|
+
label: string;
|
|
3
|
+
value: string;
|
|
4
|
+
route: string;
|
|
5
|
+
method?: string;
|
|
6
|
+
}
|
|
7
|
+
interface MenuListItem {
|
|
8
|
+
id: number;
|
|
9
|
+
category: string;
|
|
10
|
+
is_common: boolean;
|
|
11
|
+
is_model: boolean;
|
|
12
|
+
model_name: string;
|
|
13
|
+
permissions: Permission[];
|
|
14
|
+
front_route: string;
|
|
15
|
+
order: number;
|
|
16
|
+
scheme: string;
|
|
17
|
+
ext: string;
|
|
18
|
+
}
|
|
19
|
+
type RecursivePartial<T> = NonNullable<T> extends object ? {
|
|
20
|
+
[P in keyof T]?: NonNullable<T[P]> extends (infer U)[] ? RecursivePartial<U>[] : NonNullable<T[P]> extends object ? RecursivePartial<T[P]> : T[P];
|
|
21
|
+
} : T;
|
|
22
|
+
|
|
23
|
+
export type { MenuListItem, Permission, RecursivePartial };
|
package/lib/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import'./chunk-FXPGR372.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {b as b$1}from'./chunk-JIBSYGRB.js';import {b as b$2}from'./chunk-X6ZI7RL7.js';import {b,d,e}from'./chunk-WHOTHZUW.js';import {c}from'./chunk-LRMME3YZ.js';import'./chunk-OLM4QNJB.js';import {Editor}from'@monaco-editor/react';import {useQuery}from'@tanstack/react-query';import {App,Form,Card,Input,Switch,InputNumber,Button}from'antd';import {useEffect}from'react';import {useNavigate,useParams}from'react-router-dom';import {jsx,jsxs}from'react/jsx-runtime';var R=b(()=>{let{message:b}=App.useApp(),[i]=Form.useForm(),l=useNavigate(),{mutate:_}=b$1(),r=useParams(),{refetch:x}=b$2(),N=d(),{data:p,isLoading:v}=useQuery({queryKey:e.menus.detail(Number(r.id)),queryFn:()=>N.get(`/api/usystem/menu/info?id=${r.id}`),enabled:!!r.id}),q=async n=>{let{permissions:m,front_route:a,...u}=n;await _({...u,permissions:m?JSON.parse(m):void 0,front_route:c+a,id:+r.id}),x(),b.success("\u66F4\u65B0\u6210\u529F",.8,()=>l("../..",{relative:"route"}));};return useEffect(()=>{let{permissions:n,front_route:m,...a}=p??{},u=JSON.stringify(n||[],null,2),E=m?.replace(c,"");i.setFieldsValue({...a,permissions:u,front_route:E});},[p,i]),jsx(Card,{title:"\u66F4\u65B0\u83DC\u5355\u9879",loading:v,children:jsxs(Form,{scrollToFirstError:!0,form:i,labelCol:{flex:"120px"},initialValues:{is_common:!1,is_model:!1,order:0},onFinish:q,children:[jsx(Form.Item,{label:"\u83DC\u5355\u9879\u540D\u79F0",name:"category",rules:[{required:!0}],children:jsx(Input,{})}),jsx(Form.Item,{label:"\u524D\u7AEF\u8DEF\u7531",name:"front_route",rules:[{required:!0}],children:jsx(Input,{prefix:c})}),jsx(Form.Item,{label:"\u6A21\u677F\u540D\u79F0",name:"model_name",rules:[{required:!0}],children:jsx(Input,{})}),jsx(Form.Item,{label:"Is Common",name:"is_common",rules:[{required:!0}],valuePropName:"checked",children:jsx(Switch,{})}),jsx(Form.Item,{label:"Order",name:"order",children:jsx(InputNumber,{className:"w-full"})}),jsx(Form.Item,{label:"\u63A5\u53E3\u89C4\u5219",name:"permissions",children:jsx(Editor,{theme:"vs-dark",height:"300px",language:"json",options:{minimap:{enabled:!1}}})}),jsx(Form.Item,{label:"Schema",name:"scheme",rules:[{required:!0}],children:jsx(Editor,{theme:"vs-dark",height:"600px",language:"json",options:{minimap:{enabled:!1}}})}),jsx(Form.Item,{label:"Ext",name:"ext",children:jsx(Input.TextArea,{rows:5})}),jsx(Form.Item,{children:jsxs("div",{className:"flex justify-center gap-8",children:[jsx(Button,{type:"primary",htmlType:"submit",children:"\u63D0\u4EA4"}),jsx(Button,{onClick:()=>{l("../..",{relative:"path"});},children:"\u53D6\u6D88"})]})})]})})},{isGlobal:!0}),X=R;export{X as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {b}from'./chunk-O7AQM3CB.js';import'./chunk-XQERUQGQ.js';import {a as a$3}from'./chunk-SJK2ZPEL.js';import'./chunk-HZHE6R72.js';import {a}from'./chunk-7NM3DK6A.js';import {c,a as a$2}from'./chunk-X6ZI7RL7.js';import {a as a$1,d,e}from'./chunk-WHOTHZUW.js';import {e as e$1}from'./chunk-LRMME3YZ.js';import'./chunk-OLM4QNJB.js';import {useQuery}from'@tanstack/react-query';import {Tag,Breadcrumb,Card,Descriptions,Table}from'antd';import {useParams,Link}from'react-router-dom';import {jsx,jsxs,Fragment}from'react/jsx-runtime';var G=()=>{let a$4=useParams(),{t}=a(),{gameApiV2:D}=a$1(),L=d(),{data:s,isLoading:T,refetch:h}=useQuery({queryKey:e.users.detail(a$4.id||""),queryFn:()=>L.get(`/api/usystem/user/info?id=${a$4.id}`),enabled:!!a$4.id}),{data:x}=c(),{data:V}=a$2("200005"),{show:B,modal:C}=b({mode:"update",onSuccess(){h();}}),K=[{key:"group",title:t("global.projectGroup"),dataIndex:"game_group",render(o){return o.map(r=>jsx(Tag,{children:r===e$1?"\u901A\u7528":r},r))}},{key:"game",title:t("global.game"),dataIndex:"game_ids",render(o){return o.map(r=>{let P=x?.find(m=>String(D?m.game_id:m.id)===r);return jsx(Tag,{children:P?.name??(r===e$1?"\u901A\u7528":r)},r)})}},{key:"role",title:t("global.role"),dataIndex:"role",render(o){return V?jsx(Link,{to:`../../role/${o}`,relative:"path",children:o}):o}}];return jsxs(Fragment,{children:[jsx(Breadcrumb,{style:{marginBottom:"1.5rem"},items:[{key:"1",title:jsx(Link,{to:"..",relative:"path",children:t("global.user")})},{key:"2",title:"\u7528\u6237\u8BE6\u60C5"}]}),jsx(Card,{title:"\u7528\u6237\u8BE6\u60C5",loading:T,extra:jsx(a$3,{code:"100003",onClick:()=>{B({initialValues:{name:s?.name,permissions:s?.permissions},extraValues:{id:s.id}});},children:t("global.update")}),children:jsxs(Descriptions,{bordered:!0,column:1,children:[jsx(Descriptions.Item,{label:t("global.name"),children:s?.name}),jsx(Descriptions.Item,{label:"ID",children:s?.id}),jsx(Descriptions.Item,{label:t("global.role"),children:jsx(Table,{rowKey:"role",columns:K,dataSource:s?.permissions,pagination:!1})})]})}),C]})},N=G;export{N as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {a as a$2,b as b$2}from'./chunk-O7AQM3CB.js';import {h}from'./chunk-XQERUQGQ.js';import {a as a$4}from'./chunk-RITI5HRV.js';import {a as a$3}from'./chunk-SJK2ZPEL.js';import'./chunk-HZHE6R72.js';import {b as b$1,d}from'./chunk-4GULXGNG.js';import {a}from'./chunk-7NM3DK6A.js';import'./chunk-X6ZI7RL7.js';import {b,a as a$1}from'./chunk-WHOTHZUW.js';import'./chunk-LRMME3YZ.js';import'./chunk-OLM4QNJB.js';import {UserAddOutlined}from'@ant-design/icons';import {App,Row,Col,Tag,Space,Card,Form,Input}from'antd';import {Link}from'react-router-dom';import {jsx,jsxs,Fragment}from'react/jsx-runtime';var K=()=>{let{modal:V,message:b}=App.useApp(),{t:o}=a(),I=h(),{refetch:r}=b$1(),{permissionVersion:u}=a$1(t=>t),L=u==="v1",i=u==="v3",{show:M,modal:x}=a$2({mode:"create",onSuccess(){r("user-list",{page:1});}}),{show:S,modal:F}=a$2({mode:"update",onSuccess(){r("user-list");}}),{show:A,modal:B}=b$2({mode:"create",onSuccess(){r("user-list",{page:1});}}),{show:P,modal:R}=b$2({mode:"update",onSuccess(){r("user-list");}}),z=[{title:o("global.name"),dataIndex:"name",key:"name",render(t,s){return i?jsx(Link,{to:`./${s.id}`,children:t}):t}},{title:"ID",dataIndex:"id",key:"id"},(L||i)&&{title:o("global.role"),dataIndex:"roles",key:"roles",width:"40%",render(t){return jsx(Row,{gutter:[4,4],children:(t||[]).map(s=>jsx(Col,{children:s==="root"?jsx(Tag,{color:"#f50",children:s}):jsx(Tag,{color:"#ff5a00",children:jsx(Link,{to:`../role/${s}`,children:s})})},s))})}},{title:o("global.creationTime"),dataIndex:"Ctime",key:"ctime"},{title:o("global.operation"),width:150,align:"center",render:(t,s)=>{let{name:l,permissions:G,roles:H,id:n}=s;return jsxs(Space,{children:[jsx(a$3,{size:"small",type:"link",code:"100003",onClick:()=>{i?P({initialValues:{name:l,permissions:G},extraValues:{id:n}}):S({initialValues:{name:l,roles:H},extraValues:{id:n}});},children:o("global.update")}),jsx(a$3,{danger:!0,size:"small",code:"100004",type:"link",onClick:()=>{V.confirm({title:o("User.deleteTitle"),content:jsx(a$4,{texts:[l],children:o("User.deleteContent",{user:l})}),async onOk(){await I.mutateAsync({id:n,name:l}),r("user-list"),b.success(o("User.deleteSuccessfully"));}});},children:o("global.delete")})]})}}].filter(Boolean);return jsxs(Fragment,{children:[jsx(Card,{title:o("global.user"),extra:jsx(a$3,{type:"primary",icon:jsx(UserAddOutlined,{}),code:"100002",onClick:()=>{i?A():M();},children:o("User.createTitle")}),children:jsx(d,{identifier:"user-list",code:"100001",request:{url:"/api/usystem/user/list",method:"GET"},rowKey:"id",columns:z,dataAdapter:t=>({total:t?.Total,items:t?.List}),renderForm:i?t=>jsx(Form,{form:t,children:jsx(Form.Item,{label:"\u540D\u79F0",name:"name",children:jsx(Input,{})})}):void 0})}),x,F,B,R]})},se=b(K,{isGlobal:!0});export{se as default};
|
package/lib/utils.d.ts
ADDED
package/lib/utils.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{b as generateId,a as mixedStorage}from'./chunk-OLM4QNJB.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {has,template,get}from'lodash-es';import {createContext,useMemo,useContext}from'react';import'antd';import {useStore}from'zustand';import'react/jsx-runtime';var p=createContext(null);function r(o){let e=useContext(p);if(!e)throw new Error("Missing ToolkitsProvider in the tree");return useStore(e,o||(t=>t))}function N(){let o=r(t=>t.locale);return {t:useMemo(()=>(t,s)=>has(o,t)?template(get(o,t))(s):t,[o])}}export{N as a};
|
package/locale/hooks.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export{a as useTranslation}from'./chunk-GHHHKGNN.js';
|
package/locale/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export{a as useTranslation}from'./chunk-GHHHKGNN.js';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-toolkits",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.22.
|
|
4
|
+
"version": "2.22.10",
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"*.css"
|
|
7
7
|
],
|
|
@@ -13,6 +13,38 @@
|
|
|
13
13
|
"import": "./lib/index.js",
|
|
14
14
|
"types": "./lib/index.d.ts"
|
|
15
15
|
},
|
|
16
|
+
"./components": {
|
|
17
|
+
"import": "./lib/components.js",
|
|
18
|
+
"types": "./lib/components.d.ts"
|
|
19
|
+
},
|
|
20
|
+
"./constants": {
|
|
21
|
+
"import": "./lib/constants.js",
|
|
22
|
+
"types": "./lib/constants.d.ts"
|
|
23
|
+
},
|
|
24
|
+
"./hooks": {
|
|
25
|
+
"import": "./lib/hooks.js",
|
|
26
|
+
"types": "./lib/hooks.d.ts"
|
|
27
|
+
},
|
|
28
|
+
"./modules": {
|
|
29
|
+
"import": "./lib/modules.js",
|
|
30
|
+
"types": "./lib/modules.d.ts"
|
|
31
|
+
},
|
|
32
|
+
"./pages": {
|
|
33
|
+
"import": "./lib/pages.js",
|
|
34
|
+
"types": "./lib/pages.d.ts"
|
|
35
|
+
},
|
|
36
|
+
"./services": {
|
|
37
|
+
"import": "./lib/services.js",
|
|
38
|
+
"types": "./lib/services.d.ts"
|
|
39
|
+
},
|
|
40
|
+
"./types": {
|
|
41
|
+
"import": "./lib/types.js",
|
|
42
|
+
"types": "./lib/types.d.ts"
|
|
43
|
+
},
|
|
44
|
+
"./utils": {
|
|
45
|
+
"import": "./lib/utils.js",
|
|
46
|
+
"types": "./lib/utils.d.ts"
|
|
47
|
+
},
|
|
16
48
|
"./locale": {
|
|
17
49
|
"import": "./locale/index.js",
|
|
18
50
|
"types": "./locale/index.d.ts"
|
|
@@ -65,8 +97,8 @@
|
|
|
65
97
|
"tsup": "^8.3.5",
|
|
66
98
|
"typescript": "^5.6.3",
|
|
67
99
|
"@flow97/eslint-config-react": "1.1.0",
|
|
68
|
-
"
|
|
69
|
-
"
|
|
100
|
+
"tailwind-config": "0.1.3",
|
|
101
|
+
"tsconfig": "0.0.6"
|
|
70
102
|
},
|
|
71
103
|
"peerDependencies": {
|
|
72
104
|
"antd": "^5.12.2",
|