@kodaris/krubble-components 1.0.65 → 1.0.67

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.
@@ -4805,6 +4805,23 @@
4805
4805
  this.classList.toggle('kr-table--card', this.variant === 'card');
4806
4806
  this._updateScrollFlags();
4807
4807
  this._syncSlottedContent();
4808
+ this._lockColumnWidths();
4809
+ }
4810
+ /** Measures header cell widths and locks them to prevent column shift on subsequent data changes. */
4811
+ _lockColumnWidths() {
4812
+ if (this._columnWidthsLocked || this._data.length === 0)
4813
+ return;
4814
+ const headerCells = this.shadowRoot?.querySelectorAll('.header-row > .header-cell');
4815
+ if (!headerCells)
4816
+ return;
4817
+ const cols = this.getDisplayedColumns();
4818
+ headerCells.forEach((cell, i) => {
4819
+ const cellWidth = cell.offsetWidth;
4820
+ if (i < cols.length && !cols[i].width && cols[i].type !== 'actions' && cellWidth > 0) {
4821
+ cols[i].width = `${cellWidth}px`;
4822
+ this._columnWidthsLocked = true;
4823
+ }
4824
+ });
4808
4825
  }
4809
4826
  /** Syncs light DOM content for cells with custom render functions */
4810
4827
  _syncSlottedContent() {
@@ -4978,20 +4995,6 @@
4978
4995
  }
4979
4996
  }
4980
4997
  this._dataState = 'success';
4981
- if (!this._columnWidthsLocked) {
4982
- requestAnimationFrame(() => {
4983
- const headerCells = this.shadowRoot?.querySelectorAll('.header-row > .header-cell');
4984
- if (headerCells) {
4985
- const cols = this.getDisplayedColumns();
4986
- headerCells.forEach((cell, i) => {
4987
- if (i < cols.length && !cols[i].width && cols[i].type !== 'actions') {
4988
- cols[i].width = `${cell.offsetWidth}px`;
4989
- }
4990
- });
4991
- }
4992
- this._columnWidthsLocked = true;
4993
- });
4994
- }
4995
4998
  this._updateSearchPosition();
4996
4999
  })
4997
5000
  .catch(err => {