@glodon-aiot/dataset-annotation 3.10.0-alpha.18 → 3.10.0-snapshot.15

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 (30) hide show
  1. package/dist/dataset-annotation.js +123598 -0
  2. package/dist/dataset-annotation.umd.cjs +1017 -0
  3. package/dist/es/components/DetectionAnnotation/components/LabelMaker/Drawable.mjs +28 -37
  4. package/dist/es/components/OcrAnnotation/MarkKVOCRModal/KVOCRLabelMaker/index.mjs +1 -1
  5. package/dist/es/components/OcrAnnotation/MarkOCRBoxModal/OCRBoxMaker/index.mjs +1 -1
  6. package/dist/es/components/OcrAnnotation/OcrModal/index.mjs +45 -43
  7. package/dist/es/components/PicZipImportModal/index.mjs +220 -219
  8. package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/AttributeDetail/index.mjs +21 -19
  9. package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/index.mjs +43 -43
  10. package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/index.mjs +230 -247
  11. package/dist/es/components/VLMAnnotationDetail/VlmModal/index.mjs +64 -68
  12. package/dist/es/components/VLMAnnotationDetail/index.mjs +174 -177
  13. package/dist/es/index.mjs +1 -1
  14. package/dist/example/DatasetAnnotationDemo.d.ts +3 -0
  15. package/dist/example/DemoTabs.d.ts +3 -0
  16. package/dist/example/DetectionDatasetDemo.d.ts +5 -0
  17. package/dist/example/DetectionImageDemo.d.ts +5 -0
  18. package/dist/example/OcrDatasetDemo.d.ts +5 -0
  19. package/dist/example/OcrImageDemo.d.ts +5 -0
  20. package/dist/example/OcrkvcDatasetDemo.d.ts +5 -0
  21. package/dist/example/constant.local.d.ts +6 -0
  22. package/dist/example/index.d.ts +1 -0
  23. package/dist/lib/index.js +3 -3
  24. package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/ImageDetail/index.d.ts +16 -0
  25. package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/OCRBoxMaker/LabelEditorInput.d.ts +12 -0
  26. package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/OCRBoxMaker/LabelEditorItem.d.ts +21 -0
  27. package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/OCRBoxMaker/LableEditor.d.ts +16 -0
  28. package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/OCRBoxMaker/index.d.ts +19 -0
  29. package/dist/src/utils/reactCompatibility.d.ts +5 -0
  30. package/package.json +8 -4
@@ -1,54 +1,45 @@
1
- function Y(e, n) {
2
- T(e);
3
- let h = -1, s = -1, p = 0, m = 0, w = !1;
4
- e.on("mouse:down:before", (d) => {
5
- const f = d.target, u = e.getActiveObject();
6
- if (f && f !== e.backgroundImage && u === f) {
7
- e.skipTargetFind = !1;
1
+ function I(e, u) {
2
+ y(e);
3
+ let h = -1, s = -1, n = 0, p = 0;
4
+ e.on("mouse:down", (g) => {
5
+ h = -1, s = -1, n = 0, p = 0;
6
+ const i = e.getZoom();
7
+ s = g.e.offsetX / i, h = g.e.offsetY / i;
8
+ }), e.on("mouse:up", (g) => {
9
+ if (s === -1 && h === -1)
8
10
  return;
9
- }
10
- u && (e.discardActiveObject(), e.renderAll()), e.skipTargetFind = !0;
11
- }), e.on("mouse:down", (d) => {
12
- if (!e.skipTargetFind)
11
+ const i = e.getZoom(), m = g.e.offsetX > e.getWidth() ? e.getWidth() / i : g.e.offsetX / i, w = g.e.offsetY > e.getHeight() ? e.getHeight() / i : g.e.offsetY / i;
12
+ if (n = Math.abs(m - s), p = Math.abs(w - h), n === 0 || p === 0)
13
13
  return;
14
- w = !0, h = -1, s = -1, p = 0, m = 0;
15
- const f = e.getZoom();
16
- s = d.e.offsetX / f, h = d.e.offsetY / f;
17
- }), e.on("mouse:up", (d) => {
18
- if (e.skipTargetFind = !1, !w || (w = !1, s === -1 && h === -1))
19
- return;
20
- const f = e.getZoom(), u = d.e.offsetX > e.getWidth() ? e.getWidth() / f : d.e.offsetX / f, b = d.e.offsetY > e.getHeight() ? e.getHeight() / f : d.e.offsetY / f;
21
- if (p = Math.abs(u - s), m = Math.abs(b - h), p === 0 || m === 0)
22
- return;
23
- const y = e.viewportTransform ? e.viewportTransform[4] / f : 0, F = e.viewportTransform ? e.viewportTransform[5] / f : 0;
24
- let r = h > b ? b : h, i = s > u ? u : s, l = p, g = m;
25
- r = r - F, i = i - y;
26
- const I = () => {
27
- var o, k;
14
+ const T = e.viewportTransform ? e.viewportTransform[4] / i : 0, X = e.viewportTransform ? e.viewportTransform[5] / i : 0;
15
+ let f = h > w ? w : h, r = s > m ? m : s, l = n, d = p;
16
+ f = f - X, r = r - T;
17
+ const Y = () => {
18
+ var o, b;
28
19
  const t = e.backgroundImage;
29
- t && typeof t != "string" && ((o = t.aCoords) != null && o.tl.x, (k = t.aCoords) != null && k.tl.y), t && typeof t != "string" && t.top !== void 0 && t.height !== void 0 && t.left !== void 0 && t.width !== void 0 && (r < t.top && (g = g - (t.top - r), r = t.top), r + g > t.top + t.height && (g = t.top + t.height - r + g - g, r = t.height + t.top - g), i < t.left && (l = l - (t.left - i), i = t.left), i + l > t.left + t.width && (l = t.left + t.width - i + l - l, i = t.width + t.left - l));
30
- }, X = (t) => {
20
+ t && typeof t != "string" && ((o = t.aCoords) != null && o.tl.x, (b = t.aCoords) != null && b.tl.y), t && typeof t != "string" && t.top !== void 0 && t.height !== void 0 && t.left !== void 0 && t.width !== void 0 && (f < t.top && (d = d - (t.top - f), f = t.top), f + d > t.top + t.height && (d = t.top + t.height - f + d - d, f = t.height + t.top - d), r < t.left && (l = l - (t.left - r), r = t.left), r + l > t.left + t.width && (l = t.left + t.width - r + l - l, r = t.width + t.left - l));
21
+ }, k = (t) => {
31
22
  const o = e.backgroundImage;
32
23
  return !(o && typeof o != "string" && o.top !== void 0 && o.height !== void 0 && o.left !== void 0 && o.width !== void 0 && (t[0] < o.left || t[1] < o.top || t[0] > o.left + o.width || t[1] > o.top + o.height));
33
24
  };
34
- I();
35
- const c = [[i, r], [i + l, r], [i + l, r + g], [i, r + g]];
36
- n && c.every((t) => X(t)) && n({
25
+ Y();
26
+ const c = [[r, f], [r + l, f], [r + l, f + d], [r, f + d]];
27
+ u && c.every((t) => k(t)) && u({
37
28
  id: "",
38
29
  color: "#cccccc",
39
30
  label: "未知",
40
31
  box: c
41
- }), T(e);
32
+ }), e.skipTargetFind = !1, y(e);
42
33
  });
43
34
  }
44
- const T = (e) => {
45
- e.off("mouse:down"), e.off("mouse:down:before"), e.off("mouse:up"), e.skipTargetFind = !1;
35
+ const y = (e) => {
36
+ e.off("mouse:down"), e.off("mouse:up");
46
37
  };
47
- function j(e, n, h) {
38
+ function x(e, u, h) {
48
39
  if (!h)
49
- return Y(e, n), e;
40
+ return I(e, u), e;
50
41
  }
51
42
  export {
52
- j as drawable,
53
- T as stopDraw
43
+ x as drawable,
44
+ y as stopDraw
54
45
  };
@@ -14,7 +14,7 @@ import { jsx as E } from "react/jsx-runtime";
14
14
  import { useState as I, useContext as ge, useEffect as B } from "react";
15
15
  import ce from "./LableEditor.mjs";
16
16
  import { fabric as X } from "fabric";
17
- import { useKeyPress as oe } from "ahooks";
17
+ import oe from "ahooks/lib/useKeyPress";
18
18
  import { Spin as le } from "antd";
19
19
  import he from "react-dom";
20
20
  import { getUuid as K } from "../../../../utils/index.mjs";
@@ -22,7 +22,7 @@ var ge = (r, m) => {
22
22
  import { jsx as S, jsxs as Xe } from "react/jsx-runtime";
23
23
  import { useState as U, useEffect as F } from "react";
24
24
  import { fabric as z } from "fabric";
25
- import { useKeyPress as le } from "ahooks";
25
+ import le from "ahooks/lib/useKeyPress";
26
26
  import { Spin as $e, Space as Ie, Radio as me, Tooltip as se, Button as he } from "antd";
27
27
  import Me from "react-dom";
28
28
  import "./style.less.mjs";
@@ -1,17 +1,17 @@
1
- import { jsxs as a, jsx as s, Fragment as H } from "react/jsx-runtime";
2
- import { useRef as N, useState as n, useContext as Q, useEffect as k } from "react";
3
- import { Modal as u, Button as d, Tabs as V, Tooltip as X, Space as Y, message as R } from "antd";
1
+ import { jsxs as a, jsx as s, Fragment as G } from "react/jsx-runtime";
2
+ import { useRef as N, useState as n, useContext as H, useEffect as k } from "react";
3
+ import { Modal as u, Button as d, Tabs as I, Tooltip as Q, Space as X, message as v } from "antd";
4
4
  import "./style.less.mjs";
5
- import v from "react-json-view";
6
- import { useKeyPress as T } from "ahooks";
5
+ import Y from "react-json-view";
6
+ import { useKeyPress as R } from "ahooks";
7
7
  import Z from "../../MarkDescriptions/index.mjs";
8
- import x from "../../Iconfont/index.mjs";
8
+ import T from "../../Iconfont/index.mjs";
9
9
  import _ from "../../../DatasetContext/index.mjs";
10
10
  import $ from "../../OCRImageViewer/index.mjs";
11
11
  import S from "../../ScanTable/index.mjs";
12
- const ee = v.default || v, {
13
- TabPane: I
14
- } = V, fe = (j) => {
12
+ const {
13
+ TabPane: x
14
+ } = I, me = (V) => {
15
15
  var O, M;
16
16
  const {
17
17
  isOcrModalVisible: c,
@@ -22,10 +22,10 @@ const ee = v.default || v, {
22
22
  datasetId: i,
23
23
  versionId: r,
24
24
  ocrMarkTmpl: l,
25
- handleMarkClick: w,
26
- updateSampleList: z,
25
+ handleMarkClick: j,
26
+ updateSampleList: w,
27
27
  isPreLabel: m
28
- } = j, D = N(null), J = N({}), [f, K] = n("annotation"), [e, P] = n(), [L, E] = n(), [q, A] = n([]), [B, g] = n(!1), {
28
+ } = V, z = N(null), D = N({}), [f, K] = n("annotation"), [e, P] = n(), [J, L] = n(), [E, q] = n([]), [A, g] = n(!1), {
29
29
  services: {
30
30
  cvforceDatahub: t
31
31
  },
@@ -34,32 +34,32 @@ const ee = v.default || v, {
34
34
  } = {
35
35
  datasetManager: !1
36
36
  }
37
- } = Q(_);
38
- T("rightarrow", () => {
37
+ } = H(_);
38
+ R("rightarrow", () => {
39
39
  p();
40
- }), T("leftarrow", () => {
40
+ }), R("leftarrow", () => {
41
41
  b();
42
42
  }), k(() => {
43
- i && (t == null || t.listCategory(i).then((o) => A(o || [])));
43
+ i && (t == null || t.listCategory(i).then((o) => q(o || [])));
44
44
  }, [i]), k(() => {
45
45
  c && i && r && (t == null || t.getDatasetsIdVersionsVidSsamplesSid(i, r, h.id).then((o) => {
46
46
  P(o);
47
47
  }));
48
48
  }, [c, h]);
49
- const F = () => {
49
+ const B = () => {
50
50
  C(!1);
51
- }, U = (o) => {
51
+ }, F = (o) => {
52
52
  K(o);
53
- }, W = (o) => {
54
- E(o);
55
- }, G = () => {
53
+ }, U = (o) => {
54
+ L(o);
55
+ }, W = () => {
56
56
  u.confirm({
57
57
  title: "确认要删除此数据吗?",
58
58
  content: "删除后不可恢复,请慎重操作",
59
59
  onOk: () => {
60
60
  !i || !r || !(e != null && e.id) || t == null || t.delDatasetsIdVersionsVidSamplesId(i, r, e.id).then(() => {
61
- R.success("删除成功"), C(!1), z();
62
- }).catch(() => R.error("删除失败"));
61
+ v.success("删除成功"), C(!1), w();
62
+ }).catch(() => v.error("删除失败"));
63
63
  }
64
64
  });
65
65
  };
@@ -75,7 +75,7 @@ const ee = v.default || v, {
75
75
  className: "ocr-modal",
76
76
  open: c,
77
77
  destroyOnClose: !0,
78
- onCancel: () => F(),
78
+ onCancel: () => B(),
79
79
  maskClosable: !1,
80
80
  centered: !0,
81
81
  footer: null,
@@ -85,25 +85,25 @@ const ee = v.default || v, {
85
85
  className: "detail-content",
86
86
  children: [/* @__PURE__ */ s(d, {
87
87
  className: "select-prev",
88
- icon: /* @__PURE__ */ s(x, {
88
+ icon: /* @__PURE__ */ s(T, {
89
89
  type: "icon-zuojiantou"
90
90
  }),
91
91
  type: "text",
92
92
  onClick: () => b()
93
93
  }), /* @__PURE__ */ s("div", {
94
94
  className: "select-main",
95
- ref: J,
95
+ ref: D,
96
96
  children: /* @__PURE__ */ s($, {
97
97
  zoomMin: 0.1,
98
98
  zoomMax: 10,
99
99
  zoomStep: 0.1,
100
100
  url: (e == null ? void 0 : e.fileUrl) || "",
101
- ref: D,
101
+ ref: z,
102
102
  labels: e == null ? void 0 : e.labels
103
103
  })
104
104
  }), /* @__PURE__ */ s(d, {
105
105
  className: "select-next",
106
- icon: /* @__PURE__ */ s(x, {
106
+ icon: /* @__PURE__ */ s(T, {
107
107
  type: "icon-youjiantou"
108
108
  }),
109
109
  type: "text",
@@ -113,28 +113,30 @@ const ee = v.default || v, {
113
113
  className: "detail-slide",
114
114
  children: [/* @__PURE__ */ s("div", {
115
115
  className: "slide-header",
116
- children: /* @__PURE__ */ a(V, {
116
+ children: /* @__PURE__ */ a(I, {
117
117
  className: "header-tab",
118
- onChange: U,
118
+ onChange: F,
119
119
  activeKey: f,
120
- children: [/* @__PURE__ */ s(I, {
120
+ children: [/* @__PURE__ */ s(x, {
121
121
  tab: "标注信息"
122
- }, "annotation"), /* @__PURE__ */ s(I, {
122
+ }, "annotation"), /* @__PURE__ */ s(x, {
123
123
  tab: "JSON"
124
124
  }, "json")]
125
125
  })
126
126
  }), /* @__PURE__ */ a("div", {
127
127
  className: "slide-main",
128
- children: [f === "annotation" && /* @__PURE__ */ s(H, {
128
+ children: [f === "annotation" && /* @__PURE__ */ s(G, {
129
129
  children: l === "TableOCR" ? /* @__PURE__ */ s(S, {
130
130
  currentInfer: e == null ? void 0 : e.labels,
131
- onCellSelect: (o) => W(o),
132
- currentCell: L
131
+ onCellSelect: (o) => U(o),
132
+ currentCell: J
133
133
  }) : (M = e == null ? void 0 : e.labels) != null && M.length ? /* @__PURE__ */ s(Z, {
134
134
  labels: e == null ? void 0 : e.labels,
135
- catagories: q
135
+ catagories: E
136
136
  }) : "暂无标注信息"
137
- }), f === "json" && /* @__PURE__ */ s(ee, {
137
+ }), f === "json" && // eslint-disable-next-line @typescript-eslint/ban-ts-comment
138
+ // @ts-ignore
139
+ /* @__PURE__ */ s(Y, {
138
140
  name: !1,
139
141
  iconStyle: "square",
140
142
  indentWidth: 2,
@@ -150,21 +152,21 @@ const ee = v.default || v, {
150
152
  style: l === "DetectionOCR" ? {
151
153
  width: "100%"
152
154
  } : void 0,
153
- children: /* @__PURE__ */ s(X, {
155
+ children: /* @__PURE__ */ s(Q, {
154
156
  title: "预标注进行中,请任务完成后再试",
155
- open: B,
156
- children: /* @__PURE__ */ a(Y, {
157
+ open: A,
158
+ children: /* @__PURE__ */ a(X, {
157
159
  onMouseEnter: () => m && g(!0),
158
160
  onMouseLeave: () => g(!1),
159
161
  children: [/* @__PURE__ */ s(d, {
160
162
  type: "primary",
161
163
  disabled: l !== "StructKVCOCR" && l !== "DetectionOCR" || m,
162
- onClick: () => w(e == null ? void 0 : e.id),
164
+ onClick: () => j(e == null ? void 0 : e.id),
163
165
  children: "标注"
164
166
  }), y && y.delete && /* @__PURE__ */ s(d, {
165
167
  danger: !0,
166
168
  type: "ghost",
167
- onClick: G,
169
+ onClick: W,
168
170
  disabled: m,
169
171
  children: "删除数据"
170
172
  })]
@@ -174,5 +176,5 @@ const ee = v.default || v, {
174
176
  });
175
177
  };
176
178
  export {
177
- fe as default
179
+ me as default
178
180
  };