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

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