fantasy-ngzorro 2.2.13 → 2.2.14

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.
@@ -1,6 +1,7 @@
1
1
  export declare class TotalOption {
2
2
  insertIndex: number;
3
- insertValue: any;
3
+ /** 合计值;hd-table 可不传,按 insertIndex 对应列对 content 自动求和 */
4
+ insertValue?: any;
4
5
  align?: string;
5
6
  showDecimal?: boolean;
6
7
  preserveNumber?: number;
@@ -1,12 +1,14 @@
1
- import { ChangeDetectorRef, EventEmitter, OnInit, SimpleChange, TemplateRef } from "@angular/core";
1
+ import { ChangeDetectorRef, ElementRef, EventEmitter, OnDestroy, OnInit, SimpleChange, TemplateRef } from "@angular/core";
2
2
  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
6
  import { Page } from "../model/common-type";
7
7
  import { CommonSessionService } from "../service/common-session.service";
8
- import { HdTableCellChange, HdTableColumn, HdTableTotalOption, OperateBtn, TableCacheOption, TreeGrid } from "./hd-table.service";
9
- export declare class HdTableComponent implements OnInit {
8
+ import { TotalOption } from "../hd-detail-lines/hd-detail-lines.service";
9
+ import { HdTableCellChange, HdTableColumn, OperateBtn, TableCacheOption, TreeGrid } from "./hd-table.service";
10
+ export declare class HdTableComponent implements OnInit, OnDestroy {
11
+ private hostEl;
10
12
  private cdr;
11
13
  private commonSessionService;
12
14
  uuid: string;
@@ -29,7 +31,12 @@ export declare class HdTableComponent implements OnInit {
29
31
  */
30
32
  rowInvalidField: string;
31
33
  showTableTotal: boolean;
32
- tableTotalOption: Array<HdTableTotalOption>;
34
+ tableTotalOption: Array<TotalOption>;
35
+ /**
36
+ * 合计列总数(含序号列,与 hd-detail-lines 一致);
37
+ * 不传则按当前可见数据列数 + 1(序号)推算。
38
+ */
39
+ columnsNumber: number | string;
33
40
  sortEvent: EventEmitter<{}>;
34
41
  selectEvent: EventEmitter<{}>;
35
42
  tableSearchEvent: EventEmitter<{}>;
@@ -90,14 +97,19 @@ export declare class HdTableComponent implements OnInit {
90
97
  /** 记录当前是否处于虚拟滚动模式,用于切换 pageSize 时重建表格 */
91
98
  private virtualScrollActive;
92
99
  /** 可见列总宽,用于判断是否需要横向滚动 */
93
- private tableColWidthTotal;
100
+ /** 列宽合计(含勾选/序号),footer 表宽与横向 scroll 共用 */
101
+ tableColWidthTotal: number;
94
102
  /** 数据更新后待复位纵向滚动位置 */
95
103
  private pendingResetScrollTop;
96
104
  /** 当前排序,表格重建后用于恢复表头排序态 */
97
105
  private currentSortKey;
98
106
  private currentSortValue;
99
107
  nzTableComponent: NzTableComponent;
100
- constructor(cdr: ChangeDetectorRef, commonSessionService: CommonSessionService);
108
+ private totalFooterScrollBoundBody;
109
+ private totalFooterScrollHandler;
110
+ private totalFooterSyncRetry;
111
+ constructor(hostEl: ElementRef, cdr: ChangeDetectorRef, commonSessionService: CommonSessionService);
112
+ ngOnDestroy(): void;
101
113
  ngOnInit(): void;
102
114
  ngOnChanges(changes: SimpleChange): void;
103
115
  /** 是否走前端分页(对 content 切片,不请求后端) */
@@ -126,6 +138,23 @@ export declare class HdTableComponent implements OnInit {
126
138
  readonly useVirtualScroll: boolean;
127
139
  getRightSticky(col: HdTableColumn): string | null;
128
140
  getLeftSticky(col: HdTableColumn): string | null;
141
+ /**
142
+ * 序号列固定宽(含 padding,可容纳 6 位如 199995)。
143
+ * 不锁死时表体会随位数变宽(1→~64px,199995→~67px),合计行对不齐。
144
+ */
145
+ readonly lineNumberColWidth = 72;
146
+ /** 开启合计时序号列的 left(勾选列占 40px) */
147
+ readonly lineNumberLeft: string;
148
+ readonly lineNumberColWidthPx: string;
149
+ /**
150
+ * 列总宽未超出容器:无横向 scroll,表体列会被撑满,合计走 fluid(width:100%)。
151
+ * 列总宽超出:有 scroll.x,合计走固定表宽 + 横滚同步。
152
+ */
153
+ readonly isTotalFooterFluid: boolean;
154
+ /** fluid → 100%;固定 → scroll.x(与表体同一套横向宽度) */
155
+ readonly totalFooterTableWidth: string;
156
+ /** 当前页行号(跨页连续,从 1 开始) */
157
+ getLineNumber(index: number): number;
129
158
  trackByRow: (index: number, data: any) => string;
130
159
  /** 虚拟滚动按数组下标追踪,避免业务主键 trackBy 导致 CDK 行复用错位 */
131
160
  virtualTrackByRow: (index: number) => number;
@@ -174,11 +203,33 @@ export declare class HdTableComponent implements OnInit {
174
203
  private resolveScrollX;
175
204
  /** 表格渲染后按实际容器宽度校正横向 scroll(只改 x,避免触发表头结构变化) */
176
205
  private syncHorizontalScroll;
177
- /** 手动把表体横向滚动同步到表头(兜底 ng-zorro 监听丢失的情况) */
206
+ /** 手动把表体横向滚动同步到表头 / 合计 footer(兜底 ng-zorro 监听丢失的情况) */
178
207
  private syncHeaderBodyScrollLeft;
208
+ /** 取表体横向滚动容器(虚拟滚动优先 viewport) */
209
+ private getTableBodyScrollEl;
210
+ private getTotalFooterScrollEl;
211
+ /**
212
+ * 合计 footer 与表体联动:
213
+ * - fluid(列未撑满):不横滚、不测宽,表宽 100% 与表体同比例拉伸;
214
+ * - fixed(有 scroll.x):同步 scrollLeft。
215
+ */
216
+ private syncTotalFooterWithBody;
217
+ private syncTotalFooterScrollLeft;
218
+ private bindTotalFooterScrollSync;
219
+ private unbindTotalFooterScrollSync;
179
220
  dealScroll(): void;
180
221
  currentPageDataChange($event: any): void;
181
222
  search(reset: boolean): void;
223
+ /**
224
+ * 底部合计:与 hd-detail-lines 相同,使用 TotalOption(insertIndex / insertValue)。
225
+ * 开启后强制展示序号列,「合计」落在序号列下;
226
+ * insertIndex 从 1 起对应可见数据列;未传 insertValue 时按该列 name 对 content 求和。
227
+ */
228
+ calculateTableTotal(): void;
229
+ private getTableTotalCellMeta;
230
+ /** 合计单元格展示文案(对齐 detail-lines 小数规则) */
231
+ getTableTotalCellValue(col: HdTableColumn, colIndex: number): any;
232
+ getTableTotalCellAlign(col: HdTableColumn, colIndex: number): string;
182
233
  /** 底部「共 n 条」:非分页/前端分页用 content.length,服务端分页用 totalElements */
183
234
  getTableTotalCount(): number;
184
235
  resetStatus(): void;
@@ -72,11 +72,6 @@ export declare class OperateBtn {
72
72
  click?: (value: any) => void;
73
73
  permission?: (value: any) => boolean;
74
74
  }
75
- export declare class HdTableTotalOption {
76
- columnNumber: number;
77
- insertIndex: number;
78
- insertName: string;
79
- }
80
75
  export declare class TableCacheOption {
81
76
  pageSize: number;
82
77
  colWidths: Map<string, number>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "fantasy-ngzorro",
3
- "version": "2.2.13",
4
- "description": "fix:hd-form-lines enableKeyboardOperate=false 时 Select 选中后不再自动跳格",
3
+ "version": "2.2.14",
4
+ "description": "feat:hd-table 底部合计行 nzFooter(与列表同横滚/列未撑满对齐,不进虚拟滚动;TotalOption 与明细共用)",
5
5
  "peerDependencies": {
6
6
  "moment": "^2.24.0",
7
7
  "ng-zorro-antd": "^8.5.2",