@glodon-aiot/dataset-annotation 3.22.2-alpha.3 → 3.22.2-alpha.4
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.
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
var _ = Object.defineProperty, $ = Object.defineProperties;
|
|
2
2
|
var I = Object.getOwnPropertyDescriptors;
|
|
3
|
-
var
|
|
3
|
+
var P = Object.getOwnPropertySymbols;
|
|
4
4
|
var L = Object.prototype.hasOwnProperty, ee = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var
|
|
5
|
+
var B = (i, o, s) => o in i ? _(i, o, { enumerable: !0, configurable: !0, writable: !0, value: s }) : i[o] = s, N = (i, o) => {
|
|
6
6
|
for (var s in o || (o = {}))
|
|
7
|
-
L.call(o, s) &&
|
|
8
|
-
if (
|
|
9
|
-
for (var s of
|
|
10
|
-
ee.call(o, s) &&
|
|
7
|
+
L.call(o, s) && B(i, s, o[s]);
|
|
8
|
+
if (P)
|
|
9
|
+
for (var s of P(o))
|
|
10
|
+
ee.call(o, s) && B(i, s, o[s]);
|
|
11
11
|
return i;
|
|
12
12
|
}, g = (i, o) => $(i, I(o));
|
|
13
13
|
import { jsxs as h, jsx as a } from "react/jsx-runtime";
|
|
14
|
-
import { Row as
|
|
15
|
-
import { forwardRef as oe, useState as
|
|
16
|
-
import
|
|
14
|
+
import { Row as U, Button as Z, Input as te, Space as ie, Empty as le, Modal as re } from "antd";
|
|
15
|
+
import { forwardRef as oe, useState as u, useContext as ne, useEffect as y, useImperativeHandle as se } from "react";
|
|
16
|
+
import q from "../TagItem/index.mjs";
|
|
17
17
|
import "./style.less.mjs";
|
|
18
18
|
import { PlusOutlined as ce } from "@ant-design/icons";
|
|
19
|
-
import
|
|
19
|
+
import F from "../DisabledTooltip/index.mjs";
|
|
20
20
|
import ae from "../../../../DatasetContext/index.mjs";
|
|
21
21
|
import { tagColors as k } from "../../../../utils/index.mjs";
|
|
22
22
|
import de from "../../../Iconfont/index.mjs";
|
|
@@ -24,16 +24,16 @@ const fe = oe(({
|
|
|
24
24
|
datasetId: i,
|
|
25
25
|
data: o,
|
|
26
26
|
selected: s = [],
|
|
27
|
-
showZero:
|
|
28
|
-
shortcut:
|
|
27
|
+
showZero: me = !0,
|
|
28
|
+
shortcut: M = !1,
|
|
29
29
|
selectMode: G = "multiple",
|
|
30
|
-
onItemClick:
|
|
31
|
-
onSelectedChange:
|
|
32
|
-
onListChange:
|
|
30
|
+
onItemClick: C,
|
|
31
|
+
onSelectedChange: T,
|
|
32
|
+
onListChange: m,
|
|
33
33
|
isPreLabel: v = !1,
|
|
34
|
-
settingHide:
|
|
34
|
+
settingHide: j = !1
|
|
35
35
|
}, H) => {
|
|
36
|
-
const [n, A] =
|
|
36
|
+
const [n, A] = u([]), [ue, z] = u(!1), [r, p] = u([]), [E, R] = u(""), [x, S] = u(null), [w, J] = u(!1), {
|
|
37
37
|
services: {
|
|
38
38
|
cvforceDatahub: d
|
|
39
39
|
},
|
|
@@ -54,14 +54,14 @@ const fe = oe(({
|
|
|
54
54
|
})));
|
|
55
55
|
}, [i, o]);
|
|
56
56
|
const D = () => {
|
|
57
|
-
!i || !d || (
|
|
57
|
+
!i || !d || (z(!0), d.listLabels(i, {
|
|
58
58
|
pageNo: 1,
|
|
59
59
|
pageSize: 1e4
|
|
60
60
|
}).then((e) => {
|
|
61
61
|
p(e.recordList.sort((t, l) => t.createdAt - l.createdAt > 0 ? -1 : t.createdAt - l.createdAt < 0 ? 1 : 0).map((t, l) => g(N({}, t), {
|
|
62
62
|
color: k[l % 40]
|
|
63
63
|
})));
|
|
64
|
-
}).finally(() =>
|
|
64
|
+
}).finally(() => z(!1)));
|
|
65
65
|
};
|
|
66
66
|
se(H, () => ({
|
|
67
67
|
fetchLabels: D
|
|
@@ -77,17 +77,17 @@ const fe = oe(({
|
|
|
77
77
|
color: k[r.length % 40],
|
|
78
78
|
createdAt: Date.now(),
|
|
79
79
|
updatedAt: Date.now()
|
|
80
|
-
}]), S(null),
|
|
80
|
+
}]), S(null), m && m([...r]);
|
|
81
81
|
}).then(() => !0).catch(() => !1), Q = (e) => {
|
|
82
82
|
let t = [];
|
|
83
|
-
G === "multiple" ? n != null && n.some((l) => l.id === e.id) ? t = n == null ? void 0 : n.filter((l) => l.id !== e.id) : t = [...n, e] : n != null && n.some((l) => l.id === e.id) ? t = [] : t = [e], A(t),
|
|
83
|
+
G === "multiple" ? n != null && n.some((l) => l.id === e.id) ? t = n == null ? void 0 : n.filter((l) => l.id !== e.id) : t = [...n, e] : n != null && n.some((l) => l.id === e.id) ? t = [] : t = [e], A(t), T && T(t);
|
|
84
84
|
}, V = (e) => {
|
|
85
|
-
|
|
85
|
+
R(e);
|
|
86
86
|
}, W = (e) => {
|
|
87
87
|
if (!i || !d)
|
|
88
88
|
return Promise.resolve(!1);
|
|
89
89
|
const t = r.findIndex((l) => l.id === e.id);
|
|
90
|
-
return d.patchLabel(i, e.id, e).then(() => (t < 0 || (r[t] = e, p([...r]),
|
|
90
|
+
return d.patchLabel(i, e.id, e).then(() => (t < 0 || (r[t] = e, p([...r]), m && m([...r])), !0)).catch(() => !1);
|
|
91
91
|
}, X = (e) => {
|
|
92
92
|
re.confirm({
|
|
93
93
|
title: "确认要删除当前标签吗?",
|
|
@@ -97,14 +97,14 @@ const fe = oe(({
|
|
|
97
97
|
return;
|
|
98
98
|
const t = r.findIndex((c) => c.id === e), l = n.findIndex((c) => c.id === e);
|
|
99
99
|
return d.deleteLabel(i, e).then(() => {
|
|
100
|
-
l > -1 && (n.splice(l, 1), A([...n])), r.splice(t, 1), p([...r]),
|
|
100
|
+
l > -1 && (n.splice(l, 1), A([...n])), r.splice(t, 1), p([...r]), m && m([...r]), D();
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
103
|
});
|
|
104
|
-
}, b = (r == null ? void 0 : r.filter((e) => !
|
|
104
|
+
}, b = (r == null ? void 0 : r.filter((e) => !E || e.label.includes(E))) || [];
|
|
105
105
|
return /* @__PURE__ */ h("div", {
|
|
106
106
|
className: "label-list-wrap",
|
|
107
|
-
children: [/* @__PURE__ */ h(
|
|
107
|
+
children: [/* @__PURE__ */ h(U, {
|
|
108
108
|
justify: "space-between",
|
|
109
109
|
className: "label-list-title",
|
|
110
110
|
children: [/* @__PURE__ */ a("span", {
|
|
@@ -112,10 +112,10 @@ const fe = oe(({
|
|
|
112
112
|
children: "标签列表"
|
|
113
113
|
}), /* @__PURE__ */ a("span", {
|
|
114
114
|
className: "label-list-icon",
|
|
115
|
-
children: !
|
|
115
|
+
children: !j && f && f.visible && /* @__PURE__ */ a(F, {
|
|
116
116
|
isPreLabel: v,
|
|
117
117
|
placement: "topRight",
|
|
118
|
-
children: /* @__PURE__ */ a(
|
|
118
|
+
children: /* @__PURE__ */ a(Z, {
|
|
119
119
|
type: w ? "link" : "text",
|
|
120
120
|
size: "small",
|
|
121
121
|
onClick: () => J(!w),
|
|
@@ -126,11 +126,11 @@ const fe = oe(({
|
|
|
126
126
|
})
|
|
127
127
|
})
|
|
128
128
|
})]
|
|
129
|
-
}), /* @__PURE__ */ h(
|
|
129
|
+
}), /* @__PURE__ */ h(U, {
|
|
130
130
|
className: "label-list-opration",
|
|
131
|
-
children: [!
|
|
131
|
+
children: [!j && f && f.add && /* @__PURE__ */ a(F, {
|
|
132
132
|
isPreLabel: v,
|
|
133
|
-
children: /* @__PURE__ */ a(
|
|
133
|
+
children: /* @__PURE__ */ a(Z, {
|
|
134
134
|
className: "label-list-create",
|
|
135
135
|
type: "default",
|
|
136
136
|
icon: /* @__PURE__ */ a(ce, {}),
|
|
@@ -148,14 +148,14 @@ const fe = oe(({
|
|
|
148
148
|
placeholder: "请输入标签名称搜索",
|
|
149
149
|
onSearch: V,
|
|
150
150
|
onChange: (e) => {
|
|
151
|
-
|
|
151
|
+
R(e.target.value);
|
|
152
152
|
}
|
|
153
153
|
})
|
|
154
154
|
})]
|
|
155
155
|
}), /* @__PURE__ */ h(ie, {
|
|
156
156
|
direction: "vertical",
|
|
157
157
|
className: "label-list",
|
|
158
|
-
children: [x && /* @__PURE__ */ a(
|
|
158
|
+
children: [x && /* @__PURE__ */ a(q, {
|
|
159
159
|
onSave: K,
|
|
160
160
|
onCancel: () => {
|
|
161
161
|
S(null);
|
|
@@ -170,25 +170,25 @@ const fe = oe(({
|
|
|
170
170
|
}
|
|
171
171
|
}), b.length ? b.reverse().map((e, t) => {
|
|
172
172
|
var l;
|
|
173
|
-
return /* @__PURE__ */ a(
|
|
173
|
+
return /* @__PURE__ */ a(q, {
|
|
174
174
|
isActive: n.some((c) => (c == null ? void 0 : c.id) === e.id),
|
|
175
175
|
editable: w,
|
|
176
|
-
shortcut: t < 10 ? t.toString() : void 0,
|
|
177
|
-
extra:
|
|
176
|
+
shortcut: M && t < 10 ? t.toString() : void 0,
|
|
177
|
+
extra: M ? t < 10 ? /* @__PURE__ */ h("span", {
|
|
178
178
|
className: "shortcut",
|
|
179
179
|
children: ["快捷键", t]
|
|
180
180
|
}) : null : ((l = o.find((c) => c.label === e.label)) == null ? void 0 : l.count) || 0,
|
|
181
181
|
label: e.label,
|
|
182
182
|
color: e.color,
|
|
183
183
|
onClick: () => {
|
|
184
|
-
Q(e),
|
|
184
|
+
Q(e), C && C(e);
|
|
185
185
|
},
|
|
186
186
|
onSave: f && f.edit ? (c) => W(g(N({}, e), {
|
|
187
187
|
label: c
|
|
188
188
|
})) : void 0,
|
|
189
189
|
onDelete: f && f.delete ? () => X(e.id) : void 0,
|
|
190
190
|
onCheckDuplication: (c) => {
|
|
191
|
-
const Y = b.findIndex((
|
|
191
|
+
const Y = b.findIndex((O) => O.label === c && e.id !== O.id);
|
|
192
192
|
return Promise.resolve(Y > -1);
|
|
193
193
|
}
|
|
194
194
|
}, e.id);
|