diff --git a/frontend/src/Editor/Box.jsx b/frontend/src/Editor/Box.jsx index ead57e2eee..e841dccfc4 100644 --- a/frontend/src/Editor/Box.jsx +++ b/frontend/src/Editor/Box.jsx @@ -30,7 +30,7 @@ const AllComponents = { } -export const Box = function Box({ id, mode, width, height, yellow, preview, component, inCanvas, onComponentClick, onEvent, currentState, onComponentOptionChanged, paramUpdated }) { +export const Box = function Box({ id, mode, width, height, yellow, preview, component, inCanvas, onComponentClick, onEvent, currentState, onComponentOptionChanged, paramUpdated, changeCanDrag }) { const backgroundColor = yellow ? 'yellow' : ''; let styles = { @@ -59,6 +59,7 @@ export const Box = function Box({ id, mode, width, height, yellow, preview, comp id={id} paramUpdated={paramUpdated} width={width} + changeCanDrag={changeCanDrag} height={height} component={component}> diff --git a/frontend/src/Editor/Components/Table.jsx b/frontend/src/Editor/Components/Table.jsx index 409e9e9611..ed8f363b4e 100644 --- a/frontend/src/Editor/Components/Table.jsx +++ b/frontend/src/Editor/Components/Table.jsx @@ -12,7 +12,7 @@ import { import { resolve, resolve_references } from '@/_helpers/utils'; import Skeleton from 'react-loading-skeleton'; -export function Table({ id, width, height, component, onComponentClick, currentState, onEvent, paramUpdated }) { +export function Table({ id, width, height, component, onComponentClick, currentState, onEvent, paramUpdated, changeCanDrag }) { const color = component.definition.styles.textColor.value; const actions = component.definition.properties.actions || { value: []}; @@ -71,7 +71,7 @@ export function Table({ id, width, height, component, onComponentClick, currentS style={{background: action.backgroundColor, color: action.textColor}} onClick={(e) => { e.stopPropagation(); onEvent('onTableActionButtonClicked', { component, data: cell.row.original, action }); }} > - {action.buttonText} + {action.buttonText} ) } @@ -132,7 +132,10 @@ export function Table({ id, width, height, component, onComponentClick, currentS useEffect(() => { if(!state.columnResizing.isResizingColumn) { + changeCanDrag(true); paramUpdated(id, 'columnSizes', state.columnResizing.columnWidths); + } else { + changeCanDrag(false); } }, [state.columnResizing]); @@ -165,8 +168,7 @@ export function Table({ id, width, height, component, onComponentClick, currentS ) } - - return ( + return (
| { alert('ss'); e.preventDefault(); e.stopPropagation(); }}
{...column.getHeaderProps(column.getSortByToggleProps())}
className={
column.isSorted
@@ -222,7 +224,7 @@ export function Table({ id, width, height, component, onComponentClick, currentS
}
>
{column.render("Header")}
- { alert('ss'); e.preventDefault(); e.stopPropagation(); } }
{...column.getResizerProps()}
className={`resizer ${
column.isResizing ? 'isResizing' : ''
diff --git a/frontend/src/Editor/DraggableBox.jsx b/frontend/src/Editor/DraggableBox.jsx
index 47ada8a64f..a754735369 100644
--- a/frontend/src/Editor/DraggableBox.jsx
+++ b/frontend/src/Editor/DraggableBox.jsx
@@ -35,6 +35,7 @@ function getStyles(left, top, isDragging) {
export const DraggableBox = function DraggableBox({ id, mode, title, left, top, width, height, component, index, inCanvas, onEvent, onComponentClick, currentState, onComponentOptionChanged, onResizeStop, paramUpdated }) {
const [isResizing, setResizing] = useState(false);
+ const [canDrag, setCanDrag] = useState(true);
// useEffect(() => {
// setBoxes(component);
@@ -63,12 +64,16 @@ export const DraggableBox = function DraggableBox({ id, mode, title, left, top,
let refProps = {};
- if( mode === "edit") {
+ if( mode === "edit" && canDrag ) {
refProps = {
ref: drag
}
}
+ function changeCanDrag(newState) {
+ setCanDrag(newState);
+ }
+
return (
{inCanvas ?
@@ -94,6 +99,7 @@ export const DraggableBox = function DraggableBox({ id, mode, title, left, top,
width={width}
mode={mode}
height={height}
+ changeCanDrag={changeCanDrag}
inCanvas={inCanvas}
paramUpdated={paramUpdated}
onEvent={onEvent}
|
|---|