@glodon-aiot/dataset-annotation 3.10.0-alpha.23 → 3.10.0-alpha.25
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.
|
@@ -1,86 +1,85 @@
|
|
|
1
|
-
import { jsxs as x, jsx as
|
|
2
|
-
import { useRef as w, useState as
|
|
3
|
-
import { Input as
|
|
1
|
+
import { jsxs as x, jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as w, useState as I, useEffect as v } from "react";
|
|
3
|
+
import { Input as T } from "antd";
|
|
4
4
|
import { UpOutlined as j } from "@ant-design/icons";
|
|
5
5
|
const M = ({
|
|
6
6
|
name: h,
|
|
7
|
-
labelDefinitions:
|
|
8
|
-
region:
|
|
7
|
+
labelDefinitions: m,
|
|
8
|
+
region: $,
|
|
9
9
|
isSelected: p,
|
|
10
|
-
isActive:
|
|
11
|
-
activeLabelId:
|
|
12
|
-
onChange:
|
|
13
|
-
onFocus:
|
|
10
|
+
isActive: s,
|
|
11
|
+
activeLabelId: i,
|
|
12
|
+
onChange: a,
|
|
13
|
+
onFocus: f,
|
|
14
14
|
onBlur: d,
|
|
15
15
|
readOnly: N
|
|
16
16
|
}) => {
|
|
17
|
-
const
|
|
17
|
+
const n = w(null), u = w(/* @__PURE__ */ new Map()), [l, g] = I(!1);
|
|
18
18
|
return v(() => {
|
|
19
|
-
p &&
|
|
20
|
-
|
|
19
|
+
p && n.current && (g(!1), setTimeout(() => {
|
|
20
|
+
n.current && n.current.scrollIntoView({
|
|
21
21
|
behavior: "smooth",
|
|
22
22
|
block: "nearest",
|
|
23
23
|
inline: "nearest"
|
|
24
24
|
});
|
|
25
25
|
}, 200));
|
|
26
26
|
}, [p]), v(() => {
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
s && n.current && (g(!1), setTimeout(() => {
|
|
28
|
+
n.current && n.current.scrollIntoView({
|
|
29
29
|
behavior: "smooth",
|
|
30
30
|
block: "nearest",
|
|
31
31
|
inline: "nearest"
|
|
32
32
|
});
|
|
33
33
|
}, 200));
|
|
34
|
-
}, [
|
|
35
|
-
if (
|
|
36
|
-
const t = u.current.get(
|
|
37
|
-
t != null && t.input ? setTimeout(() => {
|
|
38
|
-
|
|
39
|
-
}, 0) : setTimeout(() => {
|
|
40
|
-
const o = u.current.get(c);
|
|
34
|
+
}, [s]), v(() => {
|
|
35
|
+
if (s && i) {
|
|
36
|
+
const t = u.current.get(i);
|
|
37
|
+
t != null && t.input ? t.input.focus() : setTimeout(() => {
|
|
38
|
+
const o = u.current.get(i);
|
|
41
39
|
o != null && o.input && o.input.focus();
|
|
42
40
|
}, 100);
|
|
43
41
|
}
|
|
44
|
-
}, [
|
|
45
|
-
ref:
|
|
46
|
-
className: `vlm-text-region ${p ||
|
|
42
|
+
}, [s, i]), /* @__PURE__ */ x("div", {
|
|
43
|
+
ref: n,
|
|
44
|
+
className: `vlm-text-region ${p || s ? "vlm-text-region-selected" : ""} ${l ? "vlm-text-region-collapsed" : ""}`,
|
|
47
45
|
children: [/* @__PURE__ */ x("div", {
|
|
48
46
|
className: "vlm-text-region-header",
|
|
49
|
-
onClick: () => g(!
|
|
50
|
-
children: [/* @__PURE__ */
|
|
51
|
-
className: `vlm-text-region-collapse-icon ${
|
|
52
|
-
children: /* @__PURE__ */
|
|
53
|
-
}), /* @__PURE__ */
|
|
47
|
+
onClick: () => g(!l),
|
|
48
|
+
children: [/* @__PURE__ */ c("span", {
|
|
49
|
+
className: `vlm-text-region-collapse-icon ${l ? "vlm-text-region-collapse-icon-collapsed" : ""}`,
|
|
50
|
+
children: /* @__PURE__ */ c(j, {})
|
|
51
|
+
}), /* @__PURE__ */ c("span", {
|
|
54
52
|
className: "vlm-text-region-name",
|
|
55
53
|
children: h
|
|
56
54
|
})]
|
|
57
|
-
}), /* @__PURE__ */
|
|
58
|
-
className: `vlm-text-region-content ${
|
|
59
|
-
children:
|
|
60
|
-
const o =
|
|
55
|
+
}), /* @__PURE__ */ c("div", {
|
|
56
|
+
className: `vlm-text-region-content ${l ? "vlm-text-region-content-collapsed" : ""}`,
|
|
57
|
+
children: m == null ? void 0 : m.map((t) => {
|
|
58
|
+
const o = s && i === t.id;
|
|
61
59
|
return /* @__PURE__ */ x("div", {
|
|
62
60
|
className: "vlm-text-label",
|
|
63
|
-
children: [t.name, /* @__PURE__ */
|
|
64
|
-
ref: (
|
|
65
|
-
|
|
61
|
+
children: [t.name, /* @__PURE__ */ c("br", {}), /* @__PURE__ */ c(T, {
|
|
62
|
+
ref: (e) => {
|
|
63
|
+
e ? u.current.set(t.id, e) : u.current.delete(t.id);
|
|
66
64
|
},
|
|
67
|
-
value:
|
|
68
|
-
onFocus: (
|
|
69
|
-
|
|
70
|
-
const
|
|
71
|
-
|
|
65
|
+
value: $.content[t.id],
|
|
66
|
+
onFocus: (e) => {
|
|
67
|
+
f == null || f(t.id, e.target.value || ""), setTimeout(() => {
|
|
68
|
+
const r = u.current.get(t.id);
|
|
69
|
+
r != null && r.input && r.input.focus();
|
|
72
70
|
}, 0);
|
|
73
71
|
},
|
|
74
|
-
onBlur: (
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
72
|
+
onBlur: (e) => {
|
|
73
|
+
console.log("onBlur", e);
|
|
74
|
+
const r = e.relatedTarget, k = (r == null ? void 0 : r.tagName) === "INPUT" || (r == null ? void 0 : r.closest("input")) !== null;
|
|
75
|
+
if (o && !k) {
|
|
76
|
+
e.target.focus();
|
|
78
77
|
return;
|
|
79
78
|
}
|
|
80
|
-
d == null || d(t.id,
|
|
79
|
+
d == null || d(t.id, e.target.value || "");
|
|
81
80
|
},
|
|
82
|
-
onChange: (
|
|
83
|
-
|
|
81
|
+
onChange: (e) => {
|
|
82
|
+
a == null || a(t.id, e.target.value || "");
|
|
84
83
|
},
|
|
85
84
|
allowClear: !N,
|
|
86
85
|
readOnly: N
|