@glodon-aiot/dataset-annotation 3.9.0-beta.9 → 3.10.0-alpha.11
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.
- package/dist/es/DatasetContext/index.mjs +6 -3
- package/dist/es/components/Iconfont/index.mjs +2 -2
- package/dist/es/components/PicZipImportModal/config.mjs +41 -0
- package/dist/es/components/PicZipImportModal/index.mjs +317 -301
- package/dist/es/components/PicZipImportModal/pic_vlm_json_zip.svg.mjs +4 -0
- package/dist/es/components/PicZipImportModal/pic_vlm_zip.svg.mjs +4 -0
- package/dist/es/components/VLMAnnotation/RegionItem.mjs +95 -0
- package/dist/es/components/VLMAnnotation/TextAnnotationPanel.mjs +83 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasDrag.mjs +75 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasSetup.mjs +115 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasZoom.mjs +42 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useCropRegionImage.mjs +55 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useDeleteControl.mjs +51 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useDeleteRegion.mjs +47 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useDrawingMode.mjs +220 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useOCRLoadingIcon.mjs +106 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useOCRRecognition.mjs +68 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionHover.mjs +38 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionLoader.mjs +141 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionNameText.mjs +72 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionSelection.mjs +102 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionUpdate.mjs +103 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useTextLayouts.mjs +156 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/icons/del.png.mjs +4 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/index.mjs +507 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/style.less.mjs +4 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/utils/coordinateUtils.mjs +33 -0
- package/dist/es/components/VLMAnnotation/components/DragButton.mjs +18 -0
- package/dist/es/components/VLMAnnotation/components/FitToScreenButton.mjs +16 -0
- package/dist/es/components/VLMAnnotation/components/RectangleButton.mjs +30 -0
- package/dist/es/components/VLMAnnotation/components/Toolbar.mjs +40 -0
- package/dist/es/components/VLMAnnotation/components/ZoomControls.mjs +44 -0
- package/dist/es/components/VLMAnnotation/constants.mjs +50 -0
- package/dist/es/components/VLMAnnotation/index.mjs +242 -0
- package/dist/es/components/VLMAnnotation/style.less.mjs +4 -0
- package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/AttributeDetail/index.mjs +345 -0
- package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/AttributeDetail/style.less.mjs +4 -0
- package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/QAGenerationConfig.mjs +240 -0
- package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/index.mjs +201 -0
- package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/style.less.mjs +4 -0
- package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/index.mjs +399 -0
- package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/style.less.mjs +4 -0
- package/dist/es/components/VLMAnnotationDetail/VlmModal/index.mjs +139 -0
- package/dist/es/components/VLMAnnotationDetail/VlmModal/style.less.mjs +4 -0
- package/dist/es/components/VLMAnnotationDetail/index.mjs +446 -0
- package/dist/es/components/VLMAnnotationDetail/style.less.mjs +4 -0
- package/dist/es/constant.mjs +3 -3
- package/dist/es/createVlmtasetAnnotation/index.mjs +131 -0
- package/dist/es/featuresConfig.mjs +13 -9
- package/dist/es/index.mjs +11 -7
- package/dist/lib/index.js +4 -3
- package/dist/src/DatasetContext/index.d.ts +2 -0
- package/dist/src/components/Iconfont/font_4439177_tgvowh6bmlb.d.ts +0 -0
- package/dist/src/components/PicZipImportModal/config.d.ts +20 -0
- package/dist/src/components/VLMAnnotation/ImageAnnotationDebugger.d.ts +4 -0
- package/dist/src/components/VLMAnnotation/RegionItem.d.ts +4 -0
- package/dist/src/components/VLMAnnotation/TextAnnotationPanel.d.ts +4 -0
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasDrag.d.ts +12 -0
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasSetup.d.ts +38 -0
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasZoom.d.ts +18 -0
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useCropRegionImage.d.ts +7 -0
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useDeleteControl.d.ts +13 -0
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useDeleteRegion.d.ts +21 -0
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useDrawingMode.d.ts +31 -0
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useOCRLoadingIcon.d.ts +11 -0
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useOCRRecognition.d.ts +28 -0
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionHover.d.ts +13 -0
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionLoader.d.ts +37 -0
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionNameText.d.ts +12 -0
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionSelection.d.ts +15 -0
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionUpdate.d.ts +32 -0
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useTextLayouts.d.ts +25 -0
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/index.d.ts +4 -0
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/utils/coordinateUtils.d.ts +32 -0
- package/dist/src/components/VLMAnnotation/components/DragButton.d.ts +7 -0
- package/dist/src/components/VLMAnnotation/components/FitToScreenButton.d.ts +6 -0
- package/dist/src/components/VLMAnnotation/components/RectangleButton.d.ts +7 -0
- package/dist/src/components/VLMAnnotation/components/Toolbar.d.ts +4 -0
- package/dist/src/components/VLMAnnotation/components/ZoomControls.d.ts +4 -0
- package/dist/src/components/VLMAnnotation/constants.d.ts +97 -0
- package/dist/src/components/VLMAnnotation/index.d.ts +6 -0
- package/dist/src/components/VLMAnnotation/types.d.ts +172 -0
- package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/AttributeDetail/index.d.ts +14 -0
- package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/ImageDetail/index.d.ts +16 -0
- package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/OCRBoxMaker/LabelEditorInput.d.ts +12 -0
- package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/OCRBoxMaker/LabelEditorItem.d.ts +21 -0
- package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/OCRBoxMaker/LableEditor.d.ts +16 -0
- package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/OCRBoxMaker/index.d.ts +19 -0
- package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/QAGenerationConfig.d.ts +12 -0
- package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/index.d.ts +12 -0
- package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/index.d.ts +12 -0
- package/dist/src/components/VLMAnnotationDetail/VlmModal/index.d.ts +16 -0
- package/dist/src/components/VLMAnnotationDetail/index.d.ts +6 -0
- package/dist/src/constant.d.ts +1 -1
- package/dist/src/createVlmtasetAnnotation/index.d.ts +16 -0
- package/dist/src/featuresConfig.d.ts +4 -0
- package/dist/src/index.d.ts +3 -0
- package/package.json +2 -2
|
@@ -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,345 @@
|
|
|
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((h, f) => {
|
|
14
|
+
var l = (c) => {
|
|
15
|
+
try {
|
|
16
|
+
a(n.next(c));
|
|
17
|
+
} catch (m) {
|
|
18
|
+
f(m);
|
|
19
|
+
}
|
|
20
|
+
}, p = (c) => {
|
|
21
|
+
try {
|
|
22
|
+
a(n.throw(c));
|
|
23
|
+
} catch (m) {
|
|
24
|
+
f(m);
|
|
25
|
+
}
|
|
26
|
+
}, a = (c) => c.done ? h(c.value) : Promise.resolve(c.value).then(l, p);
|
|
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: h,
|
|
39
|
+
onAttributesChange: f,
|
|
40
|
+
onLoadingChange: l
|
|
41
|
+
} = o, {
|
|
42
|
+
services: {
|
|
43
|
+
cvforceDatahub: p
|
|
44
|
+
}
|
|
45
|
+
} = ne(oe), [a, c] = b([]), [m, 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 && h && p) {
|
|
74
|
+
const t = (yield p.getDatasetsIdVersionsVidConfigs(n, h)) || [];
|
|
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 || !h || !p)) {
|
|
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 p.saveVisionLabelConfigs(n, h, {
|
|
139
|
+
data: e
|
|
140
|
+
});
|
|
141
|
+
const t = yield V();
|
|
142
|
+
C.success("保存成功"), f == null || f(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: [m && /* @__PURE__ */ i("div", {
|
|
213
|
+
children: "加载中..."
|
|
214
|
+
}), /* @__PURE__ */ i("div", {
|
|
215
|
+
className: "use-tips",
|
|
216
|
+
children: /* @__PURE__ */ i("div", {
|
|
217
|
+
children: "使用须知:用户需清楚能从图纸中提取出所有类型的信息,图片中的标注信息(如“零件名称”、“规格型号”),属性定义对应全局"
|
|
218
|
+
})
|
|
219
|
+
}), /* @__PURE__ */ u("div", {
|
|
220
|
+
className: "lists",
|
|
221
|
+
children: [/* @__PURE__ */ u(ae, {
|
|
222
|
+
className: "lists-content",
|
|
223
|
+
gutter: 48,
|
|
224
|
+
children: [/* @__PURE__ */ i(F, {
|
|
225
|
+
span: 12,
|
|
226
|
+
children: /* @__PURE__ */ u("div", {
|
|
227
|
+
className: "list-item",
|
|
228
|
+
children: [/* @__PURE__ */ i("div", {
|
|
229
|
+
className: "list-item-header",
|
|
230
|
+
children: /* @__PURE__ */ i("div", {
|
|
231
|
+
className: "list-item-title",
|
|
232
|
+
children: "新增属性"
|
|
233
|
+
})
|
|
234
|
+
}), /* @__PURE__ */ u("div", {
|
|
235
|
+
className: "list-item-content",
|
|
236
|
+
children: [/* @__PURE__ */ u("div", {
|
|
237
|
+
className: "form-item",
|
|
238
|
+
children: [/* @__PURE__ */ i("div", {
|
|
239
|
+
className: "form-label",
|
|
240
|
+
children: "属性名称"
|
|
241
|
+
}), /* @__PURE__ */ i(P, {
|
|
242
|
+
showCount: !0,
|
|
243
|
+
maxLength: 32,
|
|
244
|
+
value: D,
|
|
245
|
+
onChange: (e) => g(e.target.value),
|
|
246
|
+
placeholder: "请输入属性名称",
|
|
247
|
+
onPressEnter: _
|
|
248
|
+
})]
|
|
249
|
+
}), /* @__PURE__ */ u("div", {
|
|
250
|
+
className: "form-item",
|
|
251
|
+
children: [/* @__PURE__ */ i("div", {
|
|
252
|
+
className: "form-label",
|
|
253
|
+
children: "属性类型"
|
|
254
|
+
}), /* @__PURE__ */ i(k, {
|
|
255
|
+
value: "text",
|
|
256
|
+
disabled: !0,
|
|
257
|
+
style: {
|
|
258
|
+
width: "100%"
|
|
259
|
+
},
|
|
260
|
+
children: /* @__PURE__ */ i(k.Option, {
|
|
261
|
+
value: "text",
|
|
262
|
+
children: "文本"
|
|
263
|
+
})
|
|
264
|
+
})]
|
|
265
|
+
}), /* @__PURE__ */ i("div", {
|
|
266
|
+
className: "form-actions",
|
|
267
|
+
children: /* @__PURE__ */ u(T, {
|
|
268
|
+
children: [/* @__PURE__ */ i(v, {
|
|
269
|
+
type: "primary",
|
|
270
|
+
onClick: _,
|
|
271
|
+
children: "添加属性"
|
|
272
|
+
}), /* @__PURE__ */ i(v, {
|
|
273
|
+
onClick: H,
|
|
274
|
+
children: "取消"
|
|
275
|
+
})]
|
|
276
|
+
})
|
|
277
|
+
})]
|
|
278
|
+
})]
|
|
279
|
+
})
|
|
280
|
+
}), /* @__PURE__ */ i(F, {
|
|
281
|
+
span: 12,
|
|
282
|
+
children: /* @__PURE__ */ u("div", {
|
|
283
|
+
className: "list-item",
|
|
284
|
+
children: [/* @__PURE__ */ u("div", {
|
|
285
|
+
className: "list-item-header",
|
|
286
|
+
children: [/* @__PURE__ */ i("div", {
|
|
287
|
+
className: "list-item-title",
|
|
288
|
+
children: "属性列表"
|
|
289
|
+
}), /* @__PURE__ */ u(T, {
|
|
290
|
+
style: {
|
|
291
|
+
height: 32
|
|
292
|
+
},
|
|
293
|
+
children: [/* @__PURE__ */ i(v, {
|
|
294
|
+
type: "text",
|
|
295
|
+
icon: w ? /* @__PURE__ */ i(B, {
|
|
296
|
+
type: "icon-queding",
|
|
297
|
+
className: "self-icon"
|
|
298
|
+
}) : /* @__PURE__ */ i(B, {
|
|
299
|
+
type: "icon-editing",
|
|
300
|
+
className: "self-icon"
|
|
301
|
+
}),
|
|
302
|
+
onClick: W
|
|
303
|
+
}), /* @__PURE__ */ i(v, {
|
|
304
|
+
type: "text",
|
|
305
|
+
icon: /* @__PURE__ */ i(B, {
|
|
306
|
+
type: "icon-qingchujiyi",
|
|
307
|
+
className: "self-icon"
|
|
308
|
+
}),
|
|
309
|
+
onClick: K
|
|
310
|
+
})]
|
|
311
|
+
})]
|
|
312
|
+
}), /* @__PURE__ */ i("div", {
|
|
313
|
+
className: "list-item-content table-wrapper",
|
|
314
|
+
children: /* @__PURE__ */ i(le, {
|
|
315
|
+
columns: Q,
|
|
316
|
+
dataSource: a,
|
|
317
|
+
rowKey: "id",
|
|
318
|
+
pagination: !1,
|
|
319
|
+
size: "small",
|
|
320
|
+
scroll: {
|
|
321
|
+
y: "100%"
|
|
322
|
+
}
|
|
323
|
+
})
|
|
324
|
+
})]
|
|
325
|
+
})
|
|
326
|
+
})]
|
|
327
|
+
}), /* @__PURE__ */ i("div", {
|
|
328
|
+
className: "attribute-detail-footer",
|
|
329
|
+
children: /* @__PURE__ */ i(T, {
|
|
330
|
+
children: /* @__PURE__ */ i(v, {
|
|
331
|
+
type: "primary",
|
|
332
|
+
loading: m,
|
|
333
|
+
disabled: m,
|
|
334
|
+
onClick: L,
|
|
335
|
+
children: "保存"
|
|
336
|
+
})
|
|
337
|
+
})
|
|
338
|
+
})]
|
|
339
|
+
})]
|
|
340
|
+
});
|
|
341
|
+
});
|
|
342
|
+
de.displayName = "AttributeDetail";
|
|
343
|
+
export {
|
|
344
|
+
de as default
|
|
345
|
+
};
|