@shival99/z-ui 2.4.7 → 2.4.9
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.
- package/assets/css/global.css +0 -11
- package/fesm2022/shival99-z-ui-components-z-drawer.mjs +3 -3
- package/fesm2022/shival99-z-ui-components-z-drawer.mjs.map +1 -1
- package/fesm2022/shival99-z-ui-components-z-hover-glide.mjs +57 -41
- package/fesm2022/shival99-z-ui-components-z-hover-glide.mjs.map +1 -1
- package/fesm2022/shival99-z-ui-components-z-menu.mjs +2 -2
- package/fesm2022/shival99-z-ui-components-z-menu.mjs.map +1 -1
- package/fesm2022/shival99-z-ui-components-z-table.mjs +44 -8
- package/fesm2022/shival99-z-ui-components-z-table.mjs.map +1 -1
- package/package.json +1 -1
- package/types/shival99-z-ui-components-z-autocomplete.d.ts +1 -1
- package/types/shival99-z-ui-components-z-hover-glide.d.ts +4 -4
- package/types/shival99-z-ui-components-z-select.d.ts +2 -2
- package/types/shival99-z-ui-components-z-table.d.ts +1 -1
|
@@ -10687,15 +10687,51 @@ class ZTableComponent {
|
|
|
10687
10687
|
if (cells.length === 0) {
|
|
10688
10688
|
return null;
|
|
10689
10689
|
}
|
|
10690
|
+
// The rendered cell is constrained by `table-layout: fixed`, so its scrollWidth includes
|
|
10691
|
+
// the current column width. Measure a detached copy with all ellipsis constraints removed;
|
|
10692
|
+
// otherwise every autosize click adds the cell padding to the previous width.
|
|
10693
|
+
const measurementContainer = this._document.createElement('div');
|
|
10694
|
+
measurementContainer.className = 'z-table-autosize-measure';
|
|
10695
|
+
measurementContainer.style.cssText =
|
|
10696
|
+
'position:absolute;left:-100000px;top:-100000px;width:max-content;height:0;overflow:visible;visibility:hidden;pointer-events:none;';
|
|
10697
|
+
host.appendChild(measurementContainer);
|
|
10690
10698
|
let width = 0;
|
|
10691
|
-
|
|
10692
|
-
|
|
10693
|
-
|
|
10694
|
-
|
|
10695
|
-
|
|
10696
|
-
|
|
10697
|
-
|
|
10698
|
-
|
|
10699
|
+
try {
|
|
10700
|
+
for (let index = 0; index < cells.length; index++) {
|
|
10701
|
+
const cell = cells.item(index);
|
|
10702
|
+
const clone = cell.cloneNode(true);
|
|
10703
|
+
clone.style.setProperty('display', 'inline-block', 'important');
|
|
10704
|
+
clone.style.setProperty('position', 'absolute', 'important');
|
|
10705
|
+
clone.style.setProperty('width', 'max-content', 'important');
|
|
10706
|
+
clone.style.setProperty('min-width', '0', 'important');
|
|
10707
|
+
clone.style.setProperty('max-width', 'none', 'important');
|
|
10708
|
+
clone.style.setProperty('overflow', 'visible', 'important');
|
|
10709
|
+
clone.style.setProperty('white-space', 'nowrap', 'important');
|
|
10710
|
+
const cloneElements = [clone, ...clone.querySelectorAll('*')];
|
|
10711
|
+
for (const element of cloneElements) {
|
|
10712
|
+
element.style.setProperty('width', 'max-content', 'important');
|
|
10713
|
+
element.style.setProperty('max-width', 'none', 'important');
|
|
10714
|
+
element.style.setProperty('overflow', 'visible', 'important');
|
|
10715
|
+
element.style.setProperty('text-overflow', 'clip', 'important');
|
|
10716
|
+
element.style.setProperty('white-space', 'nowrap', 'important');
|
|
10717
|
+
}
|
|
10718
|
+
measurementContainer.appendChild(clone);
|
|
10719
|
+
const intrinsicWidth = cloneElements.reduce((maxWidth, element) => {
|
|
10720
|
+
return Math.max(maxWidth, element.scrollWidth);
|
|
10721
|
+
}, 0);
|
|
10722
|
+
const cellStyle = getComputedStyle(cell);
|
|
10723
|
+
const horizontalInset = Number.parseFloat(cellStyle.paddingLeft) +
|
|
10724
|
+
Number.parseFloat(cellStyle.paddingRight) +
|
|
10725
|
+
Number.parseFloat(cellStyle.borderLeftWidth) +
|
|
10726
|
+
Number.parseFloat(cellStyle.borderRightWidth);
|
|
10727
|
+
width = Math.max(width, Math.ceil(intrinsicWidth + horizontalInset));
|
|
10728
|
+
clone.remove();
|
|
10729
|
+
}
|
|
10730
|
+
}
|
|
10731
|
+
finally {
|
|
10732
|
+
measurementContainer.remove();
|
|
10733
|
+
}
|
|
10734
|
+
return width > 0 ? width : null;
|
|
10699
10735
|
}
|
|
10700
10736
|
_defaultColumnPinning() {
|
|
10701
10737
|
const initialPinning = this.zConfig().initialState?.columnPinning;
|