react-toolkits 0.8.13 → 0.8.15

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.
@@ -0,0 +1,39 @@
1
+ import { a as t, j as i } from "./index-X4wAgOVF.chunk.js";
2
+ import { Breadcrumb as m, Card as n, Skeleton as a, Descriptions as l } from "antd";
3
+ import { useParams as c, Link as x } from "react-router-dom";
4
+ import { P as j } from "./index-xqdcwYUL.chunk.js";
5
+ import { g as p } from "./index-pq_K84zY.chunk.js";
6
+ import "react";
7
+ import "react-dom";
8
+ const k = () => {
9
+ const r = c(), { data: e, isLoading: o } = p(r.name), s = t();
10
+ return /* @__PURE__ */ i.jsxs(i.Fragment, { children: [
11
+ /* @__PURE__ */ i.jsx(
12
+ m,
13
+ {
14
+ style: { marginBottom: 24 },
15
+ items: [
16
+ {
17
+ key: "1",
18
+ title: /* @__PURE__ */ i.jsx(x, { to: "..", children: s("global.role") })
19
+ },
20
+ {
21
+ key: "2",
22
+ title: r.name
23
+ }
24
+ ]
25
+ }
26
+ ),
27
+ /* @__PURE__ */ i.jsx(n, { title: s("RoleDetail.title"), children: /* @__PURE__ */ i.jsxs(a, { loading: o, children: [
28
+ /* @__PURE__ */ i.jsxs(l, { column: 3, layout: "vertical", children: [
29
+ /* @__PURE__ */ i.jsx(l.Item, { label: s("global.name"), children: e == null ? void 0 : e.name }),
30
+ /* @__PURE__ */ i.jsx(l.Item, { label: "ID", children: e == null ? void 0 : e.id }),
31
+ /* @__PURE__ */ i.jsx(l.Item, { label: s("global.creationTime"), children: e == null ? void 0 : e.ctime })
32
+ ] }),
33
+ /* @__PURE__ */ i.jsx(j, { readonly: !0, value: e == null ? void 0 : e.permissions })
34
+ ] }) })
35
+ ] });
36
+ };
37
+ export {
38
+ k as default
39
+ };
@@ -1,8 +1,8 @@
1
- import { A as M, _ as N, f as b, u as U, j as e, P as j, H as z, Q as H, h as A } from "./index-jdc5BLXR.chunk.js";
2
- import { App as y, Row as R, Col as E, Tag as w, Space as G, Card as _, Form as u, Input as L, Select as f } from "antd";
1
+ import { A as M, _ as N, u as b, a as U, j as e, P as j, H as z, Q as H, b as A } from "./index-X4wAgOVF.chunk.js";
2
+ import { App as y, Row as R, Col as E, Tag as w, Space as G, Card as _, Form as u, Input as L, Select as C } from "antd";
3
3
  import { p as I } from "./immer-BLf7GM7E.chunk.js";
4
4
  import { Link as D } from "react-router-dom";
5
- import { f as P, g as Q, h as k, i as V } from "./index--TYK5iZT.chunk.js";
5
+ import { u as P, a as Q, b as k, c as V } from "./index-pq_K84zY.chunk.js";
6
6
  import * as O from "react";
7
7
  import "react-dom";
8
8
  var $ = { icon: { tag: "svg", attrs: { viewBox: "64 64 896 896", focusable: "false" }, children: [{ tag: "path", attrs: { d: "M678.3 642.4c24.2-13 51.9-20.4 81.4-20.4h.1c3 0 4.4-3.6 2.2-5.6a371.67 371.67 0 00-103.7-65.8c-.4-.2-.8-.3-1.2-.5C719.2 505 759.6 431.7 759.6 349c0-137-110.8-248-247.5-248S264.7 212 264.7 349c0 82.7 40.4 156 102.6 201.1-.4.2-.8.3-1.2.5-44.7 18.9-84.8 46-119.3 80.6a373.42 373.42 0 00-80.4 119.5A373.6 373.6 0 00137 888.8a8 8 0 008 8.2h59.9c4.3 0 7.9-3.5 8-7.8 2-77.2 32.9-149.5 87.6-204.3C357 628.2 432.2 597 512.2 597c56.7 0 111.1 15.7 158 45.1a8.1 8.1 0 008.1.3zM512.2 521c-45.8 0-88.9-17.9-121.4-50.4A171.2 171.2 0 01340.5 349c0-45.9 17.9-89.1 50.3-121.6S466.3 177 512.2 177s88.9 17.9 121.4 50.4A171.2 171.2 0 01683.9 349c0 45.9-17.9 89.1-50.3 121.6C601.1 503.1 558 521 512.2 521zM880 759h-84v-84c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v84h-84c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h84v84c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-84h84c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8z" } }] }, name: "user-add", theme: "outlined" };
@@ -14,14 +14,14 @@ var v = function(c, a) {
14
14
  }));
15
15
  };
16
16
  process.env.NODE_ENV !== "production" && (v.displayName = "UserAddOutlined");
17
- const B = /* @__PURE__ */ O.forwardRef(v), { Option: F } = f, g = "/api/usystem/user/list";
17
+ const B = /* @__PURE__ */ O.forwardRef(v), { Option: F } = C, g = "/api/usystem/user/list";
18
18
  function K() {
19
19
  const { message: d } = y.useApp(), c = Q(), { data: a, isLoading: m } = k(), { setPayload: p } = b(), n = U();
20
20
  return A({
21
21
  title: n("UserList.createTitle"),
22
22
  content: (o) => /* @__PURE__ */ e.jsxs(u, { form: o, labelCol: { flex: "80px" }, children: [
23
23
  /* @__PURE__ */ e.jsx(u.Item, { label: n("global.name"), name: "name", rules: [{ required: !0 }], children: /* @__PURE__ */ e.jsx(L, {}) }),
24
- /* @__PURE__ */ e.jsx(u.Item, { label: n("global.role"), name: "roles", children: /* @__PURE__ */ e.jsx(f, { allowClear: !0, mode: "multiple", loading: m, children: (a ?? []).map((r) => /* @__PURE__ */ e.jsx(F, { value: r.name, children: r.name }, r.id)) }) })
24
+ /* @__PURE__ */ e.jsx(u.Item, { label: n("global.role"), name: "roles", children: /* @__PURE__ */ e.jsx(C, { allowClear: !0, mode: "multiple", loading: m, children: (a ?? []).map((r) => /* @__PURE__ */ e.jsx(F, { value: r.name, children: r.name }, r.id)) }) })
25
25
  ] }),
26
26
  async onConfirm(o) {
27
27
  await c.trigger(o), p(g, { page: 1 }), d.success(n("UserList.createSuccessfully"));
@@ -35,7 +35,7 @@ function J() {
35
35
  content: (o) => /* @__PURE__ */ e.jsxs(u, { form: o, labelCol: { flex: "80px" }, children: [
36
36
  /* @__PURE__ */ e.jsx(u.Item, { label: n("global.name"), name: "name", rules: [{ required: !0 }], children: /* @__PURE__ */ e.jsx(L, { readOnly: !0 }) }),
37
37
  /* @__PURE__ */ e.jsx(u.Item, { label: n("global.role"), name: "roles", children: /* @__PURE__ */ e.jsx(
38
- f,
38
+ C,
39
39
  {
40
40
  allowClear: !0,
41
41
  mode: "multiple",
@@ -132,9 +132,9 @@ const se = () => {
132
132
  id: t.id,
133
133
  name: t.name
134
134
  }), m(g, (l) => I(l, (i) => {
135
- var C, S;
136
- const x = (C = i == null ? void 0 : i.dataSource) == null ? void 0 : C.findIndex((T) => T.id === t.id);
137
- x && ((S = i == null ? void 0 : i.dataSource) == null || S.splice(x, 1));
135
+ var S, f;
136
+ const x = (S = i == null ? void 0 : i.dataSource) == null ? void 0 : S.findIndex((T) => T.id === t.id);
137
+ x && ((f = i == null ? void 0 : i.dataSource) == null || f.splice(x, 1));
138
138
  })), c.success(s("UserList.deleteSuccessfully"));
139
139
  }
140
140
  });
@@ -1,4 +1,4 @@
1
- import { I as O, w as W, i as h, k as x, s as z, m as w, n as V, U as R, o as U, b as G, r as n, e as K } from "./index-jdc5BLXR.chunk.js";
1
+ import { I as O, w as W, e as h, f as x, s as z, m as w, g as V, U as R, h as U, d as G, r as n, c as K } from "./index-X4wAgOVF.chunk.js";
2
2
  import L, { useRef as o, useCallback as N, useState as $ } from "react";
3
3
  const P = O ? (e) => {
4
4
  e();
@@ -28,8 +28,8 @@ const P = O ? (e) => {
28
28
  data: R,
29
29
  error: R,
30
30
  isMutating: !1
31
- }), b = g.current, v = N(
32
- async (D, T) => {
31
+ }), S = g.current, v = N(
32
+ async (T, k) => {
33
33
  const [y, I] = z(d.current);
34
34
  if (!m.current)
35
35
  throw new Error("Can’t trigger the mutation: missing fetcher.");
@@ -38,22 +38,22 @@ const P = O ? (e) => {
38
38
  const l = w(w({
39
39
  populateCache: !1,
40
40
  throwOnError: !0
41
- }, c.current), T), S = V();
42
- a.current = S, s({
41
+ }, c.current), k), b = V();
42
+ a.current = b, s({
43
43
  isMutating: !0
44
44
  });
45
45
  try {
46
46
  const u = await i(
47
47
  y,
48
48
  m.current(I, {
49
- arg: D
49
+ arg: T
50
50
  }),
51
51
  // We must throw the error here so we can catch and update the states.
52
52
  w(l, {
53
53
  throwOnError: !0
54
54
  })
55
55
  );
56
- if (a.current <= S) {
56
+ if (a.current <= b) {
57
57
  var M, C;
58
58
  P(() => s({
59
59
  data: u,
@@ -63,7 +63,7 @@ const P = O ? (e) => {
63
63
  }
64
64
  return u;
65
65
  } catch (u) {
66
- if (a.current <= S) {
66
+ if (a.current <= b) {
67
67
  var E, A;
68
68
  if (P(() => s({
69
69
  error: u,
@@ -75,7 +75,7 @@ const P = O ? (e) => {
75
75
  },
76
76
  // eslint-disable-next-line react-hooks/exhaustive-deps
77
77
  []
78
- ), k = N(() => {
78
+ ), D = N(() => {
79
79
  a.current = V(), s({
80
80
  data: R,
81
81
  error: R,
@@ -86,15 +86,15 @@ const P = O ? (e) => {
86
86
  d.current = e, m.current = t, c.current = r;
87
87
  }), {
88
88
  trigger: v,
89
- reset: k,
89
+ reset: D,
90
90
  get data() {
91
- return p.data = !0, b.data;
91
+ return p.data = !0, S.data;
92
92
  },
93
93
  get error() {
94
- return p.error = !0, b.error;
94
+ return p.error = !0, S.error;
95
95
  },
96
96
  get isMutating() {
97
- return p.isMutating = !0, b.isMutating;
97
+ return p.isMutating = !0, S.isMutating;
98
98
  }
99
99
  };
100
100
  }, f = W(h, q);
@@ -199,14 +199,14 @@ function re() {
199
199
  );
200
200
  }
201
201
  export {
202
- _ as a,
203
- X as b,
204
- Z as c,
205
- B as d,
206
- H as e,
207
- re as f,
208
- ee as g,
209
- J as h,
210
- te as i,
211
- Q as u
202
+ ee as a,
203
+ J as b,
204
+ te as c,
205
+ _ as d,
206
+ X as e,
207
+ Z as f,
208
+ Q as g,
209
+ B as h,
210
+ H as i,
211
+ re as u
212
212
  };
@@ -1,9 +1,9 @@
1
- import { u as S, j as e, b as $ } from "./index-jdc5BLXR.chunk.js";
1
+ import { a as S, j as e, d as $ } from "./index-X4wAgOVF.chunk.js";
2
2
  import { Collapse as D, Checkbox as k, Row as G, Col as _, Skeleton as T, Typography as A, Divider as w, Card as K, Space as M, Select as E, Button as N, Empty as O } from "antd";
3
- import { d as R, e as B } from "./index--TYK5iZT.chunk.js";
3
+ import { h as R, i as B } from "./index-pq_K84zY.chunk.js";
4
4
  import { useState as P, useCallback as F, useEffect as b } from "react";
5
5
  const q = (x) => {
6
- const { permissions: l, readonly: t, expand: d, value: r, onChange: a } = x, [m, p] = P([]), [g, u] = P({}), [c, f] = P(r ?? []), C = S(), h = F((s) => {
6
+ const { permissions: l, readonly: t, expand: d, value: a, onChange: r } = x, [m, p] = P([]), [g, u] = P({}), [c, f] = P(a ?? []), C = S(), h = F((s) => {
7
7
  p(s);
8
8
  }, []), L = (s, i) => {
9
9
  let n = [];
@@ -13,11 +13,11 @@ const q = (x) => {
13
13
  })), n;
14
14
  }, v = (s, i) => {
15
15
  const n = L(s.target.checked, i);
16
- f(n), a == null || a(n);
16
+ f(n), r == null || r(n);
17
17
  };
18
18
  return b(() => {
19
- f(r ?? []);
20
- }, [r]), b(() => {
19
+ f(a ?? []);
20
+ }, [a]), b(() => {
21
21
  d && p((l ?? []).map(({ category: s }) => s));
22
22
  }, [d, l]), b(() => {
23
23
  const s = (l ?? []).reduce(
@@ -62,19 +62,19 @@ const q = (x) => {
62
62
  }
63
63
  );
64
64
  }, V = q, { Text: z } = A, H = (x) => {
65
- const { expand: l = !0, value: t, readonly: d, onChange: r } = x, { data: a, isLoading: m, error: p } = R(), g = S();
65
+ const { expand: l = !0, value: t, readonly: d, onChange: a } = x, { data: r, isLoading: m, error: p } = R(), g = S();
66
66
  return p ? /* @__PURE__ */ e.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ e.jsx(z, { type: "danger", children: g("PermissionList.failedDescription") }) }) : /* @__PURE__ */ e.jsx(T, { active: !0, loading: m, children: /* @__PURE__ */ e.jsx(
67
67
  V,
68
68
  {
69
69
  value: t,
70
- permissions: a,
70
+ permissions: r,
71
71
  readonly: d,
72
72
  expand: l,
73
- onChange: r
73
+ onChange: a
74
74
  }
75
75
  ) });
76
76
  }, J = H, { Text: I } = A, { Option: Q } = E, U = (x) => {
77
- const { expand: l = !0, value: t, readonly: d, onChange: r } = x, { data: { permission: a, game: m } = {}, isLoading: p, error: g } = B(), [u, c] = P([]), f = a == null ? void 0 : a.filter((s) => s.is_common), C = a == null ? void 0 : a.filter((s) => !s.is_common), h = S();
77
+ const { expand: l = !0, value: t, readonly: d, onChange: a } = x, { data: { permission: r, game: m } = {}, isLoading: p, error: g } = B(), [u, c] = P([]), f = r == null ? void 0 : r.filter((s) => s.is_common), C = r == null ? void 0 : r.filter((s) => !s.is_common), h = S();
78
78
  if (b(() => {
79
79
  const s = [];
80
80
  Object.keys(t ?? {}).forEach((i) => {
@@ -97,7 +97,7 @@ const q = (x) => {
97
97
  permissions: f,
98
98
  expand: l,
99
99
  onChange: (s) => {
100
- r == null || r({
100
+ a == null || a({
101
101
  ...t,
102
102
  global: s
103
103
  });
@@ -148,7 +148,7 @@ const q = (x) => {
148
148
  expand: l,
149
149
  permissions: C,
150
150
  onChange: (o) => {
151
- r == null || r({
151
+ a == null || a({
152
152
  ...t,
153
153
  [u[i].gameId]: o
154
154
  });
package/lib/index.d.ts CHANGED
@@ -34,6 +34,8 @@ export declare interface ContextState {
34
34
  gameFilter?: (game: Game) => boolean;
35
35
  locale?: Locale;
36
36
  localeDropdownMenu?: ReactNode;
37
+ signInSuccessRedirect?: string;
38
+ notFoundRedirect?: string;
37
39
  }
38
40
 
39
41
  export declare const contextStore: StoreApi<ContextState>;
@@ -220,10 +222,16 @@ export declare const NavMenu: NamedExoticComponent<object>;
220
222
 
221
223
  export declare type NavMenuItem = MenuItemType2 | SubMenuType2 | MenuItemGroupType2 | MenuDividerType | null;
222
224
 
225
+ export declare const NotFound: () => JSX_2.Element;
226
+
227
+ export declare const OperationLogList: FC;
228
+
223
229
  declare type Paths<T, D extends number = 10> = [D] extends [never] ? never : T extends object ? {
224
230
  [K in keyof T]-?: K extends string | number ? `${K}` | Join<K, Paths<T[K]>> : never;
225
231
  }[keyof T] : '';
226
232
 
233
+ export declare const Permission: () => JSX_2.Element;
234
+
227
235
  export declare const PermissionButton: FC<PropsWithChildren<PermissionButtonProps>>;
228
236
 
229
237
  export declare interface PermissionButtonProps extends Omit<ButtonProps, 'disabled'> {
@@ -323,6 +331,8 @@ declare type RequestResponse<T> = Pick<Response, 'headers' | 'status' | 'statusT
323
331
 
324
332
  export declare const RequireGame: FC<PropsWithChildren>;
325
333
 
334
+ export declare const SignIn: FC;
335
+
326
336
  declare type SubMenuType2 = Merge<SubMenuType, {
327
337
  children?: NavMenuItem[];
328
338
  }>;
package/lib/index.js CHANGED
@@ -1,35 +1,39 @@
1
- import { C as i, D as u, F as n, G as m, H as p, p as l, L as d, N as x, P as y, q as L, Q as P, t as S, R as g, v as G, x as T, y as c, z as h, r as q, h as F, B as Q, e as R, E as f, f as k, a as v, J as B, b as C, u as D, K as E } from "./index-jdc5BLXR.chunk.js";
1
+ import { C as r, D as n, F as u, G as m, H as p, i as d, L as l, N as L, k as S, O as g, l as P, P as x, n as y, Q as c, o as F, R as G, p as T, S as k, q, t as Q, v as R, r as h, b as v, x as B, c as C, y as N, u as f, z as D, B as E, d as H, a as I, E as M } from "./index-X4wAgOVF.chunk.js";
2
2
  import "react";
3
3
  import "antd";
4
4
  import "react-router-dom";
5
5
  import "react-dom";
6
6
  export {
7
- i as ContextProvider,
8
- u as DynamicTags,
9
- n as FilterFormWrapper,
7
+ r as ContextProvider,
8
+ n as DynamicTags,
9
+ u as FilterFormWrapper,
10
10
  m as GameSelect,
11
11
  p as Highlight,
12
- l as InfiniteList,
13
- d as Layout,
14
- x as NavMenu,
15
- y as PermissionButton,
16
- L as PermissionGuard,
17
- P as QueryList,
18
- S as QueryListAction,
19
- g as RequestError,
20
- G as RequireGame,
21
- T as UserWidget,
22
- c as contextStore,
23
- h as mixedStorage,
24
- q as request,
25
- F as useFormModal,
26
- Q as useGameStore,
27
- R as usePermission,
28
- f as usePermissions,
29
- k as useQueryListStore,
30
- v as useTokenStore,
31
- B as useTokenValidation,
32
- C as useToolkitsContext,
33
- D as useTranslation,
34
- E as withBaseRoutes
12
+ d as InfiniteList,
13
+ l as Layout,
14
+ L as NavMenu,
15
+ S as NotFound,
16
+ g as OperationLogList,
17
+ P as Permission,
18
+ x as PermissionButton,
19
+ y as PermissionGuard,
20
+ c as QueryList,
21
+ F as QueryListAction,
22
+ G as RequestError,
23
+ T as RequireGame,
24
+ k as SignIn,
25
+ q as UserWidget,
26
+ Q as contextStore,
27
+ R as mixedStorage,
28
+ h as request,
29
+ v as useFormModal,
30
+ B as useGameStore,
31
+ C as usePermission,
32
+ N as usePermissions,
33
+ f as useQueryListStore,
34
+ D as useTokenStore,
35
+ E as useTokenValidation,
36
+ H as useToolkitsContext,
37
+ I as useTranslation,
38
+ M as withBaseRoutes
35
39
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-toolkits",
3
- "version": "0.8.13",
3
+ "version": "0.8.15",
4
4
  "packageManager": "^pnpm@8.7.5",
5
5
  "sideEffects": [
6
6
  "**/*.css"
@@ -69,8 +69,8 @@
69
69
  "typescript": "^5.3.3",
70
70
  "vite": "^5.0.10",
71
71
  "vite-plugin-dts": "^3.6.4",
72
- "tailwind-config": "0.1.1",
73
72
  "tsconfig": "0.0.5",
73
+ "tailwind-config": "0.1.1",
74
74
  "@flow97/eslint-config-mono": "0.0.4"
75
75
  },
76
76
  "peerDependencies": {