@vaadin/grid 24.0.0-alpha7 → 24.0.0-alpha8

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 (60) hide show
  1. package/package.json +10 -10
  2. package/src/all-imports.js +1 -1
  3. package/src/array-data-provider.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/vaadin-grid-a11y-mixin.js +1 -1
  9. package/src/vaadin-grid-active-item-mixin.d.ts +1 -1
  10. package/src/vaadin-grid-active-item-mixin.js +1 -1
  11. package/src/vaadin-grid-array-data-provider-mixin.d.ts +1 -1
  12. package/src/vaadin-grid-array-data-provider-mixin.js +1 -1
  13. package/src/vaadin-grid-column-group.d.ts +1 -1
  14. package/src/vaadin-grid-column-group.js +17 -17
  15. package/src/vaadin-grid-column-reordering-mixin.d.ts +1 -1
  16. package/src/vaadin-grid-column-reordering-mixin.js +3 -5
  17. package/src/vaadin-grid-column-resizing-mixin.js +1 -1
  18. package/src/vaadin-grid-column.d.ts +1 -1
  19. package/src/vaadin-grid-column.js +5 -5
  20. package/src/vaadin-grid-data-provider-mixin.d.ts +1 -1
  21. package/src/vaadin-grid-data-provider-mixin.js +1 -1
  22. package/src/vaadin-grid-drag-and-drop-mixin.d.ts +1 -1
  23. package/src/vaadin-grid-drag-and-drop-mixin.js +2 -2
  24. package/src/vaadin-grid-dynamic-columns-mixin.js +2 -2
  25. package/src/vaadin-grid-event-context-mixin.d.ts +1 -1
  26. package/src/vaadin-grid-event-context-mixin.js +1 -1
  27. package/src/vaadin-grid-filter-column.d.ts +1 -1
  28. package/src/vaadin-grid-filter-column.js +1 -1
  29. package/src/vaadin-grid-filter-mixin.js +1 -1
  30. package/src/vaadin-grid-filter.d.ts +1 -1
  31. package/src/vaadin-grid-filter.js +1 -1
  32. package/src/vaadin-grid-helpers.js +1 -1
  33. package/src/vaadin-grid-keyboard-navigation-mixin.js +3 -3
  34. package/src/vaadin-grid-row-details-mixin.d.ts +1 -1
  35. package/src/vaadin-grid-row-details-mixin.js +1 -1
  36. package/src/vaadin-grid-scroll-mixin.d.ts +1 -1
  37. package/src/vaadin-grid-scroll-mixin.js +5 -4
  38. package/src/vaadin-grid-selection-column.d.ts +1 -1
  39. package/src/vaadin-grid-selection-column.js +1 -1
  40. package/src/vaadin-grid-selection-mixin.d.ts +1 -1
  41. package/src/vaadin-grid-selection-mixin.js +1 -1
  42. package/src/vaadin-grid-sort-column.d.ts +1 -1
  43. package/src/vaadin-grid-sort-column.js +1 -1
  44. package/src/vaadin-grid-sort-mixin.d.ts +1 -1
  45. package/src/vaadin-grid-sort-mixin.js +1 -1
  46. package/src/vaadin-grid-sorter.d.ts +1 -1
  47. package/src/vaadin-grid-sorter.js +1 -1
  48. package/src/vaadin-grid-styles.js +1 -1
  49. package/src/vaadin-grid-styling-mixin.d.ts +1 -1
  50. package/src/vaadin-grid-styling-mixin.js +1 -1
  51. package/src/vaadin-grid-tree-column.d.ts +1 -1
  52. package/src/vaadin-grid-tree-column.js +1 -1
  53. package/src/vaadin-grid-tree-toggle.d.ts +1 -1
  54. package/src/vaadin-grid-tree-toggle.js +1 -1
  55. package/src/vaadin-grid.d.ts +1 -1
  56. package/src/vaadin-grid.js +22 -13
  57. package/theme/lumo/vaadin-grid-styles.js +5 -5
  58. package/theme/material/vaadin-grid-styles.js +1 -1
  59. package/web-types.json +576 -3
  60. package/web-types.lit.json +318 -3
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2022 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2023 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) 2016 - 2022 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2023 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) 2016 - 2022 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2023 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 - 2022 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2023 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, updatePart } from './vaadin-grid-helpers.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2022 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2023 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 - 2022 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2023 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) 2016 - 2022 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2023 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) 2016 - 2022 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2023 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) 2016 - 2022 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2023 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 { DisabledMixinClass } from '@vaadin/component-base/src/disabled-mixin.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2022 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2023 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';
@@ -539,9 +539,15 @@ class Grid extends ElementMixin(
539
539
  const cell = this.shadowRoot.activeElement;
540
540
  const cellCoordinates = this.__getBodyCellCoordinates(cell);
541
541
 
542
+ const previousSize = virtualizer.size || 0;
542
543
  virtualizer.size = effectiveSize;
543
- virtualizer.update();
544
- virtualizer.flush();
544
+
545
+ // Request an update for the previous last row to have the "last" state removed
546
+ virtualizer.update(previousSize - 1, previousSize - 1);
547
+ if (effectiveSize < previousSize) {
548
+ // Size was decreased, so the new last row requires an explicit update
549
+ virtualizer.update(effectiveSize - 1, effectiveSize - 1);
550
+ }
545
551
 
546
552
  // If the focused cell's parent row got hidden by the size change, focus the corresponding new cell
547
553
  if (cellCoordinates && cell.parentElement.hidden) {
@@ -803,10 +809,7 @@ class Grid extends ElementMixin(
803
809
  * @param {boolean} noNotify
804
810
  * @protected
805
811
  */
806
- // eslint-disable-next-line max-params
807
- _updateRow(row, columns, section, isColumnRow, noNotify) {
808
- section ||= 'body';
809
-
812
+ _updateRow(row, columns, section = 'body', isColumnRow = false, noNotify = false) {
810
813
  const contentsFragment = document.createDocumentFragment();
811
814
 
812
815
  iterateChildren(row, (cell) => {
@@ -821,7 +824,9 @@ class Grid extends ElementMixin(
821
824
 
822
825
  if (section === 'body') {
823
826
  // Body
824
- column._cells ||= [];
827
+ if (!column._cells) {
828
+ column._cells = [];
829
+ }
825
830
  cell = column._cells.find((cell) => cell._vacant);
826
831
  if (!cell) {
827
832
  cell = this._createCell('td', column);
@@ -832,7 +837,9 @@ class Grid extends ElementMixin(
832
837
 
833
838
  if (index === cols.length - 1 && this.rowDetailsRenderer) {
834
839
  // Add details cell as last cell to body rows
835
- this._detailsCells ||= [];
840
+ if (!this._detailsCells) {
841
+ this._detailsCells = [];
842
+ }
836
843
  const detailsCell = this._detailsCells.find((cell) => cell._vacant) || this._createCell('td');
837
844
  if (this._detailsCells.indexOf(detailsCell) === -1) {
838
845
  this._detailsCells.push(detailsCell);
@@ -858,7 +865,9 @@ class Grid extends ElementMixin(
858
865
  row.appendChild(cell);
859
866
  column[`_${section}Cell`] = cell;
860
867
  } else {
861
- column._emptyCells ||= [];
868
+ if (!column._emptyCells) {
869
+ column._emptyCells = [];
870
+ }
862
871
  cell = column._emptyCells.find((cell) => cell._vacant) || this._createCell(tagName);
863
872
  cell._column = column;
864
873
  row.appendChild(cell);
@@ -970,7 +979,7 @@ class Grid extends ElementMixin(
970
979
  updateRowStates(row, {
971
980
  first: index === 0,
972
981
  last: index === this._effectiveSize - 1,
973
- odd: index % 2,
982
+ odd: index % 2 !== 0,
974
983
  even: index % 2 === 0,
975
984
  });
976
985
  }
@@ -990,7 +999,7 @@ class Grid extends ElementMixin(
990
999
  */
991
1000
  _renderColumnTree(columnTree) {
992
1001
  iterateChildren(this.$.items, (row) => {
993
- this._updateRow(row, columnTree[columnTree.length - 1], null, false, true);
1002
+ this._updateRow(row, columnTree[columnTree.length - 1], 'body', false, true);
994
1003
 
995
1004
  const model = this.__getRowModel(row);
996
1005
  this._updateRowOrderParts(row);
@@ -1049,7 +1058,7 @@ class Grid extends ElementMixin(
1049
1058
  /** @private */
1050
1059
  __updateFooterPositioning() {
1051
1060
  // TODO: fixed in Firefox 99, remove when we can drop Firefox ESR 91 support
1052
- if (this._firefox && parseFloat(navigator.userAgent.match(/Firefox\/(\d{2,3}.\d)/)[1]) < 99) {
1061
+ if (this._firefox && parseFloat(navigator.userAgent.match(/Firefox\/(\d{2,3}.\d)/u)[1]) < 99) {
1053
1062
  // Sticky (or translated) footer in a flexbox host doesn't get included in
1054
1063
  // the scroll height calculation on FF. This is a workaround for the issue.
1055
1064
  this.$.items.style.paddingBottom = 0;
@@ -57,7 +57,7 @@ registerStyles(
57
57
  }
58
58
 
59
59
  /* Hide first body row top border */
60
- :host(:not([theme~='no-row-borders'])) [part~='row'][first] [part~='cell']:not([part~='details-cell']) {
60
+ :host(:not([theme~='no-row-borders'])) [part~='first-row'] [part~='cell']:not([part~='details-cell']) {
61
61
  border-top: 0;
62
62
  min-height: calc(var(--lumo-size-m) - var(--_lumo-grid-border-width));
63
63
  }
@@ -137,7 +137,7 @@ registerStyles(
137
137
  margin-top: -1px;
138
138
  }
139
139
 
140
- :host([all-rows-visible]) [part~='row'][last][dragover='below'] [part~='cell']::after {
140
+ :host([all-rows-visible]) [part~='last-row'][dragover='below'] [part~='cell']::after {
141
141
  height: 1px;
142
142
  }
143
143
 
@@ -309,8 +309,8 @@ registerStyles(
309
309
 
310
310
  /* Row stripes */
311
311
 
312
- :host([theme~='row-stripes']) [part~='row']:not([odd]) [part~='body-cell'],
313
- :host([theme~='row-stripes']) [part~='row']:not([odd]) [part~='details-cell'] {
312
+ :host([theme~='row-stripes']) [part~='even-row'] [part~='body-cell'],
313
+ :host([theme~='row-stripes']) [part~='even-row'] [part~='details-cell'] {
314
314
  background-image: linear-gradient(var(--lumo-contrast-5pct), var(--lumo-contrast-5pct));
315
315
  background-repeat: repeat-x;
316
316
  }
@@ -342,7 +342,7 @@ registerStyles(
342
342
  min-height: var(--lumo-size-s);
343
343
  }
344
344
 
345
- :host([theme~='compact']) [part~='row'][first] [part~='cell']:not([part~='details-cell']) {
345
+ :host([theme~='compact']) [part~='first-row'] [part~='cell']:not([part~='details-cell']) {
346
346
  min-height: calc(var(--lumo-size-s) - var(--_lumo-grid-border-width));
347
347
  }
348
348
 
@@ -191,7 +191,7 @@ registerStyles(
191
191
  margin-top: -1px;
192
192
  }
193
193
 
194
- :host([all-rows-visible]) [part~='row'][last][dragover='below'] [part~='cell']::after {
194
+ :host([all-rows-visible]) [part~='last-row'][dragover='below'] [part~='cell']::after {
195
195
  height: 1px;
196
196
  }
197
197