@gct-paas/word 0.1.31 → 0.1.33

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.
Files changed (51) hide show
  1. package/dist/base/input/src/input.vue.d.ts +1 -1
  2. package/dist/base/input/src/text-area.vue.d.ts +1 -1
  3. package/dist/base/table/src/table.vue.d.ts +1 -1
  4. package/dist/core/command/commands/InsertField.d.ts +22 -2
  5. package/dist/core/command/types.d.ts +0 -2
  6. package/dist/core/data/DataManager.d.ts +38 -8
  7. package/dist/core/interaction/useInteraction.d.ts +1 -0
  8. package/dist/core/layout/handlers/TextHandler.d.ts +0 -1
  9. package/dist/core/layout/handlers/fields/FieldBaseHandler.d.ts +1 -1
  10. package/dist/core/layout/linkSubTableLayout.d.ts +22 -0
  11. package/dist/core/layout/providers/TableInfoProvider.d.ts +2 -3
  12. package/dist/core/model/document/Wtbl/RegionManager.d.ts +47 -10
  13. package/dist/core/model/document/Wtc.d.ts +20 -15
  14. package/dist/core/model/document/wtcRegionRef.d.ts +20 -0
  15. package/dist/core/model/logic/{Region.d.ts → base/Region.d.ts} +2 -5
  16. package/dist/core/model/logic/{SubTableHeaderRegion.d.ts → header/SubTableHeaderRegion.d.ts} +3 -6
  17. package/dist/core/model/logic/{TableHeaderRegion.d.ts → header/TableHeaderRegion.d.ts} +3 -3
  18. package/dist/core/model/logic/index.d.ts +18 -22
  19. package/dist/core/model/logic/{BoundedItemRegion.d.ts → subtable/bounded/BoundedItemRegion.d.ts} +1 -1
  20. package/dist/core/model/logic/{BoundedRegion.d.ts → subtable/bounded/BoundedRegion.d.ts} +3 -9
  21. package/dist/core/model/logic/subtable/link/CheckTableRegion.d.ts +11 -0
  22. package/dist/core/model/logic/subtable/link/DataGroup2DRegion.d.ts +11 -0
  23. package/dist/core/model/logic/subtable/link/LinkSubTableRegion.d.ts +48 -0
  24. package/dist/core/model/logic/subtable/link/_2DTableRegion.d.ts +11 -0
  25. package/dist/core/model/logic/{RepeatingRegion.d.ts → subtable/repeating/RepeatingRegion.d.ts} +3 -9
  26. package/dist/core/model/logic/subtable/shared/itemRegionOps.d.ts +11 -0
  27. package/dist/core/model/logic/types.d.ts +10 -0
  28. package/dist/core/utils/expand.d.ts +49 -18
  29. package/dist/core/utils/index.d.ts +0 -4
  30. package/dist/core/view/TableCell.d.ts +6 -8
  31. package/dist/core/view/base/LayoutNode.d.ts +0 -1
  32. package/dist/domain/active/active-types.d.ts +1 -0
  33. package/dist/index.es.js +1895 -1434
  34. package/dist/runtime/_register_/composables/panel/useActivePanel.d.ts +1 -0
  35. package/dist/runtime/canvas/table/utils/index.d.ts +10 -2
  36. package/dist/runtime/canvas/table/utils/useTableSelection.d.ts +1 -0
  37. package/dist/runtime/factories/createDesignWidgetFactory.d.ts +17 -0
  38. package/dist/runtime/factories/{useRenderData.d.ts → useWidgetRenderData.d.ts} +18 -6
  39. package/dist/runtime/interface/computed.d.ts +6 -1
  40. package/dist/runtime/interface/render.d.ts +15 -3
  41. package/dist/runtime/renderer/dropdowns/components/tables/rdo-table-dropdown.vue.d.ts +3 -3
  42. package/dist/runtime/renderer/dropdowns/components/tables/table-dropdown.vue.d.ts +3 -3
  43. package/dist/utils/func/core.d.ts +70 -20
  44. package/dist/word.css +138 -138
  45. package/package.json +3 -3
  46. package/dist/core/model/logic/CheckTableRegion.d.ts +0 -44
  47. package/dist/core/model/logic/DataGroup2DRegion.d.ts +0 -12
  48. package/dist/core/model/logic/_2DTableRegion.d.ts +0 -44
  49. package/dist/runtime/factories/createFieldToWidgetFactory.d.ts +0 -13
  50. package/dist/runtime/factories/createPaperWidgetToWidgetFactory.d.ts +0 -13
  51. package/dist/runtime/factories/usePwRenderData.d.ts +0 -13
@@ -1,6 +1,6 @@
1
- import { Wtbl } from '../document';
2
- import { Region, RegionOptions } from './Region';
3
- import { RegionJson } from '../types';
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,6 @@ export declare class RepeatingRegion extends Region {
25
25
  valuePath: string;
26
26
  widgetMeta: RepeatingWidgetMeta;
27
27
  constructor(options: RepeatingRegionOptions);
28
- /**
29
- * 序列化为 JSON 对象
30
- */
31
28
  toJSON(): RepeatingRegionJson;
32
- /**
33
- * 从 JSON 对象还原
34
- */
35
29
  static fromJSON(json: RepeatingRegionJson, table: Wtbl): RepeatingRegion;
36
30
  }
@@ -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,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, RepeatingRegion | BoundedRegion | CheckTableRegion | _2DTableRegion>;
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
- private initializeRepeatingMapper;
66
- private initialize2DTableMapper;
67
- private initializeBoundedMapper;
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
- * 纵向(y)算法:与 x 对称——先在模板列宽内从模板下方按 itemHeight 向下铺,再换到下一组列(列宽对齐 itemWidth),新一组列从整体范围最顶行重新起铺。
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
  }
@@ -24,7 +24,3 @@ export declare function repeat(count: number, callback: (index: number) => void)
24
24
  * distributeInteger(10, 3) // [3, 3, 4]
25
25
  */
26
26
  export declare function distributeInteger(total: number, count: number): number[];
27
- /**
28
- * 将主工程的数据转换为 Word 的 JSONPath 格式数据
29
- */
30
- export declare const mainData2WordData: (data: Record<string, any>) => Record<string, any>;
@@ -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/RepeatingRegion';
7
- import { BoundedWidgetMeta } from '../model/logic/BoundedRegion';
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;
@@ -21,11 +18,12 @@ export type SubRenderer = {
21
18
  id: string;
22
19
  type: 'dynamic-table' | '2d-table' | 'fixed-table' | 'check-table' | 'table-header';
23
20
  dataIndex?: number;
24
- xDataIndex?: number;
25
- yDataIndex?: number;
26
21
  valuePath: string;
27
22
  widgetMeta?: RepeatingWidgetMeta | BoundedWidgetMeta | CheckTableWidgetMeta | _2DTableWidgetMeta;
28
- dataGroup2DAreaRange?: TableRange;
23
+ xDataIndex?: number;
24
+ yDataIndex?: number;
25
+ /** 用来标记二维表的子类型 交叉 / 横向 / 纵向 */
26
+ cellZone?: LinkSubTableCellZone;
29
27
  };
30
28
  export declare class TableCell extends LayoutGroup<Paragraph> implements IContainerMetrics {
31
29
  component: "tableCell";
@@ -7,7 +7,6 @@ type ModelRef = {
7
7
  id: string;
8
8
  start?: number;
9
9
  end?: number;
10
- valuePath2D?: string;
11
10
  xDataIndex?: number;
12
11
  yDataIndex?: number;
13
12
  };
@@ -27,6 +27,7 @@ export type PanelType =
27
27
  type ActiveContext = {
28
28
  mainModelKey: string;
29
29
  subFieldKey: string | undefined;
30
+ isDataGroup2DClicked?: boolean;
30
31
  regionId: string;
31
32
  /** 章节引用 id */
32
33
  secRefId: string;