@vaadin/grid 24.4.0-dev.223e39f050 → 24.4.0-dev.4b20a0c55.3

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 (98) hide show
  1. package/README.md +0 -1
  2. package/package.json +10 -10
  3. package/src/all-imports.js +1 -1
  4. package/src/lit/column-renderer-directives.d.ts +1 -1
  5. package/src/lit/column-renderer-directives.js +1 -1
  6. package/src/lit/renderer-directives.d.ts +1 -1
  7. package/src/lit/renderer-directives.js +1 -1
  8. package/src/lit-all-imports.js +1 -1
  9. package/src/vaadin-grid-a11y-mixin.js +1 -1
  10. package/src/vaadin-grid-active-item-mixin.d.ts +1 -1
  11. package/src/vaadin-grid-active-item-mixin.js +1 -1
  12. package/src/vaadin-grid-array-data-provider-mixin.d.ts +1 -1
  13. package/src/vaadin-grid-array-data-provider-mixin.js +1 -1
  14. package/src/vaadin-grid-column-group-mixin.d.ts +1 -1
  15. package/src/vaadin-grid-column-group-mixin.js +1 -1
  16. package/src/vaadin-grid-column-group.d.ts +1 -1
  17. package/src/vaadin-grid-column-group.js +1 -1
  18. package/src/vaadin-grid-column-mixin.d.ts +1 -1
  19. package/src/vaadin-grid-column-mixin.js +9 -5
  20. package/src/vaadin-grid-column-reordering-mixin.d.ts +1 -1
  21. package/src/vaadin-grid-column-reordering-mixin.js +1 -1
  22. package/src/vaadin-grid-column-resizing-mixin.js +1 -1
  23. package/src/vaadin-grid-column.d.ts +1 -1
  24. package/src/vaadin-grid-column.js +1 -1
  25. package/src/vaadin-grid-data-provider-mixin.d.ts +1 -1
  26. package/src/vaadin-grid-data-provider-mixin.js +2 -6
  27. package/src/vaadin-grid-drag-and-drop-mixin.d.ts +1 -1
  28. package/src/vaadin-grid-drag-and-drop-mixin.js +1 -1
  29. package/src/vaadin-grid-dynamic-columns-mixin.js +1 -1
  30. package/src/vaadin-grid-event-context-mixin.d.ts +1 -1
  31. package/src/vaadin-grid-event-context-mixin.js +1 -1
  32. package/src/vaadin-grid-filter-column-mixin.d.ts +1 -1
  33. package/src/vaadin-grid-filter-column-mixin.js +1 -1
  34. package/src/vaadin-grid-filter-column.d.ts +1 -1
  35. package/src/vaadin-grid-filter-column.js +1 -1
  36. package/src/vaadin-grid-filter-element-mixin.d.ts +1 -1
  37. package/src/vaadin-grid-filter-element-mixin.js +1 -1
  38. package/src/vaadin-grid-filter-mixin.js +1 -1
  39. package/src/vaadin-grid-filter.d.ts +1 -1
  40. package/src/vaadin-grid-filter.js +1 -1
  41. package/src/vaadin-grid-helpers.js +1 -1
  42. package/src/vaadin-grid-keyboard-navigation-mixin.js +17 -7
  43. package/src/vaadin-grid-mixin.d.ts +1 -1
  44. package/src/vaadin-grid-mixin.js +46 -16
  45. package/src/vaadin-grid-row-details-mixin.d.ts +1 -1
  46. package/src/vaadin-grid-row-details-mixin.js +1 -1
  47. package/src/vaadin-grid-scroll-mixin.d.ts +3 -1
  48. package/src/vaadin-grid-scroll-mixin.js +14 -1
  49. package/src/vaadin-grid-selection-column-base-mixin.d.ts +1 -1
  50. package/src/vaadin-grid-selection-column-base-mixin.js +19 -1
  51. package/src/vaadin-grid-selection-column-mixin.d.ts +1 -1
  52. package/src/vaadin-grid-selection-column-mixin.js +1 -1
  53. package/src/vaadin-grid-selection-column.d.ts +1 -1
  54. package/src/vaadin-grid-selection-column.js +1 -1
  55. package/src/vaadin-grid-selection-mixin.d.ts +1 -1
  56. package/src/vaadin-grid-selection-mixin.js +1 -1
  57. package/src/vaadin-grid-sort-column-mixin.d.ts +1 -1
  58. package/src/vaadin-grid-sort-column-mixin.js +1 -1
  59. package/src/vaadin-grid-sort-column.d.ts +1 -1
  60. package/src/vaadin-grid-sort-column.js +1 -1
  61. package/src/vaadin-grid-sort-mixin.d.ts +1 -1
  62. package/src/vaadin-grid-sort-mixin.js +1 -1
  63. package/src/vaadin-grid-sorter-mixin.d.ts +1 -1
  64. package/src/vaadin-grid-sorter-mixin.js +1 -1
  65. package/src/vaadin-grid-sorter.d.ts +1 -1
  66. package/src/vaadin-grid-sorter.js +1 -1
  67. package/src/vaadin-grid-styles.js +7 -1
  68. package/src/vaadin-grid-styling-mixin.d.ts +1 -1
  69. package/src/vaadin-grid-styling-mixin.js +1 -1
  70. package/src/vaadin-grid-tree-column-mixin.d.ts +1 -1
  71. package/src/vaadin-grid-tree-column-mixin.js +1 -1
  72. package/src/vaadin-grid-tree-column.d.ts +1 -1
  73. package/src/vaadin-grid-tree-column.js +1 -1
  74. package/src/vaadin-grid-tree-toggle-mixin.d.ts +1 -1
  75. package/src/vaadin-grid-tree-toggle-mixin.js +3 -5
  76. package/src/vaadin-grid-tree-toggle.d.ts +1 -1
  77. package/src/vaadin-grid-tree-toggle.js +1 -1
  78. package/src/vaadin-grid.d.ts +1 -1
  79. package/src/vaadin-grid.js +1 -1
  80. package/src/vaadin-lit-grid-column-group.js +2 -2
  81. package/src/vaadin-lit-grid-column.js +2 -2
  82. package/src/vaadin-lit-grid-filter-column.js +2 -2
  83. package/src/vaadin-lit-grid-filter.js +2 -2
  84. package/src/vaadin-lit-grid-selection-column.js +2 -2
  85. package/src/vaadin-lit-grid-sort-column.js +2 -2
  86. package/src/vaadin-lit-grid-sorter.js +2 -2
  87. package/src/vaadin-lit-grid-tree-column.js +2 -2
  88. package/src/vaadin-lit-grid-tree-toggle.js +2 -2
  89. package/src/vaadin-lit-grid.js +2 -2
  90. package/theme/lumo/vaadin-grid-styles.js +0 -1
  91. package/theme/lumo/vaadin-lit-grid-filter.js +1 -2
  92. package/theme/lumo/vaadin-lit-grid-selection-column.js +1 -1
  93. package/theme/material/vaadin-lit-grid-filter.js +1 -2
  94. package/theme/material/vaadin-lit-grid-selection-column.js +1 -1
  95. package/vaadin-grid.d.ts +0 -1
  96. package/vaadin-grid.js +0 -1
  97. package/vaadin-lit-grid.d.ts +0 -1
  98. package/vaadin-lit-grid.js +0 -1
package/README.md CHANGED
@@ -5,7 +5,6 @@ A web component for showing tabular data.
5
5
  [Documentation + Live Demo ↗](https://vaadin.com/docs/latest/components/grid)
6
6
 
7
7
  [![npm version](https://badgen.net/npm/v/@vaadin/grid)](https://www.npmjs.com/package/@vaadin/grid)
8
- [![Discord](https://img.shields.io/discord/732335336448852018?label=discord)](https://discord.gg/PHmkCKC)
9
8
 
10
9
  ```html
11
10
  <vaadin-grid theme="row-dividers" column-reordering-allowed multi-sort>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/grid",
3
- "version": "24.4.0-dev.223e39f050",
3
+ "version": "24.4.0-dev.4b20a0c55.3",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -46,14 +46,14 @@
46
46
  "dependencies": {
47
47
  "@open-wc/dedupe-mixin": "^1.3.0",
48
48
  "@polymer/polymer": "^3.0.0",
49
- "@vaadin/a11y-base": "24.4.0-dev.223e39f050",
50
- "@vaadin/checkbox": "24.4.0-dev.223e39f050",
51
- "@vaadin/component-base": "24.4.0-dev.223e39f050",
52
- "@vaadin/lit-renderer": "24.4.0-dev.223e39f050",
53
- "@vaadin/text-field": "24.4.0-dev.223e39f050",
54
- "@vaadin/vaadin-lumo-styles": "24.4.0-dev.223e39f050",
55
- "@vaadin/vaadin-material-styles": "24.4.0-dev.223e39f050",
56
- "@vaadin/vaadin-themable-mixin": "24.4.0-dev.223e39f050",
49
+ "@vaadin/a11y-base": "24.4.0-dev.4b20a0c55.3",
50
+ "@vaadin/checkbox": "24.4.0-dev.4b20a0c55.3",
51
+ "@vaadin/component-base": "24.4.0-dev.4b20a0c55.3",
52
+ "@vaadin/lit-renderer": "24.4.0-dev.4b20a0c55.3",
53
+ "@vaadin/text-field": "24.4.0-dev.4b20a0c55.3",
54
+ "@vaadin/vaadin-lumo-styles": "24.4.0-dev.4b20a0c55.3",
55
+ "@vaadin/vaadin-material-styles": "24.4.0-dev.4b20a0c55.3",
56
+ "@vaadin/vaadin-themable-mixin": "24.4.0-dev.4b20a0c55.3",
57
57
  "lit": "^3.0.0"
58
58
  },
59
59
  "devDependencies": {
@@ -65,5 +65,5 @@
65
65
  "web-types.json",
66
66
  "web-types.lit.json"
67
67
  ],
68
- "gitHead": "5e2e3bfc811c95aed9354235fab93fdbf43eb354"
68
+ "gitHead": "41cf17453d7506fb635c088a0425e20b6e82b89b"
69
69
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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) 2017 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2017 - 2024 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  /* eslint-disable max-classes-per-file */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2017 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2017 - 2024 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  /* eslint-disable max-classes-per-file */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2017 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2017 - 2024 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 type { DirectiveResult } from 'lit/directive';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2017 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2017 - 2024 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 { directive } from 'lit/directive.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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-lit-grid.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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 { iterateChildren, iterateRowCells } from './vaadin-grid-helpers.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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 type { Constructor } from '@open-wc/dedupe-mixin';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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 type { Constructor } from '@open-wc/dedupe-mixin';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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 type { ColumnBaseMixinClass } from './vaadin-grid-column.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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 } from '@vaadin/component-base/src/async.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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 type { GridDefaultItem } from './vaadin-grid.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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 type { Constructor } from '@open-wc/dedupe-mixin';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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 } from '@vaadin/component-base/src/async.js';
@@ -598,8 +598,14 @@ export const ColumnBaseMixin = (superClass) =>
598
598
 
599
599
  /** @protected */
600
600
  _runRenderer(renderer, cell, model) {
601
+ const isVisibleBodyCell = model && model.item && !cell.parentElement.hidden;
602
+ const shouldRender = isVisibleBodyCell || renderer === this._headerRenderer || renderer === this._footerRenderer;
603
+ if (!shouldRender) {
604
+ return;
605
+ }
606
+
601
607
  const args = [cell._content, this];
602
- if (model && model.item) {
608
+ if (isVisibleBodyCell) {
603
609
  args.push(model);
604
610
  }
605
611
 
@@ -634,9 +640,7 @@ export const ColumnBaseMixin = (superClass) =>
634
640
 
635
641
  cell._renderer = renderer;
636
642
 
637
- if (model.item || renderer === this._headerRenderer || renderer === this._footerRenderer) {
638
- this._runRenderer(renderer, cell, model);
639
- }
643
+ this._runRenderer(renderer, cell, model);
640
644
  });
641
645
  }
642
646
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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 type { Constructor } from '@open-wc/dedupe-mixin';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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 { isTouch } from '@vaadin/component-base/src/browser-utils.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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 type { Constructor } from '@open-wc/dedupe-mixin';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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 { microTask, timeOut } from '@vaadin/component-base/src/async.js';
@@ -206,10 +206,6 @@ export const DataProviderMixin = (superClass) =>
206
206
  * @protected
207
207
  */
208
208
  _getItem(index, el) {
209
- if (index >= this._flatSize) {
210
- return;
211
- }
212
-
213
209
  el.index = index;
214
210
 
215
211
  const { item } = this._dataProviderController.getFlatIndexContext(index);
@@ -374,7 +370,7 @@ export const DataProviderMixin = (superClass) =>
374
370
  this._hasData = false;
375
371
  this.__updateVisibleRows();
376
372
 
377
- if (!this.__virtualizer.size) {
373
+ if (!this.__virtualizer || !this.__virtualizer.size) {
378
374
  this._dataProviderController.loadFirstPage();
379
375
  }
380
376
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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 type { Constructor } from '@open-wc/dedupe-mixin';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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 {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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 { microTask, timeOut } from '@vaadin/component-base/src/async.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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 type { Constructor } from '@open-wc/dedupe-mixin';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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 type { Constructor } from '@open-wc/dedupe-mixin';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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 type { GridDefaultItem } from './vaadin-grid.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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 type { Constructor } from '@open-wc/dedupe-mixin';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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 { microTask } from '@vaadin/component-base/src/async.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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 { isKeyboardActive } from '@vaadin/a11y-base/src/focus-utils.js';
@@ -109,6 +109,11 @@ export const KeyboardNavigationMixin = (superClass) =>
109
109
  });
110
110
  }
111
111
 
112
+ /** @private */
113
+ get _visibleItemsCount() {
114
+ return this._lastVisibleIndex - this._firstVisibleIndex - 1;
115
+ }
116
+
112
117
  /** @protected */
113
118
  ready() {
114
119
  super.ready();
@@ -304,8 +309,9 @@ export const KeyboardNavigationMixin = (superClass) =>
304
309
  _onNavigationKeyDown(e, key) {
305
310
  e.preventDefault();
306
311
 
307
- const visibleItemsCount = this._lastVisibleIndex - this._firstVisibleIndex - 1;
308
312
  const isRTL = this.__isRTL;
313
+ const activeRow = e.composedPath().find((el) => this.__isRow(el));
314
+ const activeCell = e.composedPath().find((el) => this.__isCell(el));
309
315
 
310
316
  // Handle keyboard interaction as defined in:
311
317
  // https://w3c.github.io/aria-practices/#keyboard-interaction-24
@@ -350,18 +356,22 @@ export const KeyboardNavigationMixin = (superClass) =>
350
356
  dy = -1;
351
357
  break;
352
358
  case 'PageDown':
353
- dy = visibleItemsCount;
359
+ // Check if the active group is body
360
+ if (this.$.items.contains(activeRow)) {
361
+ const currentRowIndex = this.__getIndexInGroup(activeRow, this._focusedItemIndex);
362
+ // Scroll the current row to the top...
363
+ this._scrollToFlatIndex(currentRowIndex);
364
+ }
365
+ // ...only then measure the visible items count
366
+ dy = this._visibleItemsCount;
354
367
  break;
355
368
  case 'PageUp':
356
- dy = -visibleItemsCount;
369
+ dy = -this._visibleItemsCount;
357
370
  break;
358
371
  default:
359
372
  break;
360
373
  }
361
374
 
362
- const activeRow = e.composedPath().find((el) => this.__isRow(el));
363
- const activeCell = e.composedPath().find((el) => this.__isCell(el));
364
-
365
375
  if ((this.__rowFocusMode && !activeRow) || (!this.__rowFocusMode && !activeCell)) {
366
376
  // When using a screen reader, it's possible that neither a cell nor a row is focused.
367
377
  return;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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 type { Constructor } from '@open-wc/dedupe-mixin';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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 { isElementHidden } from '@vaadin/a11y-base/src/focus-utils.js';
@@ -316,11 +316,6 @@ export const GridMixin = (superClass) =>
316
316
  }
317
317
  }
318
318
 
319
- /** @private */
320
- __hasRowsWithClientHeight() {
321
- return !!Array.from(this.$.items.children).filter((row) => row.clientHeight).length;
322
- }
323
-
324
319
  /** @private */
325
320
  __getIntrinsicWidth(col) {
326
321
  if (!this.__intrinsicWidthCache.has(col)) {
@@ -432,6 +427,12 @@ export const GridMixin = (superClass) =>
432
427
  cell.style.position = '';
433
428
  }
434
429
  });
430
+
431
+ if (autoWidth) {
432
+ this.$.scroller.setAttribute('measuring-auto-width', '');
433
+ } else {
434
+ this.$.scroller.removeAttribute('measuring-auto-width');
435
+ }
435
436
  }
436
437
 
437
438
  /**
@@ -478,17 +479,40 @@ export const GridMixin = (superClass) =>
478
479
  return;
479
480
  }
480
481
  const cols = this._getColumns().filter((col) => !col.hidden && col.autoWidth);
481
- this._recalculateColumnWidths(cols);
482
+
483
+ const undefinedCols = cols.filter((col) => !customElements.get(col.localName));
484
+ if (undefinedCols.length) {
485
+ // Some of the columns are not defined yet, wait for them to be defined before measuring
486
+ Promise.all(undefinedCols.map((col) => customElements.whenDefined(col.localName))).then(() => {
487
+ this._recalculateColumnWidths(cols);
488
+ });
489
+ } else {
490
+ this._recalculateColumnWidths(cols);
491
+ }
482
492
  }
483
493
 
484
494
  /** @private */
485
495
  __tryToRecalculateColumnWidthsIfPending() {
486
- if (
487
- this.__pendingRecalculateColumnWidths &&
488
- !isElementHidden(this) &&
489
- !this._dataProviderController.isLoading() &&
490
- this.__hasRowsWithClientHeight()
491
- ) {
496
+ if (!this.__pendingRecalculateColumnWidths || isElementHidden(this) || this._dataProviderController.isLoading()) {
497
+ return;
498
+ }
499
+
500
+ // Delay recalculation if any rows are missing an index.
501
+ // This can happen during the grid's initialization if the recalculation is triggered
502
+ // as a result of the data provider responding synchronously to a page request created
503
+ // in the middle of the virtualizer update loop. In this case, rows after the one that
504
+ // triggered the page request may not have an index property yet. The lack of index
505
+ // prevents _onDataProviderPageReceived from requesting children for these rows,
506
+ // resulting in loading state being set to false and the recalculation beginning
507
+ // before all the data is loaded. Note, rows without index get updated in later iterations
508
+ // of the virtualizer update loop, ensuring the grid eventually reaches a stable state.
509
+ const hasRowsWithUndefinedIndex = [...this.$.items.children].some((row) => row.index === undefined);
510
+ if (hasRowsWithUndefinedIndex) {
511
+ return;
512
+ }
513
+
514
+ const hasRowsWithClientHeight = [...this.$.items.children].some((row) => row.clientHeight > 0);
515
+ if (hasRowsWithClientHeight) {
492
516
  this.__pendingRecalculateColumnWidths = false;
493
517
  this.recalculateColumnWidths();
494
518
  }
@@ -565,6 +589,10 @@ export const GridMixin = (superClass) =>
565
589
  });
566
590
  }
567
591
 
592
+ if (column && column._onCellKeyDown) {
593
+ cell.addEventListener('keydown', column._onCellKeyDown.bind(column));
594
+ }
595
+
568
596
  const slot = document.createElement('slot');
569
597
  slot.setAttribute('name', slotName);
570
598
 
@@ -659,11 +687,13 @@ export const GridMixin = (superClass) =>
659
687
  cell.__parentRow = row;
660
688
  // Cache the cell reference
661
689
  row.__cells.push(cell);
662
- if (!column._bodyContentHidden) {
690
+
691
+ const isSizerRow = row === this.$.sizer;
692
+ if (!column._bodyContentHidden || isSizerRow) {
663
693
  row.appendChild(cell);
664
694
  }
665
695
 
666
- if (row === this.$.sizer) {
696
+ if (isSizerRow) {
667
697
  column._sizerCell = cell;
668
698
  }
669
699
 
@@ -694,7 +724,7 @@ export const GridMixin = (superClass) =>
694
724
  // Header & footer
695
725
  const tagName = section === 'header' ? 'th' : 'td';
696
726
  if (isColumnRow || column.localName === 'vaadin-grid-column-group') {
697
- cell = column[`_${section}Cell`] || this._createCell(tagName);
727
+ cell = column[`_${section}Cell`] || this._createCell(tagName, column);
698
728
  cell._column = column;
699
729
  row.appendChild(cell);
700
730
  column[`_${section}Cell`] = cell;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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 type { Constructor } from '@open-wc/dedupe-mixin';