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