@glodon-aiot/dataset-annotation 3.18.1-alpha.15 → 3.18.1-alpha.16

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