@glodon-aiot/dataset-annotation 3.19.2-alpha.0 → 3.19.2-alpha.2

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