@glodon-aiot/dataset-annotation 3.18.0-alpha.11 → 3.18.0-alpha.13

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