ag-common 0.0.681 → 0.0.683
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/ui/components/DarkMode/Base.js +9 -4
- package/dist/ui/components/DropdownList/Dialog.js +14 -4
- package/dist/ui/components/Modal/Dialog.d.ts +1 -0
- package/dist/ui/components/Modal/Dialog.js +7 -2
- package/dist/ui/components/Modal/Modal.d.ts +1 -1
- package/dist/ui/components/Modal/Modal.js +27 -1
- package/dist/ui/components/Modal/types.d.ts +2 -2
- package/dist/ui/helpers/useTooltip.js +6 -1
- package/package.json +1 -1
|
@@ -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));
|
|
@@ -4,4 +4,4 @@ export declare const ModalItem: import("@emotion/styled").StyledComponent<{
|
|
|
4
4
|
theme?: import("@emotion/react").Theme | undefined;
|
|
5
5
|
as?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
|
|
6
6
|
}, React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
7
|
-
export declare const Modal: ({ open, setOpen, children, position, topPosition, showCloseButton, closeOnMoveMouseOutside, className, closeOnClickOutside, portalId, style, }: IModal) => React.JSX.Element | null;
|
|
7
|
+
export declare const Modal: ({ open, setOpen, children, position, topPosition, showCloseButton, closeOnMoveMouseOutside, className, closeOnClickOutside, portalId: pidraw, style, }: IModal) => React.JSX.Element | null;
|
|
@@ -34,6 +34,7 @@ const react_dom_1 = require("react-dom");
|
|
|
34
34
|
const useOnClickOutside_1 = require("../../helpers/useOnClickOutside");
|
|
35
35
|
const styles_1 = require("../../styles");
|
|
36
36
|
const Close_1 = require("../Close");
|
|
37
|
+
const globalId = 'ag-modal-portal';
|
|
37
38
|
const FixedBackground = styled_1.default.div `
|
|
38
39
|
position: fixed;
|
|
39
40
|
top: 0;
|
|
@@ -84,8 +85,33 @@ exports.ModalItem = styled_1.default.div `
|
|
|
84
85
|
const CloseStyled = (0, styled_1.default)(Close_1.Close) `
|
|
85
86
|
z-index: 1;
|
|
86
87
|
`;
|
|
87
|
-
const Modal = ({ open, setOpen, children, position = 'left', topPosition = 'top', showCloseButton = true, closeOnMoveMouseOutside = false, className, closeOnClickOutside = true, portalId, style, }) => {
|
|
88
|
+
const Modal = ({ open, setOpen, children, position = 'left', topPosition = 'top', showCloseButton = true, closeOnMoveMouseOutside = false, className, closeOnClickOutside = true, portalId: pidraw, style, }) => {
|
|
89
|
+
let portalId = pidraw;
|
|
90
|
+
if (portalId === undefined) {
|
|
91
|
+
portalId = globalId;
|
|
92
|
+
}
|
|
88
93
|
const [elem, setElem] = (0, react_1.useState)();
|
|
94
|
+
(0, react_1.useEffect)(() => {
|
|
95
|
+
if (portalId === null ||
|
|
96
|
+
document.querySelectorAll(`#${portalId}`).length > 0) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
const d = document.createElement('div');
|
|
100
|
+
d.id = portalId;
|
|
101
|
+
d.style.position = 'fixed';
|
|
102
|
+
d.style.zIndex = '10';
|
|
103
|
+
document.body.appendChild(d);
|
|
104
|
+
return () => {
|
|
105
|
+
var _a;
|
|
106
|
+
try {
|
|
107
|
+
(_a = document.querySelector(`#${portalId}`)) === null || _a === void 0 ? void 0 : _a.remove();
|
|
108
|
+
}
|
|
109
|
+
catch (e) {
|
|
110
|
+
//
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
114
|
+
}, []);
|
|
89
115
|
(0, react_1.useEffect)(() => {
|
|
90
116
|
const originalStyle = window.getComputedStyle(document.body).overflow || '';
|
|
91
117
|
if (open) {
|
|
@@ -9,8 +9,8 @@ export interface IModal {
|
|
|
9
9
|
closeOnMoveMouseOutside?: boolean;
|
|
10
10
|
className?: string;
|
|
11
11
|
closeOnClickOutside?: boolean;
|
|
12
|
-
/** if provided, will create inside this #id */
|
|
13
|
-
portalId?: string;
|
|
12
|
+
/** if provided, will create inside this #id. default "ag-modal-portal". if null, wont use global id */
|
|
13
|
+
portalId?: string | null;
|
|
14
14
|
/**applied to modal inside fixed */
|
|
15
15
|
style?: CSSProperties;
|
|
16
16
|
}
|
|
@@ -108,7 +108,12 @@ const useTooltip = () => {
|
|
|
108
108
|
document.body.appendChild(d);
|
|
109
109
|
return () => {
|
|
110
110
|
var _a;
|
|
111
|
-
|
|
111
|
+
try {
|
|
112
|
+
(_a = document.querySelector(`#${globalId}`)) === null || _a === void 0 ? void 0 : _a.remove();
|
|
113
|
+
}
|
|
114
|
+
catch (e) {
|
|
115
|
+
//
|
|
116
|
+
}
|
|
112
117
|
};
|
|
113
118
|
}, []);
|
|
114
119
|
const setPos = (p) => {
|
package/package.json
CHANGED