fantasy-ngzorro 2.2.36 → 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.
@@ -91,7 +91,9 @@ export declare class HdFilterComponent implements OnInit, OnChanges, OnDestroy {
91
91
  private serializeFilterValue;
92
92
  private patchFilterValues;
93
93
  /**
94
- * 多选 / 日期范围空态用 [],避免 FormControl 为 null 时 nz-select multiple 不显示 placeholder。
94
+ * 多选空态用 [],避免 FormControl 为 null 时 nz-select multiple 不显示 placeholder。
95
+ * DateRange 必须保持 null(或把历史空数组归一为 null):业务侧大量用 !value 判断,
96
+ * 若规范成 [] 会因 truthy 走进 moment(value[0]),被解析成「今天」。
95
97
  */
96
98
  private normalizeFilterControlValue;
97
99
  private reviveFilterValue;
@@ -3,9 +3,9 @@ import { NzFormatBeforeDropEvent, NzFormatEmitEvent } from "ng-zorro-antd/core";
3
3
  import { NzResizeEvent } from "ng-zorro-antd/resizable";
4
4
  import { NzTableComponent } from "ng-zorro-antd/table";
5
5
  import { Observable } from "rxjs";
6
+ import { TotalOption } from "../hd-detail-lines/hd-detail-lines.service";
6
7
  import { Page } from "../model/common-type";
7
8
  import { CommonSessionService } from "../service/common-session.service";
8
- import { TotalOption } from "../hd-detail-lines/hd-detail-lines.service";
9
9
  import { HdTableCellChange, HdTableColumn, OperateBtn, TableCacheOption, TreeGrid } from "./hd-table.service";
10
10
  export declare class HdTableComponent implements OnInit, OnDestroy {
11
11
  private hostEl;
@@ -102,19 +102,13 @@ export declare class HdTableComponent implements OnInit, OnDestroy {
102
102
  measuredVirtualItemSize: number;
103
103
  /** 记录当前是否处于虚拟滚动模式,用于切换 pageSize 时重建表格 */
104
104
  private virtualScrollActive;
105
- /** 列宽合计(含勾选/序号 + fluid 补宽),footer 表宽与横向 scroll 共用 */
105
+ /** 实际渲染列宽合计(含勾选/序号 + 补宽),合计 footer 表宽用 */
106
106
  tableColWidthTotal: number;
107
- /**
108
- * fluid:声明列总宽 < 容器时,把差额补到最后一列业务列(不改缓存宽),
109
- * 并设 scroll.x = 容器宽,避免表宽 100% 均摊撑开勾选列;拖拽改宽仍写 col.width。
110
- */
107
+ /** 补到 fluidExtraTargetCol 上的宽度;只影响展示,不写回 col.width(列宽缓存、拖拽仍用声明宽) */
111
108
  fluidExtraWidth: number;
112
- /**
113
- * 列总宽未超出容器(fluid 补宽吃满):不需要真正横滚,
114
- * 用于关掉 ng-zorro fixed-header 带来的常驻 X 轴滚动条。
115
- */
109
+ /** 列少、靠补宽吃满容器:模板据此加 hd-table--fluid-x,隐藏 fixed-header 常驻的横滚槽 */
116
110
  fluidHorizontal: boolean;
117
- /** fluid 补宽目标列缓存,避免模板每格 CD 时反复扫 tableCols */
111
+ /** 接收补宽的列,缓存起来避免模板每个单元格都扫一遍 tableCols */
118
112
  private fluidExtraTargetCol;
119
113
  /** 数据更新后待复位纵向滚动位置 */
120
114
  private pendingResetScrollTop;
@@ -175,7 +169,7 @@ export declare class HdTableComponent implements OnInit, OnDestroy {
175
169
  * 不锁死时表体会随位数变宽(1→~64px,199995→~67px),合计行对不齐。
176
170
  */
177
171
  readonly lineNumberColWidth = 72;
178
- /** 开启合计时序号列的 left(勾选列占 40px) */
172
+ /** 开启合计时序号列的 left(跟在勾选列后面) */
179
173
  readonly lineNumberLeft: string;
180
174
  readonly lineNumberColWidthPx: string;
181
175
  /**
@@ -183,10 +177,20 @@ export declare class HdTableComponent implements OnInit, OnDestroy {
183
177
  * 列少时也会设 scroll.x(补宽吃满),合计走固定表宽。
184
178
  */
185
179
  readonly isTotalFooterFluid: boolean;
186
- /** 展示用列宽:fluid 时最后一列业务列 = 声明宽 + fluidExtraWidth */
180
+ private isColVisible;
181
+ /** 业务列声明宽:未配置时按 fixColWidth */
182
+ private getColDeclaredWidth;
183
+ /** 声明列宽合计:勾选列 + 序号列 + 可见业务列,不含补宽 */
184
+ private getDeclaredColWidthTotal;
185
+ /** 模板里 th / td / 合计 col 用的列宽:补宽目标列 = 声明宽 + fluidExtraWidth */
187
186
  getColDisplayWidth(col: HdTableColumn): number;
188
- /** 按当前 layout 刷新 fluid 补宽目标列(仅 dealScroll / sync 时调用) */
189
- private refreshFluidExtraTargetCol;
187
+ /**
188
+ * 选出接收补宽的列:优先最后一列「非右侧固定」的可见列,
189
+ * 避免把操作列等右固定列拉宽;全是右固定列时退回最后一列可见列。
190
+ */
191
+ private findFluidExtraTargetCol;
192
+ /** 把横向布局结果写回组件状态(dealScroll / syncHorizontalScroll 共用) */
193
+ private applyHorizontalLayout;
190
194
  /** fluid → 100%;固定 → scroll.x(与表体同一套横向宽度) */
191
195
  readonly totalFooterTableWidth: string;
192
196
  /** 当前页行号(跨页连续,从 1 开始) */
@@ -199,6 +203,8 @@ export declare class HdTableComponent implements OnInit, OnDestroy {
199
203
  initTable(): void;
200
204
  /** 虚拟/普通模式切换时重建表格,避免残留滚动容器 */
201
205
  applyTableScrollMode(forceRemount?: boolean): void;
206
+ /** 销毁并重建 nz-table:等 DOM 出来后再按真实容器宽重算一次横向布局 */
207
+ private remountTable;
202
208
  /** 重建前预设 scroll,保证 AfterViewInit 时 header/body 结构已正确 */
203
209
  private presetScrollBeforeRemount;
204
210
  private afterTableRender;
@@ -234,16 +240,13 @@ export declare class HdTableComponent implements OnInit, OnDestroy {
234
240
  isDangerBtn(btn: OperateBtn, data: any): boolean;
235
241
  /** 虚拟滚动开启时使用视口最大高度 */
236
242
  private getVirtualScrollY;
237
- private hasTableData;
238
243
  /**
239
- * 按声明列总宽 + 容器宽,计算 scroll.x 与 fluid 补宽。
240
- * 列少:scroll.x = 内容区宽(clientWidth),差额加到最后业务列(勾选保持 40);
241
- * 列多:scroll.x = 声明总宽。
242
- * 比较是否超宽用 offsetWidth(含 Y 槽),避免「仅因纵滚条」误开横滚;
243
- * 补宽目标用 clientWidth,且 scroll.x 用 floor,避免表宽多 1px 逼出 X 轴滚动条。
244
+ * 按声明列宽合计 + 容器宽算出横向布局。
245
+ * 判断「是否超宽」用 offsetWidth(含竖滚条槽),避免只因竖滚条就误开横滚;
246
+ * 补宽目标用 clientWidth 并向下取整,避免表宽多 1px 逼出横滚条。
244
247
  */
245
248
  private resolveHorizontalLayout;
246
- /** 表格渲染后按实际容器宽度校正横向 scroll / fluid 补宽 */
249
+ /** 表格渲染后按真实容器宽校正横向布局;只改 x,y 保持不变 */
247
250
  private syncHorizontalScroll;
248
251
  /** 手动把表体横向滚动同步到表头 / 合计 footer(兜底 ng-zorro 监听丢失的情况) */
249
252
  private syncHeaderBodyScrollLeft;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "fantasy-ngzorro",
3
- "version": "2.2.36",
4
- "description": "fix:hd-table 异步灌数后 scroll.x 从无到有时重建表格锁勾选列宽",
3
+ "version": "2.2.38",
4
+ "description": "fix:hd-table 无数据时也走 fixed 布局锁勾选列 40px;整理横向布局代码",
5
5
  "peerDependencies": {
6
6
  "moment": "^2.24.0",
7
7
  "ng-zorro-antd": "^8.5.2",
@@ -11,7 +11,10 @@ export declare function measureTableColWidth(nzTable: NzTableComponent): number;
11
11
  * 这里用 offsetWidth(含滚动条槽)作为屏幕可展示宽度。
12
12
  */
13
13
  export declare function getTableScrollXViewportWidth(nzTable: NzTableComponent, hostClass?: string): number;
14
- /** 无数据或列宽未超出容器时不启用横向 scroll(fluid:表宽 100%,勾选/序号列由 CSS 锁宽) */
14
+ /**
15
+ * 无数据或列宽未超出容器时不启用横向 scroll(表宽 100%、table-layout: auto)。
16
+ * auto 布局下单元格 max-width 不生效,固定宽列会被均摊撑开;需要锁宽的场景见 hd-table 的横向布局。
17
+ */
15
18
  export declare function resolveAutoTableScroll(nzTable: NzTableComponent, hasData: boolean, colWidth?: number): HdTableScrollConfig | null;
16
19
  /** 取 ng-zorro 分体表头 / 表体滚动容器(含虚拟滚动) */
17
20
  export declare function getNzTableScrollElements(nzTable: NzTableComponent): {