react-toolkits 0.8.60 → 0.8.61

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 CHANGED
@@ -1,10 +1,17 @@
1
1
  # react-toolkits
2
2
 
3
+ ## 0.8.61
4
+
5
+ ### Patch Changes
6
+
7
+ - a2c318a: chore: remove onRehydrateStorage
8
+
3
9
  ## 0.8.60
4
10
 
5
11
  ### Patch Changes
6
12
 
7
- - c3f1c27: fix: data does not updated while game has changed
13
+ - 2060653: fix: data does not updated while game has changed
14
+ - 2060653: refactor: add useRequest hook
8
15
 
9
16
  ## 0.8.59
10
17
 
@@ -0,0 +1,219 @@
1
+ import { I as O, w as W, f as h, g as x, s as z, m as q, h as V, U as y, i as U, e as u, d as M, c as K } from "./index-SyU1uyhZ.chunk.js";
2
+ import L, { useRef as c, useCallback as G, useState as N } from "react";
3
+ const P = O ? (e) => {
4
+ e();
5
+ } : L.startTransition, $ = (e) => {
6
+ const [, s] = N({}), t = c(!1), r = c(e), a = c({
7
+ data: !1,
8
+ error: !1,
9
+ isValidating: !1
10
+ }), m = G((l) => {
11
+ let o = !1;
12
+ const g = r.current;
13
+ for (const p in l) {
14
+ const n = p;
15
+ g[n] !== l[n] && (g[n] = l[n], a.current[n] && (o = !0));
16
+ }
17
+ o && !t.current && s({});
18
+ }, []);
19
+ return U(() => (t.current = !1, () => {
20
+ t.current = !0;
21
+ })), [
22
+ r,
23
+ a.current,
24
+ m
25
+ ];
26
+ }, j = () => (e, s, t = {}) => {
27
+ const { mutate: r } = x(), a = c(e), m = c(s), l = c(t), o = c(0), [g, p, n] = $({
28
+ data: y,
29
+ error: y,
30
+ isMutating: !1
31
+ }), b = g.current, v = G(
32
+ async (T, k) => {
33
+ const [R, I] = z(a.current);
34
+ if (!m.current)
35
+ throw new Error("Can’t trigger the mutation: missing fetcher.");
36
+ if (!R)
37
+ throw new Error("Can’t trigger the mutation: missing key.");
38
+ const f = q(q({
39
+ populateCache: !1,
40
+ throwOnError: !0
41
+ }, l.current), k), w = V();
42
+ o.current = w, n({
43
+ isMutating: !0
44
+ });
45
+ try {
46
+ const i = await r(
47
+ R,
48
+ m.current(I, {
49
+ arg: T
50
+ }),
51
+ // We must throw the error here so we can catch and update the states.
52
+ q(f, {
53
+ throwOnError: !0
54
+ })
55
+ );
56
+ if (o.current <= w) {
57
+ var S, C;
58
+ P(() => n({
59
+ data: i,
60
+ isMutating: !1,
61
+ error: void 0
62
+ })), (S = (C = f).onSuccess) == null || S.call(C, i, R, f);
63
+ }
64
+ return i;
65
+ } catch (i) {
66
+ if (o.current <= w) {
67
+ var E, A;
68
+ if (P(() => n({
69
+ error: i,
70
+ isMutating: !1
71
+ })), (E = (A = f).onError) == null || E.call(A, i, R, f), f.throwOnError)
72
+ throw i;
73
+ }
74
+ }
75
+ },
76
+ // eslint-disable-next-line react-hooks/exhaustive-deps
77
+ []
78
+ ), D = G(() => {
79
+ o.current = V(), n({
80
+ data: y,
81
+ error: y,
82
+ isMutating: !1
83
+ });
84
+ }, []);
85
+ return U(() => {
86
+ a.current = e, m.current = s, l.current = t;
87
+ }), {
88
+ trigger: v,
89
+ reset: D,
90
+ get data() {
91
+ return p.data = !0, b.data;
92
+ },
93
+ get error() {
94
+ return p.error = !0, b.error;
95
+ },
96
+ get isMutating() {
97
+ return p.isMutating = !0, b.isMutating;
98
+ }
99
+ };
100
+ }, d = W(h, j);
101
+ function B() {
102
+ const e = u();
103
+ return h(
104
+ "/api/usystem/user/allPermssions",
105
+ (s) => e(s, { isGlobal: !0 }).then((t) => t.data)
106
+ );
107
+ }
108
+ function H() {
109
+ const e = u();
110
+ return h(
111
+ "/api/usystem/user/allPermissionsV2",
112
+ (s) => e(s, { isGlobal: !0 }).then((t) => t.data)
113
+ );
114
+ }
115
+ function J() {
116
+ const e = u(), { accessible: s } = K("200005", !0);
117
+ return h(
118
+ s ? "/api/usystem/role/all" : null,
119
+ (t) => e(t, { isGlobal: !0 }).then((r) => r.data)
120
+ );
121
+ }
122
+ function Q(e) {
123
+ const s = u(), { usePermissionApiV2: t } = M();
124
+ return h(
125
+ `/api/usystem/role/${t ? "infoV2" : "info"}?name=${e}`,
126
+ (r) => s(r, { isGlobal: !0 }).then((a) => a.data)
127
+ );
128
+ }
129
+ function X() {
130
+ const e = u(), { usePermissionApiV2: s } = M();
131
+ return d(
132
+ s ? "/api/usystem/role/createV2" : "/api/usystem/role/create",
133
+ (t, {
134
+ arg: r
135
+ }) => e(t, {
136
+ method: "post",
137
+ body: r,
138
+ isGlobal: !0
139
+ })
140
+ );
141
+ }
142
+ function Z() {
143
+ const e = u(), { usePermissionApiV2: s } = M();
144
+ return d(
145
+ s ? "/api/usystem/role/updateV2" : "/api/usystem/role/update",
146
+ (t, {
147
+ arg: r
148
+ }) => e(t, {
149
+ method: "post",
150
+ body: r,
151
+ isGlobal: !0
152
+ })
153
+ );
154
+ }
155
+ function _() {
156
+ const e = u();
157
+ return d(
158
+ "/api/usystem/role/delete",
159
+ (s, {
160
+ arg: t
161
+ }) => e(s, {
162
+ method: "post",
163
+ body: t,
164
+ isGlobal: !0
165
+ })
166
+ );
167
+ }
168
+ function ee() {
169
+ const e = u();
170
+ return d(
171
+ "/api/usystem/user/create",
172
+ (s, {
173
+ arg: t
174
+ }) => e(s, {
175
+ method: "post",
176
+ body: t,
177
+ isGlobal: !0
178
+ })
179
+ );
180
+ }
181
+ function te() {
182
+ const e = u();
183
+ return d(
184
+ "/api/usystem/user/update",
185
+ (s, {
186
+ arg: t
187
+ }) => e(s, {
188
+ method: "post",
189
+ body: t,
190
+ isGlobal: !0
191
+ })
192
+ );
193
+ }
194
+ function se() {
195
+ const e = u();
196
+ return d(
197
+ "/api/usystem/user/delete",
198
+ (s, {
199
+ arg: t
200
+ }) => e(s, {
201
+ method: "post",
202
+ body: t,
203
+ isGlobal: !0
204
+ })
205
+ );
206
+ }
207
+ export {
208
+ ee as a,
209
+ J as b,
210
+ te as c,
211
+ _ as d,
212
+ X as e,
213
+ Z as f,
214
+ Q as g,
215
+ B as h,
216
+ H as i,
217
+ se as u
218
+ };
219
+ //# sourceMappingURL=index-3oDF7W07.chunk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-3oDF7W07.chunk.js","sources":["../../../node_modules/.pnpm/swr@2.2.4_react@18.2.0/node_modules/swr/mutation/dist/index.mjs","../src/features/permission/hooks/index.ts"],"sourcesContent":["import React, { useState, useRef, useCallback } from 'react';\nimport useSWR, { useSWRConfig } from 'swr';\nimport { IS_REACT_LEGACY, useIsomorphicLayoutEffect, withMiddleware, serialize, mergeObjects, getTimestamp, UNDEFINED } from 'swr/_internal';\n\nconst startTransition = IS_REACT_LEGACY ? (cb)=>{\n cb();\n} : React.startTransition;\n/**\n * An implementation of state with dependency-tracking.\n */ const useStateWithDeps = (state)=>{\n const [, rerender] = useState({});\n const unmountedRef = useRef(false);\n const stateRef = useRef(state);\n // If a state property (data, error, or isValidating) is accessed by the render\n // function, we mark the property as a dependency so if it is updated again\n // in the future, we trigger a rerender.\n // This is also known as dependency-tracking.\n const stateDependenciesRef = useRef({\n data: false,\n error: false,\n isValidating: false\n });\n /**\n * @param payload To change stateRef, pass the values explicitly to setState:\n * @example\n * ```js\n * setState({\n * isValidating: false\n * data: newData // set data to newData\n * error: undefined // set error to undefined\n * })\n *\n * setState({\n * isValidating: false\n * data: undefined // set data to undefined\n * error: err // set error to err\n * })\n * ```\n */ const setState = useCallback((payload)=>{\n let shouldRerender = false;\n const currentState = stateRef.current;\n for(const _ in payload){\n const k = _;\n // If the property has changed, update the state and mark rerender as\n // needed.\n if (currentState[k] !== payload[k]) {\n currentState[k] = payload[k];\n // If the property is accessed by the component, a rerender should be\n // triggered.\n if (stateDependenciesRef.current[k]) {\n shouldRerender = true;\n }\n }\n }\n if (shouldRerender && !unmountedRef.current) {\n rerender({});\n }\n }, []);\n useIsomorphicLayoutEffect(()=>{\n unmountedRef.current = false;\n return ()=>{\n unmountedRef.current = true;\n };\n });\n return [\n stateRef,\n stateDependenciesRef.current,\n setState\n ];\n};\n\nconst mutation = ()=>(key, fetcher, config = {})=>{\n const { mutate } = useSWRConfig();\n const keyRef = useRef(key);\n const fetcherRef = useRef(fetcher);\n const configRef = useRef(config);\n // Ditch all mutation results that happened earlier than this timestamp.\n const ditchMutationsUntilRef = useRef(0);\n const [stateRef, stateDependencies, setState] = useStateWithDeps({\n data: UNDEFINED,\n error: UNDEFINED,\n isMutating: false\n });\n const currentState = stateRef.current;\n const trigger = useCallback(async (arg, opts)=>{\n const [serializedKey, resolvedKey] = serialize(keyRef.current);\n if (!fetcherRef.current) {\n throw new Error('Can’t trigger the mutation: missing fetcher.');\n }\n if (!serializedKey) {\n throw new Error('Can’t trigger the mutation: missing key.');\n }\n // Disable cache population by default.\n const options = mergeObjects(mergeObjects({\n populateCache: false,\n throwOnError: true\n }, configRef.current), opts);\n // Trigger a mutation, and also track the timestamp. Any mutation that happened\n // earlier this timestamp should be ignored.\n const mutationStartedAt = getTimestamp();\n ditchMutationsUntilRef.current = mutationStartedAt;\n setState({\n isMutating: true\n });\n try {\n const data = await mutate(serializedKey, fetcherRef.current(resolvedKey, {\n arg\n }), // We must throw the error here so we can catch and update the states.\n mergeObjects(options, {\n throwOnError: true\n }));\n // If it's reset after the mutation, we don't broadcast any state change.\n if (ditchMutationsUntilRef.current <= mutationStartedAt) {\n var _options_onSuccess, _options;\n startTransition(()=>setState({\n data,\n isMutating: false,\n error: undefined\n }));\n (_options_onSuccess = (_options = options).onSuccess) == null ? void 0 : _options_onSuccess.call(_options, data, serializedKey, options);\n }\n return data;\n } catch (error) {\n // If it's reset after the mutation, we don't broadcast any state change\n // or throw because it's discarded.\n if (ditchMutationsUntilRef.current <= mutationStartedAt) {\n var _options_onError, _options1;\n startTransition(()=>setState({\n error: error,\n isMutating: false\n }));\n (_options_onError = (_options1 = options).onError) == null ? void 0 : _options_onError.call(_options1, error, serializedKey, options);\n if (options.throwOnError) {\n throw error;\n }\n }\n }\n }, // eslint-disable-next-line react-hooks/exhaustive-deps\n []);\n const reset = useCallback(()=>{\n ditchMutationsUntilRef.current = getTimestamp();\n setState({\n data: UNDEFINED,\n error: UNDEFINED,\n isMutating: false\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n useIsomorphicLayoutEffect(()=>{\n keyRef.current = key;\n fetcherRef.current = fetcher;\n configRef.current = config;\n });\n // We don't return `mutate` here as it can be pretty confusing (e.g. people\n // calling `mutate` but they actually mean `trigger`).\n // And also, `mutate` relies on the useSWR hook to exist too.\n return {\n trigger,\n reset,\n get data () {\n stateDependencies.data = true;\n return currentState.data;\n },\n get error () {\n stateDependencies.error = true;\n return currentState.error;\n },\n get isMutating () {\n stateDependencies.isMutating = true;\n return currentState.isMutating;\n }\n };\n };\n/**\n * A hook to define and manually trigger remote mutations like POST, PUT, DELETE and PATCH use cases.\n *\n * @link https://swr.vercel.app/docs/mutation\n * @example\n * ```jsx\n * import useSWRMutation from 'swr/mutation'\n *\n * const {\n * data,\n * error,\n * trigger,\n * reset,\n * isMutating\n * } = useSWRMutation(key, fetcher, options?)\n * ```\n */ const useSWRMutation = withMiddleware(useSWR, mutation);\n\nexport { useSWRMutation as default };\n","import useSWR from 'swr'\nimport useSWRMutation from 'swr/mutation'\nimport { useToolkitsContext } from '../../../components/ContextProvider'\nimport type { Game } from '../../../components/GameSelect'\nimport { usePermission } from '../../../hooks/permission'\nimport { useRequest } from '../../../hooks/request'\nimport type { PermissionEnumItem, RoleEnumItem, RoleV1, RoleV2 } from '../types'\n\nexport function useAllPermissions() {\n const request = useRequest()\n return useSWR('/api/usystem/user/allPermssions', url =>\n request<PermissionEnumItem[]>(url, { isGlobal: true }).then(response => response.data),\n )\n}\n\nexport function useAllPermissionsV2() {\n const request = useRequest()\n return useSWR('/api/usystem/user/allPermissionsV2', url =>\n request<{\n game: Game[]\n permission: PermissionEnumItem[]\n }>(url, { isGlobal: true }).then(response => response.data),\n )\n}\n\nexport function useAllRoles() {\n const request = useRequest()\n const { accessible } = usePermission('200005', true)\n return useSWR(accessible ? '/api/usystem/role/all' : null, url =>\n request<RoleEnumItem[]>(url, { isGlobal: true }).then(response => response.data),\n )\n}\n\nexport function useRole(name: string) {\n const request = useRequest()\n const { usePermissionApiV2 } = useToolkitsContext()\n return useSWR(`/api/usystem/role/${usePermissionApiV2 ? 'infoV2' : 'info'}?name=${name}`, (url: string) =>\n request<RoleV1 | RoleV2>(url, { isGlobal: true }).then(response => response.data),\n )\n}\n\nexport function useCreateRole() {\n const request = useRequest()\n const { usePermissionApiV2 } = useToolkitsContext()\n\n return useSWRMutation(\n usePermissionApiV2 ? '/api/usystem/role/createV2' : '/api/usystem/role/create',\n (\n url: string,\n {\n arg,\n }: {\n arg: { name: string; permissions: RoleV1['permissions'] | RoleV2['permissions'] }\n },\n ) =>\n request(url, {\n method: 'post',\n body: arg,\n isGlobal: true,\n }),\n )\n}\n\nexport function useUpdateRole() {\n const request = useRequest()\n const { usePermissionApiV2 } = useToolkitsContext()\n\n return useSWRMutation(\n usePermissionApiV2 ? '/api/usystem/role/updateV2' : '/api/usystem/role/update',\n (\n url: string,\n {\n arg,\n }: {\n arg: { id: number; name: string; permissions: RoleV1['permissions'] | RoleV2['permissions'] }\n },\n ) =>\n request(url, {\n method: 'post',\n body: arg,\n isGlobal: true,\n }),\n )\n}\n\nexport function useRemoveRole() {\n const request = useRequest()\n return useSWRMutation(\n '/api/usystem/role/delete',\n (\n url,\n {\n arg,\n }: {\n arg: { id: number; name: string }\n },\n ) =>\n request(url, {\n method: 'post',\n body: arg,\n isGlobal: true,\n }),\n )\n}\n\nexport function useCreateUser() {\n const request = useRequest()\n return useSWRMutation(\n '/api/usystem/user/create',\n (\n url,\n {\n arg,\n }: {\n arg: { name: string; roles: string[] }\n },\n ) =>\n request(url, {\n method: 'post',\n body: arg,\n isGlobal: true,\n }),\n )\n}\n\nexport function useUpdateUser() {\n const request = useRequest()\n return useSWRMutation(\n '/api/usystem/user/update',\n (\n url,\n {\n arg,\n }: {\n arg: { id: string; name: string; roles: string[] }\n },\n ) =>\n request(url, {\n method: 'post',\n body: arg,\n isGlobal: true,\n }),\n )\n}\n\nexport function useRemoveUser() {\n const request = useRequest()\n return useSWRMutation(\n '/api/usystem/user/delete',\n (\n url,\n {\n arg,\n }: {\n arg: { id: string; name: string }\n },\n ) =>\n request(url, {\n method: 'post',\n body: arg,\n isGlobal: true,\n }),\n )\n}\n"],"names":["startTransition","IS_REACT_LEGACY","cb","React","useStateWithDeps","state","rerender","useState","unmountedRef","useRef","stateRef","stateDependenciesRef","setState","useCallback","payload","shouldRerender","currentState","_","k","useIsomorphicLayoutEffect","mutation","key","fetcher","config","mutate","useSWRConfig","keyRef","fetcherRef","configRef","ditchMutationsUntilRef","stateDependencies","UNDEFINED","trigger","arg","opts","serializedKey","resolvedKey","serialize","options","mergeObjects","mutationStartedAt","getTimestamp","data","_options_onSuccess","_options","error","_options_onError","_options1","reset","useSWRMutation","withMiddleware","useSWR","useAllPermissions","request","useRequest","url","response","useAllPermissionsV2","useAllRoles","accessible","usePermission","useRole","name","usePermissionApiV2","useToolkitsContext","useCreateRole","useUpdateRole","useRemoveRole","useCreateUser","useUpdateUser","useRemoveUser"],"mappings":";;AAIA,MAAMA,IAAkBC,IAAkB,CAACC,MAAK;AAC5C,EAAAA;AACJ,IAAIC,EAAM,iBAGAC,IAAmB,CAACC,MAAQ;AAClC,QAAM,GAAGC,CAAQ,IAAIC,EAAS,CAAE,CAAA,GAC1BC,IAAeC,EAAO,EAAK,GAC3BC,IAAWD,EAAOJ,CAAK,GAKvBM,IAAuBF,EAAO;AAAA,IAChC,MAAM;AAAA,IACN,OAAO;AAAA,IACP,cAAc;AAAA,EACtB,CAAK,GAiBOG,IAAWC,EAAY,CAACC,MAAU;AACtC,QAAIC,IAAiB;AACrB,UAAMC,IAAeN,EAAS;AAC9B,eAAUO,KAAKH,GAAQ;AACnB,YAAMI,IAAID;AAGV,MAAID,EAAaE,CAAC,MAAMJ,EAAQI,CAAC,MAC7BF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]}
@@ -1,8 +1,8 @@
1
- import { a as t, j as i } from "./index-QEbb1ngP.chunk.js";
1
+ import { a as t, j as i } from "./index-SyU1uyhZ.chunk.js";
2
2
  import { Breadcrumb as m, Card as n, Skeleton as a, Descriptions as l } from "antd";
3
3
  import { useParams as c, Link as x } from "react-router-dom";
4
- import { P as j } from "./index-VvfM7Qb8.chunk.js";
5
- import { g as p } from "./index-goOUs9qe.chunk.js";
4
+ import { P as j } from "./index-rPnRxWPS.chunk.js";
5
+ import { g as p } from "./index-3oDF7W07.chunk.js";
6
6
  import "react";
7
7
  import "react-dom";
8
8
  const k = () => {
@@ -37,4 +37,4 @@ const k = () => {
37
37
  export {
38
38
  k as default
39
39
  };
40
- //# sourceMappingURL=index-0fh4T-82.chunk.js.map
40
+ //# sourceMappingURL=index-8oB_dhPL.chunk.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-0fh4T-82.chunk.js","sources":["../src/pages/permission/RoleDetail/index.tsx"],"sourcesContent":["import { Breadcrumb, Card, Descriptions, Skeleton } from 'antd'\nimport { Link, useParams } from 'react-router-dom'\nimport { PermissionList, useRole } from '../../../features/permission'\nimport { useTranslation } from '../../../hooks/i18n'\n\nconst RoleDetail = () => {\n const params = useParams()\n const { data, isLoading } = useRole(params.name as string)\n const t = useTranslation()\n\n return (\n <>\n <Breadcrumb\n style={{ marginBottom: 24 }}\n items={[\n {\n key: '1',\n title: <Link to=\"..\">{t('global.role')}</Link>,\n },\n {\n key: '2',\n title: params.name,\n },\n ]}\n />\n <Card title={t('RoleDetail.title')}>\n <Skeleton loading={isLoading}>\n <Descriptions column={3} layout=\"vertical\">\n <Descriptions.Item label={t('global.name')}>{data?.name}</Descriptions.Item>\n <Descriptions.Item label=\"ID\">{data?.id}</Descriptions.Item>\n <Descriptions.Item label={t('global.creationTime')}>{data?.ctime}</Descriptions.Item>\n </Descriptions>\n <PermissionList readonly value={data?.permissions} />\n </Skeleton>\n </Card>\n </>\n )\n}\n\nexport default RoleDetail\n"],"names":["RoleDetail","params","useParams","data","isLoading","useRole","t","useTranslation","jsxs","Fragment","jsx","Breadcrumb","Link","Card","Skeleton","Descriptions","PermissionList"],"mappings":";;;;;;;AAKA,MAAMA,IAAa,MAAM;AACvB,QAAMC,IAASC,KACT,EAAE,MAAAC,GAAM,WAAAC,EAAA,IAAcC,EAAQJ,EAAO,IAAc,GACnDK,IAAIC;AAEV,SAEIC,gBAAAA,EAAA,KAAAC,YAAA,EAAA,UAAA;AAAA,IAAAC,gBAAAA,EAAA;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,OAAO,EAAE,cAAc,GAAG;AAAA,QAC1B,OAAO;AAAA,UACL;AAAA,YACE,KAAK;AAAA,YACL,OAAQD,gBAAAA,EAAAA,IAAAE,GAAA,EAAK,IAAG,MAAM,UAAAN,EAAE,aAAa,GAAE;AAAA,UACzC;AAAA,UACA;AAAA,YACE,KAAK;AAAA,YACL,OAAOL,EAAO;AAAA,UAChB;AAAA,QACF;AAAA,MAAA;AAAA,IACF;AAAA,IACAS,gBAAAA,EAAAA,IAACG,KAAK,OAAOP,EAAE,kBAAkB,GAC/B,UAAAE,gBAAAA,EAAAA,KAACM,GAAS,EAAA,SAASV,GACjB,UAAA;AAAA,MAAAI,gBAAAA,EAAA,KAACO,GAAa,EAAA,QAAQ,GAAG,QAAO,YAC9B,UAAA;AAAA,QAACL,gBAAAA,EAAAA,IAAAK,EAAa,MAAb,EAAkB,OAAOT,EAAE,aAAa,GAAI,iCAAM,MAAK;AAAA,8BACvDS,EAAa,MAAb,EAAkB,OAAM,MAAM,iCAAM,IAAG;AAAA,QACxCL,gBAAAA,EAAAA,IAACK,EAAa,MAAb,EAAkB,OAAOT,EAAE,qBAAqB,GAAI,UAAAH,KAAA,gBAAAA,EAAM,OAAM;AAAA,MAAA,GACnE;AAAA,4BACCa,GAAe,EAAA,UAAQ,IAAC,OAAOb,KAAA,gBAAAA,EAAM,aAAa;AAAA,IAAA,EAAA,CACrD,EACF,CAAA;AAAA,EACF,EAAA,CAAA;AAEJ;"}
1
+ {"version":3,"file":"index-8oB_dhPL.chunk.js","sources":["../src/pages/permission/RoleDetail/index.tsx"],"sourcesContent":["import { Breadcrumb, Card, Descriptions, Skeleton } from 'antd'\nimport { Link, useParams } from 'react-router-dom'\nimport { PermissionList, useRole } from '../../../features/permission'\nimport { useTranslation } from '../../../hooks/i18n'\n\nconst RoleDetail = () => {\n const params = useParams()\n const { data, isLoading } = useRole(params.name as string)\n const t = useTranslation()\n\n return (\n <>\n <Breadcrumb\n style={{ marginBottom: 24 }}\n items={[\n {\n key: '1',\n title: <Link to=\"..\">{t('global.role')}</Link>,\n },\n {\n key: '2',\n title: params.name,\n },\n ]}\n />\n <Card title={t('RoleDetail.title')}>\n <Skeleton loading={isLoading}>\n <Descriptions column={3} layout=\"vertical\">\n <Descriptions.Item label={t('global.name')}>{data?.name}</Descriptions.Item>\n <Descriptions.Item label=\"ID\">{data?.id}</Descriptions.Item>\n <Descriptions.Item label={t('global.creationTime')}>{data?.ctime}</Descriptions.Item>\n </Descriptions>\n <PermissionList readonly value={data?.permissions} />\n </Skeleton>\n </Card>\n </>\n )\n}\n\nexport default RoleDetail\n"],"names":["RoleDetail","params","useParams","data","isLoading","useRole","t","useTranslation","jsxs","Fragment","jsx","Breadcrumb","Link","Card","Skeleton","Descriptions","PermissionList"],"mappings":";;;;;;;AAKA,MAAMA,IAAa,MAAM;AACvB,QAAMC,IAASC,KACT,EAAE,MAAAC,GAAM,WAAAC,EAAA,IAAcC,EAAQJ,EAAO,IAAc,GACnDK,IAAIC;AAEV,SAEIC,gBAAAA,EAAA,KAAAC,YAAA,EAAA,UAAA;AAAA,IAAAC,gBAAAA,EAAA;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,OAAO,EAAE,cAAc,GAAG;AAAA,QAC1B,OAAO;AAAA,UACL;AAAA,YACE,KAAK;AAAA,YACL,OAAQD,gBAAAA,EAAAA,IAAAE,GAAA,EAAK,IAAG,MAAM,UAAAN,EAAE,aAAa,GAAE;AAAA,UACzC;AAAA,UACA;AAAA,YACE,KAAK;AAAA,YACL,OAAOL,EAAO;AAAA,UAChB;AAAA,QACF;AAAA,MAAA;AAAA,IACF;AAAA,IACAS,gBAAAA,EAAAA,IAACG,KAAK,OAAOP,EAAE,kBAAkB,GAC/B,UAAAE,gBAAAA,EAAAA,KAACM,GAAS,EAAA,SAASV,GACjB,UAAA;AAAA,MAAAI,gBAAAA,EAAA,KAACO,GAAa,EAAA,QAAQ,GAAG,QAAO,YAC9B,UAAA;AAAA,QAACL,gBAAAA,EAAAA,IAAAK,EAAa,MAAb,EAAkB,OAAOT,EAAE,aAAa,GAAI,iCAAM,MAAK;AAAA,8BACvDS,EAAa,MAAb,EAAkB,OAAM,MAAM,iCAAM,IAAG;AAAA,QACxCL,gBAAAA,EAAAA,IAACK,EAAa,MAAb,EAAkB,OAAOT,EAAE,qBAAqB,GAAI,UAAAH,KAAA,gBAAAA,EAAM,OAAM;AAAA,MAAA,GACnE;AAAA,4BACCa,GAAe,EAAA,UAAQ,IAAC,OAAOb,KAAA,gBAAAA,EAAM,aAAa;AAAA,IAAA,EAAA,CACrD,EACF,CAAA;AAAA,EACF,EAAA,CAAA;AAEJ;"}