@glodon-aiot/dataset-annotation 3.16.0-alpha.37 → 3.16.0-alpha.39
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/LabelMaker/index.mjs +61 -53
- package/dist/es/components/OcrAnnotation/OCRBoxDetail/index.mjs +239 -0
- package/dist/es/components/OcrAnnotation/OCRBoxDetail/style.less.mjs +4 -0
- package/dist/es/components/OcrAnnotation/OcrModal/index.mjs +175 -142
- package/dist/es/components/OcrAnnotation/index.mjs +268 -247
- package/dist/es/components/PreLabelOCR/PreLabelModal.mjs +60 -60
- package/dist/es/index.mjs +1 -1
- package/dist/lib/index.js +4 -4
- package/dist/src/components/OcrAnnotation/OCRBoxDetail/index.d.ts +20 -0
- package/dist/src/components/OcrAnnotation/OcrModal/index.d.ts +14 -5
- package/package.json +2 -2
|
@@ -2,15 +2,15 @@ var $ = Math.pow;
|
|
|
2
2
|
import { jsx as f, jsxs as V } from "react/jsx-runtime";
|
|
3
3
|
import { useRef as ee, useState as D, useEffect as h } from "react";
|
|
4
4
|
import { fabric as X } from "fabric";
|
|
5
|
-
import { useKeyPress as
|
|
5
|
+
import { useKeyPress as R } from "ahooks";
|
|
6
6
|
import "./style.less.mjs";
|
|
7
7
|
import le from "react-dom";
|
|
8
|
-
import { Spin as fe, Space as de, Tooltip as
|
|
8
|
+
import { Spin as fe, Space as de, Tooltip as A, Button as L } from "antd";
|
|
9
9
|
import te from "./RectLabel.mjs";
|
|
10
10
|
import { drawable as ue } from "./Drawable.mjs";
|
|
11
11
|
import { ZoomInOutlined as me, ZoomOutOutlined as ge, DragOutlined as he, ClearOutlined as pe } from "@ant-design/icons";
|
|
12
12
|
import be from "classnames";
|
|
13
|
-
import { approxeq as
|
|
13
|
+
import { approxeq as S } from "../../../../utils/index.mjs";
|
|
14
14
|
const oe = (a) => {
|
|
15
15
|
a.off("mouse:down"), a.off("mouse:up");
|
|
16
16
|
}, O = (a) => {
|
|
@@ -28,9 +28,9 @@ const oe = (a) => {
|
|
|
28
28
|
id: a.config.id,
|
|
29
29
|
label: a.config.name,
|
|
30
30
|
color: a.config.color,
|
|
31
|
-
box: (d == null ? void 0 : d.map((y) => [
|
|
31
|
+
box: (d == null ? void 0 : d.map((y) => [S(y.x - m.x, 0) ? 0 : S(y.x - m.x, p.width) ? p.width : y.x - m.x, S(y.y - m.y, 0) ? 0 : S(y.y - m.y, p.height) ? p.height : y.y - m.y])) || []
|
|
32
32
|
};
|
|
33
|
-
},
|
|
33
|
+
}, Ae = (a) => {
|
|
34
34
|
const d = ee(null), {
|
|
35
35
|
labels: m,
|
|
36
36
|
imageUrl: p,
|
|
@@ -38,12 +38,12 @@ const oe = (a) => {
|
|
|
38
38
|
onImageLoad: E,
|
|
39
39
|
onChange: l,
|
|
40
40
|
isPreLabel: y,
|
|
41
|
-
disabled:
|
|
41
|
+
disabled: k,
|
|
42
42
|
renderLabelItem: N
|
|
43
|
-
} = a, [z, B] = D(!0), [e, Z] = D(), [ye, ne] = D({}), [
|
|
43
|
+
} = a, [z, B] = D(!0), [e, Z] = D(), [ye, ne] = D({}), [j, K] = D(), [W, re] = D({
|
|
44
44
|
left: 0,
|
|
45
45
|
top: 0
|
|
46
|
-
}), [ie, U] = D([1, 1]), [
|
|
46
|
+
}), [ie, U] = D([1, 1]), [M, H] = D(), [x, v] = D([]), w = ee(/* @__PURE__ */ new Set()), [b, P] = D(k || !1), Y = (o, t) => {
|
|
47
47
|
if (!e)
|
|
48
48
|
return;
|
|
49
49
|
t || (t = {
|
|
@@ -74,8 +74,8 @@ const oe = (a) => {
|
|
|
74
74
|
return i && i === t;
|
|
75
75
|
})), u >= 0 && r[u]) {
|
|
76
76
|
const s = r[u];
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
w.current.add(s.config.id), s.destroy(), r.splice(u, 1), l && l(r.map(O)), setTimeout(() => {
|
|
78
|
+
w.current.delete(s.config.id);
|
|
79
79
|
}, 100);
|
|
80
80
|
} else if (t && e) {
|
|
81
81
|
const s = r.findIndex((i) => {
|
|
@@ -84,8 +84,8 @@ const oe = (a) => {
|
|
|
84
84
|
});
|
|
85
85
|
if (s >= 0 && r[s]) {
|
|
86
86
|
const i = r[s];
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
w.current.add(i.config.id), i.destroy(), r.splice(s, 1), l && l(r.map(O)), setTimeout(() => {
|
|
88
|
+
w.current.delete(i.config.id);
|
|
89
89
|
}, 100);
|
|
90
90
|
} else
|
|
91
91
|
e.remove(t), e.discardActiveObject(), e.renderAll();
|
|
@@ -93,21 +93,21 @@ const oe = (a) => {
|
|
|
93
93
|
return [...r];
|
|
94
94
|
});
|
|
95
95
|
};
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
R("Delete", q), R("Backspace", q), R("ctrl", () => {
|
|
97
|
+
P(!0);
|
|
98
98
|
}, {
|
|
99
99
|
events: ["keydown"]
|
|
100
|
-
}),
|
|
101
|
-
|
|
100
|
+
}), R("ctrl", () => {
|
|
101
|
+
k || P(!1);
|
|
102
102
|
}, {
|
|
103
103
|
events: ["keyup"]
|
|
104
104
|
}), h(() => {
|
|
105
|
-
|
|
106
|
-
}, [
|
|
105
|
+
P(k || !1);
|
|
106
|
+
}, [k]);
|
|
107
107
|
const F = (o) => {
|
|
108
108
|
e && oe(e), v((t) => {
|
|
109
109
|
const n = t.findIndex((r) => r === o);
|
|
110
|
-
return n > -1 && (t.splice(n, 1), l && l(t.map(O)),
|
|
110
|
+
return n > -1 && (t.splice(n, 1), l && l(t.map(O)), T()), [...t];
|
|
111
111
|
});
|
|
112
112
|
}, G = (o) => {
|
|
113
113
|
v((t) => {
|
|
@@ -139,7 +139,7 @@ const oe = (a) => {
|
|
|
139
139
|
});
|
|
140
140
|
};
|
|
141
141
|
}, [e, p]);
|
|
142
|
-
const
|
|
142
|
+
const T = () => {
|
|
143
143
|
e && ue(e, (o) => {
|
|
144
144
|
const t = new te({
|
|
145
145
|
id: (c == null ? void 0 : c.id) || o.id,
|
|
@@ -154,7 +154,7 @@ const oe = (a) => {
|
|
|
154
154
|
t.active = !0, v((n) => {
|
|
155
155
|
const r = [...n, t];
|
|
156
156
|
return l && l(r.map(O)), setTimeout(() => {
|
|
157
|
-
e && !b &&
|
|
157
|
+
e && !b && T();
|
|
158
158
|
}, 0), r;
|
|
159
159
|
});
|
|
160
160
|
}, y);
|
|
@@ -188,8 +188,8 @@ const oe = (a) => {
|
|
|
188
188
|
return;
|
|
189
189
|
const I = e.getPointer(t.e);
|
|
190
190
|
if (I.x < i.tl.x || I.x > i.br.x || I.y < i.tl.y || I.y > i.br.y) {
|
|
191
|
-
const
|
|
192
|
-
typeof
|
|
191
|
+
const C = n == null ? void 0 : n._onMouseUp;
|
|
192
|
+
typeof C == "function" && C(t.e);
|
|
193
193
|
}
|
|
194
194
|
};
|
|
195
195
|
return e.on("mouse:move", o), () => {
|
|
@@ -220,7 +220,7 @@ const oe = (a) => {
|
|
|
220
220
|
}), o))) : (e.defaultCursor = "default", e.off("mouse:down:before"), e.off("mouse:up"), e.setCursor("default"), v((o) => (o.forEach((t) => {
|
|
221
221
|
var n;
|
|
222
222
|
return (n = t.object) == null ? void 0 : n.set("evented", !0);
|
|
223
|
-
}), o)),
|
|
223
|
+
}), o)), T()), () => {
|
|
224
224
|
ae();
|
|
225
225
|
};
|
|
226
226
|
}, [e, b]), h(() => {
|
|
@@ -233,7 +233,7 @@ const oe = (a) => {
|
|
|
233
233
|
n.renderLabel();
|
|
234
234
|
});
|
|
235
235
|
}), !b)
|
|
236
|
-
return
|
|
236
|
+
return T(), () => {
|
|
237
237
|
e && (oe(e), e.off("mouse:wheel"));
|
|
238
238
|
};
|
|
239
239
|
}, [e, c, x, b]);
|
|
@@ -250,7 +250,7 @@ const oe = (a) => {
|
|
|
250
250
|
crossOrigin: "anonymous"
|
|
251
251
|
});
|
|
252
252
|
}, [p]), h(() => {
|
|
253
|
-
if (!
|
|
253
|
+
if (!j && e) {
|
|
254
254
|
try {
|
|
255
255
|
e.clear();
|
|
256
256
|
} catch (_) {
|
|
@@ -259,23 +259,23 @@ const oe = (a) => {
|
|
|
259
259
|
}
|
|
260
260
|
if (!d.current || !d.current.parentElement)
|
|
261
261
|
return;
|
|
262
|
-
const o =
|
|
262
|
+
const o = j == null ? void 0 : j.getElement();
|
|
263
263
|
if (!(o != null && o.width) || !(o != null && o.height))
|
|
264
264
|
return;
|
|
265
265
|
const t = o.width / o.height, n = d.current.parentElement.offsetWidth, r = d.current.parentElement.offsetHeight, u = n / o.width, s = r / o.height;
|
|
266
266
|
let i = [n, r];
|
|
267
267
|
u > s ? i = [r * t, r] : i = [n, n / t];
|
|
268
|
-
const I = i[0] / o.width, J = i[1] / o.height,
|
|
269
|
-
U([
|
|
268
|
+
const I = i[0] / o.width, J = i[1] / o.height, C = Math.min(I, J);
|
|
269
|
+
U([C, C]);
|
|
270
270
|
const g = new X.Canvas(d.current, {
|
|
271
271
|
containerClass: "marking-canvas",
|
|
272
272
|
width: n,
|
|
273
273
|
height: r
|
|
274
274
|
});
|
|
275
|
-
if (g.uniScaleKey = "", g.uniformScaling = !1, g == null || g.setZoom(
|
|
276
|
-
const _ = (n - i[0]) /
|
|
275
|
+
if (g.uniScaleKey = "", g.uniformScaling = !1, g == null || g.setZoom(C), g == null || g.renderAll(), g && j) {
|
|
276
|
+
const _ = (n - i[0]) / C / 2, Q = (r - i[1]) / C / 2;
|
|
277
277
|
g.setBackgroundImage(
|
|
278
|
-
|
|
278
|
+
j,
|
|
279
279
|
() => {
|
|
280
280
|
g.renderAll(), re({
|
|
281
281
|
left: _,
|
|
@@ -291,12 +291,12 @@ const oe = (a) => {
|
|
|
291
291
|
}
|
|
292
292
|
);
|
|
293
293
|
}
|
|
294
|
-
}, [
|
|
294
|
+
}, [j]), h(() => {
|
|
295
295
|
if (x.length > m.length) {
|
|
296
|
-
if (
|
|
296
|
+
if (w.current.size > 0)
|
|
297
297
|
return;
|
|
298
298
|
x.forEach((t) => {
|
|
299
|
-
const n =
|
|
299
|
+
const n = w.current.has(t.config.id), r = t._isDestroying;
|
|
300
300
|
!m.find((s) => s.id === t.config.id) && !r && !n && t.destroy();
|
|
301
301
|
});
|
|
302
302
|
}
|
|
@@ -311,12 +311,12 @@ const oe = (a) => {
|
|
|
311
311
|
}));
|
|
312
312
|
}, [c, e, b]), h(() => {
|
|
313
313
|
var o;
|
|
314
|
-
if (z && d.current && !
|
|
314
|
+
if (z && d.current && !M) {
|
|
315
315
|
const t = document.createElement("div");
|
|
316
316
|
t.setAttribute("style", "width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; position: absolute;top: 0;"), (o = d.current.parentElement) == null || o.appendChild(t), le.render(/* @__PURE__ */ f(fe, {}), t), H(t);
|
|
317
317
|
} else
|
|
318
|
-
!z &&
|
|
319
|
-
}, [z, d.current,
|
|
318
|
+
!z && M && (M.remove(), H(null));
|
|
319
|
+
}, [z, d.current, M]), /* @__PURE__ */ V("div", {
|
|
320
320
|
style: {
|
|
321
321
|
width: "100%",
|
|
322
322
|
height: "100%",
|
|
@@ -329,46 +329,54 @@ const oe = (a) => {
|
|
|
329
329
|
children: /* @__PURE__ */ V(de, {
|
|
330
330
|
direction: "vertical",
|
|
331
331
|
size: 16,
|
|
332
|
-
children: [/* @__PURE__ */ f(
|
|
332
|
+
children: [/* @__PURE__ */ f(A, {
|
|
333
333
|
title: "放大-鼠标滚轮前滑",
|
|
334
334
|
placement: "right",
|
|
335
|
-
children: /* @__PURE__ */ f(
|
|
335
|
+
children: /* @__PURE__ */ f(L, {
|
|
336
336
|
icon: /* @__PURE__ */ f(me, {}),
|
|
337
337
|
onClick: () => {
|
|
338
338
|
Y(-100);
|
|
339
339
|
}
|
|
340
340
|
})
|
|
341
|
-
}), /* @__PURE__ */ f(
|
|
341
|
+
}), /* @__PURE__ */ f(A, {
|
|
342
342
|
title: "缩小-鼠标滚轮后滑",
|
|
343
343
|
placement: "right",
|
|
344
|
-
children: /* @__PURE__ */ f(
|
|
344
|
+
children: /* @__PURE__ */ f(L, {
|
|
345
345
|
icon: /* @__PURE__ */ f(ge, {}),
|
|
346
346
|
onClick: () => {
|
|
347
347
|
Y(100);
|
|
348
348
|
}
|
|
349
349
|
})
|
|
350
|
-
}), !
|
|
350
|
+
}), !k && /* @__PURE__ */ f(A, {
|
|
351
351
|
title: "拖动-按住ctrl",
|
|
352
352
|
placement: "right",
|
|
353
|
-
children: /* @__PURE__ */ f(
|
|
354
|
-
disabled:
|
|
353
|
+
children: /* @__PURE__ */ f(L, {
|
|
354
|
+
disabled: k,
|
|
355
355
|
icon: /* @__PURE__ */ f(he, {}),
|
|
356
356
|
className: b ? "active" : "",
|
|
357
357
|
onClick: () => {
|
|
358
|
-
|
|
358
|
+
P(!b);
|
|
359
359
|
}
|
|
360
360
|
})
|
|
361
|
-
}), !
|
|
361
|
+
}), !k && /* @__PURE__ */ f(A, {
|
|
362
362
|
title: "一键清空全部标注",
|
|
363
363
|
placement: "right",
|
|
364
|
-
children: /* @__PURE__ */ f(
|
|
364
|
+
children: /* @__PURE__ */ f(L, {
|
|
365
365
|
icon: /* @__PURE__ */ f(pe, {}),
|
|
366
366
|
disabled: !(x != null && x.length),
|
|
367
367
|
onClick: () => {
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
368
|
+
if (!e)
|
|
369
|
+
return;
|
|
370
|
+
v((t) => (t.forEach((n) => {
|
|
371
|
+
w.current.add(n.config.id);
|
|
372
|
+
}), t.forEach((n) => {
|
|
373
|
+
n.destroy();
|
|
374
|
+
}), setTimeout(() => {
|
|
375
|
+
w.current.clear();
|
|
376
|
+
}, 100), [])), e.discardActiveObject(), e.getObjects().forEach((t) => {
|
|
377
|
+
t !== e.backgroundImage && e.remove(t);
|
|
378
|
+
}), e.renderAll(), l && l([]), setTimeout(() => {
|
|
379
|
+
e && !b && T();
|
|
372
380
|
}, 0);
|
|
373
381
|
}
|
|
374
382
|
})
|
|
@@ -391,5 +399,5 @@ const oe = (a) => {
|
|
|
391
399
|
});
|
|
392
400
|
};
|
|
393
401
|
export {
|
|
394
|
-
|
|
402
|
+
Ae as default
|
|
395
403
|
};
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
var de = Object.defineProperty, ae = Object.defineProperties;
|
|
2
|
+
var fe = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var ne = Object.getOwnPropertySymbols;
|
|
4
|
+
var ue = Object.prototype.hasOwnProperty, ge = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var re = (f, c, n) => c in f ? de(f, c, { enumerable: !0, configurable: !0, writable: !0, value: n }) : f[c] = n, w = (f, c) => {
|
|
6
|
+
for (var n in c || (c = {}))
|
|
7
|
+
ue.call(c, n) && re(f, n, c[n]);
|
|
8
|
+
if (ne)
|
|
9
|
+
for (var n of ne(c))
|
|
10
|
+
ge.call(c, n) && re(f, n, c[n]);
|
|
11
|
+
return f;
|
|
12
|
+
}, K = (f, c) => ae(f, fe(c));
|
|
13
|
+
import { jsxs as T, Fragment as he, jsx as C } from "react/jsx-runtime";
|
|
14
|
+
import { Tabs as oe, Button as O, message as y } from "antd";
|
|
15
|
+
import { useContext as pe, useRef as ie, useState as x, useEffect as W } from "react";
|
|
16
|
+
import "./style.less.mjs";
|
|
17
|
+
import xe from "../../DataEmpty/index.mjs";
|
|
18
|
+
import Ie from "../../../DatasetContext/index.mjs";
|
|
19
|
+
import me from "../MarkOCRBoxModal/ImageDetail/index.mjs";
|
|
20
|
+
const {
|
|
21
|
+
TabPane: q
|
|
22
|
+
} = oe, De = (f) => {
|
|
23
|
+
var te;
|
|
24
|
+
const {
|
|
25
|
+
visible: c,
|
|
26
|
+
selectSampleId: n,
|
|
27
|
+
datasetId: m,
|
|
28
|
+
versionId: S,
|
|
29
|
+
ocrMarkTmpl: Se,
|
|
30
|
+
onClose: be,
|
|
31
|
+
onSave: E,
|
|
32
|
+
categories: se,
|
|
33
|
+
externalSamples: I,
|
|
34
|
+
externalPagination: L,
|
|
35
|
+
externalCurrentIndex: F,
|
|
36
|
+
externalFilterMode: A,
|
|
37
|
+
onFilterModeChange: M,
|
|
38
|
+
onPaginationChange: $
|
|
39
|
+
} = f, {
|
|
40
|
+
services: {
|
|
41
|
+
cvforceDatahub: h
|
|
42
|
+
}
|
|
43
|
+
} = pe(Ie), z = ie(null), [r, a] = x(), [Ce, v] = x(0), [p, D] = x(() => n && (I != null && I.length) ? I : []), [j, b] = x(() => n && F !== void 0 ? F : -1), [i, P] = x(() => n && L ? w({}, L) : !n && L ? {
|
|
44
|
+
current: 1,
|
|
45
|
+
pageSize: L.pageSize
|
|
46
|
+
} : {
|
|
47
|
+
current: 1,
|
|
48
|
+
pageSize: 50
|
|
49
|
+
}), [G, J] = x(0), [Q, U] = x(0), [u, le] = x(() => n && A ? A : n ? "" : "nocode"), X = ie(!1), [B, R] = x(!1), [H, Y] = x(!1);
|
|
50
|
+
W(() => {
|
|
51
|
+
if (!m || !S)
|
|
52
|
+
return;
|
|
53
|
+
const e = i.current || 1, l = i.pageSize || 50;
|
|
54
|
+
if (!X.current && n && (I != null && I.length) && L && F !== void 0) {
|
|
55
|
+
const o = I.find((t) => t.id === n);
|
|
56
|
+
if (o) {
|
|
57
|
+
X.current = !0, a(o), v(I.length), k();
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
h == null || h.getDatasetsIdVersionsVidSamples(m, S, {
|
|
62
|
+
labels: u ? [u] : void 0,
|
|
63
|
+
pageNo: e,
|
|
64
|
+
pageSize: l
|
|
65
|
+
}).then((o) => {
|
|
66
|
+
const t = o.recordList || [];
|
|
67
|
+
D(t);
|
|
68
|
+
const g = K(w({}, i), {
|
|
69
|
+
current: e,
|
|
70
|
+
pageSize: l,
|
|
71
|
+
total: o.totalResults
|
|
72
|
+
});
|
|
73
|
+
if (P(g), $ == null || $(g), i.type === "next" && t.length) {
|
|
74
|
+
const d = n ? t.find((s) => s.id === n) : null;
|
|
75
|
+
if (d) {
|
|
76
|
+
const s = t.findIndex((V) => V.id === n);
|
|
77
|
+
b(s), a(d), v(t.length);
|
|
78
|
+
return;
|
|
79
|
+
} else {
|
|
80
|
+
b(0);
|
|
81
|
+
const s = o.recordList[0];
|
|
82
|
+
a(s), v(t.length);
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (i.type === "prev" && t.length) {
|
|
87
|
+
const d = n ? t.find((s) => s.id === n) : null;
|
|
88
|
+
if (d) {
|
|
89
|
+
const s = t.findIndex((V) => V.id === n);
|
|
90
|
+
b(s), a(d), v(t.length);
|
|
91
|
+
return;
|
|
92
|
+
} else {
|
|
93
|
+
b(i.pageSize - 1);
|
|
94
|
+
const s = o.recordList[i.pageSize - 1];
|
|
95
|
+
a(s), v(t.length);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
t.find((d) => d.id === n) ? (a(n ? t.find((d) => d.id === n) : t[0]), b(0), v(t.length)) : n ? h.getDatasetsIdVersionsVidSsamplesSid(m, S, n).then((d) => {
|
|
100
|
+
a(d);
|
|
101
|
+
}) : (a(t[0]), b(0), v(t.length));
|
|
102
|
+
}), k();
|
|
103
|
+
}, [i.current, u, m, S]);
|
|
104
|
+
const k = () => {
|
|
105
|
+
!m || !S || h == null || h.getDatasetsIdVersionsVidLabelcount(m, S).then((e) => {
|
|
106
|
+
const l = e.find((t) => t.id === "allcodeid"), o = e.find((t) => t.id === "nocodeid");
|
|
107
|
+
J(l ? l.count : 0), U(o ? o.count : 0);
|
|
108
|
+
});
|
|
109
|
+
}, Z = () => {
|
|
110
|
+
p && D((e) => {
|
|
111
|
+
var t, g, N, d;
|
|
112
|
+
let l;
|
|
113
|
+
const o = !r || (t = r.labels) != null && t.length && u === "hascode" || !((g = r.labels) != null && g.length) && u === "nocode" || u === "" ? j + 1 : j;
|
|
114
|
+
if (r && ((N = r.labels) != null && N.length && u === "nocode" || !((d = r.labels) != null && d.length) && u === "hascode")) {
|
|
115
|
+
const s = e.findIndex((V) => V.id === r.id);
|
|
116
|
+
s > -1 && (e.splice(s, 1), l = [...e], i.total && (i.total = i.total - 1));
|
|
117
|
+
}
|
|
118
|
+
if (o >= e.length) {
|
|
119
|
+
const s = (i.current - 1) * i.pageSize + o;
|
|
120
|
+
i.total && s >= i.total ? y.error("已经是最后一个了") : P({
|
|
121
|
+
current: i.current + 1,
|
|
122
|
+
pageSize: i.pageSize,
|
|
123
|
+
type: "next"
|
|
124
|
+
});
|
|
125
|
+
} else
|
|
126
|
+
setTimeout(() => {
|
|
127
|
+
b(o);
|
|
128
|
+
const s = e[o];
|
|
129
|
+
a(s);
|
|
130
|
+
}, 200);
|
|
131
|
+
return l || e;
|
|
132
|
+
});
|
|
133
|
+
}, ce = () => {
|
|
134
|
+
var o, t;
|
|
135
|
+
if (!p)
|
|
136
|
+
return;
|
|
137
|
+
let e;
|
|
138
|
+
if (r && p && ((o = r.labels) != null && o.length && u === "nocode" || !((t = r.labels) != null && t.length) && u === "hascode")) {
|
|
139
|
+
const g = p.findIndex((N) => N.id === r.id);
|
|
140
|
+
g > -1 && (p.splice(g, 1), e = [...p], i.total && (i.total = i.total - 1));
|
|
141
|
+
}
|
|
142
|
+
const l = j - 1;
|
|
143
|
+
if (l < 0)
|
|
144
|
+
(i.current - 1) * i.pageSize + l < 0 ? y.error("已经是第一个了") : P({
|
|
145
|
+
current: i.current - 1,
|
|
146
|
+
pageSize: i.pageSize,
|
|
147
|
+
type: "prev"
|
|
148
|
+
});
|
|
149
|
+
else {
|
|
150
|
+
b(l);
|
|
151
|
+
const g = p[l];
|
|
152
|
+
a(g);
|
|
153
|
+
}
|
|
154
|
+
e && D(e);
|
|
155
|
+
};
|
|
156
|
+
W(() => {
|
|
157
|
+
c && m && S && r && (h == null || h.getDatasetsIdVersionsVidSsamplesSid(m, S, r.id).then((e) => {
|
|
158
|
+
a(e);
|
|
159
|
+
}));
|
|
160
|
+
}, [r == null ? void 0 : r.id]), W(() => {
|
|
161
|
+
z.current && (z.current.width = z.current.offsetWidth, z.current.height = z.current.offsetHeight);
|
|
162
|
+
}, [z.current]);
|
|
163
|
+
const _ = () => {
|
|
164
|
+
r && (R(!0), E(r).then((e) => {
|
|
165
|
+
e ? (ce(), k()) : y.error("保存失败");
|
|
166
|
+
}).finally(() => {
|
|
167
|
+
R(!1);
|
|
168
|
+
}));
|
|
169
|
+
}, ee = () => {
|
|
170
|
+
r && (R(!0), E(r).then((e) => {
|
|
171
|
+
e ? (Z(), k()) : y.error("保存失败");
|
|
172
|
+
}).finally(() => {
|
|
173
|
+
R(!1);
|
|
174
|
+
}));
|
|
175
|
+
};
|
|
176
|
+
return /* @__PURE__ */ T(he, {
|
|
177
|
+
children: [/* @__PURE__ */ T("div", {
|
|
178
|
+
className: "ocr-box-detail-records-content",
|
|
179
|
+
children: [/* @__PURE__ */ T(oe, {
|
|
180
|
+
className: "ocr-box-detail-records-content-tabs",
|
|
181
|
+
activeKey: u,
|
|
182
|
+
onChange: (e) => {
|
|
183
|
+
P(K(w({}, i), {
|
|
184
|
+
current: 1
|
|
185
|
+
})), le(e), M == null || M(e);
|
|
186
|
+
},
|
|
187
|
+
children: [/* @__PURE__ */ C(q, {
|
|
188
|
+
tab: `全部(${G})`
|
|
189
|
+
}, ""), /* @__PURE__ */ C(q, {
|
|
190
|
+
tab: `未标注(${Q})`
|
|
191
|
+
}, "nocode"), /* @__PURE__ */ C(q, {
|
|
192
|
+
tab: `已标注(${G - Q})`
|
|
193
|
+
}, "hascode")]
|
|
194
|
+
}), p != null && p.length ? /* @__PURE__ */ C(me, {
|
|
195
|
+
currentSample: r,
|
|
196
|
+
categories: se,
|
|
197
|
+
onChange: (e) => {
|
|
198
|
+
a(e), D((l) => {
|
|
199
|
+
const o = l.findIndex((t) => t.id === e.id);
|
|
200
|
+
return l[o] = e, [...l];
|
|
201
|
+
});
|
|
202
|
+
},
|
|
203
|
+
onNextClick: ee,
|
|
204
|
+
onPrevClick: _
|
|
205
|
+
}) : /* @__PURE__ */ C(xe, {})]
|
|
206
|
+
}), /* @__PURE__ */ T("div", {
|
|
207
|
+
className: "ocr-box-detail-footer",
|
|
208
|
+
children: [/* @__PURE__ */ T("span", {
|
|
209
|
+
className: "ocr-modal-label-count",
|
|
210
|
+
children: ["当前图片标注框数量:", ((te = r == null ? void 0 : r.labels) == null ? void 0 : te.length) || 0]
|
|
211
|
+
}), /* @__PURE__ */ C(O, {
|
|
212
|
+
disabled: !r || B,
|
|
213
|
+
type: "primary",
|
|
214
|
+
loading: H,
|
|
215
|
+
onClick: () => {
|
|
216
|
+
r && (Y(!0), E(r).then((e) => {
|
|
217
|
+
e ? (y.success("保存成功"), Z(), k()) : y.error("保存失败");
|
|
218
|
+
}).finally(() => {
|
|
219
|
+
Y(!1);
|
|
220
|
+
}));
|
|
221
|
+
},
|
|
222
|
+
children: "保存标注"
|
|
223
|
+
}, "save"), /* @__PURE__ */ C(O, {
|
|
224
|
+
type: "default",
|
|
225
|
+
onClick: _,
|
|
226
|
+
disabled: B || H,
|
|
227
|
+
children: "上一张"
|
|
228
|
+
}, "prev"), /* @__PURE__ */ C(O, {
|
|
229
|
+
type: "default",
|
|
230
|
+
onClick: ee,
|
|
231
|
+
disabled: B || H,
|
|
232
|
+
children: "下一张"
|
|
233
|
+
}, "next")]
|
|
234
|
+
})]
|
|
235
|
+
});
|
|
236
|
+
};
|
|
237
|
+
export {
|
|
238
|
+
De as default
|
|
239
|
+
};
|