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

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