@glodon-aiot/dataset-annotation 3.10.0-alpha.17 → 3.10.0-alpha.18

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