fantasy-ngzorro 2.2.35 → 2.2.36

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.
@@ -9820,12 +9820,19 @@ class HdTableComponent {
9820
9820
  return;
9821
9821
  }
9822
9822
  /** @type {?} */
9823
+ const prevHasX = !!(this.scroll && this.scroll.x);
9824
+ /** @type {?} */
9823
9825
  const prevHasY = !!(this.scroll && this.scroll.y);
9824
9826
  this.dealScroll();
9825
9827
  /** @type {?} */
9828
+ const nextHasX = !!(this.scroll && this.scroll.x);
9829
+ /** @type {?} */
9826
9830
  const nextHasY = !!(this.scroll && this.scroll.y);
9827
- // 运行中 y 从有变无/从无变有时,也必须重建,否则同步监听仍指向旧 DOM
9828
- if (prevHasY !== nextHasY) {
9831
+ // 运行中 x/y 从有变无/从无变有时,也必须重建:
9832
+ // - y:ng-zorro 只在 AfterViewInit 绑一次 header/body 同步
9833
+ // - x:空表 scroll.x=null(table-layout:auto)→ 有数据后设 scroll.x(fixed),
9834
+ // 不重建时勾选列仍按 auto 均摊撑开(收款编辑等异步灌数页)
9835
+ if (prevHasY !== nextHasY || prevHasX !== nextHasX) {
9829
9836
  this.showTable = false;
9830
9837
  this.cdr.markForCheck();
9831
9838
  setTimeout((/**
@@ -9838,6 +9845,8 @@ class HdTableComponent {
9838
9845
  * @return {?}
9839
9846
  */
9840
9847
  () => {
9848
+ this.dealScroll();
9849
+ this.cdr.markForCheck();
9841
9850
  this.afterTableRender(useVirtual);
9842
9851
  }));
9843
9852
  }));
@@ -10591,9 +10600,17 @@ class HdTableComponent {
10591
10600
  };
10592
10601
  }
10593
10602
  /** @type {?} */
10594
- const viewportCompare = this.nzTableComponent
10603
+ let viewportCompare = this.nzTableComponent
10595
10604
  ? getTableScrollXViewportWidth(this.nzTableComponent)
10596
10605
  : 0;
10606
+ // 表体尚未量到宽时(异步灌数 / spin / 刚 remount),用宿主宽兜底
10607
+ if (viewportCompare <= 0 && this.hostEl && this.hostEl.nativeElement) {
10608
+ /** @type {?} */
10609
+ const hostW = ((/** @type {?} */ (this.hostEl.nativeElement))).offsetWidth;
10610
+ if (hostW > 0) {
10611
+ viewportCompare = hostW;
10612
+ }
10613
+ }
10597
10614
  if (viewportCompare > 0) {
10598
10615
  if (declaredColWidth > viewportCompare + 1) {
10599
10616
  return {
@@ -10618,10 +10635,10 @@ class HdTableComponent {
10618
10635
  isFluid: true,
10619
10636
  };
10620
10637
  }
10621
- /** @type {?} */
10622
- const autoScroll = resolveAutoTableScroll(this.nzTableComponent, this.hasTableData(), declaredColWidth);
10638
+ // 视口仍测不到:至少用声明宽设 scroll.x,强制 fixed 布局锁勾选列,
10639
+ // 避免落回 table-layout:auto 被均摊撑开;后续 sync/remount 再转 fluid。
10623
10640
  return {
10624
- scrollX: autoScroll ? autoScroll.x : null,
10641
+ scrollX: `${Math.ceil(declaredColWidth)}px`,
10625
10642
  fluidExtra: 0,
10626
10643
  displayTotal: declaredColWidth,
10627
10644
  isFluid: false,
@@ -10647,16 +10664,20 @@ class HdTableComponent {
10647
10664
  * @return {?}
10648
10665
  */
10649
10666
  (item) => {
10650
- if (item && item.isShow) {
10667
+ if (item && item.isShow !== false) {
10651
10668
  declared += item.width > 0 ? item.width : ColWidth.fixColWidth;
10652
10669
  }
10653
10670
  }));
10654
10671
  }
10655
10672
  /** @type {?} */
10673
+ const prevHasX = !!(this.scroll && this.scroll.x);
10674
+ /** @type {?} */
10656
10675
  const layout = this.resolveHorizontalLayout(declared);
10657
10676
  /** @type {?} */
10658
10677
  const currentY = this.scroll ? this.scroll.y : null;
10659
10678
  /** @type {?} */
10679
+ const nextHasX = !!layout.scrollX;
10680
+ /** @type {?} */
10660
10681
  const sameX = this.scroll && this.scroll.x === layout.scrollX;
10661
10682
  /** @type {?} */
10662
10683
  const sameExtra = this.fluidExtraWidth === layout.fluidExtra;
@@ -10679,6 +10700,11 @@ class HdTableComponent {
10679
10700
  this.tableColWidthTotal = layout.displayTotal;
10680
10701
  this.scroll = { x: layout.scrollX, y: currentY };
10681
10702
  this.cdr.markForCheck();
10703
+ // sync 阶段若补上了 scroll.x,需重建才能切到 fixed 布局
10704
+ if (prevHasX !== nextHasX) {
10705
+ this.applyTableScrollMode(true);
10706
+ return;
10707
+ }
10682
10708
  setTimeout((/**
10683
10709
  * @return {?}
10684
10710
  */
@@ -10933,7 +10959,7 @@ class HdTableComponent {
10933
10959
  if (!item.width) {
10934
10960
  item.width = ColWidth.fixColWidth;
10935
10961
  }
10936
- if (item.isShow) {
10962
+ if (item.isShow !== false) {
10937
10963
  item.fixedWidth = colWidth;
10938
10964
  colWidth += item.width;
10939
10965
  }
@@ -10944,7 +10970,7 @@ class HdTableComponent {
10944
10970
  for (let i = this.tableCols.length - 1; i >= 0; i--) {
10945
10971
  /** @type {?} */
10946
10972
  const item = this.tableCols[i];
10947
- if (!item.isShow) {
10973
+ if (item.isShow === false) {
10948
10974
  continue;
10949
10975
  }
10950
10976
  if (item.fixed === "right") {