@gct-paas/word 0.1.33 → 0.1.35

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.
@@ -79,6 +79,11 @@ export declare class DataManager {
79
79
  private get2DByCoords;
80
80
  private set2DByCoords;
81
81
  private cleanupCrossByAxisUid;
82
+ /**
83
+ * 复制轴行插入时:若 uid 与已有行重复,换新 uid 并复制关联交叉区行。
84
+ */
85
+ private duplicateCrossRowsByAxisUid;
86
+ private prepareAxisRowForInsert;
82
87
  /**
83
88
  * 将一个部分值对象合进整体
84
89
  */
@@ -153,6 +158,19 @@ export declare class DataManager {
153
158
  * 这样可以保证:参数映射(`[n]`)先铺好默认值,自定义数据源(真实下标)再精确覆盖。
154
159
  */
155
160
  applyInitData(initDataMap: Record<string, any>): void;
161
+ private applyInitDataCrossWildcard;
162
+ /**
163
+ * 解析子表初始化行数:接口已有行数、版面数据分组槽位。
164
+ * layoutRows 为 0(如二维表纵向 f_ewb)时不按分组扩行,仅保证至少 1 行可绑定。
165
+ */
166
+ private resolveInitRowCount;
167
+ /**
168
+ * 将子表数组补齐到指定行数。
169
+ * @param asPlaceholder true:push/insert 用的系统占位行(带 __gw_default);false:applyInitData 物化行(空对象)
170
+ */
171
+ private ensureSubTableRowCount;
172
+ /** 行已写入业务数据后去掉占位标记,避免提交/对比时被当成空行 */
173
+ private clearPlaceholderFlag;
156
174
  private applyInitDataWildcard;
157
175
  /**
158
176
  * 内部方法:根据路径获取值
@@ -219,10 +237,9 @@ export declare class DataManager {
219
237
  */
220
238
  getDefault<T = any>(path: JsonPath): T | undefined;
221
239
  /**
222
- * 将路径中的具体数组索引转换为通配符
223
- * 例如: "items[0].name" -> "items[n].name"
224
- * @param path 原始路径
225
- * @returns 转换后的路径
240
+ * 将路径中的具体数组索引转换为默认值通配符
241
+ * - 普通子表: items[0].name -> items[n].name
242
+ * - 二维交叉区: $.f_ewb:f_ewblink[0][1].f_value -> $.f_ewb:f_ewblink[n_y][n_x].f_value
226
243
  */
227
244
  private convertPathToWildcard;
228
245
  private formatRuntimeValue;
@@ -1,5 +1,10 @@
1
1
  import { LinkSubTableRegion } from '../model/logic';
2
2
  export type LinkSubTableCellZone = 'cross' | 'horizontal' | 'vertical';
3
+ export type LinkSubTableLayoutType = '2d-table' | 'check-table';
4
+ /** 二维表 / 检验表(LinkSubTable 布局体系) */
5
+ export declare function isLinkSubTableType(type?: string): type is LinkSubTableLayoutType;
6
+ /** 渲染端子表主体范围(交叉区 + 横向区,不含纵向铺砖带) */
7
+ export declare function isLinkSubTableSubScopeZone(cellZone?: string): cellZone is Exclude<LinkSubTableCellZone, 'vertical'>;
3
8
  export type LinkSubTableCellIndexMap = Map<string, {
4
9
  dataIndex?: number;
5
10
  }>;
@@ -65,6 +65,15 @@ export declare class DocModel {
65
65
  name: string;
66
66
  subType: string;
67
67
  }[];
68
+ /**
69
+ * 根据版面数据分组 / 动态关联铺砖,计算子表字段在 rawData 中应初始化的行数。
70
+ *
71
+ * - 固定表:槽位归 subFieldKey(bounded + itemRegion)
72
+ * - 二维表 / 检验表:动态分组铺砖在关联轴,槽位归 linkFieldKey(如 f_ewblink);
73
+ * 纵向 subFieldKey(如 f_ewb)不由 itemRegion 撑行,返回 0
74
+ * - 其它子表无分组:返回 1
75
+ */
76
+ getSubTableLayoutSlotCount(subFieldKey: string): number;
68
77
  /** 根据 pageIndex 获取页眉实例 */
69
78
  getHeader(pageIndex: number, section: Section): import('./headers/Wheader').Wheader | null;
70
79
  /** 根据 pageIndex 获取页脚实例 */
@@ -19,6 +19,8 @@ export declare class Wp extends ModelGroup {
19
19
  constructor(options: ModelGroupOptions & {
20
20
  pPr?: WpPr;
21
21
  });
22
+ /** 将 pPr 挂到段落节点,供样式解析沿 parent 链查找 styles */
23
+ private bindPPrParent;
22
24
  get styleId(): string | undefined;
23
25
  /**
24
26
  * runs 属性别名,指向 children
@@ -46,6 +46,8 @@ export declare class Wtc extends ModelGroup {
46
46
  /** 是否是合并起始单元格 */
47
47
  get isMergeStart(): boolean;
48
48
  get contents(): Wp[];
49
+ /** 单元格垂直对齐(w:tcPr/w:vAlign) */
50
+ get vAlign(): 'top' | 'center' | 'bottom' | undefined;
49
51
  get firstContent(): Wp | undefined;
50
52
  get lastContent(): Wp | undefined;
51
53
  get cellMergeInfo(): {
@@ -7,5 +7,9 @@ export declare class BoundedItemRegion extends Region {
7
7
  type: "boundedItem";
8
8
  parent?: BoundedRegion;
9
9
  constructor(options: BoundedItemRegionOptions);
10
+ get subFieldKey(): string;
11
+ get linkFieldKey(): string;
12
+ get subValuePath(): string;
13
+ get linkValuePath(): string;
10
14
  remove(): void;
11
15
  }
@@ -35,6 +35,10 @@ export declare class BoundedRegion extends Region {
35
35
  widgetMeta: BoundedWidgetMeta;
36
36
  itemRegion?: BoundedItemRegion;
37
37
  constructor(options: BoundedRegionOptions);
38
+ get subFieldKey(): string;
39
+ get linkFieldKey(): string;
40
+ get subValuePath(): string;
41
+ get linkValuePath(): string;
38
42
  toJSON(): BoundedRegionJson;
39
43
  static fromJSON(json: BoundedRegionJson, table: Wtbl): BoundedRegion;
40
44
  setItemRegion(options: Omit<BoundedItemRegionOptions, 'table'>): BoundedItemRegion;
@@ -7,5 +7,9 @@ export declare class DataGroup2DRegion extends Region {
7
7
  type: "dataGroup2D";
8
8
  parent?: LinkSubTableRegion;
9
9
  constructor(options: DataGroup2DRegionOptions);
10
+ get subFieldKey(): string;
11
+ get linkFieldKey(): string;
12
+ get subValuePath(): string;
13
+ get linkValuePath(): string;
10
14
  remove(): void;
11
15
  }
@@ -25,6 +25,10 @@ export declare class RepeatingRegion extends Region {
25
25
  valuePath: string;
26
26
  widgetMeta: RepeatingWidgetMeta;
27
27
  constructor(options: RepeatingRegionOptions);
28
+ get subFieldKey(): string;
29
+ get linkFieldKey(): string;
30
+ get subValuePath(): string;
31
+ get linkValuePath(): string;
28
32
  toJSON(): RepeatingRegionJson;
29
33
  static fromJSON(json: RepeatingRegionJson, table: Wtbl): RepeatingRegion;
30
34
  }
@@ -0,0 +1,18 @@
1
+ /** 表格矩形范围(含起止行列,均为闭区间) */
2
+ export type TableRange = {
3
+ start: {
4
+ row: number;
5
+ col: number;
6
+ };
7
+ end: {
8
+ row: number;
9
+ col: number;
10
+ };
11
+ };
12
+ /**
13
+ * 计算数据分组 / 动态关联在版面中可铺砖的数据槽位数(含模板块 dataIndex 0)。
14
+ * 逻辑与 TableExpander.computeDataIndexMap 中铺砖循环一致。
15
+ */
16
+ export declare function countDataGroupSlots(range: TableRange, itemRange: TableRange, fillDirection?: 'x' | 'y'): number;
17
+ /** 检验表 / 二维表动态关联:itemRegion 行范围可能超出子表主体 */
18
+ export declare function expandDataGroupRowRange(parent: TableRange, itemRange: TableRange): TableRange;
@@ -0,0 +1,8 @@
1
+ export type RegionValuePathKeys = {
2
+ subFieldKey: string;
3
+ linkFieldKey: string;
4
+ subValuePath: string;
5
+ linkValuePath: string;
6
+ };
7
+ /** 从 region.valuePath 解析子表/关联字段 key(二维表、检验表、固定表、动态表共用) */
8
+ export declare function resolveRegionValuePathKeys(valuePath: string): RegionValuePathKeys;
@@ -18,6 +18,8 @@ export declare class Paragraph extends LayoutGroup<LayoutNode> {
18
18
  component: "paragraph";
19
19
  parent: ParagraphParent;
20
20
  baseline: number;
21
+ /** 上次 layout 应用的水平对齐偏移,避免重复 layout 时累加 */
22
+ private _alignmentOffset;
21
23
  splitFillEvent: EventUtil;
22
24
  constructor(options: ParagraphOptions);
23
25
  /**
@@ -11,6 +11,8 @@ export interface IImageWidget extends IImageRun {
11
11
  signature?: string;
12
12
  pageWidgetMeta?: Record<string, any>;
13
13
  dataIndex?: number;
14
+ xDataIndex?: number;
15
+ yDataIndex?: number;
14
16
  }
15
17
  export interface ImageWidgetOptions extends ImageRunOptions {
16
18
  /** 值路径 */
@@ -20,6 +22,8 @@ export interface ImageWidgetOptions extends ImageRunOptions {
20
22
  signature?: string;
21
23
  pageWidgetMeta?: IImageWidget['pageWidgetMeta'];
22
24
  dataIndex?: number;
25
+ xDataIndex?: number;
26
+ yDataIndex?: number;
23
27
  }
24
28
  /**
25
29
  * 图片运行类
@@ -31,5 +35,7 @@ export declare class ImageWidget extends ImageRun implements IImageWidget {
31
35
  signature?: string;
32
36
  pageWidgetMeta?: IImageWidget['pageWidgetMeta'];
33
37
  dataIndex?: number;
38
+ xDataIndex?: number;
39
+ yDataIndex?: number;
34
40
  constructor(options: ImageWidgetOptions);
35
41
  }
@@ -25,6 +25,8 @@ export interface ITextWidget extends ITextRun {
25
25
  /** 页面组件元数据 */
26
26
  pageWidgetMeta?: WidgetMeta;
27
27
  dataIndex?: number;
28
+ xDataIndex?: number;
29
+ yDataIndex?: number;
28
30
  }
29
31
  export interface TextWidgetOptions extends TextRunOptions {
30
32
  /** 组件元数据 */
@@ -41,6 +43,8 @@ export interface TextWidgetOptions extends TextRunOptions {
41
43
  widgetFieldRightMarker?: boolean;
42
44
  pageWidgetMeta: ITextWidget['pageWidgetMeta'];
43
45
  dataIndex?: number;
46
+ xDataIndex?: number;
47
+ yDataIndex?: number;
44
48
  }
45
49
  export declare class TextWidget extends TextRun implements ITextWidget {
46
50
  widgetMeta?: WidgetMeta;
@@ -54,5 +58,7 @@ export declare class TextWidget extends TextRun implements ITextWidget {
54
58
  widgetFileItem?: ITextWidget['widgetFileItem'];
55
59
  pageWidgetMeta: ITextWidget['pageWidgetMeta'];
56
60
  dataIndex?: number;
61
+ xDataIndex?: number;
62
+ yDataIndex?: number;
57
63
  constructor(options: TextWidgetOptions);
58
64
  }