@glodon-aiot/dataset-annotation 3.25.1-alpha.5 → 3.25.1-alpha.6

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,17 +2,17 @@ var Ne = Object.defineProperty, ke = Object.defineProperties;
2
2
  var we = Object.getOwnPropertyDescriptors;
3
3
  var pe = Object.getOwnPropertySymbols;
4
4
  var ze = Object.prototype.hasOwnProperty, Le = Object.prototype.propertyIsEnumerable;
5
- var Ie = (p, u, s) => u in p ? Ne(p, u, { enumerable: !0, configurable: !0, writable: !0, value: s }) : p[u] = s, k = (p, u) => {
5
+ var Ie = (p, u, s) => u in p ? Ne(p, u, { enumerable: !0, configurable: !0, writable: !0, value: s }) : p[u] = s, w = (p, u) => {
6
6
  for (var s in u || (u = {}))
7
7
  ze.call(u, s) && Ie(p, s, u[s]);
8
8
  if (pe)
9
9
  for (var s of pe(u))
10
10
  Le.call(u, s) && Ie(p, s, u[s]);
11
11
  return p;
12
- }, V = (p, u) => ke(p, we(u));
13
- import { jsxs as P, Fragment as Ve, jsx as x } from "react/jsx-runtime";
14
- import { Tabs as ye, Space as me, Button as K, Tooltip as Pe, Modal as Te, message as w } from "antd";
15
- import { useContext as Oe, useRef as z, useState as I, useEffect as W } from "react";
12
+ }, P = (p, u) => ke(p, we(u));
13
+ import { jsxs as T, Fragment as Ve, jsx as x } from "react/jsx-runtime";
14
+ import { Tabs as ye, Space as me, Button as K, Tooltip as Pe, Modal as Te, message as z } from "antd";
15
+ import { useContext as Oe, useRef as L, useState as I, useEffect as W } from "react";
16
16
  import "./style.less.mjs";
17
17
  import De from "../../DataEmpty/index.mjs";
18
18
  import qe from "../../../DatasetContext/index.mjs";
@@ -24,8 +24,8 @@ const {
24
24
  const {
25
25
  visible: u,
26
26
  selectSampleId: s,
27
- datasetId: C,
28
- versionId: R,
27
+ datasetId: R,
28
+ versionId: N,
29
29
  ocrMarkTmpl: Me,
30
30
  onClose: $e,
31
31
  onSave: j,
@@ -42,13 +42,13 @@ const {
42
42
  services: {
43
43
  cvforceDatahub: m
44
44
  }
45
- } = Oe(qe), T = z(null), [e, h] = I(), _ = z({}), [je, M] = I(0), [y, B] = I(() => s && (S != null && S.length) ? S : []), [O, N] = I(() => s && U !== void 0 ? U : -1), [d, D] = I(() => s && J ? k({}, J) : !s && J ? {
45
+ } = Oe(qe), O = L(null), [e, h] = I(), _ = L({}), [je, M] = I(0), [y, B] = I(() => s && (S != null && S.length) ? S : []), [V, k] = I(() => s && U !== void 0 ? U : -1), [d, D] = I(() => s && J ? w({}, J) : !s && J ? {
46
46
  current: 1,
47
47
  pageSize: J.pageSize
48
48
  } : {
49
49
  current: 1,
50
50
  pageSize: 50
51
- }), [re, ie] = I(0), [se, oe] = I(0), [ce, le] = I(0), [o, ve] = I(() => s && ne ? ne : s ? "" : "nocode"), de = z(!1), ae = z(0), ee = z(0), L = z(!1), $ = z(!1), b = z({}), [E, A] = I(!1), [te, F] = I(!1), Se = () => {
51
+ }), [re, ie] = I(0), [se, oe] = I(0), [ce, le] = I(0), [o, ve] = I(() => s && ne ? ne : s ? "" : "nocode"), de = L(!1), ae = L(0), ee = L(0), C = L(!1), $ = L(!1), b = L({}), [E, A] = I(!1), [te, F] = I(!1), Se = () => {
52
52
  switch (o) {
53
53
  case "nocode":
54
54
  case "hascode":
@@ -71,114 +71,116 @@ const {
71
71
  }
72
72
  };
73
73
  W(() => {
74
- if (!C || !R) {
75
- L.current = !1;
74
+ if (!R || !N) {
75
+ C.current = !1;
76
76
  return;
77
77
  }
78
- const t = d.current || 1, n = d.pageSize || 50;
78
+ const t = d.current || 1, r = d.pageSize || 50;
79
79
  if (!de.current && s && (S != null && S.length) && J && U !== void 0) {
80
- const c = S.find((r) => r.id === s);
80
+ const c = S.find((n) => n.id === s);
81
81
  if (c) {
82
- de.current = !0, $.current = !0, L.current = !1, h(c), M(S.length), q();
82
+ de.current = !0, $.current = !0, C.current = !1, h(c), M(S.length), q();
83
83
  return;
84
84
  }
85
85
  }
86
86
  const f = ++ee.current;
87
- m == null || m.getDatasetsIdVersionsVidSamples(C, R, {
87
+ m == null || m.getDatasetsIdVersionsVidSamples(R, N, {
88
88
  labels: Ce(),
89
89
  pageNo: t,
90
- pageSize: n,
90
+ pageSize: r,
91
91
  confirmStatus: Se()
92
92
  }).then((c) => {
93
93
  if (f !== ee.current)
94
94
  return;
95
- const r = c.recordList || [];
96
- B(r);
97
- const g = V(k({}, d), {
95
+ const n = c.recordList || [];
96
+ B(n);
97
+ const g = P(w({}, d), {
98
98
  current: t,
99
- pageSize: n,
99
+ pageSize: r,
100
100
  total: c.totalResults
101
101
  });
102
102
  if (delete g.type, D(g), Y == null || Y({
103
103
  current: t,
104
- pageSize: n,
104
+ pageSize: r,
105
105
  total: c.totalResults
106
- }), d.type === "next" && r.length) {
107
- N(0);
106
+ }), d.type === "next" && n.length) {
107
+ k(0);
108
108
  const l = c.recordList[0];
109
- h(l), M(r.length), o !== void 0 && (b.current[o] = {
109
+ h(l), M(n.length), o !== void 0 && (b.current[o] = {
110
110
  index: 0,
111
111
  page: t
112
112
  });
113
113
  return;
114
114
  }
115
- if (d.type === "prev" && r.length) {
115
+ if (d.type === "prev" && n.length) {
116
116
  const i = d.pageSize - 1;
117
- N(i);
117
+ k(i);
118
118
  const l = c.recordList[i];
119
- h(l), M(r.length), o !== void 0 && (b.current[o] = {
119
+ h(l), M(n.length), o !== void 0 && (b.current[o] = {
120
120
  index: i,
121
121
  page: t
122
122
  });
123
123
  return;
124
124
  }
125
- if (r.find((i) => i.id === s) && !$.current) {
125
+ if (n.find((i) => i.id === s) && !$.current) {
126
126
  if (s) {
127
- $.current = !0, h(r.find((l) => l.id === s));
128
- const i = r.findIndex((l) => l.id === s);
129
- N(i), o !== void 0 && (b.current[o] = {
127
+ $.current = !0, h(n.find((l) => l.id === s));
128
+ const i = n.findIndex((l) => l.id === s);
129
+ k(i), o !== void 0 && (b.current[o] = {
130
130
  index: i,
131
131
  page: t
132
132
  });
133
133
  } else {
134
- const i = b.current[o], l = i == null ? void 0 : i.index, a = l !== void 0 && l >= 0 && l < r.length ? l : 0;
135
- h(r[a]), N(a);
134
+ const i = b.current[o], l = i == null ? void 0 : i.index, a = l !== void 0 && l >= 0 && l < n.length ? l : 0;
135
+ h(n[a]), k(a);
136
136
  }
137
- M(r.length);
137
+ M(n.length);
138
138
  } else if (s && !$.current)
139
- $.current = !0, m.getDatasetsIdVersionsVidSsamplesSid(C, R, s).then((i) => {
139
+ $.current = !0, m.getDatasetsIdVersionsVidSsamplesSid(R, N, s).then((i) => {
140
140
  h(i);
141
141
  });
142
142
  else {
143
- const i = b.current[o], l = i == null ? void 0 : i.index, a = l !== void 0 && l >= 0 && l < r.length ? l : 0;
144
- h(r[a]), N(a), M(r.length);
143
+ const i = b.current[o], l = i == null ? void 0 : i.index, a = l !== void 0 && l >= 0 && l < n.length ? l : 0;
144
+ h(n[a]), k(a), M(n.length);
145
145
  }
146
146
  }).finally(() => {
147
- f === ee.current && (L.current = !1);
147
+ f === ee.current && (C.current = !1);
148
148
  }), q();
149
- }, [d.current, o, C, R]), W(() => {
149
+ }, [d.current, o, R, N]), W(() => {
150
150
  e != null && e.id && (Z == null || Z(e.id));
151
151
  }, [e == null ? void 0 : e.id]);
152
152
  const q = () => {
153
- !C || !R || m == null || m.getDatasetsIdVersionsVidLabelcount(C, R, {
153
+ !R || !N || m == null || m.getDatasetsIdVersionsVidLabelcount(R, N, {
154
154
  label: "allcode",
155
155
  confirmStatus: 2
156
156
  }).then((t) => {
157
- const n = t.find((r) => r.id === "allcodeid"), f = t.find((r) => r.id === "nocodeid"), c = t.find((r) => r.id === "pendingid");
158
- ie(n ? n.count : 0), oe(f ? f.count : 0), le(c ? c.count : 0);
157
+ const r = t.find((n) => n.id === "allcodeid"), f = t.find((n) => n.id === "nocodeid"), c = t.find((n) => n.id === "pendingid");
158
+ ie(r ? r.count : 0), oe(f ? f.count : 0), le(c ? c.count : 0);
159
159
  });
160
160
  }, H = (t) => {
161
- y && B((n) => {
161
+ y && B((r) => {
162
162
  var v, i;
163
- const f = !!(e && ((v = e.labels) != null && v.length && o === "nocode" || !((i = e.labels) != null && i.length) && o === "hascode" || t === !0)), c = f ? O : O + 1;
164
- let r = n, g = d.total;
163
+ const f = !!(e && ((v = e.labels) != null && v.length && o === "nocode" || !((i = e.labels) != null && i.length) && o === "hascode" || t === !0)), c = f ? V : V + 1;
164
+ let n = r, g = d.total;
165
165
  if (e && f) {
166
- const l = n.findIndex((a) => a.id === e.id);
167
- l > -1 && (r = n.slice(0, l).concat(n.slice(l + 1)), g && (g = g - 1, D((a) => V(k({}, a), {
166
+ const l = r.findIndex((a) => a.id === e.id);
167
+ l > -1 && (n = r.slice(0, l).concat(r.slice(l + 1)), g && (g = g - 1, D((a) => P(w({}, a), {
168
168
  total: g
169
169
  }))));
170
170
  }
171
- if (c >= r.length) {
171
+ if (c >= n.length) {
172
+ if (C.current)
173
+ return n;
172
174
  const l = (d.current - 1) * d.pageSize + c;
173
- g == null || l >= g ? (r.length > 0 && O >= r.length && setTimeout(() => {
174
- const a = r.length - 1;
175
- N(a);
176
- const Re = r[a];
175
+ g == null || l >= g ? (n.length > 0 && V >= n.length && setTimeout(() => {
176
+ const a = n.length - 1;
177
+ k(a);
178
+ const Re = n[a];
177
179
  h(Re), o !== void 0 && (b.current[o] = {
178
180
  index: a,
179
181
  page: d.current || 1
180
182
  });
181
- }, 0), w.error("已经是最后一个了")) : L.current || (L.current = !0, D((a) => V(k({}, a), {
183
+ }, 0), z.error("已经是最后一个了")) : C.current || (C.current = !0, D((a) => P(w({}, a), {
182
184
  current: a.current + 1,
183
185
  // total 要带上,否则翻页请求回来之前判空会误报“已经是最后一个了”
184
186
  total: g,
@@ -186,36 +188,36 @@ const {
186
188
  })));
187
189
  } else
188
190
  setTimeout(() => {
189
- N(c);
190
- const l = r[c];
191
+ k(c);
192
+ const l = n[c];
191
193
  h(l), o !== void 0 && (b.current[o] = {
192
194
  index: c,
193
195
  page: d.current || 1
194
196
  });
195
197
  }, 0);
196
- return r;
198
+ return n;
197
199
  });
198
200
  }, ue = () => {
199
- var r, g;
200
- if (!y)
201
+ var n, g;
202
+ if (!y || V - 1 < 0 && C.current)
201
203
  return;
202
- let t, n = d.total;
203
- if (e && y && ((r = e.labels) != null && r.length && o === "nocode" || !((g = e.labels) != null && g.length) && o === "hascode")) {
204
+ let t, r = d.total;
205
+ if (e && y && ((n = e.labels) != null && n.length && o === "nocode" || !((g = e.labels) != null && g.length) && o === "hascode")) {
204
206
  const v = y.findIndex((i) => i.id === e.id);
205
- v > -1 && (t = y.slice(0, v).concat(y.slice(v + 1)), n && (n = n - 1, D((i) => V(k({}, i), {
206
- total: n
207
+ v > -1 && (t = y.slice(0, v).concat(y.slice(v + 1)), r && (r = r - 1, D((i) => P(w({}, i), {
208
+ total: r
207
209
  }))));
208
210
  }
209
- const f = t || y, c = O - 1;
211
+ const f = t || y, c = V - 1;
210
212
  if (c < 0)
211
- (d.current - 1) * d.pageSize + c < 0 ? w.error("已经是第一个了") : L.current || (L.current = !0, D((i) => V(k({}, i), {
213
+ (d.current - 1) * d.pageSize + c < 0 ? z.error("已经是第一个了") : C.current || (C.current = !0, D((i) => P(w({}, i), {
212
214
  current: i.current - 1,
213
215
  // total 要带上,否则翻页请求回来之前判空会误报“已经是最后一个了”
214
- total: n,
216
+ total: r,
215
217
  type: "prev"
216
218
  })));
217
219
  else {
218
- N(c);
220
+ k(c);
219
221
  const v = f[c];
220
222
  h(v), o !== void 0 && (b.current[o] = {
221
223
  index: c,
@@ -225,22 +227,22 @@ const {
225
227
  t && B(t);
226
228
  };
227
229
  W(() => {
228
- if (!u || !C || !R || !e)
230
+ if (!u || !R || !N || !e)
229
231
  return;
230
232
  const t = ++ae.current;
231
- m == null || m.getDatasetsIdVersionsVidSsamplesSid(C, R, e.id).then((n) => {
232
- t === ae.current && (h(n), _.current = JSON.parse(JSON.stringify(n)));
233
+ m == null || m.getDatasetsIdVersionsVidSsamplesSid(R, N, e.id).then((r) => {
234
+ t === ae.current && (h(r), _.current = JSON.parse(JSON.stringify(r)));
233
235
  });
234
236
  }, [e == null ? void 0 : e.id]), W(() => {
235
- T.current && (T.current.width = T.current.offsetWidth, T.current.height = T.current.offsetHeight);
236
- }, [T.current]);
237
+ O.current && (O.current.width = O.current.offsetWidth, O.current.height = O.current.offsetHeight);
238
+ }, [O.current]);
237
239
  const fe = () => !e || !_.current ? !1 : JSON.stringify(e) !== JSON.stringify(_.current), ge = () => {
238
240
  if (e)
239
241
  if (fe()) {
240
242
  A(!0);
241
243
  const t = e.confirmStatus === 1 ? Q : j;
242
- t == null || t(e).then((n) => {
243
- n ? (ue(), q()) : w.error("保存失败");
244
+ t == null || t(e).then((r) => {
245
+ r ? (ue(), q()) : z.error("保存失败");
244
246
  }).finally(() => {
245
247
  A(!1);
246
248
  });
@@ -251,27 +253,27 @@ const {
251
253
  if (fe()) {
252
254
  A(!0);
253
255
  const t = e.confirmStatus === 1 ? Q : j;
254
- t == null || t(e).then((n) => {
255
- n ? (H(), q()) : w.error("保存失败");
256
+ t == null || t(e).then((r) => {
257
+ r ? (H(), q()) : z.error("保存失败");
256
258
  }).finally(() => {
257
259
  A(!1);
258
260
  });
259
261
  } else
260
262
  H();
261
263
  };
262
- return /* @__PURE__ */ P(Ve, {
263
- children: [/* @__PURE__ */ P("div", {
264
+ return /* @__PURE__ */ T(Ve, {
265
+ children: [/* @__PURE__ */ T("div", {
264
266
  className: "ocr-box-detail-records-content",
265
- children: [/* @__PURE__ */ P(ye, {
267
+ children: [/* @__PURE__ */ T(ye, {
266
268
  className: "ocr-box-detail-records-content-tabs",
267
269
  activeKey: o,
268
270
  onChange: (t) => {
269
- O >= 0 && o !== void 0 && o !== null && (b.current[o] = {
270
- index: O,
271
+ V >= 0 && o !== void 0 && o !== null && (b.current[o] = {
272
+ index: V,
271
273
  page: d.current || 1
272
274
  });
273
- const n = b.current[t], f = (n == null ? void 0 : n.page) || 1;
274
- D(V(k({}, d), {
275
+ const r = b.current[t], f = (r == null ? void 0 : r.page) || 1;
276
+ D(P(w({}, d), {
275
277
  current: f
276
278
  })), ve(t), X == null || X(t);
277
279
  },
@@ -288,21 +290,21 @@ const {
288
290
  currentSample: e,
289
291
  categories: be,
290
292
  onChange: (t) => {
291
- h(t), B((n) => {
292
- const f = n.findIndex((c) => c.id === t.id);
293
- return n[f] = t, [...n];
293
+ h(t), B((r) => {
294
+ const f = r.findIndex((c) => c.id === t.id);
295
+ return r[f] = t, [...r];
294
296
  });
295
297
  },
296
298
  onNextClick: xe,
297
299
  onPrevClick: ge
298
300
  }) : /* @__PURE__ */ x(De, {})]
299
- }), /* @__PURE__ */ P("div", {
301
+ }), /* @__PURE__ */ T("div", {
300
302
  className: "ocr-box-detail-footer",
301
303
  children: [/* @__PURE__ */ x("div", {
302
304
  style: {
303
305
  width: "420px"
304
306
  }
305
- }), /* @__PURE__ */ P(me, {
307
+ }), /* @__PURE__ */ T(me, {
306
308
  children: [/* @__PURE__ */ x(K, {
307
309
  type: "default",
308
310
  onClick: ge,
@@ -314,12 +316,12 @@ const {
314
316
  disabled: E || te,
315
317
  children: "下一张"
316
318
  }, "next")]
317
- }), /* @__PURE__ */ P(me, {
319
+ }), /* @__PURE__ */ T(me, {
318
320
  style: {
319
321
  width: "420px",
320
322
  justifyContent: "flex-end"
321
323
  },
322
- children: [/* @__PURE__ */ P("span", {
324
+ children: [/* @__PURE__ */ T("span", {
323
325
  className: "ocr-modal-label-num",
324
326
  children: ["当前图片标注框数量:", ((he = e == null ? void 0 : e.labels) == null ? void 0 : he.length) || 0]
325
327
  }), (e == null ? void 0 : e.confirmStatus) === 1 && /* @__PURE__ */ x(Pe, {
@@ -338,7 +340,7 @@ const {
338
340
  content: "是否确认当前标注?",
339
341
  onOk: () => {
340
342
  e && (F(!0), j(e).then((t) => {
341
- t ? (w.success("保存成功"), H(!0), q()) : w.error("保存失败");
343
+ t ? (z.success("保存成功"), H(!0), q()) : z.error("保存失败");
342
344
  }).finally(() => {
343
345
  F(!1);
344
346
  }));
@@ -358,8 +360,8 @@ const {
358
360
  return;
359
361
  F(!0);
360
362
  const t = e.confirmStatus === 1 ? Q : j;
361
- t == null || t(e).then((n) => {
362
- n ? (w.success("保存成功"), H(), q()) : w.error("保存失败");
363
+ t == null || t(e).then((r) => {
364
+ r ? (z.success("保存成功"), H(), q()) : z.error("保存失败");
363
365
  }).finally(() => {
364
366
  F(!1);
365
367
  });