@vaadin/grid 23.0.6 → 23.0.9

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.0.6",
3
+ "version": "23.0.9",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -41,19 +41,19 @@
41
41
  "dependencies": {
42
42
  "@open-wc/dedupe-mixin": "^1.3.0",
43
43
  "@polymer/polymer": "^3.0.0",
44
- "@vaadin/checkbox": "^23.0.6",
45
- "@vaadin/component-base": "^23.0.6",
46
- "@vaadin/text-field": "^23.0.6",
47
- "@vaadin/vaadin-lumo-styles": "^23.0.6",
48
- "@vaadin/vaadin-material-styles": "^23.0.6",
49
- "@vaadin/vaadin-themable-mixin": "^23.0.6"
44
+ "@vaadin/checkbox": "^23.0.9",
45
+ "@vaadin/component-base": "^23.0.9",
46
+ "@vaadin/text-field": "^23.0.9",
47
+ "@vaadin/vaadin-lumo-styles": "^23.0.9",
48
+ "@vaadin/vaadin-material-styles": "^23.0.9",
49
+ "@vaadin/vaadin-themable-mixin": "^23.0.9"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@esm-bundle/chai": "^4.3.4",
53
- "@vaadin/polymer-legacy-adapter": "^23.0.6",
53
+ "@vaadin/polymer-legacy-adapter": "^23.0.9",
54
54
  "@vaadin/testing-helpers": "^0.3.2",
55
55
  "lit": "^2.0.0",
56
56
  "sinon": "^9.2.0"
57
57
  },
58
- "gitHead": "82ca8522e24a63343fb28bcb4c686e55d25c8858"
58
+ "gitHead": "4d687bdd48ba78d55f3371a78b70818e4dfca1a3"
59
59
  }
@@ -85,11 +85,8 @@ class GridColumnGroup extends ColumnBaseMixin(PolymerElement) {
85
85
 
86
86
  static get observers() {
87
87
  return [
88
- '_updateVisibleChildColumns(_childColumns)',
89
- '_childColumnsChanged(_childColumns)',
90
88
  '_groupFrozenChanged(frozen, _rootColumns)',
91
- '_groupHiddenChanged(hidden, _rootColumns)',
92
- '_visibleChildColumnsChanged(_visibleChildColumns)',
89
+ '_groupHiddenChanged(hidden)',
93
90
  '_colSpanChanged(_colSpan, _headerCell, _footerCell)',
94
91
  '_groupOrderChanged(_order, _rootColumns)',
95
92
  '_groupReorderStatusChanged(_reorderStatus, _rootColumns)',
@@ -117,9 +114,12 @@ class GridColumnGroup extends ColumnBaseMixin(PolymerElement) {
117
114
  */
118
115
  _columnPropChanged(path, value) {
119
116
  if (path === 'hidden') {
120
- this._preventHiddenCascade = true;
117
+ // Prevent synchronization of the hidden state to child columns.
118
+ // If the group is currently auto-hidden, and one column is made visible,
119
+ // we don't want the other columns to become visible as well.
120
+ this._preventHiddenSynchronization = true;
121
121
  this._updateVisibleChildColumns(this._childColumns);
122
- this._preventHiddenCascade = false;
122
+ this._preventHiddenSynchronization = false;
123
123
  }
124
124
 
125
125
  if (/flexGrow|width|hidden|_childColumns/.test(path)) {
@@ -192,14 +192,8 @@ class GridColumnGroup extends ColumnBaseMixin(PolymerElement) {
192
192
  /** @private */
193
193
  _updateVisibleChildColumns(childColumns) {
194
194
  this._visibleChildColumns = Array.prototype.filter.call(childColumns, (col) => !col.hidden);
195
- }
196
-
197
- /** @private */
198
- _childColumnsChanged(childColumns) {
199
- if (!this._autoHidden && this.hidden) {
200
- Array.prototype.forEach.call(childColumns, (column) => (column.hidden = true));
201
- this._updateVisibleChildColumns(childColumns);
202
- }
195
+ this._colSpan = this._visibleChildColumns.length;
196
+ this._updateAutoHidden();
203
197
  }
204
198
 
205
199
  /** @protected */
@@ -240,26 +234,31 @@ class GridColumnGroup extends ColumnBaseMixin(PolymerElement) {
240
234
  }
241
235
 
242
236
  /** @private */
243
- _groupHiddenChanged(hidden, rootColumns) {
244
- if (rootColumns && !this._preventHiddenCascade) {
245
- this._ignoreVisibleChildColumns = true;
246
- rootColumns.forEach((column) => (column.hidden = hidden));
247
- this._ignoreVisibleChildColumns = false;
237
+ _groupHiddenChanged(hidden) {
238
+ // When initializing the hidden property, only sync hidden state to columns
239
+ // if group is actually hidden. Otherwise, we could override a hidden column
240
+ // to be visible.
241
+ // We always want to run this though if the property is actually changed.
242
+ if (hidden || this.__groupHiddenInitialized) {
243
+ this._synchronizeHidden();
248
244
  }
245
+ this.__groupHiddenInitialized = true;
246
+ }
249
247
 
250
- this._columnPropChanged('hidden');
248
+ /** @private */
249
+ _updateAutoHidden() {
250
+ const wasAutoHidden = this._autoHidden;
251
+ this._autoHidden = (this._visibleChildColumns || []).length === 0;
252
+ // Only modify hidden state if group was auto-hidden, or becomes auto-hidden
253
+ if (wasAutoHidden || this._autoHidden) {
254
+ this.hidden = this._autoHidden;
255
+ }
251
256
  }
252
257
 
253
258
  /** @private */
254
- _visibleChildColumnsChanged(visibleChildColumns) {
255
- this._colSpan = visibleChildColumns.length;
256
-
257
- if (!this._ignoreVisibleChildColumns) {
258
- if (visibleChildColumns.length === 0) {
259
- this._autoHidden = this.hidden = true;
260
- } else if (this.hidden && this._autoHidden) {
261
- this._autoHidden = this.hidden = false;
262
- }
259
+ _synchronizeHidden() {
260
+ if (this._childColumns && !this._preventHiddenSynchronization) {
261
+ this._childColumns.forEach((column) => (column.hidden = this.hidden));
263
262
  }
264
263
  }
265
264
 
@@ -291,10 +290,14 @@ class GridColumnGroup extends ColumnBaseMixin(PolymerElement) {
291
290
  info.addedNodes.filter(this._isColumnElement).length > 0 ||
292
291
  info.removedNodes.filter(this._isColumnElement).length > 0
293
292
  ) {
294
- this._preventHiddenCascade = true;
293
+ // Prevent synchronization of the hidden state to child columns.
294
+ // If the group is currently auto-hidden, and a visible column is added,
295
+ // we don't want the other columns to become visible as well.
296
+ this._preventHiddenSynchronization = true;
295
297
  this._rootColumns = this._getChildColumns(this);
296
298
  this._childColumns = this._rootColumns;
297
- this._preventHiddenCascade = false;
299
+ this._updateVisibleChildColumns(this._childColumns);
300
+ this._preventHiddenSynchronization = false;
298
301
 
299
302
  // Update the column tree with microtask timing to avoid shady style scope issues
300
303
  microTask.run(() => {
@@ -617,6 +617,11 @@ export const KeyboardNavigationMixin = (superClass) =>
617
617
  _onTabKeyDown(e) {
618
618
  const focusTarget = this._predictFocusStepTarget(e.composedPath()[0], e.shiftKey ? -1 : 1);
619
619
 
620
+ // Can be undefined if grid has tabindex
621
+ if (!focusTarget) {
622
+ return;
623
+ }
624
+
620
625
  // Prevent focus-trap logic from intercepting the event.
621
626
  e.stopPropagation();
622
627
 
@@ -49,7 +49,7 @@ export const StylingMixin = (superClass) =>
49
49
  */
50
50
  generateCellClassNames() {
51
51
  Array.from(this.$.items.children)
52
- .filter((row) => !row.hidden)
52
+ .filter((row) => !row.hidden && !row.hasAttribute('loading'))
53
53
  .forEach((row) => this._generateCellClassNames(row, this.__getRowModel(row)));
54
54
  }
55
55
 
@@ -669,7 +669,7 @@ class Grid extends ElementMixin(
669
669
  // If focus is on element within the cell content — respect it, do not change
670
670
  const contentContainsFocusedElement = cellContent.contains(this.getRootNode().activeElement);
671
671
  // Only focus if mouse is released on cell content itself
672
- const mouseUpWithinCell = cellContent.contains(event.target);
672
+ const mouseUpWithinCell = event.composedPath().includes(cellContent);
673
673
  if (!contentContainsFocusedElement && mouseUpWithinCell) {
674
674
  cell.focus();
675
675
  }
@@ -893,7 +893,8 @@ class Grid extends ElementMixin(
893
893
  }
894
894
 
895
895
  __updateFooterPositioning() {
896
- if (this._firefox) {
896
+ // TODO: fixed in Firefox 99, remove when we can drop Firefox ESR 91 support
897
+ if (this._firefox && parseFloat(navigator.userAgent.match(/Firefox\/(\d{2,3}.\d)/)[1]) < 99) {
897
898
  // Sticky (or translated) footer in a flexbox host doesn't get included in
898
899
  // the scroll height calculation on FF. This is a workaround for the issue.
899
900
  this.$.items.style.paddingBottom = 0;
@@ -951,8 +952,6 @@ class Grid extends ElementMixin(
951
952
 
952
953
  requestAnimationFrame(() => {
953
954
  this.__scrollToPendingIndex();
954
- // This needs to be set programmatically in order to avoid an iOS 10 bug (disappearing grid)
955
- this.$.table.style.webkitOverflowScrolling = 'touch';
956
955
  });
957
956
  }
958
957
  }