react-toolkits 0.4.4 → 0.5.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.
@@ -0,0 +1,187 @@
1
+ import { A as T, _ as N, f as b, u as U, j as e, P as g, H as R, Q as z, h as I } from "./index-gdaNSPz6.chunk.js";
2
+ import { App as f, Row as H, Col as E, Tag as L, Space as G, Card as Q, Form as d, Input as j, Select as y } from "antd";
3
+ import { p as S } from "./immer-BLf7GM7E.chunk.js";
4
+ import { Link as _ } from "react-router-dom";
5
+ import { f as $, g as q, h as k, i as B } from "./index-2yXDMFsB.chunk.js";
6
+ import * as v from "react";
7
+ import "react-dom";
8
+ var D = { 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 F = D;
10
+ var O = function(c, r) {
11
+ return /* @__PURE__ */ v.createElement(T, N({}, c, {
12
+ ref: r,
13
+ icon: F
14
+ }));
15
+ };
16
+ process.env.NODE_ENV !== "production" && (O.displayName = "UserAddOutlined");
17
+ const P = /* @__PURE__ */ v.forwardRef(O), { Option: V } = y, h = "/api/usystem/user/list";
18
+ function K() {
19
+ const { message: u } = f.useApp(), c = q(), { data: r, isLoading: m } = k(), { mutate: p } = b(), n = U();
20
+ return I({
21
+ title: n("UserList.createTitle"),
22
+ content: (l) => /* @__PURE__ */ e.jsxs(d, { form: l, labelCol: { flex: "80px" }, children: [
23
+ /* @__PURE__ */ e.jsx(d.Item, { label: n("global.name"), name: "name", rules: [{ required: !0 }], children: /* @__PURE__ */ e.jsx(j, {}) }),
24
+ /* @__PURE__ */ e.jsx(d.Item, { label: n("global.role"), name: "roles", children: /* @__PURE__ */ e.jsx(y, { allowClear: !0, mode: "multiple", loading: m, children: (r ?? []).map((i) => /* @__PURE__ */ e.jsx(V, { value: i.name, children: i.name }, i.id)) }) })
25
+ ] }),
26
+ async onConfirm(l) {
27
+ await c.trigger(l), p(h, { page: 1 }), u.success(n("UserList.createSuccessfully"));
28
+ }
29
+ });
30
+ }
31
+ function J() {
32
+ const { message: u } = f.useApp(), c = B(), { data: r, isLoading: m } = k(), { mutate: p } = b(), n = U();
33
+ return I({
34
+ title: n("UserList.updateTitle"),
35
+ content: (l) => /* @__PURE__ */ e.jsxs(d, { form: l, labelCol: { flex: "80px" }, children: [
36
+ /* @__PURE__ */ e.jsx(d.Item, { hidden: !0, name: "id", children: /* @__PURE__ */ e.jsx(j, {}) }),
37
+ /* @__PURE__ */ e.jsx(d.Item, { label: n("global.name"), name: "name", rules: [{ required: !0 }], children: /* @__PURE__ */ e.jsx(j, { readOnly: !0 }) }),
38
+ /* @__PURE__ */ e.jsx(d.Item, { label: n("global.role"), name: "roles", children: /* @__PURE__ */ e.jsx(
39
+ y,
40
+ {
41
+ allowClear: !0,
42
+ mode: "multiple",
43
+ loading: m,
44
+ options: r == null ? void 0 : r.map((i) => ({
45
+ label: i.name,
46
+ value: i.name
47
+ })),
48
+ dropdownStyle: { zIndex: 9999 }
49
+ }
50
+ ) })
51
+ ] }),
52
+ async onConfirm(l) {
53
+ await c.trigger(l), p(
54
+ h,
55
+ void 0,
56
+ (i) => S(i, (s) => {
57
+ var t;
58
+ const x = (t = s == null ? void 0 : s.list) == null ? void 0 : t.find((o) => o.id === l.id);
59
+ x && (x.roles = l.roles);
60
+ }),
61
+ { revalidate: !1 }
62
+ ), u.success(n("UserList.updateSuccessfully"));
63
+ }
64
+ });
65
+ }
66
+ const te = () => {
67
+ const { modal: u, message: c } = f.useApp(), r = $(), { mutate: m } = b(), { show: p, contextHolder: n } = K(), { show: l, contextHolder: i } = J(), s = U(), x = [
68
+ {
69
+ title: s("global.name"),
70
+ dataIndex: "name",
71
+ key: "name"
72
+ },
73
+ {
74
+ title: "ID",
75
+ dataIndex: "id",
76
+ key: "id"
77
+ },
78
+ {
79
+ title: s("global.role"),
80
+ dataIndex: "roles",
81
+ key: "roles",
82
+ width: "40%",
83
+ render(t) {
84
+ return /* @__PURE__ */ e.jsx(H, { gutter: [4, 4], children: (t || []).map((o) => /* @__PURE__ */ e.jsx(E, { children: o === "root" ? /* @__PURE__ */ e.jsx(L, { color: "#f50", children: o }) : /* @__PURE__ */ e.jsx(L, { color: "#ff5a00", children: /* @__PURE__ */ e.jsx(_, { to: `/permission/role/${o}`, children: o }) }) }, o)) });
85
+ }
86
+ },
87
+ {
88
+ title: s("global.creationTime"),
89
+ dataIndex: "Ctime",
90
+ key: "ctime"
91
+ },
92
+ {
93
+ title: s("global.operation"),
94
+ width: 150,
95
+ align: "center",
96
+ render: (t) => /* @__PURE__ */ e.jsxs(G, { children: [
97
+ /* @__PURE__ */ e.jsx(
98
+ g,
99
+ {
100
+ isGlobalNS: !0,
101
+ size: "small",
102
+ type: "link",
103
+ code: "100003",
104
+ onClick: () => {
105
+ l({
106
+ initialValues: {
107
+ id: t.id,
108
+ name: t.name,
109
+ roles: t.roles
110
+ }
111
+ });
112
+ },
113
+ children: s("global.update")
114
+ }
115
+ ),
116
+ /* @__PURE__ */ e.jsx(
117
+ g,
118
+ {
119
+ isGlobalNS: !0,
120
+ danger: !0,
121
+ size: "small",
122
+ code: "100004",
123
+ type: "link",
124
+ onClick: () => {
125
+ u.confirm({
126
+ title: s("UserList.deleteTitle"),
127
+ content: /* @__PURE__ */ e.jsx(R, { texts: [t.name], children: s("UserList.deleteContent", { user: t.name }) }),
128
+ async onOk() {
129
+ await r.trigger({
130
+ id: t.id,
131
+ name: t.name
132
+ }), m(h, void 0, (o) => S(o, (a) => {
133
+ var w, A;
134
+ const C = (w = a == null ? void 0 : a.list) == null ? void 0 : w.findIndex((M) => M.id === t.id);
135
+ C && ((A = a == null ? void 0 : a.list) == null || A.splice(C, 1));
136
+ })), c.success(s("UserList.deleteSuccessfully"));
137
+ }
138
+ });
139
+ },
140
+ children: s("global.delete")
141
+ }
142
+ )
143
+ ] })
144
+ }
145
+ ];
146
+ return /* @__PURE__ */ e.jsxs(
147
+ Q,
148
+ {
149
+ title: s("global.user"),
150
+ extra: /* @__PURE__ */ e.jsx(
151
+ g,
152
+ {
153
+ isGlobalNS: !0,
154
+ type: "primary",
155
+ icon: /* @__PURE__ */ e.jsx(P, {}),
156
+ code: "100002",
157
+ onClick: () => {
158
+ p();
159
+ },
160
+ children: s("UserList.createTitle")
161
+ }
162
+ ),
163
+ children: [
164
+ /* @__PURE__ */ e.jsx(
165
+ z,
166
+ {
167
+ isGlobalNS: !0,
168
+ code: "100001",
169
+ url: h,
170
+ rowKey: "id",
171
+ columns: x,
172
+ transformResponse: (t) => {
173
+ const { List: o, Total: a } = t;
174
+ return { list: o, total: a };
175
+ }
176
+ }
177
+ ),
178
+ n,
179
+ i
180
+ ]
181
+ }
182
+ );
183
+ };
184
+ export {
185
+ te as default,
186
+ h as url
187
+ };