react-toolkits 0.8.21 → 0.8.22

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,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-2I_COrHX.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-Tn0ScF_k.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();
@@ -0,0 +1,189 @@
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";
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";
6
+ import * as M from "react";
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) {
11
+ return /* @__PURE__ */ M.createElement(T, N({}, i, {
12
+ ref: o,
13
+ icon: q
14
+ }));
15
+ };
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" },
23
+ 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
+ ] }),
27
+ async onConfirm(t) {
28
+ await i.trigger(t), m(g, { page: 1 }), d.success(n("UserList.createSuccessfully"));
29
+ }
30
+ });
31
+ }
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" },
37
+ 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(
40
+ y,
41
+ {
42
+ allowClear: !0,
43
+ mode: "multiple",
44
+ loading: u,
45
+ options: o == null ? void 0 : o.map((t) => ({
46
+ label: t.name,
47
+ value: t.name
48
+ })),
49
+ dropdownStyle: { zIndex: 9999 }
50
+ }
51
+ ) })
52
+ ] }),
53
+ async onConfirm(t, x) {
54
+ await i.trigger(t), m(
55
+ g,
56
+ (a) => I(a, (c) => {
57
+ var s;
58
+ 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);
61
+ }
62
+ }),
63
+ { revalidate: !1 }
64
+ ), d.success(n("UserList.updateSuccessfully"));
65
+ }
66
+ });
67
+ }
68
+ 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 = [
70
+ {
71
+ title: a("global.name"),
72
+ dataIndex: "name",
73
+ key: "name"
74
+ },
75
+ {
76
+ title: "ID",
77
+ dataIndex: "id",
78
+ key: "id"
79
+ },
80
+ {
81
+ title: a("global.role"),
82
+ dataIndex: "roles",
83
+ key: "roles",
84
+ width: "40%",
85
+ 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)) });
87
+ }
88
+ },
89
+ {
90
+ title: a("global.creationTime"),
91
+ dataIndex: "Ctime",
92
+ key: "ctime"
93
+ },
94
+ {
95
+ title: a("global.operation"),
96
+ width: 150,
97
+ align: "center",
98
+ render: (s) => /* @__PURE__ */ e.jsxs(G, { children: [
99
+ /* @__PURE__ */ e.jsx(
100
+ h,
101
+ {
102
+ isGlobalNS: !0,
103
+ size: "small",
104
+ type: "link",
105
+ code: "100003",
106
+ onClick: () => {
107
+ t({
108
+ initialValues: {
109
+ name: s.name,
110
+ roles: s.roles
111
+ },
112
+ extraValues: {
113
+ id: s.id
114
+ }
115
+ });
116
+ },
117
+ children: a("global.update")
118
+ }
119
+ ),
120
+ /* @__PURE__ */ e.jsx(
121
+ h,
122
+ {
123
+ isGlobalNS: !0,
124
+ danger: !0,
125
+ size: "small",
126
+ code: "100004",
127
+ type: "link",
128
+ onClick: () => {
129
+ d.confirm({
130
+ title: a("UserList.deleteTitle"),
131
+ content: /* @__PURE__ */ e.jsx(z, { texts: [s.name], children: a("UserList.deleteContent", { user: s.name }) }),
132
+ async onOk() {
133
+ await o.trigger({
134
+ id: s.id,
135
+ 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"));
141
+ }
142
+ });
143
+ },
144
+ children: a("global.delete")
145
+ }
146
+ )
147
+ ] })
148
+ }
149
+ ];
150
+ return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
151
+ /* @__PURE__ */ e.jsx(
152
+ D,
153
+ {
154
+ title: a("global.user"),
155
+ extra: /* @__PURE__ */ e.jsx(
156
+ h,
157
+ {
158
+ isGlobalNS: !0,
159
+ type: "primary",
160
+ icon: /* @__PURE__ */ e.jsx(B, {}),
161
+ code: "100002",
162
+ onClick: () => {
163
+ m();
164
+ },
165
+ children: a("UserList.createTitle")
166
+ }
167
+ ),
168
+ children: /* @__PURE__ */ e.jsx(
169
+ R,
170
+ {
171
+ isGlobalNS: !0,
172
+ code: "100001",
173
+ action: g,
174
+ rowKey: "id",
175
+ columns: c,
176
+ getTotal: (s) => s.Total,
177
+ getDataSource: (s) => s.List
178
+ }
179
+ )
180
+ }
181
+ ),
182
+ n,
183
+ x
184
+ ] });
185
+ };
186
+ export {
187
+ g as action,
188
+ te as default
189
+ };
@@ -1,63 +1,64 @@
1
- import { A as T, _, c as M, d as N, u as b, a as f, j as e, P as j, r as z, H as P, Q as $, b as L } from "./index-2I_COrHX.chunk.js";
2
- import { App as w, Space as H, Card as G, Form as m, Input as A } from "antd";
3
- import { p as k } from "./immer-BLf7GM7E.chunk.js";
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";
2
+ import { App as f, Space as F, Card as G, Form as g, Input as L } from "antd";
3
+ import { p as A } from "./immer-BLf7GM7E.chunk.js";
4
4
  import { Link as B } from "react-router-dom";
5
- import { P as v } from "./index-_CFeMHGZ.chunk.js";
6
- import { d as E, e as V, f as q } from "./index-EAawrEpf.chunk.js";
7
- import * as I from "react";
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";
7
+ import * as v from "react";
8
8
  import "react-dom";
9
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 F = D;
11
- var U = function(r, a) {
12
- return /* @__PURE__ */ I.createElement(T, _({}, r, {
10
+ const Q = D;
11
+ var I = function(o, a) {
12
+ return /* @__PURE__ */ v.createElement(O, T({}, o, {
13
13
  ref: a,
14
- icon: F
14
+ icon: Q
15
15
  }));
16
16
  };
17
- process.env.NODE_ENV !== "production" && (U.displayName = "UsergroupAddOutlined");
18
- const Q = /* @__PURE__ */ I.forwardRef(U), h = "/api/usystem/role/list", K = () => {
19
- const { message: c } = w.useApp(), { setPayload: r } = b(), a = V(), i = f(), n = async (l) => {
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) => {
20
20
  await a.trigger({
21
21
  name: `role_${l.name}`,
22
22
  permissions: l.permissions
23
- }), r(h, { page: 1 }), c.success(i("RoleList.createSuccessfully"));
23
+ }), o(h, { page: 1 }), c.success(n("RoleList.createSuccessfully"));
24
24
  };
25
- return L({
26
- title: i("RoleList.createTitle"),
25
+ return S({
26
+ title: n("RoleList.createTitle"),
27
27
  width: "50vw",
28
- content: (l) => /* @__PURE__ */ e.jsxs(m, { form: l, layout: "vertical", children: [
29
- /* @__PURE__ */ e.jsx(m.Item, { label: i("global.name"), name: "name", rules: [{ required: !0 }], children: /* @__PURE__ */ e.jsx(A, { addonBefore: "role_" }) }),
30
- /* @__PURE__ */ e.jsx(m.Item, { name: "permissions", children: /* @__PURE__ */ e.jsx(v, {}) })
28
+ layout: "vertical",
29
+ content: /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
30
+ /* @__PURE__ */ e.jsx(g.Item, { label: n("global.name"), name: "name", rules: [{ required: !0 }], children: /* @__PURE__ */ e.jsx(L, { addonBefore: "role_" }) }),
31
+ /* @__PURE__ */ e.jsx(g.Item, { name: "permissions", children: /* @__PURE__ */ e.jsx(k, {}) })
31
32
  ] }),
32
- onConfirm: n
33
+ onConfirm: r
33
34
  });
34
35
  }, J = () => {
35
- const { message: c } = w.useApp(), { mutate: r } = b(), a = q(), i = f();
36
- return L({
37
- title: i("RoleList.updateTitle"),
36
+ const { message: c } = f.useApp(), { mutate: o } = y(), a = q(), n = b();
37
+ return S({
38
+ title: n("RoleList.updateTitle"),
38
39
  width: "50vw",
39
- content: (n) => /* @__PURE__ */ e.jsxs(m, { form: n, children: [
40
- /* @__PURE__ */ e.jsx(m.Item, { label: i("global.name"), name: "name", rules: [{ required: !0 }], children: /* @__PURE__ */ e.jsx(A, { readOnly: !0, addonBefore: "role_" }) }),
41
- /* @__PURE__ */ e.jsx(m.Item, { name: "permissions", children: /* @__PURE__ */ e.jsx(v, {}) })
40
+ content: /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
41
+ /* @__PURE__ */ e.jsx(g.Item, { label: n("global.name"), name: "name", rules: [{ required: !0 }], children: /* @__PURE__ */ e.jsx(L, { readOnly: !0, addonBefore: "role_" }) }),
42
+ /* @__PURE__ */ e.jsx(g.Item, { name: "permissions", children: /* @__PURE__ */ e.jsx(k, {}) })
42
43
  ] }),
43
- onConfirm: async (n, l, p) => {
44
+ onConfirm: async (r, l) => {
44
45
  await a.trigger({
45
- id: p.id,
46
- name: `role_${n.name}`,
47
- permissions: n.permissions
48
- }), r(
46
+ id: l.id,
47
+ name: `role_${r.name}`,
48
+ permissions: r.permissions
49
+ }), o(
49
50
  h,
50
- (x) => k(x, (u) => {
51
- var t;
52
- const g = (t = u == null ? void 0 : u.dataSource) == null ? void 0 : t.find((y) => y.id === p.id);
53
- g && (g.permissions = n.permissions);
51
+ (x) => A(x, (m) => {
52
+ 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);
54
55
  }),
55
56
  { revalidate: !1 }
56
- ), c.success(i("RoleList.updateSuccessfully"));
57
+ ), c.success(n("RoleList.updateSuccessfully"));
57
58
  }
58
59
  });
59
- }, oe = () => {
60
- const { accessible: c } = M("200005", !0), { modal: r, message: a } = w.useApp(), { usePermissionApiV2: i } = N(), n = E(), { mutate: l } = b(), { show: p, contextHolder: x } = K(), { show: u, contextHolder: g } = J(), t = f(), y = [
60
+ }, 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 = [
61
62
  {
62
63
  title: t("global.name"),
63
64
  key: "name",
@@ -79,7 +80,7 @@ const Q = /* @__PURE__ */ I.forwardRef(U), h = "/api/usystem/role/list", K = ()
79
80
  title: t("global.operation"),
80
81
  width: 150,
81
82
  align: "center",
82
- render: (s) => /* @__PURE__ */ e.jsxs(H, { size: "small", children: [
83
+ render: (s) => /* @__PURE__ */ e.jsxs(F, { size: "small", children: [
83
84
  /* @__PURE__ */ e.jsx(
84
85
  j,
85
86
  {
@@ -88,17 +89,17 @@ const Q = /* @__PURE__ */ I.forwardRef(U), h = "/api/usystem/role/list", K = ()
88
89
  size: "small",
89
90
  type: "link",
90
91
  onClick: async () => {
91
- const { data: o } = await z(
92
- `/api/usystem/role/info${i ? "V2" : ""}?name=${s.name}`,
92
+ const { data: i } = await z(
93
+ `/api/usystem/role/info${n ? "V2" : ""}?name=${s.name}`,
93
94
  { isGlobalNS: !0 }
94
95
  );
95
96
  u({
96
97
  initialValues: {
97
- permissions: o == null ? void 0 : o.permissions,
98
- name: o == null ? void 0 : o.name.replace(/^role_/, "")
98
+ permissions: i == null ? void 0 : i.permissions,
99
+ name: i == null ? void 0 : i.name.replace(/^role_/, "")
99
100
  },
100
101
  extraValues: {
101
- id: o == null ? void 0 : o.id
102
+ id: i == null ? void 0 : i.id
102
103
  }
103
104
  });
104
105
  },
@@ -114,17 +115,17 @@ const Q = /* @__PURE__ */ I.forwardRef(U), h = "/api/usystem/role/list", K = ()
114
115
  size: "small",
115
116
  type: "link",
116
117
  onClick: () => {
117
- r.confirm({
118
+ o.confirm({
118
119
  title: t("RoleList.deleteTitle"),
119
120
  content: /* @__PURE__ */ e.jsx(P, { texts: [s.name], children: t("RoleList.deleteContent", { role: s.name }) }),
120
121
  async onOk() {
121
- await n.trigger({
122
+ await r.trigger({
122
123
  id: s.id,
123
124
  name: s.name
124
- }), l(h, (o) => k(o, (d) => {
125
- var R, S;
126
- const C = (R = d == null ? void 0 : d.dataSource) == null ? void 0 : R.findIndex((O) => O.id === s.id);
127
- C && ((S = d == null ? void 0 : d.dataSource) == null || S.splice(C, 1));
125
+ }), l(h, (i) => A(i, (d) => {
126
+ var R, C;
127
+ const w = (R = d == null ? void 0 : d.dataSource) == null ? void 0 : R.findIndex((U) => U.id === s.id);
128
+ w && ((C = d == null ? void 0 : d.dataSource) == null || C.splice(w, 1));
128
129
  })), a.success(t("RoleList.deleteSuccessfully"));
129
130
  }
130
131
  });
@@ -135,42 +136,42 @@ const Q = /* @__PURE__ */ I.forwardRef(U), h = "/api/usystem/role/list", K = ()
135
136
  ] })
136
137
  }
137
138
  ];
138
- return /* @__PURE__ */ e.jsxs(
139
- G,
140
- {
141
- title: t("global.role"),
142
- extra: /* @__PURE__ */ e.jsx(
143
- j,
144
- {
145
- isGlobalNS: !0,
146
- type: "primary",
147
- code: "200002",
148
- icon: /* @__PURE__ */ e.jsx(Q, {}),
149
- onClick: () => {
150
- p();
151
- },
152
- children: t("RoleList.createTitle")
153
- }
154
- ),
155
- children: [
156
- /* @__PURE__ */ e.jsx(
139
+ return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
140
+ /* @__PURE__ */ e.jsx(
141
+ G,
142
+ {
143
+ title: t("global.role"),
144
+ extra: /* @__PURE__ */ e.jsx(
145
+ j,
146
+ {
147
+ isGlobalNS: !0,
148
+ type: "primary",
149
+ code: "200002",
150
+ icon: /* @__PURE__ */ e.jsx(H, {}),
151
+ onClick: () => {
152
+ x();
153
+ },
154
+ children: t("RoleList.createTitle")
155
+ }
156
+ ),
157
+ children: /* @__PURE__ */ e.jsx(
157
158
  $,
158
159
  {
159
160
  isGlobalNS: !0,
160
161
  rowKey: "name",
161
- columns: y,
162
+ columns: M,
162
163
  code: "200001",
163
164
  action: h,
164
165
  getTotal: (s) => s.Total,
165
166
  getDataSource: (s) => s.List
166
167
  }
167
- ),
168
- x,
169
- g
170
- ]
171
- }
172
- );
168
+ )
169
+ }
170
+ ),
171
+ m,
172
+ p
173
+ ] });
173
174
  };
174
175
  export {
175
- oe as default
176
+ ie as default
176
177
  };
package/lib/index.d.ts CHANGED
@@ -2,20 +2,21 @@ import type { ButtonProps } from 'antd';
2
2
  import type { ComponentType } from 'react';
3
3
  import type { FC } from 'react';
4
4
  import type { FormInstance } from 'antd';
5
+ import type { FormProps } from 'antd';
5
6
  import { JSX as JSX_2 } from 'react/jsx-runtime';
6
7
  import type { Key } from 'react';
7
8
  import type { MenuDividerType } from 'antd/es/menu/hooks/useItems';
8
9
  import type { MenuItemGroupType } from 'antd/es/menu/hooks/useItems';
9
10
  import type { MenuItemType } from 'antd/es/menu/hooks/useItems';
10
11
  import type { Merge } from 'ts-essentials';
11
- import type { ModalFuncProps } from 'antd';
12
+ import type { ModalProps } from 'antd';
12
13
  import type { MutatorCallback } from 'swr/_internal';
13
14
  import type { MutatorOptions } from 'swr/_internal';
14
15
  import { NamedExoticComponent } from 'react';
15
16
  import { PersistOptions } from 'zustand/middleware';
16
17
  import type { PropsWithChildren } from 'react';
17
18
  import type { ReactElement } from 'react';
18
- import type { ReactNode } from 'react';
19
+ import { ReactNode } from 'react';
19
20
  import type { Ref } from 'react';
20
21
  import type { StateStorage } from 'zustand/middleware';
21
22
  import { StoreApi } from 'zustand';
@@ -227,6 +228,12 @@ declare type MenuItemType2 = Merge<MenuItemType, {
227
228
 
228
229
  export declare const mixedStorage: StateStorage;
229
230
 
231
+ declare interface ModalState {
232
+ open: Map<string, boolean>;
233
+ getOpen: (id: string) => boolean;
234
+ setOpen: (id: string, open: boolean) => void;
235
+ }
236
+
230
237
  export declare const NavMenu: NamedExoticComponent<object>;
231
238
 
232
239
  export declare type NavMenuItem = MenuItemType2 | SubMenuType2 | MenuItemGroupType2 | MenuDividerType | null;
@@ -354,23 +361,17 @@ export declare interface TokenState {
354
361
  }
355
362
 
356
363
  export declare function useFormModal<Values>(props: UseFormModalProps<Values>): {
357
- show: (scopedProps?: Partial<Pick<UseFormModalProps<Values>, 'title'> & {
358
- initialValues?: RecursivePartial<Values>;
364
+ show: (config?: {
365
+ initialValues?: RecursivePartial<Values> | undefined;
359
366
  extraValues?: any;
360
- }>) => {
361
- destroy: () => void;
362
- update: (configUpdate: ModalFuncProps | ((prevConfig: ModalFuncProps) => ModalFuncProps)) => void;
363
- } & {
364
- then<T>(resolve: (confirmed: boolean) => T, reject: VoidFunction): Promise<T>;
365
- };
366
- form: FormInstance<Values>;
367
- contextHolder: JSX_2.Element;
367
+ }) => void;
368
+ hide: () => void;
369
+ modal: JSX_2.Element;
368
370
  };
369
371
 
370
- export declare interface UseFormModalProps<Values> extends Omit<ModalFuncProps, 'icon' | 'className' | 'content' | 'type' | 'onOk' | 'onCancel'> {
371
- content?: (form: FormInstance<Values>) => ReactNode;
372
- onConfirm?: (values: Values, form: FormInstance<Values>, extraValues: any) => Promise<void>;
373
- onCancel?: (form: FormInstance<Values>) => void;
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>;
374
375
  }
375
376
 
376
377
  export declare const useGameStore: UseBoundStore<Omit<StoreApi<GameState>, "persist"> & {
@@ -385,6 +386,8 @@ export declare const useGameStore: UseBoundStore<Omit<StoreApi<GameState>, "pers
385
386
  };
386
387
  }>;
387
388
 
389
+ export declare const useModalStore: UseBoundStore<StoreApi<ModalState>>;
390
+
388
391
  export declare function usePermission(code: string | undefined, isGlobalNS?: boolean, config?: SWRConfiguration): {
389
392
  accessible: boolean;
390
393
  isValidating: boolean;
package/lib/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { C as r, D as n, F as u, G as m, H as p, i as L, L as d, 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, c as C, y as N, u as f, z as w, B as D, d as E, a as H, E as I, J as M } from "./index-2I_COrHX.chunk.js";
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";
2
2
  import "react";
3
3
  import "antd";
4
4
  import "react-dom";
@@ -8,10 +8,10 @@ export {
8
8
  n as DynamicTags,
9
9
  u as FilterFormWrapper,
10
10
  m as GameSelect,
11
- p as Highlight,
12
- L as InfiniteList,
13
- d as Layout,
14
- l as NavMenu,
11
+ d as Highlight,
12
+ l as InfiniteList,
13
+ p as Layout,
14
+ L as NavMenu,
15
15
  S as NotFound,
16
16
  g as OperationLogList,
17
17
  y as Permission,
@@ -28,7 +28,8 @@ export {
28
28
  R as request,
29
29
  v as useFormModal,
30
30
  B as useGameStore,
31
- C as usePermission,
31
+ C as useModalStore,
32
+ M as usePermission,
32
33
  N as usePermissions,
33
34
  f as useQueryListStore,
34
35
  w as useTokenStore,
@@ -36,5 +37,5 @@ export {
36
37
  E as useToolkitsContext,
37
38
  H as useTranslation,
38
39
  I as withBaseRoutes,
39
- M as withLayout
40
+ O as withLayout
40
41
  };
package/lib/style.css CHANGED
@@ -1 +1 @@
1
- *,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.bottom-0{bottom:0}.left-0{left:0}.left-14{left:3.5rem}.right-0{right:0}.right-16{right:4rem}.top-0{top:0}.top-1\/2{top:50%}.top-16{top:4rem}.top-6{top:1.5rem}.z-10{z-index:10}.my-12{margin-top:3rem;margin-bottom:3rem}.-mb-0{margin-bottom:-0px}.-mb-0\.5{margin-bottom:-.125rem}.mb-12{margin-bottom:3rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.ml-2{margin-left:.5rem}.ml-64{margin-left:16rem}.ml-8{margin-left:2rem}.mr-2{margin-right:.5rem}.mt-2{margin-top:.5rem}.mt-4{margin-top:1rem}.block{display:block}.inline{display:inline}.flex{display:flex}.h-10{height:2.5rem}.h-8{height:2rem}.h-full{height:100%}.h-screen{height:100vh}.max-h-32{max-height:8rem}.w-10\/12{width:83.333333%}.w-12{width:3rem}.w-8{width:2rem}.w-\[18px\]{width:18px}.w-\[650px\]{width:650px}.w-full{width:100%}.w-screen{width:100vw}.flex-1{flex:1 1 0%}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-10{--tw-translate-y: -2.5rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.overflow-auto{overflow:auto}.bg-gray-50{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity))}.bg-slate-50{--tw-bg-opacity: 1;background-color:rgb(248 250 252 / var(--tw-bg-opacity))}.p-6{padding:1.5rem}.px-36{padding-left:9rem;padding-right:9rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-4{padding-top:1rem;padding-bottom:1rem}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}html,body{padding:0;margin:0}.toolkits-modal .ant-modal-confirm .ant-modal-confirm-paragraph{max-width:100%!important}
1
+ *,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.bottom-0{bottom:0}.left-0{left:0}.left-14{left:3.5rem}.right-0{right:0}.right-16{right:4rem}.top-0{top:0}.top-1\/2{top:50%}.top-16{top:4rem}.top-6{top:1.5rem}.z-10{z-index:10}.my-12{margin-top:3rem;margin-bottom:3rem}.-mb-0{margin-bottom:-0px}.-mb-0\.5{margin-bottom:-.125rem}.mb-12{margin-bottom:3rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.ml-2{margin-left:.5rem}.ml-64{margin-left:16rem}.ml-8{margin-left:2rem}.mr-2{margin-right:.5rem}.mt-2{margin-top:.5rem}.mt-4{margin-top:1rem}.block{display:block}.inline{display:inline}.flex{display:flex}.h-10{height:2.5rem}.h-8{height:2rem}.h-full{height:100%}.h-screen{height:100vh}.max-h-32{max-height:8rem}.w-10\/12{width:83.333333%}.w-12{width:3rem}.w-8{width:2rem}.w-\[18px\]{width:18px}.w-\[650px\]{width:650px}.w-full{width:100%}.w-screen{width:100vw}.flex-1{flex:1 1 0%}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-10{--tw-translate-y: -2.5rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.overflow-auto{overflow:auto}.bg-gray-50{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity))}.bg-slate-50{--tw-bg-opacity: 1;background-color:rgb(248 250 252 / var(--tw-bg-opacity))}.p-6{padding:1.5rem}.px-36{padding-left:9rem;padding-right:9rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-4{padding-top:1rem;padding-bottom:1rem}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-toolkits",
3
- "version": "0.8.21",
3
+ "version": "0.8.22",
4
4
  "packageManager": "^pnpm@8.7.5",
5
5
  "sideEffects": [
6
6
  "**/*.css"