test stop drag propagation

This commit is contained in:
dehernandezm 2024-12-17 16:02:39 -06:00
parent cbe739430f
commit fe0b18d15e
3 changed files with 7 additions and 1 deletions

View File

@ -225,6 +225,7 @@ export default class Draggable extends React.Component<DraggableProps, Draggable
} }
onDragStart: DraggableEventHandler = (e, coreData) => { onDragStart: DraggableEventHandler = (e, coreData) => {
e.stopPropagation();
log('Draggable: onDragStart: %j', coreData); log('Draggable: onDragStart: %j', coreData);
// Short-circuit if user's callback killed it. // Short-circuit if user's callback killed it.
@ -236,6 +237,7 @@ export default class Draggable extends React.Component<DraggableProps, Draggable
}; };
onDrag: DraggableEventHandler = (e, coreData) => { onDrag: DraggableEventHandler = (e, coreData) => {
e.stopPropagation();
if (!this.state.dragging) return false; if (!this.state.dragging) return false;
log('Draggable: onDrag: %j', coreData); log('Draggable: onDrag: %j', coreData);
@ -281,6 +283,7 @@ export default class Draggable extends React.Component<DraggableProps, Draggable
}; };
onDragStop: DraggableEventHandler = (e, coreData) => { onDragStop: DraggableEventHandler = (e, coreData) => {
e.stopPropagation();
if (!this.state.dragging) return false; if (!this.state.dragging) return false;
// Short-circuit if user's callback killed it. // Short-circuit if user's callback killed it.

View File

@ -236,6 +236,7 @@ export default class DraggableCore extends React.Component<DraggableCoreProps, D
} }
handleDragStart: EventHandler<MouseTouchEvent> = (e) => { handleDragStart: EventHandler<MouseTouchEvent> = (e) => {
e.stopPropagation();
// Make it possible to attach event handlers on top of this one. // Make it possible to attach event handlers on top of this one.
this.props.onMouseDown(e); this.props.onMouseDown(e);
@ -300,6 +301,7 @@ export default class DraggableCore extends React.Component<DraggableCoreProps, D
}; };
handleDrag: EventHandler<MouseTouchEvent> = (e) => { handleDrag: EventHandler<MouseTouchEvent> = (e) => {
e.stopPropagation();
// Prevent scrolling on mobile devices, like ipad/iphone. // Prevent scrolling on mobile devices, like ipad/iphone.
if (e.type === 'touchmove') e.preventDefault(); if (e.type === 'touchmove') e.preventDefault();
@ -345,6 +347,7 @@ export default class DraggableCore extends React.Component<DraggableCoreProps, D
}; };
handleDragStop: EventHandler<MouseTouchEvent> = (e) => { handleDragStop: EventHandler<MouseTouchEvent> = (e) => {
e.stopPropagation();
if (!this.state.dragging) return; if (!this.state.dragging) return;
const position = getControlPosition(e, this.state.touchIdentifier, this); const position = getControlPosition(e, this.state.touchIdentifier, this);

View File

@ -1,6 +1,6 @@
{ {
"name": "v-react-pivottable", "name": "v-react-pivottable",
"version": "0.11.9", "version": "0.11.10",
"description": "A React-based pivot table", "description": "A React-based pivot table",
"main": "PivotTableUI.js", "main": "PivotTableUI.js",
"files": [ "files": [