@glodon-aiot/dataset-annotation 3.13.0-alpha.29 → 3.14.0-alpha.31
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/components/DetectionAnnotation/components/LabelMaker/RectLabel.mjs +151 -135
- package/dist/es/components/DetectionAnnotation/components/LabelMaker/index.mjs +244 -218
- package/dist/es/components/VLMAnnotation/RegionItem.mjs +135 -59
- package/dist/es/components/VLMAnnotation/TextAnnotationPanel.mjs +73 -62
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useDeleteRegion.mjs +55 -40
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useDrawingMode.mjs +291 -162
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useOCRControl.mjs +100 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useOCRRecognition.mjs +88 -55
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionBoundaryCheck.mjs +103 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionLoader.mjs +123 -91
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionSelection.mjs +42 -39
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionUpdate.mjs +55 -60
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/icons/ai.svg.mjs +4 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/icons/error.svg.mjs +4 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/icons/loading.svg.mjs +4 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/icons/star.svg.mjs +4 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/index.mjs +512 -387
- package/dist/es/components/VLMAnnotation/constants.mjs +39 -32
- package/dist/es/components/VLMAnnotation/index.mjs +187 -150
- package/dist/es/index.mjs +1 -1
- package/dist/lib/index.js +4 -4
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useDeleteRegion.d.ts +1 -0
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useDrawingMode.d.ts +3 -1
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useOCRControl.d.ts +16 -0
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useOCRRecognition.d.ts +3 -2
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionBoundaryCheck.d.ts +31 -0
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionLoader.d.ts +5 -1
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionSelection.d.ts +2 -1
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/index.d.ts +2 -2
- package/dist/src/components/VLMAnnotation/constants.d.ts +19 -3
- package/dist/src/components/VLMAnnotation/index.d.ts +1 -1
- package/dist/src/components/VLMAnnotation/types.d.ts +15 -0
- package/package.json +2 -2
|
@@ -1,94 +1,170 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { Input as
|
|
4
|
-
import { UpOutlined as
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import { jsxs as i, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as U, useState as k, useEffect as $ } from "react";
|
|
3
|
+
import { Tooltip as V, Input as W } from "antd";
|
|
4
|
+
import { UpOutlined as q } from "@ant-design/icons";
|
|
5
|
+
import G from "./VLMLabelMaker/icons/del.png.mjs";
|
|
6
|
+
import H from "./VLMLabelMaker/icons/ai.svg.mjs";
|
|
7
|
+
import J from "./VLMLabelMaker/icons/star.svg.mjs";
|
|
8
|
+
import K from "./VLMLabelMaker/icons/loading.svg.mjs";
|
|
9
|
+
const F = ({
|
|
10
|
+
name: P,
|
|
11
|
+
labelDefinitions: v,
|
|
12
|
+
region: m,
|
|
13
|
+
isSelected: g,
|
|
14
|
+
isActive: l,
|
|
15
|
+
activeLabelId: a,
|
|
16
|
+
onChange: x,
|
|
17
|
+
onFocus: h,
|
|
18
|
+
onBlur: N,
|
|
19
|
+
onDelete: T,
|
|
20
|
+
onRegionClick: c,
|
|
21
|
+
onOCR: M,
|
|
22
|
+
isOCRRecognizing: p,
|
|
23
|
+
hasOCRError: w,
|
|
24
|
+
readOnly: d
|
|
16
25
|
}) => {
|
|
17
|
-
const n =
|
|
18
|
-
return
|
|
19
|
-
|
|
26
|
+
const n = U(null), u = U(/* @__PURE__ */ new Map()), [f, I] = k(!1);
|
|
27
|
+
return $(() => {
|
|
28
|
+
g && n.current && (I(!1), setTimeout(() => {
|
|
20
29
|
n.current && n.current.scrollIntoView({
|
|
21
30
|
behavior: "smooth",
|
|
22
31
|
block: "nearest",
|
|
23
32
|
inline: "nearest"
|
|
24
33
|
});
|
|
25
34
|
}, 200));
|
|
26
|
-
}, [
|
|
27
|
-
|
|
35
|
+
}, [g]), $(() => {
|
|
36
|
+
l && n.current && (I(!1), setTimeout(() => {
|
|
28
37
|
n.current && n.current.scrollIntoView({
|
|
29
38
|
behavior: "smooth",
|
|
30
39
|
block: "nearest",
|
|
31
40
|
inline: "nearest"
|
|
32
41
|
});
|
|
33
42
|
}, 200));
|
|
34
|
-
}, [
|
|
35
|
-
if (
|
|
36
|
-
const t = u.current.get(
|
|
43
|
+
}, [l]), $(() => {
|
|
44
|
+
if (l && a) {
|
|
45
|
+
const t = u.current.get(a);
|
|
37
46
|
t != null && t.input ? t.input.focus() : setTimeout(() => {
|
|
38
|
-
const
|
|
39
|
-
|
|
47
|
+
const r = u.current.get(a);
|
|
48
|
+
r != null && r.input && r.input.focus();
|
|
40
49
|
}, 100);
|
|
41
50
|
}
|
|
42
|
-
}, [
|
|
51
|
+
}, [l, a]), /* @__PURE__ */ i("div", {
|
|
43
52
|
ref: n,
|
|
44
|
-
className: `vlm-text-region ${
|
|
45
|
-
children: [/* @__PURE__ */
|
|
53
|
+
className: `vlm-text-region ${g || l ? "vlm-text-region-selected" : ""} ${f ? "vlm-text-region-collapsed" : ""}`,
|
|
54
|
+
children: [/* @__PURE__ */ i("div", {
|
|
46
55
|
className: "vlm-text-region-header",
|
|
47
|
-
onClick: () =>
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
56
|
+
onClick: (t) => {
|
|
57
|
+
const r = t.target;
|
|
58
|
+
r.closest(".vlm-text-region-delete-btn") !== null || r.closest(".vlm-text-region-collapse-icon") !== null || c == null || c(m);
|
|
59
|
+
},
|
|
60
|
+
children: [/* @__PURE__ */ e("span", {
|
|
61
|
+
className: `vlm-text-region-collapse-icon ${f ? "vlm-text-region-collapse-icon-collapsed" : ""}`,
|
|
62
|
+
onClick: (t) => {
|
|
63
|
+
t.stopPropagation(), I(!f);
|
|
64
|
+
},
|
|
65
|
+
children: /* @__PURE__ */ e(q, {})
|
|
66
|
+
}), /* @__PURE__ */ e("span", {
|
|
52
67
|
className: "vlm-text-region-name",
|
|
53
|
-
children:
|
|
68
|
+
children: P
|
|
69
|
+
}), /* @__PURE__ */ i("div", {
|
|
70
|
+
className: "vlm-text-region-actions",
|
|
71
|
+
children: [!d && M && /* @__PURE__ */ e(V, {
|
|
72
|
+
title: p ? "识别中..." : w ? "识别失败,点击重试" : "OCR识别",
|
|
73
|
+
children: /* @__PURE__ */ e("span", {
|
|
74
|
+
className: `vlm-text-region-ocr-btn ${p ? "vlm-text-region-ocr-btn-loading" : ""} ${w ? "vlm-text-region-ocr-btn-error" : ""}`,
|
|
75
|
+
onClick: (t) => {
|
|
76
|
+
t.stopPropagation(), p || M(m.id);
|
|
77
|
+
},
|
|
78
|
+
children: /* @__PURE__ */ i("div", {
|
|
79
|
+
className: "vlm-text-region-ocr-icon-wrapper",
|
|
80
|
+
children: [/* @__PURE__ */ e("img", {
|
|
81
|
+
src: H,
|
|
82
|
+
alt: "OCR识别",
|
|
83
|
+
className: "vlm-text-region-ocr-icon"
|
|
84
|
+
}), p ? /* @__PURE__ */ e("img", {
|
|
85
|
+
src: K,
|
|
86
|
+
alt: "",
|
|
87
|
+
className: "vlm-text-region-ocr-status vlm-text-region-ocr-loading"
|
|
88
|
+
}) : w ? /* @__PURE__ */ i("svg", {
|
|
89
|
+
className: "vlm-text-region-ocr-status vlm-text-region-ocr-error-icon",
|
|
90
|
+
width: "12",
|
|
91
|
+
height: "12",
|
|
92
|
+
viewBox: "0 0 12 12",
|
|
93
|
+
fill: "none",
|
|
94
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
95
|
+
children: [/* @__PURE__ */ e("circle", {
|
|
96
|
+
cx: "6",
|
|
97
|
+
cy: "6",
|
|
98
|
+
r: "5.5",
|
|
99
|
+
fill: "#ff4d4f",
|
|
100
|
+
stroke: "none"
|
|
101
|
+
}), /* @__PURE__ */ e("path", {
|
|
102
|
+
d: "M6 3.5v3M6 8.5h.01",
|
|
103
|
+
stroke: "#fff",
|
|
104
|
+
strokeWidth: "1.2",
|
|
105
|
+
strokeLinecap: "round"
|
|
106
|
+
})]
|
|
107
|
+
}) : /* @__PURE__ */ e("img", {
|
|
108
|
+
src: J,
|
|
109
|
+
alt: "",
|
|
110
|
+
className: "vlm-text-region-ocr-status vlm-text-region-ocr-star"
|
|
111
|
+
})]
|
|
112
|
+
})
|
|
113
|
+
})
|
|
114
|
+
}), !d && T && /* @__PURE__ */ e("span", {
|
|
115
|
+
className: "vlm-text-region-delete-btn",
|
|
116
|
+
onClick: (t) => {
|
|
117
|
+
t.stopPropagation(), T(m.id);
|
|
118
|
+
},
|
|
119
|
+
title: "删除",
|
|
120
|
+
children: /* @__PURE__ */ e("img", {
|
|
121
|
+
src: G,
|
|
122
|
+
alt: "删除",
|
|
123
|
+
className: "vlm-text-region-delete-icon"
|
|
124
|
+
})
|
|
125
|
+
})]
|
|
54
126
|
})]
|
|
55
|
-
}), /* @__PURE__ */
|
|
56
|
-
className: `vlm-text-region-content ${
|
|
57
|
-
|
|
58
|
-
const
|
|
59
|
-
|
|
127
|
+
}), /* @__PURE__ */ e("div", {
|
|
128
|
+
className: `vlm-text-region-content ${f ? "vlm-text-region-content-collapsed" : ""}`,
|
|
129
|
+
onClick: (t) => {
|
|
130
|
+
const r = t.target;
|
|
131
|
+
r.tagName === "INPUT" || r.closest("input") !== null || c == null || c(m);
|
|
132
|
+
},
|
|
133
|
+
children: v == null ? void 0 : v.map((t) => {
|
|
134
|
+
const r = l && a === t.id;
|
|
135
|
+
return /* @__PURE__ */ i("div", {
|
|
60
136
|
className: "vlm-text-label",
|
|
61
|
-
children: [t.name, /* @__PURE__ */
|
|
62
|
-
ref: (
|
|
63
|
-
|
|
137
|
+
children: [t.name, /* @__PURE__ */ e("br", {}), /* @__PURE__ */ e(W, {
|
|
138
|
+
ref: (o) => {
|
|
139
|
+
o ? u.current.set(t.id, o) : u.current.delete(t.id);
|
|
64
140
|
},
|
|
65
|
-
value:
|
|
66
|
-
onFocus: (
|
|
67
|
-
|
|
68
|
-
const
|
|
69
|
-
|
|
141
|
+
value: m.content[t.id],
|
|
142
|
+
onFocus: (o) => {
|
|
143
|
+
h == null || h(t.id, o.target.value || ""), setTimeout(() => {
|
|
144
|
+
const s = u.current.get(t.id);
|
|
145
|
+
s != null && s.input && s.input.focus();
|
|
70
146
|
}, 0);
|
|
71
147
|
},
|
|
72
|
-
onBlur: (
|
|
73
|
-
console.log("onBlur",
|
|
74
|
-
const
|
|
75
|
-
if (
|
|
76
|
-
|
|
148
|
+
onBlur: (o) => {
|
|
149
|
+
console.log("onBlur", o);
|
|
150
|
+
const s = o.relatedTarget, j = (s == null ? void 0 : s.tagName) === "INPUT" || (s == null ? void 0 : s.closest("input")) !== null;
|
|
151
|
+
if (r && !j) {
|
|
152
|
+
o.target.focus();
|
|
77
153
|
return;
|
|
78
154
|
}
|
|
79
|
-
|
|
155
|
+
N == null || N(t.id, o.target.value || "");
|
|
80
156
|
},
|
|
81
|
-
onChange: (
|
|
82
|
-
|
|
157
|
+
onChange: (o) => {
|
|
158
|
+
x == null || x(t.id, o.target.value || "");
|
|
83
159
|
},
|
|
84
|
-
allowClear: !
|
|
85
|
-
readOnly:
|
|
160
|
+
allowClear: !d,
|
|
161
|
+
readOnly: d
|
|
86
162
|
})]
|
|
87
163
|
}, t.id);
|
|
88
164
|
})
|
|
89
165
|
})]
|
|
90
|
-
},
|
|
166
|
+
}, P);
|
|
91
167
|
};
|
|
92
168
|
export {
|
|
93
|
-
|
|
169
|
+
F as default
|
|
94
170
|
};
|
|
@@ -1,83 +1,94 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
for (var t in
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var t of
|
|
10
|
-
|
|
11
|
-
return
|
|
12
|
-
},
|
|
1
|
+
var B = Object.defineProperty, H = Object.defineProperties;
|
|
2
|
+
var J = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var S = Object.getOwnPropertySymbols;
|
|
4
|
+
var K = Object.prototype.hasOwnProperty, Q = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var T = (m, d, t) => d in m ? B(m, d, { enumerable: !0, configurable: !0, writable: !0, value: t }) : m[d] = t, c = (m, d) => {
|
|
6
|
+
for (var t in d || (d = {}))
|
|
7
|
+
K.call(d, t) && T(m, t, d[t]);
|
|
8
|
+
if (S)
|
|
9
|
+
for (var t of S(d))
|
|
10
|
+
Q.call(d, t) && T(m, t, d[t]);
|
|
11
|
+
return m;
|
|
12
|
+
}, _ = (m, d) => H(m, J(d));
|
|
13
13
|
import { jsx as y } from "react/jsx-runtime";
|
|
14
|
-
import { Empty as
|
|
15
|
-
import
|
|
16
|
-
import { REGION_NAME_PREFIX as
|
|
17
|
-
const
|
|
18
|
-
labelDefinitions:
|
|
19
|
-
labels:
|
|
14
|
+
import { Empty as R } from "antd";
|
|
15
|
+
import U from "./RegionItem.mjs";
|
|
16
|
+
import { REGION_NAME_PREFIX as W } from "./constants.mjs";
|
|
17
|
+
const V = ({
|
|
18
|
+
labelDefinitions: m,
|
|
19
|
+
labels: d,
|
|
20
20
|
selectedRegion: t,
|
|
21
21
|
activeLabelValue: A,
|
|
22
|
-
activeRegionNumber:
|
|
23
|
-
onChange:
|
|
24
|
-
onInputActive:
|
|
25
|
-
onBlur:
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
activeRegionNumber: X,
|
|
23
|
+
onChange: u,
|
|
24
|
+
onInputActive: $,
|
|
25
|
+
onBlur: j,
|
|
26
|
+
onDelete: f,
|
|
27
|
+
onRegionClick: k,
|
|
28
|
+
onOCR: q,
|
|
29
|
+
ocrRecognizing: F,
|
|
30
|
+
ocrErrors: I,
|
|
31
|
+
readOnly: w
|
|
32
|
+
}) => !d || d.length === 0 ? /* @__PURE__ */ y("div", {
|
|
28
33
|
className: "vlm-text-panel",
|
|
29
34
|
children: /* @__PURE__ */ y("div", {
|
|
30
35
|
className: "vlm-text-panel-empty",
|
|
31
|
-
children: /* @__PURE__ */ y(
|
|
36
|
+
children: /* @__PURE__ */ y(R, {
|
|
32
37
|
description: "暂无标注数据,按R键开始标注吧"
|
|
33
38
|
})
|
|
34
39
|
})
|
|
35
40
|
}) : /* @__PURE__ */ y("div", {
|
|
36
41
|
className: "vlm-text-panel",
|
|
37
|
-
children:
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
42
|
+
children: d.map((p, N) => {
|
|
43
|
+
var G, M;
|
|
44
|
+
const E = A != null && X === N && A.region.id === p.id, x = E ? A.label.id : void 0;
|
|
45
|
+
return /* @__PURE__ */ y(U, {
|
|
46
|
+
name: `${W}${N + 1}`,
|
|
47
|
+
labelDefinitions: m != null ? m : [],
|
|
48
|
+
region: p,
|
|
49
|
+
isSelected: (t == null ? void 0 : t.id) === p.id,
|
|
50
|
+
isActive: E,
|
|
51
|
+
activeLabelId: x,
|
|
52
|
+
readOnly: w,
|
|
53
|
+
onDelete: f,
|
|
54
|
+
onRegionClick: k,
|
|
55
|
+
onOCR: q,
|
|
56
|
+
isOCRRecognizing: (G = F == null ? void 0 : F.has(p.id)) != null ? G : !1,
|
|
57
|
+
hasOCRError: (M = I == null ? void 0 : I.has(p.id)) != null ? M : !1,
|
|
58
|
+
onFocus: (O) => {
|
|
59
|
+
const r = m == null ? void 0 : m.find((P) => P.id === O);
|
|
60
|
+
if (!r)
|
|
50
61
|
return;
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
label:
|
|
54
|
-
region:
|
|
55
|
-
},
|
|
56
|
-
label:
|
|
57
|
-
region:
|
|
58
|
-
},
|
|
62
|
+
const v = d == null ? void 0 : d[N];
|
|
63
|
+
v && ($ ? $({
|
|
64
|
+
label: r,
|
|
65
|
+
region: c({}, v)
|
|
66
|
+
}, N) : u == null || u({
|
|
67
|
+
label: r,
|
|
68
|
+
region: v
|
|
69
|
+
}, N));
|
|
59
70
|
},
|
|
60
|
-
onBlur: (
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
label:
|
|
64
|
-
region:
|
|
65
|
-
},
|
|
71
|
+
onBlur: (O) => {
|
|
72
|
+
const r = m == null ? void 0 : m.find((v) => v.id === O);
|
|
73
|
+
r && (r && j ? j({
|
|
74
|
+
label: r,
|
|
75
|
+
region: c({}, p)
|
|
76
|
+
}, N) : u == null || u(null));
|
|
66
77
|
},
|
|
67
|
-
onChange: (
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
label:
|
|
71
|
-
region:
|
|
72
|
-
content:
|
|
73
|
-
[
|
|
78
|
+
onChange: (O, r) => {
|
|
79
|
+
const v = m == null ? void 0 : m.find((P) => P.id === O);
|
|
80
|
+
v && u && u({
|
|
81
|
+
label: v,
|
|
82
|
+
region: _(c({}, p), {
|
|
83
|
+
content: _(c({}, p.content), {
|
|
84
|
+
[O]: r
|
|
74
85
|
})
|
|
75
86
|
})
|
|
76
|
-
},
|
|
87
|
+
}, N);
|
|
77
88
|
}
|
|
78
|
-
},
|
|
89
|
+
}, p.id);
|
|
79
90
|
})
|
|
80
91
|
});
|
|
81
92
|
export {
|
|
82
|
-
|
|
93
|
+
V as default
|
|
83
94
|
};
|
|
@@ -1,47 +1,62 @@
|
|
|
1
|
-
import { useRef as
|
|
2
|
-
import { Modal as
|
|
3
|
-
import { DELETE_MODAL_TITLE as
|
|
4
|
-
const
|
|
5
|
-
canvas:
|
|
6
|
-
onRegionChange:
|
|
7
|
-
updateRegionNames:
|
|
1
|
+
import { useRef as X, useCallback as A } from "react";
|
|
2
|
+
import { Modal as K } from "antd";
|
|
3
|
+
import { DELETE_MODAL_TITLE as q, DELETE_MODAL_CONTENT as z, DELETE_MODAL_OK_TEXT as B, DELETE_MODAL_CANCEL_TEXT as F } from "../../constants.mjs";
|
|
4
|
+
const O = ({
|
|
5
|
+
canvas: l,
|
|
6
|
+
onRegionChange: o,
|
|
7
|
+
updateRegionNames: _,
|
|
8
8
|
rectMapRef: f,
|
|
9
|
-
textLayersMapRef:
|
|
10
|
-
textLayoutContentMapRef:
|
|
11
|
-
regionNameTextMapRef:
|
|
12
|
-
ocrLoadingIconMapRef:
|
|
9
|
+
textLayersMapRef: e,
|
|
10
|
+
textLayoutContentMapRef: s,
|
|
11
|
+
regionNameTextMapRef: m,
|
|
12
|
+
ocrLoadingIconMapRef: d
|
|
13
13
|
}) => {
|
|
14
|
-
const
|
|
14
|
+
const E = X(!1), k = A((r) => {
|
|
15
|
+
if (!l || E.current)
|
|
16
|
+
return;
|
|
17
|
+
const D = f.current.get(r);
|
|
18
|
+
D && (E.current = !0, K.confirm({
|
|
19
|
+
title: q,
|
|
20
|
+
content: z,
|
|
21
|
+
okText: B,
|
|
22
|
+
cancelText: F,
|
|
23
|
+
onOk: () => {
|
|
24
|
+
const i = e.current.get(r);
|
|
25
|
+
i && (i.forEach((u) => {
|
|
26
|
+
u.off("mousedown"), u.off("mouseover"), u.off("mouseout"), s.current.delete(u), l.remove(u);
|
|
27
|
+
}), e.current.delete(r));
|
|
28
|
+
const T = m.current.get(r);
|
|
29
|
+
T && (r.off("moved"), r.off("modified"), l.remove(T), m.current.delete(r));
|
|
30
|
+
const n = d.current.get(r);
|
|
31
|
+
n && (l.remove(n), d.current.delete(r)), l.remove(r), f.current.delete(r), _(), o && o(D, "delete"), l.renderAll(), E.current = !1;
|
|
32
|
+
},
|
|
33
|
+
onCancel: () => {
|
|
34
|
+
E.current = !1;
|
|
35
|
+
},
|
|
36
|
+
afterClose: () => {
|
|
37
|
+
E.current = !1;
|
|
38
|
+
}
|
|
39
|
+
}));
|
|
40
|
+
}, [l, o, _, f, e, s, m, d]), w = A((r) => {
|
|
41
|
+
if (!l)
|
|
42
|
+
return;
|
|
43
|
+
const D = f.current.get(r);
|
|
44
|
+
if (!D)
|
|
45
|
+
return;
|
|
46
|
+
const i = e.current.get(r);
|
|
47
|
+
i && (i.forEach((u) => {
|
|
48
|
+
u.off("mousedown"), u.off("mouseover"), u.off("mouseout"), s.current.delete(u), l.remove(u);
|
|
49
|
+
}), e.current.delete(r));
|
|
50
|
+
const T = m.current.get(r);
|
|
51
|
+
T && (r.off("moved"), r.off("modified"), l.remove(T), m.current.delete(r));
|
|
52
|
+
const n = d.current.get(r);
|
|
53
|
+
n && (l.remove(n), d.current.delete(r)), l.remove(r), f.current.delete(r), _(), o && o(D, "delete"), l.renderAll();
|
|
54
|
+
}, [l, o, _, f, e, s, m, d]);
|
|
15
55
|
return {
|
|
16
|
-
performDelete:
|
|
17
|
-
|
|
18
|
-
return;
|
|
19
|
-
const d = f.current.get(e);
|
|
20
|
-
d && (o.current = !0, L.confirm({
|
|
21
|
-
title: O,
|
|
22
|
-
content: c,
|
|
23
|
-
okText: k,
|
|
24
|
-
cancelText: C,
|
|
25
|
-
onOk: () => {
|
|
26
|
-
const i = n.current.get(e);
|
|
27
|
-
i && (i.forEach((l) => {
|
|
28
|
-
l.off("mousedown"), l.off("mouseover"), l.off("mouseout"), D.current.delete(l), r.remove(l);
|
|
29
|
-
}), n.current.delete(e));
|
|
30
|
-
const s = E.current.get(e);
|
|
31
|
-
s && (e.off("moved"), e.off("modified"), r.remove(s), E.current.delete(e));
|
|
32
|
-
const _ = m.current.get(e);
|
|
33
|
-
_ && (r.remove(_), m.current.delete(e)), r.remove(e), f.current.delete(e), T(), u && u(d, "delete"), r.renderAll(), o.current = !1;
|
|
34
|
-
},
|
|
35
|
-
onCancel: () => {
|
|
36
|
-
o.current = !1;
|
|
37
|
-
},
|
|
38
|
-
afterClose: () => {
|
|
39
|
-
o.current = !1;
|
|
40
|
-
}
|
|
41
|
-
}));
|
|
42
|
-
}, [r, u, T, f, n, D, E, m])
|
|
56
|
+
performDelete: k,
|
|
57
|
+
deleteDirectly: w
|
|
43
58
|
};
|
|
44
59
|
};
|
|
45
60
|
export {
|
|
46
|
-
|
|
61
|
+
O as useDeleteRegion
|
|
47
62
|
};
|