mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-05 22:38:48 +00:00
Added state variable to keep track of open modals on canvas.
This commit is contained in:
parent
1ad1d54c82
commit
a6e66889c2
3 changed files with 18 additions and 0 deletions
|
|
@ -56,6 +56,7 @@ export function KanbanBoard({ widgetHeight, kanbanProps, parentRef, id }) {
|
|||
const [containers, setContainers] = useState([]);
|
||||
|
||||
const [showModal, setShowModal] = useState(false);
|
||||
const setModalOpenOnCanvas = useStore((state) => state.setModalOpenOnCanvas);
|
||||
const [activeId, setActiveId] = useState(null);
|
||||
const cardMovementRef = useRef(null);
|
||||
const shouldUpdateData = useRef(false);
|
||||
|
|
@ -117,6 +118,7 @@ export function KanbanBoard({ widgetHeight, kanbanProps, parentRef, id }) {
|
|||
}
|
||||
/**** End - Logic to reduce the zIndex of modal control box ****/
|
||||
}
|
||||
setModalOpenOnCanvas(`${id}-modal`, showModal);
|
||||
}, [showModal]);
|
||||
|
||||
useEffect(() => {
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ export const Modal = function Modal({
|
|||
const size = properties.size ?? 'lg';
|
||||
const [modalWidth, setModalWidth] = useState();
|
||||
const mode = useStore((state) => state.currentMode, shallow);
|
||||
const setModalOpenOnCanvas = useStore((state) => state.setModalOpenOnCanvas);
|
||||
|
||||
/**** Start - Logic to reset the zIndex of modal control box ****/
|
||||
useEffect(() => {
|
||||
|
|
@ -63,6 +64,7 @@ export const Modal = function Modal({
|
|||
useGridStore.getState().actions.setOpenModalWidgetId(null);
|
||||
}
|
||||
}
|
||||
setModalOpenOnCanvas(id, showModal);
|
||||
}, [showModal, id, mode]);
|
||||
/**** End - Logic to reset the zIndex of modal control box ****/
|
||||
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ const initialState = {
|
|||
currentPageHandle: null,
|
||||
showWidgetDeleteConfirmation: false,
|
||||
focusedParentId: null,
|
||||
modalsOpenOnCanvas: [],
|
||||
};
|
||||
|
||||
export const createComponentsSlice = (set, get) => ({
|
||||
|
|
@ -1860,4 +1861,17 @@ export const createComponentsSlice = (set, get) => ({
|
|||
const currentPage = getCurrentPage(moduleId);
|
||||
return currentPage?.autoComputeLayout;
|
||||
},
|
||||
setModalOpenOnCanvas: (modalId, isOpen) => {
|
||||
const { modalsOpenOnCanvas } = get();
|
||||
let newModalOpenOnCanvas = [];
|
||||
|
||||
if (isOpen) {
|
||||
newModalOpenOnCanvas = [...modalsOpenOnCanvas, modalId];
|
||||
} else {
|
||||
newModalOpenOnCanvas = modalsOpenOnCanvas.filter((id) => id !== modalId);
|
||||
}
|
||||
set((state) => {
|
||||
state.modalsOpenOnCanvas = newModalOpenOnCanvas;
|
||||
});
|
||||
},
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue