@blocklet/labels 1.5.12 → 1.5.14
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/dist/index.es.js +420 -379
- package/dist/index.umd.js +3 -3
- package/package.json +2 -2
package/dist/index.es.js
CHANGED
|
@@ -1,24 +1,23 @@
|
|
|
1
|
-
import { createContext as V, useRef as
|
|
2
|
-
import
|
|
1
|
+
import { createContext as V, useRef as j, useState as I, useCallback as T, useEffect as D, useMemo as z, useContext as q } from "react";
|
|
2
|
+
import F from "@mui/icons-material/ExpandMore";
|
|
3
3
|
import p from "@mui/material/Box";
|
|
4
|
-
import { styled as
|
|
4
|
+
import { styled as H } from "@mui/material/styles";
|
|
5
5
|
import { Tree as U } from "react-arborist";
|
|
6
6
|
import { Icon as X } from "@iconify/react";
|
|
7
|
-
import { jsx as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
7
|
+
import { jsx as n, jsxs as C, Fragment as P } from "react/jsx-runtime";
|
|
8
|
+
import ee from "lodash/omit";
|
|
9
|
+
import te, { components as J } from "react-select";
|
|
10
|
+
import ne from "@mui/material/Typography";
|
|
11
|
+
import O from "@mui/material/Button";
|
|
12
12
|
import N from "@mui/material/IconButton";
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import le from "react-use/lib/useSetState";
|
|
13
|
+
import re from "@mui/icons-material/DeleteOutlineOutlined";
|
|
14
|
+
import oe from "@mui/icons-material/EditOutlined";
|
|
15
|
+
import le from "@mui/icons-material/Add";
|
|
17
16
|
import M from "@mui/material/TextField";
|
|
18
17
|
import ie from "@mui/base/ClickAwayListener";
|
|
19
18
|
import { GithubPicker as se } from "react-color";
|
|
20
|
-
import
|
|
21
|
-
import { TextField as R, InputAdornment as ae, IconButton as ce, Box as
|
|
19
|
+
import _ from "@arcblock/ux/lib/Dialog";
|
|
20
|
+
import { TextField as R, InputAdornment as ae, IconButton as ce, Box as B } from "@mui/material";
|
|
22
21
|
import de from "@mui/icons-material/Translate";
|
|
23
22
|
import ue from "@mui/material/Popover";
|
|
24
23
|
import { useLocaleContext as $ } from "@arcblock/ux/lib/Locale/context";
|
|
@@ -27,110 +26,110 @@ import pe from "@mui/icons-material/Edit";
|
|
|
27
26
|
import me from "@mui/icons-material/LabelOutlined";
|
|
28
27
|
import fe from "@mui/material/ClickAwayListener";
|
|
29
28
|
import ge from "@mui/material/Chip";
|
|
30
|
-
const xe = (
|
|
29
|
+
const xe = (e) => /* @__PURE__ */ n("svg", {
|
|
31
30
|
viewBox: "0 0 24 24",
|
|
32
31
|
width: "1.2em",
|
|
33
32
|
height: "1.2em",
|
|
34
|
-
...
|
|
35
|
-
children: /* @__PURE__ */
|
|
33
|
+
...e,
|
|
34
|
+
children: /* @__PURE__ */ n("path", {
|
|
36
35
|
fill: "currentColor",
|
|
37
36
|
d: "M5 19q-.825 0-1.413-.587Q3 17.825 3 17V7q0-.825.587-1.412Q4.175 5 5 5h10q.5 0 .938.225q.437.225.712.625l3.525 5q.375.525.375 1.15q0 .625-.375 1.15l-3.525 5q-.275.4-.712.625Q15.5 19 15 19Z"
|
|
38
37
|
})
|
|
39
|
-
}), ye = (
|
|
38
|
+
}), ye = (e) => /* @__PURE__ */ n("svg", {
|
|
40
39
|
viewBox: "0 0 24 24",
|
|
41
40
|
width: "1.2em",
|
|
42
41
|
height: "1.2em",
|
|
43
|
-
...
|
|
44
|
-
children: /* @__PURE__ */
|
|
42
|
+
...e,
|
|
43
|
+
children: /* @__PURE__ */ n("path", {
|
|
45
44
|
fill: "currentColor",
|
|
46
45
|
d: "m10 16.4l-4-4L7.4 11l2.6 2.6L16.6 7L18 8.4Z"
|
|
47
46
|
})
|
|
48
47
|
}), K = V({});
|
|
49
48
|
function Ce({
|
|
50
|
-
selectable:
|
|
51
|
-
selected:
|
|
52
|
-
onSelect:
|
|
53
|
-
renderItem:
|
|
54
|
-
children:
|
|
49
|
+
selectable: e = !1,
|
|
50
|
+
selected: t = [],
|
|
51
|
+
onSelect: s,
|
|
52
|
+
renderItem: o,
|
|
53
|
+
children: l
|
|
55
54
|
}) {
|
|
56
|
-
const r = (h) =>
|
|
57
|
-
Array.from(new Set(
|
|
58
|
-
},
|
|
55
|
+
const r = (h) => t.indexOf(h) !== -1, i = (h) => {
|
|
56
|
+
Array.from(new Set(t).add(h)), s == null || s(h);
|
|
57
|
+
}, a = z(
|
|
59
58
|
() => ({
|
|
60
|
-
selectable:
|
|
61
|
-
selected:
|
|
59
|
+
selectable: e,
|
|
60
|
+
selected: t,
|
|
62
61
|
isSelected: r,
|
|
63
62
|
select: i,
|
|
64
|
-
renderItem:
|
|
63
|
+
renderItem: o
|
|
65
64
|
}),
|
|
66
|
-
[
|
|
65
|
+
[t]
|
|
67
66
|
);
|
|
68
|
-
return /* @__PURE__ */
|
|
69
|
-
value:
|
|
70
|
-
children:
|
|
67
|
+
return /* @__PURE__ */ n(K.Provider, {
|
|
68
|
+
value: a,
|
|
69
|
+
children: l
|
|
71
70
|
});
|
|
72
71
|
}
|
|
73
|
-
const ve = (
|
|
74
|
-
var
|
|
75
|
-
return
|
|
72
|
+
const ve = (e) => {
|
|
73
|
+
var t;
|
|
74
|
+
return e.isLeaf || !((t = e.data.children) != null && t.length);
|
|
76
75
|
};
|
|
77
76
|
function be({
|
|
78
|
-
node:
|
|
77
|
+
node: e
|
|
79
78
|
}) {
|
|
80
|
-
return ve(
|
|
79
|
+
return ve(e) ? /* @__PURE__ */ n("span", {}) : e.isOpen ? /* @__PURE__ */ n(F, {
|
|
81
80
|
style: {
|
|
82
81
|
fontSize: 20
|
|
83
82
|
}
|
|
84
|
-
}) : /* @__PURE__ */
|
|
83
|
+
}) : /* @__PURE__ */ n(F, {
|
|
85
84
|
style: {
|
|
86
85
|
fontSize: 20,
|
|
87
86
|
transform: "rotate(-90deg)"
|
|
88
87
|
}
|
|
89
88
|
});
|
|
90
89
|
}
|
|
91
|
-
function
|
|
92
|
-
node:
|
|
93
|
-
style:
|
|
94
|
-
dragHandle:
|
|
90
|
+
function Se({
|
|
91
|
+
node: e,
|
|
92
|
+
style: t,
|
|
93
|
+
dragHandle: s
|
|
95
94
|
}) {
|
|
96
95
|
const {
|
|
97
|
-
selectable:
|
|
98
|
-
select:
|
|
96
|
+
selectable: o,
|
|
97
|
+
select: l,
|
|
99
98
|
isSelected: r,
|
|
100
99
|
renderItem: i
|
|
101
100
|
} = q(K), {
|
|
102
|
-
data:
|
|
103
|
-
} =
|
|
104
|
-
icon:
|
|
101
|
+
data: a
|
|
102
|
+
} = e, h = a.icon ? /* @__PURE__ */ n(X, {
|
|
103
|
+
icon: a.icon,
|
|
105
104
|
style: {
|
|
106
105
|
fontSize: 18
|
|
107
106
|
}
|
|
108
|
-
}) : /* @__PURE__ */
|
|
107
|
+
}) : /* @__PURE__ */ n(xe, {
|
|
109
108
|
style: {
|
|
110
109
|
fontSize: 18,
|
|
111
|
-
color:
|
|
110
|
+
color: a.color || "#ddd"
|
|
112
111
|
}
|
|
113
|
-
}), g = (
|
|
114
|
-
|
|
115
|
-
}, f = (
|
|
116
|
-
|
|
117
|
-
}, x = /* @__PURE__ */ C(
|
|
112
|
+
}), g = (c) => {
|
|
113
|
+
c.stopPropagation(), e.isInternal && e.toggle();
|
|
114
|
+
}, f = (c) => {
|
|
115
|
+
c.stopPropagation(), o && l(e.id);
|
|
116
|
+
}, x = /* @__PURE__ */ C(P, {
|
|
118
117
|
children: [/* @__PURE__ */ C(p, {
|
|
119
118
|
sx: {
|
|
120
119
|
display: "flex",
|
|
121
120
|
alignItems: "center",
|
|
122
121
|
flex: 1
|
|
123
122
|
},
|
|
124
|
-
children: [/* @__PURE__ */
|
|
123
|
+
children: [/* @__PURE__ */ n(p, {
|
|
125
124
|
sx: {
|
|
126
125
|
display: "flex",
|
|
127
126
|
cursor: "pointer"
|
|
128
127
|
},
|
|
129
128
|
onClick: g,
|
|
130
|
-
children: /* @__PURE__ */
|
|
131
|
-
node:
|
|
129
|
+
children: /* @__PURE__ */ n(be, {
|
|
130
|
+
node: e
|
|
132
131
|
})
|
|
133
|
-
}), /* @__PURE__ */
|
|
132
|
+
}), /* @__PURE__ */ n(p, {
|
|
134
133
|
sx: {
|
|
135
134
|
display: "flex",
|
|
136
135
|
alignItems: "center",
|
|
@@ -138,29 +137,29 @@ function Ie({
|
|
|
138
137
|
height: 22
|
|
139
138
|
},
|
|
140
139
|
children: h
|
|
141
|
-
}), /* @__PURE__ */
|
|
140
|
+
}), /* @__PURE__ */ n(p, {
|
|
142
141
|
component: "span",
|
|
143
142
|
sx: {
|
|
144
143
|
color: "grey.700"
|
|
145
144
|
},
|
|
146
|
-
children:
|
|
145
|
+
children: e.data.name
|
|
147
146
|
})]
|
|
148
|
-
}),
|
|
147
|
+
}), o && r(e.id) && /* @__PURE__ */ n(ye, {})]
|
|
149
148
|
});
|
|
150
149
|
return /* @__PURE__ */ C(p, {
|
|
151
150
|
className: "label-tree-item",
|
|
152
|
-
style:
|
|
151
|
+
style: t,
|
|
153
152
|
sx: {
|
|
154
153
|
display: "flex",
|
|
155
154
|
alignItems: "center",
|
|
156
155
|
justifyContent: "space-between"
|
|
157
156
|
},
|
|
158
|
-
ref:
|
|
157
|
+
ref: s,
|
|
159
158
|
onClick: f,
|
|
160
|
-
children: [!i && x, !!i && i(x,
|
|
159
|
+
children: [!i && x, !!i && i(x, e.data)]
|
|
161
160
|
});
|
|
162
161
|
}
|
|
163
|
-
const we =
|
|
162
|
+
const we = H(p)`
|
|
164
163
|
> div,
|
|
165
164
|
> div > div,
|
|
166
165
|
> div > div > div {
|
|
@@ -175,107 +174,107 @@ const we = F(p)`
|
|
|
175
174
|
}
|
|
176
175
|
`;
|
|
177
176
|
function W({
|
|
178
|
-
data:
|
|
179
|
-
selectable:
|
|
180
|
-
selected:
|
|
181
|
-
onSelect:
|
|
182
|
-
rowHeight:
|
|
177
|
+
data: e,
|
|
178
|
+
selectable: t,
|
|
179
|
+
selected: s = [],
|
|
180
|
+
onSelect: o,
|
|
181
|
+
rowHeight: l = 28,
|
|
183
182
|
renderItem: r,
|
|
184
183
|
sx: i,
|
|
185
|
-
...
|
|
184
|
+
...a
|
|
186
185
|
}) {
|
|
187
|
-
const h =
|
|
188
|
-
var b,
|
|
189
|
-
x((((
|
|
190
|
-
}, [
|
|
191
|
-
return
|
|
192
|
-
|
|
193
|
-
}, [
|
|
194
|
-
selectable:
|
|
195
|
-
selected:
|
|
196
|
-
onSelect:
|
|
186
|
+
const h = j(), g = [...Array.isArray(i) ? i : [i]], [f, x] = I(0), c = T(() => {
|
|
187
|
+
var b, d;
|
|
188
|
+
x((((d = (b = h.current) == null ? void 0 : b.visibleNodes) == null ? void 0 : d.length) || 0) * l);
|
|
189
|
+
}, [l]);
|
|
190
|
+
return D(() => {
|
|
191
|
+
c();
|
|
192
|
+
}, [e, c]), /* @__PURE__ */ n(Ce, {
|
|
193
|
+
selectable: t,
|
|
194
|
+
selected: s,
|
|
195
|
+
onSelect: o,
|
|
197
196
|
renderItem: r,
|
|
198
|
-
children: /* @__PURE__ */
|
|
199
|
-
...
|
|
197
|
+
children: /* @__PURE__ */ n(we, {
|
|
198
|
+
...a,
|
|
200
199
|
sx: g,
|
|
201
|
-
children: /* @__PURE__ */
|
|
202
|
-
data:
|
|
203
|
-
rowHeight:
|
|
200
|
+
children: /* @__PURE__ */ n(U, {
|
|
201
|
+
data: e,
|
|
202
|
+
rowHeight: l,
|
|
204
203
|
height: f,
|
|
205
204
|
indent: 32,
|
|
206
205
|
ref: h,
|
|
207
206
|
onToggle: () => {
|
|
208
|
-
setTimeout(
|
|
207
|
+
setTimeout(c);
|
|
209
208
|
},
|
|
210
|
-
children:
|
|
209
|
+
children: Se
|
|
211
210
|
})
|
|
212
211
|
})
|
|
213
212
|
});
|
|
214
213
|
}
|
|
215
|
-
const L = (
|
|
216
|
-
var
|
|
217
|
-
return
|
|
218
|
-
}, []), Q = (
|
|
219
|
-
var
|
|
220
|
-
return (
|
|
221
|
-
}),
|
|
214
|
+
const L = (e) => e.reduce((t, s) => {
|
|
215
|
+
var o;
|
|
216
|
+
return t.push(s), (o = s.children) != null && o.length && t.push(...L(s.children)), t;
|
|
217
|
+
}, []), Q = (e) => e.map((t) => {
|
|
218
|
+
var s;
|
|
219
|
+
return (s = t.children) != null && s.length && (t.children = Q(t.children)), t;
|
|
220
|
+
}), Ie = (e, t = null) => {
|
|
222
221
|
try {
|
|
223
|
-
return JSON.parse(
|
|
222
|
+
return JSON.parse(e);
|
|
224
223
|
} catch {
|
|
225
|
-
return
|
|
224
|
+
return t;
|
|
226
225
|
}
|
|
227
|
-
}, ze = (
|
|
228
|
-
const
|
|
226
|
+
}, ze = (e) => {
|
|
227
|
+
const t = e.reduce((l, r) => (l[r.id] = l[r.id] || {}, r.parentId && (l[r.id].parent = r.parentId, l[r.parentId] = l[r.parentId] || {}, l[r.parentId].children = l[r.parentId].children || [], l[r.parentId].children.push(r.id)), l), {}), s = e.map(({ parentId: l, translation: r, ...i }) => ({
|
|
229
228
|
...i,
|
|
230
|
-
translation:
|
|
229
|
+
translation: Ie(r),
|
|
231
230
|
children: []
|
|
232
|
-
})),
|
|
233
|
-
return
|
|
234
|
-
const r =
|
|
235
|
-
r.parent &&
|
|
236
|
-
}),
|
|
237
|
-
}, ke = (
|
|
231
|
+
})), o = s.reduce((l, r) => ({ ...l, [r.id]: r }), {});
|
|
232
|
+
return s.forEach((l) => {
|
|
233
|
+
const r = t[l.id];
|
|
234
|
+
r.parent && o[r.parent] && (l.parent = o[r.parent]), r.children && (l.children = r.children.map((i) => o[i]));
|
|
235
|
+
}), s.filter((l) => !l.parent);
|
|
236
|
+
}, ke = (e) => {
|
|
238
237
|
const {
|
|
239
|
-
options:
|
|
240
|
-
getValue:
|
|
241
|
-
selectProps:
|
|
242
|
-
selectOption:
|
|
243
|
-
} =
|
|
244
|
-
const h =
|
|
245
|
-
h &&
|
|
238
|
+
options: t,
|
|
239
|
+
getValue: s,
|
|
240
|
+
selectProps: o,
|
|
241
|
+
selectOption: l
|
|
242
|
+
} = e, r = s(), i = (a) => {
|
|
243
|
+
const h = t.find((g) => g.data.id === a);
|
|
244
|
+
h && l(h);
|
|
246
245
|
};
|
|
247
|
-
return /* @__PURE__ */ C(
|
|
248
|
-
children: [/* @__PURE__ */
|
|
249
|
-
...
|
|
250
|
-
children: /* @__PURE__ */
|
|
246
|
+
return /* @__PURE__ */ C(P, {
|
|
247
|
+
children: [/* @__PURE__ */ n(J.MenuList, {
|
|
248
|
+
...ee(e, ["addon"]),
|
|
249
|
+
children: /* @__PURE__ */ n(p, {
|
|
251
250
|
sx: {
|
|
252
251
|
px: 2,
|
|
253
252
|
py: 1
|
|
254
253
|
},
|
|
255
|
-
children: /* @__PURE__ */
|
|
256
|
-
data:
|
|
254
|
+
children: /* @__PURE__ */ n(W, {
|
|
255
|
+
data: o.data,
|
|
257
256
|
selectable: !0,
|
|
258
257
|
onSelect: i,
|
|
259
|
-
selected: r.map((
|
|
258
|
+
selected: r.map((a) => a.data.id)
|
|
260
259
|
})
|
|
261
260
|
})
|
|
262
|
-
}),
|
|
261
|
+
}), e.addon]
|
|
263
262
|
});
|
|
264
263
|
}, Te = ({
|
|
265
|
-
children:
|
|
266
|
-
...
|
|
264
|
+
children: e,
|
|
265
|
+
...t
|
|
267
266
|
}) => {
|
|
268
|
-
const [
|
|
269
|
-
return /* @__PURE__ */ C(
|
|
270
|
-
...
|
|
271
|
-
children: [/* @__PURE__ */
|
|
267
|
+
const [s, o] = e, l = Array.isArray(s) ? s.length : 0;
|
|
268
|
+
return /* @__PURE__ */ C(J.ValueContainer, {
|
|
269
|
+
...t,
|
|
270
|
+
children: [/* @__PURE__ */ n(p, {
|
|
272
271
|
component: "span",
|
|
273
272
|
sx: {
|
|
274
273
|
fontSize: 13,
|
|
275
274
|
fontWeight: "bold"
|
|
276
275
|
},
|
|
277
|
-
children:
|
|
278
|
-
}), !!
|
|
276
|
+
children: l ? "Labels" : "Filter by labels"
|
|
277
|
+
}), !!l && /* @__PURE__ */ n(p, {
|
|
279
278
|
sx: {
|
|
280
279
|
display: "inline-flex",
|
|
281
280
|
justifyContent: "center",
|
|
@@ -287,64 +286,64 @@ const L = (t) => t.reduce((n, c) => {
|
|
|
287
286
|
fontSize: 12,
|
|
288
287
|
bgcolor: "grey.200"
|
|
289
288
|
},
|
|
290
|
-
children:
|
|
291
|
-
}),
|
|
289
|
+
children: l
|
|
290
|
+
}), o]
|
|
292
291
|
});
|
|
293
|
-
},
|
|
294
|
-
control: (
|
|
295
|
-
...
|
|
292
|
+
}, Oe = {
|
|
293
|
+
control: (e) => ({
|
|
294
|
+
...e,
|
|
296
295
|
minHeight: 31
|
|
297
296
|
}),
|
|
298
|
-
valueContainer: (
|
|
299
|
-
...
|
|
297
|
+
valueContainer: (e) => ({
|
|
298
|
+
...e,
|
|
300
299
|
display: "flex"
|
|
301
300
|
}),
|
|
302
|
-
dropdownIndicator: (
|
|
303
|
-
...
|
|
301
|
+
dropdownIndicator: (e) => ({
|
|
302
|
+
...e,
|
|
304
303
|
padding: "0 4px"
|
|
305
304
|
}),
|
|
306
|
-
clearIndicator: (
|
|
307
|
-
...
|
|
305
|
+
clearIndicator: (e) => ({
|
|
306
|
+
...e,
|
|
308
307
|
padding: "4px"
|
|
309
308
|
})
|
|
310
309
|
};
|
|
311
|
-
function
|
|
312
|
-
data:
|
|
313
|
-
value:
|
|
314
|
-
editable:
|
|
315
|
-
addon:
|
|
316
|
-
onChange:
|
|
310
|
+
function Ae({
|
|
311
|
+
data: e,
|
|
312
|
+
value: t = [],
|
|
313
|
+
editable: s = !1,
|
|
314
|
+
addon: o,
|
|
315
|
+
onChange: l,
|
|
317
316
|
compact: r,
|
|
318
317
|
...i
|
|
319
318
|
}) {
|
|
320
|
-
const
|
|
321
|
-
data:
|
|
322
|
-
label:
|
|
323
|
-
value:
|
|
324
|
-
})), [
|
|
325
|
-
...
|
|
319
|
+
const a = j(null), h = z(() => L(e).map((d) => ({
|
|
320
|
+
data: d,
|
|
321
|
+
label: d.name,
|
|
322
|
+
value: d.id
|
|
323
|
+
})), [e]), g = h.reduce((d, w) => ({
|
|
324
|
+
...d,
|
|
326
325
|
[w.data.id]: w
|
|
327
|
-
}), {}), f = Array.isArray(
|
|
328
|
-
prev: f.map((
|
|
329
|
-
}), m = (
|
|
330
|
-
|
|
326
|
+
}), {}), f = Array.isArray(t) ? t : [t], x = f.map((d) => g[d]), c = j({
|
|
327
|
+
prev: f.map((d) => g[d].data)
|
|
328
|
+
}), m = (d, w) => {
|
|
329
|
+
c.current.current = d.map((k) => k.data), ["clear", "remove-value"].includes(w.action) && a.current && setTimeout(() => {
|
|
331
330
|
var k;
|
|
332
|
-
return (k =
|
|
331
|
+
return (k = a == null ? void 0 : a.current) == null ? void 0 : k.blur();
|
|
333
332
|
}, 1);
|
|
334
333
|
}, b = () => {
|
|
335
|
-
|
|
334
|
+
c.current.current && JSON.stringify(c.current.prev.map((w) => w.id)) !== JSON.stringify(c.current.current.map((w) => w.id)) && (l(c.current.current), c.current.prev = c.current.current);
|
|
336
335
|
};
|
|
337
|
-
return /* @__PURE__ */
|
|
336
|
+
return /* @__PURE__ */ n(p, {
|
|
338
337
|
...i,
|
|
339
|
-
children: /* @__PURE__ */
|
|
340
|
-
ref:
|
|
338
|
+
children: /* @__PURE__ */ n(te, {
|
|
339
|
+
ref: a,
|
|
341
340
|
defaultValue: x,
|
|
342
341
|
options: h,
|
|
343
342
|
onChange: m,
|
|
344
343
|
components: {
|
|
345
|
-
MenuList: (
|
|
346
|
-
...
|
|
347
|
-
addon:
|
|
344
|
+
MenuList: (d) => /* @__PURE__ */ n(ke, {
|
|
345
|
+
...d,
|
|
346
|
+
addon: o
|
|
348
347
|
}),
|
|
349
348
|
...r && {
|
|
350
349
|
ValueContainer: Te
|
|
@@ -352,24 +351,24 @@ function Oe({
|
|
|
352
351
|
},
|
|
353
352
|
placeholder: "Select labels",
|
|
354
353
|
styles: {
|
|
355
|
-
...r &&
|
|
356
|
-
menu: (
|
|
357
|
-
...
|
|
358
|
-
...
|
|
354
|
+
...r && Oe,
|
|
355
|
+
menu: (d) => ({
|
|
356
|
+
...d,
|
|
357
|
+
...s && {
|
|
359
358
|
paddingBottom: "36px"
|
|
360
359
|
},
|
|
361
360
|
zIndex: 99
|
|
362
361
|
}),
|
|
363
|
-
menuList: (
|
|
364
|
-
...
|
|
362
|
+
menuList: (d) => ({
|
|
363
|
+
...d,
|
|
365
364
|
overflowY: "auto",
|
|
366
365
|
maxHeight: "264px"
|
|
367
366
|
})
|
|
368
367
|
},
|
|
369
|
-
theme: (
|
|
370
|
-
...
|
|
368
|
+
theme: (d) => ({
|
|
369
|
+
...d,
|
|
371
370
|
colors: {
|
|
372
|
-
...
|
|
371
|
+
...d.colors,
|
|
373
372
|
primary25: "#ddd",
|
|
374
373
|
primary50: "#ddd",
|
|
375
374
|
primary: "#ddd"
|
|
@@ -379,35 +378,77 @@ function Oe({
|
|
|
379
378
|
isMulti: !0,
|
|
380
379
|
closeMenuOnSelect: !1,
|
|
381
380
|
onMenuClose: b,
|
|
382
|
-
data:
|
|
381
|
+
data: e
|
|
383
382
|
})
|
|
384
383
|
});
|
|
385
384
|
}
|
|
386
|
-
function
|
|
387
|
-
|
|
388
|
-
|
|
385
|
+
var E = function() {
|
|
386
|
+
return E = Object.assign || function(t) {
|
|
387
|
+
for (var s, o = 1, l = arguments.length; o < l; o++) {
|
|
388
|
+
s = arguments[o];
|
|
389
|
+
for (var r in s)
|
|
390
|
+
Object.prototype.hasOwnProperty.call(s, r) && (t[r] = s[r]);
|
|
391
|
+
}
|
|
392
|
+
return t;
|
|
393
|
+
}, E.apply(this, arguments);
|
|
394
|
+
};
|
|
395
|
+
function Pe(e, t) {
|
|
396
|
+
var s = typeof Symbol == "function" && e[Symbol.iterator];
|
|
397
|
+
if (!s)
|
|
398
|
+
return e;
|
|
399
|
+
var o = s.call(e), l, r = [], i;
|
|
400
|
+
try {
|
|
401
|
+
for (; (t === void 0 || t-- > 0) && !(l = o.next()).done; )
|
|
402
|
+
r.push(l.value);
|
|
403
|
+
} catch (a) {
|
|
404
|
+
i = { error: a };
|
|
405
|
+
} finally {
|
|
406
|
+
try {
|
|
407
|
+
l && !l.done && (s = o.return) && s.call(o);
|
|
408
|
+
} finally {
|
|
409
|
+
if (i)
|
|
410
|
+
throw i.error;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
return r;
|
|
414
|
+
}
|
|
415
|
+
var Be = function(e) {
|
|
416
|
+
return typeof e == "function";
|
|
417
|
+
}, Ne = function(e) {
|
|
418
|
+
var t = Pe(I(e), 2), s = t[0], o = t[1], l = T(function(r) {
|
|
419
|
+
o(function(i) {
|
|
420
|
+
var a = Be(r) ? r(i) : r;
|
|
421
|
+
return a ? E(E({}, i), a) : i;
|
|
422
|
+
});
|
|
423
|
+
}, []);
|
|
424
|
+
return [s, l];
|
|
425
|
+
};
|
|
426
|
+
const Ee = Ne;
|
|
427
|
+
function Le({
|
|
428
|
+
I18NProps: e,
|
|
429
|
+
...t
|
|
389
430
|
}) {
|
|
390
431
|
const {
|
|
391
|
-
languages:
|
|
432
|
+
languages: s
|
|
392
433
|
} = $(), {
|
|
393
|
-
translation:
|
|
394
|
-
onChange:
|
|
395
|
-
} =
|
|
434
|
+
translation: o,
|
|
435
|
+
onChange: l
|
|
436
|
+
} = e, [r, i] = I(null), a = (f) => {
|
|
396
437
|
const x = f.currentTarget.closest(".MuiInputBase-root");
|
|
397
438
|
x && i(x);
|
|
398
439
|
}, h = () => {
|
|
399
440
|
i(null);
|
|
400
|
-
}, g =
|
|
401
|
-
return /* @__PURE__ */
|
|
402
|
-
...
|
|
441
|
+
}, g = s.filter((f) => f.code !== "en");
|
|
442
|
+
return /* @__PURE__ */ n(R, {
|
|
443
|
+
...t,
|
|
403
444
|
InputProps: {
|
|
404
445
|
endAdornment: /* @__PURE__ */ C(ae, {
|
|
405
446
|
position: "end",
|
|
406
|
-
children: [/* @__PURE__ */
|
|
447
|
+
children: [/* @__PURE__ */ n(ce, {
|
|
407
448
|
edge: "end",
|
|
408
|
-
onClick:
|
|
409
|
-
children: /* @__PURE__ */
|
|
410
|
-
}), /* @__PURE__ */
|
|
449
|
+
onClick: a,
|
|
450
|
+
children: /* @__PURE__ */ n(de, {})
|
|
451
|
+
}), /* @__PURE__ */ n(ue, {
|
|
411
452
|
open: !!r,
|
|
412
453
|
anchorEl: r,
|
|
413
454
|
onClose: h,
|
|
@@ -431,14 +472,14 @@ function Be({
|
|
|
431
472
|
sx: {
|
|
432
473
|
mt: 2
|
|
433
474
|
},
|
|
434
|
-
children: /* @__PURE__ */
|
|
475
|
+
children: /* @__PURE__ */ n(B, {
|
|
435
476
|
sx: {
|
|
436
477
|
p: 2
|
|
437
478
|
},
|
|
438
479
|
children: g.map(({
|
|
439
480
|
code: f,
|
|
440
481
|
name: x
|
|
441
|
-
}) => /* @__PURE__ */ C(
|
|
482
|
+
}) => /* @__PURE__ */ C(B, {
|
|
442
483
|
sx: {
|
|
443
484
|
display: "flex",
|
|
444
485
|
alignItems: "center",
|
|
@@ -447,24 +488,24 @@ function Be({
|
|
|
447
488
|
mt: 1
|
|
448
489
|
}
|
|
449
490
|
},
|
|
450
|
-
children: [/* @__PURE__ */
|
|
491
|
+
children: [/* @__PURE__ */ n(B, {
|
|
451
492
|
sx: {
|
|
452
493
|
flex: "0 0 120px"
|
|
453
494
|
},
|
|
454
495
|
children: x
|
|
455
|
-
}), /* @__PURE__ */
|
|
496
|
+
}), /* @__PURE__ */ n(B, {
|
|
456
497
|
sx: {
|
|
457
498
|
flex: 1
|
|
458
499
|
},
|
|
459
|
-
children: /* @__PURE__ */
|
|
460
|
-
value:
|
|
500
|
+
children: /* @__PURE__ */ n(R, {
|
|
501
|
+
value: o[f] || "",
|
|
461
502
|
size: "small",
|
|
462
503
|
sx: {
|
|
463
504
|
width: 1
|
|
464
505
|
},
|
|
465
|
-
onChange: (
|
|
466
|
-
...
|
|
467
|
-
[f]:
|
|
506
|
+
onChange: (c) => l({
|
|
507
|
+
...o,
|
|
508
|
+
[f]: c.target.value
|
|
468
509
|
})
|
|
469
510
|
})
|
|
470
511
|
})]
|
|
@@ -475,98 +516,98 @@ function Be({
|
|
|
475
516
|
}
|
|
476
517
|
});
|
|
477
518
|
}
|
|
478
|
-
function
|
|
479
|
-
open:
|
|
480
|
-
initialLabel:
|
|
481
|
-
onSubmit:
|
|
482
|
-
onClose:
|
|
483
|
-
...
|
|
519
|
+
function Me({
|
|
520
|
+
open: e,
|
|
521
|
+
initialLabel: t,
|
|
522
|
+
onSubmit: s,
|
|
523
|
+
onClose: o,
|
|
524
|
+
...l
|
|
484
525
|
}) {
|
|
485
|
-
const r = !(
|
|
486
|
-
name: (
|
|
487
|
-
color: (
|
|
488
|
-
slug: (
|
|
489
|
-
translation: (
|
|
490
|
-
}), h = (
|
|
491
|
-
|
|
492
|
-
...
|
|
526
|
+
const r = !(t != null && t.id), [i, a] = Ee({
|
|
527
|
+
name: (t == null ? void 0 : t.name) || "",
|
|
528
|
+
color: (t == null ? void 0 : t.color) || "#ddd",
|
|
529
|
+
slug: (t == null ? void 0 : t.id) || "",
|
|
530
|
+
translation: (t == null ? void 0 : t.translation) || {}
|
|
531
|
+
}), h = (d) => /^#([0-9A-F]{3}){1,2}$/i.test(d), g = z(() => r ? i.name && i.color && i.slug && h(i.color) : i.name && i.color && h(i.color), [i, r]), [f, x] = I(!1), c = () => {
|
|
532
|
+
s({
|
|
533
|
+
...t,
|
|
493
534
|
name: i.name,
|
|
494
535
|
color: i.color,
|
|
495
536
|
id: i.slug,
|
|
496
537
|
translation: i.translation
|
|
497
538
|
});
|
|
498
|
-
}, m = (
|
|
499
|
-
|
|
500
|
-
color:
|
|
539
|
+
}, m = (d) => {
|
|
540
|
+
a({
|
|
541
|
+
color: d.hex
|
|
501
542
|
}), setTimeout(() => x(!1));
|
|
502
|
-
}, b = (
|
|
503
|
-
|
|
504
|
-
color:
|
|
543
|
+
}, b = (d) => {
|
|
544
|
+
a({
|
|
545
|
+
color: d.target.value
|
|
505
546
|
});
|
|
506
547
|
};
|
|
507
|
-
return /* @__PURE__ */
|
|
508
|
-
open:
|
|
548
|
+
return /* @__PURE__ */ n(_, {
|
|
549
|
+
open: e,
|
|
509
550
|
showCloseButton: !0,
|
|
510
551
|
maxWidth: "lg",
|
|
511
552
|
title: r ? "Create label" : "Edit label",
|
|
512
|
-
actions: /* @__PURE__ */ C(
|
|
513
|
-
children: [/* @__PURE__ */
|
|
553
|
+
actions: /* @__PURE__ */ C(P, {
|
|
554
|
+
children: [/* @__PURE__ */ n(O, {
|
|
514
555
|
color: "inherit",
|
|
515
556
|
variant: "contained",
|
|
516
557
|
size: "small",
|
|
517
|
-
onClick:
|
|
558
|
+
onClick: o,
|
|
518
559
|
children: "Cancel"
|
|
519
|
-
}), /* @__PURE__ */
|
|
560
|
+
}), /* @__PURE__ */ n(O, {
|
|
520
561
|
color: "primary",
|
|
521
562
|
variant: "contained",
|
|
522
563
|
size: "small",
|
|
523
|
-
onClick:
|
|
564
|
+
onClick: c,
|
|
524
565
|
disabled: !g,
|
|
525
566
|
children: r ? "Create" : "Save Changes"
|
|
526
567
|
})]
|
|
527
568
|
}),
|
|
528
|
-
onClose:
|
|
529
|
-
...
|
|
569
|
+
onClose: o,
|
|
570
|
+
...l,
|
|
530
571
|
children: /* @__PURE__ */ C(p, {
|
|
531
572
|
width: 600,
|
|
532
573
|
minHeight: 280,
|
|
533
|
-
children: [/* @__PURE__ */
|
|
574
|
+
children: [/* @__PURE__ */ n(Le, {
|
|
534
575
|
label: "Name",
|
|
535
576
|
value: i.name,
|
|
536
577
|
placeholder: "New label",
|
|
537
578
|
size: "small",
|
|
538
579
|
fullWidth: !0,
|
|
539
|
-
onChange: (
|
|
540
|
-
name:
|
|
580
|
+
onChange: (d) => a({
|
|
581
|
+
name: d.target.value
|
|
541
582
|
}),
|
|
542
583
|
I18NProps: {
|
|
543
584
|
translation: i.translation,
|
|
544
|
-
onChange: (
|
|
545
|
-
translation:
|
|
585
|
+
onChange: (d) => a({
|
|
586
|
+
translation: d
|
|
546
587
|
})
|
|
547
588
|
}
|
|
548
|
-
}), /* @__PURE__ */
|
|
589
|
+
}), /* @__PURE__ */ n(M, {
|
|
549
590
|
label: "Slug",
|
|
550
591
|
value: i.slug,
|
|
551
592
|
size: "small",
|
|
552
593
|
fullWidth: !0,
|
|
553
594
|
disabled: !r,
|
|
554
|
-
onChange: (
|
|
555
|
-
slug:
|
|
595
|
+
onChange: (d) => a({
|
|
596
|
+
slug: d.target.value
|
|
556
597
|
}),
|
|
557
598
|
sx: {
|
|
558
599
|
mt: 2
|
|
559
600
|
}
|
|
560
|
-
}), (
|
|
601
|
+
}), (t == null ? void 0 : t.parent) && /* @__PURE__ */ n(M, {
|
|
561
602
|
label: "Parent",
|
|
562
|
-
value:
|
|
603
|
+
value: t.parent.name,
|
|
563
604
|
size: "small",
|
|
564
605
|
fullWidth: !0,
|
|
565
606
|
disabled: !0,
|
|
566
607
|
sx: {
|
|
567
608
|
mt: 2
|
|
568
609
|
}
|
|
569
|
-
}), /* @__PURE__ */
|
|
610
|
+
}), /* @__PURE__ */ n(ie, {
|
|
570
611
|
onClickAway: () => x(!1),
|
|
571
612
|
children: /* @__PURE__ */ C(p, {
|
|
572
613
|
sx: {
|
|
@@ -579,7 +620,7 @@ function Pe({
|
|
|
579
620
|
alignItems: "center",
|
|
580
621
|
gap: 1
|
|
581
622
|
},
|
|
582
|
-
children: [/* @__PURE__ */
|
|
623
|
+
children: [/* @__PURE__ */ n(p, {
|
|
583
624
|
sx: {
|
|
584
625
|
width: 30,
|
|
585
626
|
height: 30,
|
|
@@ -587,7 +628,7 @@ function Pe({
|
|
|
587
628
|
borderRadius: 1
|
|
588
629
|
},
|
|
589
630
|
onClick: () => x(!0)
|
|
590
|
-
}), /* @__PURE__ */
|
|
631
|
+
}), /* @__PURE__ */ n(M, {
|
|
591
632
|
label: "",
|
|
592
633
|
value: i.color,
|
|
593
634
|
size: "small",
|
|
@@ -602,13 +643,13 @@ function Pe({
|
|
|
602
643
|
}
|
|
603
644
|
}
|
|
604
645
|
})]
|
|
605
|
-
}), f && /* @__PURE__ */
|
|
646
|
+
}), f && /* @__PURE__ */ n(p, {
|
|
606
647
|
sx: {
|
|
607
648
|
position: "absolute",
|
|
608
649
|
top: 48,
|
|
609
650
|
zIndex: 1
|
|
610
651
|
},
|
|
611
|
-
children: /* @__PURE__ */
|
|
652
|
+
children: /* @__PURE__ */ n(se, {
|
|
612
653
|
color: i.color,
|
|
613
654
|
onChangeComplete: m
|
|
614
655
|
})
|
|
@@ -618,51 +659,51 @@ function Pe({
|
|
|
618
659
|
})
|
|
619
660
|
});
|
|
620
661
|
}
|
|
621
|
-
function
|
|
622
|
-
open:
|
|
623
|
-
label:
|
|
624
|
-
onSubmit:
|
|
625
|
-
onClose:
|
|
626
|
-
...
|
|
662
|
+
function je({
|
|
663
|
+
open: e,
|
|
664
|
+
label: t,
|
|
665
|
+
onSubmit: s,
|
|
666
|
+
onClose: o,
|
|
667
|
+
...l
|
|
627
668
|
}) {
|
|
628
|
-
return /* @__PURE__ */
|
|
629
|
-
open:
|
|
669
|
+
return /* @__PURE__ */ n(_, {
|
|
670
|
+
open: e,
|
|
630
671
|
showCloseButton: !0,
|
|
631
672
|
maxWidth: "md",
|
|
632
673
|
title: "Delete",
|
|
633
|
-
actions: /* @__PURE__ */ C(
|
|
634
|
-
children: [/* @__PURE__ */
|
|
674
|
+
actions: /* @__PURE__ */ C(P, {
|
|
675
|
+
children: [/* @__PURE__ */ n(O, {
|
|
635
676
|
color: "inherit",
|
|
636
677
|
variant: "contained",
|
|
637
678
|
size: "small",
|
|
638
|
-
onClick:
|
|
679
|
+
onClick: o,
|
|
639
680
|
children: "Cancel"
|
|
640
|
-
}), /* @__PURE__ */
|
|
681
|
+
}), /* @__PURE__ */ n(O, {
|
|
641
682
|
color: "primary",
|
|
642
683
|
variant: "contained",
|
|
643
684
|
size: "small",
|
|
644
|
-
onClick:
|
|
685
|
+
onClick: s,
|
|
645
686
|
children: "Delete"
|
|
646
687
|
})]
|
|
647
688
|
}),
|
|
648
|
-
onClose:
|
|
649
|
-
...
|
|
689
|
+
onClose: o,
|
|
690
|
+
...l,
|
|
650
691
|
children: /* @__PURE__ */ C(p, {
|
|
651
692
|
width: 600,
|
|
652
693
|
minHeight: 280,
|
|
653
|
-
children: [/* @__PURE__ */
|
|
694
|
+
children: [/* @__PURE__ */ n(he, {
|
|
654
695
|
severity: "info",
|
|
655
696
|
sx: {
|
|
656
697
|
mb: 2
|
|
657
698
|
},
|
|
658
699
|
children: "Are you sure you want to delete these labels ?"
|
|
659
|
-
}), /* @__PURE__ */
|
|
660
|
-
data: [
|
|
700
|
+
}), /* @__PURE__ */ n(W, {
|
|
701
|
+
data: [t]
|
|
661
702
|
})]
|
|
662
703
|
})
|
|
663
704
|
});
|
|
664
705
|
}
|
|
665
|
-
const
|
|
706
|
+
const De = H(W)`
|
|
666
707
|
.label-tree-item {
|
|
667
708
|
&:before {
|
|
668
709
|
content: '';
|
|
@@ -683,9 +724,9 @@ const Le = F(W)`
|
|
|
683
724
|
padding: 0 16px;
|
|
684
725
|
}
|
|
685
726
|
`;
|
|
686
|
-
function
|
|
687
|
-
locale:
|
|
688
|
-
value:
|
|
727
|
+
function We({
|
|
728
|
+
locale: e,
|
|
729
|
+
value: t
|
|
689
730
|
}) {
|
|
690
731
|
return /* @__PURE__ */ C(p, {
|
|
691
732
|
sx: {
|
|
@@ -698,95 +739,95 @@ function Me({
|
|
|
698
739
|
bgcolor: "grey.300",
|
|
699
740
|
borderRadius: 2
|
|
700
741
|
},
|
|
701
|
-
children: [/* @__PURE__ */
|
|
742
|
+
children: [/* @__PURE__ */ n(p, {
|
|
702
743
|
sx: {
|
|
703
744
|
pr: 0.5,
|
|
704
745
|
borderRight: 1,
|
|
705
746
|
borderColor: "grey.400"
|
|
706
747
|
},
|
|
707
|
-
children:
|
|
708
|
-
}), /* @__PURE__ */
|
|
748
|
+
children: e
|
|
749
|
+
}), /* @__PURE__ */ n(p, {
|
|
709
750
|
sx: {
|
|
710
751
|
pl: 0.5
|
|
711
752
|
},
|
|
712
|
-
children:
|
|
753
|
+
children: t
|
|
713
754
|
})]
|
|
714
755
|
});
|
|
715
756
|
}
|
|
716
|
-
function
|
|
717
|
-
data:
|
|
718
|
-
api:
|
|
719
|
-
...
|
|
757
|
+
function pt({
|
|
758
|
+
data: e,
|
|
759
|
+
api: t,
|
|
760
|
+
...s
|
|
720
761
|
}) {
|
|
721
|
-
const [
|
|
722
|
-
const u = (y,
|
|
723
|
-
return u(
|
|
724
|
-
}, [
|
|
725
|
-
var y,
|
|
726
|
-
u.parent ? (u.parent.children = (
|
|
762
|
+
const [o, l] = I(null), [r, i] = I(null), [a, h] = I(Q(e)), g = z(() => L(a), [a]), f = z(() => {
|
|
763
|
+
const u = (y, S) => y.map((v) => (S && (v.parent = S), v.children && (v.children = u(v.children, v)), v));
|
|
764
|
+
return u(a);
|
|
765
|
+
}, [a]), x = (u) => {
|
|
766
|
+
var y, S;
|
|
767
|
+
u.parent ? (u.parent.children = (S = (y = u.parent) == null ? void 0 : y.children) == null ? void 0 : S.map((v) => v.id === u.id ? {
|
|
727
768
|
...u
|
|
728
|
-
} : v), x(u.parent)) : h(
|
|
769
|
+
} : v), x(u.parent)) : h(a.map((v) => v.id === u.id ? {
|
|
729
770
|
...u
|
|
730
771
|
} : v));
|
|
731
|
-
},
|
|
732
|
-
u.parent ? (u.parent.children = u.parent.children || [], u.parent.children.push(u), h([...
|
|
772
|
+
}, c = (u) => {
|
|
773
|
+
u.parent ? (u.parent.children = u.parent.children || [], u.parent.children.push(u), h([...a])) : h([...a, u]);
|
|
733
774
|
}, m = (u) => {
|
|
734
775
|
var y;
|
|
735
|
-
u.parent ? u.parent.children = (y = u.parent.children) == null ? void 0 : y.filter((
|
|
776
|
+
u.parent ? u.parent.children = (y = u.parent.children) == null ? void 0 : y.filter((S) => S.id !== u.id) : h(a.filter((S) => S.id !== u.id));
|
|
736
777
|
}, b = (u) => {
|
|
737
|
-
if (
|
|
778
|
+
if (o)
|
|
738
779
|
return;
|
|
739
|
-
|
|
780
|
+
l({
|
|
740
781
|
id: "",
|
|
741
782
|
name: "New label",
|
|
742
783
|
parent: u,
|
|
743
784
|
color: "#dddddd"
|
|
744
785
|
});
|
|
745
|
-
},
|
|
746
|
-
|
|
786
|
+
}, d = (u) => {
|
|
787
|
+
o || l(u);
|
|
747
788
|
}, w = async (u) => {
|
|
748
|
-
if (!
|
|
789
|
+
if (!o)
|
|
749
790
|
return;
|
|
750
791
|
const {
|
|
751
792
|
parent: y,
|
|
752
|
-
children:
|
|
793
|
+
children: S,
|
|
753
794
|
translation: v,
|
|
754
795
|
...A
|
|
755
796
|
} = u;
|
|
756
|
-
|
|
797
|
+
o.id ? (await t.updateLabel({
|
|
757
798
|
...A,
|
|
758
799
|
translation: JSON.stringify(v),
|
|
759
800
|
parentId: y == null ? void 0 : y.id
|
|
760
|
-
}), x(u)) : (await
|
|
801
|
+
}), x(u)) : (await t.createLabel({
|
|
761
802
|
...A,
|
|
762
803
|
translation: JSON.stringify(v),
|
|
763
804
|
parentId: y == null ? void 0 : y.id
|
|
764
|
-
}),
|
|
805
|
+
}), c(u)), l(null);
|
|
765
806
|
}, k = async () => {
|
|
766
|
-
!r || (await
|
|
767
|
-
}, G = (u, y) => /* @__PURE__ */ C(
|
|
807
|
+
!r || (await t.deleteLabel(r.id), m(r), i(null));
|
|
808
|
+
}, G = (u, y) => /* @__PURE__ */ C(P, {
|
|
768
809
|
children: [/* @__PURE__ */ C(p, {
|
|
769
810
|
sx: {
|
|
770
811
|
display: "flex",
|
|
771
812
|
alignItems: "center",
|
|
772
813
|
flexWrap: "wrap"
|
|
773
814
|
},
|
|
774
|
-
children: [/* @__PURE__ */
|
|
815
|
+
children: [/* @__PURE__ */ n(p, {
|
|
775
816
|
children: u
|
|
776
|
-
}), y.translation && /* @__PURE__ */
|
|
817
|
+
}), y.translation && /* @__PURE__ */ n(p, {
|
|
777
818
|
sx: {
|
|
778
819
|
display: "flex",
|
|
779
820
|
alignItems: "center",
|
|
780
821
|
gap: 0.5,
|
|
781
822
|
ml: 2
|
|
782
823
|
},
|
|
783
|
-
children: Object.keys(y.translation).map((
|
|
824
|
+
children: Object.keys(y.translation).map((S) => {
|
|
784
825
|
var A;
|
|
785
|
-
const v = (A = y.translation) == null ? void 0 : A[
|
|
786
|
-
return v ? /* @__PURE__ */
|
|
787
|
-
locale:
|
|
826
|
+
const v = (A = y.translation) == null ? void 0 : A[S];
|
|
827
|
+
return v ? /* @__PURE__ */ n(We, {
|
|
828
|
+
locale: S,
|
|
788
829
|
value: v
|
|
789
|
-
},
|
|
830
|
+
}, S) : null;
|
|
790
831
|
})
|
|
791
832
|
})]
|
|
792
833
|
}), /* @__PURE__ */ C(p, {
|
|
@@ -795,38 +836,38 @@ function dt({
|
|
|
795
836
|
gap: 1,
|
|
796
837
|
flex: "0 0 auto"
|
|
797
838
|
},
|
|
798
|
-
children: [/* @__PURE__ */
|
|
839
|
+
children: [/* @__PURE__ */ n(N, {
|
|
799
840
|
color: "inherit",
|
|
800
841
|
size: "small",
|
|
801
842
|
sx: {
|
|
802
843
|
color: "grey.500"
|
|
803
844
|
},
|
|
804
845
|
onClick: () => b(y),
|
|
805
|
-
children: /* @__PURE__ */
|
|
846
|
+
children: /* @__PURE__ */ n(le, {
|
|
806
847
|
sx: {
|
|
807
848
|
fontSize: 20
|
|
808
849
|
}
|
|
809
850
|
})
|
|
810
|
-
}), /* @__PURE__ */
|
|
851
|
+
}), /* @__PURE__ */ n(N, {
|
|
811
852
|
color: "inherit",
|
|
812
853
|
size: "small",
|
|
813
854
|
sx: {
|
|
814
855
|
color: "grey.500"
|
|
815
856
|
},
|
|
816
|
-
onClick: () =>
|
|
817
|
-
children: /* @__PURE__ */
|
|
857
|
+
onClick: () => d(y),
|
|
858
|
+
children: /* @__PURE__ */ n(oe, {
|
|
818
859
|
sx: {
|
|
819
860
|
fontSize: 18
|
|
820
861
|
}
|
|
821
862
|
})
|
|
822
|
-
}), /* @__PURE__ */
|
|
863
|
+
}), /* @__PURE__ */ n(N, {
|
|
823
864
|
color: "inherit",
|
|
824
865
|
size: "small",
|
|
825
866
|
sx: {
|
|
826
867
|
color: "grey.500"
|
|
827
868
|
},
|
|
828
869
|
onClick: () => i(y),
|
|
829
|
-
children: /* @__PURE__ */
|
|
870
|
+
children: /* @__PURE__ */ n(re, {
|
|
830
871
|
sx: {
|
|
831
872
|
fontSize: 20
|
|
832
873
|
}
|
|
@@ -835,18 +876,18 @@ function dt({
|
|
|
835
876
|
})]
|
|
836
877
|
});
|
|
837
878
|
return /* @__PURE__ */ C(p, {
|
|
838
|
-
...
|
|
879
|
+
...s,
|
|
839
880
|
children: [/* @__PURE__ */ C(p, {
|
|
840
881
|
sx: {
|
|
841
882
|
display: "flex",
|
|
842
883
|
alignItems: "center",
|
|
843
884
|
justifyContent: "space-between"
|
|
844
885
|
},
|
|
845
|
-
children: [/* @__PURE__ */
|
|
886
|
+
children: [/* @__PURE__ */ n(ne, {
|
|
846
887
|
component: "h2",
|
|
847
888
|
variant: "h6",
|
|
848
889
|
children: "Manage labels"
|
|
849
|
-
}), /* @__PURE__ */
|
|
890
|
+
}), /* @__PURE__ */ n(O, {
|
|
850
891
|
color: "primary",
|
|
851
892
|
variant: "contained",
|
|
852
893
|
size: "small",
|
|
@@ -872,23 +913,23 @@ function dt({
|
|
|
872
913
|
bgcolor: "grey.200"
|
|
873
914
|
},
|
|
874
915
|
children: [g.length, " labels"]
|
|
875
|
-
}), /* @__PURE__ */
|
|
916
|
+
}), /* @__PURE__ */ n(p, {
|
|
876
917
|
sx: {
|
|
877
918
|
pt: 0.5
|
|
878
919
|
},
|
|
879
|
-
children: /* @__PURE__ */
|
|
920
|
+
children: /* @__PURE__ */ n(De, {
|
|
880
921
|
data: f,
|
|
881
922
|
selected: [],
|
|
882
923
|
renderItem: G,
|
|
883
924
|
rowHeight: 64
|
|
884
925
|
})
|
|
885
926
|
})]
|
|
886
|
-
}), /* @__PURE__ */
|
|
887
|
-
open: !!
|
|
888
|
-
onClose: () =>
|
|
889
|
-
initialLabel:
|
|
927
|
+
}), /* @__PURE__ */ n(Me, {
|
|
928
|
+
open: !!o,
|
|
929
|
+
onClose: () => l(null),
|
|
930
|
+
initialLabel: o,
|
|
890
931
|
onSubmit: w
|
|
891
|
-
},
|
|
932
|
+
}, o == null ? void 0 : o.id), /* @__PURE__ */ n(je, {
|
|
892
933
|
open: !!r,
|
|
893
934
|
onClose: () => i(null),
|
|
894
935
|
label: r,
|
|
@@ -896,151 +937,151 @@ function dt({
|
|
|
896
937
|
}, r == null ? void 0 : r.id)]
|
|
897
938
|
});
|
|
898
939
|
}
|
|
899
|
-
const Y = V({}), Z = () => q(Y),
|
|
940
|
+
const Y = V({}), Z = () => q(Y), mt = () => {
|
|
900
941
|
const {
|
|
901
|
-
updateLabels:
|
|
942
|
+
updateLabels: e
|
|
902
943
|
} = Z();
|
|
903
|
-
|
|
904
|
-
|
|
944
|
+
D(() => () => {
|
|
945
|
+
e();
|
|
905
946
|
}, []);
|
|
906
947
|
};
|
|
907
|
-
function
|
|
908
|
-
fetchLabels:
|
|
909
|
-
children:
|
|
948
|
+
function ft({
|
|
949
|
+
fetchLabels: e,
|
|
950
|
+
children: t
|
|
910
951
|
}) {
|
|
911
952
|
const {
|
|
912
|
-
locale:
|
|
913
|
-
} = $(), [
|
|
953
|
+
locale: s
|
|
954
|
+
} = $(), [o, l] = I({
|
|
914
955
|
loading: !0,
|
|
915
956
|
labels: [],
|
|
916
957
|
updateCounter: 1
|
|
917
958
|
});
|
|
918
|
-
|
|
959
|
+
D(() => {
|
|
919
960
|
(async () => {
|
|
920
961
|
try {
|
|
921
|
-
|
|
962
|
+
l((b) => ({
|
|
922
963
|
...b,
|
|
923
964
|
loading: !0
|
|
924
965
|
}));
|
|
925
|
-
const m = await
|
|
926
|
-
|
|
966
|
+
const m = await e();
|
|
967
|
+
l((b) => ({
|
|
927
968
|
...b,
|
|
928
969
|
loading: !1,
|
|
929
970
|
labels: ze(m)
|
|
930
971
|
}));
|
|
931
972
|
} catch (m) {
|
|
932
|
-
console.error(m),
|
|
973
|
+
console.error(m), l((b) => ({
|
|
933
974
|
...b,
|
|
934
975
|
loading: !1,
|
|
935
976
|
labels: []
|
|
936
977
|
}));
|
|
937
978
|
}
|
|
938
979
|
})();
|
|
939
|
-
}, [
|
|
980
|
+
}, [o.updateCounter]);
|
|
940
981
|
const r = z(() => {
|
|
941
982
|
var m;
|
|
942
|
-
return (m =
|
|
983
|
+
return (m = o.labels) != null && m.length ? L(o.labels).reduce((b, d) => ({
|
|
943
984
|
...b,
|
|
944
|
-
[
|
|
985
|
+
[d.id]: d
|
|
945
986
|
}), {}) : {};
|
|
946
|
-
}, [
|
|
987
|
+
}, [o.labels]), i = T((c) => {
|
|
947
988
|
var m;
|
|
948
989
|
return {
|
|
949
|
-
...
|
|
950
|
-
name: ((m =
|
|
990
|
+
...c,
|
|
991
|
+
name: ((m = c.translation) == null ? void 0 : m[s]) || c.name
|
|
951
992
|
};
|
|
952
|
-
}, [
|
|
953
|
-
if (!!(
|
|
954
|
-
return
|
|
955
|
-
}, []), f = z(() =>
|
|
956
|
-
loading:
|
|
957
|
-
labels:
|
|
958
|
-
updateLabels: () =>
|
|
959
|
-
...
|
|
960
|
-
updateCounter: ++
|
|
993
|
+
}, [s]), a = T((c) => c.filter(Boolean).map((m) => r[m]).map(i), [r, i]), h = T((c) => (c == null ? void 0 : c.split(",")) || [], []), g = T((c = []) => {
|
|
994
|
+
if (!!(c != null && c.length))
|
|
995
|
+
return c.join(",");
|
|
996
|
+
}, []), f = z(() => o.labels.map(i), [o.labels, i]), x = z(() => ({
|
|
997
|
+
loading: o.loading,
|
|
998
|
+
labels: o.labels || [],
|
|
999
|
+
updateLabels: () => l((c) => ({
|
|
1000
|
+
...c,
|
|
1001
|
+
updateCounter: ++o.updateCounter
|
|
961
1002
|
})),
|
|
962
|
-
getLabelsById:
|
|
1003
|
+
getLabelsById: a,
|
|
963
1004
|
parseLabelIds: h,
|
|
964
1005
|
stringifyLabelIds: g,
|
|
965
1006
|
localizedLabels: f
|
|
966
|
-
}), [
|
|
967
|
-
return /* @__PURE__ */
|
|
1007
|
+
}), [o, a, h, g, f]);
|
|
1008
|
+
return /* @__PURE__ */ n(Y.Provider, {
|
|
968
1009
|
value: x,
|
|
969
|
-
children:
|
|
1010
|
+
children: t
|
|
970
1011
|
});
|
|
971
1012
|
}
|
|
972
|
-
function
|
|
973
|
-
labels:
|
|
974
|
-
editable:
|
|
975
|
-
onChange:
|
|
976
|
-
sx:
|
|
1013
|
+
function gt({
|
|
1014
|
+
labels: e,
|
|
1015
|
+
editable: t,
|
|
1016
|
+
onChange: s,
|
|
1017
|
+
sx: o
|
|
977
1018
|
}) {
|
|
978
|
-
const
|
|
1019
|
+
const l = !(e != null && e.length), {
|
|
979
1020
|
labels: r,
|
|
980
1021
|
loading: i,
|
|
981
|
-
getLabelsById:
|
|
982
|
-
} = Z(), [h, g] =
|
|
983
|
-
if (i || !
|
|
1022
|
+
getLabelsById: a
|
|
1023
|
+
} = Z(), [h, g] = I(!1);
|
|
1024
|
+
if (i || !t && l)
|
|
984
1025
|
return null;
|
|
985
1026
|
const f = (m) => {
|
|
986
|
-
|
|
1027
|
+
s == null || s(m), setTimeout(() => {
|
|
987
1028
|
g(!1);
|
|
988
1029
|
}, 300);
|
|
989
1030
|
};
|
|
990
1031
|
if (h)
|
|
991
|
-
return /* @__PURE__ */
|
|
1032
|
+
return /* @__PURE__ */ n(fe, {
|
|
992
1033
|
onClickAway: () => h && g(!1),
|
|
993
|
-
children: /* @__PURE__ */
|
|
994
|
-
children: /* @__PURE__ */
|
|
1034
|
+
children: /* @__PURE__ */ n("div", {
|
|
1035
|
+
children: /* @__PURE__ */ n(Ae, {
|
|
995
1036
|
data: r,
|
|
996
|
-
value:
|
|
1037
|
+
value: e || [],
|
|
997
1038
|
onChange: f
|
|
998
1039
|
})
|
|
999
1040
|
})
|
|
1000
1041
|
});
|
|
1001
|
-
const x =
|
|
1042
|
+
const x = a(e || []), c = [{
|
|
1002
1043
|
display: "flex",
|
|
1003
1044
|
gap: 1,
|
|
1004
1045
|
alignItems: "center",
|
|
1005
1046
|
flexWrap: "wrap"
|
|
1006
|
-
}, ...Array.isArray(
|
|
1047
|
+
}, ...Array.isArray(o) ? o : [o]];
|
|
1007
1048
|
return /* @__PURE__ */ C(p, {
|
|
1008
|
-
sx:
|
|
1009
|
-
children: [x.map((m) => m ? /* @__PURE__ */
|
|
1049
|
+
sx: c,
|
|
1050
|
+
children: [x.map((m) => m ? /* @__PURE__ */ n(ge, {
|
|
1010
1051
|
label: m.name,
|
|
1011
1052
|
variant: "filled",
|
|
1012
1053
|
size: "small",
|
|
1013
1054
|
sx: {
|
|
1014
1055
|
borderRadius: 1
|
|
1015
1056
|
}
|
|
1016
|
-
}, m.id) : null),
|
|
1057
|
+
}, m.id) : null), t && !l && /* @__PURE__ */ n(N, {
|
|
1017
1058
|
color: "inherit",
|
|
1018
1059
|
size: "small",
|
|
1019
1060
|
onClick: () => g(!0),
|
|
1020
1061
|
sx: {
|
|
1021
1062
|
color: "grey.400"
|
|
1022
1063
|
},
|
|
1023
|
-
children: /* @__PURE__ */
|
|
1064
|
+
children: /* @__PURE__ */ n(pe, {
|
|
1024
1065
|
sx: {
|
|
1025
1066
|
fontSize: 20
|
|
1026
1067
|
}
|
|
1027
1068
|
})
|
|
1028
|
-
}),
|
|
1069
|
+
}), t && l && /* @__PURE__ */ n(O, {
|
|
1029
1070
|
color: "inherit",
|
|
1030
1071
|
variant: "outlined",
|
|
1031
|
-
startIcon: /* @__PURE__ */
|
|
1072
|
+
startIcon: /* @__PURE__ */ n(me, {}),
|
|
1032
1073
|
onClick: () => g(!0),
|
|
1033
1074
|
children: "Edit labels"
|
|
1034
1075
|
})]
|
|
1035
1076
|
});
|
|
1036
1077
|
}
|
|
1037
1078
|
export {
|
|
1038
|
-
|
|
1039
|
-
|
|
1079
|
+
pt as LabelManager,
|
|
1080
|
+
Ae as LabelPicker,
|
|
1040
1081
|
W as LabelTree,
|
|
1041
|
-
|
|
1042
|
-
|
|
1082
|
+
gt as Labels,
|
|
1083
|
+
ft as LabelsProvider,
|
|
1043
1084
|
ze as transformLabels,
|
|
1044
1085
|
Z as useLabelsContext,
|
|
1045
|
-
|
|
1086
|
+
mt as useLabelsUpdateOnDestroy
|
|
1046
1087
|
};
|