@vaadin/grid 25.0.0-beta4 → 25.0.0-beta5

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.
@@ -73,7 +73,7 @@ export const ActiveItemMixin = (superClass) =>
73
73
  // No clicked cell available
74
74
  !cell ||
75
75
  // Cell is a details cell
76
- cell.getAttribute('part').includes('details-cell') ||
76
+ cell.part.contains('details-cell') ||
77
77
  // Cell is the empty state cell
78
78
  cell === this.$.emptystatecell ||
79
79
  // Cell content is focused
@@ -7,7 +7,7 @@ import { animationFrame } from '@vaadin/component-base/src/async.js';
7
7
  import { Debouncer } from '@vaadin/component-base/src/debounce.js';
8
8
  import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
9
9
  import { get } from '@vaadin/component-base/src/path-utils.js';
10
- import { updateCellState } from './vaadin-grid-helpers.js';
10
+ import { updateCellState, updatePart } from './vaadin-grid-helpers.js';
11
11
 
12
12
  /**
13
13
  * @polymerMixin
@@ -518,7 +518,7 @@ export const ColumnBaseMixin = (superClass) =>
518
518
 
519
519
  if (resizable) {
520
520
  const handle = document.createElement('div');
521
- handle.setAttribute('part', 'resize-handle');
521
+ updatePart(handle, 'resize-handle', true);
522
522
  cell.appendChild(handle);
523
523
  }
524
524
  }
@@ -134,7 +134,7 @@ export const ColumnReorderingMixin = (superClass) =>
134
134
  }
135
135
 
136
136
  const headerCell = this._cellFromPoint(e.detail.x, e.detail.y);
137
- if (!headerCell || !headerCell.getAttribute('part').includes('header-cell')) {
137
+ if (!headerCell || !headerCell.part.contains('header-cell')) {
138
138
  return;
139
139
  }
140
140
 
@@ -20,22 +20,16 @@ export const ColumnResizingMixin = (superClass) =>
20
20
  scroller.addEventListener('touchmove', (e) => scroller.hasAttribute('column-resizing') && e.preventDefault());
21
21
 
22
22
  // Disable contextmenu on any resize separator.
23
- scroller.addEventListener(
24
- 'contextmenu',
25
- (e) => e.target.getAttribute('part') === 'resize-handle' && e.preventDefault(),
26
- );
23
+ scroller.addEventListener('contextmenu', (e) => e.target.part.contains('resize-handle') && e.preventDefault());
27
24
 
28
25
  // Disable native cell focus when resizing
29
- scroller.addEventListener(
30
- 'mousedown',
31
- (e) => e.target.getAttribute('part') === 'resize-handle' && e.preventDefault(),
32
- );
26
+ scroller.addEventListener('mousedown', (e) => e.target.part.contains('resize-handle') && e.preventDefault());
33
27
  }
34
28
 
35
29
  /** @private */
36
30
  _onHeaderTrack(e) {
37
31
  const handle = e.target;
38
- if (handle.getAttribute('part') === 'resize-handle') {
32
+ if (handle.part.contains('resize-handle')) {
39
33
  const cell = handle.parentElement;
40
34
  let column = cell._column;
41
35
 
@@ -447,7 +447,7 @@ export const DragAndDropMixin = (superClass) =>
447
447
  return rows
448
448
  .map((row) => {
449
449
  return Array.from(row.children)
450
- .filter((cell) => !cell.hidden && cell.getAttribute('part').indexOf('details-cell') === -1)
450
+ .filter((cell) => !cell.hidden && !cell.part.contains('details-cell'))
451
451
  .sort((a, b) => {
452
452
  return a._column._order > b._column._order ? 1 : -1;
453
453
  })
@@ -40,8 +40,8 @@ export const EventContextMixin = (superClass) =>
40
40
  return context;
41
41
  }
42
42
 
43
- context.section = ['body', 'header', 'footer', 'details'].find(
44
- (section) => cell.getAttribute('part').indexOf(section) > -1,
43
+ context.section = ['body', 'header', 'footer', 'details'].find((section) =>
44
+ cell.part.contains(`${section}-cell`),
45
45
  );
46
46
 
47
47
  if (cell._column) {
@@ -5,7 +5,6 @@
5
5
  */
6
6
  import { microTask } from '@vaadin/component-base/src/async.js';
7
7
  import { Debouncer } from '@vaadin/component-base/src/debounce.js';
8
- import { addValueToAttribute, removeValueFromAttribute } from '@vaadin/component-base/src/dom-utils.js';
9
8
 
10
9
  /**
11
10
  * Returns the cells of the given row, excluding the details cell.
@@ -81,15 +80,13 @@ export function updateState(element, attribute, value) {
81
80
 
82
81
  /**
83
82
  * @param {!HTMLElement} element
84
- * @param {boolean | string | null | undefined} value
85
83
  * @param {string} part
84
+ * @param {boolean | string | null | undefined} value
86
85
  */
87
- export function updatePart(element, value, part) {
88
- if (value || value === '') {
89
- addValueToAttribute(element, 'part', part);
90
- } else {
91
- removeValueFromAttribute(element, 'part', part);
92
- }
86
+ export function updatePart(element, part, value) {
87
+ element.classList.toggle(part, value || value === '');
88
+ element.part.toggle(part, value || value === '');
89
+ element.part.length === 0 && element.removeAttribute('part');
93
90
  }
94
91
 
95
92
  /**
@@ -99,7 +96,7 @@ export function updatePart(element, value, part) {
99
96
  */
100
97
  export function updateCellsPart(cells, part, value) {
101
98
  cells.forEach((cell) => {
102
- updatePart(cell, value, part);
99
+ updatePart(cell, part, value);
103
100
  });
104
101
  }
105
102
 
@@ -117,7 +114,7 @@ export function updateBooleanRowStates(row, states) {
117
114
  const rowPart = `${state}-row`;
118
115
 
119
116
  // Row part attribute
120
- updatePart(row, value, rowPart);
117
+ updatePart(row, rowPart, value);
121
118
 
122
119
  // Cells part attribute
123
120
  updateCellsPart(cells, `${rowPart}-cell`, value);
@@ -140,14 +137,14 @@ export function updateStringRowStates(row, states) {
140
137
  // remove previous part from row and cells if there was any
141
138
  if (prevValue) {
142
139
  const prevRowPart = `${state}-${prevValue}-row`;
143
- updatePart(row, false, prevRowPart);
140
+ updatePart(row, prevRowPart, false);
144
141
  updateCellsPart(cells, `${prevRowPart}-cell`, false);
145
142
  }
146
143
 
147
144
  // set new part to rows and cells if there is a value
148
145
  if (value) {
149
146
  const rowPart = `${state}-${value}-row`;
150
- updatePart(row, value, rowPart);
147
+ updatePart(row, rowPart, value);
151
148
  updateCellsPart(cells, `${rowPart}-cell`, value);
152
149
  }
153
150
  });
@@ -166,11 +163,11 @@ export function updateCellState(cell, attribute, value, part, oldPart) {
166
163
 
167
164
  // Remove old part from the attribute
168
165
  if (oldPart) {
169
- updatePart(cell, false, oldPart);
166
+ updatePart(cell, oldPart, false);
170
167
  }
171
168
 
172
169
  // Add new part to the cell attribute
173
- updatePart(cell, value, part || `${attribute}-cell`);
170
+ updatePart(cell, part || `${attribute}-cell`, value);
174
171
  }
175
172
 
176
173
  /**
@@ -6,7 +6,7 @@
6
6
  import { isKeyboardActive } from '@vaadin/a11y-base/src/focus-utils.js';
7
7
  import { animationFrame } from '@vaadin/component-base/src/async.js';
8
8
  import { Debouncer } from '@vaadin/component-base/src/debounce.js';
9
- import { addValueToAttribute, removeValueFromAttribute } from '@vaadin/component-base/src/dom-utils.js';
9
+ import { updatePart } from './vaadin-grid-helpers.js';
10
10
 
11
11
  function isRow(element) {
12
12
  return element instanceof HTMLTableRowElement;
@@ -169,11 +169,11 @@ export const KeyboardNavigationMixin = (superClass) =>
169
169
  /** @private */
170
170
  _focusedCellChanged(focusedCell, oldFocusedCell) {
171
171
  if (oldFocusedCell) {
172
- removeValueFromAttribute(oldFocusedCell, 'part', 'focused-cell');
172
+ updatePart(oldFocusedCell, 'focused-cell', false);
173
173
  }
174
174
 
175
175
  if (focusedCell) {
176
- addValueToAttribute(focusedCell, 'part', 'focused-cell');
176
+ updatePart(focusedCell, 'focused-cell', true);
177
177
  }
178
178
  }
179
179
 
@@ -603,7 +603,7 @@ export const KeyboardNavigationMixin = (superClass) =>
603
603
  this._scrollHorizontallyToCell(dstCell);
604
604
  }
605
605
 
606
- dstCell.focus();
606
+ dstCell.focus({ preventScroll: true });
607
607
  }
608
608
  }
609
609
 
@@ -1016,8 +1016,9 @@ export const KeyboardNavigationMixin = (superClass) =>
1016
1016
  const dstRow = dstCell.parentNode;
1017
1017
  const dstCellIndex = Array.from(dstRow.children).indexOf(dstCell);
1018
1018
  const tableRect = this.$.table.getBoundingClientRect();
1019
- let leftBoundary = tableRect.left,
1020
- rightBoundary = tableRect.right;
1019
+ const scrollbarWidth = this.$.table.clientWidth - this.$.table.offsetWidth;
1020
+ let leftBoundary = tableRect.left - (this.__isRTL ? scrollbarWidth : 0);
1021
+ let rightBoundary = tableRect.right + (this.__isRTL ? 0 : scrollbarWidth);
1021
1022
  for (let i = dstCellIndex - 1; i >= 0; i--) {
1022
1023
  const cell = dstRow.children[i];
1023
1024
  if (cell.hasAttribute('hidden') || isDetailsCell(cell)) {
@@ -1040,10 +1041,10 @@ export const KeyboardNavigationMixin = (superClass) =>
1040
1041
  }
1041
1042
 
1042
1043
  if (dstCellRect.left < leftBoundary) {
1043
- this.$.table.scrollLeft += Math.round(dstCellRect.left - leftBoundary);
1044
+ this.$.table.scrollLeft += dstCellRect.left - leftBoundary;
1044
1045
  }
1045
1046
  if (dstCellRect.right > rightBoundary) {
1046
- this.$.table.scrollLeft += Math.round(dstCellRect.right - rightBoundary);
1047
+ this.$.table.scrollLeft += dstCellRect.right - rightBoundary;
1047
1048
  }
1048
1049
  }
1049
1050
 
@@ -31,15 +31,10 @@ import type { GridRowDetailsRenderer, RowDetailsMixinClass } from './vaadin-grid
31
31
  import type { ScrollMixinClass } from './vaadin-grid-scroll-mixin.js';
32
32
  import type { SelectionMixinClass } from './vaadin-grid-selection-mixin.js';
33
33
  import type { SortMixinClass } from './vaadin-grid-sort-mixin.js';
34
- import type {
35
- GridCellClassNameGenerator,
36
- GridCellPartNameGenerator,
37
- StylingMixinClass,
38
- } from './vaadin-grid-styling-mixin.js';
34
+ import type { GridCellPartNameGenerator, StylingMixinClass } from './vaadin-grid-styling-mixin.js';
39
35
 
40
36
  export {
41
37
  GridBodyRenderer,
42
- GridCellClassNameGenerator,
43
38
  GridCellPartNameGenerator,
44
39
  GridDataProvider,
45
40
  GridDataProviderCallback,
@@ -354,9 +354,10 @@ export const GridMixin = (superClass) =>
354
354
  const rows = [];
355
355
  for (let i = 0; i < count; i++) {
356
356
  const row = document.createElement('tr');
357
- row.setAttribute('part', 'row body-row');
358
357
  row.setAttribute('role', 'row');
359
358
  row.setAttribute('tabindex', '-1');
359
+ updatePart(row, 'row', true);
360
+ updatePart(row, 'body-row', true);
360
361
  if (this._columnTree) {
361
362
  this.__initRow(row, this._columnTree[this._columnTree.length - 1], 'body', false, true);
362
363
  }
@@ -503,7 +504,8 @@ export const GridMixin = (superClass) =>
503
504
  }
504
505
  column._cells.push(cell);
505
506
  }
506
- cell.setAttribute('part', 'cell body-cell');
507
+ updatePart(cell, 'cell', true);
508
+ updatePart(cell, 'body-cell', true);
507
509
  cell.__parentRow = row;
508
510
  // Cache the cell reference
509
511
  row.__cells.push(cell);
@@ -565,7 +567,8 @@ export const GridMixin = (superClass) =>
565
567
  column._emptyCells.push(cell);
566
568
  }
567
569
  }
568
- cell.part.add('cell', `${section}-cell`);
570
+ updatePart(cell, 'cell', true);
571
+ updatePart(cell, `${section}-cell`, true);
569
572
  }
570
573
 
571
574
  if (!cell._content.parentElement) {
@@ -713,15 +716,17 @@ export const GridMixin = (superClass) =>
713
716
 
714
717
  while (this.$.header.children.length < columnTree.length) {
715
718
  const headerRow = document.createElement('tr');
716
- headerRow.setAttribute('part', 'row header-row');
717
719
  headerRow.setAttribute('role', 'row');
718
720
  headerRow.setAttribute('tabindex', '-1');
721
+ updatePart(headerRow, 'row', true);
722
+ updatePart(headerRow, 'header-row', true);
719
723
  this.$.header.appendChild(headerRow);
720
724
 
721
725
  const footerRow = document.createElement('tr');
722
- footerRow.setAttribute('part', 'row footer-row');
723
726
  footerRow.setAttribute('role', 'row');
724
727
  footerRow.setAttribute('tabindex', '-1');
728
+ updatePart(footerRow, 'row', true);
729
+ updatePart(footerRow, 'footer-row', true);
725
730
  this.$.footer.appendChild(footerRow);
726
731
  }
727
732
  while (this.$.header.children.length > columnTree.length) {
@@ -748,7 +753,6 @@ export const GridMixin = (superClass) =>
748
753
  this._resetKeyboardNavigation();
749
754
  this.__a11yUpdateHeaderRows();
750
755
  this.__a11yUpdateFooterRows();
751
- this.generateCellClassNames();
752
756
  this.generateCellPartNames();
753
757
  this.__updateHeaderAndFooter();
754
758
  }
@@ -757,12 +761,12 @@ export const GridMixin = (superClass) =>
757
761
  __updateHeaderFooterRowParts(section) {
758
762
  const visibleRows = [...this.$[section].querySelectorAll('tr:not([hidden])')];
759
763
  [...this.$[section].children].forEach((row) => {
760
- updatePart(row, row === visibleRows.at(0), `first-${section}-row`);
761
- updatePart(row, row === visibleRows.at(-1), `last-${section}-row`);
764
+ updatePart(row, `first-${section}-row`, row === visibleRows.at(0));
765
+ updatePart(row, `last-${section}-row`, row === visibleRows.at(-1));
762
766
 
763
767
  getBodyRowCells(row).forEach((cell) => {
764
- updatePart(cell, row === visibleRows.at(0), `first-${section}-row-cell`);
765
- updatePart(cell, row === visibleRows.at(-1), `last-${section}-row-cell`);
768
+ updatePart(cell, `first-${section}-row-cell`, row === visibleRows.at(0));
769
+ updatePart(cell, `last-${section}-row-cell`, row === visibleRows.at(-1));
766
770
  });
767
771
  });
768
772
  }
@@ -783,7 +787,6 @@ export const GridMixin = (superClass) =>
783
787
 
784
788
  if (loading) {
785
789
  // Run style generators for the loading row to have custom names cleared
786
- this._generateCellClassNames(row);
787
790
  this._generateCellPartNames(row);
788
791
  }
789
792
  }
@@ -814,7 +817,6 @@ export const GridMixin = (superClass) =>
814
817
 
815
818
  this.__updateRowStateParts(row, model);
816
819
 
817
- this._generateCellClassNames(row, model);
818
820
  this._generateCellPartNames(row, model);
819
821
  this._filterDragAndDrop(row, model);
820
822
  this.__updateDragSourceParts(row, model);
@@ -3,7 +3,7 @@
3
3
  * Copyright (c) 2016 - 2025 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
- import { iterateChildren } from './vaadin-grid-helpers.js';
6
+ import { iterateChildren, updatePart } from './vaadin-grid-helpers.js';
7
7
 
8
8
  /**
9
9
  * @polymerMixin
@@ -109,7 +109,8 @@ export const RowDetailsMixin = (superClass) =>
109
109
  * @protected
110
110
  */
111
111
  _configureDetailsCell(cell) {
112
- cell.setAttribute('part', 'cell details-cell');
112
+ updatePart(cell, 'cell', true);
113
+ updatePart(cell, 'details-cell', true);
113
114
  // Freeze the details cell, so that it does not scroll horizontally
114
115
  // with the normal cells. This way it looks less weird.
115
116
  cell.toggleAttribute('frozen', true);
@@ -178,13 +178,17 @@ export const ScrollMixin = (superClass) =>
178
178
  return;
179
179
  }
180
180
 
181
- const dstRect = element.getBoundingClientRect();
181
+ const elementRect = element.getBoundingClientRect();
182
+ const elementComputedStyle = getComputedStyle(element);
183
+ const elementTop = elementRect.top + parseInt(elementComputedStyle.scrollMarginTop || 0);
184
+ const elementBottom = elementRect.bottom + parseInt(elementComputedStyle.scrollMarginBottom || 0);
185
+
182
186
  const footerTop = this.$.footer.getBoundingClientRect().top;
183
187
  const headerBottom = this.$.header.getBoundingClientRect().bottom;
184
- if (dstRect.bottom > footerTop) {
185
- this.$.table.scrollTop += dstRect.bottom - footerTop;
186
- } else if (dstRect.top < headerBottom) {
187
- this.$.table.scrollTop -= headerBottom - dstRect.top;
188
+ if (elementBottom > footerTop) {
189
+ this.$.table.scrollTop += elementBottom - footerTop;
190
+ } else if (elementTop < headerBottom) {
191
+ this.$.table.scrollTop -= headerBottom - elementTop;
188
192
  }
189
193
  }
190
194
 
@@ -450,6 +454,16 @@ export const ScrollMixin = (superClass) =>
450
454
  // Update the horizontal scroll position property of the focused row
451
455
  this.__updateRowScrollPositionProperty(focusedRow);
452
456
  }
457
+
458
+ const lastHeaderRow = this.$.header.querySelector("[part~='last-header-row']");
459
+ if (lastHeaderRow) {
460
+ this.__updateRowScrollPositionProperty(lastHeaderRow);
461
+ }
462
+
463
+ const firstFooterRow = this.$.footer.querySelector("[part~='first-footer-row']");
464
+ if (firstFooterRow) {
465
+ this.__updateRowScrollPositionProperty(firstFooterRow);
466
+ }
453
467
  }
454
468
 
455
469
  /**
@@ -9,36 +9,11 @@ import type { GridColumn } from './vaadin-grid-column.js';
9
9
 
10
10
  export type GridCellPartNameGenerator<TItem> = (column: GridColumn<TItem>, model: GridItemModel<TItem>) => string;
11
11
 
12
- /**
13
- * @deprecated Use `GridCellPartNameGenerator` type and `cellPartNameGenerator` API instead.
14
- */
15
- export type GridCellClassNameGenerator<TItem> = GridCellPartNameGenerator<TItem>;
16
-
17
12
  export declare function StylingMixin<TItem, T extends Constructor<HTMLElement>>(
18
13
  base: T,
19
14
  ): Constructor<StylingMixinClass<TItem>> & T;
20
15
 
21
16
  export declare class StylingMixinClass<TItem> {
22
- /**
23
- * A function that allows generating CSS class names for grid cells
24
- * based on their row and column. The return value should be the generated
25
- * class name as a string, or multiple class names separated by whitespace
26
- * characters.
27
- *
28
- * Receives two arguments:
29
- * - `column` The `<vaadin-grid-column>` element (`undefined` for details-cell).
30
- * - `model` The object with the properties related with
31
- * the rendered item, contains:
32
- * - `model.index` The index of the item.
33
- * - `model.item` The item.
34
- * - `model.expanded` Sublevel toggle state.
35
- * - `model.level` Level of the tree represented with a horizontal offset of the toggle button.
36
- * - `model.selected` Selected state.
37
- *
38
- * @deprecated Use `cellPartNameGenerator` instead.
39
- */
40
- cellClassNameGenerator: GridCellClassNameGenerator<TItem> | null | undefined;
41
-
42
17
  /**
43
18
  * A function that allows generating CSS `part` names for grid cells in Shadow DOM based
44
19
  * on their row and column, for styling from outside using the `::part()` selector.
@@ -58,16 +33,6 @@ export declare class StylingMixinClass<TItem> {
58
33
  */
59
34
  cellPartNameGenerator: GridCellPartNameGenerator<TItem> | null | undefined;
60
35
 
61
- /**
62
- * Runs the `cellClassNameGenerator` for the visible cells.
63
- * If the generator depends on varying conditions, you need to
64
- * call this function manually in order to update the styles when
65
- * the conditions change.
66
- *
67
- * @deprecated Use `cellPartNameGenerator` and `generateCellPartNames()` instead.
68
- */
69
- generateCellClassNames(): void;
70
-
71
36
  /**
72
37
  * Runs the `cellPastNameGenerator` for the visible cells.
73
38
  * If the generator depends on varying conditions, you need to
@@ -12,30 +12,6 @@ export const StylingMixin = (superClass) =>
12
12
  class StylingMixin extends superClass {
13
13
  static get properties() {
14
14
  return {
15
- /**
16
- * A function that allows generating CSS class names for grid cells
17
- * based on their row and column. The return value should be the generated
18
- * class name as a string, or multiple class names separated by whitespace
19
- * characters.
20
- *
21
- * Receives two arguments:
22
- * - `column` The `<vaadin-grid-column>` element (`undefined` for details-cell).
23
- * - `model` The object with the properties related with
24
- * the rendered item, contains:
25
- * - `model.index` The index of the item.
26
- * - `model.item` The item.
27
- * - `model.expanded` Sublevel toggle state.
28
- * - `model.level` Level of the tree represented with a horizontal offset of the toggle button.
29
- * - `model.selected` Selected state.
30
- *
31
- * @type {GridCellClassNameGenerator | null | undefined}
32
- * @deprecated Use `cellPartNameGenerator` instead.
33
- */
34
- cellClassNameGenerator: {
35
- type: Function,
36
- sync: true,
37
- },
38
-
39
15
  /**
40
16
  * A function that allows generating CSS `part` names for grid cells in Shadow DOM based
41
17
  * on their row and column, for styling from outside using the `::part()` selector.
@@ -63,15 +39,7 @@ export const StylingMixin = (superClass) =>
63
39
  }
64
40
 
65
41
  static get observers() {
66
- return [
67
- '__cellClassNameGeneratorChanged(cellClassNameGenerator)',
68
- '__cellPartNameGeneratorChanged(cellPartNameGenerator)',
69
- ];
70
- }
71
-
72
- /** @private */
73
- __cellClassNameGeneratorChanged() {
74
- this.generateCellClassNames();
42
+ return ['__cellPartNameGeneratorChanged(cellPartNameGenerator)'];
75
43
  }
76
44
 
77
45
  /** @private */
@@ -79,22 +47,6 @@ export const StylingMixin = (superClass) =>
79
47
  this.generateCellPartNames();
80
48
  }
81
49
 
82
- /**
83
- * Runs the `cellClassNameGenerator` for the visible cells.
84
- * If the generator depends on varying conditions, you need to
85
- * call this function manually in order to update the styles when
86
- * the conditions change.
87
- *
88
- * @deprecated Use `cellPartNameGenerator` and `generateCellPartNames()` instead.
89
- */
90
- generateCellClassNames() {
91
- iterateChildren(this.$.items, (row) => {
92
- if (!row.hidden) {
93
- this._generateCellClassNames(row, this.__getRowModel(row));
94
- }
95
- });
96
- }
97
-
98
50
  /**
99
51
  * Runs the `cellPartNameGenerator` for the visible cells.
100
52
  * If the generator depends on varying conditions, you need to
@@ -109,29 +61,13 @@ export const StylingMixin = (superClass) =>
109
61
  });
110
62
  }
111
63
 
112
- /** @private */
113
- _generateCellClassNames(row, model) {
114
- iterateRowCells(row, (cell) => {
115
- if (cell.__generatedClasses) {
116
- cell.__generatedClasses.forEach((className) => cell.classList.remove(className));
117
- }
118
- if (this.cellClassNameGenerator && !row.hasAttribute('loading')) {
119
- const result = this.cellClassNameGenerator(cell._column, model);
120
- cell.__generatedClasses = result && result.split(' ').filter((className) => className.length > 0);
121
- if (cell.__generatedClasses) {
122
- cell.__generatedClasses.forEach((className) => cell.classList.add(className));
123
- }
124
- }
125
- });
126
- }
127
-
128
64
  /** @private */
129
65
  _generateCellPartNames(row, model) {
130
66
  iterateRowCells(row, (cell) => {
131
67
  if (cell.__generatedParts) {
132
68
  cell.__generatedParts.forEach((partName) => {
133
69
  // Remove previously generated part names
134
- updatePart(cell, null, partName);
70
+ updatePart(cell, partName, null);
135
71
  });
136
72
  }
137
73
  if (this.cellPartNameGenerator && !row.hasAttribute('loading')) {
@@ -140,7 +76,7 @@ export const StylingMixin = (superClass) =>
140
76
  if (cell.__generatedParts) {
141
77
  cell.__generatedParts.forEach((partName) => {
142
78
  // Add the newly generated names to part
143
- updatePart(cell, true, partName);
79
+ updatePart(cell, partName, true);
144
80
  });
145
81
  }
146
82
  }
@@ -302,7 +302,7 @@ class Grid extends GridMixin(ElementMixin(ThemableMixin(PolylitMixin(LumoInjecti
302
302
  <tbody id="items" role="rowgroup"></tbody>
303
303
  <tbody id="emptystatebody">
304
304
  <tr id="emptystaterow">
305
- <td part="empty-state" id="emptystatecell" tabindex="0">
305
+ <td part="empty-state" class="empty-state" id="emptystatecell" tabindex="0">
306
306
  <slot name="empty-state" id="emptystateslot"></slot>
307
307
  </td>
308
308
  </tr>
@@ -310,7 +310,7 @@ class Grid extends GridMixin(ElementMixin(ThemableMixin(PolylitMixin(LumoInjecti
310
310
  <tfoot id="footer" role="rowgroup"></tfoot>
311
311
  </table>
312
312
 
313
- <div part="reorder-ghost"></div>
313
+ <div part="reorder-ghost" class="reorder-ghost"></div>
314
314
  </div>
315
315
 
316
316
  <slot name="tooltip"></slot>