@gct-paas/word 0.1.32 → 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/base/input/src/input.vue.d.ts +1 -1
- package/dist/base/input/src/text-area.vue.d.ts +1 -1
- package/dist/base/table/src/table.vue.d.ts +1 -1
- package/dist/core/command/commands/InsertField.d.ts +22 -2
- package/dist/core/data/DataManager.d.ts +40 -12
- package/dist/core/layout/handlers/fields/FieldBaseHandler.d.ts +1 -0
- package/dist/core/layout/linkSubTableLayout.d.ts +27 -0
- package/dist/core/layout/providers/TableInfoProvider.d.ts +2 -3
- package/dist/core/model/DocModel.d.ts +9 -0
- package/dist/core/model/document/Wtbl/RegionManager.d.ts +47 -10
- package/dist/core/model/document/Wtc.d.ts +20 -15
- package/dist/core/model/document/wtcRegionRef.d.ts +20 -0
- package/dist/core/model/logic/{Region.d.ts → base/Region.d.ts} +2 -5
- package/dist/core/model/logic/{SubTableHeaderRegion.d.ts → header/SubTableHeaderRegion.d.ts} +3 -6
- package/dist/core/model/logic/{TableHeaderRegion.d.ts → header/TableHeaderRegion.d.ts} +3 -3
- package/dist/core/model/logic/index.d.ts +18 -22
- package/dist/core/model/logic/{BoundedItemRegion.d.ts → subtable/bounded/BoundedItemRegion.d.ts} +5 -1
- package/dist/core/model/logic/{BoundedRegion.d.ts → subtable/bounded/BoundedRegion.d.ts} +7 -9
- package/dist/core/model/logic/subtable/link/CheckTableRegion.d.ts +11 -0
- package/dist/core/model/logic/subtable/link/DataGroup2DRegion.d.ts +15 -0
- package/dist/core/model/logic/subtable/link/LinkSubTableRegion.d.ts +48 -0
- package/dist/core/model/logic/subtable/link/_2DTableRegion.d.ts +11 -0
- package/dist/core/model/logic/{RepeatingRegion.d.ts → subtable/repeating/RepeatingRegion.d.ts} +7 -9
- package/dist/core/model/logic/subtable/shared/dataGroupSlotCount.d.ts +18 -0
- package/dist/core/model/logic/subtable/shared/itemRegionOps.d.ts +11 -0
- package/dist/core/model/logic/subtable/shared/regionValuePath.d.ts +8 -0
- package/dist/core/model/logic/types.d.ts +10 -0
- package/dist/core/utils/expand.d.ts +49 -18
- package/dist/core/view/TableCell.d.ts +3 -7
- 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 +1968 -1254
- package/dist/runtime/canvas/table/utils/index.d.ts +2 -2
- package/dist/runtime/factories/createDesignWidgetFactory.d.ts +17 -0
- package/dist/runtime/factories/{useRenderData.d.ts → useWidgetRenderData.d.ts} +18 -6
- package/dist/runtime/renderer/dropdowns/components/tables/rdo-table-dropdown.vue.d.ts +3 -3
- package/dist/runtime/renderer/dropdowns/components/tables/table-dropdown.vue.d.ts +3 -3
- package/dist/utils/func/core.d.ts +62 -18
- package/dist/utils/func/render.d.ts +4 -1
- package/dist/word.css +153 -153
- package/package.json +1 -1
- package/dist/core/model/logic/CheckTableRegion.d.ts +0 -44
- package/dist/core/model/logic/DataGroup2DRegion.d.ts +0 -12
- package/dist/core/model/logic/_2DTableRegion.d.ts +0 -44
- package/dist/runtime/factories/createFieldToWidgetFactory.d.ts +0 -13
- package/dist/runtime/factories/createPaperWidgetToWidgetFactory.d.ts +0 -13
- package/dist/runtime/factories/usePwRenderData.d.ts +0 -13
package/dist/core/model/logic/{RepeatingRegion.d.ts → subtable/repeating/RepeatingRegion.d.ts}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Wtbl } from '
|
|
2
|
-
import { Region, RegionOptions } from '
|
|
3
|
-
import { RegionJson } from '
|
|
1
|
+
import { Wtbl } from '../../../document';
|
|
2
|
+
import { Region, RegionOptions } from '../../base/Region';
|
|
3
|
+
import { RegionJson } from '../../../types';
|
|
4
4
|
export type RepeatingWidgetPropsMeta = {
|
|
5
5
|
/** 快速填报 */
|
|
6
6
|
quickFill: boolean;
|
|
@@ -25,12 +25,10 @@ export declare class RepeatingRegion extends Region {
|
|
|
25
25
|
valuePath: string;
|
|
26
26
|
widgetMeta: RepeatingWidgetMeta;
|
|
27
27
|
constructor(options: RepeatingRegionOptions);
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
get subFieldKey(): string;
|
|
29
|
+
get linkFieldKey(): string;
|
|
30
|
+
get subValuePath(): string;
|
|
31
|
+
get linkValuePath(): string;
|
|
31
32
|
toJSON(): RepeatingRegionJson;
|
|
32
|
-
/**
|
|
33
|
-
* 从 JSON 对象还原
|
|
34
|
-
*/
|
|
35
33
|
static fromJSON(json: RepeatingRegionJson, table: Wtbl): RepeatingRegion;
|
|
36
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,11 @@
|
|
|
1
|
+
import { Wtbl } from '../../../document';
|
|
2
|
+
import { CellPos, Region } from '../../base/Region';
|
|
3
|
+
type RegionBounds = {
|
|
4
|
+
start: CellPos;
|
|
5
|
+
end: CellPos;
|
|
6
|
+
};
|
|
7
|
+
/** 在矩形范围内为单元格打上子表项标记 */
|
|
8
|
+
export declare function markSubTableItemCells(table: Wtbl, bounds: RegionBounds, itemType: string, regionId: string): void;
|
|
9
|
+
/** 清除子表项区域覆盖单元格上的字段与子表项标记 */
|
|
10
|
+
export declare function clearSubTableItemCells(table: Wtbl, itemRegion: Region): void;
|
|
11
|
+
export {};
|
|
@@ -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;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { RepeatingRegion } from './subtable/repeating/RepeatingRegion';
|
|
2
|
+
import { BoundedRegion } from './subtable/bounded/BoundedRegion';
|
|
3
|
+
import { CheckTableRegion } from './subtable/link/CheckTableRegion';
|
|
4
|
+
import { TableHeaderRegion } from './header/TableHeaderRegion';
|
|
5
|
+
import { SubTableHeaderRegion } from './header/SubTableHeaderRegion';
|
|
6
|
+
import { _2DTableRegion } from './subtable/link/_2DTableRegion';
|
|
7
|
+
/** 表格上可注册的全部逻辑区域 */
|
|
8
|
+
export type TableRegion = RepeatingRegion | _2DTableRegion | BoundedRegion | CheckTableRegion | TableHeaderRegion | SubTableHeaderRegion;
|
|
9
|
+
/** 可作为子表体的区域类型 */
|
|
10
|
+
export type SubTableRegion = RepeatingRegion | BoundedRegion;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { DataManager } from '../data/DataManager';
|
|
2
2
|
import { Wtr, Wtbl, Wtc } from '../model/document';
|
|
3
3
|
import { RepeatingRegion, BoundedRegion, TableHeaderRegion, SubTableHeaderRegion, CheckTableRegion, _2DTableRegion } from '../model/logic';
|
|
4
|
+
import { LinkSubTableCellZone } from '../layout/linkSubTableLayout';
|
|
4
5
|
import { Doc } from '../view/Doc';
|
|
6
|
+
/** 表格矩形范围(含起止行列,均为闭区间) */
|
|
5
7
|
export type TableRange = {
|
|
6
8
|
start: {
|
|
7
9
|
row: number;
|
|
@@ -12,13 +14,16 @@ export type TableRange = {
|
|
|
12
14
|
col: number;
|
|
13
15
|
};
|
|
14
16
|
};
|
|
17
|
+
/** 展开后的单元格片段,供布局与数据绑定使用 */
|
|
15
18
|
export type CellFragment = {
|
|
16
19
|
id: string;
|
|
17
20
|
expandFromId: string;
|
|
18
21
|
rowspan: number;
|
|
19
22
|
colspan: number;
|
|
20
23
|
dataIndex?: number;
|
|
24
|
+
/** 二维表横向数据索引(数据关联区) */
|
|
21
25
|
xDataIndex?: number;
|
|
26
|
+
/** 二维表纵向数据索引 */
|
|
22
27
|
yDataIndex?: number;
|
|
23
28
|
repeatingId?: string;
|
|
24
29
|
_2DTableId?: string;
|
|
@@ -26,6 +31,8 @@ export type CellFragment = {
|
|
|
26
31
|
checkTableId?: string;
|
|
27
32
|
mergeFromId?: string;
|
|
28
33
|
headerId?: string;
|
|
34
|
+
/** 数据关联子表单元格分区:交叉 / 横向 / 纵向 */
|
|
35
|
+
cellZone?: LinkSubTableCellZone;
|
|
29
36
|
};
|
|
30
37
|
type RowFragment = {
|
|
31
38
|
id: string;
|
|
@@ -33,28 +40,36 @@ type RowFragment = {
|
|
|
33
40
|
cells: CellFragment[];
|
|
34
41
|
};
|
|
35
42
|
type ModelNode = Wtr | Wtc;
|
|
43
|
+
/** 模板坐标 "row,col" → 数据项索引及引用单元格 */
|
|
36
44
|
type IndexMap = Map<string, {
|
|
37
45
|
dataIndex: number;
|
|
38
46
|
refPos?: string;
|
|
39
47
|
refCellId?: string;
|
|
40
48
|
}>;
|
|
49
|
+
type SubTableRegion = RepeatingRegion | BoundedRegion | CheckTableRegion | _2DTableRegion;
|
|
41
50
|
export declare class TableExpander {
|
|
42
51
|
table: Wtbl;
|
|
43
52
|
doc: Doc;
|
|
44
53
|
data: DataManager;
|
|
54
|
+
/** 模板节点 id → Wtr / Wtc */
|
|
45
55
|
modelMapper: Map<string, ModelNode>;
|
|
56
|
+
/** 展开实例 id → RowFragment / CellFragment */
|
|
46
57
|
instanceMapper: Map<string, RowFragment | CellFragment>;
|
|
58
|
+
/** 模板行索引 → 各类逻辑区域(用于按行分发展开策略) */
|
|
47
59
|
rowIndexRepeatingMapper: Map<number, RepeatingRegion>;
|
|
48
60
|
rowIndex2DTableMapper: Map<number, _2DTableRegion>;
|
|
49
61
|
rowIndexBoundedMapper: Map<number, BoundedRegion>;
|
|
50
62
|
rowIndexCheckTableMapper: Map<number, CheckTableRegion>;
|
|
51
63
|
rowIndexTableHeaderMapper: Map<number, TableHeaderRegion | SubTableHeaderRegion>;
|
|
52
64
|
rowIdTableHeaderMapper: Map<string, TableHeaderRegion | SubTableHeaderRegion>;
|
|
53
|
-
rowIdSubTableMapper: Map<string,
|
|
65
|
+
rowIdSubTableMapper: Map<string, SubTableRegion>;
|
|
66
|
+
/** 固定表 / 检验表 / 二维表:数据关联铺砖后的单元格数据索引 */
|
|
54
67
|
boundedCellDataIndexMap: IndexMap;
|
|
55
68
|
checkTableCellDataIndexMap: IndexMap;
|
|
56
69
|
_2DTableCellDataIndexMap: IndexMap;
|
|
70
|
+
/** 展开后的行列表(按文档顺序) */
|
|
57
71
|
rows: RowFragment[];
|
|
72
|
+
/** 表头区域 id → 该区域包含的模板行 id 列表 */
|
|
58
73
|
regionIdTableHeaderMetaMap: Map<string, {
|
|
59
74
|
rowIds: string[];
|
|
60
75
|
}>;
|
|
@@ -62,38 +77,54 @@ export declare class TableExpander {
|
|
|
62
77
|
getModelById<T extends ModelNode = Wtc>(id: string): T | undefined;
|
|
63
78
|
initialize(): void;
|
|
64
79
|
private initializeModelMapper;
|
|
65
|
-
|
|
66
|
-
private
|
|
67
|
-
private
|
|
68
|
-
private initializeCheckTableMapper;
|
|
80
|
+
/** 建立模板行索引 / 行 id 与各类子表、表头区域的映射 */
|
|
81
|
+
private initializeRegionMappers;
|
|
82
|
+
private registerRowsForRegions;
|
|
69
83
|
private initializeTableHeaderMapper;
|
|
70
84
|
private initializeBoundedItemDataIndex;
|
|
85
|
+
/**
|
|
86
|
+
* 检验表 / 二维表的数据关联区:itemRegion 可能超出子表行范围(向上/下扩充),
|
|
87
|
+
* 展开铺砖时需用扩充后的行范围。
|
|
88
|
+
*/
|
|
71
89
|
private getDataGroup2DItemRange;
|
|
72
90
|
private initializeDataGroup2DDataIndex;
|
|
91
|
+
private initLinkSubTableCellIndexMaps;
|
|
92
|
+
private mergeIndexMap;
|
|
73
93
|
private initializeRows;
|
|
94
|
+
/** 编辑模式只展开一份;预览/填报模式按数据路径长度重复 */
|
|
74
95
|
getRepeatCount(region: RepeatingRegion | _2DTableRegion): number;
|
|
75
96
|
private initializeRepeatingRowsInRange;
|
|
76
97
|
private initialize2DTableRowsInRange;
|
|
98
|
+
/**
|
|
99
|
+
* 循环子表与二维子表共用的纵向展开逻辑:
|
|
100
|
+
* 按数据条数复制行块,区域外最后一行单元格需合并 rowspan 以覆盖重复产生的额外行。
|
|
101
|
+
*/
|
|
102
|
+
private initializeRepeatableSubTableRows;
|
|
103
|
+
/**
|
|
104
|
+
* 循环区域外、首条数据最后一行:将 rowspan 拉长以吞并后续重复行,
|
|
105
|
+
* 避免区域外单元格被拆成多行。
|
|
106
|
+
*/
|
|
107
|
+
private tryCreateExtendedRowspanCell;
|
|
77
108
|
private initializeBoundedRowInRange;
|
|
78
109
|
private initializeCheckTableRowInRange;
|
|
79
110
|
private initializeTableHeaderRowInRange;
|
|
80
111
|
private initializeNormalRowInRange;
|
|
112
|
+
private buildSingleTemplateRow;
|
|
113
|
+
private createTemplateCell;
|
|
114
|
+
private pushRow;
|
|
115
|
+
private getLinkSubTableCellIndexMap;
|
|
116
|
+
private getFillEndColForRegion;
|
|
117
|
+
private findLinkSubTableRegionForCell;
|
|
118
|
+
private resolveLinkSubTableCellMeta;
|
|
119
|
+
/** 根据主单元格的 rowspan/colspan,为被覆盖的从属单元格设置 mergeFromId */
|
|
81
120
|
private transformMergeRelations;
|
|
82
121
|
/**
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
* @param range - 整体范围 {start:{row,col} end:{row,col}},表示需要分配数据项的总区域
|
|
86
|
-
* @param itemRange - 局部范围 {start:{row,col} end:{row,col}},表示一个数据项的模板大小
|
|
87
|
-
* @param fillDirection - `x`:先横向扩展再换行;`y`:先纵向扩展再换列(与 `x` 的行列外层循环互为镜像)
|
|
88
|
-
* @returns Map,key 为字符串 "row,col",值为对应的数据索引
|
|
89
|
-
*
|
|
90
|
-
* 横向(x)算法:
|
|
91
|
-
* 1. 局部范围内的单元格数据索引为 0
|
|
92
|
-
* 2. 从局部范围右侧开始,按 itemWidth 宽度逐个扩展数据项
|
|
93
|
-
* 3. 当同一行带内无法再放置更多数据项时,换到下一个 itemHeight 行带
|
|
94
|
-
* 4. 换行后从整体范围的最左侧列开始继续扩展
|
|
122
|
+
* 计算单元格对应的数据索引(用于范围扩展 / 数据关联铺砖)。
|
|
95
123
|
*
|
|
96
|
-
*
|
|
124
|
+
* @param range - 需要分配数据项的总区域
|
|
125
|
+
* @param itemRange - 单个数据项的模板大小(局部范围索引均为 0)
|
|
126
|
+
* @param fillDirection - `x`:先横向铺砖再换行;`y`:先纵向铺砖再换列
|
|
127
|
+
* @returns key 为 "row,col",含 dataIndex 及引用模板单元格 id
|
|
97
128
|
*/
|
|
98
129
|
computeDataIndexMap(range: TableRange, itemRange: TableRange, fillDirection?: 'x' | 'y'): IndexMap;
|
|
99
130
|
}
|
|
@@ -3,11 +3,8 @@ import { LayoutGroup, LayoutGroupOptions } from './base';
|
|
|
3
3
|
import { IContainerMetrics, Border } from './types';
|
|
4
4
|
import { Table } from './Table';
|
|
5
5
|
import { TableRow } from './TableRow';
|
|
6
|
-
import { RepeatingWidgetMeta } from '../model/logic
|
|
7
|
-
import {
|
|
8
|
-
import { CheckTableWidgetMeta } from '../model/logic/CheckTableRegion';
|
|
9
|
-
import { TableRange } from '../utils/expand';
|
|
10
|
-
import { _2DTableWidgetMeta } from '../model/logic/_2DTableRegion';
|
|
6
|
+
import { RepeatingWidgetMeta, BoundedWidgetMeta, CheckTableWidgetMeta, _2DTableWidgetMeta } from '../model/logic';
|
|
7
|
+
import { LinkSubTableCellZone } from '../layout/linkSubTableLayout';
|
|
11
8
|
export interface TableCellOptions extends LayoutGroupOptions {
|
|
12
9
|
colspan?: number;
|
|
13
10
|
rowspan?: number;
|
|
@@ -23,11 +20,10 @@ export type SubRenderer = {
|
|
|
23
20
|
dataIndex?: number;
|
|
24
21
|
valuePath: string;
|
|
25
22
|
widgetMeta?: RepeatingWidgetMeta | BoundedWidgetMeta | CheckTableWidgetMeta | _2DTableWidgetMeta;
|
|
26
|
-
dataGroup2DAreaRange?: TableRange;
|
|
27
23
|
xDataIndex?: number;
|
|
28
24
|
yDataIndex?: number;
|
|
29
25
|
/** 用来标记二维表的子类型 交叉 / 横向 / 纵向 */
|
|
30
|
-
cellZone?:
|
|
26
|
+
cellZone?: LinkSubTableCellZone;
|
|
31
27
|
};
|
|
32
28
|
export declare class TableCell extends LayoutGroup<Paragraph> implements IContainerMetrics {
|
|
33
29
|
component: "tableCell";
|
|
@@ -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
|
}
|