@kodaris/krubble-components 1.0.64 → 1.0.66

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 => {
@@ -5982,13 +5985,8 @@
5982
5985
  }
5983
5986
  /** Renders the scrollable data grid with column headers and rows. */
5984
5987
  _renderTable() {
5985
- const wrapperStyle = {};
5986
- if (this.variant === 'card') {
5987
- // Reserve space for header row + pageSize data rows to prevent layout shift
5988
- wrapperStyle['min-height'] = `${48 + (this._pageSize * 48)}px`;
5989
- }
5990
5988
  return b `
5991
- <div class="wrapper" style=${o$1(wrapperStyle)}>
5989
+ <div class="wrapper">
5992
5990
  <div class="overlay-left"></div>
5993
5991
  <div class="overlay-right"></div>
5994
5992
  ${this._renderStatus()}
@@ -6960,6 +6958,7 @@
6960
6958
  :host(.kr-table--card) .wrapper {
6961
6959
  flex: none;
6962
6960
  overflow: visible;
6961
+ min-height: 200px;
6963
6962
  }
6964
6963
 
6965
6964
  :host(.kr-table--card) .content {