@glodon-aiot/dataset-annotation 3.11.1-shapshot.1765331459 → 3.13.0-alpha.28

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 (118) hide show
  1. package/dist/es/DatasetContext/index.mjs +6 -3
  2. package/dist/es/components/DetectionAnnotation/components/ImageDetail/index.mjs +94 -91
  3. package/dist/es/components/DetectionAnnotation/components/ImageModal/index.mjs +129 -0
  4. package/dist/es/components/DetectionAnnotation/components/ImageModal/style.less.mjs +4 -0
  5. package/dist/es/components/DetectionAnnotation/components/LabelMaker/Drawable.mjs +37 -28
  6. package/dist/es/components/DetectionAnnotation/components/LabelMaker/RectLabel.mjs +136 -108
  7. package/dist/es/components/DetectionAnnotation/components/LabelMaker/index.mjs +197 -162
  8. package/dist/es/components/DetectionAnnotation/index.mjs +424 -395
  9. package/dist/es/components/Iconfont/index.mjs +2 -2
  10. package/dist/es/components/OcrAnnotation/MarkKVOCRModal/KVOCRLabelMaker/index.mjs +1 -1
  11. package/dist/es/components/OcrAnnotation/MarkOCRBoxModal/OCRBoxMaker/index.mjs +1 -1
  12. package/dist/es/components/OcrAnnotation/OcrModal/index.mjs +43 -45
  13. package/dist/es/components/PicZipImportModal/config.mjs +47 -0
  14. package/dist/es/components/PicZipImportModal/index.mjs +308 -293
  15. package/dist/es/components/PicZipImportModal/pic_vlm_json_zip.svg.mjs +4 -0
  16. package/dist/es/components/PicZipImportModal/pic_vlm_zip.svg.mjs +4 -0
  17. package/dist/es/components/PreLabelOCR/index.mjs +1 -1
  18. package/dist/es/components/VLMAnnotation/RegionItem.mjs +94 -0
  19. package/dist/es/components/VLMAnnotation/TextAnnotationPanel.mjs +83 -0
  20. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasDrag.mjs +116 -0
  21. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasSetup.mjs +115 -0
  22. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasZoom.mjs +42 -0
  23. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useCropRegionImage.mjs +55 -0
  24. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useDeleteControl.mjs +51 -0
  25. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useDeleteRegion.mjs +47 -0
  26. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useDrawingMode.mjs +248 -0
  27. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useOCRLoadingIcon.mjs +106 -0
  28. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useOCRRecognition.mjs +68 -0
  29. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionHover.mjs +38 -0
  30. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionLoader.mjs +141 -0
  31. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionNameText.mjs +72 -0
  32. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionSelection.mjs +113 -0
  33. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionUpdate.mjs +103 -0
  34. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useTextLayouts.mjs +156 -0
  35. package/dist/es/components/VLMAnnotation/VLMLabelMaker/icons/del.png.mjs +4 -0
  36. package/dist/es/components/VLMAnnotation/VLMLabelMaker/index.mjs +526 -0
  37. package/dist/es/components/VLMAnnotation/VLMLabelMaker/style.less.mjs +4 -0
  38. package/dist/es/components/VLMAnnotation/VLMLabelMaker/utils/coordinateUtils.mjs +33 -0
  39. package/dist/es/components/VLMAnnotation/components/DragButton.mjs +18 -0
  40. package/dist/es/components/VLMAnnotation/components/FitToScreenButton.mjs +16 -0
  41. package/dist/es/components/VLMAnnotation/components/RectangleButton.mjs +30 -0
  42. package/dist/es/components/VLMAnnotation/components/Toolbar.mjs +40 -0
  43. package/dist/es/components/VLMAnnotation/components/ZoomControls.mjs +44 -0
  44. package/dist/es/components/VLMAnnotation/constants.mjs +50 -0
  45. package/dist/es/components/VLMAnnotation/index.mjs +242 -0
  46. package/dist/es/components/VLMAnnotation/style.less.mjs +4 -0
  47. package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/AttributeDetail/index.mjs +343 -0
  48. package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/AttributeDetail/style.less.mjs +4 -0
  49. package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/QAGenerationConfig.mjs +240 -0
  50. package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/index.mjs +201 -0
  51. package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/style.less.mjs +4 -0
  52. package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/index.mjs +455 -0
  53. package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/style.less.mjs +4 -0
  54. package/dist/es/components/VLMAnnotationDetail/VlmModal/index.mjs +149 -0
  55. package/dist/es/components/VLMAnnotationDetail/VlmModal/style.less.mjs +4 -0
  56. package/dist/es/components/VLMAnnotationDetail/index.mjs +449 -0
  57. package/dist/es/components/VLMAnnotationDetail/style.less.mjs +4 -0
  58. package/dist/es/constant.mjs +3 -3
  59. package/dist/es/createVlmtasetAnnotation/index.mjs +131 -0
  60. package/dist/es/featuresConfig.mjs +13 -9
  61. package/dist/es/index.mjs +11 -7
  62. package/dist/lib/index.js +4 -3
  63. package/dist/src/DatasetContext/index.d.ts +2 -0
  64. package/dist/src/components/DetectionAnnotation/components/ImageDetail/index.d.ts +1 -0
  65. package/dist/src/components/DetectionAnnotation/components/ImageModal/index.d.ts +34 -0
  66. package/dist/src/components/Iconfont/font_4439177_tgvowh6bmlb.d.ts +0 -0
  67. package/dist/src/components/PicZipImportModal/config.d.ts +23 -0
  68. package/dist/src/components/VLMAnnotation/ImageAnnotationDebugger.d.ts +4 -0
  69. package/dist/src/components/VLMAnnotation/RegionItem.d.ts +4 -0
  70. package/dist/src/components/VLMAnnotation/TextAnnotationPanel.d.ts +4 -0
  71. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasDrag.d.ts +13 -0
  72. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasSetup.d.ts +38 -0
  73. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasZoom.d.ts +18 -0
  74. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useCropRegionImage.d.ts +7 -0
  75. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useDeleteControl.d.ts +13 -0
  76. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useDeleteRegion.d.ts +21 -0
  77. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useDrawingMode.d.ts +32 -0
  78. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useOCRLoadingIcon.d.ts +11 -0
  79. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useOCRRecognition.d.ts +28 -0
  80. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionHover.d.ts +13 -0
  81. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionLoader.d.ts +37 -0
  82. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionNameText.d.ts +12 -0
  83. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionSelection.d.ts +15 -0
  84. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionUpdate.d.ts +32 -0
  85. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useTextLayouts.d.ts +25 -0
  86. package/dist/src/components/VLMAnnotation/VLMLabelMaker/index.d.ts +4 -0
  87. package/dist/src/components/VLMAnnotation/VLMLabelMaker/utils/coordinateUtils.d.ts +32 -0
  88. package/dist/src/components/VLMAnnotation/components/DragButton.d.ts +7 -0
  89. package/dist/src/components/VLMAnnotation/components/FitToScreenButton.d.ts +6 -0
  90. package/dist/src/components/VLMAnnotation/components/RectangleButton.d.ts +7 -0
  91. package/dist/src/components/VLMAnnotation/components/Toolbar.d.ts +4 -0
  92. package/dist/src/components/VLMAnnotation/components/ZoomControls.d.ts +4 -0
  93. package/dist/src/components/VLMAnnotation/constants.d.ts +97 -0
  94. package/dist/src/components/VLMAnnotation/index.d.ts +6 -0
  95. package/dist/src/components/VLMAnnotation/types.d.ts +172 -0
  96. package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/AttributeDetail/index.d.ts +14 -0
  97. package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/QAGenerationConfig.d.ts +12 -0
  98. package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/index.d.ts +12 -0
  99. package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/index.d.ts +12 -0
  100. package/dist/src/components/VLMAnnotationDetail/VlmModal/index.d.ts +17 -0
  101. package/dist/src/components/VLMAnnotationDetail/index.d.ts +6 -0
  102. package/dist/src/constant.d.ts +1 -1
  103. package/dist/src/createVlmtasetAnnotation/index.d.ts +16 -0
  104. package/dist/src/featuresConfig.d.ts +4 -0
  105. package/dist/src/index.d.ts +3 -0
  106. package/package.json +2 -2
  107. package/dist/dataset-annotation.js +0 -123598
  108. package/dist/dataset-annotation.umd.cjs +0 -1017
  109. package/dist/example/DatasetAnnotationDemo.d.ts +0 -3
  110. package/dist/example/DemoTabs.d.ts +0 -3
  111. package/dist/example/DetectionDatasetDemo.d.ts +0 -5
  112. package/dist/example/DetectionImageDemo.d.ts +0 -5
  113. package/dist/example/OcrDatasetDemo.d.ts +0 -5
  114. package/dist/example/OcrImageDemo.d.ts +0 -5
  115. package/dist/example/OcrkvcDatasetDemo.d.ts +0 -5
  116. package/dist/example/constant.local.d.ts +0 -6
  117. package/dist/example/index.d.ts +0 -1
  118. package/dist/src/utils/reactCompatibility.d.ts +0 -5
@@ -0,0 +1,44 @@
1
+ import { jsxs as t, jsx as o } from "react/jsx-runtime";
2
+ import { Space as m, Tooltip as n, Button as e } from "antd";
3
+ import { ZoomInOutlined as p, ZoomOutOutlined as s } from "@ant-design/icons";
4
+ import { MAX_ZOOM as a, MIN_ZOOM as h } from "../constants.mjs";
5
+ const Z = ({
6
+ scale: i,
7
+ onZoomIn: r,
8
+ onZoomOut: l
9
+ }) => {
10
+ const c = i >= a, d = i <= h;
11
+ return /* @__PURE__ */ t(m, {
12
+ direction: "vertical",
13
+ size: 16,
14
+ children: [/* @__PURE__ */ o(n, {
15
+ title: "放大-鼠标滚轮前滑",
16
+ placement: "right",
17
+ children: /* @__PURE__ */ o(e, {
18
+ icon: /* @__PURE__ */ o(p, {}),
19
+ onClick: r,
20
+ disabled: c
21
+ })
22
+ }), /* @__PURE__ */ t("div", {
23
+ style: {
24
+ textAlign: "center",
25
+ fontSize: 8,
26
+ color: "#666",
27
+ padding: "4px 0",
28
+ lineHeight: "32px"
29
+ },
30
+ children: [Math.round(i * 100), "%"]
31
+ }), /* @__PURE__ */ o(n, {
32
+ title: "缩小-鼠标滚轮后滑",
33
+ placement: "right",
34
+ children: /* @__PURE__ */ o(e, {
35
+ icon: /* @__PURE__ */ o(s, {}),
36
+ onClick: l,
37
+ disabled: d
38
+ })
39
+ })]
40
+ });
41
+ };
42
+ export {
43
+ Z as default
44
+ };
@@ -0,0 +1,50 @@
1
+ const _ = 20, E = 0.1, O = 0.999, T = 0.01, L = 100, R = 2, C = "#EAD4FF", A = "rgba(156, 36, 242, 0.1)", I = "rgba(156, 36, 242, 0.05)", n = "transparent", s = "rgba(0, 0, 0, 0)", N = [5, 5], t = "vlm-label-maker-canvas", c = 300, o = 0.7, S = 0.05, F = 0.95, M = "rect", D = "区域", a = "区域1", P = "Arial, sans-serif", r = 12, U = 4, G = 3, X = 3, g = 1.5, H = 0.5, b = 8e-3, Y = "rgba(156, 36, 242, 0.2)", K = "rgba(156, 36, 242, 0.5)", e = "#9C24F2", Z = "rgba(156, 36, 242, 0.2)", B = "rgba(156, 36, 242, 0.2)", l = "rgba(156, 36, 242, 0.5)", W = "rgba(0, 255, 0, 0.2)", i = 300, m = "#9C24F2", p = 6, V = 36, v = 20, f = 24, k = "#9C24F2", x = "image/png", d = "确认删除", h = "确定要删除此标注区域吗?", j = "确定", q = "取消";
2
+ export {
3
+ R as BASE_STROKE_WIDTH,
4
+ t as CANVAS_CONTAINER_CLASS,
5
+ m as CONTROL_POINT_COLOR,
6
+ p as CONTROL_POINT_SIZE,
7
+ o as DEFAULT_LEFT_RATIO,
8
+ F as DEFAULT_MAX_RATIO,
9
+ c as DEFAULT_MIN_LEFT_WIDTH,
10
+ S as DEFAULT_MIN_RATIO,
11
+ a as DEFAULT_REGION_NAME,
12
+ M as DEFAULT_SHAPE_TYPE,
13
+ v as DELETE_CONTROL_OFFSET_X,
14
+ f as DELETE_CONTROL_OFFSET_Y,
15
+ V as DELETE_ICON_SIZE,
16
+ q as DELETE_MODAL_CANCEL_TEXT,
17
+ h as DELETE_MODAL_CONTENT,
18
+ j as DELETE_MODAL_OK_TEXT,
19
+ d as DELETE_MODAL_TITLE,
20
+ I as HOVER_RECT_FILL_COLOR,
21
+ x as IMAGE_EXPORT_FORMAT,
22
+ _ as MAX_ZOOM,
23
+ E as MIN_ZOOM,
24
+ b as OCR_SCAN_ANIMATION_SPEED,
25
+ G as OCR_SCAN_LINE_BASE_HEIGHT,
26
+ K as OCR_SCAN_LINE_BRIGHT_COLOR,
27
+ e as OCR_SCAN_LINE_CORE_COLOR,
28
+ H as OCR_SCAN_LINE_CORE_HEIGHT_MULTIPLIER,
29
+ g as OCR_SCAN_LINE_CORE_POSITION_MULTIPLIER,
30
+ Y as OCR_SCAN_LINE_GLOW_COLOR,
31
+ X as OCR_SCAN_LINE_GLOW_MULTIPLIER,
32
+ C as RECT_STROKE_COLOR,
33
+ P as REGION_NAME_FONT_FAMILY,
34
+ r as REGION_NAME_FONT_SIZE,
35
+ U as REGION_NAME_PADDING,
36
+ D as REGION_NAME_PREFIX,
37
+ k as REGION_NAME_TEXT_COLOR,
38
+ A as SELECTED_RECT_FILL_COLOR,
39
+ s as TEMP_RECT_FILL_COLOR,
40
+ N as TEMP_RECT_STROKE_DASH_ARRAY,
41
+ W as TEXT_LAYOUT_RECT_CLICK_FEEDBACK_COLOR,
42
+ i as TEXT_LAYOUT_RECT_FEEDBACK_DELAY,
43
+ Z as TEXT_LAYOUT_RECT_FILL_COLOR,
44
+ l as TEXT_LAYOUT_RECT_HOVER_STROKE_COLOR,
45
+ B as TEXT_LAYOUT_RECT_STROKE_COLOR,
46
+ n as TRANSPARENT_FILL,
47
+ O as ZOOM_FACTOR,
48
+ T as ZOOM_PRECISION_ERROR,
49
+ L as ZOOM_STEP
50
+ };
@@ -0,0 +1,242 @@
1
+ var le = Object.defineProperty, ce = Object.defineProperties;
2
+ var ae = Object.getOwnPropertyDescriptors;
3
+ var G = Object.getOwnPropertySymbols;
4
+ var ue = Object.prototype.hasOwnProperty, ie = Object.prototype.propertyIsEnumerable;
5
+ var J = (r, o, s) => o in r ? le(r, o, { enumerable: !0, configurable: !0, writable: !0, value: s }) : r[o] = s, a = (r, o) => {
6
+ for (var s in o || (o = {}))
7
+ ue.call(o, s) && J(r, s, o[s]);
8
+ if (G)
9
+ for (var s of G(o))
10
+ ie.call(o, s) && J(r, s, o[s]);
11
+ return r;
12
+ }, u = (r, o) => ce(r, ae(o));
13
+ import { jsxs as de, jsx as M } from "react/jsx-runtime";
14
+ import { useMemo as me, useState as y, useRef as K, useEffect as T } from "react";
15
+ import "./style.less.mjs";
16
+ import pe from "./TextAnnotationPanel.mjs";
17
+ import ve from "./VLMLabelMaker/index.mjs";
18
+ import { DEFAULT_SHAPE_TYPE as fe, DEFAULT_MIN_LEFT_WIDTH as be, DEFAULT_MAX_RATIO as P, DEFAULT_MIN_RATIO as Q, DEFAULT_LEFT_RATIO as ye } from "./constants.mjs";
19
+ const k = (r) => {
20
+ var o, s;
21
+ return u(a({}, r), {
22
+ labels: (s = (o = r.labels) == null ? void 0 : o.map((l) => {
23
+ if (l.shape.name === "rect") {
24
+ const {
25
+ x: A,
26
+ y: p,
27
+ width: v,
28
+ height: d
29
+ } = l.shape;
30
+ return u(a({}, l), {
31
+ shape: u(a({}, l.shape), {
32
+ x: A + v / 2,
33
+ y: p + d / 2
34
+ })
35
+ });
36
+ }
37
+ return l;
38
+ })) != null ? s : []
39
+ });
40
+ }, Ae = (r) => {
41
+ var o, s;
42
+ return u(a({}, r), {
43
+ labels: (s = (o = r.labels) == null ? void 0 : o.map((l) => {
44
+ if (l.shape.name === "rect") {
45
+ const {
46
+ x: A,
47
+ y: p,
48
+ width: v,
49
+ height: d
50
+ } = l.shape;
51
+ return u(a({}, l), {
52
+ shape: u(a({}, l.shape), {
53
+ x: A - v / 2,
54
+ y: p - d / 2
55
+ })
56
+ });
57
+ }
58
+ return l;
59
+ })) != null ? s : []
60
+ });
61
+ }, Fe = ({
62
+ sample: r,
63
+ labelDefinitions: o,
64
+ onChange: s,
65
+ leftRatio: l,
66
+ resizable: A = !0,
67
+ minLeftRatio: p,
68
+ maxLeftRatio: v,
69
+ minLeftWidth: d = be,
70
+ onRatioChange: B,
71
+ ocrRecognize: Z,
72
+ coordinateType: L = "top-left",
73
+ hideRightSide: E,
74
+ readOnly: C
75
+ }) => {
76
+ var H, q;
77
+ const i = me(() => L === "center" ? Ae(r) : r, [r, L]), [f, R] = y((H = i == null ? void 0 : i.labels) != null ? H : []), [b, m] = y(null), [g, w] = y(null), [_, x] = y(null);
78
+ y(fe);
79
+ const z = Math.min(P, Math.max(Q, p != null ? p : Q)), O = Math.min(P, Math.max(z, v != null ? v : P)), F = K(null), N = K(!1), V = (t, e) => {
80
+ let n = z;
81
+ return typeof d == "number" && d >= 0 && e && e > 0 && (n = Math.max(n, Math.min(P, d / e))), Math.min(O, Math.max(n, t));
82
+ }, U = typeof l == "number", [W, S] = y(V(l != null ? l : ye));
83
+ T(() => {
84
+ U || S((t) => V(t));
85
+ }, [z, O]);
86
+ const ee = (q = F.current) == null ? void 0 : q.clientWidth, te = V(U ? l : W, ee), X = E ? 1 : te, ne = E ? 0 : 1 - X, oe = E ? !1 : A, [, $] = y(0);
87
+ T(() => {
88
+ const t = F.current;
89
+ if (!t)
90
+ return;
91
+ let e = null, n = 0;
92
+ if (typeof ResizeObserver != "undefined")
93
+ e = new ResizeObserver(() => {
94
+ cancelAnimationFrame(n), n = requestAnimationFrame(() => {
95
+ $((c) => c + 1);
96
+ });
97
+ }), e.observe(t);
98
+ else {
99
+ const c = () => $((h) => h + 1);
100
+ return window.addEventListener("resize", c), () => {
101
+ window.removeEventListener("resize", c);
102
+ };
103
+ }
104
+ return () => {
105
+ e && e.disconnect(), cancelAnimationFrame(n);
106
+ };
107
+ }, []), T(() => {
108
+ var t;
109
+ R((t = i == null ? void 0 : i.labels) != null ? t : []), m(null), w(null), x(null);
110
+ }, [i]), T(() => {
111
+ _ && m(null);
112
+ }, [_]), T(() => {
113
+ b !== null && x(null);
114
+ }, [b]);
115
+ const j = (t) => {
116
+ const e = F.current;
117
+ if (!e)
118
+ return;
119
+ const n = e.getBoundingClientRect(), c = V((t - n.left) / n.width, n.width);
120
+ B && B(c), U || S(c);
121
+ }, se = (t) => {
122
+ if (!A)
123
+ return;
124
+ t.preventDefault(), N.current = !0, document.body.style.userSelect = "none", document.body.style.setProperty("-webkit-user-select", "none"), document.body.style.setProperty("-moz-user-select", "none"), document.body.style.setProperty("-ms-user-select", "none"), j(t.clientX);
125
+ const e = (c) => {
126
+ N.current && (c.preventDefault(), j(c.clientX));
127
+ }, n = () => {
128
+ N.current = !1, document.body.style.userSelect = "", document.body.style.setProperty("-webkit-user-select", ""), document.body.style.setProperty("-moz-user-select", ""), document.body.style.setProperty("-ms-user-select", ""), window.removeEventListener("mousemove", e), window.removeEventListener("mouseup", n);
129
+ };
130
+ window.addEventListener("mousemove", e), window.addEventListener("mouseup", n);
131
+ };
132
+ return /* @__PURE__ */ de("div", {
133
+ className: "vlm-annotation-wrap",
134
+ ref: F,
135
+ children: [/* @__PURE__ */ M("div", {
136
+ className: "vlm-annotation-left",
137
+ style: {
138
+ flex: `${X} 1 0%`,
139
+ minWidth: typeof d == "number" ? `${d}px` : void 0
140
+ },
141
+ children: /* @__PURE__ */ M(ve, {
142
+ sample: i,
143
+ labelDefinitions: o,
144
+ labels: f,
145
+ onChange: (t) => {
146
+ if (s) {
147
+ const e = u(a({}, i), {
148
+ labels: t
149
+ });
150
+ s(L === "center" ? k(e) : e);
151
+ }
152
+ R(t);
153
+ },
154
+ onRegionSelect: x,
155
+ onRegionChange: (t, e) => {
156
+ },
157
+ ocrRecognize: Z,
158
+ activeLabelValue: b,
159
+ onClearActive: () => {
160
+ m(null), w(null);
161
+ },
162
+ selectedRegion: _,
163
+ onAppendTextToActive: (t) => {
164
+ if (!b || g === null)
165
+ return;
166
+ const e = f[g];
167
+ if (!e)
168
+ return;
169
+ const n = b.label.id, h = (e.content[n] || "") + t, D = [...f], Y = u(a({}, e), {
170
+ content: u(a({}, e.content), {
171
+ [n]: h
172
+ })
173
+ });
174
+ D[g] = Y, R(D);
175
+ const re = u(a({}, b), {
176
+ region: Y
177
+ });
178
+ if (m(re), (o == null ? void 0 : o.find((I) => I.id === n)) && setTimeout(() => {
179
+ }, 0), s) {
180
+ const I = u(a({}, i), {
181
+ labels: D
182
+ });
183
+ s(L === "center" ? k(I) : I);
184
+ }
185
+ },
186
+ readOnly: C
187
+ })
188
+ }), oe ? /* @__PURE__ */ M("div", {
189
+ className: "vlm-annotation-resizer",
190
+ role: "separator",
191
+ "aria-orientation": "vertical",
192
+ onMouseDown: se
193
+ }) : null, !E && /* @__PURE__ */ M("div", {
194
+ className: "vlm-annotation-right",
195
+ style: {
196
+ flex: `${ne} 1 0%`
197
+ },
198
+ children: /* @__PURE__ */ M(pe, {
199
+ labelDefinitions: o,
200
+ labels: f,
201
+ selectedRegion: _,
202
+ activeLabelValue: b,
203
+ activeRegionNumber: g,
204
+ readOnly: C,
205
+ onInputActive: (t, e) => {
206
+ if (e !== void 0 && f[e]) {
207
+ const n = f[e], c = {
208
+ label: t.label,
209
+ // 使用传入的 label,确保 label 字段被更新
210
+ region: a({}, n)
211
+ };
212
+ m(c), w(e);
213
+ } else
214
+ m(t), e !== void 0 && w(e);
215
+ },
216
+ onChange: (t, e) => {
217
+ if (t !== null && e !== void 0) {
218
+ const n = [...f];
219
+ n[e] = t.region, R(n);
220
+ const c = {
221
+ label: t.label,
222
+ // 确保使用传入的 label
223
+ region: n[e]
224
+ // 使用更新后的 region
225
+ };
226
+ if (m(c), w(e), s) {
227
+ const h = u(a({}, i), {
228
+ labels: n
229
+ });
230
+ s(L === "center" ? k(h) : h);
231
+ }
232
+ } else
233
+ m(null), w(null);
234
+ }
235
+ })
236
+ })]
237
+ });
238
+ };
239
+ export {
240
+ k as convertTopLeftToCenter,
241
+ Fe as default
242
+ };
@@ -0,0 +1,4 @@
1
+ const t = "";
2
+ export {
3
+ t as default
4
+ };
@@ -0,0 +1,343 @@
1
+ var X = Object.defineProperty, Y = Object.defineProperties;
2
+ var Z = Object.getOwnPropertyDescriptors;
3
+ var j = Object.getOwnPropertySymbols;
4
+ var ee = Object.prototype.hasOwnProperty, te = Object.prototype.propertyIsEnumerable;
5
+ var M = (o, s, n) => s in o ? X(o, s, { enumerable: !0, configurable: !0, writable: !0, value: n }) : o[s] = n, x = (o, s) => {
6
+ for (var n in s || (s = {}))
7
+ ee.call(s, n) && M(o, n, s[n]);
8
+ if (j)
9
+ for (var n of j(s))
10
+ te.call(s, n) && M(o, n, s[n]);
11
+ return o;
12
+ }, A = (o, s) => Y(o, Z(s));
13
+ var E = (o, s, n) => new Promise((m, h) => {
14
+ var l = (c) => {
15
+ try {
16
+ a(n.next(c));
17
+ } catch (p) {
18
+ h(p);
19
+ }
20
+ }, f = (c) => {
21
+ try {
22
+ a(n.throw(c));
23
+ } catch (p) {
24
+ h(p);
25
+ }
26
+ }, a = (c) => c.done ? m(c.value) : Promise.resolve(c.value).then(l, f);
27
+ a((n = n.apply(o, s)).next());
28
+ });
29
+ import { jsxs as u, jsx as i } from "react/jsx-runtime";
30
+ import { forwardRef as ie, useContext as ne, useState as b, useRef as re, useImperativeHandle as se, useEffect as q } from "react";
31
+ import { Row as ae, Col as F, Input as P, Select as k, Space as T, Button as v, Table as le, Modal as ce, message as C } from "antd";
32
+ import oe from "../../../../DatasetContext/index.mjs";
33
+ import "./style.less.mjs";
34
+ import B from "../../../Iconfont/index.mjs";
35
+ const de = ie((o, s) => {
36
+ const {
37
+ datasetId: n,
38
+ versionId: m,
39
+ onAttributesChange: h,
40
+ onLoadingChange: l
41
+ } = o, {
42
+ services: {
43
+ cvforceDatahub: f
44
+ }
45
+ } = ne(oe), [a, c] = b([]), [p, N] = b(!1), [D, g] = b(""), [w, O] = b(!1), [R, y] = b(null), I = re(""), S = (e) => {
46
+ const t = [...e].sort((r, d) => r.id.localeCompare(d.id));
47
+ return JSON.stringify(t);
48
+ }, U = () => S(a) !== I.current, z = () => new Promise((e) => {
49
+ if (!U()) {
50
+ e(!0);
51
+ return;
52
+ }
53
+ ce.confirm({
54
+ title: "提示",
55
+ content: "属性列表有未保存的更改,确定要离开吗?",
56
+ okText: "确定",
57
+ cancelText: "取消",
58
+ onOk: () => {
59
+ e(!0);
60
+ },
61
+ onCancel: () => {
62
+ e(!1);
63
+ }
64
+ });
65
+ });
66
+ se(s, () => ({
67
+ hasUnsavedChanges: U,
68
+ checkDirtyAndConfirm: z
69
+ }));
70
+ const V = () => E(void 0, null, function* () {
71
+ N(!0), l == null || l(!0);
72
+ try {
73
+ if (n && m && f) {
74
+ const t = (yield f.getDatasetsIdVersionsVidConfigs(n, m)) || [];
75
+ return c(t), I.current = S(t), t;
76
+ }
77
+ } catch (e) {
78
+ console.error("获取属性列表失败:", e);
79
+ } finally {
80
+ N(!1), l == null || l(!1);
81
+ }
82
+ });
83
+ q(() => {
84
+ V();
85
+ }, []), q(() => {
86
+ const e = (t) => {
87
+ if (S(a) !== I.current)
88
+ return t.preventDefault(), t.returnValue = "", "";
89
+ };
90
+ return window.addEventListener("beforeunload", e), () => {
91
+ window.removeEventListener("beforeunload", e);
92
+ };
93
+ }, [a]);
94
+ const _ = () => {
95
+ if (!D.trim()) {
96
+ C.error("属性名称不能为空");
97
+ return;
98
+ }
99
+ const e = {
100
+ id: `attr-${Date.now()}`,
101
+ name: D.trim(),
102
+ type: "text"
103
+ }, t = [...a, e];
104
+ c(t), g("");
105
+ }, H = () => {
106
+ g("");
107
+ }, J = (e) => {
108
+ const t = a.filter((r) => r.id !== e);
109
+ c(t);
110
+ }, K = () => {
111
+ c([]), O(!1), y(null);
112
+ }, W = () => {
113
+ if (a.filter((t) => !t.name || !t.name.trim()).length > 0) {
114
+ C.error("属性名称不能为空");
115
+ return;
116
+ }
117
+ O(!w), y(null);
118
+ }, $ = (e, t) => {
119
+ const r = a.map((d) => d.id === e ? A(x({}, d), {
120
+ name: t
121
+ }) : d);
122
+ c(r);
123
+ }, G = (e, t) => {
124
+ const r = a.map((d) => d.id === e ? A(x({}, d), {
125
+ type: t
126
+ }) : d);
127
+ c(r);
128
+ }, L = () => E(void 0, null, function* () {
129
+ if (!(!n || !m || !f)) {
130
+ N(!0), l == null || l(!0);
131
+ try {
132
+ const e = a.map((r) => {
133
+ var d;
134
+ return A(x({}, r), {
135
+ id: (d = r.id) != null && d.startsWith("attr-") ? "" : r.id
136
+ });
137
+ });
138
+ console.log("attributes", a), yield f.saveVisionLabelConfigs(n, m, {
139
+ data: e
140
+ });
141
+ const t = yield V();
142
+ C.success("保存成功"), h == null || h(t || a);
143
+ } catch (e) {
144
+ throw console.error("保存属性列表失败:", e), C.error("保存失败"), e;
145
+ } finally {
146
+ N(!1), l == null || l(!1);
147
+ }
148
+ }
149
+ }), Q = [{
150
+ title: "序号",
151
+ key: "index",
152
+ width: 80,
153
+ render: (e, t, r) => r + 1
154
+ }, {
155
+ title: "属性名称",
156
+ dataIndex: "name",
157
+ key: "name",
158
+ render: (e, t) => w ? /* @__PURE__ */ i(P, {
159
+ value: e,
160
+ showCount: !0,
161
+ maxLength: 32,
162
+ onChange: (r) => {
163
+ $(t.id, r.target.value);
164
+ },
165
+ onBlur: () => {
166
+ R === t.id && y(null);
167
+ },
168
+ onFocus: () => {
169
+ y(t.id);
170
+ }
171
+ }) : /* @__PURE__ */ i("span", {
172
+ children: e
173
+ })
174
+ }, {
175
+ title: "属性类型",
176
+ dataIndex: "type",
177
+ key: "type",
178
+ render: (e, t) => w ? /* @__PURE__ */ i(k, {
179
+ value: e || "text",
180
+ onChange: (r) => {
181
+ G(t.id, r);
182
+ },
183
+ style: {
184
+ width: "100%"
185
+ },
186
+ onBlur: () => {
187
+ R === t.id && y(null);
188
+ },
189
+ onFocus: () => {
190
+ y(t.id);
191
+ },
192
+ disabled: !0,
193
+ children: /* @__PURE__ */ i(k.Option, {
194
+ value: "text",
195
+ children: "文本"
196
+ })
197
+ }) : /* @__PURE__ */ i("span", {
198
+ children: "文本"
199
+ })
200
+ }, {
201
+ title: "操作",
202
+ key: "action",
203
+ width: 100,
204
+ render: (e, t) => /* @__PURE__ */ i(v, {
205
+ type: "link",
206
+ onClick: () => J(t.id),
207
+ children: "删除"
208
+ })
209
+ }];
210
+ return /* @__PURE__ */ u("div", {
211
+ className: "attribute-detail",
212
+ children: [/* @__PURE__ */ i("div", {
213
+ className: "use-tips",
214
+ children: /* @__PURE__ */ i("div", {
215
+ children: "使用须知:用户需清楚能从图纸中提取出所有类型的信息,图片中的标注信息(如“零件名称”、“规格型号”),属性定义对应全局"
216
+ })
217
+ }), /* @__PURE__ */ u("div", {
218
+ className: "lists",
219
+ children: [/* @__PURE__ */ u(ae, {
220
+ className: "lists-content",
221
+ gutter: 48,
222
+ children: [/* @__PURE__ */ i(F, {
223
+ span: 12,
224
+ children: /* @__PURE__ */ u("div", {
225
+ className: "list-item",
226
+ children: [/* @__PURE__ */ i("div", {
227
+ className: "list-item-header",
228
+ children: /* @__PURE__ */ i("div", {
229
+ className: "list-item-title",
230
+ children: "新增属性"
231
+ })
232
+ }), /* @__PURE__ */ u("div", {
233
+ className: "list-item-content",
234
+ children: [/* @__PURE__ */ u("div", {
235
+ className: "form-item",
236
+ children: [/* @__PURE__ */ i("div", {
237
+ className: "form-label",
238
+ children: "属性名称"
239
+ }), /* @__PURE__ */ i(P, {
240
+ showCount: !0,
241
+ maxLength: 32,
242
+ value: D,
243
+ onChange: (e) => g(e.target.value),
244
+ placeholder: "请输入属性名称",
245
+ onPressEnter: _
246
+ })]
247
+ }), /* @__PURE__ */ u("div", {
248
+ className: "form-item",
249
+ children: [/* @__PURE__ */ i("div", {
250
+ className: "form-label",
251
+ children: "属性类型"
252
+ }), /* @__PURE__ */ i(k, {
253
+ value: "text",
254
+ disabled: !0,
255
+ style: {
256
+ width: "100%"
257
+ },
258
+ children: /* @__PURE__ */ i(k.Option, {
259
+ value: "text",
260
+ children: "文本"
261
+ })
262
+ })]
263
+ }), /* @__PURE__ */ i("div", {
264
+ className: "form-actions",
265
+ children: /* @__PURE__ */ u(T, {
266
+ children: [/* @__PURE__ */ i(v, {
267
+ type: "primary",
268
+ onClick: _,
269
+ children: "添加属性"
270
+ }), /* @__PURE__ */ i(v, {
271
+ onClick: H,
272
+ children: "取消"
273
+ })]
274
+ })
275
+ })]
276
+ })]
277
+ })
278
+ }), /* @__PURE__ */ i(F, {
279
+ span: 12,
280
+ children: /* @__PURE__ */ u("div", {
281
+ className: "list-item",
282
+ children: [/* @__PURE__ */ u("div", {
283
+ className: "list-item-header",
284
+ children: [/* @__PURE__ */ i("div", {
285
+ className: "list-item-title",
286
+ children: "属性列表"
287
+ }), /* @__PURE__ */ u(T, {
288
+ style: {
289
+ height: 32
290
+ },
291
+ children: [/* @__PURE__ */ i(v, {
292
+ type: "text",
293
+ icon: w ? /* @__PURE__ */ i(B, {
294
+ type: "icon-queding",
295
+ className: "self-icon"
296
+ }) : /* @__PURE__ */ i(B, {
297
+ type: "icon-editing",
298
+ className: "self-icon"
299
+ }),
300
+ onClick: W
301
+ }), /* @__PURE__ */ i(v, {
302
+ type: "text",
303
+ icon: /* @__PURE__ */ i(B, {
304
+ type: "icon-qingchujiyi",
305
+ className: "self-icon"
306
+ }),
307
+ onClick: K
308
+ })]
309
+ })]
310
+ }), /* @__PURE__ */ i("div", {
311
+ className: "list-item-content table-wrapper",
312
+ children: /* @__PURE__ */ i(le, {
313
+ columns: Q,
314
+ dataSource: a,
315
+ rowKey: "id",
316
+ pagination: !1,
317
+ size: "small",
318
+ scroll: {
319
+ y: "100%"
320
+ }
321
+ })
322
+ })]
323
+ })
324
+ })]
325
+ }), /* @__PURE__ */ i("div", {
326
+ className: "attribute-detail-footer",
327
+ children: /* @__PURE__ */ i(T, {
328
+ children: /* @__PURE__ */ i(v, {
329
+ type: "primary",
330
+ loading: p,
331
+ disabled: p,
332
+ onClick: L,
333
+ children: "保存"
334
+ })
335
+ })
336
+ })]
337
+ })]
338
+ });
339
+ });
340
+ de.displayName = "AttributeDetail";
341
+ export {
342
+ de as default
343
+ };
@@ -0,0 +1,4 @@
1
+ const t = "";
2
+ export {
3
+ t as default
4
+ };