@vaadin/grid 23.0.0-alpha2 → 23.0.0-beta1

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.
Files changed (53) hide show
  1. package/package.json +10 -9
  2. package/src/all-imports.js +1 -1
  3. package/src/vaadin-grid-a11y-mixin.js +1 -1
  4. package/src/vaadin-grid-active-item-mixin.d.ts +1 -1
  5. package/src/vaadin-grid-active-item-mixin.js +1 -1
  6. package/src/vaadin-grid-array-data-provider-mixin.d.ts +1 -1
  7. package/src/vaadin-grid-array-data-provider-mixin.js +1 -1
  8. package/src/vaadin-grid-column-group.d.ts +1 -1
  9. package/src/vaadin-grid-column-group.js +1 -1
  10. package/src/vaadin-grid-column-reordering-mixin.d.ts +1 -1
  11. package/src/vaadin-grid-column-reordering-mixin.js +1 -1
  12. package/src/vaadin-grid-column-resizing-mixin.js +1 -1
  13. package/src/vaadin-grid-column.d.ts +1 -1
  14. package/src/vaadin-grid-column.js +11 -3
  15. package/src/vaadin-grid-data-provider-mixin.d.ts +1 -1
  16. package/src/vaadin-grid-data-provider-mixin.js +2 -2
  17. package/src/vaadin-grid-drag-and-drop-mixin.d.ts +1 -1
  18. package/src/vaadin-grid-drag-and-drop-mixin.js +1 -1
  19. package/src/vaadin-grid-dynamic-columns-mixin.js +1 -1
  20. package/src/vaadin-grid-event-context-mixin.d.ts +1 -1
  21. package/src/vaadin-grid-event-context-mixin.js +1 -1
  22. package/src/vaadin-grid-filter-column.d.ts +1 -1
  23. package/src/vaadin-grid-filter-column.js +1 -1
  24. package/src/vaadin-grid-filter-mixin.js +1 -1
  25. package/src/vaadin-grid-filter.d.ts +1 -1
  26. package/src/vaadin-grid-filter.js +1 -1
  27. package/src/vaadin-grid-helpers.js +3 -3
  28. package/src/vaadin-grid-keyboard-navigation-mixin.js +42 -5
  29. package/src/vaadin-grid-row-details-mixin.d.ts +1 -1
  30. package/src/vaadin-grid-row-details-mixin.js +4 -2
  31. package/src/vaadin-grid-scroll-mixin.d.ts +1 -1
  32. package/src/vaadin-grid-scroll-mixin.js +1 -1
  33. package/src/vaadin-grid-selection-column.d.ts +1 -1
  34. package/src/vaadin-grid-selection-column.js +2 -2
  35. package/src/vaadin-grid-selection-mixin.d.ts +1 -1
  36. package/src/vaadin-grid-selection-mixin.js +3 -7
  37. package/src/vaadin-grid-sort-column.d.ts +1 -1
  38. package/src/vaadin-grid-sort-column.js +1 -1
  39. package/src/vaadin-grid-sort-mixin.d.ts +1 -1
  40. package/src/vaadin-grid-sort-mixin.js +1 -1
  41. package/src/vaadin-grid-sorter.d.ts +1 -1
  42. package/src/vaadin-grid-sorter.js +1 -1
  43. package/src/vaadin-grid-styles.js +1 -1
  44. package/src/vaadin-grid-styling-mixin.d.ts +1 -1
  45. package/src/vaadin-grid-styling-mixin.js +1 -1
  46. package/src/vaadin-grid-tree-column.d.ts +1 -1
  47. package/src/vaadin-grid-tree-column.js +1 -1
  48. package/src/vaadin-grid-tree-toggle.d.ts +1 -1
  49. package/src/vaadin-grid-tree-toggle.js +1 -1
  50. package/src/vaadin-grid.d.ts +3 -2
  51. package/src/vaadin-grid.js +9 -3
  52. package/theme/lumo/vaadin-grid-styles.js +4 -0
  53. package/theme/material/vaadin-grid-styles.js +4 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/grid",
3
- "version": "23.0.0-alpha2",
3
+ "version": "23.0.0-beta1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -18,6 +18,7 @@
18
18
  },
19
19
  "main": "vaadin-grid.js",
20
20
  "module": "vaadin-grid.js",
21
+ "type": "module",
21
22
  "files": [
22
23
  "all-imports.js",
23
24
  "src",
@@ -40,19 +41,19 @@
40
41
  "dependencies": {
41
42
  "@open-wc/dedupe-mixin": "^1.3.0",
42
43
  "@polymer/polymer": "^3.0.0",
43
- "@vaadin/checkbox": "23.0.0-alpha2",
44
- "@vaadin/component-base": "23.0.0-alpha2",
45
- "@vaadin/text-field": "23.0.0-alpha2",
46
- "@vaadin/vaadin-lumo-styles": "23.0.0-alpha2",
47
- "@vaadin/vaadin-material-styles": "23.0.0-alpha2",
48
- "@vaadin/vaadin-themable-mixin": "23.0.0-alpha2"
44
+ "@vaadin/checkbox": "23.0.0-beta1",
45
+ "@vaadin/component-base": "23.0.0-beta1",
46
+ "@vaadin/text-field": "23.0.0-beta1",
47
+ "@vaadin/vaadin-lumo-styles": "23.0.0-beta1",
48
+ "@vaadin/vaadin-material-styles": "23.0.0-beta1",
49
+ "@vaadin/vaadin-themable-mixin": "23.0.0-beta1"
49
50
  },
50
51
  "devDependencies": {
51
52
  "@esm-bundle/chai": "^4.3.4",
52
- "@vaadin/polymer-legacy-adapter": "23.0.0-alpha2",
53
+ "@vaadin/polymer-legacy-adapter": "23.0.0-beta1",
53
54
  "@vaadin/testing-helpers": "^0.3.2",
54
55
  "lit": "^2.0.0",
55
56
  "sinon": "^9.2.0"
56
57
  },
57
- "gitHead": "070f586dead02ca41b66717820c647f48bf1665f"
58
+ "gitHead": "467244b76021176c109df675799b07029b293e58"
58
59
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import './vaadin-grid.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { Constructor } from '@open-wc/dedupe-mixin';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { Constructor } from '@open-wc/dedupe-mixin';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { createArrayDataProvider } from './array-data-provider.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { GridDefaultItem } from './vaadin-grid.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { FlattenedNodesObserver } from '@polymer/polymer/lib/utils/flattened-nodes-observer.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { Constructor } from '@open-wc/dedupe-mixin';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { addListener } from '@vaadin/component-base/src/gestures.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { addListener } from '@vaadin/component-base/src/gestures.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { Constructor } from '@open-wc/dedupe-mixin';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { PolymerElement } from '@polymer/polymer/polymer-element.js';
@@ -449,6 +449,10 @@ export const ColumnBaseMixin = (superClass) =>
449
449
  }
450
450
 
451
451
  cells.forEach((cell) => {
452
+ if (!cell.parentElement) {
453
+ return;
454
+ }
455
+
452
456
  const model = this._grid.__getRowModel(cell.parentElement);
453
457
 
454
458
  if (!renderer) {
@@ -493,7 +497,9 @@ export const ColumnBaseMixin = (superClass) =>
493
497
  }
494
498
 
495
499
  this.__renderCellsContent(headerRenderer, [headerCell]);
496
- this._grid.__updateHeaderFooterRowVisibility(headerCell.parentElement);
500
+ if (this._grid) {
501
+ this._grid.__updateHeaderFooterRowVisibility(headerCell.parentElement);
502
+ }
497
503
  }
498
504
 
499
505
  /** @protected */
@@ -532,7 +538,9 @@ export const ColumnBaseMixin = (superClass) =>
532
538
  }
533
539
 
534
540
  this.__renderCellsContent(footerRenderer, [footerCell]);
535
- this._grid.__updateHeaderFooterRowVisibility(footerCell.parentElement);
541
+ if (this._grid) {
542
+ this._grid.__updateHeaderFooterRowVisibility(footerCell.parentElement);
543
+ }
536
544
  }
537
545
 
538
546
  /** @protected */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { Constructor } from '@open-wc/dedupe-mixin';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { timeOut } from '@vaadin/component-base/src/async.js';
@@ -324,7 +324,7 @@ export const DataProviderMixin = (superClass) =>
324
324
  let level = 0;
325
325
  while (cache.parentCache) {
326
326
  cache = cache.parentCache;
327
- level++;
327
+ level += 1;
328
328
  }
329
329
  return level;
330
330
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { Constructor } from '@open-wc/dedupe-mixin';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  const DropMode = {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { FlattenedNodesObserver } from '@polymer/polymer/lib/utils/flattened-nodes-observer.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { Constructor } from '@open-wc/dedupe-mixin';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { GridDefaultItem } from './vaadin-grid.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import './vaadin-grid-filter.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import '@vaadin/text-field/src/vaadin-text-field.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
 
@@ -15,9 +15,9 @@ export function updateColumnOrders(columns, scope, baseOrder) {
15
15
  // avoid multiples of 10 because they introduce and extra zero and
16
16
  // causes the underlying calculations for child order goes wrong
17
17
  if (c % 10 === 0) {
18
- c++;
18
+ c += 1;
19
19
  }
20
20
  column._order = baseOrder + c * scope;
21
- c++;
21
+ c += 1;
22
22
  });
23
23
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
 
@@ -130,6 +130,37 @@ export const KeyboardNavigationMixin = (superClass) =>
130
130
  this._updateGridSectionFocusTarget(this._footerFocusable);
131
131
  }
132
132
 
133
+ /**
134
+ * Since the focused cell/row state is stored as an element reference, the reference may get
135
+ * out of sync when the virtual indexes for elements update due to effective size change.
136
+ * This function updates the reference to the correct element after a possible index change.
137
+ * @private
138
+ */
139
+ __updateItemsFocusable() {
140
+ if (!this._itemsFocusable) {
141
+ return;
142
+ }
143
+
144
+ const wasFocused = this.shadowRoot.activeElement === this._itemsFocusable;
145
+
146
+ this._getVisibleRows().forEach((row) => {
147
+ if (row.index === this._focusedItemIndex) {
148
+ if (this.__rowFocusMode) {
149
+ // Row focus mode
150
+ this._itemsFocusable = row;
151
+ } else if (this._itemsFocusable.parentElement) {
152
+ // Cell focus mode
153
+ const cellIndex = [...this._itemsFocusable.parentElement.children].indexOf(this._itemsFocusable);
154
+ this._itemsFocusable = row.children[cellIndex];
155
+ }
156
+ }
157
+ });
158
+
159
+ if (wasFocused) {
160
+ this._itemsFocusable.focus();
161
+ }
162
+ }
163
+
133
164
  /**
134
165
  * @param {!KeyboardEvent} e
135
166
  * @protected
@@ -359,7 +390,7 @@ export const KeyboardNavigationMixin = (superClass) =>
359
390
 
360
391
  /**
361
392
  * Returns the target row after navigating by the given dy offset.
362
- * Also returns infromation whether the details cell should be the target on the target row.
393
+ * Also returns information whether the details cell should be the target on the target row.
363
394
  * If the row is not in the viewport, it is first scrolled to.
364
395
  * @private
365
396
  **/
@@ -379,11 +410,11 @@ export const KeyboardNavigationMixin = (superClass) =>
379
410
  // in vertical keyboard navigation.
380
411
  if (dstRowIndex > currentRowIndex) {
381
412
  while (dstRowIndex < maxRowIndex && activeRowGroup.children[dstRowIndex].hidden) {
382
- dstRowIndex++;
413
+ dstRowIndex += 1;
383
414
  }
384
415
  } else if (dstRowIndex < currentRowIndex) {
385
416
  while (dstRowIndex > 0 && activeRowGroup.children[dstRowIndex].hidden) {
386
- dstRowIndex--;
417
+ dstRowIndex -= 1;
387
418
  }
388
419
  }
389
420
 
@@ -531,7 +562,11 @@ export const KeyboardNavigationMixin = (superClass) =>
531
562
 
532
563
  if (this.interacting !== wantInteracting && cell !== null) {
533
564
  if (wantInteracting) {
534
- const focusTarget = cell._content.querySelector('[focus-target]') || cell._content.firstElementChild;
565
+ const focusTarget =
566
+ cell._content.querySelector('[focus-target]') ||
567
+ // If a child element hasn't been explicitly marked as a focus target,
568
+ // fall back to any focusable element inside the cell.
569
+ [...cell._content.querySelectorAll('*')].find((node) => this._isFocusable(node));
535
570
  if (focusTarget) {
536
571
  e.preventDefault();
537
572
  focusTarget.focus();
@@ -805,6 +840,8 @@ export const KeyboardNavigationMixin = (superClass) =>
805
840
  delete this._focusedColumnOrder;
806
841
  this._itemsFocusable = this.__rowFocusMode ? firstVisibleRow : firstVisibleCell;
807
842
  }
843
+ } else {
844
+ this.__updateItemsFocusable();
808
845
  }
809
846
  }
810
847
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { Constructor } from '@open-wc/dedupe-mixin';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
 
@@ -83,7 +83,9 @@ export const RowDetailsMixin = (superClass) =>
83
83
  Array.from(this.$.items.children).forEach((row) => {
84
84
  if (!row.querySelector('[part~=details-cell]')) {
85
85
  this._updateRow(row, this._columnTree[this._columnTree.length - 1]);
86
- this._a11yUpdateRowDetailsOpened(row, false);
86
+ const isDetailsOpened = this._isDetailsOpened(row._item);
87
+ this._a11yUpdateRowDetailsOpened(row, isDetailsOpened);
88
+ this._toggleDetailsCell(row, isDetailsOpened);
87
89
  }
88
90
  });
89
91
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { Constructor } from '@open-wc/dedupe-mixin';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { animationFrame, microTask, timeOut } from '@vaadin/component-base/src/async.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { GridDefaultItem } from './vaadin-grid.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import '@vaadin/checkbox/src/vaadin-checkbox.js';
@@ -235,7 +235,7 @@ class GridSelectionColumn extends GridColumn {
235
235
  }
236
236
 
237
237
  /**
238
- * iOS needs indeterminated + checked at the same time
238
+ * iOS needs indeterminate + checked at the same time
239
239
  * @private
240
240
  */
241
241
  __isChecked(selectAll, indeterminate) {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { Constructor } from '@open-wc/dedupe-mixin';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
 
@@ -77,12 +77,8 @@ export const SelectionMixin = (superClass) =>
77
77
  }
78
78
 
79
79
  /** @private */
80
- _selectedItemsChanged(e) {
81
- if (this.$.items.children.length && (e.path === 'selectedItems' || e.path === 'selectedItems.splices')) {
82
- Array.from(this.$.items.children).forEach((row) => {
83
- this._updateItem(row, row._item);
84
- });
85
- }
80
+ _selectedItemsChanged() {
81
+ this.requestContentUpdate();
86
82
  }
87
83
 
88
84
  /**
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { GridDefaultItem } from './vaadin-grid.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import './vaadin-grid-sorter.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { Constructor } from '@open-wc/dedupe-mixin';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { Constructor } from '@open-wc/dedupe-mixin';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { GridDefaultItem } from './vaadin-grid.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import './vaadin-grid-tree-toggle.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { ElementMixinClass } from '@vaadin/component-base/src/element-mixin.js';
@@ -308,7 +308,7 @@ export interface GridEventMap<TItem> extends HTMLElementEventMap, GridCustomEven
308
308
  * `reorder-status` | Reflects the status of a cell while columns are being reordered | cell
309
309
  * `frozen` | Frozen cell | cell
310
310
  * `last-frozen` | Last frozen cell | cell
311
- * * `first-column` | First visible cell on a row | cell
311
+ * `first-column` | First visible cell on a row | cell
312
312
  * `last-column` | Last visible cell on a row | cell
313
313
  * `selected` | Selected row | row
314
314
  * `expanded` | Expanded row | row
@@ -316,6 +316,7 @@ export interface GridEventMap<TItem> extends HTMLElementEventMap, GridCustomEven
316
316
  * `loading` | Row that is waiting for data from data provider | row
317
317
  * `odd` | Odd row | row
318
318
  * `first` | The first body row | row
319
+ * `last` | The last body row | row
319
320
  * `dragstart` | Set for one frame when drag of a row is starting. The value is a number when multiple rows are dragged | row
320
321
  * `dragover` | Set when the row is dragged over | row
321
322
  * `drag-disabled` | Set to a row that isn't available for dragging | row
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import './vaadin-grid-column.js';
@@ -194,7 +194,7 @@ import { StylingMixin } from './vaadin-grid-styling-mixin.js';
194
194
  * `reorder-status` | Reflects the status of a cell while columns are being reordered | cell
195
195
  * `frozen` | Frozen cell | cell
196
196
  * `last-frozen` | Last frozen cell | cell
197
- * * `first-column` | First visible cell on a row | cell
197
+ * `first-column` | First visible cell on a row | cell
198
198
  * `last-column` | Last visible cell on a row | cell
199
199
  * `selected` | Selected row | row
200
200
  * `expanded` | Expanded row | row
@@ -202,6 +202,7 @@ import { StylingMixin } from './vaadin-grid-styling-mixin.js';
202
202
  * `loading` | Row that is waiting for data from data provider | row
203
203
  * `odd` | Odd row | row
204
204
  * `first` | The first body row | row
205
+ * `last` | The last body row | row
205
206
  * `dragstart` | Set for one frame when drag of a row is starting. The value is a number when multiple rows are dragged | row
206
207
  * `dragover` | Set when the row is dragged over | row
207
208
  * `drag-disabled` | Set to a row that isn't available for dragging | row
@@ -279,7 +280,7 @@ class Grid extends ElementMixin(
279
280
  loading$="[[loading]]"
280
281
  column-reordering-allowed$="[[columnReorderingAllowed]]"
281
282
  >
282
- <table id="table" role="grid" aria-multiselectable="true" tabindex="0">
283
+ <table id="table" role="treegrid" aria-multiselectable="true" tabindex="0">
283
284
  <caption id="sizer" part="row"></caption>
284
285
  <thead id="header" role="rowgroup"></thead>
285
286
  <tbody id="items" role="rowgroup"></tbody>
@@ -489,6 +490,7 @@ class Grid extends ElementMixin(
489
490
  const cellCoordinates = this.__getBodyCellCoordinates(cell);
490
491
 
491
492
  virtualizer.size = effectiveSize;
493
+ virtualizer.update();
492
494
  virtualizer.flush();
493
495
 
494
496
  // If the focused cell's parent row got hidden by the size change, focus the corresponding new cell
@@ -582,6 +584,9 @@ class Grid extends ElementMixin(
582
584
  * @private
583
585
  */
584
586
  _recalculateColumnWidths(cols) {
587
+ // Flush to make sure DOM is up-to-date when measuring the column widths
588
+ this.__virtualizer.flush();
589
+
585
590
  cols.forEach((col) => {
586
591
  col.width = `${this.__getDistributedWidth(col)}px`;
587
592
  });
@@ -821,6 +826,7 @@ class Grid extends ElementMixin(
821
826
  }
822
827
 
823
828
  row.toggleAttribute('first', index === 0);
829
+ row.toggleAttribute('last', index === this._effectiveSize - 1);
824
830
  row.toggleAttribute('odd', index % 2);
825
831
  this._a11yUpdateRowRowindex(row, index);
826
832
  this._getItem(index, row);
@@ -133,6 +133,10 @@ registerStyles(
133
133
  margin-top: -1px;
134
134
  }
135
135
 
136
+ :host([all-rows-visible]) [part~='row'][last][dragover='below'] [part~='cell']::after {
137
+ height: 1px;
138
+ }
139
+
136
140
  [part~='row'][dragover='above'] [part~='cell']::after {
137
141
  top: auto;
138
142
  bottom: 100%;
@@ -183,6 +183,10 @@ registerStyles(
183
183
  margin-top: -1px;
184
184
  }
185
185
 
186
+ :host([all-rows-visible]) [part~='row'][last][dragover='below'] [part~='cell']::after {
187
+ height: 1px;
188
+ }
189
+
186
190
  [part~='row'][dragover='above'] [part~='cell']::after {
187
191
  top: auto;
188
192
  bottom: 100%;
@@ -200,8 +204,6 @@ registerStyles(
200
204
  }
201
205
 
202
206
  [part~='row'][dragstart] {
203
- /* Add bottom-space to the row so the drag number doesn't get clipped. Needed for IE/Edge */
204
- border-bottom: 100px solid transparent;
205
207
  z-index: 100 !important;
206
208
  opacity: 0.9;
207
209
  }