@glodon-aiot/dataset-annotation 3.24.0-alpha.6 → 3.25.0-alpha.10
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/ClassificationAnnotation/index.mjs +399 -343
- package/dist/es/components/DetectionAnnotation/components/ImageDetail/index.mjs +82 -78
- package/dist/es/components/DetectionAnnotation/components/ImageModal/index.mjs +28 -26
- package/dist/es/components/DetectionAnnotation/components/LabelMaker/index.mjs +173 -166
- package/dist/es/components/DetectionAnnotation/index.mjs +607 -590
- package/dist/es/components/OcrAnnotation/OCRBoxDetail/index.mjs +249 -230
- package/dist/es/components/OcrAnnotation/OcrModal/index.mjs +103 -98
- package/dist/es/components/OcrAnnotation/index.mjs +281 -243
- package/dist/es/components/VLMAnnotationDetail/VLMDetail/index.mjs +304 -298
- package/dist/es/components/VLMAnnotationDetail/VlmModal/index.mjs +86 -83
- package/dist/es/components/VLMAnnotationDetail/index.mjs +386 -300
- package/dist/es/index.mjs +1 -1
- package/dist/es/utils/checkVlmSampleLabeled.mjs +7 -0
- package/dist/es/utils/scrollSampleIntoView.mjs +16 -0
- package/dist/lib/index.js +4 -4
- package/dist/src/components/DetectionAnnotation/components/ImageDetail/index.d.ts +2 -0
- package/dist/src/components/DetectionAnnotation/components/ImageModal/index.d.ts +2 -0
- package/dist/src/components/OcrAnnotation/OCRBoxDetail/index.d.ts +2 -0
- package/dist/src/components/OcrAnnotation/OcrModal/index.d.ts +1 -0
- package/dist/src/components/VLMAnnotationDetail/VLMDetail/index.d.ts +7 -0
- package/dist/src/components/VLMAnnotationDetail/VlmModal/index.d.ts +6 -1
- package/dist/src/utils/checkVlmSampleLabeled.d.ts +8 -0
- package/dist/src/utils/scrollSampleIntoView.d.ts +9 -0
- package/package.json +2 -2
|
@@ -1,297 +1,303 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
for (var
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var
|
|
10
|
-
|
|
1
|
+
var pt = Object.defineProperty, xt = Object.defineProperties;
|
|
2
|
+
var vt = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var Ze = Object.getOwnPropertySymbols;
|
|
4
|
+
var yt = Object.prototype.hasOwnProperty, Ct = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var _e = (k, y, f) => y in k ? pt(k, y, { enumerable: !0, configurable: !0, writable: !0, value: f }) : k[y] = f, D = (k, y) => {
|
|
6
|
+
for (var f in y || (y = {}))
|
|
7
|
+
yt.call(y, f) && _e(k, f, y[f]);
|
|
8
|
+
if (Ze)
|
|
9
|
+
for (var f of Ze(y))
|
|
10
|
+
Ct.call(y, f) && _e(k, f, y[f]);
|
|
11
11
|
return k;
|
|
12
|
-
},
|
|
13
|
-
var L = (k,
|
|
12
|
+
}, F = (k, y) => xt(k, vt(y));
|
|
13
|
+
var L = (k, y, f) => new Promise((N, h) => {
|
|
14
14
|
var x = (C) => {
|
|
15
15
|
try {
|
|
16
|
-
|
|
17
|
-
} catch (
|
|
18
|
-
|
|
16
|
+
_(f.next(C));
|
|
17
|
+
} catch (B) {
|
|
18
|
+
h(B);
|
|
19
19
|
}
|
|
20
|
-
},
|
|
20
|
+
}, le = (C) => {
|
|
21
21
|
try {
|
|
22
|
-
|
|
23
|
-
} catch (
|
|
24
|
-
|
|
22
|
+
_(f.throw(C));
|
|
23
|
+
} catch (B) {
|
|
24
|
+
h(B);
|
|
25
25
|
}
|
|
26
|
-
},
|
|
27
|
-
|
|
26
|
+
}, _ = (C) => C.done ? N(C.value) : Promise.resolve(C.value).then(x, le);
|
|
27
|
+
_((f = f.apply(k, y)).next());
|
|
28
28
|
});
|
|
29
|
-
import { jsxs as H, jsx as
|
|
30
|
-
import { Tabs as
|
|
31
|
-
import { forwardRef as
|
|
32
|
-
import { useKeyPress as
|
|
29
|
+
import { jsxs as H, jsx as c, Fragment as et } from "react/jsx-runtime";
|
|
30
|
+
import { Tabs as ze, message as P, Spin as St, Space as tt, Button as pe, Modal as nt } from "antd";
|
|
31
|
+
import { forwardRef as wt, useContext as It, useMemo as kt, useRef as U, useState as g, useEffect as Y, useImperativeHandle as At } from "react";
|
|
32
|
+
import { useKeyPress as it } from "ahooks";
|
|
33
33
|
import "./style.less.mjs";
|
|
34
|
-
import
|
|
35
|
-
import
|
|
36
|
-
import
|
|
37
|
-
import
|
|
38
|
-
import
|
|
39
|
-
import
|
|
40
|
-
import { createTokenResolver as
|
|
41
|
-
import
|
|
34
|
+
import bt from "../../DataEmpty/index.mjs";
|
|
35
|
+
import Rt from "../../../DatasetContext/index.mjs";
|
|
36
|
+
import Tt from "../../VLMAnnotation/index.mjs";
|
|
37
|
+
import Vt from "axios";
|
|
38
|
+
import Dt from "../MarkVLMBoxModal/AttributeDetail/index.mjs";
|
|
39
|
+
import Lt from "../MarkVLMBoxModal/QADetail/index.mjs";
|
|
40
|
+
import { createTokenResolver as Nt } from "../../../utils/index.mjs";
|
|
41
|
+
import { checkVlmSampleLabeled as zt } from "../../../utils/checkVlmSampleLabeled.mjs";
|
|
42
|
+
import Mt from "../../VQAAnnotation/index.mjs";
|
|
42
43
|
const {
|
|
43
|
-
TabPane:
|
|
44
|
-
} =
|
|
44
|
+
TabPane: Z
|
|
45
|
+
} = ze, Zt = wt((k, y) => {
|
|
45
46
|
const {
|
|
46
|
-
visible:
|
|
47
|
+
visible: f,
|
|
47
48
|
selectSampleId: N,
|
|
48
|
-
datasetId:
|
|
49
|
+
datasetId: h,
|
|
49
50
|
versionId: x,
|
|
50
|
-
vlmMarkTmpl:
|
|
51
|
-
onClose:
|
|
51
|
+
vlmMarkTmpl: le,
|
|
52
|
+
onClose: _,
|
|
52
53
|
onSave: C,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}, {
|
|
54
|
+
onDeleteSample: B,
|
|
55
|
+
externalSamples: E,
|
|
56
|
+
externalPagination: xe,
|
|
57
|
+
externalCurrentIndex: ve,
|
|
58
|
+
externalFilterMode: Me,
|
|
59
|
+
onFilterModeChange: ye,
|
|
60
|
+
onCurrentSampleChange: Ce
|
|
61
|
+
} = k, Q = le === "VQA", G = (t) => zt(t, le), {
|
|
62
62
|
services: {
|
|
63
63
|
cvforceDatahub: d
|
|
64
64
|
},
|
|
65
|
-
token:
|
|
66
|
-
getToken:
|
|
67
|
-
apiUrl:
|
|
65
|
+
token: qe,
|
|
66
|
+
getToken: Pe,
|
|
67
|
+
apiUrl: Ue,
|
|
68
68
|
featuresConfig: {
|
|
69
|
-
datasetManager:
|
|
69
|
+
datasetManager: Ee
|
|
70
70
|
} = {
|
|
71
71
|
datasetManager: !1
|
|
72
72
|
}
|
|
73
|
-
} =
|
|
73
|
+
} = It(Rt), rt = kt(() => Nt(qe, Pe), [qe, Pe]), O = U(null), [i, S] = g(), w = U(void 0), [qt, Se] = g(0), [u, $] = g(() => N && (E != null && E.length) ? E : []), [A, z] = g(() => N && ve !== void 0 ? ve : -1), [a, M] = g(() => N && xe ? D({}, xe) : {
|
|
74
74
|
current: 1,
|
|
75
75
|
pageSize: 100
|
|
76
|
-
}), [
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
76
|
+
}), [Ge, $e] = g(0), [Fe, Qe] = g(0), [m, de] = g(() => N && Me ? Me : N ? "" : "nocode"), [we, X] = g(), ee = U({}), [Ie, je] = g([]), [p, fe] = g("textAnnotation"), [W, K] = g(), [te, b] = g(!1), ue = U(0), ke = U(0), [Ae, ot] = g(!1), [ne, ge] = g(!1), [he, be] = g(!1), [Re, Be] = g(!1), [ie, Te] = g(!1), j = U(null), V = U(null), me = U(null), Ve = U(!1), De = U(!1), [at, st] = g(() => Date.now()), [ct, lt] = g(() => Date.now());
|
|
77
|
+
Y(() => {
|
|
78
|
+
f && (!h || !x || Q || d == null || d.getDatasetsIdVersionsVidConfigs(h, x).then((t) => {
|
|
79
|
+
je(t || []), (t == null ? void 0 : t.length) > 0 ? fe("textAnnotation") : fe("attributeDefinition");
|
|
80
80
|
}));
|
|
81
|
-
}, [
|
|
82
|
-
const t =
|
|
83
|
-
if (!
|
|
81
|
+
}, [f]), Y(() => {
|
|
82
|
+
const t = a.current || 1, e = a.pageSize || 100, n = a.type;
|
|
83
|
+
if (!h || !x)
|
|
84
84
|
return;
|
|
85
85
|
if (De.current) {
|
|
86
86
|
De.current = !1;
|
|
87
87
|
return;
|
|
88
88
|
}
|
|
89
|
-
if (!
|
|
90
|
-
const
|
|
91
|
-
if (
|
|
92
|
-
|
|
89
|
+
if (!Ve.current && N && (E != null && E.length) && xe && ve !== void 0) {
|
|
90
|
+
const oe = E.find((T) => T.id === N);
|
|
91
|
+
if (oe) {
|
|
92
|
+
Ve.current = !0, S(oe), Se(E.length), R();
|
|
93
93
|
return;
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
const
|
|
99
|
-
d == null || d.getDatasetsIdVersionsVidSamples(
|
|
100
|
-
labels:
|
|
101
|
-
pageNo:
|
|
102
|
-
pageSize:
|
|
103
|
-
}).then((
|
|
104
|
-
var
|
|
105
|
-
if (
|
|
96
|
+
const r = ++ue.current;
|
|
97
|
+
be(!0);
|
|
98
|
+
const o = u || [], v = Ve.current ? we : N || we, l = ee.current[m], s = l == null ? void 0 : l.index, I = l == null ? void 0 : l.page, re = !n && !v && !!I && I > 1, We = re ? 1 : t, ht = re ? I * e : e;
|
|
99
|
+
d == null || d.getDatasetsIdVersionsVidSamples(h, x, {
|
|
100
|
+
labels: m ? [m] : void 0,
|
|
101
|
+
pageNo: We,
|
|
102
|
+
pageSize: ht
|
|
103
|
+
}).then((oe) => {
|
|
104
|
+
var Ye;
|
|
105
|
+
if (r !== ue.current)
|
|
106
106
|
return;
|
|
107
|
-
const T =
|
|
108
|
-
$(q),
|
|
109
|
-
const
|
|
110
|
-
if (
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
index:
|
|
114
|
-
page:
|
|
107
|
+
const T = oe.recordList || [], q = We === 1 && !n ? T : n === "prev" ? [...T, ...o] : n === "next" ? [...o, ...T] : T;
|
|
108
|
+
$(q), re && (De.current = !0);
|
|
109
|
+
const Je = (Ye = oe.totalResults) != null ? Ye : 0, Ne = Math.max(1, Math.ceil(Je / e) || 1), mt = Math.min(re ? I : t, Ne);
|
|
110
|
+
if (re && I != null && I > Ne) {
|
|
111
|
+
const se = Math.min(s != null ? s : 0, Math.max(0, q.length - 1));
|
|
112
|
+
ee.current[m] = {
|
|
113
|
+
index: se,
|
|
114
|
+
page: Ne
|
|
115
115
|
};
|
|
116
116
|
}
|
|
117
|
-
M(
|
|
118
|
-
current:
|
|
117
|
+
M(F(D({}, a), {
|
|
118
|
+
current: mt,
|
|
119
119
|
pageSize: e,
|
|
120
|
-
total:
|
|
120
|
+
total: Je,
|
|
121
121
|
type: void 0
|
|
122
122
|
}));
|
|
123
|
-
let
|
|
123
|
+
let ae = 0, J = q[0];
|
|
124
124
|
if (n === "next" && T.length)
|
|
125
|
-
|
|
125
|
+
ae = o.length, J = T[0];
|
|
126
126
|
else if (n === "prev" && T.length)
|
|
127
|
-
|
|
128
|
-
else if (
|
|
129
|
-
const
|
|
130
|
-
if (
|
|
131
|
-
|
|
127
|
+
ae = T.length - 1, J = T[T.length - 1];
|
|
128
|
+
else if (v) {
|
|
129
|
+
const se = q.findIndex((ce) => ce.id === v);
|
|
130
|
+
if (se !== -1)
|
|
131
|
+
ae = se, J = q[se];
|
|
132
132
|
else {
|
|
133
|
-
d == null || d.getDatasetsIdVersionsVidSsamplesSid(
|
|
134
|
-
|
|
133
|
+
d == null || d.getDatasetsIdVersionsVidSsamplesSid(h, x, v).then((ce) => {
|
|
134
|
+
r === ue.current && ce && ($([ce, ...q]), S(ce), z(0), Se(q.length + 1), X(void 0));
|
|
135
135
|
});
|
|
136
136
|
return;
|
|
137
137
|
}
|
|
138
138
|
} else
|
|
139
|
-
|
|
140
|
-
J && (
|
|
139
|
+
s !== void 0 && s >= 0 && s < q.length && (ae = s, J = q[s]);
|
|
140
|
+
J && (S(J), z(ae), Se(q.length), we && X(void 0));
|
|
141
141
|
}).finally(() => {
|
|
142
|
-
|
|
142
|
+
r === ue.current && be(!1);
|
|
143
143
|
}), R();
|
|
144
|
-
}, [
|
|
144
|
+
}, [a.current, m, h, x]), Y(() => {
|
|
145
|
+
!(i != null && i.id) || A < 0 || Ce == null || Ce({
|
|
146
|
+
id: i.id,
|
|
147
|
+
index: A,
|
|
148
|
+
page: a.current || 1
|
|
149
|
+
});
|
|
150
|
+
}, [i == null ? void 0 : i.id, A, a.current]);
|
|
145
151
|
const R = () => {
|
|
146
|
-
!
|
|
147
|
-
const e = t.find((
|
|
148
|
-
|
|
152
|
+
!h || !x || d == null || d.getDatasetsIdVersionsVidLabelcount(h, x).then((t) => {
|
|
153
|
+
const e = t.find((r) => r.id === "allcodeid"), n = t.find((r) => r.id === "nocodeid");
|
|
154
|
+
$e(e ? e.count : 0), Qe(n ? n.count : 0);
|
|
149
155
|
});
|
|
150
|
-
},
|
|
151
|
-
|
|
152
|
-
const e =
|
|
153
|
-
let
|
|
156
|
+
}, Le = () => {
|
|
157
|
+
u && $((t) => {
|
|
158
|
+
const e = w.current || i, n = [...t];
|
|
159
|
+
let r;
|
|
154
160
|
if (e) {
|
|
155
|
-
const
|
|
156
|
-
|
|
161
|
+
const l = n.findIndex((s) => s.id === e.id);
|
|
162
|
+
l > -1 && n.splice(l, 1, e);
|
|
157
163
|
}
|
|
158
|
-
const
|
|
159
|
-
if (e && (G(e) &&
|
|
160
|
-
const
|
|
161
|
-
|
|
162
|
-
total:
|
|
164
|
+
const o = !e || G(e) && m === "hascode" || !G(e) && m === "nocode" || m === "" ? A + 1 : A;
|
|
165
|
+
if (e && (G(e) && m === "nocode" || !G(e) && m === "hascode")) {
|
|
166
|
+
const l = n.findIndex((s) => s.id === e.id);
|
|
167
|
+
l > -1 && (n.splice(l, 1), r = [...n], M((s) => F(D({}, s), {
|
|
168
|
+
total: s.total ? s.total - 1 : s.total
|
|
163
169
|
})));
|
|
164
170
|
}
|
|
165
|
-
const
|
|
166
|
-
return
|
|
167
|
-
current:
|
|
168
|
-
pageSize:
|
|
171
|
+
const v = r || n;
|
|
172
|
+
return o >= v.length ? ((a.current - 1) * a.pageSize + o, a.total && o >= a.total ? P.error("已经是最后一个了") : M({
|
|
173
|
+
current: a.current + 1,
|
|
174
|
+
pageSize: a.pageSize,
|
|
169
175
|
type: "next"
|
|
170
176
|
})) : setTimeout(() => {
|
|
171
|
-
z(
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
}, 0),
|
|
177
|
+
z(o);
|
|
178
|
+
const l = v[o];
|
|
179
|
+
S(l);
|
|
180
|
+
}, 0), v;
|
|
175
181
|
});
|
|
176
|
-
},
|
|
177
|
-
if (!
|
|
182
|
+
}, Ke = () => {
|
|
183
|
+
if (!u)
|
|
178
184
|
return;
|
|
179
|
-
const t =
|
|
185
|
+
const t = w.current || i, e = [...u];
|
|
180
186
|
let n;
|
|
181
|
-
if (t &&
|
|
182
|
-
const
|
|
183
|
-
if (
|
|
184
|
-
const
|
|
185
|
-
|
|
186
|
-
total:
|
|
187
|
+
if (t && u) {
|
|
188
|
+
const v = e.findIndex((l) => l.id === t.id);
|
|
189
|
+
if (v > -1 && e.splice(v, 1, t), G(t) && m === "nocode" || !G(t) && m === "hascode") {
|
|
190
|
+
const l = e.findIndex((s) => s.id === t.id);
|
|
191
|
+
l > -1 && (e.splice(l, 1), n = [...e], M((s) => F(D({}, s), {
|
|
192
|
+
total: s.total ? s.total - 1 : s.total
|
|
187
193
|
})));
|
|
188
194
|
}
|
|
189
195
|
}
|
|
190
|
-
const
|
|
191
|
-
if (
|
|
192
|
-
(
|
|
193
|
-
current:
|
|
194
|
-
pageSize:
|
|
196
|
+
const r = n || e, o = A - 1;
|
|
197
|
+
if (o < 0)
|
|
198
|
+
(a.current - 1) * a.pageSize + o < 0 ? P.error("已经是第一个了") : M({
|
|
199
|
+
current: a.current - 1,
|
|
200
|
+
pageSize: a.pageSize,
|
|
195
201
|
type: "prev"
|
|
196
202
|
});
|
|
197
203
|
else {
|
|
198
|
-
z(
|
|
199
|
-
const
|
|
200
|
-
|
|
204
|
+
z(o);
|
|
205
|
+
const v = r[o];
|
|
206
|
+
S(v);
|
|
201
207
|
}
|
|
202
208
|
n && $(n);
|
|
203
209
|
};
|
|
204
|
-
|
|
205
|
-
if (!
|
|
210
|
+
Y(() => {
|
|
211
|
+
if (!f || !h || !x || !i)
|
|
206
212
|
return;
|
|
207
|
-
const t = ++
|
|
208
|
-
|
|
209
|
-
t ===
|
|
213
|
+
const t = ++ke.current;
|
|
214
|
+
Be(!0), d == null || d.getDatasetsIdVersionsVidSsamplesSid(h, x, i.id).then((e) => {
|
|
215
|
+
t === ke.current && S(e);
|
|
210
216
|
}).finally(() => {
|
|
211
|
-
t ===
|
|
217
|
+
t === ke.current && Be(!1);
|
|
212
218
|
});
|
|
213
|
-
}, [
|
|
214
|
-
const
|
|
215
|
-
|
|
216
|
-
|
|
219
|
+
}, [f, i == null ? void 0 : i.id]);
|
|
220
|
+
const dt = () => L(void 0, null, function* () {
|
|
221
|
+
Q && W && !(yield new Promise((e) => {
|
|
222
|
+
nt.confirm({
|
|
217
223
|
title: "有未保存的标注,确认关闭吗?",
|
|
218
224
|
content: "关闭后改动将丢失",
|
|
219
225
|
onOk: () => e(!0),
|
|
220
226
|
onCancel: () => e(!1)
|
|
221
227
|
});
|
|
222
|
-
})) ||
|
|
228
|
+
})) || p === "attributeDefinition" && j.current && !(yield j.current.checkDirtyAndConfirm()) || p === "qaGeneration" && V.current && !(yield V.current.checkDirtyAndConfirm()) || _();
|
|
223
229
|
});
|
|
224
|
-
|
|
225
|
-
handleModalCancel:
|
|
226
|
-
})),
|
|
230
|
+
At(y, () => ({
|
|
231
|
+
handleModalCancel: dt
|
|
232
|
+
})), Y(() => {
|
|
227
233
|
O.current && (O.current.width = O.current.offsetWidth, O.current.height = O.current.offsetHeight);
|
|
228
234
|
}, [O.current]);
|
|
229
|
-
const
|
|
235
|
+
const He = () => L(void 0, null, function* () {
|
|
230
236
|
var e, n;
|
|
231
|
-
if (
|
|
237
|
+
if (te)
|
|
232
238
|
return;
|
|
233
|
-
if (b(!0),
|
|
239
|
+
if (b(!0), p === "qaGeneration" && V.current && !(yield V.current.checkDirtyAndConfirm())) {
|
|
234
240
|
b(!1);
|
|
235
241
|
return;
|
|
236
242
|
}
|
|
237
|
-
const t =
|
|
243
|
+
const t = w.current || i;
|
|
238
244
|
if (!t) {
|
|
239
245
|
b(!1);
|
|
240
246
|
return;
|
|
241
247
|
}
|
|
242
|
-
if (
|
|
243
|
-
if (
|
|
248
|
+
if (p === "textAnnotation" && W) {
|
|
249
|
+
if (Q && !((n = (e = me.current) == null ? void 0 : e.validate()) != null ? n : !0)) {
|
|
244
250
|
b(!1);
|
|
245
251
|
return;
|
|
246
252
|
}
|
|
247
|
-
|
|
248
|
-
|
|
253
|
+
ge(!0), C(t).then((r) => {
|
|
254
|
+
r ? (K(void 0), Ke(), R()) : P.error("保存失败");
|
|
249
255
|
}).finally(() => {
|
|
250
|
-
|
|
256
|
+
ge(!1), b(!1);
|
|
251
257
|
});
|
|
252
258
|
} else
|
|
253
|
-
|
|
254
|
-
}),
|
|
259
|
+
Ke(), b(!1);
|
|
260
|
+
}), Oe = () => L(void 0, null, function* () {
|
|
255
261
|
var e, n;
|
|
256
|
-
if (
|
|
262
|
+
if (te)
|
|
257
263
|
return;
|
|
258
|
-
if (b(!0),
|
|
264
|
+
if (b(!0), p === "qaGeneration" && V.current && !(yield V.current.checkDirtyAndConfirm())) {
|
|
259
265
|
b(!1);
|
|
260
266
|
return;
|
|
261
267
|
}
|
|
262
|
-
const t =
|
|
268
|
+
const t = w.current || i;
|
|
263
269
|
if (!t) {
|
|
264
270
|
b(!1);
|
|
265
271
|
return;
|
|
266
272
|
}
|
|
267
|
-
if (
|
|
268
|
-
if (
|
|
273
|
+
if (p === "textAnnotation" && W) {
|
|
274
|
+
if (Q && !((n = (e = me.current) == null ? void 0 : e.validate()) != null ? n : !0)) {
|
|
269
275
|
b(!1);
|
|
270
276
|
return;
|
|
271
277
|
}
|
|
272
|
-
|
|
273
|
-
|
|
278
|
+
ge(!0), C(t).then((r) => {
|
|
279
|
+
r ? (K(void 0), Le(), R()) : P.error("保存失败");
|
|
274
280
|
}).finally(() => {
|
|
275
|
-
|
|
281
|
+
ge(!1), b(!1);
|
|
276
282
|
});
|
|
277
283
|
} else
|
|
278
|
-
|
|
284
|
+
Le(), b(!1);
|
|
279
285
|
});
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
}, [
|
|
283
|
-
const
|
|
284
|
-
|
|
286
|
+
Y(() => {
|
|
287
|
+
w.current = i;
|
|
288
|
+
}, [i]);
|
|
289
|
+
const Xe = te || ne || Re || he || ie;
|
|
290
|
+
it("rightarrow", (t) => {
|
|
285
291
|
const e = t.target;
|
|
286
|
-
(e == null ? void 0 : e.tagName) === "INPUT" || (e == null ? void 0 : e.tagName) === "TEXTAREA" || e != null && e.isContentEditable ||
|
|
287
|
-
}),
|
|
292
|
+
(e == null ? void 0 : e.tagName) === "INPUT" || (e == null ? void 0 : e.tagName) === "TEXTAREA" || e != null && e.isContentEditable || Xe || Oe();
|
|
293
|
+
}), it("leftarrow", (t) => {
|
|
288
294
|
const e = t.target;
|
|
289
|
-
(e == null ? void 0 : e.tagName) === "INPUT" || (e == null ? void 0 : e.tagName) === "TEXTAREA" || e != null && e.isContentEditable ||
|
|
295
|
+
(e == null ? void 0 : e.tagName) === "INPUT" || (e == null ? void 0 : e.tagName) === "TEXTAREA" || e != null && e.isContentEditable || Xe || He();
|
|
290
296
|
});
|
|
291
|
-
const
|
|
292
|
-
console.log("ocrRecognize apiUrl",
|
|
293
|
-
const e = yield
|
|
294
|
-
return
|
|
297
|
+
const ft = (t) => L(void 0, null, function* () {
|
|
298
|
+
console.log("ocrRecognize apiUrl", Ue);
|
|
299
|
+
const e = yield rt();
|
|
300
|
+
return Vt.post(`${Ue}/aishop/v2/infer?serviceId=Actpkb4pi3vxg`, {
|
|
295
301
|
pages: [{
|
|
296
302
|
image: t,
|
|
297
303
|
no: 0
|
|
@@ -300,226 +306,226 @@ const {
|
|
|
300
306
|
headers: {
|
|
301
307
|
Authorization: e ? `Bearer ${e}` : ""
|
|
302
308
|
}
|
|
303
|
-
}).then((n) => (console.log("ocrRecognize res", n.data.data), n.data.data.pages[0].layout.filter((
|
|
309
|
+
}).then((n) => (console.log("ocrRecognize res", n.data.data), n.data.data.pages[0].layout.filter((o) => o.content))).catch((n) => {
|
|
304
310
|
console.error("ocrRecognize error", n);
|
|
305
311
|
});
|
|
306
|
-
}),
|
|
307
|
-
const t =
|
|
308
|
-
!t || !
|
|
312
|
+
}), ut = () => L(void 0, null, function* () {
|
|
313
|
+
const t = w.current || i;
|
|
314
|
+
!t || !h || !x || nt.confirm({
|
|
309
315
|
title: "确认要删除此数据吗?",
|
|
310
316
|
content: "删除后不可恢复,请慎重操作",
|
|
311
317
|
onOk: () => L(void 0, null, function* () {
|
|
312
318
|
console.log("handleDeleteClick currentSample", t);
|
|
313
319
|
try {
|
|
314
|
-
yield d == null ? void 0 : d.delDatasetsIdVersionsVidSamplesId(
|
|
315
|
-
var
|
|
316
|
-
const n = e.findIndex((
|
|
320
|
+
yield d == null ? void 0 : d.delDatasetsIdVersionsVidSamplesId(h, x, t.id), P.success("删除成功"), B == null || B(t.id), $((e) => {
|
|
321
|
+
var s;
|
|
322
|
+
const n = e.findIndex((I) => I.id === t.id);
|
|
317
323
|
if (n === -1)
|
|
318
324
|
return e;
|
|
319
|
-
const
|
|
320
|
-
if (M((
|
|
321
|
-
total:
|
|
322
|
-
}),
|
|
323
|
-
current:
|
|
324
|
-
pageSize:
|
|
325
|
+
const r = [...e.slice(0, n), ...e.slice(n + 1)], o = a.pageSize || 1, v = Math.max(((s = a.total) != null ? s : e.length) - 1, 0), l = r.length === 0 && v > a.current * o;
|
|
326
|
+
if (M((I) => D(F(D({}, I), {
|
|
327
|
+
total: v
|
|
328
|
+
}), l ? {
|
|
329
|
+
current: I.current + 1,
|
|
330
|
+
pageSize: o,
|
|
325
331
|
type: "next"
|
|
326
332
|
} : {
|
|
327
|
-
type:
|
|
328
|
-
})),
|
|
329
|
-
const
|
|
330
|
-
z(
|
|
333
|
+
type: l ? "next" : void 0
|
|
334
|
+
})), r.length) {
|
|
335
|
+
const I = Math.min(n, r.length - 1);
|
|
336
|
+
z(I), S(r[I]);
|
|
331
337
|
} else
|
|
332
|
-
z(-1),
|
|
333
|
-
return
|
|
338
|
+
z(-1), S(void 0);
|
|
339
|
+
return r;
|
|
334
340
|
}), R();
|
|
335
341
|
} catch (e) {
|
|
336
342
|
P.error("删除失败");
|
|
337
343
|
}
|
|
338
344
|
})
|
|
339
345
|
});
|
|
340
|
-
}),
|
|
341
|
-
if (!
|
|
346
|
+
}), gt = () => L(void 0, null, function* () {
|
|
347
|
+
if (!h || !x || !(i != null && i.id))
|
|
342
348
|
return;
|
|
343
|
-
const t = yield d == null ? void 0 : d.getDatasetsIdVersionsVidSsamplesSid(
|
|
344
|
-
t && (
|
|
349
|
+
const t = yield d == null ? void 0 : d.getDatasetsIdVersionsVidSsamplesSid(h, x, i.id);
|
|
350
|
+
t && (S(t), w.current = t);
|
|
345
351
|
});
|
|
346
352
|
return /* @__PURE__ */ H("div", {
|
|
347
353
|
className: "vlm-records-content",
|
|
348
|
-
children: [/* @__PURE__ */
|
|
354
|
+
children: [/* @__PURE__ */ c("div", {
|
|
349
355
|
className: "records-content-tabs-container",
|
|
350
|
-
children: /* @__PURE__ */ H(
|
|
356
|
+
children: /* @__PURE__ */ H(ze, {
|
|
351
357
|
className: "records-content-tabs",
|
|
352
|
-
activeKey:
|
|
358
|
+
activeKey: m,
|
|
353
359
|
onChange: (t) => L(void 0, null, function* () {
|
|
354
|
-
var n,
|
|
355
|
-
|
|
356
|
-
index:
|
|
357
|
-
page:
|
|
360
|
+
var n, r;
|
|
361
|
+
A >= 0 && m !== void 0 && m !== null && (ee.current[m] = {
|
|
362
|
+
index: A,
|
|
363
|
+
page: a.current || 1
|
|
358
364
|
});
|
|
359
365
|
let e = !1;
|
|
360
|
-
if (!(
|
|
361
|
-
if (
|
|
362
|
-
const
|
|
363
|
-
if (
|
|
364
|
-
if (!(yield C(
|
|
366
|
+
if (!(p === "attributeDefinition" && j.current && (e = !!((r = (n = j.current).hasUnsavedChanges) != null && r.call(n)), !(yield j.current.checkDirtyAndConfirm()))) && !(p === "qaGeneration" && V.current && !(yield V.current.checkDirtyAndConfirm()))) {
|
|
367
|
+
if (p === "textAnnotation" && W) {
|
|
368
|
+
const o = w.current || i;
|
|
369
|
+
if (o && C) {
|
|
370
|
+
if (!(yield C(o))) {
|
|
365
371
|
P.error("保存失败,已阻止切换筛选");
|
|
366
372
|
return;
|
|
367
373
|
}
|
|
368
|
-
|
|
374
|
+
S(o), w.current = o, K(void 0), R == null || R(), m === "nocode" && G(o) && ($([]), S(o), z(-1), X(o.id), M(F(D({}, a), {
|
|
369
375
|
current: 1,
|
|
370
376
|
total: void 0,
|
|
371
377
|
type: void 0
|
|
372
|
-
})),
|
|
378
|
+
})), de("hascode"));
|
|
373
379
|
}
|
|
374
380
|
}
|
|
375
|
-
e &&
|
|
381
|
+
e && st(Date.now()), lt(Date.now()), p !== "attributeDefinition" && (be(!0), $([]), S(void 0), z(-1), X(void 0)), M(F(D({}, a), {
|
|
376
382
|
current: 1,
|
|
377
383
|
total: void 0,
|
|
378
384
|
type: void 0
|
|
379
|
-
})),
|
|
385
|
+
})), de(t), ye == null || ye(t);
|
|
380
386
|
}
|
|
381
387
|
}),
|
|
382
|
-
children: [/* @__PURE__ */
|
|
383
|
-
tab: `全部(${
|
|
384
|
-
}, ""), /* @__PURE__ */
|
|
385
|
-
tab: `未标注(${
|
|
386
|
-
}, "nocode"), /* @__PURE__ */
|
|
387
|
-
tab: `已标注(${
|
|
388
|
+
children: [/* @__PURE__ */ c(Z, {
|
|
389
|
+
tab: `全部(${Ge})`
|
|
390
|
+
}, ""), /* @__PURE__ */ c(Z, {
|
|
391
|
+
tab: `未标注(${Fe})`
|
|
392
|
+
}, "nocode"), /* @__PURE__ */ c(Z, {
|
|
393
|
+
tab: `已标注(${Ge - Fe})`
|
|
388
394
|
}, "hascode")]
|
|
389
395
|
})
|
|
390
|
-
}),
|
|
396
|
+
}), u != null && u.length ? /* @__PURE__ */ c("div", {
|
|
391
397
|
className: "sample-detail",
|
|
392
|
-
children:
|
|
398
|
+
children: Q ? i && /* @__PURE__ */ c("div", {
|
|
393
399
|
className: "container",
|
|
394
|
-
children: /* @__PURE__ */
|
|
395
|
-
ref:
|
|
396
|
-
sample:
|
|
400
|
+
children: /* @__PURE__ */ c(Mt, {
|
|
401
|
+
ref: me,
|
|
402
|
+
sample: i,
|
|
397
403
|
onChange: (t) => {
|
|
398
|
-
|
|
404
|
+
w.current = t, K(t);
|
|
399
405
|
}
|
|
400
406
|
})
|
|
401
|
-
}) : /* @__PURE__ */ H(
|
|
402
|
-
children: [/* @__PURE__ */
|
|
407
|
+
}) : /* @__PURE__ */ H(et, {
|
|
408
|
+
children: [/* @__PURE__ */ c("div", {
|
|
403
409
|
className: "content-mode-buttons",
|
|
404
|
-
children: /* @__PURE__ */ H(
|
|
405
|
-
activeKey:
|
|
410
|
+
children: /* @__PURE__ */ H(ze, {
|
|
411
|
+
activeKey: p,
|
|
406
412
|
onChange: (t) => L(void 0, null, function* () {
|
|
407
|
-
if (!(
|
|
408
|
-
if (
|
|
409
|
-
const e =
|
|
413
|
+
if (!(p === "attributeDefinition" && j.current && !(yield j.current.checkDirtyAndConfirm())) && !(p === "qaGeneration" && V.current && !(yield V.current.checkDirtyAndConfirm()))) {
|
|
414
|
+
if (p === "textAnnotation" && C && W && (w.current || i)) {
|
|
415
|
+
const e = w.current || i;
|
|
410
416
|
if (!(yield C(e))) {
|
|
411
417
|
P.error("保存失败,已阻止切换页签");
|
|
412
418
|
return;
|
|
413
419
|
}
|
|
414
|
-
|
|
415
|
-
index:
|
|
416
|
-
page:
|
|
417
|
-
}), $([]),
|
|
420
|
+
S(e), w.current = e, K(void 0), R == null || R(), m === "nocode" && G(e) && (A >= 0 && (ee.current.nocode = {
|
|
421
|
+
index: A,
|
|
422
|
+
page: a.current || 1
|
|
423
|
+
}), $([]), S(e), z(-1), X(e.id), M(F(D({}, a), {
|
|
418
424
|
current: 1,
|
|
419
425
|
total: void 0,
|
|
420
426
|
type: void 0
|
|
421
|
-
})),
|
|
422
|
-
index:
|
|
423
|
-
page:
|
|
424
|
-
}), $([]),
|
|
427
|
+
})), de("hascode")), m === "hascode" && !G(e) && (A >= 0 && (ee.current.hascode = {
|
|
428
|
+
index: A,
|
|
429
|
+
page: a.current || 1
|
|
430
|
+
}), $([]), S(e), z(-1), X(e.id), M(F(D({}, a), {
|
|
425
431
|
current: 1,
|
|
426
432
|
total: void 0,
|
|
427
433
|
type: void 0
|
|
428
|
-
})),
|
|
434
|
+
})), de("nocode"));
|
|
429
435
|
}
|
|
430
|
-
t === "textAnnotation" && (
|
|
436
|
+
t === "textAnnotation" && (i != null && i.id) && (yield gt()), fe(t);
|
|
431
437
|
}
|
|
432
438
|
}),
|
|
433
|
-
children: [/* @__PURE__ */
|
|
439
|
+
children: [/* @__PURE__ */ c(Z, {
|
|
434
440
|
tab: "属性定义",
|
|
435
|
-
disabled:
|
|
436
|
-
}, "attributeDefinition"), /* @__PURE__ */
|
|
441
|
+
disabled: Ae
|
|
442
|
+
}, "attributeDefinition"), /* @__PURE__ */ c(Z, {
|
|
437
443
|
tab: "文本标注",
|
|
438
|
-
disabled:
|
|
439
|
-
}, "textAnnotation"), /* @__PURE__ */
|
|
444
|
+
disabled: Ae
|
|
445
|
+
}, "textAnnotation"), /* @__PURE__ */ c(Z, {
|
|
440
446
|
tab: "QA生成",
|
|
441
|
-
disabled:
|
|
447
|
+
disabled: Ae
|
|
442
448
|
}, "qaGeneration")]
|
|
443
449
|
})
|
|
444
|
-
}),
|
|
450
|
+
}), p === "textAnnotation" && i && /* @__PURE__ */ c("div", {
|
|
445
451
|
className: "container",
|
|
446
|
-
children: /* @__PURE__ */
|
|
447
|
-
sample:
|
|
448
|
-
labelDefinitions:
|
|
452
|
+
children: /* @__PURE__ */ c(Tt, {
|
|
453
|
+
sample: i,
|
|
454
|
+
labelDefinitions: Ie,
|
|
449
455
|
onChange: (t) => {
|
|
450
|
-
|
|
456
|
+
w.current = t, K(t);
|
|
451
457
|
},
|
|
452
|
-
ocrRecognize:
|
|
458
|
+
ocrRecognize: ft
|
|
453
459
|
})
|
|
454
|
-
}),
|
|
460
|
+
}), p === "attributeDefinition" && /* @__PURE__ */ c(Dt, {
|
|
455
461
|
ref: j,
|
|
456
|
-
datasetId:
|
|
462
|
+
datasetId: h,
|
|
457
463
|
versionId: x,
|
|
458
464
|
onAttributesChange: (t) => {
|
|
459
|
-
|
|
465
|
+
je(t), t.length > 0 && Ie.length === 0 && fe("textAnnotation");
|
|
460
466
|
},
|
|
461
467
|
onLoadingChange: (t) => {
|
|
462
|
-
|
|
468
|
+
ot(t);
|
|
463
469
|
}
|
|
464
|
-
}, `attribute-${
|
|
465
|
-
ref:
|
|
466
|
-
sample:
|
|
467
|
-
labels:
|
|
468
|
-
datasetId:
|
|
470
|
+
}, `attribute-${at}`), p === "qaGeneration" && /* @__PURE__ */ c(Lt, {
|
|
471
|
+
ref: V,
|
|
472
|
+
sample: i,
|
|
473
|
+
labels: Ie,
|
|
474
|
+
datasetId: h,
|
|
469
475
|
visionId: x
|
|
470
|
-
}, `qa-${
|
|
476
|
+
}, `qa-${ct}`)]
|
|
471
477
|
})
|
|
472
|
-
}) :
|
|
478
|
+
}) : he ? /* @__PURE__ */ c("div", {
|
|
473
479
|
style: {
|
|
474
480
|
padding: "48px 0",
|
|
475
481
|
textAlign: "center"
|
|
476
482
|
},
|
|
477
|
-
children: /* @__PURE__ */
|
|
478
|
-
}) : /* @__PURE__ */
|
|
483
|
+
children: /* @__PURE__ */ c(St, {})
|
|
484
|
+
}) : /* @__PURE__ */ c(bt, {}), Q || p !== "attributeDefinition" ? /* @__PURE__ */ H("div", {
|
|
479
485
|
className: "vlm-detail-footer",
|
|
480
|
-
children: [/* @__PURE__ */
|
|
486
|
+
children: [/* @__PURE__ */ c("div", {
|
|
481
487
|
style: {
|
|
482
488
|
flex: 1
|
|
483
489
|
}
|
|
484
|
-
}), /* @__PURE__ */ H(
|
|
490
|
+
}), /* @__PURE__ */ H(tt, {
|
|
485
491
|
size: 24,
|
|
486
|
-
children: [(
|
|
492
|
+
children: [(u == null ? void 0 : u.length) > 0 && /* @__PURE__ */ c(pe, {
|
|
487
493
|
type: "default",
|
|
488
|
-
disabled:
|
|
489
|
-
onClick:
|
|
494
|
+
disabled: Re || he || ne || te || ie,
|
|
495
|
+
onClick: He,
|
|
490
496
|
children: "上一张"
|
|
491
|
-
}, "prev"), (
|
|
497
|
+
}, "prev"), (u == null ? void 0 : u.length) > 0 && /* @__PURE__ */ c(pe, {
|
|
492
498
|
type: "default",
|
|
493
|
-
disabled:
|
|
494
|
-
onClick:
|
|
499
|
+
disabled: Re || he || ne || te || ie,
|
|
500
|
+
onClick: Oe,
|
|
495
501
|
children: "下一张"
|
|
496
502
|
}, "next")]
|
|
497
|
-
}), /* @__PURE__ */
|
|
503
|
+
}), /* @__PURE__ */ c("div", {
|
|
498
504
|
style: {
|
|
499
505
|
flex: 1,
|
|
500
506
|
display: "flex",
|
|
501
507
|
justifyContent: "flex-end"
|
|
502
508
|
},
|
|
503
|
-
children: /* @__PURE__ */
|
|
504
|
-
children: (
|
|
505
|
-
children: [/* @__PURE__ */
|
|
506
|
-
disabled: !
|
|
509
|
+
children: /* @__PURE__ */ c(tt, {
|
|
510
|
+
children: (Q || p === "textAnnotation") && (u == null ? void 0 : u.length) > 0 ? /* @__PURE__ */ H(et, {
|
|
511
|
+
children: [/* @__PURE__ */ c(pe, {
|
|
512
|
+
disabled: !i || !W || ne,
|
|
507
513
|
type: "primary",
|
|
508
514
|
onClick: () => {
|
|
509
515
|
var e, n;
|
|
510
|
-
if (
|
|
516
|
+
if (Q && !((n = (e = me.current) == null ? void 0 : e.validate()) != null ? n : !0))
|
|
511
517
|
return;
|
|
512
|
-
const t =
|
|
513
|
-
t && (
|
|
514
|
-
|
|
518
|
+
const t = w.current || i;
|
|
519
|
+
t && (Te(!0), C(t).then((r) => L(void 0, null, function* () {
|
|
520
|
+
r ? (P.success("保存成功"), K(void 0), Le(), R(), Te(!1)) : (P.error("保存失败"), Te(!1));
|
|
515
521
|
})));
|
|
516
522
|
},
|
|
517
|
-
loading:
|
|
523
|
+
loading: ie,
|
|
518
524
|
children: "保存标注"
|
|
519
|
-
}, "save"),
|
|
525
|
+
}, "save"), Ee && Ee.delete && /* @__PURE__ */ c(pe, {
|
|
520
526
|
type: "default",
|
|
521
|
-
disabled:
|
|
522
|
-
onClick:
|
|
527
|
+
disabled: ie || ne,
|
|
528
|
+
onClick: ut,
|
|
523
529
|
children: "删除数据"
|
|
524
530
|
})]
|
|
525
531
|
}) : null
|
|
@@ -529,5 +535,5 @@ const {
|
|
|
529
535
|
});
|
|
530
536
|
});
|
|
531
537
|
export {
|
|
532
|
-
|
|
538
|
+
Zt as default
|
|
533
539
|
};
|