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