@gct-paas/word 0.1.33 → 0.1.34
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/dist/core/data/DataManager.d.ts +16 -4
- package/dist/core/layout/linkSubTableLayout.d.ts +5 -0
- package/dist/core/model/DocModel.d.ts +9 -0
- package/dist/core/model/logic/subtable/bounded/BoundedItemRegion.d.ts +4 -0
- package/dist/core/model/logic/subtable/bounded/BoundedRegion.d.ts +4 -0
- package/dist/core/model/logic/subtable/link/DataGroup2DRegion.d.ts +4 -0
- package/dist/core/model/logic/subtable/repeating/RepeatingRegion.d.ts +4 -0
- package/dist/core/model/logic/subtable/shared/dataGroupSlotCount.d.ts +18 -0
- package/dist/core/model/logic/subtable/shared/regionValuePath.d.ts +8 -0
- package/dist/core/view/runs/ImageWidget.d.ts +6 -0
- package/dist/core/view/runs/TextWidget.d.ts +6 -0
- package/dist/index.es.js +908 -567
- package/dist/runtime/canvas/table/utils/index.d.ts +0 -8
- package/dist/utils/func/core.d.ts +12 -18
- package/dist/utils/func/render.d.ts +4 -1
- package/dist/word.css +72 -72
- package/package.json +3 -3
|
@@ -153,6 +153,19 @@ export declare class DataManager {
|
|
|
153
153
|
* 这样可以保证:参数映射(`[n]`)先铺好默认值,自定义数据源(真实下标)再精确覆盖。
|
|
154
154
|
*/
|
|
155
155
|
applyInitData(initDataMap: Record<string, any>): void;
|
|
156
|
+
private applyInitDataCrossWildcard;
|
|
157
|
+
/**
|
|
158
|
+
* 解析子表初始化行数:接口已有行数、版面数据分组槽位。
|
|
159
|
+
* layoutRows 为 0(如二维表纵向 f_ewb)时不按分组扩行,仅保证至少 1 行可绑定。
|
|
160
|
+
*/
|
|
161
|
+
private resolveInitRowCount;
|
|
162
|
+
/**
|
|
163
|
+
* 将子表数组补齐到指定行数。
|
|
164
|
+
* @param asPlaceholder true:push/insert 用的系统占位行(带 __gw_default);false:applyInitData 物化行(空对象)
|
|
165
|
+
*/
|
|
166
|
+
private ensureSubTableRowCount;
|
|
167
|
+
/** 行已写入业务数据后去掉占位标记,避免提交/对比时被当成空行 */
|
|
168
|
+
private clearPlaceholderFlag;
|
|
156
169
|
private applyInitDataWildcard;
|
|
157
170
|
/**
|
|
158
171
|
* 内部方法:根据路径获取值
|
|
@@ -219,10 +232,9 @@ export declare class DataManager {
|
|
|
219
232
|
*/
|
|
220
233
|
getDefault<T = any>(path: JsonPath): T | undefined;
|
|
221
234
|
/**
|
|
222
|
-
*
|
|
223
|
-
*
|
|
224
|
-
*
|
|
225
|
-
* @returns 转换后的路径
|
|
235
|
+
* 将路径中的具体数组索引转换为默认值通配符
|
|
236
|
+
* - 普通子表: items[0].name -> items[n].name
|
|
237
|
+
* - 二维交叉区: $.f_ewb:f_ewblink[0][1].f_value -> $.f_ewb:f_ewblink[n_y][n_x].f_value
|
|
226
238
|
*/
|
|
227
239
|
private convertPathToWildcard;
|
|
228
240
|
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 获取页脚实例 */
|
|
@@ -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;
|
|
@@ -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
|
}
|