diff --git a/.gitignore b/.gitignore
index 839ad32..250b27b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -16,8 +16,11 @@ types.d.ts
/.npmrc
/frontend/generated
/frontend/index.html
+/src/main/frontend/generated
+/src/main/frontend/index.html
/pnpm-lock.yaml
/pnpmfile.js
/src/main/dev-bundle
+/src/main/bundles
vite.generated.ts
vite.config.ts
diff --git a/pom.xml b/pom.xml
index 4880789..a1f0d39 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
org.vaadin.addons.flowingcode
grid-helpers
- 1.4.6-SNAPSHOT
+ 1.5.0-SNAPSHOT
Grid Helpers Add-on
Grid Helpers Add-on for Vaadin Flow
https://www.flowingcode.com/en/open-source/
@@ -89,6 +89,16 @@
vaadin-snapshots
https://oss.sonatype.org/content/repositories/vaadin-snapshots/
+
+ FlowingCode Snapshots
+ https://maven.flowingcode.com/snapshots
+
+ true
+
+
+ false
+
+
@@ -124,6 +134,11 @@
vaadin-core
true
+
+ com.flowingcode.vaadin
+ json-migration-helper
+ 0.0.1-SNAPSHOT
+
org.slf4j
slf4j-simple
@@ -595,16 +610,6 @@
vaadin-prerelease
https://maven.vaadin.com/vaadin-prereleases
-
- FlowingCode Snapshots
- https://maven.flowingcode.com/snapshots
-
- true
-
-
- false
-
-
diff --git a/src/main/java/com/flowingcode/vaadin/addons/gridhelpers/EnhancedSelectionGridHelper.java b/src/main/java/com/flowingcode/vaadin/addons/gridhelpers/EnhancedSelectionGridHelper.java
index 83217fd..f382da6 100644
--- a/src/main/java/com/flowingcode/vaadin/addons/gridhelpers/EnhancedSelectionGridHelper.java
+++ b/src/main/java/com/flowingcode/vaadin/addons/gridhelpers/EnhancedSelectionGridHelper.java
@@ -20,11 +20,13 @@
package com.flowingcode.vaadin.addons.gridhelpers;
+import com.flowingcode.vaadin.jsonmigration.JsonMigration;
import com.vaadin.flow.component.ComponentUtil;
import com.vaadin.flow.component.UI;
import com.vaadin.flow.component.grid.Grid;
import com.vaadin.flow.component.grid.dataview.GridListDataView;
import com.vaadin.flow.shared.Registration;
+import elemental.json.JsonObject;
import java.io.Serializable;
import java.util.Optional;
import java.util.stream.Collectors;
@@ -101,26 +103,27 @@ void enableEnhancedSelection() {
});
keyUpRegistration = grid.getElement().addEventListener("keyup", ev -> {
- String keyUp = ev.getEventData().getString(KEY_UP_EVENT_KEY);
+ JsonObject eventData = JsonMigration.getEventData(ev);
+
+ String keyUp = eventData.getString(KEY_UP_EVENT_KEY);
boolean arrowsKey = "ArrowDown".equals(keyUp) || "ArrowUp".equals(keyUp);
GridListDataView dataView = grid.getListDataView();
Optional newFocusedItemMaybe = Optional.empty();
- int newFocusedItemIndex =
- (int) ev.getEventData().getNumber(KEY_UP_ELEMENT_FOCUSED_ITEM_INDEX);
+ int newFocusedItemIndex = (int) eventData.getNumber(KEY_UP_ELEMENT_FOCUSED_ITEM_INDEX);
if (newFocusedItemIndex >= 0) {
newFocusedItemMaybe = dataView.getItems().skip(newFocusedItemIndex).findFirst();
}
if (newFocusedItemMaybe.isPresent()) {
T newFocusedItem = newFocusedItemMaybe.get();
- boolean isSpecialKey = ev.getEventData().getBoolean(KEY_UP_EVENT_META_KEY)
- || ev.getEventData().getBoolean(KEY_UP_EVENT_CTRL_KEY)
- || ev.getEventData().getBoolean(KEY_UP_EVENT_ALT_KEY);
+ boolean isSpecialKey = eventData.getBoolean(KEY_UP_EVENT_META_KEY)
+ || eventData.getBoolean(KEY_UP_EVENT_CTRL_KEY)
+ || eventData.getBoolean(KEY_UP_EVENT_ALT_KEY);
Object lastFocusedItem = ComponentUtil.getData(grid, LAST_FOCUSED_ITEM);
- boolean shiftKey = ev.getEventData().getBoolean(KEY_UP_EVENT_SHIFT_KEY);
+ boolean shiftKey = eventData.getBoolean(KEY_UP_EVENT_SHIFT_KEY);
if (shiftKey) {
if (lastFocusedItem == null) {
ComponentUtil.setData(grid, LAST_FOCUSED_ITEM, newFocusedItem);
diff --git a/src/main/java/com/flowingcode/vaadin/addons/gridhelpers/GridRadioSelectionColumn.java b/src/main/java/com/flowingcode/vaadin/addons/gridhelpers/GridRadioSelectionColumn.java
index 2b062ee..c5f8348 100644
--- a/src/main/java/com/flowingcode/vaadin/addons/gridhelpers/GridRadioSelectionColumn.java
+++ b/src/main/java/com/flowingcode/vaadin/addons/gridhelpers/GridRadioSelectionColumn.java
@@ -33,10 +33,10 @@
* Server side implementation for the flow specific grid radio selection column.
*/
@Tag("grid-flow-radio-selection-column")
-@JsModule("@vaadin/polymer-legacy-adapter/style-modules.js")
@JsModule("./fcGridHelper/grid-flow-radio-selection-column.js")
@Uses(RadioButtonGroup.class)
// Indirectly ensure @NpmPackage(value = "@vaadin/polymer-legacy-adapter", version = "x.x.x")
+// and @JsModule("@vaadin/polymer-legacy-adapter/style-modules.js")
@Uses(Grid.class)
public class GridRadioSelectionColumn extends Component implements HasStyle {
diff --git a/src/main/java/com/flowingcode/vaadin/addons/gridhelpers/ResponsiveGridHelper.java b/src/main/java/com/flowingcode/vaadin/addons/gridhelpers/ResponsiveGridHelper.java
index 1fc2b80..06314b9 100644
--- a/src/main/java/com/flowingcode/vaadin/addons/gridhelpers/ResponsiveGridHelper.java
+++ b/src/main/java/com/flowingcode/vaadin/addons/gridhelpers/ResponsiveGridHelper.java
@@ -2,7 +2,7 @@
* #%L
* Grid Helpers Add-on
* %%
- * Copyright (C) 2022 - 2024 Flowing Code
+ * Copyright (C) 2022 - 2025 Flowing Code
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@
*/
package com.flowingcode.vaadin.addons.gridhelpers;
+import com.flowingcode.vaadin.jsonmigration.JsonMigration;
import com.vaadin.flow.component.grid.Grid;
import com.vaadin.flow.dom.DebouncePhase;
import com.vaadin.flow.shared.Registration;
@@ -76,7 +77,7 @@ GridResponsiveStep getOrCreate(int minWidth) {
private void initialize() {
Grid grid = helper.getGrid();
grid.getElement().addEventListener("fcgh-responsive-step", ev -> {
- apply((int) ev.getEventData().getNumber("event.detail.step"), false);
+ apply((int) JsonMigration.getEventData(ev).getNumber("event.detail.step"), false);
}).addEventData("event.detail.step").debounce(200, DebouncePhase.TRAILING);
sendSteps();
}
diff --git a/src/test/java/com/flowingcode/vaadin/addons/gridhelpers/AllFeaturesDemo.java b/src/test/java/com/flowingcode/vaadin/addons/gridhelpers/AllFeaturesDemo.java
index 590bbe4..8d783cb 100644
--- a/src/test/java/com/flowingcode/vaadin/addons/gridhelpers/AllFeaturesDemo.java
+++ b/src/test/java/com/flowingcode/vaadin/addons/gridhelpers/AllFeaturesDemo.java
@@ -34,7 +34,6 @@
import com.vaadin.flow.component.grid.Grid;
import com.vaadin.flow.component.grid.Grid.SelectionMode;
import com.vaadin.flow.component.html.Div;
-import com.vaadin.flow.component.html.Label;
import com.vaadin.flow.component.icon.VaadinIcon;
import com.vaadin.flow.component.notification.Notification;
import com.vaadin.flow.component.orderedlayout.FlexComponent.JustifyContentMode;
@@ -189,7 +188,8 @@ public AllFeaturesDemo() {
heightByRowsField.setStepButtonsVisible(true);
binder.getFields().map(Component.class::cast).forEach(features::add);
- Label label = new Label("Features");
+
+ CompatibilityLabel label = new CompatibilityLabel("Features");
label.addClassNames("label");
features.addComponentAtIndex(2, label);
diff --git a/src/test/java/com/flowingcode/vaadin/addons/gridhelpers/CompatibilityLabel.java b/src/test/java/com/flowingcode/vaadin/addons/gridhelpers/CompatibilityLabel.java
new file mode 100644
index 0000000..a263a11
--- /dev/null
+++ b/src/test/java/com/flowingcode/vaadin/addons/gridhelpers/CompatibilityLabel.java
@@ -0,0 +1,35 @@
+/*-
+ * #%L
+ * Grid Helpers Add-on
+ * %%
+ * Copyright (C) 2022 - 2025 Flowing Code
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+package com.flowingcode.vaadin.addons.gridhelpers;
+
+import com.vaadin.flow.component.Component;
+import com.vaadin.flow.component.HasStyle;
+import com.vaadin.flow.component.Tag;
+import com.vaadin.flow.component.Text;
+
+@Tag(Tag.LABEL)
+public class CompatibilityLabel extends Component implements HasStyle {
+
+ public CompatibilityLabel(String text) {
+ getElement().appendChild(new Text(text).getElement());
+ }
+
+
+}
diff --git a/src/test/java/com/flowingcode/vaadin/addons/gridhelpers/it/GridHelperElement.java b/src/test/java/com/flowingcode/vaadin/addons/gridhelpers/it/GridHelperElement.java
index c2c6e83..d194526 100644
--- a/src/test/java/com/flowingcode/vaadin/addons/gridhelpers/it/GridHelperElement.java
+++ b/src/test/java/com/flowingcode/vaadin/addons/gridhelpers/it/GridHelperElement.java
@@ -134,7 +134,7 @@ public WebElement getHeaderRow(int rowIndex) {
return headerRows.get(rowIndex);
}
- public WebElement getHeaderCell(int rowIndex, int columnIndex) {
+ public WebElement getHeaderCellAt(int rowIndex, int columnIndex) {
List headerCells = getHeaderRow(rowIndex).findElements(By.tagName("th"));
return headerCells.get(columnIndex);
}
diff --git a/src/test/java/com/flowingcode/vaadin/addons/gridhelpers/it/HeaderFooterStylesIT.java b/src/test/java/com/flowingcode/vaadin/addons/gridhelpers/it/HeaderFooterStylesIT.java
index e92867a..c62b534 100644
--- a/src/test/java/com/flowingcode/vaadin/addons/gridhelpers/it/HeaderFooterStylesIT.java
+++ b/src/test/java/com/flowingcode/vaadin/addons/gridhelpers/it/HeaderFooterStylesIT.java
@@ -54,11 +54,11 @@ public void testHeaderClassesApplied() {
row1.getCell(i).setClassName("row1-cell" + i);
}
- assertEquals("row0-cell0", grid.getHeaderCell(0, 0).getAttribute("class"));
- assertEquals("row0-cell1", grid.getHeaderCell(0, 1).getAttribute("class"));
+ assertEquals("row0-cell0", grid.getHeaderCellAt(0, 0).getAttribute("class"));
+ assertEquals("row0-cell1", grid.getHeaderCellAt(0, 1).getAttribute("class"));
for (int i = 0; i < 5; i++) {
- assertEquals("row1-cell" + i, grid.getHeaderCell(1, i).getAttribute("class"));
+ assertEquals("row1-cell" + i, grid.getHeaderCellAt(1, i).getAttribute("class"));
}
}
@@ -72,8 +72,8 @@ public void testHeaderCellMutability() {
$server.setColumnOrder(2, 3, 0, 1, 4);
header0.setClassName("row0-cell0");
header1.setClassName("row0-cell1");
- assertEquals("row0-cell1", grid.getHeaderCell(0, 0).getAttribute("class"));
- assertEquals("row0-cell0", grid.getHeaderCell(0, 1).getAttribute("class"));
+ assertEquals("row0-cell1", grid.getHeaderCellAt(0, 0).getAttribute("class"));
+ assertEquals("row0-cell0", grid.getHeaderCellAt(0, 1).getAttribute("class"));
}
}