@glodon-aiot/dataset-annotation 3.23.0-alpha.4 → 3.24.0-alpha.4

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,15 +1,15 @@
1
- var gt = Object.defineProperty, ht = Object.defineProperties;
2
- var mt = Object.getOwnPropertyDescriptors;
3
- var We = Object.getOwnPropertySymbols;
4
- var pt = Object.prototype.hasOwnProperty, vt = Object.prototype.propertyIsEnumerable;
5
- var Je = (k, S, u) => S in k ? gt(k, S, { enumerable: !0, configurable: !0, writable: !0, value: u }) : k[S] = u, V = (k, S) => {
1
+ var ht = Object.defineProperty, mt = Object.defineProperties;
2
+ var pt = Object.getOwnPropertyDescriptors;
3
+ var Je = Object.getOwnPropertySymbols;
4
+ var vt = Object.prototype.hasOwnProperty, xt = Object.prototype.propertyIsEnumerable;
5
+ var Ye = (k, S, u) => S in k ? ht(k, S, { enumerable: !0, configurable: !0, writable: !0, value: u }) : k[S] = u, V = (k, S) => {
6
6
  for (var u in S || (S = {}))
7
- pt.call(S, u) && Je(k, u, S[u]);
8
- if (We)
9
- for (var u of We(S))
10
- vt.call(S, u) && Je(k, u, S[u]);
7
+ vt.call(S, u) && Ye(k, u, S[u]);
8
+ if (Je)
9
+ for (var u of Je(S))
10
+ xt.call(S, u) && Ye(k, u, S[u]);
11
11
  return k;
12
- }, Q = (k, S) => ht(k, mt(S));
12
+ }, Q = (k, S) => mt(k, pt(S));
13
13
  var L = (k, S, u) => new Promise((N, m) => {
14
14
  var x = (C) => {
15
15
  try {
@@ -26,22 +26,22 @@ var L = (k, S, u) => new Promise((N, m) => {
26
26
  }, Z = (C) => C.done ? N(C.value) : Promise.resolve(C.value).then(x, pe);
27
27
  Z((u = u.apply(k, S)).next());
28
28
  });
29
- import { jsxs as H, jsx as l, Fragment as Ye } from "react/jsx-runtime";
30
- import { Tabs as Ne, message as P, Spin as xt, Space as Ze, Button as me, Modal as _e } from "antd";
31
- import { forwardRef as yt, useContext as St, useMemo as Ct, useRef as U, useState as h, useEffect as ce, useImperativeHandle as wt } from "react";
32
- import { useKeyPress as et } from "ahooks";
29
+ import { jsxs as H, jsx as l, Fragment as Ze } from "react/jsx-runtime";
30
+ import { Tabs as Ne, message as P, Spin as yt, Space as _e, Button as me, Modal as et } from "antd";
31
+ import { forwardRef as St, useContext as Ct, useMemo as wt, useRef as U, useState as h, useEffect as ce, useImperativeHandle as It } from "react";
32
+ import { useKeyPress as tt } from "ahooks";
33
33
  import "./style.less.mjs";
34
- import It from "../../DataEmpty/index.mjs";
35
- import kt from "../../../DatasetContext/index.mjs";
36
- import At from "../../VLMAnnotation/index.mjs";
37
- import bt from "axios";
38
- import Rt from "../MarkVLMBoxModal/AttributeDetail/index.mjs";
39
- import Tt from "../MarkVLMBoxModal/QADetail/index.mjs";
40
- import { createTokenResolver as Dt } from "../../../utils/index.mjs";
41
- import Vt from "../../VQAAnnotation/index.mjs";
34
+ import kt from "../../DataEmpty/index.mjs";
35
+ import At from "../../../DatasetContext/index.mjs";
36
+ import bt from "../../VLMAnnotation/index.mjs";
37
+ import Rt from "axios";
38
+ import Tt from "../MarkVLMBoxModal/AttributeDetail/index.mjs";
39
+ import Dt from "../MarkVLMBoxModal/QADetail/index.mjs";
40
+ import { createTokenResolver as Vt } from "../../../utils/index.mjs";
41
+ import Lt from "../../VQAAnnotation/index.mjs";
42
42
  const {
43
43
  TabPane: Y
44
- } = Ne, Ot = yt((k, S) => {
44
+ } = Ne, Xt = St((k, S) => {
45
45
  const {
46
46
  visible: u,
47
47
  selectSampleId: N,
@@ -64,14 +64,19 @@ const {
64
64
  },
65
65
  token: Me,
66
66
  getToken: qe,
67
- apiUrl: Pe
68
- } = St(kt), tt = Ct(() => Dt(Me, qe), [Me, qe]), O = U(null), [a, w] = h(), I = U(void 0), [Lt, Se] = h(0), [g, $] = h(() => N && (A != null && A.length) ? A : []), [F, z] = h(() => N && xe !== void 0 ? xe : -1), [s, M] = h(() => N && ve ? V({}, ve) : {
67
+ apiUrl: Pe,
68
+ featuresConfig: {
69
+ datasetManager: Ue
70
+ } = {
71
+ datasetManager: !1
72
+ }
73
+ } = Ct(At), nt = wt(() => Vt(Me, qe), [Me, qe]), O = U(null), [a, w] = h(), I = U(void 0), [Nt, Se] = h(0), [g, $] = h(() => N && (A != null && A.length) ? A : []), [F, z] = h(() => N && xe !== void 0 ? xe : -1), [s, M] = h(() => N && ve ? V({}, ve) : {
69
74
  current: 1,
70
75
  pageSize: 100
71
- }), [Ue, Ee] = h(0), [Ge, $e] = h(0), [p, le] = h(() => N && ze ? ze : N ? "" : "nocode"), [Ce, X] = h(), _ = U({}), [we, Fe] = h([]), [v, de] = h("textAnnotation"), [W, K] = h(), [ee, b] = h(!1), fe = U(0), Ie = U(0), [ke, nt] = h(!1), [te, ue] = h(!1), [ge, Ae] = h(!1), [be, Qe] = h(!1), [ne, Re] = h(!1), j = U(null), D = U(null), he = U(null), Te = U(!1), De = U(!1), [it, rt] = h(() => Date.now()), [ot, at] = h(() => Date.now());
76
+ }), [Ee, Ge] = h(0), [$e, Fe] = h(0), [p, le] = h(() => N && ze ? ze : N ? "" : "nocode"), [Ce, X] = h(), _ = U({}), [we, Qe] = h([]), [v, de] = h("textAnnotation"), [W, K] = h(), [ee, b] = h(!1), fe = U(0), Ie = U(0), [ke, it] = h(!1), [te, ue] = h(!1), [ge, Ae] = h(!1), [be, je] = h(!1), [ne, Re] = h(!1), j = U(null), D = U(null), he = U(null), Te = U(!1), De = U(!1), [rt, ot] = h(() => Date.now()), [at, st] = h(() => Date.now());
72
77
  ce(() => {
73
78
  u && (!m || !x || E || d == null || d.getDatasetsIdVersionsVidConfigs(m, x).then((t) => {
74
- Fe(t || []), (t == null ? void 0 : t.length) > 0 ? de("textAnnotation") : de("attributeDefinition");
79
+ Qe(t || []), (t == null ? void 0 : t.length) > 0 ? de("textAnnotation") : de("attributeDefinition");
75
80
  }));
76
81
  }, [u]), ce(() => {
77
82
  const t = s.current || 1, e = s.pageSize || 100, n = s.type;
@@ -90,18 +95,18 @@ const {
90
95
  }
91
96
  const i = ++fe.current;
92
97
  Ae(!0);
93
- const r = g || [], f = Te.current ? Ce : N || Ce, c = _.current[p], o = c == null ? void 0 : c.index, y = c == null ? void 0 : c.page, B = !n && !f && !!y && y > 1, ie = B ? 1 : t, ft = B ? y * e : e;
98
+ const r = g || [], f = Te.current ? Ce : N || Ce, c = _.current[p], o = c == null ? void 0 : c.index, y = c == null ? void 0 : c.page, B = !n && !f && !!y && y > 1, ie = B ? 1 : t, ut = B ? y * e : e;
94
99
  d == null || d.getDatasetsIdVersionsVidSamples(m, x, {
95
100
  labels: p ? [p] : void 0,
96
101
  pageNo: ie,
97
- pageSize: ft
102
+ pageSize: ut
98
103
  }).then((re) => {
99
- var Xe;
104
+ var We;
100
105
  if (i !== fe.current)
101
106
  return;
102
107
  const T = re.recordList || [], q = ie === 1 && !n ? T : n === "prev" ? [...T, ...r] : n === "next" ? [...r, ...T] : T;
103
108
  $(q), B && (De.current = !0);
104
- const Oe = (Xe = re.totalResults) != null ? Xe : 0, Le = Math.max(1, Math.ceil(Oe / e) || 1), ut = Math.min(B ? y : t, Le);
109
+ const Xe = (We = re.totalResults) != null ? We : 0, Le = Math.max(1, Math.ceil(Xe / e) || 1), gt = Math.min(B ? y : t, Le);
105
110
  if (B && y != null && y > Le) {
106
111
  const ae = Math.min(o != null ? o : 0, Math.max(0, q.length - 1));
107
112
  _.current[p] = {
@@ -110,9 +115,9 @@ const {
110
115
  };
111
116
  }
112
117
  M(Q(V({}, s), {
113
- current: ut,
118
+ current: gt,
114
119
  pageSize: e,
115
- total: Oe,
120
+ total: Xe,
116
121
  type: void 0
117
122
  }));
118
123
  let oe = 0, J = q[0];
@@ -140,7 +145,7 @@ const {
140
145
  const R = () => {
141
146
  !m || !x || d == null || d.getDatasetsIdVersionsVidLabelcount(m, x).then((t) => {
142
147
  const e = t.find((i) => i.id === "allcodeid"), n = t.find((i) => i.id === "nocodeid");
143
- Ee(e ? e.count : 0), $e(n ? n.count : 0);
148
+ Ge(e ? e.count : 0), Fe(n ? n.count : 0);
144
149
  });
145
150
  }, Ve = () => {
146
151
  g && $((t) => {
@@ -168,7 +173,7 @@ const {
168
173
  w(c);
169
174
  }, 0), f;
170
175
  });
171
- }, je = () => {
176
+ }, Be = () => {
172
177
  if (!g)
173
178
  return;
174
179
  const t = I.current || a, e = [...g];
@@ -200,15 +205,15 @@ const {
200
205
  if (!u || !m || !x || !a)
201
206
  return;
202
207
  const t = ++Ie.current;
203
- Qe(!0), d == null || d.getDatasetsIdVersionsVidSsamplesSid(m, x, a.id).then((e) => {
208
+ je(!0), d == null || d.getDatasetsIdVersionsVidSsamplesSid(m, x, a.id).then((e) => {
204
209
  t === Ie.current && w(e);
205
210
  }).finally(() => {
206
- t === Ie.current && Qe(!1);
211
+ t === Ie.current && je(!1);
207
212
  });
208
213
  }, [u, a == null ? void 0 : a.id]);
209
- const st = () => L(void 0, null, function* () {
214
+ const ct = () => L(void 0, null, function* () {
210
215
  E && W && !(yield new Promise((e) => {
211
- _e.confirm({
216
+ et.confirm({
212
217
  title: "有未保存的标注,确认关闭吗?",
213
218
  content: "关闭后改动将丢失",
214
219
  onOk: () => e(!0),
@@ -216,12 +221,12 @@ const {
216
221
  });
217
222
  })) || v === "attributeDefinition" && j.current && !(yield j.current.checkDirtyAndConfirm()) || v === "qaGeneration" && D.current && !(yield D.current.checkDirtyAndConfirm()) || Z();
218
223
  });
219
- wt(S, () => ({
220
- handleModalCancel: st
224
+ It(S, () => ({
225
+ handleModalCancel: ct
221
226
  })), ce(() => {
222
227
  O.current && (O.current.width = O.current.offsetWidth, O.current.height = O.current.offsetHeight);
223
228
  }, [O.current]);
224
- const Be = () => L(void 0, null, function* () {
229
+ const Ke = () => L(void 0, null, function* () {
225
230
  var e, n;
226
231
  if (ee)
227
232
  return;
@@ -240,13 +245,13 @@ const {
240
245
  return;
241
246
  }
242
247
  ue(!0), C(t).then((i) => {
243
- i ? (K(void 0), je(), R()) : P.error("保存失败");
248
+ i ? (K(void 0), Be(), R()) : P.error("保存失败");
244
249
  }).finally(() => {
245
250
  ue(!1), b(!1);
246
251
  });
247
252
  } else
248
- je(), b(!1);
249
- }), Ke = () => L(void 0, null, function* () {
253
+ Be(), b(!1);
254
+ }), He = () => L(void 0, null, function* () {
250
255
  var e, n;
251
256
  if (ee)
252
257
  return;
@@ -275,18 +280,18 @@ const {
275
280
  ce(() => {
276
281
  I.current = a;
277
282
  }, [a]);
278
- const He = ee || te || be || ge || ne;
279
- et("rightarrow", (t) => {
283
+ const Oe = ee || te || be || ge || ne;
284
+ tt("rightarrow", (t) => {
280
285
  const e = t.target;
281
- (e == null ? void 0 : e.tagName) === "INPUT" || (e == null ? void 0 : e.tagName) === "TEXTAREA" || e != null && e.isContentEditable || He || Ke();
282
- }), et("leftarrow", (t) => {
286
+ (e == null ? void 0 : e.tagName) === "INPUT" || (e == null ? void 0 : e.tagName) === "TEXTAREA" || e != null && e.isContentEditable || Oe || He();
287
+ }), tt("leftarrow", (t) => {
283
288
  const e = t.target;
284
- (e == null ? void 0 : e.tagName) === "INPUT" || (e == null ? void 0 : e.tagName) === "TEXTAREA" || e != null && e.isContentEditable || He || Be();
289
+ (e == null ? void 0 : e.tagName) === "INPUT" || (e == null ? void 0 : e.tagName) === "TEXTAREA" || e != null && e.isContentEditable || Oe || Ke();
285
290
  });
286
- const ct = (t) => L(void 0, null, function* () {
291
+ const lt = (t) => L(void 0, null, function* () {
287
292
  console.log("ocrRecognize apiUrl", Pe);
288
- const e = yield tt();
289
- return bt.post(`${Pe}/aishop/v2/infer?serviceId=Actpkb4pi3vxg`, {
293
+ const e = yield nt();
294
+ return Rt.post(`${Pe}/aishop/v2/infer?serviceId=Actpkb4pi3vxg`, {
290
295
  pages: [{
291
296
  image: t,
292
297
  no: 0
@@ -298,9 +303,9 @@ const {
298
303
  }).then((n) => (console.log("ocrRecognize res", n.data.data), n.data.data.pages[0].layout.filter((r) => r.content))).catch((n) => {
299
304
  console.error("ocrRecognize error", n);
300
305
  });
301
- }), lt = () => L(void 0, null, function* () {
306
+ }), dt = () => L(void 0, null, function* () {
302
307
  const t = I.current || a;
303
- !t || !m || !x || _e.confirm({
308
+ !t || !m || !x || et.confirm({
304
309
  title: "确认要删除此数据吗?",
305
310
  content: "删除后不可恢复,请慎重操作",
306
311
  onOk: () => L(void 0, null, function* () {
@@ -332,7 +337,7 @@ const {
332
337
  }
333
338
  })
334
339
  });
335
- }), dt = () => L(void 0, null, function* () {
340
+ }), ft = () => L(void 0, null, function* () {
336
341
  if (!m || !x || !(a != null && a.id))
337
342
  return;
338
343
  const t = yield d == null ? void 0 : d.getDatasetsIdVersionsVidSsamplesSid(m, x, a.id);
@@ -367,7 +372,7 @@ const {
367
372
  })), le("hascode"));
368
373
  }
369
374
  }
370
- e && rt(Date.now()), at(Date.now()), v !== "attributeDefinition" && (Ae(!0), $([]), w(void 0), z(-1), X(void 0)), M(Q(V({}, s), {
375
+ e && ot(Date.now()), st(Date.now()), v !== "attributeDefinition" && (Ae(!0), $([]), w(void 0), z(-1), X(void 0)), M(Q(V({}, s), {
371
376
  current: 1,
372
377
  total: void 0,
373
378
  type: void 0
@@ -375,25 +380,25 @@ const {
375
380
  }
376
381
  }),
377
382
  children: [/* @__PURE__ */ l(Y, {
378
- tab: `全部(${Ue})`
383
+ tab: `全部(${Ee})`
379
384
  }, ""), /* @__PURE__ */ l(Y, {
380
- tab: `未标注(${Ge})`
385
+ tab: `未标注(${$e})`
381
386
  }, "nocode"), /* @__PURE__ */ l(Y, {
382
- tab: `已标注(${Ue - Ge})`
387
+ tab: `已标注(${Ee - $e})`
383
388
  }, "hascode")]
384
389
  })
385
390
  }), g != null && g.length ? /* @__PURE__ */ l("div", {
386
391
  className: "sample-detail",
387
392
  children: E ? a && /* @__PURE__ */ l("div", {
388
393
  className: "container",
389
- children: /* @__PURE__ */ l(Vt, {
394
+ children: /* @__PURE__ */ l(Lt, {
390
395
  ref: he,
391
396
  sample: a,
392
397
  onChange: (t) => {
393
398
  I.current = t, K(t);
394
399
  }
395
400
  })
396
- }) : /* @__PURE__ */ H(Ye, {
401
+ }) : /* @__PURE__ */ H(Ze, {
397
402
  children: [/* @__PURE__ */ l("div", {
398
403
  className: "content-mode-buttons",
399
404
  children: /* @__PURE__ */ H(Ne, {
@@ -422,7 +427,7 @@ const {
422
427
  type: void 0
423
428
  })), le("nocode"));
424
429
  }
425
- t === "textAnnotation" && (a != null && a.id) && (yield dt()), de(t);
430
+ t === "textAnnotation" && (a != null && a.id) && (yield ft()), de(t);
426
431
  }
427
432
  }),
428
433
  children: [/* @__PURE__ */ l(Y, {
@@ -438,55 +443,55 @@ const {
438
443
  })
439
444
  }), v === "textAnnotation" && a && /* @__PURE__ */ l("div", {
440
445
  className: "container",
441
- children: /* @__PURE__ */ l(At, {
446
+ children: /* @__PURE__ */ l(bt, {
442
447
  sample: a,
443
448
  labelDefinitions: we,
444
449
  onChange: (t) => {
445
450
  I.current = t, K(t);
446
451
  },
447
- ocrRecognize: ct
452
+ ocrRecognize: lt
448
453
  })
449
- }), v === "attributeDefinition" && /* @__PURE__ */ l(Rt, {
454
+ }), v === "attributeDefinition" && /* @__PURE__ */ l(Tt, {
450
455
  ref: j,
451
456
  datasetId: m,
452
457
  versionId: x,
453
458
  onAttributesChange: (t) => {
454
- Fe(t), t.length > 0 && we.length === 0 && de("textAnnotation");
459
+ Qe(t), t.length > 0 && we.length === 0 && de("textAnnotation");
455
460
  },
456
461
  onLoadingChange: (t) => {
457
- nt(t);
462
+ it(t);
458
463
  }
459
- }, `attribute-${it}`), v === "qaGeneration" && /* @__PURE__ */ l(Tt, {
464
+ }, `attribute-${rt}`), v === "qaGeneration" && /* @__PURE__ */ l(Dt, {
460
465
  ref: D,
461
466
  sample: a,
462
467
  labels: we,
463
468
  datasetId: m,
464
469
  visionId: x
465
- }, `qa-${ot}`)]
470
+ }, `qa-${at}`)]
466
471
  })
467
472
  }) : ge ? /* @__PURE__ */ l("div", {
468
473
  style: {
469
474
  padding: "48px 0",
470
475
  textAlign: "center"
471
476
  },
472
- children: /* @__PURE__ */ l(xt, {})
473
- }) : /* @__PURE__ */ l(It, {}), E || v !== "attributeDefinition" ? /* @__PURE__ */ H("div", {
477
+ children: /* @__PURE__ */ l(yt, {})
478
+ }) : /* @__PURE__ */ l(kt, {}), E || v !== "attributeDefinition" ? /* @__PURE__ */ H("div", {
474
479
  className: "vlm-detail-footer",
475
480
  children: [/* @__PURE__ */ l("div", {
476
481
  style: {
477
482
  flex: 1
478
483
  }
479
- }), /* @__PURE__ */ H(Ze, {
484
+ }), /* @__PURE__ */ H(_e, {
480
485
  size: 24,
481
486
  children: [(g == null ? void 0 : g.length) > 0 && /* @__PURE__ */ l(me, {
482
487
  type: "default",
483
488
  disabled: be || ge || te || ee || ne,
484
- onClick: Be,
489
+ onClick: Ke,
485
490
  children: "上一张"
486
491
  }, "prev"), (g == null ? void 0 : g.length) > 0 && /* @__PURE__ */ l(me, {
487
492
  type: "default",
488
493
  disabled: be || ge || te || ee || ne,
489
- onClick: Ke,
494
+ onClick: He,
490
495
  children: "下一张"
491
496
  }, "next")]
492
497
  }), /* @__PURE__ */ l("div", {
@@ -495,8 +500,8 @@ const {
495
500
  display: "flex",
496
501
  justifyContent: "flex-end"
497
502
  },
498
- children: /* @__PURE__ */ l(Ze, {
499
- children: (E || v === "textAnnotation") && (g == null ? void 0 : g.length) > 0 ? /* @__PURE__ */ H(Ye, {
503
+ children: /* @__PURE__ */ l(_e, {
504
+ children: (E || v === "textAnnotation") && (g == null ? void 0 : g.length) > 0 ? /* @__PURE__ */ H(Ze, {
500
505
  children: [/* @__PURE__ */ l(me, {
501
506
  disabled: !a || !W || te,
502
507
  type: "primary",
@@ -511,10 +516,10 @@ const {
511
516
  },
512
517
  loading: ne,
513
518
  children: "保存标注"
514
- }, "save"), /* @__PURE__ */ l(me, {
519
+ }, "save"), Ue && Ue.delete && /* @__PURE__ */ l(me, {
515
520
  type: "default",
516
521
  disabled: ne || te,
517
- onClick: lt,
522
+ onClick: dt,
518
523
  children: "删除数据"
519
524
  })]
520
525
  }) : null
@@ -524,5 +529,5 @@ const {
524
529
  });
525
530
  });
526
531
  export {
527
- Ot as default
532
+ Xt as default
528
533
  };