react-toolkits 0.6.5 → 0.7.0

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,5 +1,11 @@
1
1
  # react-toolkits
2
2
 
3
+ ## 0.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - b30e737: refactor: change QueryList api
8
+
3
9
  ## 0.6.5
4
10
 
5
11
  ### Patch Changes
@@ -1,68 +1,68 @@
1
- import { A as _, _ as M, e as N, b as T, f as b, u as f, j as e, P as j, r as z, H as P, Q as $, h as A } from "./index-jIaB0f6T.chunk.js";
2
- import { App as R, Space as H, Card as G, Form as m, Input as k } from "antd";
3
- import { p as S } from "./immer-BLf7GM7E.chunk.js";
1
+ import { A as T, _, e as M, b as N, f as b, u as f, j as e, P as j, r as z, H as P, Q as $, h as A } from "./index-JEVes6q2.chunk.js";
2
+ import { App as w, Space as H, Card as G, Form as m, Input as S } from "antd";
3
+ import { p as k } from "./immer-BLf7GM7E.chunk.js";
4
4
  import { Link as B } from "react-router-dom";
5
- import { P as I } from "./index-HtxBCkWB.chunk.js";
6
- import { a as E, b as V, c as q } from "./index-sZjVIAIn.chunk.js";
5
+ import { P as I } from "./index-BvENvvlB.chunk.js";
6
+ import { a as E, b as V, c as q } from "./index-tzZwFuEm.chunk.js";
7
7
  import * as U from "react";
8
8
  import "react-dom";
9
- var F = { 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 = F;
11
- var v = function(a, l) {
12
- return /* @__PURE__ */ U.createElement(_, M({}, a, {
13
- ref: l,
14
- icon: Q
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 v = function(r, a) {
12
+ return /* @__PURE__ */ U.createElement(T, _({}, r, {
13
+ ref: a,
14
+ icon: F
15
15
  }));
16
16
  };
17
17
  process.env.NODE_ENV !== "production" && (v.displayName = "UsergroupAddOutlined");
18
- const D = /* @__PURE__ */ U.forwardRef(v), h = "/api/usystem/role/list", K = () => {
19
- const { message: d } = R.useApp(), { setPayload: a } = b(), l = V(), n = f(), o = async (c) => {
20
- await l.trigger({
21
- name: `role_${c.name}`,
22
- permissions: c.permissions
23
- }), a(h, { page: 1 }), d.success(n("RoleList.createSuccessfully"));
18
+ const Q = /* @__PURE__ */ U.forwardRef(v), h = "/api/usystem/role/list", K = () => {
19
+ const { message: c } = w.useApp(), { setPayload: r } = b(), a = V(), o = f(), n = async (l) => {
20
+ await a.trigger({
21
+ name: `role_${l.name}`,
22
+ permissions: l.permissions
23
+ }), r(h, { page: 1 }), c.success(o("RoleList.createSuccessfully"));
24
24
  };
25
25
  return A({
26
- title: n("RoleList.createTitle"),
26
+ title: o("RoleList.createTitle"),
27
27
  width: "50vw",
28
- content: (c) => /* @__PURE__ */ e.jsxs(m, { form: c, layout: "vertical", children: [
29
- /* @__PURE__ */ e.jsx(m.Item, { label: n("global.name"), name: "name", rules: [{ required: !0 }], children: /* @__PURE__ */ e.jsx(k, { addonBefore: "role_" }) }),
28
+ content: (l) => /* @__PURE__ */ e.jsxs(m, { form: l, layout: "vertical", children: [
29
+ /* @__PURE__ */ e.jsx(m.Item, { label: o("global.name"), name: "name", rules: [{ required: !0 }], children: /* @__PURE__ */ e.jsx(S, { addonBefore: "role_" }) }),
30
30
  /* @__PURE__ */ e.jsx(m.Item, { name: "permissions", children: /* @__PURE__ */ e.jsx(I, {}) })
31
31
  ] }),
32
- onConfirm: o
32
+ onConfirm: n
33
33
  });
34
34
  }, J = () => {
35
- const { message: d } = R.useApp(), { mutate: a } = b(), l = q(), n = f();
35
+ const { message: c } = w.useApp(), { mutate: r } = b(), a = q(), o = f();
36
36
  return A({
37
- title: n("RoleList.updateTitle"),
37
+ title: o("RoleList.updateTitle"),
38
38
  width: "50vw",
39
- content: (o) => /* @__PURE__ */ e.jsxs(m, { form: o, children: [
40
- /* @__PURE__ */ e.jsx(m.Item, { label: n("global.name"), name: "name", rules: [{ required: !0 }], children: /* @__PURE__ */ e.jsx(k, { readOnly: !0, addonBefore: "role_" }) }),
39
+ content: (n) => /* @__PURE__ */ e.jsxs(m, { form: n, children: [
40
+ /* @__PURE__ */ e.jsx(m.Item, { label: o("global.name"), name: "name", rules: [{ required: !0 }], children: /* @__PURE__ */ e.jsx(S, { readOnly: !0, addonBefore: "role_" }) }),
41
41
  /* @__PURE__ */ e.jsx(m.Item, { name: "permissions", children: /* @__PURE__ */ e.jsx(I, {}) })
42
42
  ] }),
43
- onConfirm: async (o, c, p) => {
44
- await l.trigger({
43
+ onConfirm: async (n, l, p) => {
44
+ await a.trigger({
45
45
  id: p.id,
46
- name: `role_${o.name}`,
47
- permissions: o.permissions
48
- }), a(
46
+ name: `role_${n.name}`,
47
+ permissions: n.permissions
48
+ }), r(
49
49
  h,
50
- (x) => S(x, (u) => {
51
- var s;
52
- const g = (s = u == null ? void 0 : u.list) == null ? void 0 : s.find((y) => y.id === p.id);
53
- g && (g.permissions = o.permissions);
50
+ (x) => k(x, (u) => {
51
+ var t;
52
+ const g = (t = u == null ? void 0 : u.list) == null ? void 0 : t.find((y) => y.id === p.id);
53
+ g && (g.permissions = n.permissions);
54
54
  }),
55
55
  { revalidate: !1 }
56
- ), d.success(n("RoleList.updateSuccessfully"));
56
+ ), c.success(o("RoleList.updateSuccessfully"));
57
57
  }
58
58
  });
59
59
  }, ie = () => {
60
- const { accessible: d } = N("200005", !0), { modal: a, message: l } = R.useApp(), { usePermissionApiV2: n } = T(), o = E(), { mutate: c } = b(), { show: p, contextHolder: x } = K(), { show: u, contextHolder: g } = J(), s = f(), y = [
60
+ const { accessible: c } = M("200005", !0), { modal: r, message: a } = w.useApp(), { usePermissionApiV2: o } = N(), n = E(), { mutate: l } = b(), { show: p, contextHolder: x } = K(), { show: u, contextHolder: g } = J(), t = f(), y = [
61
61
  {
62
- title: s("global.name"),
62
+ title: t("global.name"),
63
63
  key: "name",
64
- render(i) {
65
- return d ? /* @__PURE__ */ e.jsx(B, { to: `${i.name}`, children: i.name }) : /* @__PURE__ */ e.jsx(e.Fragment, { children: i.name });
64
+ render(s) {
65
+ return c ? /* @__PURE__ */ e.jsx(B, { to: `${s.name}`, children: s.name }) : /* @__PURE__ */ e.jsx(e.Fragment, { children: s.name });
66
66
  }
67
67
  },
68
68
  {
@@ -71,15 +71,15 @@ const D = /* @__PURE__ */ U.forwardRef(v), h = "/api/usystem/role/list", K = ()
71
71
  key: "id"
72
72
  },
73
73
  {
74
- title: s("global.creationTime"),
74
+ title: t("global.creationTime"),
75
75
  dataIndex: "ctime",
76
76
  key: "ctime"
77
77
  },
78
78
  {
79
- title: s("global.operation"),
79
+ title: t("global.operation"),
80
80
  width: 150,
81
81
  align: "center",
82
- render: (i) => /* @__PURE__ */ e.jsxs(H, { size: "small", children: [
82
+ render: (s) => /* @__PURE__ */ e.jsxs(H, { size: "small", children: [
83
83
  /* @__PURE__ */ e.jsx(
84
84
  j,
85
85
  {
@@ -88,21 +88,21 @@ const D = /* @__PURE__ */ U.forwardRef(v), h = "/api/usystem/role/list", K = ()
88
88
  size: "small",
89
89
  type: "link",
90
90
  onClick: async () => {
91
- const { data: t } = await z(
92
- `/api/usystem/role/info${n ? "V2" : ""}?name=${i.name}`,
91
+ const { data: i } = await z(
92
+ `/api/usystem/role/info${o ? "V2" : ""}?name=${s.name}`,
93
93
  { isGlobalNS: !0 }
94
94
  );
95
95
  u({
96
96
  initialValues: {
97
- permissions: t == null ? void 0 : t.permissions,
98
- name: t == null ? void 0 : t.name.replace(/^role_/, "")
97
+ permissions: i == null ? void 0 : i.permissions,
98
+ name: i == null ? void 0 : i.name.replace(/^role_/, "")
99
99
  },
100
100
  extraValues: {
101
- id: t == null ? void 0 : t.id
101
+ id: i == null ? void 0 : i.id
102
102
  }
103
103
  });
104
104
  },
105
- children: s("global.edit")
105
+ children: t("global.edit")
106
106
  }
107
107
  ),
108
108
  /* @__PURE__ */ e.jsx(
@@ -114,22 +114,22 @@ const D = /* @__PURE__ */ U.forwardRef(v), h = "/api/usystem/role/list", K = ()
114
114
  size: "small",
115
115
  type: "link",
116
116
  onClick: () => {
117
- a.confirm({
118
- title: s("RoleList.deleteTitle"),
119
- content: /* @__PURE__ */ e.jsx(P, { texts: [i.name], children: s("RoleList.deleteContent", { role: i.name }) }),
117
+ r.confirm({
118
+ title: t("RoleList.deleteTitle"),
119
+ content: /* @__PURE__ */ e.jsx(P, { texts: [s.name], children: t("RoleList.deleteContent", { role: s.name }) }),
120
120
  async onOk() {
121
- await o.trigger({
122
- id: i.id,
123
- name: i.name
124
- }), c(h, (t) => S(t, (r) => {
125
- var C, L;
126
- const w = (C = r == null ? void 0 : r.list) == null ? void 0 : C.findIndex((O) => O.id === i.id);
127
- w && ((L = r == null ? void 0 : r.list) == null || L.splice(w, 1));
128
- })), l.success(s("RoleList.deleteSuccessfully"));
121
+ await n.trigger({
122
+ id: s.id,
123
+ name: s.name
124
+ }), l(h, (i) => k(i, (d) => {
125
+ var R, L;
126
+ const C = (R = d == null ? void 0 : d.list) == null ? void 0 : R.findIndex((O) => O.id === s.id);
127
+ C && ((L = d == null ? void 0 : d.list) == null || L.splice(C, 1));
128
+ })), a.success(t("RoleList.deleteSuccessfully"));
129
129
  }
130
130
  });
131
131
  },
132
- children: s("global.delete")
132
+ children: t("global.delete")
133
133
  }
134
134
  )
135
135
  ] })
@@ -138,18 +138,18 @@ const D = /* @__PURE__ */ U.forwardRef(v), h = "/api/usystem/role/list", K = ()
138
138
  return /* @__PURE__ */ e.jsxs(
139
139
  G,
140
140
  {
141
- title: s("global.role"),
141
+ title: t("global.role"),
142
142
  extra: /* @__PURE__ */ e.jsx(
143
143
  j,
144
144
  {
145
145
  isGlobalNS: !0,
146
146
  type: "primary",
147
147
  code: "200002",
148
- icon: /* @__PURE__ */ e.jsx(D, {}),
148
+ icon: /* @__PURE__ */ e.jsx(Q, {}),
149
149
  onClick: () => {
150
150
  p();
151
151
  },
152
- children: s("RoleList.createTitle")
152
+ children: t("RoleList.createTitle")
153
153
  }
154
154
  ),
155
155
  children: [
@@ -161,10 +161,8 @@ const D = /* @__PURE__ */ U.forwardRef(v), h = "/api/usystem/role/list", K = ()
161
161
  columns: y,
162
162
  code: "200001",
163
163
  action: h,
164
- transformResponse: (i) => {
165
- const { List: t, Total: r } = i;
166
- return { list: t, total: r };
167
- }
164
+ getTotal: (s) => s.Total,
165
+ getDataSource: (s) => s.List
168
166
  }
169
167
  ),
170
168
  x,
@@ -1,4 +1,4 @@
1
- import { a as y, u as M, b as S, d as G, r as f, j as c, l as h } from "./index-jIaB0f6T.chunk.js";
1
+ import { a as y, u as M, b as S, d as G, r as f, j as c, l as h } from "./index-JEVes6q2.chunk.js";
2
2
  import { Typography as i, Space as g, Alert as z, Form as s, Input as _, Button as o, Divider as C } from "antd";
3
3
  import { useSearchParams as u, useLocation as m, Navigate as F } from "react-router-dom";
4
4
  import "react";
@@ -1,6 +1,6 @@
1
- import { u as S, j as e, b as $ } from "./index-jIaB0f6T.chunk.js";
1
+ import { u as S, j as e, b as $ } from "./index-JEVes6q2.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-sZjVIAIn.chunk.js";
3
+ import { d as R, e as B } from "./index-tzZwFuEm.chunk.js";
4
4
  import { useState as P, useCallback as F, useEffect as b } from "react";
5
5
  const q = (x) => {
6
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) => {
@@ -1,4 +1,4 @@
1
- import { u as o, j as t } from "./index-jIaB0f6T.chunk.js";
1
+ import { u as o, j as t } from "./index-JEVes6q2.chunk.js";
2
2
  import { Result as r, Button as i } from "antd";
3
3
  import { useNavigate as n } from "react-router-dom";
4
4
  import "react";