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