@vaadin/grid 23.1.6 → 23.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/grid",
|
|
3
|
-
"version": "23.1.
|
|
3
|
+
"version": "23.1.8",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -43,20 +43,20 @@
|
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
45
45
|
"@polymer/polymer": "^3.0.0",
|
|
46
|
-
"@vaadin/checkbox": "
|
|
47
|
-
"@vaadin/component-base": "
|
|
48
|
-
"@vaadin/lit-renderer": "
|
|
49
|
-
"@vaadin/text-field": "
|
|
50
|
-
"@vaadin/vaadin-lumo-styles": "
|
|
51
|
-
"@vaadin/vaadin-material-styles": "
|
|
52
|
-
"@vaadin/vaadin-themable-mixin": "
|
|
46
|
+
"@vaadin/checkbox": "~23.1.8",
|
|
47
|
+
"@vaadin/component-base": "~23.1.8",
|
|
48
|
+
"@vaadin/lit-renderer": "~23.1.8",
|
|
49
|
+
"@vaadin/text-field": "~23.1.8",
|
|
50
|
+
"@vaadin/vaadin-lumo-styles": "~23.1.8",
|
|
51
|
+
"@vaadin/vaadin-material-styles": "~23.1.8",
|
|
52
|
+
"@vaadin/vaadin-themable-mixin": "~23.1.8"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@esm-bundle/chai": "^4.3.4",
|
|
56
|
-
"@vaadin/polymer-legacy-adapter": "
|
|
56
|
+
"@vaadin/polymer-legacy-adapter": "~23.1.8",
|
|
57
57
|
"@vaadin/testing-helpers": "^0.3.2",
|
|
58
58
|
"lit": "^2.0.0",
|
|
59
59
|
"sinon": "^13.0.2"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "297e4e51743751bed97f5400e661529a7d550870"
|
|
62
62
|
}
|
|
@@ -161,7 +161,23 @@ export const ColumnReorderingMixin = (superClass) =>
|
|
|
161
161
|
this._isSwapAllowed(this._draggedColumn, targetColumn) &&
|
|
162
162
|
this._isSwappableByPosition(targetColumn, e.detail.x)
|
|
163
163
|
) {
|
|
164
|
-
|
|
164
|
+
// Get the column header level of the target column (and the dragged column)
|
|
165
|
+
const columnTreeLevel = this._columnTree.findIndex((level) => level.includes(targetColumn));
|
|
166
|
+
// Get the columns on that level in visual order
|
|
167
|
+
const levelColumnsInOrder = this._getColumnsInOrder(columnTreeLevel);
|
|
168
|
+
|
|
169
|
+
// Index of the column being dragged
|
|
170
|
+
const startIndex = levelColumnsInOrder.indexOf(this._draggedColumn);
|
|
171
|
+
// Index of the column being dragged over
|
|
172
|
+
const endIndex = levelColumnsInOrder.indexOf(targetColumn);
|
|
173
|
+
|
|
174
|
+
// Direction of iteration
|
|
175
|
+
const direction = startIndex < endIndex ? 1 : -1;
|
|
176
|
+
|
|
177
|
+
// Iteratively swap all the columns from the dragged column to the target column
|
|
178
|
+
for (let i = startIndex; i !== endIndex; i += direction) {
|
|
179
|
+
this._swapColumnOrders(this._draggedColumn, levelColumnsInOrder[i + direction]);
|
|
180
|
+
}
|
|
165
181
|
}
|
|
166
182
|
|
|
167
183
|
this._updateGhostPosition(e.detail.x, this._touchDevice ? e.detail.y - 50 : e.detail.y);
|
|
@@ -192,15 +208,14 @@ export const ColumnReorderingMixin = (superClass) =>
|
|
|
192
208
|
}
|
|
193
209
|
|
|
194
210
|
/**
|
|
211
|
+
* Returns the columns (or column groups) on the specified header level in visual order.
|
|
212
|
+
* By default, the bottom level is used.
|
|
213
|
+
*
|
|
195
214
|
* @return {!Array<!GridColumn>}
|
|
196
215
|
* @protected
|
|
197
216
|
*/
|
|
198
|
-
_getColumnsInOrder() {
|
|
199
|
-
return this._columnTree
|
|
200
|
-
.slice(0)
|
|
201
|
-
.pop()
|
|
202
|
-
.filter((c) => !c.hidden)
|
|
203
|
-
.sort((b, a) => b._order - a._order);
|
|
217
|
+
_getColumnsInOrder(headerLevel = this._columnTree.length - 1) {
|
|
218
|
+
return this._columnTree[headerLevel].filter((c) => !c.hidden).sort((b, a) => b._order - a._order);
|
|
204
219
|
}
|
|
205
220
|
|
|
206
221
|
/**
|
package/src/vaadin-grid.js
CHANGED
|
@@ -594,6 +594,11 @@ class Grid extends ElementMixin(
|
|
|
594
594
|
// Flush to make sure DOM is up-to-date when measuring the column widths
|
|
595
595
|
this.__virtualizer.flush();
|
|
596
596
|
|
|
597
|
+
// Flush to account for any changes to the visibility of the columns
|
|
598
|
+
if (this._debouncerHiddenChanged) {
|
|
599
|
+
this._debouncerHiddenChanged.flush();
|
|
600
|
+
}
|
|
601
|
+
|
|
597
602
|
cols.forEach((col) => {
|
|
598
603
|
col.width = `${this.__getDistributedWidth(col)}px`;
|
|
599
604
|
});
|
|
@@ -993,7 +998,9 @@ class Grid extends ElementMixin(
|
|
|
993
998
|
// Header and footer renderers
|
|
994
999
|
this._columnTree.forEach((level) => {
|
|
995
1000
|
level.forEach((column) => {
|
|
996
|
-
column._renderHeaderAndFooter
|
|
1001
|
+
if (column._renderHeaderAndFooter) {
|
|
1002
|
+
column._renderHeaderAndFooter();
|
|
1003
|
+
}
|
|
997
1004
|
});
|
|
998
1005
|
});
|
|
999
1006
|
|