react-toolkits 2.22.9 → 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 +6 -0
- package/README.md +63 -10
- package/lib/chunk-HZHE6R72.js +1 -0
- package/lib/{chunk-TYDTFWYK.js → chunk-JLHCYGWL.js} +1 -1
- package/lib/chunk-MSKNHKMD.js +1 -0
- package/lib/{chunk-TRRCT3ST.js → chunk-O7AQM3CB.js} +1 -1
- package/lib/chunk-SJK2ZPEL.js +1 -0
- package/lib/{chunk-P5SX5RW3.js → chunk-YIJSACFM.js} +1 -1
- package/lib/chunk-ZCPZYTPN.js +1 -0
- package/lib/components.d.ts +6 -107
- package/lib/components.js +1 -1
- package/lib/hooks.d.ts +108 -0
- package/lib/hooks.js +1 -0
- package/lib/index.d.ts +5 -4
- package/lib/index.js +1 -1
- package/lib/modules.js +1 -1
- package/lib/roleDetail-2QUBILZK.js +1 -0
- package/lib/roleList-KWWVOLWJ.js +1 -0
- package/lib/userDetail-TXGT2W7X.js +1 -0
- package/lib/userList-ELLBMK76.js +1 -0
- package/locale/context.js +1 -9
- package/locale/en_GB.js +1 -96
- package/locale/hooks.js +1 -29
- package/locale/index.js +1 -29
- package/locale/ja_JP.js +1 -96
- package/locale/ko_KR.js +1 -96
- package/locale/zh_CN.js +1 -96
- package/package.json +7 -3
- package/lib/chunk-3OYXD4UE.js +0 -1
- package/lib/chunk-K5HXGCZ4.js +0 -1
- package/lib/components.js.map +0 -1
- package/lib/constants.js.map +0 -1
- package/lib/index.css.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/modules.js.map +0 -1
- package/lib/pages.js.map +0 -1
- package/lib/roleDetail-PFVKUPYB.js +0 -1
- package/lib/roleList-AHH4PNYW.js +0 -1
- package/lib/services.js.map +0 -1
- package/lib/types.js.map +0 -1
- package/lib/userDetail-JJNDBV5T.js +0 -1
- package/lib/userList-KX3POGAU.js +0 -1
- package/lib/utils.js.map +0 -1
- package/locale/context.js.map +0 -1
- package/locale/en_GB.js.map +0 -1
- package/locale/hooks.js.map +0 -1
- package/locale/index.js.map +0 -1
- package/locale/ja_JP.js.map +0 -1
- package/locale/ko_KR.js.map +0 -1
- package/locale/zh_CN.js.map +0 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -66,7 +66,8 @@ root.render(
|
|
|
66
66
|
|
|
67
67
|
## 子路径导出(推荐)
|
|
68
68
|
|
|
69
|
-
- `react-toolkits/components`:组件与 Hooks(如 `Layout`、`ToolkitsProvider`、`
|
|
69
|
+
- `react-toolkits/components`:组件与 Hooks(如 `Layout`、`ToolkitsProvider`、`InfiniteList`)
|
|
70
|
+
- `react-toolkits/hooks`:表单弹层 Hooks(如 `useFormDrawer`、`useFormModal`)
|
|
70
71
|
- `react-toolkits/pages`:内置页面与路由片段(如 `permissionRoutes`、`menuRoutes`、`SignIn`)
|
|
71
72
|
- `react-toolkits/services`:请求相关 Hooks(如 `usePermission`、`useMenuList`、`useGames`)
|
|
72
73
|
- `react-toolkits/constants`:常量与枚举(如 `APP_ID_HEADER`、`PermissionVersion`)
|
|
@@ -77,7 +78,8 @@ root.render(
|
|
|
77
78
|
示例:
|
|
78
79
|
|
|
79
80
|
```ts
|
|
80
|
-
import { Layout
|
|
81
|
+
import { Layout } from 'react-toolkits/components'
|
|
82
|
+
import { useFormDrawer } from 'react-toolkits/hooks'
|
|
81
83
|
import { permissionRoutes } from 'react-toolkits/pages'
|
|
82
84
|
import { usePermission } from 'react-toolkits/services'
|
|
83
85
|
import { APP_ID_HEADER } from 'react-toolkits/constants'
|
|
@@ -132,6 +134,7 @@ const { t } = useTranslation()
|
|
|
132
134
|
```
|
|
133
135
|
src/
|
|
134
136
|
components/ // 组件与 Hooks(以 react-toolkits/components 导出)
|
|
137
|
+
hooks/ // 表单弹层 Hooks(以 react-toolkits/hooks 导出)
|
|
135
138
|
features/ // 特性模块(权限/菜单等:hooks/组件/服务聚合)
|
|
136
139
|
pages/ // 内置页面与路由片段
|
|
137
140
|
services/ // 数据服务 hooks(依赖 libs/ky 与全局上下文)
|
|
@@ -189,18 +192,29 @@ export default function LogList() {
|
|
|
189
192
|
|
|
190
193
|
```tsx
|
|
191
194
|
import { Button } from 'antd'
|
|
192
|
-
import { useFormDrawer } from 'react-toolkits/
|
|
195
|
+
import { useFormDrawer } from 'react-toolkits/hooks'
|
|
193
196
|
|
|
194
197
|
export default function CreateUser() {
|
|
195
198
|
const { show, drawer } = useFormDrawer({
|
|
196
199
|
title: '新建用户',
|
|
197
|
-
|
|
200
|
+
onConfirm: async values => {
|
|
198
201
|
await fetch('/api/users', { method: 'POST', body: JSON.stringify(values) })
|
|
199
202
|
},
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
203
|
+
content: (
|
|
204
|
+
<>
|
|
205
|
+
<Form.Item name="name" label="姓名" rules={[{ required: true }]}>
|
|
206
|
+
<Input />
|
|
207
|
+
</Form.Item>
|
|
208
|
+
<Form.Item name="role" label="角色" rules={[{ required: true }]}>
|
|
209
|
+
<Select
|
|
210
|
+
options={[
|
|
211
|
+
{ value: 'admin', label: '管理员' },
|
|
212
|
+
{ value: 'user', label: '用户' },
|
|
213
|
+
]}
|
|
214
|
+
/>
|
|
215
|
+
</Form.Item>
|
|
216
|
+
</>
|
|
217
|
+
),
|
|
204
218
|
})
|
|
205
219
|
|
|
206
220
|
return (
|
|
@@ -212,6 +226,44 @@ export default function CreateUser() {
|
|
|
212
226
|
}
|
|
213
227
|
```
|
|
214
228
|
|
|
229
|
+
### 表单弹层(`useFormModal`)
|
|
230
|
+
|
|
231
|
+
```tsx
|
|
232
|
+
import { Button, Form, Input, Select } from 'antd'
|
|
233
|
+
import { useFormModal } from 'react-toolkits/hooks'
|
|
234
|
+
|
|
235
|
+
export default function EditUser() {
|
|
236
|
+
const { show, modal } = useFormModal({
|
|
237
|
+
title: '编辑用户',
|
|
238
|
+
onConfirm: async values => {
|
|
239
|
+
await fetch('/api/users', { method: 'PUT', body: JSON.stringify(values) })
|
|
240
|
+
},
|
|
241
|
+
content: (
|
|
242
|
+
<>
|
|
243
|
+
<Form.Item name="name" label="姓名" rules={[{ required: true }]}>
|
|
244
|
+
<Input />
|
|
245
|
+
</Form.Item>
|
|
246
|
+
<Form.Item name="role" label="角色" rules={[{ required: true }]}>
|
|
247
|
+
<Select
|
|
248
|
+
options={[
|
|
249
|
+
{ value: 'admin', label: '管理员' },
|
|
250
|
+
{ value: 'user', label: '用户' },
|
|
251
|
+
]}
|
|
252
|
+
/>
|
|
253
|
+
</Form.Item>
|
|
254
|
+
</>
|
|
255
|
+
),
|
|
256
|
+
})
|
|
257
|
+
|
|
258
|
+
return (
|
|
259
|
+
<>
|
|
260
|
+
<Button onClick={() => show({ initialValues: { name: 'John', role: 'user' } })}>编辑</Button>
|
|
261
|
+
{modal}
|
|
262
|
+
</>
|
|
263
|
+
)
|
|
264
|
+
}
|
|
265
|
+
```
|
|
266
|
+
|
|
215
267
|
### 服务层 Hooks(`react-toolkits/services`)
|
|
216
268
|
|
|
217
269
|
```tsx
|
|
@@ -257,13 +309,14 @@ export default function FetchWithKy() {
|
|
|
257
309
|
过去:
|
|
258
310
|
|
|
259
311
|
```ts
|
|
260
|
-
import { ToolkitsProvider, Layout } from 'react-toolkits'
|
|
312
|
+
import { ToolkitsProvider, Layout, useFormDrawer } from 'react-toolkits'
|
|
261
313
|
```
|
|
262
314
|
|
|
263
315
|
现在(推荐):
|
|
264
316
|
|
|
265
317
|
```ts
|
|
266
318
|
import { ToolkitsProvider, Layout } from 'react-toolkits/components'
|
|
319
|
+
import { useFormDrawer, useFormModal } from 'react-toolkits/hooks'
|
|
267
320
|
import { permissionRoutes } from 'react-toolkits/pages'
|
|
268
321
|
import { usePermission } from 'react-toolkits/services'
|
|
269
322
|
```
|
|
@@ -301,7 +354,7 @@ pnpm -C packages/react-toolkits build
|
|
|
301
354
|
pnpm -C packages/react-toolkits dev
|
|
302
355
|
```
|
|
303
356
|
|
|
304
|
-
构建将产出多入口:`lib/index.js`、`lib/components.js`、`lib/pages.js`、`lib/services.js`、`lib/types.js`、`lib/utils.js`,以及 `locale/*`。
|
|
357
|
+
构建将产出多入口:`lib/index.js`、`lib/components.js`、`lib/hooks.js`、`lib/pages.js`、`lib/services.js`、`lib/types.js`、`lib/utils.js`,以及 `locale/*`。
|
|
305
358
|
|
|
306
359
|
提示:发布前请确保示例应用验证通过,并更新 `CHANGELOG.md` 描述变更与迁移说明。
|
|
307
360
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {b}from'./chunk-OLM4QNJB.js';import {create}from'zustand';import {Modal,Form}from'antd';import {useMemo,useEffect,useState,useCallback}from'react';import {jsx}from'react/jsx-runtime';var P=create((s,o)=>({open:new Map,usedIds:new Set,isOpen:e=>o().open.get(e)??!1,show(e){s({open:new Map(o().open).set(e,!0)});},hide(e){s({open:new Map(o().open).set(e,!1)});},hideAll(){s({open:new Map});},checkUniqueness(e){let{usedIds:r}=o();return !r.has(e)},registerIds(e){let{usedIds:r}=o();return r.has(e)?!1:(s({usedIds:new Set(r).add(e)}),!0)},cleanup(e){let{open:r,usedIds:i}=o(),l=new Map(r),n=new Set(i);l.delete(e),n.delete(e),s({open:l,usedIds:n});}}));function v(s){let{content:o,onConfirm:e,afterOpen:r,afterClose:i,...l}=s,n=useMemo(()=>b(),[]),{show:p,hide:u,isOpen:w,cleanup:t}=P();useEffect(()=>()=>{t(n);},[n,t]);let y=w(n),[x,c]=useState(!1),m=typeof o=="function",V=useCallback(async()=>{p(n),await r?.();},[n,p,r]),d=useCallback(()=>{u(n);},[n,u]),a=useCallback(async()=>{d(),await i?.();},[d,i]),f=useCallback(async()=>{try{c(!0),await e?.(),d(),await i?.();}catch(O){throw console.error("Modal confirm error:",O),O}finally{c(!1);}},[e,d,i]),M=jsx(Modal,{...l,open:y,confirmLoading:x,onOk:f,onCancel:a,children:m?o({hide:d}):o});return {id:n,show:V,hide:d,modal:M}}function N(s){let{content:o,form:e,formProps:r,onConfirm:i,onSuccess:l,afterClose:n,...p}=s,[u,w]=useState({}),[t]=Form.useForm();t=e||t;let y=typeof o=="function",{id:x,show:c,hide:m,modal:V}=v({...p,content:a=>jsx(Form,{...r,form:t,children:y?o(u,a):o}),onConfirm:async()=>{try{let a=await t.validateFields();await i?.(a,u),l?.(),m();}catch(a){throw console.error("Form validation or submission error:",a),a}},afterClose:()=>{n?.(t);}}),d=useCallback(a=>{let{initialValues:f,extraValues:M}=a||{};M&&w(M),f&&t.setFieldsValue(f),c();},[t,c]);return {id:x,show:d,hide:m,modal:V}}export{P as a,v as b,N as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {c,d,j,i}from'./chunk-XQERUQGQ.js';import {c as c$1}from'./chunk-
|
|
1
|
+
import {c,d,j,i}from'./chunk-XQERUQGQ.js';import {c as c$1}from'./chunk-HZHE6R72.js';import {a}from'./chunk-7NM3DK6A.js';import {c as c$2}from'./chunk-X6ZI7RL7.js';import {a as a$1}from'./chunk-WHOTHZUW.js';import {App,Form,Input,Divider,Skeleton,Card,Space,Select,Button,Empty,Typography,Checkbox,Row,Col,Collapse}from'antd';import {useState,useEffect,useTransition,useCallback}from'react';import {jsxs,Fragment,jsx}from'react/jsx-runtime';var oe=m=>{let{permissions:i,readonly:n,expand:r,value:l,onChange:g}=m,[c,f]=useState([]),[y,R]=useState({}),[a$1,d]=useState(l??[]),{t:P}=a(),[,v]=useTransition(),V=useCallback(e=>{f(e);},[]),p=(e,s)=>{let o=[];return e?o=[...new Set(a$1.concat(s))]:(o=a$1.slice(),s.forEach(u=>{let b=o.findIndex(X=>X===u);b>-1&&o.splice(b,1);})),o},x=(e,s)=>{let o=p(e.target.checked,s);d(o),g?.(o);};useEffect(()=>{d(l??[]);},[l]),useEffect(()=>{r&&v(()=>{f((i??[]).map(({category:e})=>e));});},[r,i]),useEffect(()=>{let e=(i??[]).reduce((s,o)=>(s[o.category]=o.permissions.every(u=>a$1?.includes(u.value)),s),{});R(e);},[a$1,i]);let I=(i??[]).map(e=>({key:e.category,label:e.category,extra:!n&&jsx(Checkbox,{checked:y[e.category],onChange:s=>{x(s,e.permissions?.map(o=>o.value));},children:P("global.selectAll")}),children:jsx(Checkbox.Group,{style:{width:"100%"},value:a$1,disabled:n,children:jsx(Row,{gutter:[10,10],style:{width:"100%"},children:e.permissions?.map(s=>jsx(Col,{span:6,children:jsx(Checkbox,{value:s.value,onChange:o=>{x(o,[s.value]);},children:s.label})},s.value))})})}));return jsx(Collapse,{style:{width:"100%"},collapsible:"header",activeKey:c,items:I,onChange:V})},k=oe;var{Text:w}=Typography,{Option:le}=Select,pe=m=>{let{expand:i=!0,value:n,readonly:r,onChange:l}=m,{data:g,isLoading:c,error:f}=j(),{data:y,isLoading:R}=c$2(),[a$1,d]=useState([]),P=g?.filter(e=>e.is_common),v=g?.filter(e=>!e.is_common),V=c||R,{t:p}=a();if(useEffect(()=>{let e=[];Object.keys(n??{}).forEach(s=>{s!=="global"&&e.push({gameId:s,permissions:n?.[s]??[]});}),d(e);},[n]),f)return jsx("div",{className:"flex justify-center",children:jsx(w,{type:"danger",children:p("PermissionList.failedDescription")})});let x=()=>{d(e=>[...e,{gameId:"",permissions:[]}]);},I=e=>{d(s=>s.filter((o,u)=>u!==e));};return jsxs("div",{className:"flex flex-col w-full",children:[jsx("div",{className:"mb-12",children:jsx(Divider,{dashed:!0,children:p("PermissionList.baseSectionTitle")})}),jsx(Skeleton,{active:!0,loading:V,children:jsx(k,{value:n?.global,readonly:r,permissions:P,expand:i,onChange:e=>{l?.({...n,global:e});}})}),jsx("div",{className:"my-12",children:jsx(Divider,{dashed:!0,children:p("PermissionList.gameSectionTitle")})}),a$1.map((e,s)=>jsx(Card,{title:jsxs(Space,{children:[jsx(w,{children:p("global.game")}),r?jsx(w,{children:y?.find(o=>String(o.id)===e.gameId)?.name}):jsx(Select,{disabled:r,value:a$1[s].gameId||void 0,style:{width:"160px"},placeholder:p("PermissionList.gameSelectPlaceholder"),onChange:o=>{d(u=>{let b=u.slice();return b[s].gameId=o,b});},children:y?.map(o=>jsx(le,{value:o.id,disabled:a$1.some(({gameId:u})=>u===String(o.id)),children:o.name},o.id))})]}),className:"mb-6",extra:!r&&jsx(Button,{type:"link",onClick:()=>{I(s);},children:p("PermissionList.removeText")}),children:a$1[s].gameId?jsx(Skeleton,{active:!0,loading:V,children:jsx(k,{value:n?.[a$1[s].gameId],readonly:r,expand:i,permissions:v,onChange:o=>{l?.({...n,[a$1[s].gameId]:o});}})}):jsx(Empty,{description:p("PermissionList.gameSectionDescription")})},s)),!r&&jsx(Button,{block:!0,type:"dashed",onClick:x,children:p("PermissionList.addText")})]})},U=pe;var{Text:ue}=Typography,ge=m=>{let{expand:i$1=!0,value:n,readonly:r,onChange:l}=m,{data:g,isLoading:c,error:f}=i(),{t:y}=a();return f?jsx("div",{className:"flex justify-center",children:jsx(ue,{type:"danger",children:y("PermissionList.failedDescription")})}):jsx(Skeleton,{active:!0,loading:c,children:jsx(k,{value:n,permissions:g,readonly:r,expand:i$1,onChange:l})})},$=ge;var fe=m=>{let{value:i}=m;console.log("value",typeof i,i===null,JSON.stringify(i));let{permissionVersion:n}=a$1();return n==="v2"?jsx(U,{...m,value:i}):jsx($,{...m,value:i})},H=fe;var Qe=({mode:m,onSuccess:i})=>{let{message:n}=App.useApp(),{t:r}=a(),l=c(),g=d(),c$2=m==="create",f=r(c$2?"Role.createTitle":"Role.updateTitle"),y=jsxs(Fragment,{children:[jsx(Form.Item,{label:r("global.name"),name:"name",rules:[{required:!0}],children:jsx(Input,{disabled:!c$2})}),jsx(Form.Item,{name:"permissions",children:jsx(H,{})})]});return c$1({title:f,width:"1000px",formProps:{layout:"vertical"},content:y,onConfirm:async(a,d)=>{let P=`role_${a.name}`,v=a.permissions;c$2?(await l.mutateAsync({name:P,permissions:v}),n.success(r("Role.createSuccessfully"))):(await g.mutateAsync({id:d?.id,name:P,permissions:v}),n.success(r("Role.updateSuccessfully"))),i?.();}})};export{H as a,Qe as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {b}from'./chunk-JTDKSGJR.js';import {a as a$2}from'./chunk-4GULXGNG.js';import {a}from'./chunk-7NM3DK6A.js';import {a as a$1,c}from'./chunk-X6ZI7RL7.js';import {d,a as a$3}from'./chunk-WHOTHZUW.js';import {PlusOutlined,LogoutOutlined,UserOutlined,MenuUnfoldOutlined,MenuFoldOutlined}from'@ant-design/icons';import*as B from'antd';import {Spin,Menu,Form,Result,Table,Button,theme,Space,Input,Tag,Empty,Dropdown,Divider,Select,Typography}from'antd';import {forwardRef,memo,useRef,useMemo,useCallback,useEffect,useState,useImperativeHandle,cloneElement,Fragment as Fragment$1,Suspense}from'react';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {useInfiniteQuery,useQueryClient}from'@tanstack/react-query';import {isEqual}from'lodash-es';import {create}from'zustand';import {persist,createJSONStorage,devtools,subscribeWithSelector}from'zustand/middleware';import {Link,useLocation,useNavigate}from'react-router-dom';var at=r=>{let{initialTags:a$1,addable:e,removable:t,addCallback:n,removeCallback:o}=r,{t:i}=a(),{token:c}=theme.useToken(),[p,I]=useState([]),[s,v]=useState(!1),[u,L]=useState(""),[m,f]=useState(-1),[h,x]=useState(""),k=useRef(null),P=useRef(null);useEffect(()=>{I(a$1??[]);},[a$1]),useEffect(()=>{s&&k.current?.focus();},[s]),useEffect(()=>{P.current?.focus();},[u]);let d=async y=>{if(await o?.(y)){let M=p.filter(ae=>ae!==y);I(M);}},V=()=>{v(!0);},F=y=>{L(y.target.value);},D=async()=>{u&&p.indexOf(u)===-1&&await n?.(u)&&I([...p,u]),v(!1),L("");},S=y=>{x(y.target.value);},j=()=>{let y=[...p];y[m]=h,I(y),f(-1),L("");},N={width:78,verticalAlign:"top"},re={background:c.colorBgContainer,borderStyle:"dashed"};return jsxs(Space,{wrap:!0,size:[0,8],children:[jsx(Space,{wrap:!0,size:[0,8],children:p.map((y,C)=>m===C?jsx(Input,{ref:P,size:"small",style:N,value:h,onChange:S,onBlur:j,onPressEnter:j},y):jsx(Tag,{closable:t,style:{userSelect:"none"},onClose:async M=>{M.preventDefault(),await d(y);},children:jsx("span",{onDoubleClick:M=>{C!==0&&(f(C),x(y),M.preventDefault());},children:y})},y))}),e&&(s?jsx(Input,{ref:k,type:"text",size:"small",style:N,value:u,onChange:F,onBlur:D,onPressEnter:D}):jsxs(Tag,{style:re,onClick:V,children:[jsx(PlusOutlined,{}),"\xA0",i("global.add")]}))]})},ot=at;var ct=()=>create()(devtools(subscribeWithSelector((r,a)=>({instances:new Map,registerInstance(e,t,n,o,i){r(c=>{let p=c.instances.get(e);if(p){let v={...p,refetch:o,fetchNextPage:i},u=new Map(c.instances);return u.set(e,v),{instances:u}}let I={id:e,url:t,queryKey:n,payload:{page:0,formValue:{}},refetch:o,fetchNextPage:i},s=new Map(c.instances);return s.set(e,I),{instances:s}});},unregisterInstance(e){r(t=>{let n=new Map(t.instances);return n.delete(e)?{instances:n}:t});},updatePayload(e,t){r(n=>{let o=n.instances.get(e);if(!o)return n;let i={...o.payload,...t};if(!isEqual(o.payload,i)){let c={...o,payload:i},p=new Map(n.instances);return p.set(e,c),{instances:p}}return n});},getPayload(e){return a().instances.get(e)?.payload??{page:0,formValue:{}}},async refetch(e,t){let n=a().instances.get(e);if(!n){console.warn(`InfiniteList instance with id "${e}" not found`);return}if(t){let o=n.payload,i={...o,...t};isEqual(o,i)||a().updatePayload(e,t);}try{await n.refetch();}catch(o){throw console.error(`Failed to refetch InfiniteList instance "${e}":`,o),o}},async fetchNextPage(e){let t=a().instances.get(e);if(!t){console.warn(`InfiniteList instance with id "${e}" not found`);return}try{await t.fetchNextPage();}catch(n){throw console.error(`Failed to fetch next page for InfiniteList instance "${e}":`,n),n}},getInstance(e){return a().instances.get(e)},getAllInstances(){return Array.from(a().instances.values())}})),{name:"infinite-list-store"})),pt=ct(),T=pt;var xt=(r,a$3)=>{let t={refreshInterval:0,initialPageParam:0,...r,dataAdapter:{...{items:l=>l?l.flatMap(g=>g?.list||g||[]):[],hasMore:l=>{if(!l)return !1;let g=l;return g?.hasMore||g?.has_more||!1},nextPageParam:(l,g,W)=>(G=>{if(!G)return !1;let H=G;return H?.hasMore||H?.has_more||!1})(l)?g.length:void 0},...r.dataAdapter}},{identifier:n,code:o,buttonsAlign:i,showReset:c,refreshInterval:p,request:I,tableExtra:s,renderForm:v,afterSuccess:u,afterError:L,dataAdapter:m,initialPageParam:f,footer:h,form:x,...k}=t,{t:P}=a(),[d$1]=Form.useForm(x),[V,F]=useState(!1),D=useRef(!1),S=useRef(3),j=d(),{data:N,isLoading:re}=a$1(o),y=useCallback(()=>T.getState().getPayload(n),[n]),C=useMemo(()=>d$1,[d$1]),{url:M,method:ae="GET",body:oe,params:ie,headers:Q,cacheTime:Ue=5*60*1e3,staleTime:Xe=0}=I,se=useMemo(()=>typeof Q=="function"?Q(C):Q,[Q,C]),le=useMemo(()=>{let l=y();return [M,n,N,V,l,se]},[M,n,N,V,y,se]),{data:U,fetchNextPage:ce,hasNextPage:Ie,isFetchingNextPage:be,refetch:X,isFetching:ve}=useInfiniteQuery({queryKey:le,queryFn:async({pageParam:l=f})=>{try{let g=y(),W=typeof ie=="function"?ie(g,l):ie,z=typeof oe=="function"?oe(g,l):oe,G={method:ae,searchParams:W,headers:se};z&&(z instanceof FormData?G.body=z:G.json=z);let H=await j.request({url:M,...G});return D.current=!0,u?.(S.current,C,[H]),H}catch(g){let W=g instanceof Error?g:new Error(String(g));throw L?.(W,S.current,C),W}},initialPageParam:f,getNextPageParam:(l,g)=>m?.nextPageParam?.(l,g,f),enabled:N&&V,retry:(l,g)=>!(l>=3||g?.message?.includes("401")),retryDelay:l=>Math.min(1e3*2**l,3e4),refetchOnWindowFocus:!1,refetchInterval:D.current?p:0,gcTime:Ue,staleTime:Xe});useEffect(()=>(T.getState().registerInstance(n,M,le,X,ce),()=>{T.getState().unregisterInstance(n);}),[n,M,le,X,ce]);let $=m?.items?.(U?.pages,C),pe=be,xe=!Ie,$e=!$||$.length===0,Pe=async()=>{S.current=0;let l=await d$1.getFieldsValue();try{await d$1.validateFields(),F(!0),T.getState().updatePayload(n,{page:0,formValue:l}),X();}catch{F(!1);}},Ye=()=>{S.current=2,ce();},Je=async()=>{S.current=1;try{d$1.resetFields();let l=await d$1.getFieldsValue();T.getState().updatePayload(n,{page:0,formValue:l}),await d$1.validateFields({validateOnly:!0}),X();}catch{}};if(useEffect(()=>{setTimeout(()=>{N&&d$1.validateFields({validateOnly:!0}).then(l=>{F(!0),T.getState().updatePayload(n,{page:0,formValue:l});}).catch(()=>{F(!1);});},300);},[N,d$1,n]),useImperativeHandle(a$3,()=>({data:U?.pages,dataSource:$,form:d$1,refetch:()=>T.getState().refetch(n),fetchNextPage:()=>T.getState().fetchNextPage(n),hasNextPage:!!Ie,isFetchingNextPage:be})),re)return jsx(Spin,{style:{display:"flex",justifyContent:"center",alignItems:"center",height:300}});if(!N)return jsx(Result,{status:403,subTitle:P("global.noEntitlement")});let Ze=h&&(()=>h(U?.pages)),et=()=>typeof s=="function"?s(C,U?.pages):s,tt=typeof v=="function"?jsx(a$2,{showReset:c,buttonsAlign:i,isConfirming:ve,onReset:Je,onConfirm:Pe,children:cloneElement(v(d$1),{onKeyUp:l=>{l.key==="Enter"&&Pe();}})}):jsx(Form,{form:d$1});return jsxs(Fragment,{children:[tt,et(),jsx("div",{style:{minHeight:"400px"},children:jsx(Table,{...k,dataSource:$,loading:ve,pagination:!1,footer:Ze})}),!$e&&jsx(Button,{block:!0,loading:pe,type:"link",htmlType:"button",disabled:pe||xe,onClick:Ye,children:P(pe?"InfiniteList.loadingText":xe?"InfiniteList.reachEndText":"InfiniteList.loadMoreText")})]})},Pt=forwardRef(xt),St=Pt;var Ve=create()(persist((r,a)=>({openKeys:[],setOpenKeys:e=>{let t=a();(t.openKeys.length!==e.length||!t.openKeys.every((n,o)=>n===e[o]))&&r({openKeys:e});},selectedKeys:[],setSelectedKeys:e=>{let t=a();(t.selectedKeys.length!==e.length||!t.selectedKeys.every((n,o)=>n===e[o]))&&r({selectedKeys:e});}}),{name:"nav",storage:createJSONStorage(()=>localStorage),partialize:r=>({openKeys:r.openKeys,selectedKeys:r.selectedKeys}),skipHydration:!1,version:1}));var Ke=memo(({to:r,children:a})=>jsx(Link,{to:r,children:a}));Ke.displayName="MemoizedLink";function Z(r){let a=[];if(r)for(let e=0;e<r.length;e++)if(r[e]===null||r[e].type==="divider")a[e]=r[e];else if(r[e].children){let{children:t,...n}=r[e];a[e]={...n,children:Z(t)};}else {let{route:t,label:n,...o}=r[e],i=t?jsx(Ke,{to:t,children:n}):n;a[e]={...o,label:i};}return a}function ee(r,a=[],e=[]){for(let t of r){let n=t?.children;if(Array.isArray(n)){let o=t.type!=="group"&&t.key?[...e,t.key]:e;ee(n,a,o);}else t&&a.push(Object.assign(t,{keypath:e}));}return a}var Ot=memo(function(a){let{items:e=[],theme:t,loading:n}=a,o=useLocation(),i=useRef(),c=useRef(),p=useMemo(()=>i.current===e?i.current?ee(i.current):[]:(i.current=e,ee(e)),[e]),I=useMemo(()=>i.current===e?i.current?Z(i.current):[]:Z(e),[e]),{openKeys:s,selectedKeys:v,setOpenKeys:u,setSelectedKeys:L}=Ve(),m=useCallback(f=>{let h=f.find(x=>!s.includes(x));if(h){let x=p.find(P=>P.key===h),k=x?.keypath?[...x.keypath,h]:[h];u(k);}else u(f);},[p,s,u]);return useEffect(()=>{if(c.current===o.pathname)return;c.current=o.pathname;let f=p.find(h=>o.pathname===h.route);if(f){let h=f.key,x=f.keypath;(v[0]!==h||!s.every((k,P)=>k===x[P]))&&(L([h]),u(x));}},[p,o.pathname,v,s,L,u]),n?jsx("div",{className:"flex justify-center items-center",style:{height:"calc(100vh - 64px)"},children:jsx(Spin,{})}):jsx(Menu,{theme:t,style:{borderRight:"none"},items:I,mode:"inline",openKeys:s,selectedKeys:v,onOpenChange:m})}),de=Ot;var {Spin:qt}=B,Wt=({children:r})=>{let{permissionVersion:a$1,gameId:e,isGlobal:t}=a$3(i=>i),{isLoading:n}=c(),{t:o}=a();return n?jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:400},children:jsx(qt,{})}):a$1==="v1"||t?r:e?jsx(Fragment$1,{children:r},e):jsx(Empty,{image:Empty.PRESENTED_IMAGE_SIMPLE,description:o("RequireGame.description")})},ye=Wt;var Qt=()=>{let{t:r}=a(),a$1=useNavigate(),{clearToken:e,getUser:t,signInPath:n}=a$3(s=>s),o=t(),i=()=>{e(),a$1(n);},c=s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),i());},p=s=>{(s.key==="Enter"||s.key===" ")&&s.preventDefault();},I=[{key:"1",icon:jsx(LogoutOutlined,{}),label:jsx("a",{role:"button",tabIndex:0,onClick:i,onKeyDown:c,children:r("UserWidget.signOutText")})}];return jsx("div",{children:jsx(Dropdown,{menu:{selectable:!0,items:I},placement:"bottomRight",children:jsx("a",{role:"button",tabIndex:0,onClick:s=>{s.preventDefault();},onKeyDown:p,children:jsxs(Space,{align:"center",children:[jsx("span",{children:o?.authorityId}),jsx(UserOutlined,{style:{fontSize:"16px"}})]})})})})},ge=Qt;var{Text:en}=Typography,tn=r=>{let{filter:a$1,options:e}=r,{t}=a(),{gameApiV2:n,gameId:o,setGameId:i}=a$3(m=>m),{data:c$1,isLoading:p}=c(),I=useQueryClient(),s=c$1?.filter(m=>a$1?.(m)??!0),v=typeof e=="function"?e(s):s?.map(m=>({label:m.name,value:n?m.game_id:m.id})),u=m=>{L(),i(m);},L=()=>{I.removeQueries({predicate:m=>{let f=m.queryKey;return !f.includes("/api/game/list")&&!f.includes("/api/usystem/game/all")}});};return useEffect(()=>{if(c$1&&c$1.length>0){let m=n?c$1[0].game_id:c$1[0].id;c$1.every(f=>String(f.game_id||f.id)!==String(o))&&i(m);}},[c$1]),jsxs(Space,{children:[jsx(en,{children:t("GameSelect.label")}),jsx(Select,{showSearch:!0,optionFilterProp:"label",value:o,placeholder:t("GameSelect.placeholder"),loading:p,style:{width:"200px"},options:v,onChange:u})]})},ze=tn;var _e=memo(({title:r,subtitle:a,mainPagePath:e,collapsed:t})=>jsxs("div",{className:"px-6 py-2 font-bold relative bg-gradient-to-r from-white to-gray-50/30",style:{height:"auto",display:"flex",flexDirection:"column",justifyContent:"center",backdropFilter:"blur(4px)",WebkitBackdropFilter:"blur(4px)"},children:[jsxs("div",{className:`flex items-center w-full ${t?"justify-center":""}`,children:[jsx(Link,{to:e,className:"hover:opacity-80 transition-all duration-300 ease-out block rounded-lg p-1 hover:bg-white/50 hover:shadow-sm",style:{transition:"all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94)",opacity:t?.8:1,transform:"translateX(0)"},children:jsx(b,{width:36,style:{objectFit:"contain",display:"block",filter:"drop-shadow(0 1px 1px rgba(0, 0, 0, 0.05))",transition:"all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94)"}})}),r&&jsx("div",{className:"ml-4 overflow-hidden min-w-0",style:{transition:"all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94)",opacity:t?0:1,width:t?"0px":"auto",marginLeft:t?"0px":"16px",transform:t?"translateX(-8px)":"translateX(0)"},children:jsx(Link,{to:e,className:"text-xl leading-tight hover:text-blue-600 transition-all duration-300 font-bold text-ellipsis overflow-hidden whitespace-nowrap block bg-gradient-to-r from-gray-800 to-gray-600 bg-clip-text text-transparent hover:from-blue-600 hover:to-blue-500",title:r,style:{letterSpacing:"0.02em",textShadow:"0 1px 2px rgba(0, 0, 0, 0.05)"},children:r})})]}),jsx("div",{className:"w-full mt-2 overflow-hidden",style:{height:a&&!t?"20px":"1px",transition:"height 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94)"},children:jsxs("div",{className:"flex items-center justify-center h-full w-full",children:[jsx("div",{className:"w-full border-t border-gray-200 absolute",style:{opacity:!a||t?1:0,transition:"opacity 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94)"}}),a&&jsxs("div",{className:"flex items-center w-full text-sm",style:{opacity:t?0:1,transform:t?"translateY(-3px)":"translateY(0)",transition:"all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94)"},children:[jsx("div",{className:"flex-1 border-t border-gray-200"}),jsx("span",{className:"px-3 text-gray-500 font-medium whitespace-nowrap",title:a,children:a}),jsx("div",{className:"flex-1 border-t border-gray-200"})]})]})})]}));_e.displayName="LayoutHeader";var Be=_e;var {Spin:pn,theme:mn}=B,{Header:un,Sider:fn,Content:dn}=B.Layout,yn=r=>{let{collapsible:a,isMenuLoading:e,items:t,headerExtra:n,children:o,navWidth:i,filter:c,gameSelectOptions:p,title:I,subtitle:s}=r,{token:{colorBgContainer:v,colorBorder:u}}=mn.useToken(),{permissionVersion:L,navWidth:m,collapsible:f,mainPagePath:h,collapsed:x,setContext:k,isGlobal:P}=a$3(),[d,V]=useState(x),F=async()=>{V(!d),k({collapsed:!d});},D=a??f??!1;return jsxs(B.Layout,{children:[jsxs(fn,{collapsible:D,theme:"light",trigger:null,collapsed:d,width:i??m,style:{height:"100vh",overflowX:"hidden",overflowY:"auto",borderRightWidth:1,borderRightStyle:"solid",borderRightColor:u,transition:"all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1)"},children:[jsx(Be,{title:I,subtitle:s,mainPagePath:h,collapsed:d||!1}),jsx(de,{items:t,loading:e})]}),jsxs(B.Layout,{children:[jsx(un,{style:{padding:"0 24px",background:v},children:jsxs("div",{className:"flex justify-between items-center h-full",children:[jsxs(Space,{size:"small",split:jsx(Divider,{type:"vertical"}),className:"mr-6",children:[D&&jsx(Button,{type:"text",icon:d?jsx(MenuUnfoldOutlined,{}):jsx(MenuFoldOutlined,{}),style:{fontSize:"16px"},onClick:F}),L!=="v1"&&!P&&jsx(ze,{filter:c,options:p}),n?.left?.map(S=>jsx("span",{children:S.children},S.key))]}),jsxs(Space,{size:"small",split:jsx(Divider,{type:"vertical"}),children:[n?.right?.map(S=>jsx("span",{children:S.children},S.key)),jsx(ge,{})]})]})}),jsx(dn,{style:{overflow:"auto",padding:"24px 16px",maxHeight:"calc(100vh - 64px)",transition:"margin-left 0.2s cubic-bezier(0.645, 0.045, 0.355, 1)"},children:jsx(Suspense,{fallback:jsx(pn,{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"200px"}}),children:jsx(ye,{children:o})})})]})]})},gn=yn;var bn=r=>{let{code:a$2,config:e,children:t}=r,{data:n,isLoading:o}=a$1(a$2,e),{t:i}=a();return o?jsx(Spin,{style:{display:"flex",justifyContent:"center",alignItems:"center",height:200}}):n?jsx(Fragment,{children:t}):jsx(Result,{status:"403",subTitle:i("global.noEntitlement")})},vn=bn;export{ot as a,T as b,St as c,de as d,ye as e,ge as f,gn as g,vn as h};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a as a$1,f,g}from'./chunk-XQERUQGQ.js';import {c}from'./chunk-
|
|
1
|
+
import {a as a$1,f,g}from'./chunk-XQERUQGQ.js';import {c}from'./chunk-HZHE6R72.js';import {a}from'./chunk-7NM3DK6A.js';import {d,e}from'./chunk-WHOTHZUW.js';import {e as e$1}from'./chunk-LRMME3YZ.js';import {MinusCircleOutlined}from'@ant-design/icons';import {useQuery}from'@tanstack/react-query';import {App,Form,Input,Select,Row,Col,Empty,Button,Typography}from'antd';import {last,first}from'lodash-es';import {Fragment as Fragment$1}from'react';import {jsxs,Fragment,jsx}from'react/jsx-runtime';var {Text:q}=Typography,$=u=>{let{onChange:a,...r}=u,o=d(),{data:g,isLoading:d$1}=useQuery({queryKey:e.enums.gameGroups,queryFn:()=>o.get("/api/enum/get?enum=game_group&type=all")}),C=[{label:"\u901A\u7528",value:e$1}].concat(g?.map(s=>({label:s,value:s}))??[]);return jsx(Select,{...r,allowClear:!0,showSearch:!0,mode:"tags",optionFilterProp:"label",loading:d$1,options:C,onChange:s=>{last(s)===e$1?a?.([e$1]):first(s)===e$1?a?.(s.slice(1)):a?.(s);}})},z=u=>{let{groups:a,onChange:r,...o}=u,g=d(),{data:d$1,isLoading:C}=useQuery({queryKey:e.enums.gameIds(a||[]),queryFn:()=>g.get(`/api/enum/game_group/get_game_ids?game_groups=${a?.join(",")}`).then(t=>t?.list),enabled:!!a?.length}),h=d$1?.map(t=>({label:t.name,value:t.id}));return jsx(Select,{...o,allowClear:!0,showSearch:!0,optionFilterProp:"label",mode:"tags",loading:C,options:h,onChange:t=>{last(t)===e$1?r?.([e$1]):first(t)===e$1?r?.(t.slice(1)):r?.(t);}})},le=({mode:u,onSuccess:a$2})=>{let{message:r}=App.useApp(),{t:o}=a(),{data:g$1,isLoading:d}=a$1(),C=f(),h=g(),s=u==="create",t=o(s?"User.createTitle":"User.updateTitle"),S=jsxs(Fragment,{children:[jsx(Form.Item,{label:o("global.name"),name:"name",rules:[{required:!0}],children:jsx(Input,{disabled:!s})}),jsx(Form.Item,{label:o("global.role"),name:"roles",children:jsx(Select,{allowClear:!0,showSearch:!0,mode:"multiple",loading:d,optionFilterProp:"label",options:g$1?.map(n=>({label:n.name,value:n.name}))})})]});return c({title:t,width:"50vw",formProps:{autoComplete:"off",labelCol:{flex:"80px"}},content:S,onConfirm:async(n,f)=>{s?(await C.mutateAsync(n),r.success(o("User.createSuccessfully"))):(await h.mutateAsync({...n,id:f?.id}),r.success(o("User.updateSuccessfully"))),a$2?.();}})},ie=({mode:u,onSuccess:a$2})=>{let{message:r}=App.useApp(),{t:o}=a(),{data:g$1,isLoading:d}=a$1(),C=f(),h=g(),s=u==="create",t=o(s?"User.createTitle":"User.updateTitle"),S=jsxs(Fragment,{children:[jsx(Form.Item,{label:o("global.name"),name:"name",rules:[{required:!0}],children:jsx(Input,{disabled:!s})}),jsx(Form.List,{name:"permissions",children:(n,{add:f,remove:V})=>jsxs(Row,{gutter:8,children:[jsx(Col,{span:8,className:"text-center mb-4",children:jsx(q,{strong:!0,children:o("global.projectGroup")})}),jsx(Col,{span:10,className:"text-center mb-4",children:jsx(q,{strong:!0,children:o("global.game")})}),jsx(Col,{span:6,className:"text-center mb-4",children:jsx(q,{strong:!0,children:o("global.role")})}),n.map(m=>jsxs(Fragment$1,{children:[jsx(Col,{span:8,children:jsx(Form.Item,{noStyle:!0,shouldUpdate:!0,children:({setFieldValue:l})=>jsx(Form.Item,{name:[m.name,"game_group"],children:jsx($,{onChange:()=>{l(["permissions",m.name,"game_ids"],[]);}})})})}),jsx(Col,{span:10,children:jsx(Form.Item,{noStyle:!0,shouldUpdate:(l,y)=>l.permissions[m.name]?.game_group!==y.permissions[m.name]?.game_group,children:({getFieldValue:l})=>{let y=l(["permissions",m.name,"game_group"]);return jsx(Form.Item,{name:[m.name,"game_ids"],dependencies:[["permissions",m.name,"game_group"]],rules:[{required:y?.length,message:"\u8BF7\u9009\u62E9\u6E38\u620F"}],children:jsx(z,{groups:y})})}})}),jsx(Col,{span:6,children:jsxs("div",{className:"flex",children:[jsx("div",{className:"flex-1",children:jsx(Form.Item,{name:[m.name,"role"],rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u89D2\u8272"},({getFieldValue:l})=>({validator(y,K){return l("permissions").filter((I,j)=>!!I&&j!==m.name).some(I=>I.role===K)?Promise.reject(new Error("\u8BF7\u52FF\u91CD\u590D\u9009\u62E9\u89D2\u8272")):Promise.resolve()}})],children:jsx(Select,{allowClear:!0,showSearch:!0,optionFilterProp:"label",loading:d,options:g$1?.map(l=>({label:l.name,value:l.name}))})})}),jsx("div",{className:"w-8 text-center",children:jsx(Form.Item,{children:jsx(MinusCircleOutlined,{onClick:()=>{V(m.name);}})})})]})})]},m.key)),n.length===0&&jsx(Col,{span:24,children:jsx(Empty,{className:"mb-6"})}),jsx(Col,{span:24,children:jsx(Button,{block:!0,type:"dashed",onClick:()=>f(),children:o("global.add")})})]})})]});return c({title:t,width:"50vw",formProps:{autoComplete:"off",labelCol:{flex:"80px"}},content:S,onConfirm:async(n,f)=>{s?(await C.mutateAsync(n),r.success(o("User.createSuccessfully"))):(await h.mutateAsync({...n,id:f?.id}),r.success(o("User.updateSuccessfully"))),a$2?.();}})};export{le as a,ie as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {a as a$1}from'./chunk-7NM3DK6A.js';import {a}from'./chunk-X6ZI7RL7.js';import {Button,Tooltip}from'antd';import {jsx}from'react/jsx-runtime';var B=d=>{let{children:n,code:o,showLoading:i,disabled:l,config:m,...r}=d,u=o?Array.isArray(o)?o:[o]:[],{data:s,isLoading:f}=a(u,m),{t:P}=a$1();return f?jsx(Button,{loading:i,disabled:!i,...r,children:n}):typeof s=="boolean"||s&&Object.values(s).some(Boolean)?jsx(Button,{disabled:l,...r,children:n}):jsx(Tooltip,{defaultOpen:!1,title:P("global.noEntitlement"),children:jsx(Button,{disabled:!0,...r,children:n})})},y=B;export{y as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {lazy}from'react';import {Routes,Route,Navigate}from'react-router-dom';import {jsxs,jsx}from'react/jsx-runtime';var i=lazy(()=>import('./menuItemList-AS6ZDOTZ.js')),n=lazy(()=>import('./createMenuItem-HUQG2HQY.js')),s=lazy(()=>import('./updateMenuItem-7SUIOBXS.js')),l=jsxs(Routes,{children:[jsx(Route,{index:!0,element:jsx(i,{})}),jsx(Route,{path:"create",element:jsx(n,{})}),jsx(Route,{path:"update/:id",element:jsx(s,{})})]});var R=lazy(()=>import('./userList-
|
|
1
|
+
import {lazy}from'react';import {Routes,Route,Navigate}from'react-router-dom';import {jsxs,jsx}from'react/jsx-runtime';var i=lazy(()=>import('./menuItemList-AS6ZDOTZ.js')),n=lazy(()=>import('./createMenuItem-HUQG2HQY.js')),s=lazy(()=>import('./updateMenuItem-7SUIOBXS.js')),l=jsxs(Routes,{children:[jsx(Route,{index:!0,element:jsx(i,{})}),jsx(Route,{path:"create",element:jsx(n,{})}),jsx(Route,{path:"update/:id",element:jsx(s,{})})]});var R=lazy(()=>import('./userList-ELLBMK76.js')),c=lazy(()=>import('./userDetail-TXGT2W7X.js')),h=lazy(()=>import('./roleList-KWWVOLWJ.js')),x=lazy(()=>import('./roleDetail-2QUBILZK.js')),I=jsxs(Routes,{children:[jsx(Route,{index:!0,element:jsx(Navigate,{to:"user"})}),jsx(Route,{path:"user",element:jsx(R,{})}),jsx(Route,{path:"user/:id",element:jsx(c,{})}),jsx(Route,{path:"role",element:jsx(h,{})}),jsx(Route,{path:"role/:name",element:jsx(x,{})})]});export{l as a,I as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {b}from'./chunk-OLM4QNJB.js';import {Button,Drawer,Form}from'antd';import {useMemo,useEffect,useState,useCallback}from'react';import {create}from'zustand';import {jsxs,jsx}from'react/jsx-runtime';var V=create((s,o)=>({open:new Map,usedIds:new Set,isOpen:e=>o().open.get(e)??!1,show(e){s({open:new Map(o().open).set(e,!0)});},hide(e){s({open:new Map(o().open).set(e,!1)});},hideAll(){s({open:new Map});},checkUniqueness(e){let{usedIds:r}=o();return !r.has(e)},registerIds(e){let{usedIds:r}=o();return r.has(e)?!1:(s({usedIds:new Set(r).add(e)}),!0)},cleanup(e){let{open:r,usedIds:p}=o(),i=new Map(r),c=new Set(p);i.delete(e),c.delete(e),s({open:i,usedIds:c});}}));function F(s){let{content:o,onConfirm:e,afterOpen:r,afterClose:p,footer:i,confirmText:c="\u786E\u8BA4",cancelText:h="\u53D6\u6D88",confirmButtonProps:d,cancelButtonProps:D,...a}=s,n=useMemo(()=>b(),[]),{show:l,hide:u,isOpen:f,cleanup:w}=V();useEffect(()=>()=>{w(n);},[n,w]);let C=f(n),[t,m]=useState(!1),x=typeof o=="function",E=useCallback(async()=>{l(n),await r?.();},[n,l,r]),y=useCallback(()=>{u(n);},[n,u]),b$1=useCallback(async()=>{y(),await p?.();},[y,p]),R=useCallback(async()=>{try{m(!0),await e?.();}catch(O){throw console.error("Drawer confirm error:",O),O}finally{m(!1);}},[e]),B=i!==void 0?i:jsxs("div",{className:"flex gap-4 mx-4",children:[jsx(Button,{type:"primary",loading:t,...d,onClick:R,children:c}),jsx(Button,{...D,onClick:b$1,children:h})]}),N=jsx(Drawer,{...a,open:C,footer:B,onClose:b$1,children:x?o({hide:y}):o});return {id:n,show:E,hide:y,confirmLoading:t,drawer:N}}function q(s){let{content:o,form:e,formProps:r,onConfirm:p,onSuccess:i,afterClose:c,...h}=s,[d,D]=useState({}),[a]=Form.useForm();a=e||a;let n=typeof o=="function",{id:l,show:u,hide:f,drawer:w}=F({...h,content:t=>jsx(Form,{...r,form:a,children:n?o(d,t):o}),onConfirm:async()=>{try{let t=await a.validateFields();await p?.(t,d),i?.(),f();}catch(t){throw console.error("Form validation or submission error:",t),t}},afterClose:()=>{c?.(a);}}),C=useCallback(t=>{let{initialValues:m,extraValues:x}=t||{};x&&D(x),m&&a.setFieldsValue(m),u();},[a,u]);return {id:l,show:C,hide:f,drawer:w}}export{V as a,F as b,q as c};
|
package/lib/components.d.ts
CHANGED
|
@@ -1,71 +1,17 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { DrawerProps, Button, FormProps, FormInstance, MenuProps, SelectProps, ModalProps, ButtonProps } from 'antd';
|
|
3
1
|
import * as react from 'react';
|
|
4
|
-
import {
|
|
5
|
-
import { AnyObject } from 'antd/es/_util/type';
|
|
6
|
-
import { RecursivePartial } from './types.js';
|
|
7
|
-
import * as zustand from 'zustand';
|
|
2
|
+
import { FC, PropsWithChildren, Key, ReactNode, ReactElement, Ref, DetailedHTMLProps, ImgHTMLAttributes, ComponentType } from 'react';
|
|
8
3
|
import { ParagraphProps } from 'antd/es/typography/Paragraph';
|
|
4
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
|
+
import { FormInstance, MenuProps, SelectProps, ButtonProps } from 'antd';
|
|
6
|
+
import { AnyObject } from 'antd/es/_util/type';
|
|
9
7
|
import { TableProps } from 'antd/es/table';
|
|
8
|
+
import * as zustand from 'zustand';
|
|
10
9
|
import { ItemType, SubMenuType, MenuItemGroupType, MenuItemType } from 'antd/es/menu/interface';
|
|
11
10
|
import { Merge } from 'ts-essentials';
|
|
12
11
|
import { G as Game } from './types-DVKf5poe.js';
|
|
13
12
|
import { Options } from 'ky';
|
|
14
13
|
import { PermissionVersion } from './constants.js';
|
|
15
14
|
|
|
16
|
-
interface UseDrawerOperation {
|
|
17
|
-
hide: () => void;
|
|
18
|
-
}
|
|
19
|
-
interface UseDrawerProps extends Omit<DrawerProps, 'open' | 'confirmLoading' | 'onClose' | 'footer'> {
|
|
20
|
-
content?: ReactNode | ((operation: UseDrawerOperation) => ReactNode);
|
|
21
|
-
onConfirm?: () => void | Promise<void>;
|
|
22
|
-
afterOpen?: () => void | Promise<void>;
|
|
23
|
-
afterClose?: () => void | Promise<void>;
|
|
24
|
-
footer?: ReactNode | null;
|
|
25
|
-
confirmText?: string;
|
|
26
|
-
cancelText?: string;
|
|
27
|
-
confirmButtonProps?: ComponentProps<typeof Button>;
|
|
28
|
-
cancelButtonProps?: ComponentProps<typeof Button>;
|
|
29
|
-
}
|
|
30
|
-
declare function useDrawer(props: UseDrawerProps): {
|
|
31
|
-
id: number;
|
|
32
|
-
show: () => Promise<void>;
|
|
33
|
-
hide: () => void;
|
|
34
|
-
confirmLoading: boolean;
|
|
35
|
-
drawer: react_jsx_runtime.JSX.Element;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
interface UseFormDrawerProps<Values extends AnyObject = AnyObject, ExtraValues = any> extends Omit<UseDrawerProps, 'onConfirm' | 'content' | 'onShow' | 'afterClose'> {
|
|
39
|
-
formProps?: Omit<FormProps, 'form'>;
|
|
40
|
-
form?: FormInstance<Values>;
|
|
41
|
-
content?: ReactNode | ((extraValues: ExtraValues, operation: UseDrawerOperation) => ReactNode);
|
|
42
|
-
onConfirm?: (values: Values, extraValues: ExtraValues) => void | Promise<void>;
|
|
43
|
-
onSuccess?: () => void;
|
|
44
|
-
afterClose?: (form: FormInstance<Values>) => void;
|
|
45
|
-
}
|
|
46
|
-
declare function useFormDrawer<Values extends AnyObject = AnyObject, ExtraValues = any>(props: UseFormDrawerProps<Values, ExtraValues>): {
|
|
47
|
-
id: number;
|
|
48
|
-
show: (options?: {
|
|
49
|
-
initialValues?: RecursivePartial<Values>;
|
|
50
|
-
extraValues?: ExtraValues;
|
|
51
|
-
}) => void;
|
|
52
|
-
hide: () => void;
|
|
53
|
-
drawer: react_jsx_runtime.JSX.Element;
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
interface DrawerState {
|
|
57
|
-
open: Map<number, boolean>;
|
|
58
|
-
usedIds: Set<number>;
|
|
59
|
-
isOpen: (uuid: number) => boolean;
|
|
60
|
-
show: (uuid: number) => void;
|
|
61
|
-
hide: (uuid: number) => void;
|
|
62
|
-
hideAll: () => void;
|
|
63
|
-
checkUniqueness: (uuid: number) => boolean;
|
|
64
|
-
registerIds: (uuid: number) => boolean;
|
|
65
|
-
cleanup: (uuid: number) => void;
|
|
66
|
-
}
|
|
67
|
-
declare const useDrawerStore: zustand.UseBoundStore<zustand.StoreApi<DrawerState>>;
|
|
68
|
-
|
|
69
15
|
interface DynamicTagsProps {
|
|
70
16
|
initialTags?: string[];
|
|
71
17
|
addable?: boolean;
|
|
@@ -236,53 +182,6 @@ declare const Layout: FC<PropsWithChildren<LayoutProps>>;
|
|
|
236
182
|
type LogoProps = Omit<DetailedHTMLProps<ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, 'src' | 'alt'>;
|
|
237
183
|
declare const Logo: FC<LogoProps>;
|
|
238
184
|
|
|
239
|
-
interface UseModalOperation {
|
|
240
|
-
hide: () => void;
|
|
241
|
-
}
|
|
242
|
-
interface UseModalProps extends Omit<ModalProps, 'open' | 'confirmLoading' | 'onOk' | 'onCancel'> {
|
|
243
|
-
content?: ReactNode | ((operation: UseModalOperation) => ReactNode);
|
|
244
|
-
onConfirm?: () => void | Promise<void>;
|
|
245
|
-
afterOpen?: () => void | Promise<void>;
|
|
246
|
-
afterClose?: () => void | Promise<void>;
|
|
247
|
-
}
|
|
248
|
-
declare function useModal(props: UseModalProps): {
|
|
249
|
-
id: number;
|
|
250
|
-
show: () => Promise<void>;
|
|
251
|
-
hide: () => void;
|
|
252
|
-
modal: react_jsx_runtime.JSX.Element;
|
|
253
|
-
};
|
|
254
|
-
|
|
255
|
-
interface UseFormModalProps<Values extends AnyObject = AnyObject, ExtraValues = any> extends Omit<UseModalProps, 'onConfirm' | 'content' | 'onShow' | 'afterClose'> {
|
|
256
|
-
formProps?: Omit<FormProps, 'form'>;
|
|
257
|
-
form?: FormInstance<Values>;
|
|
258
|
-
content?: ReactNode | ((extraValues: ExtraValues, operation: UseModalOperation) => ReactNode);
|
|
259
|
-
onConfirm?: (values: Values, extraValues: ExtraValues) => void | Promise<void>;
|
|
260
|
-
onSuccess?: () => void;
|
|
261
|
-
afterClose?: (form: FormInstance<Values>) => void;
|
|
262
|
-
}
|
|
263
|
-
declare function useFormModal<Values extends AnyObject = AnyObject, ExtraValues = any>(props: UseFormModalProps<Values, ExtraValues>): {
|
|
264
|
-
id: number;
|
|
265
|
-
show: (options?: {
|
|
266
|
-
initialValues?: RecursivePartial<Values>;
|
|
267
|
-
extraValues?: ExtraValues;
|
|
268
|
-
}) => void;
|
|
269
|
-
hide: () => void;
|
|
270
|
-
modal: react_jsx_runtime.JSX.Element;
|
|
271
|
-
};
|
|
272
|
-
|
|
273
|
-
interface ModalState {
|
|
274
|
-
open: Map<number, boolean>;
|
|
275
|
-
usedIds: Set<number>;
|
|
276
|
-
isOpen: (uuid: number) => boolean;
|
|
277
|
-
show: (uuid: number) => void;
|
|
278
|
-
hide: (uuid: number) => void;
|
|
279
|
-
hideAll: () => void;
|
|
280
|
-
checkUniqueness: (uuid: number) => boolean;
|
|
281
|
-
registerIds: (uuid: number) => boolean;
|
|
282
|
-
cleanup: (uuid: number) => void;
|
|
283
|
-
}
|
|
284
|
-
declare const useModalStore: zustand.UseBoundStore<zustand.StoreApi<ModalState>>;
|
|
285
|
-
|
|
286
185
|
interface PermissionButtonProps extends ButtonProps {
|
|
287
186
|
code?: string | string[];
|
|
288
187
|
showLoading?: boolean;
|
|
@@ -527,4 +426,4 @@ declare const withContext: (Component: ComponentType, providerProps: Omit<Toolki
|
|
|
527
426
|
|
|
528
427
|
declare const UserWidget: FC;
|
|
529
428
|
|
|
530
|
-
export { DynamicTags, type DynamicTagsProps, ExpandableParagraph, type ExpandableParagraphProps, FilterFormWrapper, type FilterFormWrapperProps, Game, Highlight, type HighlightProps, InfiniteList, InfiniteListAction, type InfiniteListPayload, type InfiniteListProps, type InfiniteListRef, type InfiniteListRequestConfig, Layout, type LayoutProps, Logo, type LogoProps, NavMenu, type NavMenuItem, PermissionButton, type PermissionButtonProps, QueryList, QueryListAction, type QueryListPayload, type QueryListProps, type QueryListRef, RequireGame, RequirePermission, type RequirePermissionProps, ToolkitsProvider, type ToolkitsProviderProps,
|
|
429
|
+
export { DynamicTags, type DynamicTagsProps, ExpandableParagraph, type ExpandableParagraphProps, FilterFormWrapper, type FilterFormWrapperProps, Game, Highlight, type HighlightProps, InfiniteList, InfiniteListAction, type InfiniteListPayload, type InfiniteListProps, type InfiniteListRef, type InfiniteListRequestConfig, Layout, type LayoutProps, Logo, type LogoProps, NavMenu, type NavMenuItem, PermissionButton, type PermissionButtonProps, QueryList, QueryListAction, type QueryListPayload, type QueryListProps, type QueryListRef, RequireGame, RequirePermission, type RequirePermissionProps, ToolkitsProvider, type ToolkitsProviderProps, UserWidget, useInfiniteListStore, useQueryListStore, useToolkitsStore, withContext };
|
package/lib/components.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{
|
|
1
|
+
export{a as DynamicTags,c as InfiniteList,g as Layout,d as NavMenu,e as RequireGame,h as RequirePermission,f as UserWidget,b as useInfiniteListStore}from'./chunk-MSKNHKMD.js';export{a as Highlight}from'./chunk-RITI5HRV.js';export{a as PermissionButton}from'./chunk-SJK2ZPEL.js';export{a as ExpandableParagraph,b as Logo}from'./chunk-JTDKSGJR.js';export{a as FilterFormWrapper,d as QueryList,c as QueryListAction,b as useQueryListStore}from'./chunk-4GULXGNG.js';import'./chunk-7NM3DK6A.js';import'./chunk-X6ZI7RL7.js';export{c as ToolkitsProvider,a as useToolkitsStore,b as withContext}from'./chunk-WHOTHZUW.js';import'./chunk-LRMME3YZ.js';import'./chunk-OLM4QNJB.js';
|
package/lib/hooks.d.ts
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { DrawerProps, Button, FormProps, FormInstance, ModalProps } from 'antd';
|
|
3
|
+
import { ReactNode, ComponentProps } from 'react';
|
|
4
|
+
import { AnyObject } from 'antd/es/_util/type';
|
|
5
|
+
import { RecursivePartial } from './types.js';
|
|
6
|
+
import * as zustand from 'zustand';
|
|
7
|
+
|
|
8
|
+
interface UseDrawerOperation {
|
|
9
|
+
hide: () => void;
|
|
10
|
+
}
|
|
11
|
+
interface UseDrawerProps extends Omit<DrawerProps, 'open' | 'confirmLoading' | 'onClose' | 'footer'> {
|
|
12
|
+
content?: ReactNode | ((operation: UseDrawerOperation) => ReactNode);
|
|
13
|
+
onConfirm?: () => void | Promise<void>;
|
|
14
|
+
afterOpen?: () => void | Promise<void>;
|
|
15
|
+
afterClose?: () => void | Promise<void>;
|
|
16
|
+
footer?: ReactNode | null;
|
|
17
|
+
confirmText?: string;
|
|
18
|
+
cancelText?: string;
|
|
19
|
+
confirmButtonProps?: ComponentProps<typeof Button>;
|
|
20
|
+
cancelButtonProps?: ComponentProps<typeof Button>;
|
|
21
|
+
}
|
|
22
|
+
declare function useDrawer(props: UseDrawerProps): {
|
|
23
|
+
id: number;
|
|
24
|
+
show: () => Promise<void>;
|
|
25
|
+
hide: () => void;
|
|
26
|
+
confirmLoading: boolean;
|
|
27
|
+
drawer: react_jsx_runtime.JSX.Element;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
interface UseFormDrawerProps<Values extends AnyObject = AnyObject, ExtraValues = any> extends Omit<UseDrawerProps, 'onConfirm' | 'content' | 'onShow' | 'afterClose'> {
|
|
31
|
+
formProps?: Omit<FormProps, 'form'>;
|
|
32
|
+
form?: FormInstance<Values>;
|
|
33
|
+
content?: ReactNode | ((extraValues: ExtraValues, operation: UseDrawerOperation) => ReactNode);
|
|
34
|
+
onConfirm?: (values: Values, extraValues: ExtraValues) => void | Promise<void>;
|
|
35
|
+
onSuccess?: () => void;
|
|
36
|
+
afterClose?: (form: FormInstance<Values>) => void;
|
|
37
|
+
}
|
|
38
|
+
declare function useFormDrawer<Values extends AnyObject = AnyObject, ExtraValues = any>(props: UseFormDrawerProps<Values, ExtraValues>): {
|
|
39
|
+
id: number;
|
|
40
|
+
show: (options?: {
|
|
41
|
+
initialValues?: RecursivePartial<Values>;
|
|
42
|
+
extraValues?: ExtraValues;
|
|
43
|
+
}) => void;
|
|
44
|
+
hide: () => void;
|
|
45
|
+
drawer: react_jsx_runtime.JSX.Element;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
interface DrawerState {
|
|
49
|
+
open: Map<number, boolean>;
|
|
50
|
+
usedIds: Set<number>;
|
|
51
|
+
isOpen: (uuid: number) => boolean;
|
|
52
|
+
show: (uuid: number) => void;
|
|
53
|
+
hide: (uuid: number) => void;
|
|
54
|
+
hideAll: () => void;
|
|
55
|
+
checkUniqueness: (uuid: number) => boolean;
|
|
56
|
+
registerIds: (uuid: number) => boolean;
|
|
57
|
+
cleanup: (uuid: number) => void;
|
|
58
|
+
}
|
|
59
|
+
declare const useDrawerStore: zustand.UseBoundStore<zustand.StoreApi<DrawerState>>;
|
|
60
|
+
|
|
61
|
+
interface UseModalOperation {
|
|
62
|
+
hide: () => void;
|
|
63
|
+
}
|
|
64
|
+
interface UseModalProps extends Omit<ModalProps, 'open' | 'confirmLoading' | 'onOk' | 'onCancel'> {
|
|
65
|
+
content?: ReactNode | ((operation: UseModalOperation) => ReactNode);
|
|
66
|
+
onConfirm?: () => void | Promise<void>;
|
|
67
|
+
afterOpen?: () => void | Promise<void>;
|
|
68
|
+
afterClose?: () => void | Promise<void>;
|
|
69
|
+
}
|
|
70
|
+
declare function useModal(props: UseModalProps): {
|
|
71
|
+
id: number;
|
|
72
|
+
show: () => Promise<void>;
|
|
73
|
+
hide: () => void;
|
|
74
|
+
modal: react_jsx_runtime.JSX.Element;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
interface UseFormModalProps<Values extends AnyObject = AnyObject, ExtraValues = any> extends Omit<UseModalProps, 'onConfirm' | 'content' | 'onShow' | 'afterClose'> {
|
|
78
|
+
formProps?: Omit<FormProps, 'form'>;
|
|
79
|
+
form?: FormInstance<Values>;
|
|
80
|
+
content?: ReactNode | ((extraValues: ExtraValues, operation: UseModalOperation) => ReactNode);
|
|
81
|
+
onConfirm?: (values: Values, extraValues: ExtraValues) => void | Promise<void>;
|
|
82
|
+
onSuccess?: () => void;
|
|
83
|
+
afterClose?: (form: FormInstance<Values>) => void;
|
|
84
|
+
}
|
|
85
|
+
declare function useFormModal<Values extends AnyObject = AnyObject, ExtraValues = any>(props: UseFormModalProps<Values, ExtraValues>): {
|
|
86
|
+
id: number;
|
|
87
|
+
show: (options?: {
|
|
88
|
+
initialValues?: RecursivePartial<Values>;
|
|
89
|
+
extraValues?: ExtraValues;
|
|
90
|
+
}) => void;
|
|
91
|
+
hide: () => void;
|
|
92
|
+
modal: react_jsx_runtime.JSX.Element;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
interface ModalState {
|
|
96
|
+
open: Map<number, boolean>;
|
|
97
|
+
usedIds: Set<number>;
|
|
98
|
+
isOpen: (uuid: number) => boolean;
|
|
99
|
+
show: (uuid: number) => void;
|
|
100
|
+
hide: (uuid: number) => void;
|
|
101
|
+
hideAll: () => void;
|
|
102
|
+
checkUniqueness: (uuid: number) => boolean;
|
|
103
|
+
registerIds: (uuid: number) => boolean;
|
|
104
|
+
cleanup: (uuid: number) => void;
|
|
105
|
+
}
|
|
106
|
+
declare const useModalStore: zustand.UseBoundStore<zustand.StoreApi<ModalState>>;
|
|
107
|
+
|
|
108
|
+
export { type UseFormDrawerProps, type UseFormModalProps, useDrawer, useDrawerStore, useFormDrawer, useFormModal, useModal, useModalStore };
|
package/lib/hooks.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{b as useDrawer,a as useDrawerStore,c as useFormDrawer}from'./chunk-ZCPZYTPN.js';export{c as useFormModal,b as useModal,a as useModalStore}from'./chunk-HZHE6R72.js';import'./chunk-OLM4QNJB.js';
|
package/lib/index.d.ts
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
export { DynamicTags, DynamicTagsProps, ExpandableParagraph, ExpandableParagraphProps, FilterFormWrapper, FilterFormWrapperProps, Highlight, HighlightProps, InfiniteList, InfiniteListAction, InfiniteListPayload, InfiniteListProps, InfiniteListRef, InfiniteListRequestConfig, Layout, LayoutProps, Logo, LogoProps, NavMenu, NavMenuItem, PermissionButton, PermissionButtonProps, QueryList, QueryListAction, QueryListPayload, QueryListProps, QueryListRef, RequireGame, RequirePermission, RequirePermissionProps, ToolkitsProvider, ToolkitsProviderProps,
|
|
1
|
+
export { DynamicTags, DynamicTagsProps, ExpandableParagraph, ExpandableParagraphProps, FilterFormWrapper, FilterFormWrapperProps, Highlight, HighlightProps, InfiniteList, InfiniteListAction, InfiniteListPayload, InfiniteListProps, InfiniteListRef, InfiniteListRequestConfig, Layout, LayoutProps, Logo, LogoProps, NavMenu, NavMenuItem, PermissionButton, PermissionButtonProps, QueryList, QueryListAction, QueryListPayload, QueryListProps, QueryListRef, RequireGame, RequirePermission, RequirePermissionProps, ToolkitsProvider, ToolkitsProviderProps, UserWidget, useInfiniteListStore, useQueryListStore, useToolkitsStore, withContext } from './components.js';
|
|
2
2
|
export { G as Game } from './types-DVKf5poe.js';
|
|
3
3
|
export { APP_ID_HEADER, FRONTEND_ROUTE_PREFIX, PermissionVersion, SSO_URL, WILDCARD } from './constants.js';
|
|
4
|
+
export { UseFormDrawerProps, UseFormModalProps, useDrawer, useDrawerStore, useFormDrawer, useFormModal, useModal, useModalStore } from './hooks.js';
|
|
4
5
|
export { menu, permission } from './modules.js';
|
|
5
6
|
export { NotFound, OperationLogList, SignIn } from './pages.js';
|
|
6
7
|
export { useGames, useMenuList, usePermission } from './services.js';
|
|
7
8
|
export { MenuListItem, Permission, RecursivePartial } from './types.js';
|
|
8
9
|
export { generateId, mixedStorage } from './utils.js';
|
|
10
|
+
import 'react';
|
|
11
|
+
import 'antd/es/typography/Paragraph';
|
|
9
12
|
import 'react/jsx-runtime';
|
|
10
13
|
import 'antd';
|
|
11
|
-
import 'react';
|
|
12
14
|
import 'antd/es/_util/type';
|
|
13
|
-
import 'zustand';
|
|
14
|
-
import 'antd/es/typography/Paragraph';
|
|
15
15
|
import 'antd/es/table';
|
|
16
|
+
import 'zustand';
|
|
16
17
|
import 'antd/es/menu/interface';
|
|
17
18
|
import 'ts-essentials';
|
|
18
19
|
import 'ky';
|
package/lib/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{
|
|
1
|
+
export{a as DynamicTags,c as InfiniteList,g as Layout,d as NavMenu,e as RequireGame,h as RequirePermission,f as UserWidget,b as useInfiniteListStore}from'./chunk-MSKNHKMD.js';export{a as Highlight}from'./chunk-RITI5HRV.js';export{a as PermissionButton}from'./chunk-SJK2ZPEL.js';export{b as useDrawer,a as useDrawerStore,c as useFormDrawer}from'./chunk-ZCPZYTPN.js';export{c as useFormModal,b as useModal,a as useModalStore}from'./chunk-HZHE6R72.js';export{a as menu,b as permission}from'./chunk-YIJSACFM.js';export{a as NotFound,b as OperationLogList,c as SignIn}from'./chunk-XWIQENHQ.js';export{a as ExpandableParagraph,b as Logo}from'./chunk-JTDKSGJR.js';export{a as FilterFormWrapper,d as QueryList,c as QueryListAction,b as useQueryListStore}from'./chunk-4GULXGNG.js';import'./chunk-7NM3DK6A.js';export{c as useGames,b as useMenuList,a as usePermission}from'./chunk-X6ZI7RL7.js';export{c as ToolkitsProvider,a as useToolkitsStore,b as withContext}from'./chunk-WHOTHZUW.js';export{b as APP_ID_HEADER,c as FRONTEND_ROUTE_PREFIX,d as PermissionVersion,a as SSO_URL,e as WILDCARD}from'./chunk-LRMME3YZ.js';export{b as generateId,a as mixedStorage}from'./chunk-OLM4QNJB.js';import'./chunk-FXPGR372.js';
|
package/lib/modules.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as menu,b as permission}from'./chunk-
|
|
1
|
+
export{a as menu,b as permission}from'./chunk-YIJSACFM.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {b as b$2,a as a$2}from'./chunk-JLHCYGWL.js';import {b as b$1}from'./chunk-XQERUQGQ.js';import {a as a$1}from'./chunk-SJK2ZPEL.js';import'./chunk-HZHE6R72.js';import {a}from'./chunk-7NM3DK6A.js';import'./chunk-X6ZI7RL7.js';import {b}from'./chunk-WHOTHZUW.js';import'./chunk-LRMME3YZ.js';import'./chunk-OLM4QNJB.js';import {Breadcrumb,Card,Skeleton,Descriptions,Divider}from'antd';import {useParams,Link}from'react-router-dom';import {jsxs,Fragment,jsx}from'react/jsx-runtime';var C=()=>{let c=useParams(),{t:o}=a(),{data:t,isLoading:d,refetch:u}=b$1(c.name),{show:f,modal:b}=b$2({mode:"update",onSuccess(){u();}}),D=async()=>{f({initialValues:{permissions:t?.permissions,name:t?.name.replace(/^role_/,"")},extraValues:{id:t.id}});};return jsxs(Fragment,{children:[jsx(Breadcrumb,{style:{marginBottom:"1.5rem"},items:[{key:"1",title:jsx(Link,{to:"..",relative:"path",children:o("global.role")})},{key:"2",title:o("RoleDetail.title")}]}),jsx(Card,{title:o("RoleDetail.title"),extra:jsx(a$1,{code:"200003",onClick:D,children:o("global.update")}),children:jsxs(Skeleton,{loading:d,children:[jsxs(Descriptions,{column:2,layout:"vertical",className:"mb-6",children:[jsx(Descriptions.Item,{label:o("global.name"),children:t?.name}),jsx(Descriptions.Item,{label:"ID",children:t?.id}),jsx(Descriptions.Item,{label:o("global.creationTime"),children:t?.ctime})]}),jsx(Divider,{}),jsx(a$2,{readonly:!0,value:t?.permissions})]})}),b]})},N=b(C,{isGlobal:!0});export{N as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {b as b$2}from'./chunk-JLHCYGWL.js';import {e}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 as d$1}from'./chunk-4GULXGNG.js';import {a as a$1}from'./chunk-7NM3DK6A.js';import {a}from'./chunk-X6ZI7RL7.js';import {b,a as a$2,d}from'./chunk-WHOTHZUW.js';import'./chunk-LRMME3YZ.js';import'./chunk-OLM4QNJB.js';import {UsergroupAddOutlined}from'@ant-design/icons';import {App,Space,Card}from'antd';import {Link}from'react-router-dom';import {jsx,Fragment,jsxs}from'react/jsx-runtime';var $=()=>{let{modal:h,message:k}=App.useApp(),{data:L}=a("200005"),{t}=a$1(),{permissionVersion:T}=a$2(e=>e),{refetch:s}=b$1(),b=d(),{show:C,modal:w}=b$2({mode:"create",onSuccess(){s("role-list",{page:1});}}),{show:V,modal:I}=b$2({mode:"update",onSuccess(){s("role-list");}}),S=e(),x=async e=>{let o=await b.get(`/api/usystem/role/info${T==="v2"?"V2":""}?name=${e.name}`);V({initialValues:{permissions:o.permissions,name:o.name.replace(/^role_/,"")},extraValues:{id:o?.id}});},P=[{title:t("global.name"),key:"name",render(e){return L?jsx(Link,{to:`${e.name}`,relative:"path",children:e.name}):jsx(Fragment,{children:e.name})}},{title:"ID",dataIndex:"id",key:"id"},{title:t("global.creationTime"),dataIndex:"ctime",key:"ctime"},{title:t("global.operation"),width:150,align:"center",render:(e,o)=>jsxs(Space,{size:"small",children:[jsx(a$3,{code:"200003",size:"small",type:"link",onClick:async()=>{x(o);},children:t("global.update")}),jsx(a$3,{danger:!0,code:"200004",size:"small",type:"link",onClick:()=>{h.confirm({title:t("Role.deleteTitle"),content:jsx(a$4,{texts:[o.name],children:t("Role.deleteContent",{role:o.name})}),async onOk(){await S.mutate({id:o.id,name:o.name}),s("role-list"),k.success(t("Role.deleteSuccessfully"));}});},children:t("global.delete")})]})}];return jsxs(Fragment,{children:[jsx(Card,{title:t("global.role"),extra:jsx(a$3,{type:"primary",code:"200002",icon:jsx(UsergroupAddOutlined,{}),onClick:()=>{C();},children:t("Role.createTitle")}),children:jsx(d$1,{identifier:"role-list",rowKey:"name",columns:P,code:"200001",request:{url:"/api/usystem/role/list",method:"GET"},dataAdapter:e=>({total:e?.Total,items:e?.List})})}),w,I]})},W=b($,{isGlobal:!0});export{W 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/locale/context.js
CHANGED
|
@@ -1,9 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
// src/locale/context.ts
|
|
4
|
-
var LocaleContext = createContext(void 0);
|
|
5
|
-
var context_default = LocaleContext;
|
|
6
|
-
|
|
7
|
-
export { context_default as default };
|
|
8
|
-
//# sourceMappingURL=context.js.map
|
|
9
|
-
//# sourceMappingURL=context.js.map
|
|
1
|
+
import {createContext}from'react';var o=createContext(void 0),n=o;export{n as default};
|