@glodon-aiot/dataset-annotation 3.17.0-alpha.1 → 3.17.0-alpha.2

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