@4i/modal-manager 1.0.61 → 1.0.70
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/package.json
CHANGED
@@ -142,7 +142,7 @@ var ModalProvider = function (_a) {
|
|
142
142
|
return (data.length !== 0 &&
|
143
143
|
data.map(function (item, i) {
|
144
144
|
var Modal = activeModals[i] || (function () { return react_1.default.createElement(react_1.default.Fragment, null); });
|
145
|
-
return (react_1.default.createElement("div", { style: { zIndex: zIndex || 1000 + i }, key: item.modalId, onMouseDown: function (e) {
|
145
|
+
return (react_1.default.createElement("div", { style: { zIndex: zIndex || 1000 + i, position: "relative" }, key: item.modalId, onMouseDown: function (e) {
|
146
146
|
isCloseOnBackdropClick && handleCloseModal(i, e);
|
147
147
|
} },
|
148
148
|
react_1.default.createElement("div", { className: "".concat(className, " backdrop_modal_manager ").concat(isHaveBackdrop && isCloseOnBackdropClick && "backdrop") },
|
@@ -18,6 +18,7 @@ interface ModalProviderProps {
|
|
18
18
|
data: TData[],
|
19
19
|
names: string[]
|
20
20
|
) => void;
|
21
|
+
ignoreClickElement?: Element;
|
21
22
|
}
|
22
23
|
|
23
24
|
type TData = { [key: string]: any };
|
@@ -32,6 +33,7 @@ const ModalProvider = ({
|
|
32
33
|
isHaveBackdrop = true,
|
33
34
|
isCloseOnBackdropClick = true,
|
34
35
|
zIndex,
|
36
|
+
ignoreClickElement,
|
35
37
|
}: ModalProviderProps) => {
|
36
38
|
const [data, setData] = useState<TData[]>([]);
|
37
39
|
const [names, setNames] = useState<string[]>([]);
|
@@ -121,6 +123,7 @@ const ModalProvider = ({
|
|
121
123
|
|
122
124
|
const handleCloseModal = (index: number, e: any) => {
|
123
125
|
if (!isCloseOnBackdropClick) return;
|
126
|
+
if (ignoreClickElement && ignoreClickElement.contains(e.target)) return;
|
124
127
|
if (
|
125
128
|
modalRef.current[index] &&
|
126
129
|
!modalRef.current[index].contains(e.target)
|
@@ -140,7 +143,7 @@ const ModalProvider = ({
|
|
140
143
|
|
141
144
|
return (
|
142
145
|
<div
|
143
|
-
style={{ zIndex: zIndex || 1000 + i }}
|
146
|
+
style={{ zIndex: zIndex || 1000 + i, position: "relative" }}
|
144
147
|
key={item.modalId}
|
145
148
|
onMouseDown={(e) => {
|
146
149
|
isCloseOnBackdropClick && handleCloseModal(i, e);
|
package/tsconfig.json
CHANGED