ag-common 0.0.680 → 0.0.682
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.
|
@@ -125,10 +125,15 @@ const DarkModeAux = ({ iconSize = '2.5rem', className, mode, onSubmit, style, dm
|
|
|
125
125
|
else {
|
|
126
126
|
className = '';
|
|
127
127
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
128
|
+
try {
|
|
129
|
+
document.getElementsByTagName('html')[0].classList.remove('dark-mode');
|
|
130
|
+
document.getElementsByTagName('html')[0].classList.remove('light-mode');
|
|
131
|
+
if (className) {
|
|
132
|
+
document.getElementsByTagName('html')[0].classList.add(className);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
catch (e) {
|
|
136
|
+
//
|
|
132
137
|
}
|
|
133
138
|
dm.setDarkmode(newDarkMode);
|
|
134
139
|
onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(newDarkMode);
|
|
@@ -30,11 +30,21 @@ const DropdownListDialog = (p) => __awaiter(void 0, void 0, void 0, function* ()
|
|
|
30
30
|
wrapper.style.left = `${p.position.x}px`;
|
|
31
31
|
const root = (0, client_1.createRoot)(wrapper);
|
|
32
32
|
root.render(react_1.default.createElement(index_1.DropdownList, Object.assign({}, p, { open: true, onClose: () => {
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
try {
|
|
34
|
+
root.unmount();
|
|
35
|
+
wrapper.remove();
|
|
36
|
+
}
|
|
37
|
+
catch (e) {
|
|
38
|
+
//
|
|
39
|
+
}
|
|
35
40
|
}, onChange: (v, i) => {
|
|
36
|
-
|
|
37
|
-
|
|
41
|
+
try {
|
|
42
|
+
root.unmount();
|
|
43
|
+
wrapper.remove();
|
|
44
|
+
}
|
|
45
|
+
catch (e) {
|
|
46
|
+
//
|
|
47
|
+
}
|
|
38
48
|
res(!v ? undefined : [v, i]);
|
|
39
49
|
} }), "\u00A0"));
|
|
40
50
|
});
|
|
@@ -22,8 +22,13 @@ const ModalDialog = (content, opt) => __awaiter(void 0, void 0, void 0, function
|
|
|
22
22
|
const root = (0, client_1.createRoot)(wrapper);
|
|
23
23
|
root.render(react_1.default.createElement(Modal_1.Modal, { open: true, setOpen: (o) => {
|
|
24
24
|
if (!o) {
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
try {
|
|
26
|
+
root.unmount();
|
|
27
|
+
wrapper.remove();
|
|
28
|
+
}
|
|
29
|
+
catch (e) {
|
|
30
|
+
//
|
|
31
|
+
}
|
|
27
32
|
}
|
|
28
33
|
res('ok');
|
|
29
34
|
}, topPosition: "center", position: "center", style: opt === null || opt === void 0 ? void 0 : opt.style }, content));
|
|
@@ -39,14 +39,22 @@ const Comp = ({ pos, children, }) => {
|
|
|
39
39
|
const ref = (0, react_1.createRef)();
|
|
40
40
|
const [size, setSize] = (0, react_1.useState)();
|
|
41
41
|
(0, react_1.useEffect)(() => {
|
|
42
|
-
var _a;
|
|
43
|
-
if (
|
|
42
|
+
var _a, _b;
|
|
43
|
+
if (!ref.current) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const tooltipWidth = Math.max(ref.current.clientWidth, ref.current.scrollWidth);
|
|
47
|
+
const tooltipHeight = Math.max(ref.current.clientHeight, ref.current.scrollHeight);
|
|
48
|
+
if (tooltipHeight === ((_a = size === null || size === void 0 ? void 0 : size.p) === null || _a === void 0 ? void 0 : _a.tooltipHeight) ||
|
|
49
|
+
tooltipWidth === ((_b = size === null || size === void 0 ? void 0 : size.p) === null || _b === void 0 ? void 0 : _b.tooltipWidth) ||
|
|
50
|
+
tooltipHeight === 0 ||
|
|
51
|
+
tooltipWidth === 0) {
|
|
44
52
|
return;
|
|
45
53
|
}
|
|
46
54
|
setSize({
|
|
47
55
|
p: {
|
|
48
|
-
tooltipWidth
|
|
49
|
-
tooltipHeight
|
|
56
|
+
tooltipWidth,
|
|
57
|
+
tooltipHeight,
|
|
50
58
|
},
|
|
51
59
|
});
|
|
52
60
|
}, [ref, size]);
|
|
@@ -60,21 +68,24 @@ const Comp = ({ pos, children, }) => {
|
|
|
60
68
|
const gap = 5;
|
|
61
69
|
if (size === null || size === void 0 ? void 0 : size.p) {
|
|
62
70
|
left = pos.x + gap;
|
|
71
|
+
const newRight = pos.parentWidth - pos.x + gap;
|
|
63
72
|
if (pos.x + gap + size.p.tooltipWidth > pos.parentWidth) {
|
|
64
73
|
left = undefined;
|
|
65
|
-
right =
|
|
74
|
+
right = newRight;
|
|
66
75
|
}
|
|
67
76
|
//
|
|
68
77
|
top = pos.y + gap;
|
|
69
|
-
|
|
70
|
-
if (top + size.p.tooltipHeight > pos.parentHeight &&
|
|
71
|
-
//check against really tall
|
|
72
|
-
newBottom > 0) {
|
|
78
|
+
if (top + size.p.tooltipHeight > pos.parentHeight) {
|
|
73
79
|
top = undefined;
|
|
74
80
|
bottom = pos.parentHeight - pos.y;
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
81
|
+
}
|
|
82
|
+
if (right && right + size.p.tooltipWidth > pos.parentWidth) {
|
|
83
|
+
right = undefined;
|
|
84
|
+
left = 0;
|
|
85
|
+
}
|
|
86
|
+
if (bottom && bottom + size.p.tooltipHeight > pos.parentHeight) {
|
|
87
|
+
bottom = undefined;
|
|
88
|
+
top = 0;
|
|
78
89
|
}
|
|
79
90
|
}
|
|
80
91
|
const Content = (react_1.default.createElement(Base, { ref: ref, style: Object.assign(Object.assign({ left,
|
|
@@ -97,7 +108,12 @@ const useTooltip = () => {
|
|
|
97
108
|
document.body.appendChild(d);
|
|
98
109
|
return () => {
|
|
99
110
|
var _a;
|
|
100
|
-
|
|
111
|
+
try {
|
|
112
|
+
(_a = document.querySelector(`#${globalId}`)) === null || _a === void 0 ? void 0 : _a.remove();
|
|
113
|
+
}
|
|
114
|
+
catch (e) {
|
|
115
|
+
//
|
|
116
|
+
}
|
|
101
117
|
};
|
|
102
118
|
}, []);
|
|
103
119
|
const setPos = (p) => {
|
package/package.json
CHANGED