@glodon-aiot/dataset-annotation 3.24.0-alpha.6 → 3.25.0-alpha.7

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.
Files changed (24) hide show
  1. package/dist/es/components/ClassificationAnnotation/index.mjs +374 -325
  2. package/dist/es/components/DetectionAnnotation/components/ImageDetail/index.mjs +82 -78
  3. package/dist/es/components/DetectionAnnotation/components/ImageModal/index.mjs +28 -26
  4. package/dist/es/components/DetectionAnnotation/components/LabelMaker/index.mjs +173 -166
  5. package/dist/es/components/DetectionAnnotation/index.mjs +478 -473
  6. package/dist/es/components/OcrAnnotation/OCRBoxDetail/index.mjs +249 -230
  7. package/dist/es/components/OcrAnnotation/OcrModal/index.mjs +103 -98
  8. package/dist/es/components/OcrAnnotation/index.mjs +281 -248
  9. package/dist/es/components/VLMAnnotationDetail/VLMDetail/index.mjs +277 -272
  10. package/dist/es/components/VLMAnnotationDetail/VlmModal/index.mjs +42 -40
  11. package/dist/es/components/VLMAnnotationDetail/index.mjs +331 -278
  12. package/dist/es/index.mjs +1 -1
  13. package/dist/es/utils/checkVlmSampleLabeled.mjs +7 -0
  14. package/dist/es/utils/scrollSampleIntoView.mjs +16 -0
  15. package/dist/lib/index.js +4 -4
  16. package/dist/src/components/DetectionAnnotation/components/ImageDetail/index.d.ts +2 -0
  17. package/dist/src/components/DetectionAnnotation/components/ImageModal/index.d.ts +2 -0
  18. package/dist/src/components/OcrAnnotation/OCRBoxDetail/index.d.ts +2 -0
  19. package/dist/src/components/OcrAnnotation/OcrModal/index.d.ts +1 -0
  20. package/dist/src/components/VLMAnnotationDetail/VLMDetail/index.d.ts +6 -0
  21. package/dist/src/components/VLMAnnotationDetail/VlmModal/index.d.ts +5 -0
  22. package/dist/src/utils/checkVlmSampleLabeled.d.ts +8 -0
  23. package/dist/src/utils/scrollSampleIntoView.d.ts +9 -0
  24. package/package.json +2 -2
@@ -1,421 +1,469 @@
1
- var Ye = Object.defineProperty, et = Object.defineProperties;
2
- var tt = Object.getOwnPropertyDescriptors;
3
- var Ne = Object.getOwnPropertySymbols;
4
- var lt = Object.prototype.hasOwnProperty, it = Object.prototype.propertyIsEnumerable;
5
- var ke = (D, c, o) => c in D ? Ye(D, c, { enumerable: !0, configurable: !0, writable: !0, value: o }) : D[c] = o, u = (D, c) => {
6
- for (var o in c || (c = {}))
7
- lt.call(c, o) && ke(D, o, c[o]);
8
- if (Ne)
9
- for (var o of Ne(c))
10
- it.call(c, o) && ke(D, o, c[o]);
1
+ var nt = Object.defineProperty, it = Object.defineProperties;
2
+ var ot = Object.getOwnPropertyDescriptors;
3
+ var we = Object.getOwnPropertySymbols;
4
+ var lt = Object.prototype.hasOwnProperty, rt = Object.prototype.propertyIsEnumerable;
5
+ var Re = (D, c, r) => c in D ? nt(D, c, { enumerable: !0, configurable: !0, writable: !0, value: r }) : D[c] = r, h = (D, c) => {
6
+ for (var r in c || (c = {}))
7
+ lt.call(c, r) && Re(D, r, c[r]);
8
+ if (we)
9
+ for (var r of we(c))
10
+ rt.call(c, r) && Re(D, r, c[r]);
11
11
  return D;
12
- }, h = (D, c) => et(D, tt(c));
13
- import { jsx as n, jsxs as E } from "react/jsx-runtime";
14
- import { useRef as se, useState as d, useEffect as N } from "react";
15
- import { message as j, ConfigProvider as ot, Space as ce, Select as nt, Button as Te, Tabs as rt, Col as st, Tooltip as ct, Empty as we, Spin as Ee, Modal as at } from "antd";
16
- import dt from "rc-virtual-list";
17
- import { UploadZipsStatus as Y } from "@glodon-aiot/apis";
18
- import ft from "antd/es/locale/zh_CN";
19
- import ut from "../../DatasetContext/index.mjs";
20
- import ht from "../DetectionAnnotation/icon_item_empty.svg.mjs";
12
+ }, m = (D, c) => it(D, ot(c));
13
+ import { jsx as s, jsxs as E } from "react/jsx-runtime";
14
+ import { useRef as B, useState as u, useEffect as N } from "react";
15
+ import { message as _, ConfigProvider as st, Space as fe, Select as ct, Button as Ee, Tabs as at, Col as dt, Tooltip as ft, Empty as Me, Spin as Ae, Modal as ut } from "antd";
16
+ import ht from "rc-virtual-list";
17
+ import { UploadZipsStatus as te } from "@glodon-aiot/apis";
18
+ import mt from "antd/es/locale/zh_CN";
19
+ import gt from "../../DatasetContext/index.mjs";
20
+ import bt from "../DetectionAnnotation/icon_item_empty.svg.mjs";
21
21
  import "./style.less.mjs";
22
- import { tagColors as Me } from "../../utils/index.mjs";
23
- import { useKeyPress as mt } from "ahooks";
24
- import { SearchOutlined as bt } from "@ant-design/icons";
25
- import gt from "../../Common/Page/index.mjs";
26
- import vt from "../PageNav/index.mjs";
27
- import pt from "../Thumbnail/index.mjs";
28
- import Ct from "../CompositionInput/index.mjs";
29
- import It from "lodash/merge";
30
- import { DEFAULT_FILTER_SWITCH as St } from "../../constant.mjs";
31
- import xt from "../DetectionStatus/index.mjs";
32
- import yt from "./components/ClassificationImageModal/index.mjs";
33
- import Lt from "../DetectionAnnotation/components/Labels/index.mjs";
34
- import Dt from "../PicZipImportModal/index.mjs";
35
- import { Prompt as Vt } from "../hooks/Prompt.mjs";
36
- const Qt = (D) => {
37
- var Le, De;
22
+ import { tagColors as ze } from "../../utils/index.mjs";
23
+ import { scrollSampleIntoView as pt, getVirtualListHolder as vt } from "../../utils/scrollSampleIntoView.mjs";
24
+ import { useKeyPress as Ct } from "ahooks";
25
+ import { SearchOutlined as It } from "@ant-design/icons";
26
+ import xt from "../../Common/Page/index.mjs";
27
+ import St from "../PageNav/index.mjs";
28
+ import Lt from "../Thumbnail/index.mjs";
29
+ import yt from "../CompositionInput/index.mjs";
30
+ import Vt from "lodash/merge";
31
+ import { DEFAULT_FILTER_SWITCH as Dt } from "../../constant.mjs";
32
+ import Nt from "../DetectionStatus/index.mjs";
33
+ import kt from "./components/ClassificationImageModal/index.mjs";
34
+ import Tt from "../DetectionAnnotation/components/Labels/index.mjs";
35
+ import wt from "../PicZipImportModal/index.mjs";
36
+ import { Prompt as Rt } from "../hooks/Prompt.mjs";
37
+ const on = (D) => {
38
+ var Ne, ke;
38
39
  const {
39
40
  services: c,
40
- datasetId: o,
41
- versionId: ee,
42
- backTo: Re,
43
- labelManager: ae = !1,
41
+ datasetId: r,
42
+ versionId: ne,
43
+ backTo: Fe,
44
+ labelManager: ue = !1,
44
45
  datasetManager: T = !1,
45
- annotation: Ae,
46
- header: m = {
46
+ annotation: Pe,
47
+ header: v = {
47
48
  versionSelect: !1
48
49
  }
49
- } = D, q = It(u({}, St), D.filterSwitch), _ = se(null), te = se(null), [C, ze] = d(), [i, G] = d(), [le, Ue] = d([]), [de, fe] = d(!1), [H, Fe] = d(0), [J, Be] = d(0), [a, ie] = d(""), [A, He] = d(0), [w, ue] = d([]), [b, oe] = d([]), [he, K] = d(!1), [P, z] = d(!1), [M, v] = d(-1), [I, p] = d(), [S, y] = d(), [x, V] = d({
50
+ } = D, G = Vt(h({}, Dt), D.filterSwitch), K = B(null), ie = B(null), [S, Ue] = u(), [l, J] = u(), [oe, He] = u([]), [he, me] = u(!1), [Z, Be] = u(0), [Q, Ke] = u(0), [d, le] = u(""), [A, Ze] = u(0), [w, ge] = u([]), [C, re] = u([]), [be, q] = u(!1), [O, z] = u(!1), [R, I] = u(-1), [b, x] = u(), [L, y] = u(), [a, V] = u({
50
51
  current: 0,
51
52
  pageSize: 100
52
- }), [Z, ne] = d([]), [O, Ke] = d(""), U = se({}), [Pe, Ze] = d(), [me, be] = d(!1), [ge, Oe] = d(!1), [ve, We] = d(!0), [$e, je] = d(!1), [W, qe] = d(""), pe = () => {
53
- p(void 0), y(void 0), v(-1), K(!1), Q(), setTimeout(() => {
54
- V((e) => h(u({}, e), {
53
+ }), [W, se] = u([]), [$, qe] = u(""), F = B({}), ce = B(void 0), X = B(!1), ae = B(!1), [Oe, We] = u(), [pe, ve] = u(!1), [Ce, $e] = u(!1), [Ie, je] = u(!0), [_e, Ge] = u(!1), [j, Je] = u(""), xe = () => {
54
+ x(void 0), y(void 0), I(-1), q(!1), Y(), setTimeout(() => {
55
+ V((e) => m(h({}, e), {
55
56
  current: 1,
56
57
  type: void 0
57
58
  }));
58
59
  }, 10);
59
60
  };
60
- mt("Esc", pe), N(() => {
61
- o && c.cvforceDatahub.getS3Iam(o).then((e) => {
62
- Ze(e);
61
+ Ct("Esc", xe), N(() => {
62
+ r && c.cvforceDatahub.getS3Iam(r).then((e) => {
63
+ We(e);
63
64
  });
64
- }, [o, c.cvforceDatahub]), N(() => {
65
- o && (fe(!0), Promise.all([c.cvforceDatahub.getDatasetsId(o).then(ze), c.cvforceDatahub.getDatasetsIdVersions(o, 1, 1e3).then((e) => {
66
- Ue(e.recordList), G(ee ? e.recordList.find((t) => t.id === ee) : e.recordList[0]);
67
- })]).finally(() => fe(!1)));
68
- }, [o, ee]), N(() => {
65
+ }, [r, c.cvforceDatahub]), N(() => {
66
+ r && (me(!0), Promise.all([c.cvforceDatahub.getDatasetsId(r).then(Ue), c.cvforceDatahub.getDatasetsIdVersions(r, 1, 1e3).then((e) => {
67
+ He(e.recordList), J(ne ? e.recordList.find((t) => t.id === ne) : e.recordList[0]);
68
+ })]).finally(() => me(!1)));
69
+ }, [r, ne]), N(() => {
69
70
  k();
70
- }, [i == null ? void 0 : i.id, O]), N(() => {
71
- Q();
72
- }, [i, a]), N(() => {
73
- !i || !C || $(h(u({}, x), {
71
+ }, [l == null ? void 0 : l.id, $]), N(() => {
72
+ Y();
73
+ }, [l, d]), N(() => {
74
+ !l || !S || P(m(h({}, a), {
74
75
  current: 1
75
76
  }));
76
- }, [C == null ? void 0 : C.id, i == null ? void 0 : i.id, Z, O]), N(() => {
77
- $().then(() => {
77
+ }, [S == null ? void 0 : S.id, l == null ? void 0 : l.id, W, $]), N(() => {
78
+ if (X.current) {
79
+ X.current = !1;
80
+ return;
81
+ }
82
+ if (ce.current === a.current) {
83
+ ce.current = void 0, k();
84
+ return;
85
+ }
86
+ P().then(() => {
78
87
  }), k();
79
- }, [x.current]), N(() => {
80
- P || (p(void 0), y(void 0), K(!1), v(-1), Q(), k());
81
- }, [P]), N(() => {
82
- !i || !C || $(h(u({}, x), {
88
+ }, [a.current]), N(() => {
89
+ let e;
90
+ if (!O) {
91
+ const t = b == null ? void 0 : b.id, n = R;
92
+ x(void 0), y(void 0), q(!1), I(-1), Y(), k(), t !== void 0 && (e = requestAnimationFrame(() => {
93
+ pt(vt(K.current), t, n);
94
+ }));
95
+ }
96
+ return () => {
97
+ e !== void 0 && cancelAnimationFrame(e);
98
+ };
99
+ }, [O]), N(() => {
100
+ if (!l || !S)
101
+ return;
102
+ const e = F.current[d], t = a.pageSize || 100;
103
+ (e && e.page > 1 ? P(m(h({}, a), {
104
+ current: 1,
105
+ pageSize: e.page * t,
106
+ total: void 0
107
+ })).then((o) => (ce.current = e.page, V((i) => m(h({}, i), {
108
+ current: e.page,
109
+ pageSize: t
110
+ })), o)) : P(m(h({}, a), {
83
111
  current: 1,
84
112
  total: void 0
85
- })).then((e) => {
86
- if (!(!e || !Array.isArray(e)) && !(!I && !P))
87
- if (e.length > 0) {
88
- const t = U.current[a], l = t !== void 0 && t >= 0 && t < e.length ? t : 0;
89
- v(l), p(e[l]), y(void 0);
113
+ }))).then((o) => {
114
+ if (!(!o || !Array.isArray(o)) && !(!b && !O))
115
+ if (o.length > 0) {
116
+ const i = e == null ? void 0 : e.index, f = i !== void 0 && i >= 0 && i < o.length ? i : 0;
117
+ I(f), x(o[f]), y(void 0);
90
118
  } else
91
- p(void 0), y(void 0), v(-1), V((t) => h(u({}, t), {
119
+ x(void 0), y(void 0), I(-1), V((i) => m(h({}, i), {
92
120
  current: 1
93
121
  }));
94
122
  });
95
- }, [a]), N(() => {
96
- V(a === "nocode" ? (e) => h(u({}, e), {
97
- total: H
98
- }) : a === "" ? (e) => h(u({}, e), {
123
+ }, [d]), N(() => {
124
+ V(d === "nocode" ? (e) => m(h({}, e), {
125
+ total: Z
126
+ }) : d === "" ? (e) => m(h({}, e), {
99
127
  total: A
100
- }) : a === "pending" ? (e) => h(u({}, e), {
101
- total: J
102
- }) : (e) => h(u({}, e), {
103
- total: A - H - J
128
+ }) : d === "pending" ? (e) => m(h({}, e), {
129
+ total: Q
130
+ }) : (e) => m(h({}, e), {
131
+ total: A - Z - Q
104
132
  }));
105
- }, [H, A, J]);
106
- const Ce = () => {
133
+ }, [Z, A, Q]);
134
+ const Se = () => {
107
135
  var e, t;
108
- (t = (e = _.current) == null ? void 0 : e.getElementsByClassName("rc-virtual-list-holder")[0]) == null || t.scrollTo({
136
+ (t = (e = K.current) == null ? void 0 : e.getElementsByClassName("rc-virtual-list-holder")[0]) == null || t.scrollTo({
109
137
  top: 0
110
138
  });
111
- }, Ie = () => {
112
- !o || !i || c.cvforceDatahub.getDatasetsIdVersionsVid(o, i.id).then((e) => {
113
- var t, l;
114
- G(e), qe((l = (t = e.versionAsyncTask) == null ? void 0 : t.state) != null ? l : "");
139
+ }, Le = () => {
140
+ !r || !l || c.cvforceDatahub.getDatasetsIdVersionsVid(r, l.id).then((e) => {
141
+ var t, n;
142
+ J(e), Je((n = (t = e.versionAsyncTask) == null ? void 0 : t.state) != null ? n : "");
115
143
  });
116
144
  };
117
145
  N(() => {
118
- W !== Y.Pending && W !== Y.Started || j.warning("文件导入中,请刷新页面再试");
119
- }, [W]), N(() => {
120
- je(!ve && ge);
121
- }, [ve, ge]), N(() => {
122
- o && (i != null && i.id) && Ie();
123
- }, [o, i == null ? void 0 : i.id]);
146
+ j !== te.Pending && j !== te.Started || _.warning("文件导入中,请刷新页面再试");
147
+ }, [j]), N(() => {
148
+ Ge(!Ie && Ce);
149
+ }, [Ie, Ce]), N(() => {
150
+ r && (l != null && l.id) && Le();
151
+ }, [r, l == null ? void 0 : l.id]);
124
152
  const k = () => {
125
- !o || !i || c.cvforceDatahub.getDatasetsIdVersionsVidLabelcount(o, i.id, {
153
+ !r || !l || c.cvforceDatahub.getDatasetsIdVersionsVidLabelcount(r, l.id, {
126
154
  label: "allcode",
127
- searchName: O
155
+ searchName: $
128
156
  }).then((e) => {
129
- var s, g, L;
130
- const t = e == null ? void 0 : e.find((f) => f.id === "allcodeid"), l = e == null ? void 0 : e.find((f) => f.id === "nocodeid"), r = e == null ? void 0 : e.find((f) => f.id === "pendingid");
131
- He((s = t == null ? void 0 : t.count) != null ? s : 0), Fe((g = l == null ? void 0 : l.count) != null ? g : 0), Be((L = r == null ? void 0 : r.count) != null ? L : 0);
157
+ var i, f, p;
158
+ const t = e == null ? void 0 : e.find((g) => g.id === "allcodeid"), n = e == null ? void 0 : e.find((g) => g.id === "nocodeid"), o = e == null ? void 0 : e.find((g) => g.id === "pendingid");
159
+ Ze((i = t == null ? void 0 : t.count) != null ? i : 0), Be((f = n == null ? void 0 : n.count) != null ? f : 0), Ke((p = o == null ? void 0 : o.count) != null ? p : 0);
132
160
  });
133
- }, Q = () => {
134
- if (!(!o || !(i != null && i.id)))
135
- return c.cvforceDatahub.getDatasetsIdVersionsVidLabelcount(o, i.id, {}).then((e) => {
136
- const l = (e || []).filter((r) => r.label !== "nocode").map((r, s) => ({
137
- label: r.label,
138
- count: r.count,
139
- id: r.id,
140
- color: Me[s % 40]
161
+ }, Y = () => {
162
+ if (!(!r || !(l != null && l.id)))
163
+ return c.cvforceDatahub.getDatasetsIdVersionsVidLabelcount(r, l.id, {}).then((e) => {
164
+ const n = (e || []).filter((o) => o.label !== "nocode").map((o, i) => ({
165
+ label: o.label,
166
+ count: o.count,
167
+ id: o.id,
168
+ color: ze[i % 40]
141
169
  }));
142
- return ue(l), e;
170
+ return ge(n), e;
143
171
  });
144
- }, $ = (e, t) => {
145
- const l = (e == null ? void 0 : e.current) || x.current, r = (e == null ? void 0 : e.pageSize) || x.pageSize;
146
- if (!o || !i || !l)
172
+ }, P = (e, t) => {
173
+ const n = (e == null ? void 0 : e.current) || a.current, o = (e == null ? void 0 : e.pageSize) || a.pageSize;
174
+ if (!r || !l || !n)
147
175
  return Promise.resolve(!1);
148
- const s = Z.map((L) => L.label), g = () => {
149
- switch (a) {
176
+ const i = W.map((p) => p.label), f = () => {
177
+ switch (d) {
150
178
  case "nocode":
151
179
  return "nocode";
152
180
  case "hascode":
153
- return s.length ? s : "hascode";
181
+ return i.length ? i : "hascode";
154
182
  default:
155
- return s.length ? s : void 0;
183
+ return i.length ? i : void 0;
156
184
  }
157
185
  };
158
- return l === 1 && Ce(), V((L) => h(u({}, L), {
159
- current: l,
160
- pageSize: r
161
- })), c.cvforceDatahub.getDatasetsIdVersionsVidSamples(o, i.id, {
162
- pageNo: l,
163
- pageSize: r,
164
- labels: g(),
165
- searchName: O
166
- }).then((L) => {
167
- const f = L.recordList || [], R = l === 1 ? f : [...t || b, ...f];
168
- return oe(R), V((X) => h(u({}, X), {
169
- current: l,
170
- pageSize: r,
171
- total: L.totalResults
172
- })), (e == null ? void 0 : e.type) === "next" && f.length && (v(0), p(f[0])), (e == null ? void 0 : e.type) === "prev" && f.length && (v(r - 1), p(f[f.length - 1])), he && M < 0 && f.length && (v(0), p(f[0]), z(!0)), R;
186
+ return n === 1 && Se(), V((p) => m(h({}, p), {
187
+ current: n,
188
+ pageSize: o
189
+ })), c.cvforceDatahub.getDatasetsIdVersionsVidSamples(r, l.id, {
190
+ pageNo: n,
191
+ pageSize: o,
192
+ labels: f(),
193
+ searchName: $
194
+ }).then((p) => {
195
+ const g = p.recordList || [], M = n === 1 ? g : [...t || C, ...g];
196
+ return re(M), V((ee) => m(h({}, ee), {
197
+ current: n,
198
+ pageSize: o,
199
+ total: p.totalResults
200
+ })), (e == null ? void 0 : e.type) === "next" && g.length && (I(0), x(g[0])), (e == null ? void 0 : e.type) === "prev" && g.length && (I(o - 1), x(g[g.length - 1])), be && R < 0 && g.length && (I(0), x(g[0]), z(!0)), M;
173
201
  }).catch(() => !1);
174
- }, _e = (e) => {
175
- b && (K(!1), v(e), p(b[e]), y(void 0), z(!0), a !== void 0 && (U.current[a] = e));
202
+ }, Qe = (e) => {
203
+ C && (q(!1), I(e), x(C[e]), y(void 0), z(!0), d !== void 0 && (F.current[d] = {
204
+ index: e,
205
+ page: a.current || 1
206
+ }));
176
207
  };
177
208
  N(() => {
178
- var t, l, r;
179
- if (!S)
209
+ var t, n, o;
210
+ if (!L)
180
211
  return;
181
212
  const e = [];
182
- (t = S.labels) == null || t.forEach((s) => {
183
- w != null && w.find((g) => g.id === s.id) && e.push(s);
184
- }), e.length !== ((r = (l = S.labels) == null ? void 0 : l.length) != null ? r : 0) && y(h(u({}, S), {
213
+ (t = L.labels) == null || t.forEach((i) => {
214
+ w != null && w.find((f) => f.id === i.id) && e.push(i);
215
+ }), e.length !== ((o = (n = L.labels) == null ? void 0 : n.length) != null ? o : 0) && y(m(h({}, L), {
185
216
  labels: e
186
217
  }));
187
218
  }, [w]);
188
- const re = () => {
189
- if (!i)
219
+ const de = () => {
220
+ if (ae.current = !1, !l)
190
221
  return Promise.resolve(!1);
191
- const e = S != null ? S : I;
192
- if (!e || !S)
222
+ const e = L != null ? L : b;
223
+ if (!e || !L)
193
224
  return Promise.resolve(!0);
194
- const t = (I == null ? void 0 : I.labels) || [], l = (S.labels || []).filter((s) => !!s.id);
195
- if (t.length === l.length && l.every((s, g) => {
196
- var L;
197
- return ((L = t[g]) == null ? void 0 : L.id) === s.id;
225
+ const t = (b == null ? void 0 : b.labels) || [], n = (L.labels || []).filter((i) => !!i.id);
226
+ if (t.length === n.length && n.every((i, f) => {
227
+ var p;
228
+ return ((p = t[f]) == null ? void 0 : p.id) === i.id;
198
229
  }))
199
230
  return Promise.resolve(!0);
200
- const r = h(u({}, e), {
201
- labels: l.map((s) => {
202
- var g;
203
- return h(u({}, s), {
204
- box: (g = s.box) != null ? g : []
231
+ const o = m(h({}, e), {
232
+ labels: n.map((i) => {
233
+ var f;
234
+ return m(h({}, i), {
235
+ box: (f = i.box) != null ? f : []
205
236
  });
206
237
  }),
207
- isLabeled: l.length > 0
238
+ isLabeled: n.length > 0
208
239
  });
209
- return c.cvforceDatahub.updateSamples(o, i.id, [r]).then(() => {
210
- var g, L;
211
- j.success({
240
+ return c.cvforceDatahub.updateSamples(r, l.id, [o]).then(() => {
241
+ var f, p;
242
+ _.success({
212
243
  content: "保存成功"
213
244
  });
214
- const s = a === "nocode" && ((g = r.labels) == null ? void 0 : g.length) || a === "hascode" && !((L = r.labels) != null && L.length);
215
- return oe((f) => {
216
- const R = f.findIndex((F) => F.id === r.id);
217
- if (R === -1)
218
- return f;
219
- if (s) {
220
- const F = f.slice(0, R).concat(f.slice(R + 1));
221
- if (V((B) => h(u({}, B), {
222
- total: B.total != null ? Math.max(0, B.total - 1) : void 0
223
- })), F.length === 0)
224
- p(void 0), y(void 0), v(-1), z(!1);
245
+ const i = d === "nocode" && ((f = o.labels) == null ? void 0 : f.length) || d === "hascode" && !((p = o.labels) != null && p.length);
246
+ return ae.current = !!i, re((g) => {
247
+ const M = g.findIndex((U) => U.id === o.id);
248
+ if (M === -1)
249
+ return g;
250
+ if (i) {
251
+ const U = g.slice(0, M).concat(g.slice(M + 1));
252
+ if (V((H) => m(h({}, H), {
253
+ total: H.total != null ? Math.max(0, H.total - 1) : void 0
254
+ })), U.length === 0)
255
+ x(void 0), y(void 0), I(-1), z(!1);
225
256
  else {
226
- const B = Math.min(M, F.length - 1), Ve = F[B];
227
- Ve != null && (p(Ve), v(B), y(void 0));
257
+ const H = Math.min(R, U.length - 1), Te = U[H];
258
+ Te != null && (x(Te), I(H), y(void 0));
228
259
  }
229
- return F;
260
+ return U;
230
261
  }
231
- const X = [...f];
232
- return X[R] = r, X;
233
- }), s || (p(r), y(r)), !0;
262
+ const ee = [...g];
263
+ return ee[M] = o, ee;
264
+ }), i || (x(o), y(o)), !0;
234
265
  }).catch(() => !1);
235
- }, Se = () => {
236
- b && re().then((e) => {
237
- if (!e)
266
+ }, ye = () => {
267
+ if (!C)
268
+ return;
269
+ const e = b == null ? void 0 : b.id;
270
+ de().then((t) => {
271
+ if (!t)
238
272
  return;
239
273
  k();
240
- const t = M + 1;
241
- t >= b.length ? x.total != null && t >= x.total ? j.error("已经是最后一个了") : $({
242
- current: x.current + 1,
243
- pageSize: x.pageSize,
274
+ const n = ae.current, o = n ? C.filter((p) => p.id !== e) : C, i = n ? R : R + 1, f = a.total != null ? a.total - (n ? 1 : 0) : void 0;
275
+ n && o.length === 0 || (i >= o.length ? f != null && i >= f ? _.error("已经是最后一个了") : P({
276
+ current: a.current + 1,
277
+ pageSize: a.pageSize,
244
278
  type: "next"
245
- }, b).then((l) => {
246
- Array.isArray(l) && (v(t), p(l[t]), y(void 0), a !== void 0 && (U.current[a] = t));
279
+ }, o).then((p) => {
280
+ Array.isArray(p) && (I(i), x(p[i]), y(void 0), d !== void 0 && (F.current[d] = {
281
+ index: i,
282
+ page: a.current + 1
283
+ }));
247
284
  }) : setTimeout(() => {
248
- v(t), p(b[t]), y(void 0), a !== void 0 && (U.current[a] = t);
249
- }, 200);
285
+ I(i), x(o[i]), y(void 0), d !== void 0 && (F.current[d] = {
286
+ index: i,
287
+ page: a.current || 1
288
+ });
289
+ }, 200));
250
290
  });
251
- }, Ge = () => {
252
- b && re().then((e) => {
291
+ }, Xe = () => {
292
+ C && de().then((e) => {
253
293
  if (!e)
254
294
  return;
255
295
  k();
256
- const t = M - 1;
257
- t < 0 ? j.error("已经是第一个了") : setTimeout(() => {
258
- v(t), p(b[t]), y(void 0), a !== void 0 && (U.current[a] = t);
296
+ const t = R - 1;
297
+ t < 0 ? _.error("已经是第一个了") : setTimeout(() => {
298
+ I(t), x(C[t]), y(void 0), d !== void 0 && (F.current[d] = {
299
+ index: t,
300
+ page: a.current || 1
301
+ });
259
302
  }, 200);
260
303
  });
261
- }, Je = () => {
304
+ }, Ye = () => {
262
305
  var e;
263
- if ((e = S == null ? void 0 : S.labels) != null && e.some((t) => !t.id))
264
- return j.error("请选择标签"), Promise.resolve(!1);
265
- Se();
266
- }, Qe = () => {
267
- at.confirm({
306
+ if ((e = L == null ? void 0 : L.labels) != null && e.some((t) => !t.id))
307
+ return _.error("请选择标签"), Promise.resolve(!1);
308
+ ye();
309
+ }, et = () => {
310
+ ut.confirm({
268
311
  title: "确认要删除当前数据吗?",
269
312
  content: "数据包含当前标注的内容和图片,删除后无法恢复,请确认是否删除!",
270
313
  onOk: () => {
271
- !I || !i || c.cvforceDatahub.delDatasetsIdVersionsVidSamplesId(o, i.id, I.id).then(() => {
272
- const e = b.findIndex((l) => l.id === I.id), t = [...b];
273
- if (t.splice(e, 1), oe(t), V((l) => h(u({}, l), {
274
- total: l.total != null ? l.total - 1 : 0
314
+ !b || !l || c.cvforceDatahub.delDatasetsIdVersionsVidSamplesId(r, l.id, b.id).then(() => {
315
+ const e = C.findIndex((n) => n.id === b.id), t = [...C];
316
+ if (t.splice(e, 1), re(t), V((n) => m(h({}, n), {
317
+ total: n.total != null ? n.total - 1 : 0
275
318
  })), t.length > 0) {
276
- const l = e < t.length ? e : e - 1;
277
- p(t[l]), v(l);
319
+ const n = e < t.length ? e : e - 1;
320
+ x(t[n]), I(n);
278
321
  } else
279
- p(void 0), y(void 0), v(-1), z(!1), V((l) => h(u({}, l), {
322
+ x(void 0), y(void 0), I(-1), z(!1), V((n) => m(h({}, n), {
280
323
  current: 1
281
324
  }));
282
325
  y(void 0), k();
283
326
  });
284
327
  }
285
328
  });
286
- }, xe = (e) => {
287
- M >= 0 && a !== void 0 && a !== null && (U.current[a] = M), S ? re().then((t) => {
288
- t && (ie(e), k());
289
- }) : (V((t) => h(u({}, t), {
329
+ }, Ve = (e) => {
330
+ R >= 0 && d !== void 0 && d !== null && (F.current[d] = {
331
+ index: R,
332
+ page: a.current || 1
333
+ });
334
+ const t = (a.current || 1) !== 1;
335
+ L ? de().then((n) => {
336
+ n && (X.current = t, le(e), k());
337
+ }) : (X.current = t, V((n) => m(h({}, n), {
290
338
  current: 1,
291
339
  total: void 0
292
- })), ie(e)), e === "nocode" && ne([]);
293
- }, ye = [{
340
+ })), le(e)), e === "nocode" && se([]);
341
+ }, De = [{
294
342
  key: "",
295
343
  label: `全部(${A})`,
296
344
  children: null
297
345
  }, {
298
346
  key: "nocode",
299
- label: `未标注(${H})`,
347
+ label: `未标注(${Z})`,
300
348
  children: null
301
349
  }, {
302
350
  key: "hascode",
303
- label: `已标注(${A - H - J})`,
351
+ label: `已标注(${A - Z - Q})`,
304
352
  children: null
305
- }], Xe = (e) => {
306
- var l;
353
+ }], tt = (e) => {
354
+ var n;
307
355
  const t = e.currentTarget;
308
- (x.total == null || x.total > b.length) && t.scrollHeight - t.scrollTop === ((l = _.current) == null ? void 0 : l.clientHeight) && V((r) => h(u({}, r), {
309
- current: r.current + 1
356
+ (a.total == null || a.total > C.length) && t.scrollHeight - t.scrollTop === ((n = K.current) == null ? void 0 : n.clientHeight) && V((o) => m(h({}, o), {
357
+ current: o.current + 1
310
358
  }));
311
359
  };
312
- return /* @__PURE__ */ n(ot, {
313
- locale: ft,
314
- children: /* @__PURE__ */ n(ut.Provider, {
360
+ return /* @__PURE__ */ s(st, {
361
+ locale: mt,
362
+ children: /* @__PURE__ */ s(gt.Provider, {
315
363
  value: {
316
- datasetId: o,
317
- versionId: (i == null ? void 0 : i.id) || "",
318
- no: (i == null ? void 0 : i.no) || "",
319
- loading: de,
320
- version: i,
321
- versions: le,
322
- samples: b,
323
- pagination: x,
364
+ datasetId: r,
365
+ versionId: (l == null ? void 0 : l.id) || "",
366
+ no: (l == null ? void 0 : l.no) || "",
367
+ loading: he,
368
+ version: l,
369
+ versions: oe,
370
+ samples: C,
371
+ pagination: a,
324
372
  services: c,
325
373
  featuresConfig: {
326
- labelManager: ae,
374
+ labelManager: ue,
327
375
  datasetManager: T,
328
- annotation: Ae,
329
- filterSwitch: q,
330
- header: m,
376
+ annotation: Pe,
377
+ filterSwitch: G,
378
+ header: v,
331
379
  exampleSrcRoot: D.exampleSrcRoot
332
380
  }
333
381
  },
334
- children: C ? C.markType === "classification" ? /* @__PURE__ */ n("div", {
382
+ children: S ? S.markType === "classification" ? /* @__PURE__ */ s("div", {
335
383
  className: "classification-version-detail",
336
- children: /* @__PURE__ */ E(gt, {
384
+ children: /* @__PURE__ */ E(xt, {
337
385
  className: "product-details-page",
338
- header: m !== !1 ? /* @__PURE__ */ n(vt, {
339
- backTo: Re,
340
- onBackClick: m != null && m.onBackClick ? () => {
386
+ header: v !== !1 ? /* @__PURE__ */ s(St, {
387
+ backTo: Fe,
388
+ onBackClick: v != null && v.onBackClick ? () => {
341
389
  var e;
342
- I && pe(), (e = m == null ? void 0 : m.onBackClick) == null || e.call(m);
390
+ b && xe(), (e = v == null ? void 0 : v.onBackClick) == null || e.call(v);
343
391
  } : void 0,
344
- left: !de && /* @__PURE__ */ E(ce, {
345
- children: [/* @__PURE__ */ n("span", {
392
+ left: !he && /* @__PURE__ */ E(fe, {
393
+ children: [/* @__PURE__ */ s("span", {
346
394
  style: {
347
395
  fontWeight: "bold"
348
396
  },
349
- children: C == null ? void 0 : C.name
350
- }), /* @__PURE__ */ n(nt, {
351
- disabled: (m == null ? void 0 : m.versionSelect) === !1,
352
- value: i == null ? void 0 : i.id,
397
+ children: S == null ? void 0 : S.name
398
+ }), /* @__PURE__ */ s(ct, {
399
+ disabled: (v == null ? void 0 : v.versionSelect) === !1,
400
+ value: l == null ? void 0 : l.id,
353
401
  style: {
354
402
  width: 70
355
403
  },
356
- options: le.map((e) => ({
404
+ options: oe.map((e) => ({
357
405
  label: e.no,
358
406
  value: e.id
359
407
  })),
360
408
  onChange: (e) => {
361
- var l;
362
- const t = le.find((r) => r.id === e);
363
- t && (G(t), (l = m == null ? void 0 : m.onVersionChange) == null || l.call(m, t));
409
+ var n;
410
+ const t = oe.find((o) => o.id === e);
411
+ t && (J(t), (n = v == null ? void 0 : v.onVersionChange) == null || n.call(v, t));
364
412
  }
365
413
  })]
366
414
  }),
367
- right: /* @__PURE__ */ E(ce, {
368
- children: [!I && T && T.add && /* @__PURE__ */ n(Te, {
415
+ right: /* @__PURE__ */ E(fe, {
416
+ children: [!b && T && T.add && /* @__PURE__ */ s(Ee, {
369
417
  type: "default",
370
- onClick: () => be(!0),
371
- disabled: W === Y.Pending || W === Y.Started,
418
+ onClick: () => ve(!0),
419
+ disabled: j === te.Pending || j === te.Started,
372
420
  children: "导入数据"
373
- }), !I && T && T.label && /* @__PURE__ */ n(Te, {
421
+ }), !b && T && T.label && /* @__PURE__ */ s(Ee, {
374
422
  type: "primary",
375
423
  onClick: () => {
376
- I || ie("nocode"), K(!0), v(-1), a === "nocode" && (b != null && b.length) && (v(0), p(b[0])), z(!0);
424
+ b || le("nocode"), q(!0), I(-1), d === "nocode" && (C != null && C.length) && (I(0), x(C[0])), z(!0);
377
425
  },
378
426
  children: "开始标注"
379
- }), /* @__PURE__ */ n(Vt, {
380
- when: $e,
427
+ }), /* @__PURE__ */ s(Rt, {
428
+ when: _e,
381
429
  content: "确认要离开此页面吗?",
382
430
  subContent: "离开此页面后,将结束导入,放弃未上传的文件,请谨慎操作!"
383
- }), me && /* @__PURE__ */ n(Dt, {
384
- datasetIam: Pe,
385
- datasetId: o,
386
- currentVersion: i,
387
- tenCode: C == null ? void 0 : C.tenantCode,
388
- isVisible: me,
389
- setIsVisible: be,
431
+ }), pe && /* @__PURE__ */ s(wt, {
432
+ datasetIam: Oe,
433
+ datasetId: r,
434
+ currentVersion: l,
435
+ tenCode: S == null ? void 0 : S.tenantCode,
436
+ isVisible: pe,
437
+ setIsVisible: ve,
390
438
  getVersionListRequest: k,
391
- setIsConfirm: We,
439
+ setIsConfirm: je,
392
440
  onUploadStatusChange: (e) => {
393
- Oe(e);
441
+ $e(e);
394
442
  },
395
443
  tableReload: () => {
396
444
  var e;
397
- i != null && i.id && (Ce(), $(h(u({}, x), {
445
+ l != null && l.id && (Se(), P(m(h({}, a), {
398
446
  current: 1
399
- })), (e = te.current) == null || e.fetchLabels());
447
+ })), (e = ie.current) == null || e.fetchLabels());
400
448
  },
401
- loadVersionData: Ie,
402
- markType: C == null ? void 0 : C.markType
449
+ loadVersionData: Le,
450
+ markType: S == null ? void 0 : S.markType
403
451
  })]
404
452
  })
405
453
  }) : void 0,
406
- children: [/* @__PURE__ */ n("div", {
454
+ children: [/* @__PURE__ */ s("div", {
407
455
  className: "detection-header",
408
- children: /* @__PURE__ */ E(ce, {
409
- children: [q.tabs && /* @__PURE__ */ n(rt, {
456
+ children: /* @__PURE__ */ E(fe, {
457
+ children: [G.tabs && /* @__PURE__ */ s(at, {
410
458
  className: "header-tab",
411
- activeKey: a,
412
- items: ye,
413
- onChange: xe
414
- }), !I && q.search && /* @__PURE__ */ n(Ct, {
459
+ activeKey: d,
460
+ items: De,
461
+ onChange: Ve
462
+ }), !b && G.search && /* @__PURE__ */ s(yt, {
415
463
  placeholder: "请输入图片名称搜索",
416
- suffix: /* @__PURE__ */ n(bt, {}),
417
- value: O,
418
- onChange: Ke,
464
+ suffix: /* @__PURE__ */ s(It, {}),
465
+ value: $,
466
+ onChange: qe,
419
467
  allowClear: !0
420
468
  })]
421
469
  })
@@ -423,68 +471,69 @@ const Qt = (D) => {
423
471
  className: "d-row",
424
472
  children: [/* @__PURE__ */ E("div", {
425
473
  className: "d-right",
426
- ref: _,
427
- children: [P && /* @__PURE__ */ n(yt, {
428
- datasetId: o,
429
- isImageDetailVisible: P,
474
+ ref: K,
475
+ children: [O && /* @__PURE__ */ s(kt, {
476
+ datasetId: r,
477
+ isImageDetailVisible: O,
430
478
  setIsImageDetailVisible: z,
431
- currentSample: S != null ? S : I,
479
+ currentSample: L != null ? L : b,
432
480
  labels: w,
433
- previewMode: !he,
434
- filterItems: ye,
435
- filterMode: a,
436
- onFilterChange: xe,
481
+ previewMode: !be,
482
+ filterItems: De,
483
+ filterMode: d,
484
+ onFilterChange: Ve,
437
485
  onChange: y,
438
- onNextClick: Se,
439
- onPrevClick: Ge,
440
- onSave: Je,
441
- onEnterEdit: () => K(!0),
442
- onDeleteSample: Qe,
486
+ onNextClick: ye,
487
+ onPrevClick: Xe,
488
+ onSave: Ye,
489
+ onEnterEdit: () => q(!0),
490
+ onDeleteSample: et,
443
491
  onRefresh: () => {
444
492
  var e, t;
445
- (e = Q()) == null || e.then(() => k()), (t = te.current) == null || t.fetchLabels();
493
+ (e = Y()) == null || e.then(() => k()), (t = ie.current) == null || t.fetchLabels();
446
494
  },
447
495
  isPreLabel: !1,
448
496
  imgCount: {
449
497
  total: A,
450
- index: M + 1
498
+ index: R + 1
451
499
  },
452
- settingHide: !ae,
500
+ settingHide: !ue,
453
501
  canLabel: !!(T && T.label),
454
502
  canDelete: !!(T && T.delete)
455
- }), I ? /* @__PURE__ */ n("div", {}) : x.total !== void 0 && x.total > 0 ? /* @__PURE__ */ n(dt, {
503
+ }), a.total !== void 0 && a.total > 0 ? /* @__PURE__ */ s(ht, {
456
504
  innerProps: {
457
505
  className: "d-right-row"
458
506
  },
459
- data: b,
507
+ data: C,
460
508
  itemKey: "id",
461
- height: (De = (Le = _.current) == null ? void 0 : Le.clientHeight) != null ? De : 600,
462
- onScroll: Xe,
509
+ height: (ke = (Ne = K.current) == null ? void 0 : Ne.clientHeight) != null ? ke : 600,
510
+ onScroll: tt,
463
511
  children: (e, t) => {
464
- var l;
465
- return /* @__PURE__ */ n(st, {
512
+ var n;
513
+ return /* @__PURE__ */ s(dt, {
466
514
  className: "d-right-col",
467
- onClick: () => _e(t),
515
+ "data-sample-id": e.id,
516
+ onClick: () => Qe(t),
468
517
  children: /* @__PURE__ */ E("div", {
469
518
  className: "right-col-wrapper",
470
- children: [/* @__PURE__ */ n("div", {
519
+ children: [/* @__PURE__ */ s("div", {
471
520
  className: "detection-status-wrapper",
472
- children: /* @__PURE__ */ n(xt, {
521
+ children: /* @__PURE__ */ s(Nt, {
473
522
  sample: e
474
523
  })
475
- }), /* @__PURE__ */ n("div", {
524
+ }), /* @__PURE__ */ s("div", {
476
525
  className: "right-col-img",
477
- children: /* @__PURE__ */ n(pt, {
526
+ children: /* @__PURE__ */ s(Lt, {
478
527
  fileKey: e.fileKey,
479
528
  width: 124,
480
529
  thumbnailUrl: e.thumbnailUrl
481
530
  })
482
531
  }), /* @__PURE__ */ E("div", {
483
532
  className: "right-col-text",
484
- children: [(l = e.labels) != null && l.length ? /* @__PURE__ */ n(ct, {
533
+ children: [(n = e.labels) != null && n.length ? /* @__PURE__ */ s(ft, {
485
534
  placement: "top",
486
535
  title: e.labels[0].label,
487
- children: /* @__PURE__ */ n("span", {
536
+ children: /* @__PURE__ */ s("span", {
488
537
  style: {
489
538
  display: "inline-block",
490
539
  maxWidth: "calc(100% - 25px)",
@@ -494,45 +543,45 @@ const Qt = (D) => {
494
543
  },
495
544
  children: e.labels[0].label
496
545
  })
497
- }) : /* @__PURE__ */ n("span", {
546
+ }) : /* @__PURE__ */ s("span", {
498
547
  style: {
499
548
  color: "rgba(0,0,0,0.45)",
500
549
  width: "100%"
501
550
  },
502
551
  children: "无标签"
503
- }), /* @__PURE__ */ n("div", {
552
+ }), /* @__PURE__ */ s("div", {
504
553
  children: t + 1
505
554
  })]
506
555
  })]
507
556
  })
508
557
  }, e.id);
509
558
  }
510
- }) : /* @__PURE__ */ n("div", {
559
+ }) : /* @__PURE__ */ s("div", {
511
560
  className: "empty",
512
- children: x.total === 0 ? /* @__PURE__ */ n(we, {
513
- image: ht,
561
+ children: a.total === 0 ? /* @__PURE__ */ s(Me, {
562
+ image: bt,
514
563
  description: "暂无数据"
515
- }) : /* @__PURE__ */ n(Ee, {})
564
+ }) : /* @__PURE__ */ s(Ae, {})
516
565
  })]
517
- }), a !== "nocode" && !I && q.labels && /* @__PURE__ */ n("div", {
566
+ }), d !== "nocode" && G.labels && /* @__PURE__ */ s("div", {
518
567
  className: "d-sider",
519
- children: /* @__PURE__ */ n(Lt, {
520
- ref: te,
521
- datasetId: o,
568
+ children: /* @__PURE__ */ s(Tt, {
569
+ ref: ie,
570
+ datasetId: r,
522
571
  data: w || [],
523
- selected: Z,
572
+ selected: W,
524
573
  onSelectedChange: (e) => {
525
- ne((w == null ? void 0 : w.filter((t) => e.find((l) => l.label === t.label))) || []);
574
+ se((w == null ? void 0 : w.filter((t) => e.find((n) => n.label === t.label))) || []);
526
575
  },
527
576
  onListChange: () => {
528
- i && (c.cvforceDatahub.getDatasetsIdVersionsVidLabelcount(o, i.id, {}).then((e) => {
529
- const l = (e || []).filter((s) => s.label !== "nocode").map((s, g) => ({
530
- label: s.label,
531
- count: s.count,
532
- id: s.id,
533
- color: Me[g % 40]
534
- })), r = Z.filter((s) => l.some((g) => g.id === s.id));
535
- ue(l), Z.length !== r.length && ne(r);
577
+ l && (c.cvforceDatahub.getDatasetsIdVersionsVidLabelcount(r, l.id, {}).then((e) => {
578
+ const n = (e || []).filter((i) => i.label !== "nocode").map((i, f) => ({
579
+ label: i.label,
580
+ count: i.count,
581
+ id: i.id,
582
+ color: ze[f % 40]
583
+ })), o = W.filter((i) => n.some((f) => f.id === i.id));
584
+ ge(n), W.length !== o.length && se(o);
536
585
  }), k());
537
586
  },
538
587
  isPreLabel: !1
@@ -540,18 +589,18 @@ const Qt = (D) => {
540
589
  })]
541
590
  })]
542
591
  })
543
- }) : /* @__PURE__ */ n("div", {
592
+ }) : /* @__PURE__ */ s("div", {
544
593
  className: "empty",
545
- children: /* @__PURE__ */ n(we, {
594
+ children: /* @__PURE__ */ s(Me, {
546
595
  description: "当前数据集不是 classification(图像分类) 类型"
547
596
  })
548
- }) : /* @__PURE__ */ n("div", {
597
+ }) : /* @__PURE__ */ s("div", {
549
598
  className: "empty",
550
- children: /* @__PURE__ */ n(Ee, {})
599
+ children: /* @__PURE__ */ s(Ae, {})
551
600
  })
552
601
  })
553
602
  });
554
603
  };
555
604
  export {
556
- Qt as default
605
+ on as default
557
606
  };