@shival99/z-ui 2.0.91 → 2.0.92
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.
|
@@ -4612,7 +4612,11 @@ class ZTablePinningStylesPipe {
|
|
|
4612
4612
|
return {};
|
|
4613
4613
|
}
|
|
4614
4614
|
_colWidth(columnId, column, domWidthMap) {
|
|
4615
|
-
|
|
4615
|
+
const measuredWidth = domWidthMap?.[columnId];
|
|
4616
|
+
if (measuredWidth && measuredWidth > 0) {
|
|
4617
|
+
return measuredWidth;
|
|
4618
|
+
}
|
|
4619
|
+
return column.getSize();
|
|
4616
4620
|
}
|
|
4617
4621
|
// ─── Body ─────────────────────────────────────────────────────────────────
|
|
4618
4622
|
_getBodyPinningStyles(column, allCells, columns, domWidthMap) {
|
|
@@ -4620,6 +4624,9 @@ class ZTablePinningStylesPipe {
|
|
|
4620
4624
|
if (!isPinned) {
|
|
4621
4625
|
return this._buildPinningResult(undefined, 0, 0);
|
|
4622
4626
|
}
|
|
4627
|
+
if (!allCells?.length) {
|
|
4628
|
+
return this._buildPinningResult(isPinned, column.getStart(isPinned), column.getAfter(isPinned));
|
|
4629
|
+
}
|
|
4623
4630
|
const offsets = this._getOrBuildBodyOffsetMap(allCells, columns, domWidthMap);
|
|
4624
4631
|
const entry = offsets[column.id];
|
|
4625
4632
|
return this._buildPinningResult(isPinned, entry?.left ?? 0, entry?.right ?? 0);
|
|
@@ -4628,14 +4635,18 @@ class ZTablePinningStylesPipe {
|
|
|
4628
4635
|
if (!domWidthMap) {
|
|
4629
4636
|
return this._buildBodyOffsetMap(allCells, columns, undefined);
|
|
4630
4637
|
}
|
|
4638
|
+
const signature = this._bodyOffsetSignature(allCells);
|
|
4631
4639
|
const cached = this._offsetCache.get(domWidthMap);
|
|
4632
|
-
if (cached) {
|
|
4633
|
-
return cached;
|
|
4640
|
+
if (cached?.signature === signature) {
|
|
4641
|
+
return cached.result;
|
|
4634
4642
|
}
|
|
4635
4643
|
const result = this._buildBodyOffsetMap(allCells, columns, domWidthMap);
|
|
4636
|
-
this._offsetCache.set(domWidthMap, result);
|
|
4644
|
+
this._offsetCache.set(domWidthMap, { signature, result });
|
|
4637
4645
|
return result;
|
|
4638
4646
|
}
|
|
4647
|
+
_bodyOffsetSignature(allCells) {
|
|
4648
|
+
return (allCells ?? []).map(cell => `${cell.column.id}:${cell.column.getIsPinned() || 'center'}`).join('|');
|
|
4649
|
+
}
|
|
4639
4650
|
_buildBodyOffsetMap(allCells, columns, domWidthMap) {
|
|
4640
4651
|
if (!allCells?.length) {
|
|
4641
4652
|
return {};
|
|
@@ -4697,7 +4708,6 @@ class ZTablePinningStylesPipe {
|
|
|
4697
4708
|
return this._buildPinningResult(undefined, 0, 0);
|
|
4698
4709
|
}
|
|
4699
4710
|
const isChildPinned = this._childPinDirection(column, headerCurrent);
|
|
4700
|
-
const headerGroups = headerCurrent.headerGroup.headers;
|
|
4701
4711
|
if (isChildPinned === 'left') {
|
|
4702
4712
|
const leftOffset = this._headerLeftOffset(headerCurrent, table, domWidthMap);
|
|
4703
4713
|
return { position: 'sticky', zIndex: 1, left: `${leftOffset}px`, right: undefined };
|
|
@@ -4737,7 +4747,6 @@ class ZTablePinningStylesPipe {
|
|
|
4737
4747
|
return this._buildPinningResult(undefined, 0, 0);
|
|
4738
4748
|
}
|
|
4739
4749
|
const isChildPinned = this._childPinDirection(column, footerCurrent);
|
|
4740
|
-
const footerHeaders = footerCurrent.headerGroup.headers;
|
|
4741
4750
|
if (isChildPinned === 'left') {
|
|
4742
4751
|
const leftOffset = this._footerLeftOffset(footerCurrent, table, domWidthMap);
|
|
4743
4752
|
return { position: 'sticky', zIndex: 1, left: `${leftOffset}px`, right: undefined };
|
|
@@ -4788,33 +4797,6 @@ class ZTablePinningStylesPipe {
|
|
|
4788
4797
|
}
|
|
4789
4798
|
return new Set(leafHeaders.map(leafHeader => leafHeader.column.id));
|
|
4790
4799
|
}
|
|
4791
|
-
_headerWidth(header, allHeaders, columns, type, pinDirection, domWidthMap) {
|
|
4792
|
-
const getColSpan = type === 'header' ? getHeaderColSpan : getFooterColSpan;
|
|
4793
|
-
const shouldRender = type === 'header' ? shouldHeaderRender : shouldFooterRender;
|
|
4794
|
-
if (header.subHeaders.length > 0) {
|
|
4795
|
-
return header.subHeaders
|
|
4796
|
-
.filter(s => shouldRender(s, header.subHeaders, columns))
|
|
4797
|
-
.reduce((acc, s) => acc + this._headerWidth(s, header.subHeaders, columns, type, pinDirection, domWidthMap), 0);
|
|
4798
|
-
}
|
|
4799
|
-
if (header.column.getIsPinned() !== pinDirection) {
|
|
4800
|
-
return 0;
|
|
4801
|
-
}
|
|
4802
|
-
return this._singleHeaderWidth(header, allHeaders, columns, getColSpan, domWidthMap);
|
|
4803
|
-
}
|
|
4804
|
-
_singleHeaderWidth(header, allHeaders, columns, getColSpanFn, domWidthMap) {
|
|
4805
|
-
const config = findColumnConfig(header.column.id, columns);
|
|
4806
|
-
const colSpan = getColSpanFn(config);
|
|
4807
|
-
if (colSpan && colSpan > 1) {
|
|
4808
|
-
const idx = allHeaders.findIndex(h => h.id === header.id);
|
|
4809
|
-
let w = this._colWidth(header.column.id, header.column, domWidthMap);
|
|
4810
|
-
for (let j = 1; j < colSpan && idx + j < allHeaders.length; j++) {
|
|
4811
|
-
const next = allHeaders[idx + j];
|
|
4812
|
-
w += this._colWidth(next.column.id, next.column, domWidthMap);
|
|
4813
|
-
}
|
|
4814
|
-
return w;
|
|
4815
|
-
}
|
|
4816
|
-
return this._colWidth(header.column.id, header.column, domWidthMap);
|
|
4817
|
-
}
|
|
4818
4800
|
// ─── Result builder ───────────────────────────────────────────────────────
|
|
4819
4801
|
_buildPinningResult(isPinned, leftOffset, rightOffset) {
|
|
4820
4802
|
return {
|
|
@@ -6298,6 +6280,7 @@ class ZTableComponent {
|
|
|
6298
6280
|
}, ...(ngDevMode ? [{ debugName: "pendingColumnVisibilityDisabledMap" }] : []));
|
|
6299
6281
|
orderedHeaderGroups = computed(() => {
|
|
6300
6282
|
void this.columnPinning();
|
|
6283
|
+
void this._columnPinVersion();
|
|
6301
6284
|
void this.columnOrder();
|
|
6302
6285
|
const leftGroups = this.table.getLeftHeaderGroups();
|
|
6303
6286
|
const centerGroups = this.table.getCenterHeaderGroups();
|
|
@@ -6317,6 +6300,7 @@ class ZTableComponent {
|
|
|
6317
6300
|
}, ...(ngDevMode ? [{ debugName: "orderedHeaderGroups" }] : []));
|
|
6318
6301
|
orderedFooterGroups = computed(() => {
|
|
6319
6302
|
void this.columnPinning();
|
|
6303
|
+
void this._columnPinVersion();
|
|
6320
6304
|
void this.columnOrder();
|
|
6321
6305
|
const leftGroups = this.table.getLeftFooterGroups();
|
|
6322
6306
|
const centerGroups = this.table.getCenterFooterGroups();
|
|
@@ -6359,16 +6343,19 @@ class ZTableComponent {
|
|
|
6359
6343
|
bottomRowsReversed = computed(() => [...this.table.getBottomRows()].reverse(), ...(ngDevMode ? [{ debugName: "bottomRowsReversed" }] : []));
|
|
6360
6344
|
leftHeaderRow = computed(() => {
|
|
6361
6345
|
void this.columnPinning();
|
|
6346
|
+
void this._columnPinVersion();
|
|
6362
6347
|
void this.columnOrder();
|
|
6363
6348
|
return this.table.getLeftHeaderGroups()[0]?.headers ?? [];
|
|
6364
6349
|
}, ...(ngDevMode ? [{ debugName: "leftHeaderRow" }] : []));
|
|
6365
6350
|
centerHeaderRow = computed(() => {
|
|
6366
6351
|
void this.columnPinning();
|
|
6352
|
+
void this._columnPinVersion();
|
|
6367
6353
|
void this.columnOrder();
|
|
6368
6354
|
return this.table.getCenterHeaderGroups()[0]?.headers ?? [];
|
|
6369
6355
|
}, ...(ngDevMode ? [{ debugName: "centerHeaderRow" }] : []));
|
|
6370
6356
|
rightHeaderRow = computed(() => {
|
|
6371
6357
|
void this.columnPinning();
|
|
6358
|
+
void this._columnPinVersion();
|
|
6372
6359
|
void this.columnOrder();
|
|
6373
6360
|
return this.table.getRightHeaderGroups()[0]?.headers ?? [];
|
|
6374
6361
|
}, ...(ngDevMode ? [{ debugName: "rightHeaderRow" }] : []));
|
|
@@ -9229,13 +9216,24 @@ class ZTableComponent {
|
|
|
9229
9216
|
? [actionColumnId, ...fixedColumnPinning.left]
|
|
9230
9217
|
: fixedColumnPinning.left;
|
|
9231
9218
|
const fixedRightColumnIds = actionColumnId && actionPosition === 'right' ? [actionColumnId] : [];
|
|
9232
|
-
const normalizedPinning = normalizeZTableColumnPinning(pinning, fixedLeftColumnIds, fixedRightColumnIds);
|
|
9219
|
+
const normalizedPinning = this._sortColumnPinningByOrder(normalizeZTableColumnPinning(pinning, fixedLeftColumnIds, fixedRightColumnIds));
|
|
9233
9220
|
if (this._areColumnIdListsEqual(currentPinning.left, normalizedPinning.left) &&
|
|
9234
9221
|
this._areColumnIdListsEqual(currentPinning.right, normalizedPinning.right)) {
|
|
9235
9222
|
return;
|
|
9236
9223
|
}
|
|
9237
9224
|
this.columnPinning.set(normalizedPinning);
|
|
9238
9225
|
}
|
|
9226
|
+
_sortColumnPinningByOrder(pinning) {
|
|
9227
|
+
const order = this.columnOrder().length
|
|
9228
|
+
? this.columnOrder()
|
|
9229
|
+
: this.table.getAllLeafColumns().map(column => column.id);
|
|
9230
|
+
const orderMap = new Map(order.map((columnId, index) => [columnId, index]));
|
|
9231
|
+
const sortByOrder = (columnIds) => [...columnIds].sort((a, b) => (orderMap.get(a) ?? Number.MAX_SAFE_INTEGER) - (orderMap.get(b) ?? Number.MAX_SAFE_INTEGER));
|
|
9232
|
+
return {
|
|
9233
|
+
left: sortByOrder(pinning.left),
|
|
9234
|
+
right: sortByOrder(pinning.right),
|
|
9235
|
+
};
|
|
9236
|
+
}
|
|
9239
9237
|
_moveGroupingColumnsToLeadingDataPosition(columnIds) {
|
|
9240
9238
|
if (columnIds.length === 0) {
|
|
9241
9239
|
return;
|