fantasy-ngzorro 2.2.37 → 2.2.38
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/bundles/fantasy-ngzorro.umd.js +313 -222
- package/bundles/fantasy-ngzorro.umd.js.map +1 -1
- package/bundles/fantasy-ngzorro.umd.min.js +1 -1
- package/bundles/fantasy-ngzorro.umd.min.js.map +1 -1
- package/esm2015/hd-table/hd-table.component.js +234 -196
- package/esm2015/utils/hd-table-scroll.util.js +3 -2
- package/esm5/hd-table/hd-table.component.js +312 -222
- package/esm5/utils/hd-table-scroll.util.js +3 -2
- package/fantasy-ngzorro.metadata.json +1 -1
- package/fesm2015/fantasy-ngzorro.js +235 -196
- package/fesm2015/fantasy-ngzorro.js.map +1 -1
- package/fesm5/fantasy-ngzorro.js +313 -222
- package/fesm5/fantasy-ngzorro.js.map +1 -1
- package/hd-table/hd-table.component.d.ts +24 -21
- package/package.json +2 -2
- package/utils/hd-table-scroll.util.d.ts +4 -1
package/fesm5/fantasy-ngzorro.js
CHANGED
|
@@ -1298,7 +1298,8 @@ function getTableScrollXViewportWidth(nzTable, hostClass) {
|
|
|
1298
1298
|
return getTableViewportWidth(nzTable, hostClass);
|
|
1299
1299
|
}
|
|
1300
1300
|
/**
|
|
1301
|
-
* 无数据或列宽未超出容器时不启用横向 scroll
|
|
1301
|
+
* 无数据或列宽未超出容器时不启用横向 scroll(表宽 100%、table-layout: auto)。
|
|
1302
|
+
* auto 布局下单元格 max-width 不生效,固定宽列会被均摊撑开;需要锁宽的场景见 hd-table 的横向布局。
|
|
1302
1303
|
* @param {?} nzTable
|
|
1303
1304
|
* @param {?} hasData
|
|
1304
1305
|
* @param {?=} colWidth
|
|
@@ -10747,6 +10748,67 @@ if (false) {
|
|
|
10747
10748
|
* @fileoverview added by tsickle
|
|
10748
10749
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
10749
10750
|
*/
|
|
10751
|
+
/**
|
|
10752
|
+
* 勾选列宽(px),与模板 nzWidth、less 兜底保持一致
|
|
10753
|
+
* @type {?}
|
|
10754
|
+
*/
|
|
10755
|
+
var SELECT_COL_WIDTH = 40;
|
|
10756
|
+
/**
|
|
10757
|
+
* 横向布局计算结果
|
|
10758
|
+
* @record
|
|
10759
|
+
*/
|
|
10760
|
+
function HdTableHorizontalLayout() { }
|
|
10761
|
+
if (false) {
|
|
10762
|
+
/**
|
|
10763
|
+
* 传给 nzScroll.x;只有列宽总和 <= 0 时为 null
|
|
10764
|
+
* @type {?}
|
|
10765
|
+
*/
|
|
10766
|
+
HdTableHorizontalLayout.prototype.scrollX;
|
|
10767
|
+
/**
|
|
10768
|
+
* 补到最后一列业务列上的宽度,列多时为 0
|
|
10769
|
+
* @type {?}
|
|
10770
|
+
*/
|
|
10771
|
+
HdTableHorizontalLayout.prototype.fluidExtra;
|
|
10772
|
+
/**
|
|
10773
|
+
* 实际渲染总宽 = 声明总宽 + fluidExtra
|
|
10774
|
+
* @type {?}
|
|
10775
|
+
*/
|
|
10776
|
+
HdTableHorizontalLayout.prototype.displayTotal;
|
|
10777
|
+
/**
|
|
10778
|
+
* 列少、靠补宽吃满容器,不需要真正横滚
|
|
10779
|
+
* @type {?}
|
|
10780
|
+
*/
|
|
10781
|
+
HdTableHorizontalLayout.prototype.isFluid;
|
|
10782
|
+
}
|
|
10783
|
+
/**
|
|
10784
|
+
* 列多(或量不到容器宽):scroll.x = 声明总宽,正常横滚
|
|
10785
|
+
* @param {?} declaredWidth
|
|
10786
|
+
* @return {?}
|
|
10787
|
+
*/
|
|
10788
|
+
function fixedLayout(declaredWidth) {
|
|
10789
|
+
return {
|
|
10790
|
+
scrollX: Math.ceil(declaredWidth) + "px",
|
|
10791
|
+
fluidExtra: 0,
|
|
10792
|
+
displayTotal: declaredWidth,
|
|
10793
|
+
isFluid: false,
|
|
10794
|
+
};
|
|
10795
|
+
}
|
|
10796
|
+
/**
|
|
10797
|
+
* 列少:scroll.x = 容器宽,差额补到最后一列业务列
|
|
10798
|
+
* @param {?} containerWidth
|
|
10799
|
+
* @param {?} declaredWidth
|
|
10800
|
+
* @return {?}
|
|
10801
|
+
*/
|
|
10802
|
+
function fluidLayout(containerWidth, declaredWidth) {
|
|
10803
|
+
/** @type {?} */
|
|
10804
|
+
var fluidExtra = Math.max(0, containerWidth - declaredWidth);
|
|
10805
|
+
return {
|
|
10806
|
+
scrollX: containerWidth + "px",
|
|
10807
|
+
fluidExtra: fluidExtra,
|
|
10808
|
+
displayTotal: declaredWidth + fluidExtra,
|
|
10809
|
+
isFluid: true,
|
|
10810
|
+
};
|
|
10811
|
+
}
|
|
10750
10812
|
var HdTableComponent = /** @class */ (function () {
|
|
10751
10813
|
function HdTableComponent(hostEl, cdr, commonSessionService) {
|
|
10752
10814
|
var _this = this;
|
|
@@ -10832,21 +10894,19 @@ var HdTableComponent = /** @class */ (function () {
|
|
|
10832
10894
|
*/
|
|
10833
10895
|
this.virtualScrollActive = null;
|
|
10834
10896
|
/**
|
|
10835
|
-
*
|
|
10897
|
+
* 实际渲染列宽合计(含勾选/序号 + 补宽),合计 footer 表宽用
|
|
10836
10898
|
*/
|
|
10837
10899
|
this.tableColWidthTotal = 0;
|
|
10838
10900
|
/**
|
|
10839
|
-
*
|
|
10840
|
-
* 并设 scroll.x = 容器宽,避免表宽 100% 均摊撑开勾选列;拖拽改宽仍写 col.width。
|
|
10901
|
+
* 补到 fluidExtraTargetCol 上的宽度;只影响展示,不写回 col.width(列宽缓存、拖拽仍用声明宽)
|
|
10841
10902
|
*/
|
|
10842
10903
|
this.fluidExtraWidth = 0;
|
|
10843
10904
|
/**
|
|
10844
|
-
*
|
|
10845
|
-
* 用于关掉 ng-zorro fixed-header 带来的常驻 X 轴滚动条。
|
|
10905
|
+
* 列少、靠补宽吃满容器:模板据此加 hd-table--fluid-x,隐藏 fixed-header 常驻的横滚槽
|
|
10846
10906
|
*/
|
|
10847
10907
|
this.fluidHorizontal = false;
|
|
10848
10908
|
/**
|
|
10849
|
-
*
|
|
10909
|
+
* 接收补宽的列,缓存起来避免模板每个单元格都扫一遍 tableCols
|
|
10850
10910
|
*/
|
|
10851
10911
|
this.fluidExtraTargetCol = null;
|
|
10852
10912
|
/**
|
|
@@ -11070,10 +11130,8 @@ var HdTableComponent = /** @class */ (function () {
|
|
|
11070
11130
|
changes["tableData"]["currentValue"]["pageNumber"] !==
|
|
11071
11131
|
changes["tableData"]["previousValue"]["pageNumber"]) {
|
|
11072
11132
|
this.pendingResetScrollTop = true;
|
|
11073
|
-
// pageSize
|
|
11074
|
-
//
|
|
11075
|
-
// virtualScroll=false 时若这里跳过,空表初始化后的 fluid 不会补上,勾选列被撑开。
|
|
11076
|
-
// applyTableScrollMode(false) 在模式未变时只 dealScroll,不会强制重建清排序态。
|
|
11133
|
+
// 业务可能把 Page.pageSize 写成 content.length,换数据时就会走到这里,
|
|
11134
|
+
// 必须重算横向布局。滚动模式不变时不会重建,排序态不会被清掉。
|
|
11077
11135
|
this.applyTableScrollMode(false);
|
|
11078
11136
|
// 翻页/改 pageSize:主动多次复位,覆盖 CDK 异步渲染时序
|
|
11079
11137
|
this.scheduleResetTableBodyScrollTop();
|
|
@@ -11085,9 +11143,7 @@ var HdTableComponent = /** @class */ (function () {
|
|
|
11085
11143
|
}
|
|
11086
11144
|
if (changes["tableData"]) {
|
|
11087
11145
|
this.pendingResetScrollTop = true;
|
|
11088
|
-
//
|
|
11089
|
-
// 收款/付款编辑等页 [virtualScroll]=false + 异步灌数据:原先跳过会导致
|
|
11090
|
-
// 空表初始化后不再补宽,勾选列被均摊撑开。
|
|
11146
|
+
// 不论是否虚拟滚动,数据变化后都要重算横向布局
|
|
11091
11147
|
this.applyTableScrollMode(false);
|
|
11092
11148
|
// 数据更新后复位纵向滚动(含虚拟滚动场景)
|
|
11093
11149
|
this.scheduleResetTableBodyScrollTop();
|
|
@@ -11328,13 +11384,13 @@ var HdTableComponent = /** @class */ (function () {
|
|
|
11328
11384
|
return col.fixed === "left" ? (col.fixedWidth || 0) + "px" : null;
|
|
11329
11385
|
};
|
|
11330
11386
|
Object.defineProperty(HdTableComponent.prototype, "lineNumberLeft", {
|
|
11331
|
-
/** 开启合计时序号列的 left
|
|
11387
|
+
/** 开启合计时序号列的 left(跟在勾选列后面) */
|
|
11332
11388
|
get: /**
|
|
11333
|
-
* 开启合计时序号列的 left
|
|
11389
|
+
* 开启合计时序号列的 left(跟在勾选列后面)
|
|
11334
11390
|
* @return {?}
|
|
11335
11391
|
*/
|
|
11336
11392
|
function () {
|
|
11337
|
-
return this.showSelected ?
|
|
11393
|
+
return (this.showSelected ? SELECT_COL_WIDTH : 0) + "px";
|
|
11338
11394
|
},
|
|
11339
11395
|
enumerable: true,
|
|
11340
11396
|
configurable: true
|
|
@@ -11365,64 +11421,141 @@ var HdTableComponent = /** @class */ (function () {
|
|
|
11365
11421
|
enumerable: true,
|
|
11366
11422
|
configurable: true
|
|
11367
11423
|
});
|
|
11368
|
-
/** 展示用列宽:fluid 时最后一列业务列 = 声明宽 + fluidExtraWidth */
|
|
11369
11424
|
/**
|
|
11370
|
-
*
|
|
11425
|
+
* @private
|
|
11426
|
+
* @param {?} col
|
|
11427
|
+
* @return {?}
|
|
11428
|
+
*/
|
|
11429
|
+
HdTableComponent.prototype.isColVisible = /**
|
|
11430
|
+
* @private
|
|
11431
|
+
* @param {?} col
|
|
11432
|
+
* @return {?}
|
|
11433
|
+
*/
|
|
11434
|
+
function (col) {
|
|
11435
|
+
return !!col && col.isShow !== false;
|
|
11436
|
+
};
|
|
11437
|
+
/** 业务列声明宽:未配置时按 fixColWidth */
|
|
11438
|
+
/**
|
|
11439
|
+
* 业务列声明宽:未配置时按 fixColWidth
|
|
11440
|
+
* @private
|
|
11441
|
+
* @param {?} col
|
|
11442
|
+
* @return {?}
|
|
11443
|
+
*/
|
|
11444
|
+
HdTableComponent.prototype.getColDeclaredWidth = /**
|
|
11445
|
+
* 业务列声明宽:未配置时按 fixColWidth
|
|
11446
|
+
* @private
|
|
11447
|
+
* @param {?} col
|
|
11448
|
+
* @return {?}
|
|
11449
|
+
*/
|
|
11450
|
+
function (col) {
|
|
11451
|
+
return col && col.width > 0 ? col.width : ColWidth.fixColWidth;
|
|
11452
|
+
};
|
|
11453
|
+
/** 声明列宽合计:勾选列 + 序号列 + 可见业务列,不含补宽 */
|
|
11454
|
+
/**
|
|
11455
|
+
* 声明列宽合计:勾选列 + 序号列 + 可见业务列,不含补宽
|
|
11456
|
+
* @private
|
|
11457
|
+
* @return {?}
|
|
11458
|
+
*/
|
|
11459
|
+
HdTableComponent.prototype.getDeclaredColWidthTotal = /**
|
|
11460
|
+
* 声明列宽合计:勾选列 + 序号列 + 可见业务列,不含补宽
|
|
11461
|
+
* @private
|
|
11462
|
+
* @return {?}
|
|
11463
|
+
*/
|
|
11464
|
+
function () {
|
|
11465
|
+
var _this = this;
|
|
11466
|
+
/** @type {?} */
|
|
11467
|
+
var total = 0;
|
|
11468
|
+
if (this.showSelected) {
|
|
11469
|
+
total += SELECT_COL_WIDTH;
|
|
11470
|
+
}
|
|
11471
|
+
if (this.showTableTotal) {
|
|
11472
|
+
total += this.lineNumberColWidth;
|
|
11473
|
+
}
|
|
11474
|
+
(this.tableCols || []).forEach((/**
|
|
11475
|
+
* @param {?} col
|
|
11476
|
+
* @return {?}
|
|
11477
|
+
*/
|
|
11478
|
+
function (col) {
|
|
11479
|
+
if (_this.isColVisible(col)) {
|
|
11480
|
+
total += _this.getColDeclaredWidth(col);
|
|
11481
|
+
}
|
|
11482
|
+
}));
|
|
11483
|
+
return total;
|
|
11484
|
+
};
|
|
11485
|
+
/** 模板里 th / td / 合计 col 用的列宽:补宽目标列 = 声明宽 + fluidExtraWidth */
|
|
11486
|
+
/**
|
|
11487
|
+
* 模板里 th / td / 合计 col 用的列宽:补宽目标列 = 声明宽 + fluidExtraWidth
|
|
11371
11488
|
* @param {?} col
|
|
11372
11489
|
* @return {?}
|
|
11373
11490
|
*/
|
|
11374
11491
|
HdTableComponent.prototype.getColDisplayWidth = /**
|
|
11375
|
-
*
|
|
11492
|
+
* 模板里 th / td / 合计 col 用的列宽:补宽目标列 = 声明宽 + fluidExtraWidth
|
|
11376
11493
|
* @param {?} col
|
|
11377
11494
|
* @return {?}
|
|
11378
11495
|
*/
|
|
11379
11496
|
function (col) {
|
|
11380
11497
|
/** @type {?} */
|
|
11381
|
-
var
|
|
11382
|
-
|
|
11383
|
-
|
|
11384
|
-
if (this.fluidExtraWidth <= 0 ||
|
|
11385
|
-
!col ||
|
|
11386
|
-
!this.fluidExtraTargetCol ||
|
|
11387
|
-
col !== this.fluidExtraTargetCol) {
|
|
11388
|
-
return base;
|
|
11498
|
+
var declared = this.getColDeclaredWidth(col);
|
|
11499
|
+
if (this.fluidExtraWidth > 0 && col && col === this.fluidExtraTargetCol) {
|
|
11500
|
+
return declared + this.fluidExtraWidth;
|
|
11389
11501
|
}
|
|
11390
|
-
return
|
|
11502
|
+
return declared;
|
|
11391
11503
|
};
|
|
11392
|
-
/** 按当前 layout 刷新 fluid 补宽目标列(仅 dealScroll / sync 时调用) */
|
|
11393
11504
|
/**
|
|
11394
|
-
*
|
|
11505
|
+
* 选出接收补宽的列:优先最后一列「非右侧固定」的可见列,
|
|
11506
|
+
* 避免把操作列等右固定列拉宽;全是右固定列时退回最后一列可见列。
|
|
11507
|
+
*/
|
|
11508
|
+
/**
|
|
11509
|
+
* 选出接收补宽的列:优先最后一列「非右侧固定」的可见列,
|
|
11510
|
+
* 避免把操作列等右固定列拉宽;全是右固定列时退回最后一列可见列。
|
|
11395
11511
|
* @private
|
|
11396
11512
|
* @return {?}
|
|
11397
11513
|
*/
|
|
11398
|
-
HdTableComponent.prototype.
|
|
11399
|
-
*
|
|
11514
|
+
HdTableComponent.prototype.findFluidExtraTargetCol = /**
|
|
11515
|
+
* 选出接收补宽的列:优先最后一列「非右侧固定」的可见列,
|
|
11516
|
+
* 避免把操作列等右固定列拉宽;全是右固定列时退回最后一列可见列。
|
|
11400
11517
|
* @private
|
|
11401
11518
|
* @return {?}
|
|
11402
11519
|
*/
|
|
11403
11520
|
function () {
|
|
11404
|
-
|
|
11405
|
-
|
|
11406
|
-
|
|
11407
|
-
|
|
11408
|
-
|
|
11409
|
-
}
|
|
11410
|
-
for (var i = this.tableCols.length - 1; i >= 0; i--) {
|
|
11521
|
+
/** @type {?} */
|
|
11522
|
+
var cols = this.tableCols || [];
|
|
11523
|
+
/** @type {?} */
|
|
11524
|
+
var lastVisible = null;
|
|
11525
|
+
for (var i = cols.length - 1; i >= 0; i--) {
|
|
11411
11526
|
/** @type {?} */
|
|
11412
|
-
var
|
|
11413
|
-
if (
|
|
11414
|
-
|
|
11415
|
-
return;
|
|
11527
|
+
var col = cols[i];
|
|
11528
|
+
if (!this.isColVisible(col)) {
|
|
11529
|
+
continue;
|
|
11416
11530
|
}
|
|
11417
|
-
|
|
11418
|
-
|
|
11419
|
-
|
|
11420
|
-
|
|
11421
|
-
|
|
11422
|
-
this.fluidExtraTargetCol = c;
|
|
11423
|
-
return;
|
|
11531
|
+
if (col.fixed !== "right") {
|
|
11532
|
+
return col;
|
|
11533
|
+
}
|
|
11534
|
+
if (!lastVisible) {
|
|
11535
|
+
lastVisible = col;
|
|
11424
11536
|
}
|
|
11425
11537
|
}
|
|
11538
|
+
return lastVisible;
|
|
11539
|
+
};
|
|
11540
|
+
/** 把横向布局结果写回组件状态(dealScroll / syncHorizontalScroll 共用) */
|
|
11541
|
+
/**
|
|
11542
|
+
* 把横向布局结果写回组件状态(dealScroll / syncHorizontalScroll 共用)
|
|
11543
|
+
* @private
|
|
11544
|
+
* @param {?} layout
|
|
11545
|
+
* @return {?}
|
|
11546
|
+
*/
|
|
11547
|
+
HdTableComponent.prototype.applyHorizontalLayout = /**
|
|
11548
|
+
* 把横向布局结果写回组件状态(dealScroll / syncHorizontalScroll 共用)
|
|
11549
|
+
* @private
|
|
11550
|
+
* @param {?} layout
|
|
11551
|
+
* @return {?}
|
|
11552
|
+
*/
|
|
11553
|
+
function (layout) {
|
|
11554
|
+
this.fluidExtraWidth = layout.fluidExtra;
|
|
11555
|
+
this.fluidHorizontal = layout.isFluid;
|
|
11556
|
+
this.fluidExtraTargetCol =
|
|
11557
|
+
layout.fluidExtra > 0 ? this.findFluidExtraTargetCol() : null;
|
|
11558
|
+
this.tableColWidthTotal = layout.displayTotal;
|
|
11426
11559
|
};
|
|
11427
11560
|
Object.defineProperty(HdTableComponent.prototype, "totalFooterTableWidth", {
|
|
11428
11561
|
/** fluid → 100%;固定 → scroll.x(与表体同一套横向宽度) */
|
|
@@ -11550,7 +11683,6 @@ var HdTableComponent = /** @class */ (function () {
|
|
|
11550
11683
|
* @return {?}
|
|
11551
11684
|
*/
|
|
11552
11685
|
function (forceRemount) {
|
|
11553
|
-
var _this = this;
|
|
11554
11686
|
if (forceRemount === void 0) { forceRemount = false; }
|
|
11555
11687
|
/** @type {?} */
|
|
11556
11688
|
var useVirtual = this.useVirtualScroll;
|
|
@@ -11563,23 +11695,7 @@ var HdTableComponent = /** @class */ (function () {
|
|
|
11563
11695
|
// ng-zorro 只在 AfterViewInit 绑一次 header/body 的 scroll 同步;
|
|
11564
11696
|
// 若先以 y=null 创建再改成有 y,表头监听会丢,表现为列头不跟着横滚。
|
|
11565
11697
|
this.presetScrollBeforeRemount(useVirtual);
|
|
11566
|
-
this.
|
|
11567
|
-
this.cdr.markForCheck();
|
|
11568
|
-
setTimeout((/**
|
|
11569
|
-
* @return {?}
|
|
11570
|
-
*/
|
|
11571
|
-
function () {
|
|
11572
|
-
_this.showTable = true;
|
|
11573
|
-
_this.cdr.markForCheck();
|
|
11574
|
-
setTimeout((/**
|
|
11575
|
-
* @return {?}
|
|
11576
|
-
*/
|
|
11577
|
-
function () {
|
|
11578
|
-
_this.dealScroll();
|
|
11579
|
-
_this.cdr.markForCheck();
|
|
11580
|
-
_this.afterTableRender(useVirtual);
|
|
11581
|
-
}));
|
|
11582
|
-
}));
|
|
11698
|
+
this.remountTable(useVirtual);
|
|
11583
11699
|
return;
|
|
11584
11700
|
}
|
|
11585
11701
|
/** @type {?} */
|
|
@@ -11591,32 +11707,48 @@ var HdTableComponent = /** @class */ (function () {
|
|
|
11591
11707
|
var nextHasX = !!(this.scroll && this.scroll.x);
|
|
11592
11708
|
/** @type {?} */
|
|
11593
11709
|
var nextHasY = !!(this.scroll && this.scroll.y);
|
|
11594
|
-
//
|
|
11595
|
-
// - y:ng-zorro 只在 AfterViewInit
|
|
11596
|
-
// - x
|
|
11597
|
-
// 不重建时勾选列仍按 auto 均摊撑开(收款编辑等异步灌数页)
|
|
11710
|
+
// scroll.x / scroll.y 从无到有(或反过来)时必须重建,原地改值不生效:
|
|
11711
|
+
// - y:ng-zorro 8 只在 AfterViewInit 绑一次表头/表体滚动同步,且决定表头是否拆成独立 table
|
|
11712
|
+
// - x:决定是否带 ant-table-fixed(table-layout: fixed),勾选列锁宽依赖它
|
|
11598
11713
|
if (prevHasY !== nextHasY || prevHasX !== nextHasX) {
|
|
11599
|
-
this.
|
|
11600
|
-
|
|
11714
|
+
this.remountTable(useVirtual);
|
|
11715
|
+
return;
|
|
11716
|
+
}
|
|
11717
|
+
this.cdr.markForCheck();
|
|
11718
|
+
this.afterTableRender(useVirtual);
|
|
11719
|
+
};
|
|
11720
|
+
/** 销毁并重建 nz-table:等 DOM 出来后再按真实容器宽重算一次横向布局 */
|
|
11721
|
+
/**
|
|
11722
|
+
* 销毁并重建 nz-table:等 DOM 出来后再按真实容器宽重算一次横向布局
|
|
11723
|
+
* @private
|
|
11724
|
+
* @param {?} useVirtual
|
|
11725
|
+
* @return {?}
|
|
11726
|
+
*/
|
|
11727
|
+
HdTableComponent.prototype.remountTable = /**
|
|
11728
|
+
* 销毁并重建 nz-table:等 DOM 出来后再按真实容器宽重算一次横向布局
|
|
11729
|
+
* @private
|
|
11730
|
+
* @param {?} useVirtual
|
|
11731
|
+
* @return {?}
|
|
11732
|
+
*/
|
|
11733
|
+
function (useVirtual) {
|
|
11734
|
+
var _this = this;
|
|
11735
|
+
this.showTable = false;
|
|
11736
|
+
this.cdr.markForCheck();
|
|
11737
|
+
setTimeout((/**
|
|
11738
|
+
* @return {?}
|
|
11739
|
+
*/
|
|
11740
|
+
function () {
|
|
11741
|
+
_this.showTable = true;
|
|
11742
|
+
_this.cdr.markForCheck();
|
|
11601
11743
|
setTimeout((/**
|
|
11602
11744
|
* @return {?}
|
|
11603
11745
|
*/
|
|
11604
11746
|
function () {
|
|
11605
|
-
_this.
|
|
11747
|
+
_this.dealScroll();
|
|
11606
11748
|
_this.cdr.markForCheck();
|
|
11607
|
-
|
|
11608
|
-
* @return {?}
|
|
11609
|
-
*/
|
|
11610
|
-
function () {
|
|
11611
|
-
_this.dealScroll();
|
|
11612
|
-
_this.cdr.markForCheck();
|
|
11613
|
-
_this.afterTableRender(useVirtual);
|
|
11614
|
-
}));
|
|
11749
|
+
_this.afterTableRender(useVirtual);
|
|
11615
11750
|
}));
|
|
11616
|
-
|
|
11617
|
-
}
|
|
11618
|
-
this.cdr.markForCheck();
|
|
11619
|
-
this.afterTableRender(useVirtual);
|
|
11751
|
+
}));
|
|
11620
11752
|
};
|
|
11621
11753
|
/** 重建前预设 scroll,保证 AfterViewInit 时 header/body 结构已正确 */
|
|
11622
11754
|
/**
|
|
@@ -12481,48 +12613,62 @@ var HdTableComponent = /** @class */ (function () {
|
|
|
12481
12613
|
function (maxOffset) {
|
|
12482
12614
|
return "calc(100vh - " + maxOffset + "px)";
|
|
12483
12615
|
};
|
|
12484
|
-
|
|
12485
|
-
*
|
|
12486
|
-
*
|
|
12487
|
-
|
|
12488
|
-
|
|
12489
|
-
*
|
|
12490
|
-
*
|
|
12491
|
-
|
|
12492
|
-
|
|
12493
|
-
|
|
12494
|
-
|
|
12495
|
-
|
|
12496
|
-
|
|
12497
|
-
|
|
12498
|
-
*
|
|
12499
|
-
|
|
12500
|
-
|
|
12501
|
-
|
|
12502
|
-
|
|
12503
|
-
|
|
12504
|
-
|
|
12505
|
-
|
|
12506
|
-
|
|
12507
|
-
|
|
12508
|
-
|
|
12509
|
-
|
|
12616
|
+
/*
|
|
12617
|
+
* 横向布局(勾选列锁 40px 的关键)
|
|
12618
|
+
*
|
|
12619
|
+
* 勾选列只有在 table-layout: fixed 下才锁得住:ng-zorro 8 仅在 nzScroll.x 有值时
|
|
12620
|
+
* 给 table 加 ant-table-fixed;auto 布局下 table 宽 100%、每列都有 nzWidth,
|
|
12621
|
+
* 剩余空间会按比例摊到所有列(含勾选列),单元格上的 max-width 也不生效。
|
|
12622
|
+
* 所以只要有列(无论有没有数据)就一定设置 scroll.x:
|
|
12623
|
+
* - 列少:scroll.x = 容器宽,差额补到最后一列业务列(fluid,不出真横滚)
|
|
12624
|
+
* - 列多:scroll.x = 声明总宽,正常横滚
|
|
12625
|
+
* less 里勾选列的 40px 只是 fixed 布局下的兜底。
|
|
12626
|
+
*/
|
|
12627
|
+
/**
|
|
12628
|
+
* 按声明列宽合计 + 容器宽算出横向布局。
|
|
12629
|
+
* 判断「是否超宽」用 offsetWidth(含竖滚条槽),避免只因竖滚条就误开横滚;
|
|
12630
|
+
* 补宽目标用 clientWidth 并向下取整,避免表宽多 1px 逼出横滚条。
|
|
12631
|
+
*/
|
|
12632
|
+
/*
|
|
12633
|
+
* 横向布局(勾选列锁 40px 的关键)
|
|
12634
|
+
*
|
|
12635
|
+
* 勾选列只有在 table-layout: fixed 下才锁得住:ng-zorro 8 仅在 nzScroll.x 有值时
|
|
12636
|
+
* 给 table 加 ant-table-fixed;auto 布局下 table 宽 100%、每列都有 nzWidth,
|
|
12637
|
+
* 剩余空间会按比例摊到所有列(含勾选列),单元格上的 max-width 也不生效。
|
|
12638
|
+
* 所以只要有列(无论有没有数据)就一定设置 scroll.x:
|
|
12639
|
+
* - 列少:scroll.x = 容器宽,差额补到最后一列业务列(fluid,不出真横滚)
|
|
12640
|
+
* - 列多:scroll.x = 声明总宽,正常横滚
|
|
12641
|
+
* less 里勾选列的 40px 只是 fixed 布局下的兜底。
|
|
12642
|
+
*/
|
|
12643
|
+
/**
|
|
12644
|
+
* 按声明列宽合计 + 容器宽算出横向布局。
|
|
12645
|
+
* 判断「是否超宽」用 offsetWidth(含竖滚条槽),避免只因竖滚条就误开横滚;
|
|
12646
|
+
* 补宽目标用 clientWidth 并向下取整,避免表宽多 1px 逼出横滚条。
|
|
12510
12647
|
* @private
|
|
12511
12648
|
* @param {?} declaredColWidth
|
|
12512
12649
|
* @return {?}
|
|
12513
12650
|
*/
|
|
12514
|
-
HdTableComponent.prototype.resolveHorizontalLayout =
|
|
12515
|
-
|
|
12516
|
-
|
|
12517
|
-
|
|
12518
|
-
|
|
12519
|
-
|
|
12651
|
+
HdTableComponent.prototype.resolveHorizontalLayout = /*
|
|
12652
|
+
* 横向布局(勾选列锁 40px 的关键)
|
|
12653
|
+
*
|
|
12654
|
+
* 勾选列只有在 table-layout: fixed 下才锁得住:ng-zorro 8 仅在 nzScroll.x 有值时
|
|
12655
|
+
* 给 table 加 ant-table-fixed;auto 布局下 table 宽 100%、每列都有 nzWidth,
|
|
12656
|
+
* 剩余空间会按比例摊到所有列(含勾选列),单元格上的 max-width 也不生效。
|
|
12657
|
+
* 所以只要有列(无论有没有数据)就一定设置 scroll.x:
|
|
12658
|
+
* - 列少:scroll.x = 容器宽,差额补到最后一列业务列(fluid,不出真横滚)
|
|
12659
|
+
* - 列多:scroll.x = 声明总宽,正常横滚
|
|
12660
|
+
* less 里勾选列的 40px 只是 fixed 布局下的兜底。
|
|
12661
|
+
*/
|
|
12662
|
+
/**
|
|
12663
|
+
* 按声明列宽合计 + 容器宽算出横向布局。
|
|
12664
|
+
* 判断「是否超宽」用 offsetWidth(含竖滚条槽),避免只因竖滚条就误开横滚;
|
|
12665
|
+
* 补宽目标用 clientWidth 并向下取整,避免表宽多 1px 逼出横滚条。
|
|
12520
12666
|
* @private
|
|
12521
12667
|
* @param {?} declaredColWidth
|
|
12522
12668
|
* @return {?}
|
|
12523
12669
|
*/
|
|
12524
12670
|
function (declaredColWidth) {
|
|
12525
|
-
if (
|
|
12671
|
+
if (declaredColWidth <= 0) {
|
|
12526
12672
|
return {
|
|
12527
12673
|
scrollX: null,
|
|
12528
12674
|
fluidExtra: 0,
|
|
@@ -12531,115 +12677,63 @@ var HdTableComponent = /** @class */ (function () {
|
|
|
12531
12677
|
};
|
|
12532
12678
|
}
|
|
12533
12679
|
/** @type {?} */
|
|
12534
|
-
var
|
|
12680
|
+
var compareWidth = this.nzTableComponent
|
|
12535
12681
|
? getTableScrollXViewportWidth(this.nzTableComponent)
|
|
12536
12682
|
: 0;
|
|
12537
|
-
//
|
|
12538
|
-
if (
|
|
12539
|
-
/** @type {?} */
|
|
12540
|
-
var hostW = ((/** @type {?} */ (this.hostEl.nativeElement))).offsetWidth;
|
|
12541
|
-
if (hostW > 0) {
|
|
12542
|
-
viewportCompare = hostW;
|
|
12543
|
-
}
|
|
12683
|
+
// 表体还没渲染出来(刚重建 / 在 spin 里)时用宿主宽兜底
|
|
12684
|
+
if (compareWidth <= 0 && this.hostEl && this.hostEl.nativeElement) {
|
|
12685
|
+
compareWidth = ((/** @type {?} */ (this.hostEl.nativeElement))).offsetWidth;
|
|
12544
12686
|
}
|
|
12545
|
-
|
|
12546
|
-
|
|
12547
|
-
|
|
12548
|
-
scrollX: Math.ceil(declaredColWidth) + "px",
|
|
12549
|
-
fluidExtra: 0,
|
|
12550
|
-
displayTotal: declaredColWidth,
|
|
12551
|
-
isFluid: false,
|
|
12552
|
-
};
|
|
12553
|
-
}
|
|
12554
|
-
/** @type {?} */
|
|
12555
|
-
var fillWidth = this.nzTableComponent
|
|
12556
|
-
? getTableViewportWidth(this.nzTableComponent)
|
|
12557
|
-
: 0;
|
|
12558
|
-
/** @type {?} */
|
|
12559
|
-
var target = Math.floor(fillWidth > 0 ? fillWidth : viewportCompare);
|
|
12560
|
-
/** @type {?} */
|
|
12561
|
-
var fluidExtra = Math.max(0, target - declaredColWidth);
|
|
12562
|
-
return {
|
|
12563
|
-
scrollX: target + "px",
|
|
12564
|
-
fluidExtra: fluidExtra,
|
|
12565
|
-
displayTotal: declaredColWidth + fluidExtra,
|
|
12566
|
-
isFluid: true,
|
|
12567
|
-
};
|
|
12687
|
+
// 仍量不到(如宿主在 display:none 里):先按声明宽走 fixed,等 ResizeObserver 触发再转 fluid
|
|
12688
|
+
if (compareWidth <= 0) {
|
|
12689
|
+
return fixedLayout(declaredColWidth);
|
|
12568
12690
|
}
|
|
12569
|
-
//
|
|
12570
|
-
|
|
12571
|
-
|
|
12572
|
-
|
|
12573
|
-
|
|
12574
|
-
|
|
12575
|
-
|
|
12576
|
-
|
|
12691
|
+
// 1px 容差,避免亚像素误判
|
|
12692
|
+
if (declaredColWidth > compareWidth + 1) {
|
|
12693
|
+
return fixedLayout(declaredColWidth);
|
|
12694
|
+
}
|
|
12695
|
+
/** @type {?} */
|
|
12696
|
+
var fillWidth = this.nzTableComponent
|
|
12697
|
+
? getTableViewportWidth(this.nzTableComponent)
|
|
12698
|
+
: 0;
|
|
12699
|
+
/** @type {?} */
|
|
12700
|
+
var containerWidth = Math.floor(fillWidth > 0 ? fillWidth : compareWidth);
|
|
12701
|
+
return fluidLayout(containerWidth, declaredColWidth);
|
|
12577
12702
|
};
|
|
12578
|
-
/**
|
|
12703
|
+
/** 表格渲染后按真实容器宽校正横向布局;只改 x,y 保持不变 */
|
|
12579
12704
|
/**
|
|
12580
|
-
*
|
|
12705
|
+
* 表格渲染后按真实容器宽校正横向布局;只改 x,y 保持不变
|
|
12581
12706
|
* @private
|
|
12582
12707
|
* @return {?}
|
|
12583
12708
|
*/
|
|
12584
12709
|
HdTableComponent.prototype.syncHorizontalScroll = /**
|
|
12585
|
-
*
|
|
12710
|
+
* 表格渲染后按真实容器宽校正横向布局;只改 x,y 保持不变
|
|
12586
12711
|
* @private
|
|
12587
12712
|
* @return {?}
|
|
12588
12713
|
*/
|
|
12589
12714
|
function () {
|
|
12590
12715
|
var _this = this;
|
|
12591
12716
|
/** @type {?} */
|
|
12592
|
-
var declared = 0;
|
|
12593
|
-
if (this.showSelected) {
|
|
12594
|
-
declared += 40;
|
|
12595
|
-
}
|
|
12596
|
-
if (this.showTableTotal) {
|
|
12597
|
-
declared += this.lineNumberColWidth;
|
|
12598
|
-
}
|
|
12599
|
-
if (this.tableCols) {
|
|
12600
|
-
this.tableCols.forEach((/**
|
|
12601
|
-
* @param {?} item
|
|
12602
|
-
* @return {?}
|
|
12603
|
-
*/
|
|
12604
|
-
function (item) {
|
|
12605
|
-
if (item && item.isShow !== false) {
|
|
12606
|
-
declared += item.width > 0 ? item.width : ColWidth.fixColWidth;
|
|
12607
|
-
}
|
|
12608
|
-
}));
|
|
12609
|
-
}
|
|
12610
|
-
/** @type {?} */
|
|
12611
12717
|
var prevHasX = !!(this.scroll && this.scroll.x);
|
|
12612
12718
|
/** @type {?} */
|
|
12613
|
-
var layout = this.resolveHorizontalLayout(
|
|
12614
|
-
/** @type {?} */
|
|
12615
|
-
var currentY = this.scroll ? this.scroll.y : null;
|
|
12616
|
-
/** @type {?} */
|
|
12617
|
-
var nextHasX = !!layout.scrollX;
|
|
12719
|
+
var layout = this.resolveHorizontalLayout(this.getDeclaredColWidthTotal());
|
|
12618
12720
|
/** @type {?} */
|
|
12619
|
-
var
|
|
12620
|
-
|
|
12621
|
-
|
|
12622
|
-
|
|
12623
|
-
|
|
12624
|
-
if (sameX &&
|
|
12625
|
-
sameExtra &&
|
|
12626
|
-
sameFluid &&
|
|
12627
|
-
this.scroll &&
|
|
12628
|
-
this.scroll.y === currentY) {
|
|
12721
|
+
var unchanged = this.scroll &&
|
|
12722
|
+
this.scroll.x === layout.scrollX &&
|
|
12723
|
+
this.fluidExtraWidth === layout.fluidExtra &&
|
|
12724
|
+
this.fluidHorizontal === layout.isFluid;
|
|
12725
|
+
if (unchanged) {
|
|
12629
12726
|
setTimeout((/**
|
|
12630
12727
|
* @return {?}
|
|
12631
12728
|
*/
|
|
12632
12729
|
function () { return _this.syncTotalFooterWithBody(); }));
|
|
12633
12730
|
return;
|
|
12634
12731
|
}
|
|
12635
|
-
this.
|
|
12636
|
-
this.
|
|
12637
|
-
this.refreshFluidExtraTargetCol();
|
|
12638
|
-
this.tableColWidthTotal = layout.displayTotal;
|
|
12639
|
-
this.scroll = { x: layout.scrollX, y: currentY };
|
|
12732
|
+
this.applyHorizontalLayout(layout);
|
|
12733
|
+
this.scroll = { x: layout.scrollX, y: this.scroll ? this.scroll.y : null };
|
|
12640
12734
|
this.cdr.markForCheck();
|
|
12641
|
-
//
|
|
12642
|
-
if (prevHasX !==
|
|
12735
|
+
// x 从无到有(或反过来)要重建才能切换 table-layout
|
|
12736
|
+
if (prevHasX !== !!layout.scrollX) {
|
|
12643
12737
|
this.applyTableScrollMode(true);
|
|
12644
12738
|
return;
|
|
12645
12739
|
}
|
|
@@ -12959,13 +13053,15 @@ var HdTableComponent = /** @class */ (function () {
|
|
|
12959
13053
|
* @return {?}
|
|
12960
13054
|
*/
|
|
12961
13055
|
function () {
|
|
13056
|
+
var _this = this;
|
|
13057
|
+
// 左侧固定列:从左往右累计偏移(勾选列、序号列在最前面)
|
|
12962
13058
|
/** @type {?} */
|
|
12963
|
-
var
|
|
13059
|
+
var leftOffset = 0;
|
|
12964
13060
|
if (this.showSelected) {
|
|
12965
|
-
|
|
13061
|
+
leftOffset += SELECT_COL_WIDTH;
|
|
12966
13062
|
}
|
|
12967
13063
|
if (this.showTableTotal) {
|
|
12968
|
-
|
|
13064
|
+
leftOffset += this.lineNumberColWidth;
|
|
12969
13065
|
}
|
|
12970
13066
|
this.tableCols.forEach((/**
|
|
12971
13067
|
* @param {?} item
|
|
@@ -12975,9 +13071,9 @@ var HdTableComponent = /** @class */ (function () {
|
|
|
12975
13071
|
if (!item.width) {
|
|
12976
13072
|
item.width = ColWidth.fixColWidth;
|
|
12977
13073
|
}
|
|
12978
|
-
if (item
|
|
12979
|
-
item.fixedWidth =
|
|
12980
|
-
|
|
13074
|
+
if (_this.isColVisible(item)) {
|
|
13075
|
+
item.fixedWidth = leftOffset;
|
|
13076
|
+
leftOffset += item.width;
|
|
12981
13077
|
}
|
|
12982
13078
|
}));
|
|
12983
13079
|
// 右侧固定列:从右往左累计偏移,避免多列都 right:0 互相遮挡
|
|
@@ -12986,7 +13082,7 @@ var HdTableComponent = /** @class */ (function () {
|
|
|
12986
13082
|
for (var i = this.tableCols.length - 1; i >= 0; i--) {
|
|
12987
13083
|
/** @type {?} */
|
|
12988
13084
|
var item = this.tableCols[i];
|
|
12989
|
-
if (item
|
|
13085
|
+
if (!this.isColVisible(item)) {
|
|
12990
13086
|
continue;
|
|
12991
13087
|
}
|
|
12992
13088
|
if (item.fixed === "right") {
|
|
@@ -12998,11 +13094,8 @@ var HdTableComponent = /** @class */ (function () {
|
|
|
12998
13094
|
}
|
|
12999
13095
|
}
|
|
13000
13096
|
/** @type {?} */
|
|
13001
|
-
var layout = this.resolveHorizontalLayout(
|
|
13002
|
-
this.
|
|
13003
|
-
this.fluidHorizontal = layout.isFluid;
|
|
13004
|
-
this.refreshFluidExtraTargetCol();
|
|
13005
|
-
this.tableColWidthTotal = layout.displayTotal;
|
|
13097
|
+
var layout = this.resolveHorizontalLayout(this.getDeclaredColWidthTotal());
|
|
13098
|
+
this.applyHorizontalLayout(layout);
|
|
13006
13099
|
/** @type {?} */
|
|
13007
13100
|
var maxOffset = this.getScrollYMaxOffset();
|
|
13008
13101
|
/** @type {?} */
|
|
@@ -14477,24 +14570,22 @@ if (false) {
|
|
|
14477
14570
|
*/
|
|
14478
14571
|
HdTableComponent.prototype.virtualScrollActive;
|
|
14479
14572
|
/**
|
|
14480
|
-
*
|
|
14573
|
+
* 实际渲染列宽合计(含勾选/序号 + 补宽),合计 footer 表宽用
|
|
14481
14574
|
* @type {?}
|
|
14482
14575
|
*/
|
|
14483
14576
|
HdTableComponent.prototype.tableColWidthTotal;
|
|
14484
14577
|
/**
|
|
14485
|
-
*
|
|
14486
|
-
* 并设 scroll.x = 容器宽,避免表宽 100% 均摊撑开勾选列;拖拽改宽仍写 col.width。
|
|
14578
|
+
* 补到 fluidExtraTargetCol 上的宽度;只影响展示,不写回 col.width(列宽缓存、拖拽仍用声明宽)
|
|
14487
14579
|
* @type {?}
|
|
14488
14580
|
*/
|
|
14489
14581
|
HdTableComponent.prototype.fluidExtraWidth;
|
|
14490
14582
|
/**
|
|
14491
|
-
*
|
|
14492
|
-
* 用于关掉 ng-zorro fixed-header 带来的常驻 X 轴滚动条。
|
|
14583
|
+
* 列少、靠补宽吃满容器:模板据此加 hd-table--fluid-x,隐藏 fixed-header 常驻的横滚槽
|
|
14493
14584
|
* @type {?}
|
|
14494
14585
|
*/
|
|
14495
14586
|
HdTableComponent.prototype.fluidHorizontal;
|
|
14496
14587
|
/**
|
|
14497
|
-
*
|
|
14588
|
+
* 接收补宽的列,缓存起来避免模板每个单元格都扫一遍 tableCols
|
|
14498
14589
|
* @type {?}
|
|
14499
14590
|
* @private
|
|
14500
14591
|
*/
|