@glodon-aiot/dataset-annotation 3.23.0-alpha.3 → 3.23.0-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,127 +1,130 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
for (var
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var
|
|
10
|
-
|
|
1
|
+
var ee = Object.defineProperty, le = Object.defineProperties;
|
|
2
|
+
var te = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var U = Object.getOwnPropertySymbols;
|
|
4
|
+
var ie = Object.prototype.hasOwnProperty, re = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var Z = (i, n, c) => n in i ? ee(i, n, { enumerable: !0, configurable: !0, writable: !0, value: c }) : i[n] = c, g = (i, n) => {
|
|
6
|
+
for (var c in n || (n = {}))
|
|
7
|
+
ie.call(n, c) && Z(i, c, n[c]);
|
|
8
|
+
if (U)
|
|
9
|
+
for (var c of U(n))
|
|
10
|
+
re.call(n, c) && Z(i, c, n[c]);
|
|
11
11
|
return i;
|
|
12
|
-
}, A = (i, n) =>
|
|
13
|
-
import { jsxs as p, jsx as r, Fragment as
|
|
14
|
-
import { Row as
|
|
15
|
-
import { forwardRef as
|
|
16
|
-
import
|
|
12
|
+
}, A = (i, n) => le(i, te(n));
|
|
13
|
+
import { jsxs as p, jsx as r, Fragment as ne } from "react/jsx-runtime";
|
|
14
|
+
import { Row as $, Button as q, Input as oe, Space as se, Empty as ce, Modal as ae, Tooltip as de } from "antd";
|
|
15
|
+
import { forwardRef as fe, useState as h, useContext as me, useEffect as M, useImperativeHandle as pe } from "react";
|
|
16
|
+
import G from "../TagItem/index.mjs";
|
|
17
17
|
import "./style.less.mjs";
|
|
18
|
-
import { PlusOutlined as
|
|
19
|
-
import
|
|
20
|
-
import
|
|
18
|
+
import { PlusOutlined as ue } from "@ant-design/icons";
|
|
19
|
+
import H from "../DisabledTooltip/index.mjs";
|
|
20
|
+
import he from "../../../../DatasetContext/index.mjs";
|
|
21
21
|
import { tagColors as T } from "../../../../utils/index.mjs";
|
|
22
|
-
import { formatCount as
|
|
22
|
+
import { formatCount as xe } from "../../../../utils/formatCount.mjs";
|
|
23
23
|
import be from "../../../Iconfont/index.mjs";
|
|
24
|
-
const
|
|
24
|
+
const ve = fe(({
|
|
25
25
|
datasetId: i,
|
|
26
26
|
data: n,
|
|
27
|
-
selected:
|
|
28
|
-
showZero:
|
|
27
|
+
selected: c = [],
|
|
28
|
+
showZero: Ne = !0,
|
|
29
29
|
shortcut: C = !1,
|
|
30
|
-
showStatColumns:
|
|
31
|
-
selectMode:
|
|
30
|
+
showStatColumns: S = !1,
|
|
31
|
+
selectMode: J = "multiple",
|
|
32
32
|
onItemClick: E,
|
|
33
33
|
onSelectedChange: j,
|
|
34
34
|
onListChange: u,
|
|
35
|
-
isPreLabel:
|
|
35
|
+
isPreLabel: b = !1,
|
|
36
36
|
settingHide: z = !1
|
|
37
|
-
},
|
|
38
|
-
const [s,
|
|
37
|
+
}, K) => {
|
|
38
|
+
const [s, D] = h([]), [ge, R] = h(!1), [o, x] = h([]), [O, P] = h(""), [v, w] = h(null), [y, Q] = h(!1), {
|
|
39
39
|
services: {
|
|
40
|
-
cvforceDatahub:
|
|
40
|
+
cvforceDatahub: d
|
|
41
41
|
},
|
|
42
42
|
featuresConfig: {
|
|
43
|
-
labelManager:
|
|
43
|
+
labelManager: f
|
|
44
44
|
} = {
|
|
45
45
|
labelManager: !1
|
|
46
46
|
}
|
|
47
|
-
} =
|
|
47
|
+
} = me(he);
|
|
48
48
|
M(() => {
|
|
49
|
-
o.length &&
|
|
50
|
-
}, [
|
|
49
|
+
o.length && D(c.map((e) => o.find((l) => l.id === e.id)));
|
|
50
|
+
}, [c, o]), M(() => {
|
|
51
51
|
i && k();
|
|
52
52
|
}, [i]), M(() => {
|
|
53
|
-
!i && n &&
|
|
53
|
+
!i && n && x(n.map((e) => A(g({}, e), {
|
|
54
54
|
createdAt: 0,
|
|
55
55
|
updatedAt: 0
|
|
56
56
|
})));
|
|
57
57
|
}, [i, n]);
|
|
58
58
|
const k = () => {
|
|
59
|
-
!i || !
|
|
59
|
+
!i || !d || (R(!0), d.listLabels(i, {
|
|
60
60
|
pageNo: 1,
|
|
61
61
|
pageSize: 1e4
|
|
62
62
|
}).then((e) => {
|
|
63
|
-
|
|
63
|
+
x(e.recordList.sort((l, t) => l.createdAt - t.createdAt > 0 ? -1 : l.createdAt - t.createdAt < 0 ? 1 : 0).map((l, t) => A(g({}, l), {
|
|
64
64
|
color: T[t % 40]
|
|
65
65
|
})));
|
|
66
66
|
}).finally(() => R(!1)));
|
|
67
67
|
};
|
|
68
|
-
|
|
68
|
+
pe(K, () => ({
|
|
69
69
|
fetchLabels: k
|
|
70
70
|
}));
|
|
71
|
-
const
|
|
71
|
+
const V = (e) => !i || !d ? Promise.resolve(!1) : d.postLabels(i, {
|
|
72
72
|
labels: [{
|
|
73
73
|
label: e
|
|
74
74
|
}]
|
|
75
75
|
}).then((l) => {
|
|
76
|
-
|
|
76
|
+
x([...o, {
|
|
77
77
|
label: e,
|
|
78
78
|
id: l[0],
|
|
79
79
|
color: T[o.length % 40],
|
|
80
80
|
createdAt: Date.now(),
|
|
81
81
|
updatedAt: Date.now()
|
|
82
82
|
}]), w(null), u && u([...o]);
|
|
83
|
-
}).then(() => !0).catch(() => !1),
|
|
83
|
+
}).then(() => !0).catch(() => !1), W = (e) => {
|
|
84
84
|
let l = [];
|
|
85
|
-
|
|
86
|
-
}, W = (e) => {
|
|
87
|
-
P(e);
|
|
85
|
+
J === "multiple" ? s != null && s.some((t) => t.id === e.id) ? l = s == null ? void 0 : s.filter((t) => t.id !== e.id) : l = [...s, e] : s != null && s.some((t) => t.id === e.id) ? l = [] : l = [e], D(l), j && j(l);
|
|
88
86
|
}, X = (e) => {
|
|
89
|
-
|
|
87
|
+
P(e);
|
|
88
|
+
}, Y = (e) => {
|
|
89
|
+
if (!i || !d)
|
|
90
90
|
return Promise.resolve(!1);
|
|
91
91
|
const l = o.findIndex((t) => t.id === e.id);
|
|
92
|
-
return
|
|
93
|
-
},
|
|
92
|
+
return d.patchLabel(i, e.id, e).then(() => (l < 0 || (o[l] = e, x([...o]), u && u([...o])), !0)).catch(() => !1);
|
|
93
|
+
}, _ = (e) => {
|
|
94
94
|
ae.confirm({
|
|
95
95
|
title: "确认要删除当前标签吗?",
|
|
96
96
|
content: "删除后,将会删除当前数据集中所有与当前标签关联的数据,删除后无法恢复,请确认是否删除!",
|
|
97
97
|
onOk: () => {
|
|
98
|
-
if (!i || !
|
|
98
|
+
if (!i || !d)
|
|
99
99
|
return;
|
|
100
|
-
const l = o.findIndex((
|
|
101
|
-
return
|
|
102
|
-
t > -1 && (s.splice(t, 1),
|
|
100
|
+
const l = o.findIndex((a) => a.id === e), t = s.findIndex((a) => a.id === e);
|
|
101
|
+
return d.deleteLabel(i, e).then(() => {
|
|
102
|
+
t > -1 && (s.splice(t, 1), D([...s])), o.splice(l, 1), x([...o]), u && u([...o]), k();
|
|
103
103
|
});
|
|
104
104
|
}
|
|
105
105
|
});
|
|
106
|
-
}, N = (o == null ? void 0 : o.filter((e) => !O || e.label.includes(O))) || [],
|
|
107
|
-
var
|
|
108
|
-
|
|
109
|
-
|
|
106
|
+
}, N = (o == null ? void 0 : o.filter((e) => !O || e.label.includes(O))) || [], B = (e) => {
|
|
107
|
+
var l;
|
|
108
|
+
return (l = n.find((t) => t.id && t.id === e.id)) != null ? l : n.find((t) => t.label === e.label);
|
|
109
|
+
}, I = (e) => {
|
|
110
|
+
var t, a;
|
|
111
|
+
const l = xe((t = e == null ? void 0 : e.boxCount) != null ? t : 0);
|
|
112
|
+
return /* @__PURE__ */ p(ne, {
|
|
110
113
|
children: [/* @__PURE__ */ r("span", {
|
|
111
114
|
className: "label-stat-col",
|
|
112
|
-
children: l.exact ? /* @__PURE__ */ r(
|
|
115
|
+
children: l.exact ? /* @__PURE__ */ r(de, {
|
|
113
116
|
title: l.exact,
|
|
114
117
|
children: l.text
|
|
115
118
|
}) : l.text
|
|
116
119
|
}), /* @__PURE__ */ r("span", {
|
|
117
120
|
className: "label-stat-col",
|
|
118
|
-
children: (
|
|
121
|
+
children: (a = e == null ? void 0 : e.count) != null ? a : 0
|
|
119
122
|
})]
|
|
120
123
|
});
|
|
121
124
|
};
|
|
122
125
|
return /* @__PURE__ */ p("div", {
|
|
123
|
-
className: `label-list-wrap${
|
|
124
|
-
children: [/* @__PURE__ */ p(
|
|
126
|
+
className: `label-list-wrap${S ? " label-list-wrap--stats" : ""}`,
|
|
127
|
+
children: [/* @__PURE__ */ p($, {
|
|
125
128
|
justify: "space-between",
|
|
126
129
|
className: "label-list-title",
|
|
127
130
|
children: [/* @__PURE__ */ r("span", {
|
|
@@ -129,29 +132,29 @@ const xe = de(({
|
|
|
129
132
|
children: "标签列表"
|
|
130
133
|
}), /* @__PURE__ */ r("span", {
|
|
131
134
|
className: "label-list-icon",
|
|
132
|
-
children: !z &&
|
|
133
|
-
isPreLabel:
|
|
135
|
+
children: !z && f && f.visible && /* @__PURE__ */ r(H, {
|
|
136
|
+
isPreLabel: b,
|
|
134
137
|
placement: "topRight",
|
|
135
|
-
children: /* @__PURE__ */ r(
|
|
138
|
+
children: /* @__PURE__ */ r(q, {
|
|
136
139
|
type: y ? "link" : "text",
|
|
137
140
|
size: "small",
|
|
138
|
-
onClick: () =>
|
|
141
|
+
onClick: () => Q(!y),
|
|
139
142
|
icon: /* @__PURE__ */ r(be, {
|
|
140
143
|
type: "icon-shezhi"
|
|
141
144
|
}),
|
|
142
|
-
disabled:
|
|
145
|
+
disabled: b
|
|
143
146
|
})
|
|
144
147
|
})
|
|
145
148
|
})]
|
|
146
|
-
}), /* @__PURE__ */ p(
|
|
149
|
+
}), /* @__PURE__ */ p($, {
|
|
147
150
|
className: "label-list-opration",
|
|
148
|
-
children: [!z &&
|
|
149
|
-
isPreLabel:
|
|
150
|
-
children: /* @__PURE__ */ r(
|
|
151
|
+
children: [!z && f && f.add && /* @__PURE__ */ r(H, {
|
|
152
|
+
isPreLabel: b,
|
|
153
|
+
children: /* @__PURE__ */ r(q, {
|
|
151
154
|
className: "label-list-create",
|
|
152
155
|
type: "default",
|
|
153
|
-
icon: /* @__PURE__ */ r(
|
|
154
|
-
disabled: v !== null ||
|
|
156
|
+
icon: /* @__PURE__ */ r(ue, {}),
|
|
157
|
+
disabled: v !== null || b,
|
|
155
158
|
onClick: () => {
|
|
156
159
|
w({
|
|
157
160
|
color: T[o.length % 40],
|
|
@@ -161,15 +164,15 @@ const xe = de(({
|
|
|
161
164
|
})
|
|
162
165
|
}), /* @__PURE__ */ r("span", {
|
|
163
166
|
className: "label-list-search",
|
|
164
|
-
children: /* @__PURE__ */ r(
|
|
167
|
+
children: /* @__PURE__ */ r(oe.Search, {
|
|
165
168
|
placeholder: "请输入标签名称搜索",
|
|
166
|
-
onSearch:
|
|
169
|
+
onSearch: X,
|
|
167
170
|
onChange: (e) => {
|
|
168
171
|
P(e.target.value);
|
|
169
172
|
}
|
|
170
173
|
})
|
|
171
174
|
})]
|
|
172
|
-
}),
|
|
175
|
+
}), S && /* @__PURE__ */ p("div", {
|
|
173
176
|
className: "label-list-header",
|
|
174
177
|
children: [/* @__PURE__ */ r("span", {
|
|
175
178
|
className: "label-list-header-name",
|
|
@@ -181,11 +184,11 @@ const xe = de(({
|
|
|
181
184
|
className: "label-stat-col",
|
|
182
185
|
children: "图片数"
|
|
183
186
|
})]
|
|
184
|
-
}), /* @__PURE__ */ p(
|
|
187
|
+
}), /* @__PURE__ */ p(se, {
|
|
185
188
|
direction: "vertical",
|
|
186
189
|
className: "label-list",
|
|
187
|
-
children: [v && /* @__PURE__ */ r(
|
|
188
|
-
onSave:
|
|
190
|
+
children: [v && /* @__PURE__ */ r(G, {
|
|
191
|
+
onSave: V,
|
|
189
192
|
onCancel: () => {
|
|
190
193
|
w(null);
|
|
191
194
|
},
|
|
@@ -198,30 +201,30 @@ const xe = de(({
|
|
|
198
201
|
return Promise.resolve(l > -1);
|
|
199
202
|
}
|
|
200
203
|
}), N.length ? N.reverse().map((e, l) => {
|
|
201
|
-
var t,
|
|
202
|
-
return /* @__PURE__ */ r(
|
|
203
|
-
isActive: s.some((
|
|
204
|
+
var t, a;
|
|
205
|
+
return /* @__PURE__ */ r(G, {
|
|
206
|
+
isActive: s.some((m) => (m == null ? void 0 : m.id) === e.id),
|
|
204
207
|
editable: y,
|
|
205
208
|
shortcut: C && l < 10 ? l.toString() : void 0,
|
|
206
209
|
extra: C ? l < 10 ? /* @__PURE__ */ p("span", {
|
|
207
210
|
className: "shortcut",
|
|
208
211
|
children: ["快捷键", l]
|
|
209
|
-
}) : null :
|
|
212
|
+
}) : null : S ? I(B(e)) : (a = (t = B(e)) == null ? void 0 : t.count) != null ? a : 0,
|
|
210
213
|
label: e.label,
|
|
211
214
|
color: e.color,
|
|
212
215
|
onClick: () => {
|
|
213
|
-
|
|
216
|
+
W(e), E && E(e);
|
|
214
217
|
},
|
|
215
|
-
onSave:
|
|
216
|
-
label:
|
|
218
|
+
onSave: f && f.edit ? (m) => Y(A(g({}, e), {
|
|
219
|
+
label: m
|
|
217
220
|
})) : void 0,
|
|
218
|
-
onDelete:
|
|
219
|
-
onCheckDuplication: (
|
|
220
|
-
const
|
|
221
|
-
return Promise.resolve(
|
|
221
|
+
onDelete: f && f.delete ? () => _(e.id) : void 0,
|
|
222
|
+
onCheckDuplication: (m) => {
|
|
223
|
+
const L = N.findIndex((F) => F.label === m && e.id !== F.id);
|
|
224
|
+
return Promise.resolve(L > -1);
|
|
222
225
|
}
|
|
223
226
|
}, e.id);
|
|
224
|
-
}) : /* @__PURE__ */ r(
|
|
227
|
+
}) : /* @__PURE__ */ r(ce, {
|
|
225
228
|
className: "label-list-empty",
|
|
226
229
|
image: !1,
|
|
227
230
|
description: "请先添加标签,然后在图中框选标注"
|
|
@@ -229,7 +232,7 @@ const xe = de(({
|
|
|
229
232
|
})]
|
|
230
233
|
});
|
|
231
234
|
});
|
|
232
|
-
|
|
235
|
+
ve.displayName = "Labels";
|
|
233
236
|
export {
|
|
234
|
-
|
|
237
|
+
ve as default
|
|
235
238
|
};
|