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.
- package/CHANGELOG.md +12 -0
- package/README.md +2 -2
- package/lib/immer-BLf7GM7E.chunk.js +459 -0
- package/lib/index-2yXDMFsB.chunk.js +212 -0
- package/lib/index-46YNBewp.chunk.js +170 -0
- package/lib/index-GnoTyQLT.chunk.js +1448 -0
- package/lib/index-MckNf-V8.chunk.js +179 -0
- package/lib/index-SypqQFGs.chunk.js +380 -0
- package/lib/index-ZZXzToVD.chunk.js +29 -0
- package/lib/index-dETo--R9.chunk.js +39 -0
- package/lib/index-eh8cxTQW.chunk.js +187 -0
- package/lib/index-gdaNSPz6.chunk.js +15895 -0
- package/lib/{index.d.mts → index.d.ts} +407 -360
- package/lib/index.js +35 -27
- package/lib/style.css +1 -0
- package/locales/{index-Xn8Uwe6G.d.mts → en_GB.d.ts} +90 -87
- package/locales/en_GB.js +88 -5
- package/locales/ja_JP.d.ts +90 -0
- package/locales/ja_JP.js +88 -5
- package/locales/ko_KR.d.ts +90 -0
- package/locales/ko_KR.js +88 -5
- package/locales/zh_CN.d.ts +90 -0
- package/locales/zh_CN.js +88 -5
- package/package.json +25 -20
- package/lib/index.css +0 -2
- package/lib/index.css.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/logo-L6MFCL6M.png +0 -0
- package/locales/en_GB.d.mts +0 -5
- package/locales/en_GB.js.map +0 -1
- package/locales/ja_JP.d.mts +0 -5
- package/locales/ja_JP.js.map +0 -1
- package/locales/ko_KR.d.mts +0 -5
- package/locales/ko_KR.js.map +0 -1
- package/locales/zh_CN.d.mts +0 -5
- package/locales/zh_CN.js.map +0 -1
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { u as S, j as e, b as $ } from "./index-gdaNSPz6.chunk.js";
|
|
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-2yXDMFsB.chunk.js";
|
|
4
|
+
import { useState as P, useCallback as F, useEffect as b } from "react";
|
|
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) => {
|
|
7
|
+
p(s);
|
|
8
|
+
}, []), L = (s, i) => {
|
|
9
|
+
let n = [];
|
|
10
|
+
return s ? n = [...new Set(c.concat(i))] : (n = c.slice(), i.forEach((o) => {
|
|
11
|
+
const j = n.findIndex((y) => y === o);
|
|
12
|
+
j > -1 && n.splice(j, 1);
|
|
13
|
+
})), n;
|
|
14
|
+
}, v = (s, i) => {
|
|
15
|
+
const n = L(s.target.checked, i);
|
|
16
|
+
f(n), a == null || a(n);
|
|
17
|
+
};
|
|
18
|
+
return b(() => {
|
|
19
|
+
f(r ?? []);
|
|
20
|
+
}, [r]), b(() => {
|
|
21
|
+
d && p((l ?? []).map(({ category: s }) => s));
|
|
22
|
+
}, [d, l]), b(() => {
|
|
23
|
+
const s = (l ?? []).reduce(
|
|
24
|
+
(i, n) => (i[n.category] = n.permissions.every((o) => c == null ? void 0 : c.includes(o.value)), i),
|
|
25
|
+
{}
|
|
26
|
+
);
|
|
27
|
+
u(s);
|
|
28
|
+
}, [c, l]), /* @__PURE__ */ e.jsx(
|
|
29
|
+
D,
|
|
30
|
+
{
|
|
31
|
+
style: { width: "100%" },
|
|
32
|
+
collapsible: "header",
|
|
33
|
+
activeKey: m,
|
|
34
|
+
items: (l ?? []).map((s) => ({
|
|
35
|
+
key: s.category,
|
|
36
|
+
label: s.category,
|
|
37
|
+
extra: !t && /* @__PURE__ */ e.jsx(
|
|
38
|
+
k,
|
|
39
|
+
{
|
|
40
|
+
checked: g[s.category],
|
|
41
|
+
onChange: (i) => {
|
|
42
|
+
v(
|
|
43
|
+
i,
|
|
44
|
+
s.permissions.map((n) => n.value)
|
|
45
|
+
);
|
|
46
|
+
},
|
|
47
|
+
children: C("global.selectAll")
|
|
48
|
+
}
|
|
49
|
+
),
|
|
50
|
+
children: /* @__PURE__ */ e.jsx(k.Group, { style: { width: "100%" }, value: c, disabled: t, children: /* @__PURE__ */ e.jsx(G, { gutter: [10, 10], style: { width: "100%" }, children: s.permissions.map((i) => /* @__PURE__ */ e.jsx(_, { span: 6, children: /* @__PURE__ */ e.jsx(
|
|
51
|
+
k,
|
|
52
|
+
{
|
|
53
|
+
value: i.value,
|
|
54
|
+
onChange: (n) => {
|
|
55
|
+
v(n, [i.value]);
|
|
56
|
+
},
|
|
57
|
+
children: i.label
|
|
58
|
+
}
|
|
59
|
+
) }, i.value)) }) })
|
|
60
|
+
})),
|
|
61
|
+
onChange: h
|
|
62
|
+
}
|
|
63
|
+
);
|
|
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();
|
|
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
|
+
V,
|
|
68
|
+
{
|
|
69
|
+
value: t,
|
|
70
|
+
permissions: a,
|
|
71
|
+
readonly: d,
|
|
72
|
+
expand: l,
|
|
73
|
+
onChange: r
|
|
74
|
+
}
|
|
75
|
+
) });
|
|
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();
|
|
78
|
+
if (b(() => {
|
|
79
|
+
const s = [];
|
|
80
|
+
Object.keys(t ?? {}).forEach((i) => {
|
|
81
|
+
i !== "global" && s.push({ gameId: i, permissions: (t == null ? void 0 : t[i]) ?? [] });
|
|
82
|
+
}), c(s);
|
|
83
|
+
}, [t]), g)
|
|
84
|
+
return /* @__PURE__ */ e.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ e.jsx(I, { type: "danger", children: h("PermissionList.failedDescription") }) });
|
|
85
|
+
const L = () => {
|
|
86
|
+
c((s) => [...s, { gameId: "", permissions: [] }]);
|
|
87
|
+
}, v = (s) => {
|
|
88
|
+
c((i) => i.filter((n, o) => o !== s));
|
|
89
|
+
};
|
|
90
|
+
return /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col w-full", children: [
|
|
91
|
+
/* @__PURE__ */ e.jsx("div", { className: "mb-12", children: /* @__PURE__ */ e.jsx(w, { dashed: !0, children: h("PermissionList.baseSectionTitle") }) }),
|
|
92
|
+
/* @__PURE__ */ e.jsx(T, { active: !0, loading: p, children: /* @__PURE__ */ e.jsx(
|
|
93
|
+
V,
|
|
94
|
+
{
|
|
95
|
+
value: t == null ? void 0 : t.global,
|
|
96
|
+
readonly: d,
|
|
97
|
+
permissions: f,
|
|
98
|
+
expand: l,
|
|
99
|
+
onChange: (s) => {
|
|
100
|
+
r == null || r({
|
|
101
|
+
...t,
|
|
102
|
+
global: s
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
) }),
|
|
107
|
+
/* @__PURE__ */ e.jsx("div", { className: "my-12", children: /* @__PURE__ */ e.jsx(w, { dashed: !0, children: h("PermissionList.gameSectionTitle") }) }),
|
|
108
|
+
u.map((s, i) => {
|
|
109
|
+
var n;
|
|
110
|
+
return /* @__PURE__ */ e.jsx(
|
|
111
|
+
K,
|
|
112
|
+
{
|
|
113
|
+
title: /* @__PURE__ */ e.jsxs(M, { children: [
|
|
114
|
+
/* @__PURE__ */ e.jsx(I, { children: h("global.game") }),
|
|
115
|
+
d ? /* @__PURE__ */ e.jsx(I, { children: (n = m == null ? void 0 : m.find((o) => o.id === s.gameId)) == null ? void 0 : n.name }) : /* @__PURE__ */ e.jsx(
|
|
116
|
+
E,
|
|
117
|
+
{
|
|
118
|
+
disabled: d,
|
|
119
|
+
value: u[i].gameId || void 0,
|
|
120
|
+
style: { width: "160px" },
|
|
121
|
+
placeholder: h("PermissionList.gameSelectPlaceholder"),
|
|
122
|
+
onChange: (o) => {
|
|
123
|
+
c((j) => {
|
|
124
|
+
const y = j.slice();
|
|
125
|
+
return y[i].gameId = o, y;
|
|
126
|
+
});
|
|
127
|
+
},
|
|
128
|
+
children: m == null ? void 0 : m.map((o) => /* @__PURE__ */ e.jsx(Q, { value: o.id, disabled: u.some(({ gameId: j }) => j === o.id), children: o.name }, o.id))
|
|
129
|
+
}
|
|
130
|
+
)
|
|
131
|
+
] }),
|
|
132
|
+
className: "mb-6",
|
|
133
|
+
extra: !d && /* @__PURE__ */ e.jsx(
|
|
134
|
+
N,
|
|
135
|
+
{
|
|
136
|
+
type: "link",
|
|
137
|
+
onClick: () => {
|
|
138
|
+
v(i);
|
|
139
|
+
},
|
|
140
|
+
children: h("PermissionList.removeText")
|
|
141
|
+
}
|
|
142
|
+
),
|
|
143
|
+
children: u[i].gameId ? /* @__PURE__ */ e.jsx(T, { active: !0, loading: p, children: /* @__PURE__ */ e.jsx(
|
|
144
|
+
V,
|
|
145
|
+
{
|
|
146
|
+
value: t == null ? void 0 : t[u[i].gameId],
|
|
147
|
+
readonly: d,
|
|
148
|
+
expand: l,
|
|
149
|
+
permissions: C,
|
|
150
|
+
onChange: (o) => {
|
|
151
|
+
r == null || r({
|
|
152
|
+
...t,
|
|
153
|
+
[u[i].gameId]: o
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
) }) : /* @__PURE__ */ e.jsx(O, { description: h("PermissionList.gameSectionDescription") })
|
|
158
|
+
},
|
|
159
|
+
i
|
|
160
|
+
);
|
|
161
|
+
}),
|
|
162
|
+
!d && /* @__PURE__ */ e.jsx(N, { block: !0, type: "dashed", onClick: L, children: h("PermissionList.addText") })
|
|
163
|
+
] });
|
|
164
|
+
}, W = U, X = (x) => {
|
|
165
|
+
const { value: l } = x, { usePermissionApiV2: t } = $();
|
|
166
|
+
return /* @__PURE__ */ e.jsx(e.Fragment, { children: t ? /* @__PURE__ */ e.jsx(W, { ...x, value: l }) : /* @__PURE__ */ e.jsx(J, { ...x, value: l }) });
|
|
167
|
+
}, ie = X;
|
|
168
|
+
export {
|
|
169
|
+
ie as P
|
|
170
|
+
};
|