Skip to content

Commit 6cddf09

Browse files
authored
fix: remove grid dnd polyfill (#5686)
1 parent 21bebf3 commit 6cddf09

3 files changed

Lines changed: 16 additions & 12 deletions

File tree

‎vaadin-grid-flow-parent/vaadin-grid-flow-integration-tests/src/main/java/com/vaadin/flow/component/grid/it/DragAndDropGridPage.java‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,15 @@ private void createControls() {
144144
});
145145
multiSelectButton.setId("multiselect");
146146
add(multiSelectButton);
147+
148+
NativeButton removeOnItemClick = new NativeButton(
149+
"remove on item click", e -> {
150+
grid.addItemClickListener(event -> {
151+
grid.removeFromParent();
152+
});
153+
});
154+
removeOnItemClick.setId("remove-on-item-click");
155+
add(removeOnItemClick);
147156
}
148157

149158
}

‎vaadin-grid-flow-parent/vaadin-grid-flow-integration-tests/src/test/java/com/vaadin/flow/component/grid/it/DragAndDropGridIT.java‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,13 @@ public void setDropFilter_undroppable_noDropMode() {
209209
assertMessages("", "", "");
210210
}
211211

212+
@Test
213+
public void removeOnItemClick_noError() {
214+
click("remove-on-item-click");
215+
grid.getCell("0").click();
216+
checkLogsForErrors();
217+
}
218+
212219
private void assertMessages(String expectedStartMessage,
213220
String expectedEndMessage, String expectedDropMessage) {
214221
Assert.assertEquals(expectedStartMessage,

‎vaadin-grid-flow-parent/vaadin-grid-flow/src/main/java/com/vaadin/flow/component/grid/Grid.java‎

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@
5252
import com.vaadin.flow.component.Tag;
5353
import com.vaadin.flow.component.dependency.JsModule;
5454
import com.vaadin.flow.component.dependency.NpmPackage;
55-
import com.vaadin.flow.component.dnd.DragSource;
56-
import com.vaadin.flow.component.dnd.DropTarget;
5755
import com.vaadin.flow.component.grid.GridArrayUpdater.UpdateQueueData;
5856
import com.vaadin.flow.component.grid.contextmenu.GridContextMenu;
5957
import com.vaadin.flow.component.grid.dataview.GridDataView;
@@ -4234,11 +4232,6 @@ public Registration addDragEndListener(
42344232
* @see GridDropEvent#getDropLocation()
42354233
*/
42364234
public void setDropMode(GridDropMode dropMode) {
4237-
// We need to add DnD mobile polyfill here by invoking
4238-
// DndUtil.addMobileDndPolyfillIfNeeded. But, since DndUtil is in a Flow
4239-
// internal package, DropTarget.create is called to invoke
4240-
// addMobileDndPolyfillIfNeeded indirectly.
4241-
DropTarget.create(this).setActive(false);
42424235
getElement().setProperty("dropMode",
42434236
dropMode == null ? null : dropMode.getClientName());
42444237
}
@@ -4264,11 +4257,6 @@ public GridDropMode getDropMode() {
42644257
* {@code false} if not
42654258
*/
42664259
public void setRowsDraggable(boolean rowsDraggable) {
4267-
// We need to add DnD mobile polyfill here by invoking
4268-
// DndUtil.addMobileDndPolyfillIfNeeded. But, since DndUtil is in a Flow
4269-
// internal package, DragSource.create is called to invoke
4270-
// addMobileDndPolyfillIfNeeded indirectly.
4271-
DragSource.create(this).setDraggable(false);
42724260
getElement().setProperty("rowsDraggable", rowsDraggable);
42734261
}
42744262

0 commit comments

Comments
 (0)