@glodon-aiot/dataset-annotation 3.25.1-alpha.6 → 3.26.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.
Files changed (57) hide show
  1. package/dist/dataset-annotation.js +123598 -0
  2. package/dist/dataset-annotation.umd.cjs +1017 -0
  3. package/dist/es/components/OCRImageViewer/index.mjs +117 -130
  4. package/dist/es/components/OcrAnnotation/OCRBoxDetail/index.mjs +92 -94
  5. package/dist/es/index.mjs +15 -21
  6. package/dist/example/DatasetAnnotationDemo.d.ts +3 -0
  7. package/dist/example/DemoTabs.d.ts +3 -0
  8. package/dist/example/DetectionDatasetDemo.d.ts +5 -0
  9. package/dist/example/DetectionImageDemo.d.ts +5 -0
  10. package/dist/example/OcrDatasetDemo.d.ts +5 -0
  11. package/dist/example/OcrImageDemo.d.ts +5 -0
  12. package/dist/example/OcrkvcDatasetDemo.d.ts +5 -0
  13. package/dist/example/constant.local.d.ts +6 -0
  14. package/dist/example/index.d.ts +1 -0
  15. package/dist/lib/index.js +4 -37
  16. package/dist/src/components/OCRImageViewer/index.d.ts +0 -1
  17. package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/ImageDetail/index.d.ts +16 -0
  18. package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/OCRBoxMaker/LabelEditorInput.d.ts +12 -0
  19. package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/OCRBoxMaker/LabelEditorItem.d.ts +21 -0
  20. package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/OCRBoxMaker/LableEditor.d.ts +16 -0
  21. package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/OCRBoxMaker/index.d.ts +19 -0
  22. package/dist/src/index.d.ts +0 -6
  23. package/dist/src/utils/reactCompatibility.d.ts +5 -0
  24. package/package.json +2 -2
  25. package/dist/es/_virtual/_commonjsHelpers.mjs +0 -8
  26. package/dist/es/_virtual/dayjs.min.mjs +0 -4
  27. package/dist/es/components/VersionCompare/VersionCompareSelectModal/index.mjs +0 -122
  28. package/dist/es/components/VersionCompare/adapter.mjs +0 -215
  29. package/dist/es/components/VersionCompare/components/DataChangeStatsCard.mjs +0 -68
  30. package/dist/es/components/VersionCompare/components/DiffValue.mjs +0 -31
  31. package/dist/es/components/VersionCompare/components/LabelComparisonCard.mjs +0 -130
  32. package/dist/es/components/VersionCompare/components/ModifiedSampleCompareModal.mjs +0 -207
  33. package/dist/es/components/VersionCompare/components/SampleChangeDetailsCard.mjs +0 -160
  34. package/dist/es/components/VersionCompare/components/SingleSampleDetailModal.mjs +0 -165
  35. package/dist/es/components/VersionCompare/components/VersionCompareHeader.mjs +0 -106
  36. package/dist/es/components/VersionCompare/components/VersionOverviewCard.mjs +0 -70
  37. package/dist/es/components/VersionCompare/index.mjs +0 -416
  38. package/dist/es/components/VersionCompare/mock.mjs +0 -571
  39. package/dist/es/components/VersionCompare/style.less.mjs +0 -4
  40. package/dist/es/components/VersionCompare/utils/labelColors.mjs +0 -45
  41. package/dist/es/createDatasetVersionCompare/index.mjs +0 -124
  42. package/dist/es/node_modules/dayjs/dayjs.min.mjs +0 -324
  43. package/dist/src/components/VersionCompare/VersionCompareSelectModal/index.d.ts +0 -16
  44. package/dist/src/components/VersionCompare/adapter.d.ts +0 -50
  45. package/dist/src/components/VersionCompare/components/DataChangeStatsCard.d.ts +0 -9
  46. package/dist/src/components/VersionCompare/components/DiffValue.d.ts +0 -23
  47. package/dist/src/components/VersionCompare/components/LabelComparisonCard.d.ts +0 -12
  48. package/dist/src/components/VersionCompare/components/ModifiedSampleCompareModal.d.ts +0 -48
  49. package/dist/src/components/VersionCompare/components/SampleChangeDetailsCard.d.ts +0 -21
  50. package/dist/src/components/VersionCompare/components/SingleSampleDetailModal.d.ts +0 -46
  51. package/dist/src/components/VersionCompare/components/VersionCompareHeader.d.ts +0 -13
  52. package/dist/src/components/VersionCompare/components/VersionOverviewCard.d.ts +0 -9
  53. package/dist/src/components/VersionCompare/index.d.ts +0 -34
  54. package/dist/src/components/VersionCompare/mock.d.ts +0 -25
  55. package/dist/src/components/VersionCompare/types.d.ts +0 -75
  56. package/dist/src/components/VersionCompare/utils/labelColors.d.ts +0 -13
  57. package/dist/src/createDatasetVersionCompare/index.d.ts +0 -26
@@ -1,186 +1,177 @@
1
- import { jsxs as b, jsx as s } from "react/jsx-runtime";
2
- import { forwardRef as ye, useRef as k, useState as i, useImperativeHandle as We, useEffect as xe } from "react";
1
+ import { jsxs as E, jsx as s } from "react/jsx-runtime";
2
+ import { forwardRef as pt, useRef as _, useState as i, useEffect as vt, useImperativeHandle as It } from "react";
3
3
  import "./style.less.mjs";
4
- import Ce from "classnames";
5
- import { Space as He, Tooltip as O, Button as U } from "antd";
6
- import { ZoomInOutlined as Se, ZoomOutOutlined as Ye, DragOutlined as Ee } from "@ant-design/icons";
7
- import { useKeyPress as se } from "ahooks";
8
- const ke = ye((B, ie) => {
9
- var te;
4
+ import Mt from "classnames";
5
+ import { Space as wt, Tooltip as k, Button as L } from "antd";
6
+ import { ZoomInOutlined as xt, ZoomOutOutlined as yt, DragOutlined as St } from "@ant-design/icons";
7
+ import { useKeyPress as tt } from "ahooks";
8
+ const Dt = pt((O, et) => {
9
+ var Q;
10
10
  const {
11
- url: v,
12
- offsetEdge: re = [50, 50, 50, 50],
13
- zoomable: j = !0,
14
- zoomStep: w = 0.02,
15
- zoomMax: M = 2,
11
+ url: R,
12
+ offsetEdge: ot = [50, 50, 50, 50],
13
+ zoomable: b = !0,
14
+ zoomStep: p = 0.02,
15
+ zoomMax: v = 2,
16
16
  zoomMin: I = 0,
17
- onImageLoad: L,
18
- onImageError: X,
19
- labels: z
20
- } = B, h = k({}), y = k({}), [Z, ce] = i(0), [$, ae] = i(0), [l, N] = i(1), [u, g] = i(0), [m, f] = i(0), [r, P] = i(0), [c, D] = i(0), [le, ue] = i(""), q = !!v && le === v, [K, W] = i(!1), [V, me] = i(), [x, C] = i({
17
+ onImageLoad: X,
18
+ labels: N
19
+ } = O, M = _({}), w = _({}), [j, nt] = i(0), [B, st] = i(0), [l, P] = i(1), [u, f] = i(0), [g, d] = i(0), [r, z] = i(0), [c, D] = i(0), [it, U] = i(!1), [Z, x] = i(!1), [$, rt] = i(), [y, S] = i({
21
20
  x: 0,
22
21
  y: 0
23
- }), [A, F, G, J] = re, [a, R] = i((te = B.draggable) != null ? te : !0);
24
- se("ctrl", () => {
25
- R(!0);
22
+ }), [q, K, V, A] = ot, [a, T] = i((Q = O.draggable) != null ? Q : !0);
23
+ tt("ctrl", () => {
24
+ T(!0);
26
25
  }, {
27
26
  events: ["keydown"]
28
- }), se("ctrl", () => {
29
- R(!1);
27
+ }), tt("ctrl", () => {
28
+ T(!1);
30
29
  }, {
31
30
  events: ["keyup"]
32
- });
33
- const T = () => {
34
- var oe, ne;
35
- if (!y.current || !((oe = h.current) != null && oe.naturalWidth) || !((ne = h.current) != null && ne.naturalHeight))
31
+ }), vt(() => {
32
+ U(!1);
33
+ }, [R]);
34
+ const F = () => {
35
+ if (!w.current)
36
36
  return;
37
- const e = y.current.clientWidth, t = y.current.clientHeight, o = h.current.naturalWidth, n = h.current.naturalHeight, d = e / o, E = t / n, p = d < E ? d : E, ve = (e - o * p) / 2, we = (t - n * p) / 2, Me = o * p, Ie = n * p;
38
- ce(e), ae(t), N(p), g(ve), f(we), P(Me), D((Xe) => Ie), ue(v), L && L(h.current);
39
- }, Q = k(T);
40
- Q.current = T;
41
- const H = () => {
42
- if (!j || l >= M)
37
+ const t = w.current.clientWidth, e = w.current.clientHeight, o = M.current.naturalWidth, n = M.current.naturalHeight, m = t / o, H = e / n, h = m < H ? m : H, mt = (t - o * h) / 2, ft = (e - n * h) / 2, dt = o * h, ht = n * h;
38
+ nt(t), st(e), P(h), f(mt), d(ft), z(dt), D(ht), U(!0), X && X(M.current);
39
+ }, C = () => {
40
+ if (!b || l >= v)
43
41
  return;
44
- let e = l * (1 + w), t = w;
45
- e >= M && (e = M, t = M / l - 1), g(u - r * (t / 2)), f(m - c * (t / 2)), P(r + r * t), D(c + c * t), N(e), Y();
46
- }, S = () => {
47
- if (!j || l <= I)
42
+ let t = l * (1 + p), e = p;
43
+ t >= v && (t = v, e = v / l - 1), f(u - r * (e / 2)), d(g - c * (e / 2)), z(r + r * e), D(c + c * e), P(t), Y();
44
+ }, W = () => {
45
+ if (!b || l <= I)
48
46
  return;
49
- let e = l * (1 - w), t = w;
50
- e <= I && (e = I, t = 1 - I / l), g(u - r * (-t / 2)), f(m - c * (-t / 2)), P(r + r * -t), D(c + c * -t), N(e), Y();
47
+ let t = l * (1 - p), e = p;
48
+ t <= I && (t = I, e = 1 - I / l), f(u - r * (-e / 2)), d(g - c * (-e / 2)), z(r + r * -e), D(c + c * -e), P(t), Y();
51
49
  };
52
- We(ie, () => ({
53
- zoomIn: H,
54
- zoomOut: S,
55
- onImageLoad: L
50
+ It(et, () => ({
51
+ zoomIn: C,
52
+ zoomOut: W,
53
+ onImageLoad: X
56
54
  }));
57
- const de = (e) => (e.deltaY < 0 ? H() : S(), !1), ge = (e) => {
58
- W(!0);
55
+ const ct = (t) => (t.deltaY < 0 ? C() : W(), !1), at = (t) => {
56
+ x(!0);
59
57
  const {
60
- pageX: t,
58
+ pageX: e,
61
59
  pageY: o
62
- } = e;
63
- C({
64
- x: t,
60
+ } = t;
61
+ S({
62
+ x: e,
65
63
  y: o
66
64
  });
67
- }, fe = (e) => {
68
- if (!K)
65
+ }, lt = (t) => {
66
+ if (!Z)
69
67
  return !1;
70
68
  const {
71
- pageX: t,
69
+ pageX: e,
72
70
  pageY: o
73
- } = e, n = t - x.x, d = o - x.y;
74
- C({
75
- x: t,
71
+ } = t, n = e - y.x, m = o - y.y;
72
+ S({
73
+ x: e,
76
74
  y: o
77
- }), g(u + n), f(m + d), Y();
78
- }, _ = () => {
79
- W(!1);
75
+ }), f(u + n), d(g + m), Y();
76
+ }, G = () => {
77
+ x(!1);
80
78
  };
81
- xe(() => {
82
- const e = () => {
83
- W(!1);
84
- }, t = () => {
85
- Q.current();
86
- };
87
- return window.addEventListener("mouseup", e), window.addEventListener("resize", t), () => {
88
- window.removeEventListener("mouseup", e), window.removeEventListener("resize", t);
89
- };
90
- }, []);
79
+ window.onmouseup = () => {
80
+ x(!1);
81
+ }, window.onresize = F;
91
82
  const Y = () => {
92
- u < -r + J && g(-r + J), m < -c + A && f(-c + A), u > Z - F && g(Z - F), m > $ - G && f($ - G);
93
- }, he = (e) => {
83
+ u < -r + A && f(-r + A), g < -c + q && d(-c + q), u > j - K && f(j - K), g > B - V && d(B - V);
84
+ }, ut = (t) => {
94
85
  const {
95
- touches: t
96
- } = e;
97
- if (W(!0), t.length < 2) {
86
+ touches: e
87
+ } = t;
88
+ if (x(!0), e.length < 2) {
98
89
  const {
99
90
  clientX: o,
100
91
  clientY: n
101
- } = t[0];
102
- C({
92
+ } = e[0];
93
+ S({
103
94
  x: o,
104
95
  y: n
105
96
  });
106
97
  } else
107
- me(t);
108
- }, pe = (e) => {
109
- if (!K || !e.touches)
98
+ rt(e);
99
+ }, gt = (t) => {
100
+ if (!Z || !t.touches)
110
101
  return !1;
111
102
  const {
112
- clientX: t,
103
+ clientX: e,
113
104
  clientY: o
114
- } = e.touches[0];
115
- if (e.touches.length < 2) {
116
- const n = t - x.x, d = o - x.y;
117
- C({
118
- x: t,
105
+ } = t.touches[0];
106
+ if (t.touches.length < 2) {
107
+ const n = e - y.x, m = o - y.y;
108
+ S({
109
+ x: e,
119
110
  y: o
120
- }), g(u + n), f(m + d), Y();
111
+ }), f(u + n), d(g + m), Y();
121
112
  } else {
122
- const n = e.touches, d = ee(n[0], n[1]), E = ee(V[0], V[1]);
123
- d > E ? H() : S();
113
+ const n = t.touches, m = J(n[0], n[1]), H = J($[0], $[1]);
114
+ m > H ? C() : W();
124
115
  }
125
- }, ee = (e, t) => {
126
- const o = t.pageX - e.pageX, n = t.pageY - e.pageY;
116
+ }, J = (t, e) => {
117
+ const o = e.pageX - t.pageX, n = e.pageY - t.pageY;
127
118
  return Math.sqrt(o * o + n * n);
128
119
  };
129
- return /* @__PURE__ */ b("div", {
120
+ return /* @__PURE__ */ E("div", {
130
121
  className: "ocr-image-viewer",
131
122
  children: [/* @__PURE__ */ s("div", {
132
123
  className: "marker-toolbar",
133
124
  children: /* @__PURE__ */ s("div", {
134
125
  className: "create-mode-select",
135
- children: /* @__PURE__ */ b(He, {
126
+ children: /* @__PURE__ */ E(wt, {
136
127
  direction: "vertical",
137
128
  size: 16,
138
- children: [/* @__PURE__ */ s(O, {
129
+ children: [/* @__PURE__ */ s(k, {
139
130
  title: "放大-鼠标滚轮前滑",
140
131
  placement: "right",
141
- children: /* @__PURE__ */ s(U, {
142
- icon: /* @__PURE__ */ s(Se, {}),
132
+ children: /* @__PURE__ */ s(L, {
133
+ icon: /* @__PURE__ */ s(xt, {}),
143
134
  onClick: () => {
144
- H();
135
+ C();
145
136
  }
146
137
  })
147
- }), /* @__PURE__ */ s(O, {
138
+ }), /* @__PURE__ */ s(k, {
148
139
  title: "缩小-鼠标滚轮后滑",
149
140
  placement: "right",
150
- children: /* @__PURE__ */ s(U, {
151
- icon: /* @__PURE__ */ s(Ye, {}),
141
+ children: /* @__PURE__ */ s(L, {
142
+ icon: /* @__PURE__ */ s(yt, {}),
152
143
  onClick: () => {
153
- S();
144
+ W();
154
145
  }
155
146
  })
156
- }), /* @__PURE__ */ s(O, {
147
+ }), /* @__PURE__ */ s(k, {
157
148
  title: "拖动-按住ctrl",
158
149
  placement: "right",
159
- children: /* @__PURE__ */ s(U, {
160
- icon: /* @__PURE__ */ s(Ee, {}),
150
+ children: /* @__PURE__ */ s(L, {
151
+ icon: /* @__PURE__ */ s(St, {}),
161
152
  className: a ? "active" : "",
162
153
  onClick: () => {
163
- R(!a);
154
+ T(!a);
164
155
  }
165
156
  })
166
157
  })]
167
158
  })
168
159
  })
169
- }), /* @__PURE__ */ b("div", {
170
- className: Ce({
160
+ }), /* @__PURE__ */ E("div", {
161
+ className: Mt({
171
162
  "image-map": !0,
172
163
  draggable: a
173
164
  }),
174
- ref: y,
175
- onMouseDown: a ? ge : void 0,
176
- onMouseMove: a ? fe : void 0,
177
- onMouseUp: a ? _ : void 0,
178
- onWheel: de,
179
- onTouchStart: a ? he : void 0,
180
- onTouchMove: a ? pe : void 0,
181
- onTouchEnd: a ? _ : void 0,
182
- onContextMenu: (e) => {
183
- e.preventDefault();
165
+ ref: w,
166
+ onMouseDown: a ? at : void 0,
167
+ onMouseMove: a ? lt : void 0,
168
+ onMouseUp: a ? G : void 0,
169
+ onWheel: ct,
170
+ onTouchStart: a ? ut : void 0,
171
+ onTouchMove: a ? gt : void 0,
172
+ onTouchEnd: a ? G : void 0,
173
+ onContextMenu: (t) => {
174
+ t.preventDefault();
184
175
  },
185
176
  children: [/* @__PURE__ */ s("img", {
186
177
  draggable: "false",
@@ -188,39 +179,35 @@ const ke = ye((B, ie) => {
188
179
  style: {
189
180
  position: "absolute",
190
181
  left: u,
191
- top: m,
182
+ top: g,
192
183
  width: r,
193
- height: c,
194
- visibility: q ? "visible" : "hidden"
195
- },
196
- ref: h,
197
- onLoad: T,
198
- onError: () => {
199
- X == null || X();
184
+ height: c
200
185
  },
201
- src: v,
186
+ ref: M,
187
+ onLoad: F,
188
+ src: R,
202
189
  alt: ""
203
- }), q ? /* @__PURE__ */ s("svg", {
190
+ }), it ? /* @__PURE__ */ s("svg", {
204
191
  style: {
205
192
  position: "absolute",
206
193
  left: u,
207
- top: m,
194
+ top: g,
208
195
  width: r,
209
196
  height: c
210
197
  },
211
- children: z == null ? void 0 : z.map((e, t) => {
198
+ children: N == null ? void 0 : N.map((t, e) => {
212
199
  var o;
213
200
  return /* @__PURE__ */ s("g", {
214
201
  children: /* @__PURE__ */ s("polygon", {
215
202
  className: "label-box",
216
- points: (o = e == null ? void 0 : e.box) == null ? void 0 : o.map((n) => `${n[0] * l} ${n[1] * l}`).join(",")
217
- }, e.id)
218
- }, t);
203
+ points: (o = t == null ? void 0 : t.box) == null ? void 0 : o.map((n) => `${n[0] * l} ${n[1] * l}`).join(",")
204
+ }, t.id)
205
+ }, e);
219
206
  })
220
207
  }) : ""]
221
208
  })]
222
209
  });
223
210
  });
224
211
  export {
225
- ke as default
212
+ Dt as default
226
213
  };