@vaadin/grid 25.4.0-alpha5 → 25.4.0-alpha7

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.
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import { isTouch } from '@vaadin/component-base/src/browser-utils.js';
7
7
  import { addListener } from '@vaadin/component-base/src/gestures.js';
8
- import { getBodyRowCells, iterateChildren, updateColumnOrders } from './vaadin-grid-helpers.js';
8
+ import { iterateChildren, updateColumnOrders } from './vaadin-grid-helpers.js';
9
9
 
10
10
  export const ColumnReorderingMixin = (superClass) =>
11
11
  class ColumnReorderingMixin extends superClass {
@@ -204,6 +204,8 @@ export const ColumnReorderingMixin = (superClass) =>
204
204
  this._swapColumnOrders(this._draggedColumn, levelColumnsInOrder[i + direction]);
205
205
  }
206
206
 
207
+ this.__renderBody();
208
+ this.__renderSizer();
207
209
  this.__renderHeaderFooter();
208
210
  }
209
211
 
@@ -442,24 +444,10 @@ export const ColumnReorderingMixin = (superClass) =>
442
444
  * @protected
443
445
  */
444
446
  _swapColumnOrders(column1, column2) {
445
- // Swap order values and determine which column should come first
446
447
  [column1._order, column2._order] = [column2._order, column1._order];
447
- const [firstColumn, secondColumn] = column1._order < column2._order ? [column1, column2] : [column2, column1];
448
-
449
- [...this.$.items.children, this.$.sizer].forEach((row) => {
450
- const cells = getBodyRowCells(row);
451
- const firstColumnCells = cells.filter((cell) => firstColumn.contains(cell._column));
452
- const secondColumnFirstCell = cells.find((cell) => secondColumn.contains(cell._column));
453
- firstColumnCells.forEach((cell) => secondColumnFirstCell.before(cell));
454
- // row.__cells are out of sync with the actual cell order after the move, and must be updated
455
- if (row.__cells) {
456
- row.__cells = row.__cells.toSorted((a, b) => a._column._order - b._column._order);
457
- }
458
- });
459
448
 
460
- [...this.$.items.children, this.$.sizer].forEach((row) => {
461
- this._updateFirstAndLastColumnForRow(row);
462
- });
449
+ this.__scheduleRenderBody();
450
+ this.__scheduleRenderSizer();
463
451
 
464
452
  this.__scheduleRenderHeaderFooter();
465
453
  this._debounceUpdateFrozenColumn();
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import { microTask, timeOut } from '@vaadin/component-base/src/async.js';
7
7
  import { Debouncer } from '@vaadin/component-base/src/debounce.js';
8
- import { ColumnObserver, getBodyRowCells, updateCellState } from './vaadin-grid-helpers.js';
8
+ import { ColumnObserver } from './vaadin-grid-helpers.js';
9
9
 
10
10
  function arrayEquals(arr1, arr2) {
11
11
  if (!arr1 || !arr2 || arr1.length !== arr2.length) {
@@ -143,17 +143,6 @@ export const DynamicColumnsMixin = (superClass) =>
143
143
  });
144
144
  }
145
145
 
146
- /**
147
- * @param {!HTMLElement} row
148
- * @protected
149
- */
150
- _updateFirstAndLastColumnForRow(row) {
151
- getBodyRowCells(row).forEach((cell, cellIndex, cells) => {
152
- updateCellState(cell, 'first-column', cellIndex === 0);
153
- updateCellState(cell, 'last-column', cellIndex === cells.length - 1);
154
- });
155
- }
156
-
157
146
  /**
158
147
  * @param {!Node} node
159
148
  * @return {boolean}
@@ -11,7 +11,7 @@ import { repeat } from 'lit/directives/repeat.js';
11
11
  import { styleMap } from 'lit/directives/style-map.js';
12
12
  import { microTask } from '@vaadin/component-base/src/async.js';
13
13
  import { Debouncer } from '@vaadin/component-base/src/debounce.js';
14
- import { partMap } from '@vaadin/component-base/src/directives/part-map.js';
14
+ import { parsePartNames, partMap } from '@vaadin/component-base/src/directives/part-map.js';
15
15
  import { cellContent } from './directives/cell-content-directive.js';
16
16
 
17
17
  function isContentCell(column, level, columnTree) {
@@ -49,19 +49,6 @@ function isFooterRowVisible(columns, level, columnTree) {
49
49
  });
50
50
  }
51
51
 
52
- /**
53
- * Converts a whitespace separated list of custom part names
54
- * into an object accepted by the `partMap` directive.
55
- */
56
- function getCustomParts(partName) {
57
- return Object.fromEntries(
58
- (partName ?? '')
59
- .split(' ')
60
- .filter((name) => name !== '')
61
- .map((name) => [name, true]),
62
- );
63
- }
64
-
65
52
  /**
66
53
  * A mixin providing rendering of header and footer rows based on the column tree.
67
54
  */
@@ -142,7 +129,7 @@ export const HeaderFooterRenderingMixin = (superClass) =>
142
129
  'last-column-cell': isLastCell,
143
130
  };
144
131
 
145
- const customCellParts = isContentCell ? getCustomParts(column.headerPartName) : {};
132
+ const customCellParts = isContentCell ? parsePartNames(column.headerPartName) : {};
146
133
 
147
134
  return cache(html`
148
135
  <th
@@ -225,7 +212,7 @@ export const HeaderFooterRenderingMixin = (superClass) =>
225
212
  'last-column-cell': isLastCell,
226
213
  };
227
214
 
228
- const customCellParts = isContentCell ? getCustomParts(column.footerPartName) : {};
215
+ const customCellParts = isContentCell ? parsePartNames(column.footerPartName) : {};
229
216
 
230
217
  return cache(html`
231
218
  <td
@@ -669,16 +669,19 @@ export const KeyboardNavigationMixin = (superClass) =>
669
669
 
670
670
  let focusStepTarget = tabOrder[index];
671
671
 
672
+ // In focus button mode, the focusable is a button inside the cell
673
+ const focusStepCell = isCell(focusStepTarget?.parentElement) ? focusStepTarget.parentElement : focusStepTarget;
674
+
672
675
  // If the target focusable is tied to a column that is not visible,
673
676
  // find the first visible column and update the target in order to
674
677
  // prevent scrolling to the start of the row.
675
- if (focusStepTarget && !this.__isHorizontallyInViewport(focusStepTarget)) {
678
+ if (focusStepTarget && !this.__isHorizontallyInViewport(focusStepCell)) {
676
679
  const firstVisibleColumn = this._getColumnsInOrder().find((column) => this.__isColumnInViewport(column));
677
680
  if (firstVisibleColumn) {
678
681
  if (focusStepTarget === this._headerFocusable) {
679
682
  focusStepTarget = firstVisibleColumn._headerCell;
680
683
  } else if (focusStepTarget === this._itemsFocusable) {
681
- const row = focusStepTarget.parentElement;
684
+ const row = focusStepCell.parentElement;
682
685
  focusStepTarget = [...row.children].find((cell) => cell._column === firstVisibleColumn);
683
686
  } else if (focusStepTarget === this._footerFocusable) {
684
687
  focusStepTarget = firstVisibleColumn._footerCell;
@@ -22,15 +22,7 @@ import { DynamicColumnsMixin } from './vaadin-grid-dynamic-columns-mixin.js';
22
22
  import { EventContextMixin } from './vaadin-grid-event-context-mixin.js';
23
23
  import { FilterMixin } from './vaadin-grid-filter-mixin.js';
24
24
  import { HeaderFooterRenderingMixin } from './vaadin-grid-header-footer-rendering-mixin.js';
25
- import {
26
- getBodyRowCells,
27
- getClosestCell,
28
- iterateChildren,
29
- iterateRowCells,
30
- updateBooleanRowStates,
31
- updateCellsPart,
32
- updatePart,
33
- } from './vaadin-grid-helpers.js';
25
+ import { getClosestCell, iterateChildren, updateBooleanRowStates } from './vaadin-grid-helpers.js';
34
26
  import { KeyboardNavigationMixin } from './vaadin-grid-keyboard-navigation-mixin.js';
35
27
  import { ResizeMixin } from './vaadin-grid-resize-mixin.js';
36
28
  import { RowDetailsMixin } from './vaadin-grid-row-details-mixin.js';
@@ -78,6 +70,8 @@ export const GridMixin = (superClass) =>
78
70
  ),
79
71
  ),
80
72
  ) {
73
+ #renderedColumns = [];
74
+
81
75
  static get observers() {
82
76
  return ['_columnTreeChanged(_columnTree)', '_flatSizeChanged(_flatSize, __virtualizer, _hasData, _columnTree)'];
83
77
  }
@@ -332,18 +326,14 @@ export const GridMixin = (superClass) =>
332
326
  for (let i = 0; i < count; i++) {
333
327
  const row = this.__createBodyRow();
334
328
  if (this._columnTree) {
335
- this.__initRow(row, this._columnTree.at(-1), 'body', true);
329
+ this.__renderBodyRow(row);
336
330
  }
337
331
  rows.push(row);
338
332
  }
339
333
 
340
- if (this._columnTree) {
341
- this._columnTree.at(-1).forEach((c) => {
342
- if (c.isConnected && c._cells) {
343
- c._cells = [...c._cells];
344
- }
345
- });
346
- }
334
+ this._columnTree?.at(-1).forEach((column) => {
335
+ column.performUpdate?.();
336
+ });
347
337
 
348
338
  return rows;
349
339
  }
@@ -378,142 +368,6 @@ export const GridMixin = (superClass) =>
378
368
  }
379
369
  }
380
370
 
381
- /** @private */
382
- _createCell(tagName, column) {
383
- const contentId = (this._contentIndex = this._contentIndex + 1 || 0);
384
- const slotName = `vaadin-grid-cell-content-${contentId}`;
385
-
386
- const cellContent = document.createElement('vaadin-grid-cell-content');
387
- cellContent.setAttribute('slot', slotName);
388
-
389
- const cell = document.createElement(tagName);
390
- cell.id = slotName.replace('-content-', '-');
391
- cell.setAttribute('role', tagName === 'td' ? 'gridcell' : 'columnheader');
392
-
393
- cell.addEventListener('mouseenter', this.__onCellMouseEnter);
394
- cell.addEventListener('mouseleave', this.__onCellMouseLeave);
395
- cell.addEventListener('mousedown', this.__onCellMouseDown);
396
- cell.addEventListener('keydown', this.__onCellKeyDown);
397
-
398
- const slot = document.createElement('slot');
399
- slot.setAttribute('name', slotName);
400
-
401
- if (column?._focusButtonMode) {
402
- const div = document.createElement('div');
403
- div.setAttribute('role', 'button');
404
- div.setAttribute('tabindex', '-1');
405
- cell.appendChild(div);
406
-
407
- // Patch `focus()` to use the button
408
- cell._focusButton = div;
409
- cell.focus = function (options) {
410
- cell._focusButton.focus(options);
411
- };
412
-
413
- div.appendChild(slot);
414
- } else {
415
- cell.setAttribute('tabindex', '-1');
416
- cell.appendChild(slot);
417
- }
418
-
419
- cell._content = cellContent;
420
-
421
- return cell;
422
- }
423
-
424
- /**
425
- * @param {!HTMLTableRowElement} row
426
- * @param {!Array<!GridColumn>} columns
427
- * @param {?string} section
428
- * @param {boolean} noNotify
429
- * @private
430
- */
431
- __initRow(row, columns, section = 'body', noNotify = false) {
432
- const contentsFragment = document.createDocumentFragment();
433
-
434
- iterateRowCells(row, (cell) => {
435
- cell._vacant = true;
436
- });
437
-
438
- const detailsCell = row.querySelector('.details-cell');
439
- if (detailsCell) {
440
- this.__teardownDetailsCell(detailsCell);
441
- }
442
-
443
- row.innerHTML = '';
444
- if (section === 'body') {
445
- // Clear the cached cell references
446
- row.__cells = [];
447
- }
448
-
449
- columns
450
- .filter((column) => !column.hidden)
451
- .toSorted((a, b) => a._order - b._order)
452
- .forEach((column, index, cols) => {
453
- let cell;
454
-
455
- if (section === 'body') {
456
- // Body
457
- if (!column._cells) {
458
- column._cells = [];
459
- }
460
- cell = column._cells.find((cell) => cell._vacant);
461
- if (!cell) {
462
- cell = this._createCell('td', column);
463
- column._cells.push(cell);
464
- }
465
- updatePart(cell, 'cell', true);
466
- updatePart(cell, 'body-cell', true);
467
- cell.__parentRow = row;
468
- // Cache the cell reference
469
- row.__cells.push(cell);
470
-
471
- const isSizerRow = row === this.$.sizer;
472
- if (!column._bodyContentHidden || isSizerRow) {
473
- row.appendChild(cell);
474
- }
475
-
476
- if (isSizerRow) {
477
- column._sizerCell = cell;
478
- }
479
-
480
- if (index === cols.length - 1 && this.rowDetailsRenderer) {
481
- // Add details cell as last cell to body rows
482
- if (!this._detailsCells) {
483
- this._detailsCells = [];
484
- }
485
- const detailsCell = this._detailsCells.find((cell) => cell._vacant) || this._createCell('td');
486
- if (this._detailsCells.indexOf(detailsCell) === -1) {
487
- this._detailsCells.push(detailsCell);
488
- }
489
- if (!detailsCell._content.parentElement) {
490
- contentsFragment.appendChild(detailsCell._content);
491
- }
492
- this._configureDetailsCell(detailsCell);
493
- detailsCell.__parentRow = row;
494
- row.appendChild(detailsCell);
495
- this.__a11ySetRowDetailsCell(row, detailsCell);
496
- detailsCell._vacant = false;
497
- }
498
-
499
- if (!noNotify) {
500
- column._cells = [...column._cells];
501
- }
502
- }
503
-
504
- if (!cell._content.parentElement) {
505
- contentsFragment.appendChild(cell._content);
506
- }
507
- cell._vacant = false;
508
- cell._column = column;
509
- });
510
-
511
- // Might be empty if only cache was used
512
- this.appendChild(contentsFragment);
513
-
514
- this._updateFirstAndLastColumnForRow(row);
515
- }
516
-
517
371
  /** @private */
518
372
  __updateVirtualizerElement(row, index) {
519
373
  this._preventScrollerRotatingCellFocus(row, index);
@@ -530,18 +384,16 @@ export const GridMixin = (superClass) =>
530
384
 
531
385
  /** @private */
532
386
  _columnTreeChanged(columnTree) {
533
- this._renderColumnTree(columnTree);
534
- this.__updateColumnsBodyContentHidden();
535
- }
387
+ const columns = columnTree.at(-1);
388
+ columns
389
+ .filter((column) => !this.#renderedColumns.includes(column))
390
+ .forEach((column) => {
391
+ column._cells = [];
392
+ });
393
+ this.#renderedColumns = columns;
536
394
 
537
- /** @private */
538
- __updateRowOrderParts(row) {
539
- updateBooleanRowStates(row, {
540
- first: row.index === 0,
541
- last: row.index === this._flatSize - 1,
542
- odd: row.index % 2 !== 0,
543
- even: row.index % 2 === 0,
544
- });
395
+ this._renderColumnTree();
396
+ this.__updateColumnsBodyContentHidden();
545
397
  }
546
398
 
547
399
  /** @private */
@@ -561,23 +413,25 @@ export const GridMixin = (superClass) =>
561
413
  }
562
414
 
563
415
  /**
564
- * @param {!Array<!GridColumn>} columnTree
565
416
  * @protected
566
417
  */
567
- _renderColumnTree(columnTree) {
418
+ _renderColumnTree() {
568
419
  // This render uses the current hidden state of all columns,
569
420
  // so a pending render from a hidden change is not needed
570
421
  this._debouncerHiddenChanged?.cancel();
422
+ this.__renderBodyDebouncer?.cancel();
571
423
 
572
424
  iterateChildren(this.$.items, (row) => {
573
- this.__initRow(row, columnTree.at(-1), 'body', true);
574
425
  this.__updateRow(row);
575
426
  });
576
427
 
577
428
  this.__renderHeaderFooter();
429
+ this.__renderSizer();
578
430
 
579
- // Sizer rows
580
- this.__initRow(this.$.sizer, columnTree.at(-1));
431
+ this._columnTree.at(-1).forEach((column) => {
432
+ column._cells = [...(column._cells ?? [])];
433
+ column.performUpdate?.();
434
+ });
581
435
 
582
436
  this.__updateHorizontalScrollPosition();
583
437
  this.__a11yUpdateHeaderRows();
@@ -587,40 +441,22 @@ export const GridMixin = (superClass) =>
587
441
 
588
442
  /**
589
443
  * @param {!HTMLElement} row
590
- * @param {boolean} loading
444
+ * @param {{ skipRenderers?: boolean }} options
591
445
  * @private
592
446
  */
593
- __updateRowCellsLoading(row, loading) {
594
- const cells = getBodyRowCells(row);
595
-
596
- // Cells part attribute
597
- updateCellsPart(cells, 'loading-row-cell', loading);
598
-
599
- if (loading) {
600
- // Run style generators for the loading row to have custom names cleared
601
- this._generateCellPartNames(row);
447
+ __updateRow(row, { skipRenderers = false } = {}) {
448
+ const item = this.__getRowItem(row);
449
+ if (item) {
450
+ // Set the item before rendering, the row template reads the row model
451
+ row._item = item;
602
452
  }
603
- }
604
453
 
605
- /**
606
- * @param {!HTMLElement} row
607
- * @private
608
- */
609
- __updateRow(row) {
610
454
  this.__renderBodyRow(row);
611
455
 
612
- this.__a11yUpdateRowRowindex(row);
613
- this.__updateRowOrderParts(row);
614
-
615
- const item = this.__getRowItem(row);
616
- if (item) {
617
- this.__updateRowCellsLoading(row, false);
618
- } else {
619
- this.__updateRowCellsLoading(row, true);
456
+ if (!item) {
620
457
  return;
621
458
  }
622
459
 
623
- row._item = item;
624
460
  const model = this.__getRowModel(row);
625
461
 
626
462
  this._toggleDetailsCell(row, model.detailsOpened);
@@ -630,19 +466,20 @@ export const GridMixin = (superClass) =>
630
466
 
631
467
  this.__updateRowStateParts(row, model);
632
468
 
633
- this._generateCellPartNames(row, model);
634
469
  this._filterDragAndDrop(row, model);
635
470
  this.__updateDragSourceParts(row, model);
636
471
 
637
- iterateChildren(row, (cell) => {
638
- if (cell._column && !cell._column.isConnected) {
639
- return;
640
- }
641
- if (cell._renderer) {
642
- const owner = cell._column || this;
643
- cell._renderer.call(owner, cell._content, owner, model);
644
- }
645
- });
472
+ if (!skipRenderers) {
473
+ iterateChildren(row, (cell) => {
474
+ if (cell._column && !cell._column.isConnected) {
475
+ return;
476
+ }
477
+ if (cell._renderer) {
478
+ const owner = cell._column || this;
479
+ cell._renderer.call(owner, cell._content, owner, model);
480
+ }
481
+ });
482
+ }
646
483
 
647
484
  this._updateDetailsCellHeight(row);
648
485
 
@@ -3,8 +3,6 @@
3
3
  * Copyright (c) 2016 - 2026 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
- import { updatePart } from './vaadin-grid-helpers.js';
7
-
8
6
  export const RowDetailsMixin = (superClass) =>
9
7
  class RowDetailsMixin extends superClass {
10
8
  static get properties() {
@@ -40,14 +38,6 @@ export const RowDetailsMixin = (superClass) =>
40
38
  sync: true,
41
39
  },
42
40
 
43
- /**
44
- * @type {!Array<!HTMLElement> | undefined}
45
- * @protected
46
- */
47
- _detailsCells: {
48
- type: Array,
49
- },
50
-
51
41
  /**
52
42
  * Set of opened details item ids
53
43
  * @private
@@ -79,24 +69,19 @@ export const RowDetailsMixin = (superClass) =>
79
69
 
80
70
  /** @private */
81
71
  _rowDetailsRendererChanged(rowDetailsRenderer) {
82
- if (!rowDetailsRenderer) {
72
+ if (!this._columnTree) {
73
+ // Only update the rows if the column tree has already been initialized
83
74
  return;
84
75
  }
85
76
 
86
- if (this._columnTree) {
87
- // Only update the rows if the column tree has already been initialized
88
- this._getRenderedRows().forEach((row) => {
89
- if (!row.querySelector('.details-cell')) {
90
- this.__initRow(row, this._columnTree.at(-1));
91
- this.__updateRow(row);
92
- return;
93
- }
94
-
95
- if (row.hasAttribute('details-opened')) {
96
- this.__updateRow(row);
97
- }
98
- });
99
- }
77
+ this._getRenderedRows().forEach((row) => {
78
+ // Update the rows that need the details cell added or removed,
79
+ // and the rows with opened details to apply the new renderer.
80
+ const hasDetailsCell = !!row.querySelector('.details-cell');
81
+ if (hasDetailsCell !== !!rowDetailsRenderer || row.hasAttribute('details-opened')) {
82
+ this.__updateRow(row);
83
+ }
84
+ });
100
85
  }
101
86
 
102
87
  /** @private */
@@ -108,25 +93,6 @@ export const RowDetailsMixin = (superClass) =>
108
93
  });
109
94
  }
110
95
 
111
- /**
112
- * @param {!HTMLElement} cell
113
- * @protected
114
- */
115
- _configureDetailsCell(cell) {
116
- updatePart(cell, 'cell', true);
117
- updatePart(cell, 'details-cell', true);
118
- // Freeze the details cell, so that it does not scroll horizontally
119
- // with the normal cells. This way it looks less weird.
120
- cell.toggleAttribute('frozen', true);
121
-
122
- this._detailsCellResizeObserver.observe(cell);
123
- }
124
-
125
- /** @private */
126
- __teardownDetailsCell(cell) {
127
- this._detailsCellResizeObserver.unobserve(cell);
128
- }
129
-
130
96
  /**
131
97
  * @param {!HTMLElement} row
132
98
  * @param {boolean} detailsOpened
@@ -153,19 +119,15 @@ export const RowDetailsMixin = (superClass) =>
153
119
 
154
120
  /** @protected */
155
121
  _updateDetailsCellHeight(row) {
156
- const cell = row.querySelector('.details-cell');
157
- if (!cell) {
158
- return;
159
- }
160
-
161
- this.__updateDetailsRowPadding(row, cell);
122
+ this.__updateDetailsRowPadding(row);
162
123
  // Ensure the row has correct padding after frame (the resize observer might miss it)
163
- requestAnimationFrame(() => this.__updateDetailsRowPadding(row, cell));
124
+ requestAnimationFrame(() => this.__updateDetailsRowPadding(row));
164
125
  }
165
126
 
166
127
  /** @private */
167
- __updateDetailsRowPadding(row, cell) {
168
- if (cell.hidden) {
128
+ __updateDetailsRowPadding(row) {
129
+ const cell = row.querySelector('.details-cell');
130
+ if (!cell || cell.hidden) {
169
131
  row.style.removeProperty('padding-bottom');
170
132
  } else {
171
133
  row.style.setProperty('padding-bottom', `${cell.offsetHeight}px`);
@@ -328,37 +328,29 @@ export const ScrollMixin = (superClass) =>
328
328
  this.__scrollToPendingColumn();
329
329
 
330
330
  const columnsInOrder = this._getColumnsInOrder();
331
- let bodyContentHiddenChanged = false;
331
+ const changedColumns = [];
332
332
 
333
- // Remove the column cells from the DOM if the column is outside the viewport.
334
- // Add the column cells to the DOM if the column is inside the viewport.
335
- //
336
333
  // Update the _bodyContentHidden property of the column to reflect the current
337
- // visibility state and make it run renderers for the cells if necessary.
334
+ // visibility state.
338
335
  columnsInOrder.forEach((column) => {
339
336
  const bodyContentHidden = this._lazyColumns && !this.__isColumnInViewport(column);
340
337
 
341
338
  if (column._bodyContentHidden !== bodyContentHidden) {
342
- bodyContentHiddenChanged = true;
343
- column._cells.forEach((cell) => {
344
- if (cell !== column._sizerCell) {
345
- if (bodyContentHidden) {
346
- cell.remove();
347
- } else if (cell.__parentRow) {
348
- // Add the cell to the correct DOM position in the row
349
- const followingColumnCell = [...cell.__parentRow.children].find(
350
- (child) => columnsInOrder.indexOf(child._column) > columnsInOrder.indexOf(column),
351
- );
352
- cell.__parentRow.insertBefore(cell, followingColumnCell);
353
- }
354
- }
355
- });
339
+ changedColumns.push(column);
356
340
  }
357
341
 
358
342
  column._bodyContentHidden = bodyContentHidden;
359
343
  });
360
344
 
361
- if (bodyContentHiddenChanged) {
345
+ if (changedColumns.length > 0) {
346
+ [...this.$.items.children].forEach((row) => {
347
+ this.__updateRow(row, { skipRenderers: true });
348
+ });
349
+
350
+ changedColumns.forEach((column) => {
351
+ column.performUpdate?.();
352
+ });
353
+
362
354
  // Frozen columns may have changed their visibility
363
355
  this._frozenCellsChanged();
364
356
  }
@@ -28,7 +28,7 @@ export declare class GridSelectionColumnBaseMixinClass<TItem> {
28
28
  selectAll: boolean;
29
29
 
30
30
  /**
31
- * When true, the active item gets automatically selected.
31
+ * When true, activating a row by click or keyboard toggles its selection.
32
32
  * @attr {boolean} auto-select
33
33
  */
34
34
  autoSelect: boolean;