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

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