react-toolkits 0.8.22 → 0.8.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,74 +1,77 @@
1
- import { A as T, _ as N, u as j, a as b, j as e, P as h, H as z, Q as R, b as A } from "./index-Tn0ScF_k.chunk.js";
2
- import { App as U, Row as F, Col as E, Tag as w, Space as G, Card as D, Form as p, Input as L, Select as y } from "antd";
1
+ import { A as T, _ as N, u as j, a as b, j as e, P as h, H as R, Q as z, b as w } from "./index-IcW2Gzox.chunk.js";
2
+ import { App as U, Row as F, Col as P, Tag as A, Space as E, Card as G, Form as g, Input as L, Select as y } from "antd";
3
3
  import { p as I } from "./immer-BLf7GM7E.chunk.js";
4
- import { Link as P } from "react-router-dom";
5
- import { u as Q, a as V, b as k, c as _ } from "./index-di-49SIT.chunk.js";
4
+ import { Link as D } from "react-router-dom";
5
+ import { u as Q, a as _, b as k, c as $ } from "./index-d2XgZJdb.chunk.js";
6
6
  import * as M from "react";
7
7
  import "react-dom";
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" };
9
- const q = $;
10
- var O = function(i, o) {
8
+ var q = { 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" };
9
+ const B = q;
10
+ var O = function(i, l) {
11
11
  return /* @__PURE__ */ M.createElement(T, N({}, i, {
12
- ref: o,
13
- icon: q
12
+ ref: l,
13
+ icon: B
14
14
  }));
15
15
  };
16
16
  process.env.NODE_ENV !== "production" && (O.displayName = "UserAddOutlined");
17
- const B = /* @__PURE__ */ M.forwardRef(O), { Option: H } = y, g = "/api/usystem/user/list";
18
- function K() {
19
- const { message: d } = U.useApp(), i = V(), { data: o, isLoading: u } = k(), { setPayload: m } = j(), n = b();
20
- return A({
21
- title: n("UserList.createTitle"),
22
- labelCol: { flex: "80px" },
17
+ const H = /* @__PURE__ */ M.forwardRef(O), { Option: K } = y, x = "/api/usystem/user/list";
18
+ function J() {
19
+ const { message: d } = U.useApp(), i = _(), { data: l, isLoading: u } = k(), { setPayload: m } = j(), a = b();
20
+ return w({
21
+ title: a("UserList.createTitle"),
22
+ formProps: {
23
+ labelCol: { flex: "80px" }
24
+ },
23
25
  content: /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
24
- /* @__PURE__ */ e.jsx(p.Item, { label: n("global.name"), name: "name", rules: [{ required: !0 }], children: /* @__PURE__ */ e.jsx(L, {}) }),
25
- /* @__PURE__ */ e.jsx(p.Item, { label: n("global.role"), name: "roles", children: /* @__PURE__ */ e.jsx(y, { allowClear: !0, mode: "multiple", loading: u, children: (o ?? []).map((t) => /* @__PURE__ */ e.jsx(H, { value: t.name, children: t.name }, t.id)) }) })
26
+ /* @__PURE__ */ e.jsx(g.Item, { label: a("global.name"), name: "name", rules: [{ required: !0 }], children: /* @__PURE__ */ e.jsx(L, {}) }),
27
+ /* @__PURE__ */ e.jsx(g.Item, { label: a("global.role"), name: "roles", children: /* @__PURE__ */ e.jsx(y, { allowClear: !0, mode: "multiple", loading: u, children: (l ?? []).map((t) => /* @__PURE__ */ e.jsx(K, { value: t.name, children: t.name }, t.id)) }) })
26
28
  ] }),
27
29
  async onConfirm(t) {
28
- await i.trigger(t), m(g, { page: 1 }), d.success(n("UserList.createSuccessfully"));
30
+ await i.trigger(t), m(x, { page: 1 }), d.success(a("UserList.createSuccessfully"));
29
31
  }
30
32
  });
31
33
  }
32
- function J() {
33
- const { message: d } = U.useApp(), i = _(), { data: o, isLoading: u } = k(), { mutate: m } = j(), n = b();
34
- return A({
35
- title: n("UserList.updateTitle"),
36
- labelCol: { flex: "80px" },
34
+ function W() {
35
+ const { message: d } = U.useApp(), i = $(), { data: l, isLoading: u } = k(), { mutate: m } = j(), a = b();
36
+ return w({
37
+ title: a("UserList.updateTitle"),
38
+ formProps: {
39
+ labelCol: { flex: "80px" }
40
+ },
37
41
  content: /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
38
- /* @__PURE__ */ e.jsx(p.Item, { label: n("global.name"), name: "name", rules: [{ required: !0 }], children: /* @__PURE__ */ e.jsx(L, { readOnly: !0 }) }),
39
- /* @__PURE__ */ e.jsx(p.Item, { label: n("global.role"), name: "roles", children: /* @__PURE__ */ e.jsx(
42
+ /* @__PURE__ */ e.jsx(g.Item, { label: a("global.name"), name: "name", rules: [{ required: !0 }], children: /* @__PURE__ */ e.jsx(L, { readOnly: !0 }) }),
43
+ /* @__PURE__ */ e.jsx(g.Item, { label: a("global.role"), name: "roles", children: /* @__PURE__ */ e.jsx(
40
44
  y,
41
45
  {
42
46
  allowClear: !0,
43
47
  mode: "multiple",
44
48
  loading: u,
45
- options: o == null ? void 0 : o.map((t) => ({
49
+ options: l == null ? void 0 : l.map((t) => ({
46
50
  label: t.name,
47
51
  value: t.name
48
- })),
49
- dropdownStyle: { zIndex: 9999 }
52
+ }))
50
53
  }
51
54
  ) })
52
55
  ] }),
53
- async onConfirm(t, x) {
56
+ async onConfirm(t, p) {
54
57
  await i.trigger(t), m(
55
- g,
56
- (a) => I(a, (c) => {
58
+ x,
59
+ (n) => I(n, (c) => {
57
60
  var s;
58
61
  if (c != null && c.dataSource) {
59
- const l = (s = c.dataSource) == null ? void 0 : s.findIndex((r) => r.id === x.id);
60
- l !== -1 && (c.dataSource[l].roles = t.roles);
62
+ const o = (s = c.dataSource) == null ? void 0 : s.findIndex((r) => r.id === (p == null ? void 0 : p.id));
63
+ o !== -1 && (c.dataSource[o].roles = t.roles);
61
64
  }
62
65
  }),
63
66
  { revalidate: !1 }
64
- ), d.success(n("UserList.updateSuccessfully"));
67
+ ), d.success(a("UserList.updateSuccessfully"));
65
68
  }
66
69
  });
67
70
  }
68
71
  const te = () => {
69
- const { modal: d, message: i } = U.useApp(), o = Q(), { mutate: u } = j(), { show: m, modal: n } = K(), { show: t, modal: x } = J(), a = b(), c = [
72
+ const { modal: d, message: i } = U.useApp(), l = Q(), { mutate: u } = j(), { show: m, modal: a } = J(), { show: t, modal: p } = W(), n = b(), c = [
70
73
  {
71
- title: a("global.name"),
74
+ title: n("global.name"),
72
75
  dataIndex: "name",
73
76
  key: "name"
74
77
  },
@@ -78,24 +81,24 @@ const te = () => {
78
81
  key: "id"
79
82
  },
80
83
  {
81
- title: a("global.role"),
84
+ title: n("global.role"),
82
85
  dataIndex: "roles",
83
86
  key: "roles",
84
87
  width: "40%",
85
88
  render(s) {
86
- return /* @__PURE__ */ e.jsx(F, { gutter: [4, 4], children: (s || []).map((l) => /* @__PURE__ */ e.jsx(E, { children: l === "root" ? /* @__PURE__ */ e.jsx(w, { color: "#f50", children: l }) : /* @__PURE__ */ e.jsx(w, { color: "#ff5a00", children: /* @__PURE__ */ e.jsx(P, { to: `/permission/role/${l}`, children: l }) }) }, l)) });
89
+ return /* @__PURE__ */ e.jsx(F, { gutter: [4, 4], children: (s || []).map((o) => /* @__PURE__ */ e.jsx(P, { children: o === "root" ? /* @__PURE__ */ e.jsx(A, { color: "#f50", children: o }) : /* @__PURE__ */ e.jsx(A, { color: "#ff5a00", children: /* @__PURE__ */ e.jsx(D, { to: `/permission/role/${o}`, children: o }) }) }, o)) });
87
90
  }
88
91
  },
89
92
  {
90
- title: a("global.creationTime"),
93
+ title: n("global.creationTime"),
91
94
  dataIndex: "Ctime",
92
95
  key: "ctime"
93
96
  },
94
97
  {
95
- title: a("global.operation"),
98
+ title: n("global.operation"),
96
99
  width: 150,
97
100
  align: "center",
98
- render: (s) => /* @__PURE__ */ e.jsxs(G, { children: [
101
+ render: (s) => /* @__PURE__ */ e.jsxs(E, { children: [
99
102
  /* @__PURE__ */ e.jsx(
100
103
  h,
101
104
  {
@@ -114,7 +117,7 @@ const te = () => {
114
117
  }
115
118
  });
116
119
  },
117
- children: a("global.update")
120
+ children: n("global.update")
118
121
  }
119
122
  ),
120
123
  /* @__PURE__ */ e.jsx(
@@ -127,21 +130,21 @@ const te = () => {
127
130
  type: "link",
128
131
  onClick: () => {
129
132
  d.confirm({
130
- title: a("UserList.deleteTitle"),
131
- content: /* @__PURE__ */ e.jsx(z, { texts: [s.name], children: a("UserList.deleteContent", { user: s.name }) }),
133
+ title: n("UserList.deleteTitle"),
134
+ content: /* @__PURE__ */ e.jsx(R, { texts: [s.name], children: n("UserList.deleteContent", { user: s.name }) }),
132
135
  async onOk() {
133
- await o.trigger({
136
+ await l.trigger({
134
137
  id: s.id,
135
138
  name: s.name
136
- }), u(g, (l) => I(l, (r) => {
137
- var C, f;
138
- const S = (C = r == null ? void 0 : r.dataSource) == null ? void 0 : C.findIndex((v) => v.id === s.id);
139
- S && ((f = r == null ? void 0 : r.dataSource) == null || f.splice(S, 1));
140
- })), i.success(a("UserList.deleteSuccessfully"));
139
+ }), u(x, (o) => I(o, (r) => {
140
+ var C, S;
141
+ const f = (C = r == null ? void 0 : r.dataSource) == null ? void 0 : C.findIndex((v) => v.id === s.id);
142
+ f && ((S = r == null ? void 0 : r.dataSource) == null || S.splice(f, 1));
143
+ })), i.success(n("UserList.deleteSuccessfully"));
141
144
  }
142
145
  });
143
146
  },
144
- children: a("global.delete")
147
+ children: n("global.delete")
145
148
  }
146
149
  )
147
150
  ] })
@@ -149,28 +152,28 @@ const te = () => {
149
152
  ];
150
153
  return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
151
154
  /* @__PURE__ */ e.jsx(
152
- D,
155
+ G,
153
156
  {
154
- title: a("global.user"),
157
+ title: n("global.user"),
155
158
  extra: /* @__PURE__ */ e.jsx(
156
159
  h,
157
160
  {
158
161
  isGlobalNS: !0,
159
162
  type: "primary",
160
- icon: /* @__PURE__ */ e.jsx(B, {}),
163
+ icon: /* @__PURE__ */ e.jsx(H, {}),
161
164
  code: "100002",
162
165
  onClick: () => {
163
166
  m();
164
167
  },
165
- children: a("UserList.createTitle")
168
+ children: n("UserList.createTitle")
166
169
  }
167
170
  ),
168
171
  children: /* @__PURE__ */ e.jsx(
169
- R,
172
+ z,
170
173
  {
171
174
  isGlobalNS: !0,
172
175
  code: "100001",
173
- action: g,
176
+ action: x,
174
177
  rowKey: "id",
175
178
  columns: c,
176
179
  getTotal: (s) => s.Total,
@@ -179,11 +182,11 @@ const te = () => {
179
182
  )
180
183
  }
181
184
  ),
182
- n,
183
- x
185
+ a,
186
+ p
184
187
  ] });
185
188
  };
186
189
  export {
187
- g as action,
190
+ x as action,
188
191
  te as default
189
192
  };
@@ -1,39 +1,41 @@
1
- import { A as O, _ as T, c as N, d as _, u as y, a as b, j as e, P as j, r as z, H as P, Q as $, b as S } from "./index-Tn0ScF_k.chunk.js";
1
+ import { A as O, _ as T, c as N, d as P, u as y, a as b, j as e, P as j, r as _, H as z, Q as $, b as S } from "./index-IcW2Gzox.chunk.js";
2
2
  import { App as f, Space as F, Card as G, Form as g, Input as L } from "antd";
3
3
  import { p as A } from "./immer-BLf7GM7E.chunk.js";
4
4
  import { Link as B } from "react-router-dom";
5
- import { P as k } from "./index-6HknRl5q.chunk.js";
6
- import { d as E, e as V, f as q } from "./index-di-49SIT.chunk.js";
5
+ import { P as k } from "./index-9I4jc90P.chunk.js";
6
+ import { d as E, e as q, f as D } from "./index-d2XgZJdb.chunk.js";
7
7
  import * as v from "react";
8
8
  import "react-dom";
9
- var D = { icon: { tag: "svg", attrs: { viewBox: "64 64 896 896", focusable: "false" }, children: [{ tag: "path", attrs: { d: "M892 772h-80v-80c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v80h-80c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h80v80c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8v-80h80c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM373.5 498.4c-.9-8.7-1.4-17.5-1.4-26.4 0-15.9 1.5-31.4 4.3-46.5.7-3.6-1.2-7.3-4.5-8.8-13.6-6.1-26.1-14.5-36.9-25.1a127.54 127.54 0 01-38.7-95.4c.9-32.1 13.8-62.6 36.3-85.6 24.7-25.3 57.9-39.1 93.2-38.7 31.9.3 62.7 12.6 86 34.4 7.9 7.4 14.7 15.6 20.4 24.4 2 3.1 5.9 4.4 9.3 3.2 17.6-6.1 36.2-10.4 55.3-12.4 5.6-.6 8.8-6.6 6.3-11.6-32.5-64.3-98.9-108.7-175.7-109.9-110.8-1.7-203.2 89.2-203.2 200 0 62.8 28.9 118.8 74.2 155.5-31.8 14.7-61.1 35-86.5 60.4-54.8 54.7-85.8 126.9-87.8 204a8 8 0 008 8.2h56.1c4.3 0 7.9-3.4 8-7.7 1.9-58 25.4-112.3 66.7-153.5 29.4-29.4 65.4-49.8 104.7-59.7 3.8-1.1 6.4-4.8 5.9-8.8zM824 472c0-109.4-87.9-198.3-196.9-200C516.3 270.3 424 361.2 424 472c0 62.8 29 118.8 74.2 155.5a300.95 300.95 0 00-86.4 60.4C357 742.6 326 814.8 324 891.8a8 8 0 008 8.2h56c4.3 0 7.9-3.4 8-7.7 1.9-58 25.4-112.3 66.7-153.5C505.8 695.7 563 672 624 672c110.4 0 200-89.5 200-200zm-109.5 90.5C690.3 586.7 658.2 600 624 600s-66.3-13.3-90.5-37.5a127.26 127.26 0 01-37.5-91.8c.3-32.8 13.4-64.5 36.3-88 24-24.6 56.1-38.3 90.4-38.7 33.9-.3 66.8 12.9 91 36.6 24.8 24.3 38.4 56.8 38.4 91.4-.1 34.2-13.4 66.3-37.6 90.5z" } }] }, name: "usergroup-add", theme: "outlined" };
10
- const Q = D;
11
- var I = function(o, a) {
12
- return /* @__PURE__ */ v.createElement(O, T({}, o, {
9
+ var Q = { icon: { tag: "svg", attrs: { viewBox: "64 64 896 896", focusable: "false" }, children: [{ tag: "path", attrs: { d: "M892 772h-80v-80c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v80h-80c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h80v80c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8v-80h80c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM373.5 498.4c-.9-8.7-1.4-17.5-1.4-26.4 0-15.9 1.5-31.4 4.3-46.5.7-3.6-1.2-7.3-4.5-8.8-13.6-6.1-26.1-14.5-36.9-25.1a127.54 127.54 0 01-38.7-95.4c.9-32.1 13.8-62.6 36.3-85.6 24.7-25.3 57.9-39.1 93.2-38.7 31.9.3 62.7 12.6 86 34.4 7.9 7.4 14.7 15.6 20.4 24.4 2 3.1 5.9 4.4 9.3 3.2 17.6-6.1 36.2-10.4 55.3-12.4 5.6-.6 8.8-6.6 6.3-11.6-32.5-64.3-98.9-108.7-175.7-109.9-110.8-1.7-203.2 89.2-203.2 200 0 62.8 28.9 118.8 74.2 155.5-31.8 14.7-61.1 35-86.5 60.4-54.8 54.7-85.8 126.9-87.8 204a8 8 0 008 8.2h56.1c4.3 0 7.9-3.4 8-7.7 1.9-58 25.4-112.3 66.7-153.5 29.4-29.4 65.4-49.8 104.7-59.7 3.8-1.1 6.4-4.8 5.9-8.8zM824 472c0-109.4-87.9-198.3-196.9-200C516.3 270.3 424 361.2 424 472c0 62.8 29 118.8 74.2 155.5a300.95 300.95 0 00-86.4 60.4C357 742.6 326 814.8 324 891.8a8 8 0 008 8.2h56c4.3 0 7.9-3.4 8-7.7 1.9-58 25.4-112.3 66.7-153.5C505.8 695.7 563 672 624 672c110.4 0 200-89.5 200-200zm-109.5 90.5C690.3 586.7 658.2 600 624 600s-66.3-13.3-90.5-37.5a127.26 127.26 0 01-37.5-91.8c.3-32.8 13.4-64.5 36.3-88 24-24.6 56.1-38.3 90.4-38.7 33.9-.3 66.8 12.9 91 36.6 24.8 24.3 38.4 56.8 38.4 91.4-.1 34.2-13.4 66.3-37.6 90.5z" } }] }, name: "usergroup-add", theme: "outlined" };
10
+ const H = Q;
11
+ var I = function(r, a) {
12
+ return /* @__PURE__ */ v.createElement(O, T({}, r, {
13
13
  ref: a,
14
- icon: Q
14
+ icon: H
15
15
  }));
16
16
  };
17
17
  process.env.NODE_ENV !== "production" && (I.displayName = "UsergroupAddOutlined");
18
- const H = /* @__PURE__ */ v.forwardRef(I), h = "/api/usystem/role/list", K = () => {
19
- const { message: c } = f.useApp(), { setPayload: o } = y(), a = V(), n = b(), r = async (l) => {
18
+ const K = /* @__PURE__ */ v.forwardRef(I), h = "/api/usystem/role/list", J = () => {
19
+ const { message: c } = f.useApp(), { setPayload: r } = y(), a = q(), n = b(), l = async (i) => {
20
20
  await a.trigger({
21
- name: `role_${l.name}`,
22
- permissions: l.permissions
23
- }), o(h, { page: 1 }), c.success(n("RoleList.createSuccessfully"));
21
+ name: `role_${i.name}`,
22
+ permissions: i.permissions
23
+ }), r(h, { page: 1 }), c.success(n("RoleList.createSuccessfully"));
24
24
  };
25
25
  return S({
26
26
  title: n("RoleList.createTitle"),
27
27
  width: "50vw",
28
- layout: "vertical",
28
+ formProps: {
29
+ layout: "vertical"
30
+ },
29
31
  content: /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
30
32
  /* @__PURE__ */ e.jsx(g.Item, { label: n("global.name"), name: "name", rules: [{ required: !0 }], children: /* @__PURE__ */ e.jsx(L, { addonBefore: "role_" }) }),
31
33
  /* @__PURE__ */ e.jsx(g.Item, { name: "permissions", children: /* @__PURE__ */ e.jsx(k, {}) })
32
34
  ] }),
33
- onConfirm: r
35
+ onConfirm: l
34
36
  });
35
- }, J = () => {
36
- const { message: c } = f.useApp(), { mutate: o } = y(), a = q(), n = b();
37
+ }, W = () => {
38
+ const { message: c } = f.useApp(), { mutate: r } = y(), a = D(), n = b();
37
39
  return S({
38
40
  title: n("RoleList.updateTitle"),
39
41
  width: "50vw",
@@ -41,24 +43,24 @@ const H = /* @__PURE__ */ v.forwardRef(I), h = "/api/usystem/role/list", K = ()
41
43
  /* @__PURE__ */ e.jsx(g.Item, { label: n("global.name"), name: "name", rules: [{ required: !0 }], children: /* @__PURE__ */ e.jsx(L, { readOnly: !0, addonBefore: "role_" }) }),
42
44
  /* @__PURE__ */ e.jsx(g.Item, { name: "permissions", children: /* @__PURE__ */ e.jsx(k, {}) })
43
45
  ] }),
44
- onConfirm: async (r, l) => {
46
+ onConfirm: async (l, i) => {
45
47
  await a.trigger({
46
- id: l.id,
47
- name: `role_${r.name}`,
48
- permissions: r.permissions
49
- }), o(
48
+ id: i == null ? void 0 : i.id,
49
+ name: `role_${l.name}`,
50
+ permissions: l.permissions
51
+ }), r(
50
52
  h,
51
53
  (x) => A(x, (m) => {
52
54
  var p;
53
- const u = (p = m == null ? void 0 : m.dataSource) == null ? void 0 : p.find((t) => t.id === l.id);
54
- u && (u.permissions = r.permissions);
55
+ const u = (p = m == null ? void 0 : m.dataSource) == null ? void 0 : p.find((t) => t.id === (i == null ? void 0 : i.id));
56
+ u && (u.permissions = l.permissions);
55
57
  }),
56
58
  { revalidate: !1 }
57
59
  ), c.success(n("RoleList.updateSuccessfully"));
58
60
  }
59
61
  });
60
62
  }, ie = () => {
61
- const { accessible: c } = N("200005", !0), { modal: o, message: a } = f.useApp(), { usePermissionApiV2: n } = _(), r = E(), { mutate: l } = y(), { show: x, modal: m } = K(), { show: u, modal: p } = J(), t = b(), M = [
63
+ const { accessible: c } = N("200005", !0), { modal: r, message: a } = f.useApp(), { usePermissionApiV2: n } = P(), l = E(), { mutate: i } = y(), { show: x, modal: m } = J(), { show: u, modal: p } = W(), t = b(), M = [
62
64
  {
63
65
  title: t("global.name"),
64
66
  key: "name",
@@ -89,17 +91,17 @@ const H = /* @__PURE__ */ v.forwardRef(I), h = "/api/usystem/role/list", K = ()
89
91
  size: "small",
90
92
  type: "link",
91
93
  onClick: async () => {
92
- const { data: i } = await z(
94
+ const { data: o } = await _(
93
95
  `/api/usystem/role/info${n ? "V2" : ""}?name=${s.name}`,
94
96
  { isGlobalNS: !0 }
95
97
  );
96
98
  u({
97
99
  initialValues: {
98
- permissions: i == null ? void 0 : i.permissions,
99
- name: i == null ? void 0 : i.name.replace(/^role_/, "")
100
+ permissions: o == null ? void 0 : o.permissions,
101
+ name: o == null ? void 0 : o.name.replace(/^role_/, "")
100
102
  },
101
103
  extraValues: {
102
- id: i == null ? void 0 : i.id
104
+ id: o == null ? void 0 : o.id
103
105
  }
104
106
  });
105
107
  },
@@ -115,14 +117,14 @@ const H = /* @__PURE__ */ v.forwardRef(I), h = "/api/usystem/role/list", K = ()
115
117
  size: "small",
116
118
  type: "link",
117
119
  onClick: () => {
118
- o.confirm({
120
+ r.confirm({
119
121
  title: t("RoleList.deleteTitle"),
120
- content: /* @__PURE__ */ e.jsx(P, { texts: [s.name], children: t("RoleList.deleteContent", { role: s.name }) }),
122
+ content: /* @__PURE__ */ e.jsx(z, { texts: [s.name], children: t("RoleList.deleteContent", { role: s.name }) }),
121
123
  async onOk() {
122
- await r.trigger({
124
+ await l.trigger({
123
125
  id: s.id,
124
126
  name: s.name
125
- }), l(h, (i) => A(i, (d) => {
127
+ }), i(h, (o) => A(o, (d) => {
126
128
  var R, C;
127
129
  const w = (R = d == null ? void 0 : d.dataSource) == null ? void 0 : R.findIndex((U) => U.id === s.id);
128
130
  w && ((C = d == null ? void 0 : d.dataSource) == null || C.splice(w, 1));
@@ -147,7 +149,7 @@ const H = /* @__PURE__ */ v.forwardRef(I), h = "/api/usystem/role/list", K = ()
147
149
  isGlobalNS: !0,
148
150
  type: "primary",
149
151
  code: "200002",
150
- icon: /* @__PURE__ */ e.jsx(H, {}),
152
+ icon: /* @__PURE__ */ e.jsx(K, {}),
151
153
  onClick: () => {
152
154
  x();
153
155
  },
@@ -1,8 +1,8 @@
1
- import { a as t, j as i } from "./index-Tn0ScF_k.chunk.js";
1
+ import { a as t, j as i } from "./index-IcW2Gzox.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-6HknRl5q.chunk.js";
5
- import { g as p } from "./index-di-49SIT.chunk.js";
4
+ import { P as j } from "./index-9I4jc90P.chunk.js";
5
+ import { g as p } from "./index-d2XgZJdb.chunk.js";
6
6
  import "react";
7
7
  import "react-dom";
8
8
  const k = () => {
@@ -1,4 +1,4 @@
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-Tn0ScF_k.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-IcW2Gzox.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();
package/lib/index.d.ts CHANGED
@@ -230,8 +230,8 @@ export declare const mixedStorage: StateStorage;
230
230
 
231
231
  declare interface ModalState {
232
232
  open: Map<string, boolean>;
233
- getOpen: (id: string) => boolean;
234
- setOpen: (id: string, open: boolean) => void;
233
+ getOpen: (uuid: string) => boolean;
234
+ setOpen: (uuid: string, open: boolean) => void;
235
235
  }
236
236
 
237
237
  export declare const NavMenu: NamedExoticComponent<object>;
@@ -360,18 +360,18 @@ export declare interface TokenState {
360
360
  clearToken: () => void;
361
361
  }
362
362
 
363
- export declare function useFormModal<Values>(props: UseFormModalProps<Values>): {
363
+ export declare function useFormModal<Values, ExtraValues = any>(props: UseFormModalProps<Values, ExtraValues>): {
364
364
  show: (config?: {
365
- initialValues?: RecursivePartial<Values> | undefined;
366
- extraValues?: any;
365
+ initialValues?: RecursivePartial<Values>;
366
+ extraValues?: ExtraValues;
367
367
  }) => void;
368
368
  hide: () => void;
369
369
  modal: JSX_2.Element;
370
370
  };
371
371
 
372
- export declare interface UseFormModalProps<Values> extends Pick<ModalProps, 'title' | 'width' | 'maskClosable'>, Pick<FormProps, 'labelCol' | 'layout' | 'initialValues'> {
373
- content?: ReactNode;
374
- onConfirm?: (values: Values, extraValues: any) => Promise<void>;
372
+ export declare interface UseFormModalProps<Values, ExtraValues> extends Omit<UseModalProps, 'afterClose' | 'onConfirm'> {
373
+ formProps?: Omit<FormProps, 'form'>;
374
+ onConfirm?: (values: Values, extraValues?: ExtraValues) => void | Promise<void>;
375
375
  }
376
376
 
377
377
  export declare const useGameStore: UseBoundStore<Omit<StoreApi<GameState>, "persist"> & {
@@ -386,6 +386,17 @@ export declare const useGameStore: UseBoundStore<Omit<StoreApi<GameState>, "pers
386
386
  };
387
387
  }>;
388
388
 
389
+ export declare function useModal(props: UseModalProps): {
390
+ show: () => void;
391
+ hide: () => void;
392
+ modal: JSX_2.Element;
393
+ };
394
+
395
+ declare interface UseModalProps extends Omit<ModalProps, 'open' | 'confirmLoading' | 'onOk' | 'onCancel'> {
396
+ content?: ReactNode;
397
+ onConfirm?: () => void | Promise<void>;
398
+ }
399
+
389
400
  export declare const useModalStore: UseBoundStore<StoreApi<ModalState>>;
390
401
 
391
402
  export declare function usePermission(code: string | undefined, isGlobalNS?: boolean, config?: SWRConfiguration): {
package/lib/index.js CHANGED
@@ -1,12 +1,12 @@
1
- import { C as r, D as n, F as u, G as m, H as d, i as l, L as p, N as L, k as S, O as g, l as y, P, n as x, Q as c, o as F, R as G, p as T, S as h, q as k, t as q, v as Q, r as R, b as v, x as B, y as C, c as M, z as N, u as f, B as w, E as D, d as E, a as H, J as I, K as O } from "./index-Tn0ScF_k.chunk.js";
1
+ import { C as r, D as u, F as n, G as m, H as d, i as l, L as p, N as L, k as S, O as g, l as y, P, n as x, Q as c, o as F, R as G, p as M, S as T, q as h, t as k, v as q, r as Q, b as R, x as v, y as B, z as C, c as N, B as f, u as w, E as D, J as E, d as H, a as I, K as O, M as W } from "./index-IcW2Gzox.chunk.js";
2
2
  import "react";
3
3
  import "antd";
4
4
  import "react-dom";
5
5
  import "react-router-dom";
6
6
  export {
7
7
  r as ContextProvider,
8
- n as DynamicTags,
9
- u as FilterFormWrapper,
8
+ u as DynamicTags,
9
+ n as FilterFormWrapper,
10
10
  m as GameSelect,
11
11
  d as Highlight,
12
12
  l as InfiniteList,
@@ -20,22 +20,23 @@ export {
20
20
  c as QueryList,
21
21
  F as QueryListAction,
22
22
  G as RequestError,
23
- T as RequireGame,
24
- h as SignIn,
25
- k as UserWidget,
26
- q as contextStore,
27
- Q as mixedStorage,
28
- R as request,
29
- v as useFormModal,
30
- B as useGameStore,
23
+ M as RequireGame,
24
+ T as SignIn,
25
+ h as UserWidget,
26
+ k as contextStore,
27
+ q as mixedStorage,
28
+ Q as request,
29
+ R as useFormModal,
30
+ v as useGameStore,
31
+ B as useModal,
31
32
  C as useModalStore,
32
- M as usePermission,
33
- N as usePermissions,
34
- f as useQueryListStore,
35
- w as useTokenStore,
36
- D as useTokenValidation,
37
- E as useToolkitsContext,
38
- H as useTranslation,
39
- I as withBaseRoutes,
40
- O as withLayout
33
+ N as usePermission,
34
+ f as usePermissions,
35
+ w as useQueryListStore,
36
+ D as useTokenStore,
37
+ E as useTokenValidation,
38
+ H as useToolkitsContext,
39
+ I as useTranslation,
40
+ O as withBaseRoutes,
41
+ W as withLayout
41
42
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-toolkits",
3
- "version": "0.8.22",
3
+ "version": "0.8.24",
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
- "@flow97/eslint-config-mono": "0.0.4",
73
72
  "tailwind-config": "0.1.1",
73
+ "@flow97/eslint-config-mono": "0.0.4",
74
74
  "tsconfig": "0.0.5"
75
75
  },
76
76
  "peerDependencies": {