@glodon-aiot/dataset-annotation 3.24.0-alpha.6 → 3.25.0-alpha.7

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.
Files changed (24) hide show
  1. package/dist/es/components/ClassificationAnnotation/index.mjs +374 -325
  2. package/dist/es/components/DetectionAnnotation/components/ImageDetail/index.mjs +82 -78
  3. package/dist/es/components/DetectionAnnotation/components/ImageModal/index.mjs +28 -26
  4. package/dist/es/components/DetectionAnnotation/components/LabelMaker/index.mjs +173 -166
  5. package/dist/es/components/DetectionAnnotation/index.mjs +478 -473
  6. package/dist/es/components/OcrAnnotation/OCRBoxDetail/index.mjs +249 -230
  7. package/dist/es/components/OcrAnnotation/OcrModal/index.mjs +103 -98
  8. package/dist/es/components/OcrAnnotation/index.mjs +281 -248
  9. package/dist/es/components/VLMAnnotationDetail/VLMDetail/index.mjs +277 -272
  10. package/dist/es/components/VLMAnnotationDetail/VlmModal/index.mjs +42 -40
  11. package/dist/es/components/VLMAnnotationDetail/index.mjs +331 -278
  12. package/dist/es/index.mjs +1 -1
  13. package/dist/es/utils/checkVlmSampleLabeled.mjs +7 -0
  14. package/dist/es/utils/scrollSampleIntoView.mjs +16 -0
  15. package/dist/lib/index.js +4 -4
  16. package/dist/src/components/DetectionAnnotation/components/ImageDetail/index.d.ts +2 -0
  17. package/dist/src/components/DetectionAnnotation/components/ImageModal/index.d.ts +2 -0
  18. package/dist/src/components/OcrAnnotation/OCRBoxDetail/index.d.ts +2 -0
  19. package/dist/src/components/OcrAnnotation/OcrModal/index.d.ts +1 -0
  20. package/dist/src/components/VLMAnnotationDetail/VLMDetail/index.d.ts +6 -0
  21. package/dist/src/components/VLMAnnotationDetail/VlmModal/index.d.ts +5 -0
  22. package/dist/src/utils/checkVlmSampleLabeled.d.ts +8 -0
  23. package/dist/src/utils/scrollSampleIntoView.d.ts +9 -0
  24. package/package.json +2 -2
@@ -1,150 +1,154 @@
1
- var $ = Object.defineProperty, V = Object.defineProperties;
2
- var S = Object.getOwnPropertyDescriptors;
3
- var M = Object.getOwnPropertySymbols;
4
- var ee = Object.prototype.hasOwnProperty, ie = Object.prototype.propertyIsEnumerable;
5
- var A = (d, o, a) => o in d ? $(d, o, { enumerable: !0, configurable: !0, writable: !0, value: a }) : d[o] = a, b = (d, o) => {
6
- for (var a in o || (o = {}))
7
- ee.call(o, a) && A(d, a, o[a]);
8
- if (M)
9
- for (var a of M(o))
10
- ie.call(o, a) && A(d, a, o[a]);
11
- return d;
12
- }, U = (d, o) => V(d, S(o));
13
- import { jsxs as m, jsx as n } from "react/jsx-runtime";
14
- import { useRef as B, useState as h, useEffect as w } from "react";
15
- import { Button as H } from "antd";
16
- import { useKeyPress as K } from "ahooks";
1
+ var V = Object.defineProperty, S = Object.defineProperties;
2
+ var ee = Object.getOwnPropertyDescriptors;
3
+ var A = Object.getOwnPropertySymbols;
4
+ var ie = Object.prototype.hasOwnProperty, se = Object.prototype.propertyIsEnumerable;
5
+ var B = (n, t, a) => t in n ? V(n, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : n[t] = a, b = (n, t) => {
6
+ for (var a in t || (t = {}))
7
+ ie.call(t, a) && B(n, a, t[a]);
8
+ if (A)
9
+ for (var a of A(t))
10
+ se.call(t, a) && B(n, a, t[a]);
11
+ return n;
12
+ }, x = (n, t) => S(n, ee(t));
13
+ import { jsxs as m, jsx as d } from "react/jsx-runtime";
14
+ import { useRef as H, useState as h, useEffect as U } from "react";
15
+ import { Button as K, Spin as le } from "antd";
16
+ import { useKeyPress as O } from "ahooks";
17
17
  import "./style.less.mjs";
18
- import se from "../Labels/index.mjs";
19
- import le from "../LabelMaker/index.mjs";
20
- import O from "../../../Iconfont/index.mjs";
21
- import oe from "../../../DetectionStatus/index.mjs";
22
- const ge = (d) => {
23
- var u, z, F;
18
+ import te from "../Labels/index.mjs";
19
+ import oe from "../LabelMaker/index.mjs";
20
+ import q from "../../../Iconfont/index.mjs";
21
+ import ae from "../../../DetectionStatus/index.mjs";
22
+ const Le = (n) => {
23
+ var z, F, M;
24
24
  const {
25
- datasetId: o,
25
+ datasetId: t,
26
26
  isImageDetailVisible: a = !0,
27
27
  currentSample: e,
28
28
  onNextClick: g,
29
29
  onPrevClick: v,
30
30
  labels: r = [],
31
- editing: q,
31
+ editing: G,
32
32
  onRefresh: L,
33
- onChange: C,
34
- isPreLabel: p,
33
+ onChange: j,
34
+ isPreLabel: C,
35
35
  settingHide: D,
36
36
  imgCount: f,
37
- readonly: G,
37
+ readonly: J,
38
38
  showLabelList: E = !0,
39
- renderLabelItem: J,
40
- onLoadingChange: I
41
- } = d, Q = B(null), T = B({}), [P, W] = h({}), [y, N] = h(), [t, R] = h(), [X, Y] = h(!1), [Z, j] = h(), x = !!(e != null && e.fileUrl) && Z !== e.fileUrl;
42
- K("rightarrow", () => {
39
+ renderLabelItem: Q,
40
+ onLoadingChange: I,
41
+ switchingSample: P
42
+ } = n, T = H(null), W = H({}), [u, X] = h({}), [y, N] = h(), [o, p] = h(), [Y, Z] = h(!1), [_, k] = h(), w = !!P || !!(e != null && e.fileUrl) && _ !== e.fileUrl;
43
+ O("rightarrow", () => {
43
44
  g && g();
44
- }), K("leftarrow", () => {
45
+ }), O("leftarrow", () => {
45
46
  v && v();
46
- }), w(() => () => {
47
- X && L && L();
48
- }, []), w(() => {
47
+ }), U(() => () => {
48
+ Y && L && L();
49
+ }, []), U(() => {
49
50
  var s, l;
50
- if (N(void 0), (e == null ? void 0 : e.id) !== (t == null ? void 0 : t.id) && R(void 0), !a || !((s = e == null ? void 0 : e.labels) != null && s.length))
51
+ if (N(void 0), (e == null ? void 0 : e.id) !== (o == null ? void 0 : o.id) && p(void 0), !a || !((s = e == null ? void 0 : e.labels) != null && s.length))
51
52
  return;
52
- const i = (l = t || e) == null ? void 0 : l.labels.reduce((c, k) => (c[k.id] ? ++c[k.id] : c[k.id] = 1, c), {});
53
- W(i || {});
54
- }, [a, e, t]), w(() => {
55
- I && I(x, e == null ? void 0 : e.fileUrl);
56
- }, [x, e == null ? void 0 : e.fileUrl, I]), w(() => {
57
- if (t != null && t.labels) {
53
+ const i = (l = o || e) == null ? void 0 : l.labels.reduce((c, R) => (c[R.id] ? ++c[R.id] : c[R.id] = 1, c), {});
54
+ X(i || {});
55
+ }, [a, e, o]), U(() => {
56
+ I && I(w, e == null ? void 0 : e.fileUrl);
57
+ }, [w, e == null ? void 0 : e.fileUrl, I]), U(() => {
58
+ if (o != null && o.labels) {
58
59
  const i = [];
59
- t.labels.forEach((s) => {
60
+ o.labels.forEach((s) => {
60
61
  const l = r.find((c) => c.id === s.id);
61
- l && i.push(U(b({}, s), {
62
+ l && i.push(x(b({}, s), {
62
63
  label: l.label
63
64
  }));
64
- }), t.labels = i, R(b({}, t));
65
+ }), o.labels = i, p(b({}, o));
65
66
  }
66
67
  }, [r]);
67
- const _ = () => {
68
- Q.current && j(e == null ? void 0 : e.fileUrl);
68
+ const $ = () => {
69
+ T.current && k(e == null ? void 0 : e.fileUrl);
69
70
  };
70
- return window.onresize = _, /* @__PURE__ */ m("div", {
71
+ return window.onresize = $, /* @__PURE__ */ m("div", {
71
72
  className: "detection-image-detail",
72
73
  children: [/* @__PURE__ */ m("div", {
73
74
  className: "detail-image",
74
75
  children: [D ? /* @__PURE__ */ m("div", {
75
76
  className: "img-detail-info",
76
77
  children: ["第 ", f == null ? void 0 : f.index, " 张 / 共 ", f == null ? void 0 : f.total, " 张"]
77
- }) : /* @__PURE__ */ n("div", {
78
+ }) : /* @__PURE__ */ d("div", {
78
79
  className: "img-detail-info",
79
80
  children: f == null ? void 0 : f.index
80
81
  }), /* @__PURE__ */ m("div", {
81
82
  className: "detail-content",
82
- children: [v && /* @__PURE__ */ n(H, {
83
+ children: [v && /* @__PURE__ */ d(K, {
83
84
  className: "select-prev",
84
- icon: /* @__PURE__ */ n(O, {
85
+ icon: /* @__PURE__ */ d(q, {
85
86
  type: "icon-zuojiantou"
86
87
  }),
87
88
  type: "text",
88
- disabled: x,
89
+ disabled: w,
89
90
  onClick: () => v(),
90
91
  tabIndex: 0
91
92
  }), /* @__PURE__ */ m("div", {
92
93
  className: "select-main",
93
- ref: T,
94
- children: [((u = e == null ? void 0 : e.sampleFileName) == null ? void 0 : u.name) && /* @__PURE__ */ n("div", {
94
+ ref: W,
95
+ children: [((z = e == null ? void 0 : e.sampleFileName) == null ? void 0 : z.name) && /* @__PURE__ */ d("div", {
95
96
  className: "img-detail-name-overlay",
96
97
  children: e.sampleFileName.name
97
- }), /* @__PURE__ */ n("div", {
98
+ }), /* @__PURE__ */ d("div", {
98
99
  className: "detection-status-wrapper",
99
- children: /* @__PURE__ */ n(oe, {
100
+ children: /* @__PURE__ */ d(ae, {
100
101
  sample: e
101
102
  })
102
- }), /* @__PURE__ */ n(le, {
103
- disabled: G,
103
+ }), /* @__PURE__ */ d(oe, {
104
+ disabled: J,
104
105
  imageUrl: (e == null ? void 0 : e.fileUrl) || "",
105
106
  pen: y,
106
- labels: ((z = t ? t.labels : e == null ? void 0 : e.labels) == null ? void 0 : z.map((i) => {
107
+ labels: ((F = o ? o.labels : e == null ? void 0 : e.labels) == null ? void 0 : F.map((i) => {
107
108
  var s;
108
- return U(b({}, i), {
109
+ return x(b({}, i), {
109
110
  color: ((s = r.find((l) => l.id === i.id)) == null ? void 0 : s.color) || ""
110
111
  });
111
112
  })) || [],
112
- onImageLoad: () => j(e == null ? void 0 : e.fileUrl),
113
- onImageError: () => j(e == null ? void 0 : e.fileUrl),
113
+ onImageLoad: () => k(e == null ? void 0 : e.fileUrl),
114
+ onImageError: () => k(e == null ? void 0 : e.fileUrl),
114
115
  onChange: (i) => {
115
116
  if (N(void 0), !e)
116
117
  return;
117
- const s = U(b({}, e), {
118
+ const s = x(b({}, e), {
118
119
  labels: i.map((l) => ({
119
120
  id: l.id,
120
121
  label: l.label,
121
122
  box: l.box
122
123
  }))
123
124
  });
124
- R(s), C && C(s);
125
+ p(s), j && j(s);
125
126
  },
126
- isPreLabel: p,
127
- renderLabelItem: J
128
- }, E ? "with-slide" : "no-slide")]
129
- }), g && /* @__PURE__ */ n(H, {
127
+ isPreLabel: C,
128
+ renderLabelItem: Q
129
+ }, E ? "with-slide" : "no-slide"), P && /* @__PURE__ */ d("div", {
130
+ className: "sample-switching-mask",
131
+ children: /* @__PURE__ */ d(le, {})
132
+ })]
133
+ }), g && /* @__PURE__ */ d(K, {
130
134
  className: "select-next",
131
- icon: /* @__PURE__ */ n(O, {
135
+ icon: /* @__PURE__ */ d(q, {
132
136
  type: "icon-youjiantou"
133
137
  }),
134
138
  type: "text",
135
- disabled: x,
139
+ disabled: w,
136
140
  onClick: () => g()
137
141
  })]
138
142
  })]
139
- }), (!!(r != null && r.length) || q) && E && /* @__PURE__ */ n("div", {
143
+ }), (!!(r != null && r.length) || G) && E && /* @__PURE__ */ d("div", {
140
144
  className: "detail-slide",
141
- children: /* @__PURE__ */ n(se, {
142
- datasetId: o,
145
+ children: /* @__PURE__ */ d(te, {
146
+ datasetId: t,
143
147
  selectMode: "single",
144
- data: ((F = Object.keys(P)) == null ? void 0 : F.map((i) => {
148
+ data: ((M = Object.keys(u)) == null ? void 0 : M.map((i) => {
145
149
  const s = r.find((l) => l.id === i);
146
150
  if (s)
147
- return s.count = P[i], s;
151
+ return s.count = u[i], s;
148
152
  }).filter((i) => !!i)) || [],
149
153
  shortcut: !0,
150
154
  selected: y ? [y] : [],
@@ -161,14 +165,14 @@ const ge = (d) => {
161
165
  N(s);
162
166
  },
163
167
  onListChange: () => {
164
- Y(!0), L && L();
168
+ Z(!0), L && L();
165
169
  },
166
- isPreLabel: p,
170
+ isPreLabel: C,
167
171
  settingHide: D
168
172
  })
169
173
  })]
170
174
  });
171
175
  };
172
176
  export {
173
- ge as default
177
+ Le as default
174
178
  };
@@ -1,16 +1,16 @@
1
1
  import { jsxs as d, jsx as i } from "react/jsx-runtime";
2
- import { useState as x, useCallback as z } from "react";
3
- import { Modal as N, Button as l, Tabs as F, Space as H, Tooltip as R } from "antd";
4
- import { useKeyPress as k } from "ahooks";
2
+ import { useState as z, useCallback as F } from "react";
3
+ import { Modal as L, Button as l, Tabs as H, Space as R, Tooltip as S } from "antd";
4
+ import { useKeyPress as N } from "ahooks";
5
5
  import q from "../ImageDetail/index.mjs";
6
6
  import "./style.less.mjs";
7
7
  import G from "../../../DataEmpty/index.mjs";
8
8
  import { ISampleActionType as h } from "../../index.mjs";
9
- const _ = (w) => {
9
+ const $ = (k) => {
10
10
  const {
11
11
  datasetId: D,
12
- setIsImageDetailVisible: b,
13
- isImageDetailVisible: p = !0,
12
+ setIsImageDetailVisible: p,
13
+ isImageDetailVisible: b = !0,
14
14
  currentSample: e,
15
15
  onNextClick: o,
16
16
  onPrevClick: s,
@@ -27,20 +27,21 @@ const _ = (w) => {
27
27
  onEnterEdit: y,
28
28
  onBackToDetail: C,
29
29
  onLoadingChange: c,
30
+ switchingSample: B,
30
31
  filterItems: u,
31
- filterMode: B,
32
+ filterMode: K,
32
33
  onFilterChange: I,
33
34
  previewMode: t = !0,
34
35
  canLabel: r = !1,
35
- canDelete: L = !1
36
- } = w, [f, K] = x(!1), O = z((m, V) => {
37
- K(m), c == null || c(m, V);
36
+ canDelete: w = !1
37
+ } = k, [f, O] = z(!1), V = F((m, x) => {
38
+ O(m), c == null || c(m, x);
38
39
  }, [c]);
39
- return k("rightarrow", () => {
40
+ return N("rightarrow", () => {
40
41
  t || o && o(e == null ? void 0 : e.confirmStatus);
41
- }), k("leftarrow", () => {
42
+ }), N("leftarrow", () => {
42
43
  t || s && s(e == null ? void 0 : e.confirmStatus);
43
- }), /* @__PURE__ */ d(N, {
44
+ }), /* @__PURE__ */ d(L, {
44
45
  title: /* @__PURE__ */ d("div", {
45
46
  className: "detection-sample-detail-title",
46
47
  children: [/* @__PURE__ */ i("span", {
@@ -53,8 +54,8 @@ const _ = (w) => {
53
54
  })]
54
55
  }),
55
56
  width: "100%",
56
- open: p,
57
- onCancel: () => b(!1),
57
+ open: b,
58
+ onCancel: () => p(!1),
58
59
  footer: null,
59
60
  centered: !0,
60
61
  wrapClassName: "detection-modal-wrap",
@@ -65,15 +66,15 @@ const _ = (w) => {
65
66
  destroyOnClose: !1,
66
67
  children: [/* @__PURE__ */ i("div", {
67
68
  className: "detail-tabs",
68
- children: !t && u && /* @__PURE__ */ i(F, {
69
- activeKey: B,
69
+ children: !t && u && /* @__PURE__ */ i(H, {
70
+ activeKey: K,
70
71
  items: u,
71
72
  onChange: (m) => I && I(m)
72
73
  })
73
74
  }), e ? /* @__PURE__ */ i(q, {
74
75
  datasetId: D,
75
- isImageDetailVisible: p,
76
- setIsImageDetailVisible: b,
76
+ isImageDetailVisible: b,
77
+ setIsImageDetailVisible: p,
77
78
  currentSample: e,
78
79
  onNextClick: t ? () => o == null ? void 0 : o(e == null ? void 0 : e.confirmStatus) : void 0,
79
80
  onPrevClick: t ? () => s == null ? void 0 : s(e == null ? void 0 : e.confirmStatus) : void 0,
@@ -86,10 +87,11 @@ const _ = (w) => {
86
87
  readonly: t || !r,
87
88
  showLabelList: t ? !1 : j,
88
89
  renderLabelItem: A,
89
- onLoadingChange: O
90
+ onLoadingChange: V,
91
+ switchingSample: B
90
92
  }) : /* @__PURE__ */ i(G, {}), e && /* @__PURE__ */ i("div", {
91
93
  className: "detail-footer",
92
- children: t ? /* @__PURE__ */ d(H, {
94
+ children: t ? /* @__PURE__ */ d(R, {
93
95
  children: [y && r && /* @__PURE__ */ i("div", {
94
96
  className: "detail-actions",
95
97
  children: /* @__PURE__ */ i(l, {
@@ -97,7 +99,7 @@ const _ = (w) => {
97
99
  onClick: y,
98
100
  children: "标注"
99
101
  })
100
- }), L && /* @__PURE__ */ i(l, {
102
+ }), w && /* @__PURE__ */ i(l, {
101
103
  danger: !0,
102
104
  onClick: g,
103
105
  children: "删除数据"
@@ -119,7 +121,7 @@ const _ = (w) => {
119
121
  })]
120
122
  }), /* @__PURE__ */ d("div", {
121
123
  className: "footer-right",
122
- children: [r && e.confirmStatus === 1 && /* @__PURE__ */ i(R, {
124
+ children: [r && e.confirmStatus === 1 && /* @__PURE__ */ i(S, {
123
125
  title: /* @__PURE__ */ i("span", {
124
126
  style: {
125
127
  color: "#ff9800"
@@ -130,7 +132,7 @@ const _ = (w) => {
130
132
  children: /* @__PURE__ */ i(l, {
131
133
  type: "primary",
132
134
  onClick: () => {
133
- N.confirm({
135
+ L.confirm({
134
136
  title: "确认",
135
137
  content: "是否确认当前标注?",
136
138
  onOk: () => {
@@ -154,7 +156,7 @@ const _ = (w) => {
154
156
  },
155
157
  disabled: n,
156
158
  children: "保存标注"
157
- }), L && /* @__PURE__ */ i(l, {
159
+ }), w && /* @__PURE__ */ i(l, {
158
160
  onClick: g,
159
161
  disabled: n,
160
162
  children: "删除数据"
@@ -165,5 +167,5 @@ const _ = (w) => {
165
167
  });
166
168
  };
167
169
  export {
168
- _ as default
170
+ $ as default
169
171
  };