@gct-paas/word 0.1.37 → 0.1.39
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/command/commands/Backspace.d.ts +2 -0
- package/dist/core/data/DataManager.d.ts +34 -4
- package/dist/core/data/data-path-suffix.d.ts +7 -0
- package/dist/core/data/enricher-types.d.ts +6 -0
- package/dist/core/data/enrichers/build-field-enrichers.d.ts +6 -0
- package/dist/core/data/post-change-pipeline.d.ts +102 -0
- package/dist/core/data/subtable-row.d.ts +17 -0
- package/dist/core/layout/LayoutContext.d.ts +2 -0
- package/dist/core/layout/handlers/FieldHandler.d.ts +2 -0
- package/dist/core/layout/handlers/fields/index.d.ts +1 -0
- package/dist/core/layout/logic/LayoutBuilder.d.ts +4 -0
- package/dist/core/model/DocModel.d.ts +2 -2
- package/dist/core/model/document/WrText.d.ts +4 -0
- package/dist/core/utils/expand.d.ts +10 -0
- package/dist/index.es.js +46620 -744
- package/dist/sdk/doc-runtime/check-table/expand-runtime-json.d.ts +12 -0
- package/dist/sdk/doc-runtime/check-table/index.d.ts +4 -0
- package/dist/sdk/doc-runtime/check-table/map-check-table-item-infos.d.ts +14 -0
- package/dist/sdk/doc-runtime/check-table/resolve-check-table-item-infos.d.ts +5 -0
- package/dist/sdk/doc-runtime/check-table/types.d.ts +29 -0
- package/dist/sdk/doc-runtime/utils/wait-for-data-settle.d.ts +8 -0
- package/dist/sdk/types/index.d.ts +4 -2
- package/dist/suites/edhr/check-table/check-table-dyn-value.d.ts +4 -0
- package/dist/suites/edhr/panel-schema/data-init/utils/sql.d.ts +2 -2
- package/dist/utils/func/render.d.ts +1 -1
- package/dist/word.css +71 -71
- package/package.json +2 -1
|
@@ -30,6 +30,8 @@ export declare class Backspace extends CommandBase<'backspace'> {
|
|
|
30
30
|
* 处理组件 run 的删除
|
|
31
31
|
*/
|
|
32
32
|
private handleWidgetRun;
|
|
33
|
+
/** 处理表格内联纸张组件(时间差/序号等):整段删除,不按 char 删模型 */
|
|
34
|
+
private handleInlinePageWidgetRun;
|
|
33
35
|
/** 处理悬浮 run 的删除 */
|
|
34
36
|
private handleOverlayPageWidgetRun;
|
|
35
37
|
/**
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { Doc } from '../view/Doc';
|
|
2
|
+
import { PostChangePipelineContext } from './post-change-pipeline';
|
|
3
|
+
export type EmitSource = 'user' | 'dependency' | 'enrichment' | 'parent';
|
|
2
4
|
export type Data = Record<string, any>;
|
|
3
5
|
export type PartialData = Partial<Data>;
|
|
4
6
|
type JsonPath = string;
|
|
@@ -13,12 +15,17 @@ export declare class DataManager {
|
|
|
13
15
|
private subscriptions;
|
|
14
16
|
private depGraph;
|
|
15
17
|
private depQueue;
|
|
16
|
-
private depScheduled;
|
|
17
18
|
private computing;
|
|
18
19
|
private layoutScheduled;
|
|
19
20
|
private emitScheduled;
|
|
20
21
|
private emitQueue;
|
|
21
22
|
private rawData;
|
|
23
|
+
private postChangePipeline?;
|
|
24
|
+
/** 无字段依赖的常量公式(如 true)已执行过的 depKey,防止重复 register 死循环 */
|
|
25
|
+
private ranImmediateDepKeys;
|
|
26
|
+
/** 正在执行「注册时立即跑」的依赖,避免 setMultiple 再次走完整 postChange */
|
|
27
|
+
private runningImmediateDep;
|
|
28
|
+
private immediateDepDataTouched;
|
|
22
29
|
/**
|
|
23
30
|
* 默认值 Map
|
|
24
31
|
* key: jsonpath 路径 (支持 [n] 数组索引)
|
|
@@ -32,8 +39,11 @@ export declare class DataManager {
|
|
|
32
39
|
/**
|
|
33
40
|
* 调度 layout,自动合并同一微任务队列中的多个操作
|
|
34
41
|
*/
|
|
42
|
+
attachPostChangePipeline(ctx: PostChangePipelineContext): void;
|
|
35
43
|
private scheduleLayout;
|
|
36
44
|
getLabelPath(path: JsonPath): JsonPath;
|
|
45
|
+
/** 供 PostChangePipeline 在同一微任务内刷新公式依赖 */
|
|
46
|
+
flushDependenciesNow(): Promise<void>;
|
|
37
47
|
/**
|
|
38
48
|
* 根据 jsonpath 获取原始数据(仅返回 rawData 中的值)
|
|
39
49
|
* @param path jsonpath 路径 (例如: "document.body.children[0].text" 或 "user.name")
|
|
@@ -47,6 +57,10 @@ export declare class DataManager {
|
|
|
47
57
|
* @returns 指定路径的标签值或原值,不存在返回 undefined
|
|
48
58
|
*/
|
|
49
59
|
getLabel<T = any>(path: JsonPath): T | undefined;
|
|
60
|
+
/** 子表数组路径下未软删行数 */
|
|
61
|
+
countActiveSubtableRows(arrayPath: JsonPath): number;
|
|
62
|
+
/** 版面可见行下标 → rawData 数组实际下标 */
|
|
63
|
+
resolveSubtableVisibleIndex(arrayPath: JsonPath, visibleIndex: number): number;
|
|
50
64
|
private assignField;
|
|
51
65
|
/**
|
|
52
66
|
* 根据 jsonpath 设置数据
|
|
@@ -54,7 +68,7 @@ export declare class DataManager {
|
|
|
54
68
|
* @param value 要设置的值
|
|
55
69
|
* @returns 是否设置成功
|
|
56
70
|
*/
|
|
57
|
-
set(path: JsonPath, value: any, source?:
|
|
71
|
+
set(path: JsonPath, value: any, source?: EmitSource): boolean;
|
|
58
72
|
/**
|
|
59
73
|
* 从带数字下标的 path 推断二维坐标(供 setMultiple / patch / 业务回填等无 modelRef 的场景)
|
|
60
74
|
* - 单轴:$.f_ewb[0].f_name → y=0;$.f_ewblink[1].x → x=1(需能从 rawData 的交叉 key 识别轴,或命中 link 命名启发)
|
|
@@ -106,7 +120,9 @@ export declare class DataManager {
|
|
|
106
120
|
* @param updates 路径与值的映射对象
|
|
107
121
|
* @returns 是否全部设置成功
|
|
108
122
|
*/
|
|
109
|
-
setMultiple(updates: Record<JsonPath, any>, source?:
|
|
123
|
+
setMultiple(updates: Record<JsonPath, any>, source?: EmitSource): boolean;
|
|
124
|
+
/** 依赖赋值写回 rawData,不触发 emit(用于注册期常量公式立即执行) */
|
|
125
|
+
private applyDependencyWrites;
|
|
110
126
|
/**
|
|
111
127
|
* 在数组末尾添加一个或多个元素
|
|
112
128
|
* @param path 数组的 jsonpath 路径
|
|
@@ -158,6 +174,17 @@ export declare class DataManager {
|
|
|
158
174
|
* 这样可以保证:参数映射(`[n]`)先铺好默认值,自定义数据源(真实下标)再精确覆盖。
|
|
159
175
|
*/
|
|
160
176
|
applyInitData(initDataMap: Record<string, any>): void;
|
|
177
|
+
/**
|
|
178
|
+
* 仅补齐检验表关联轴子表(如 f_jianyan2)到动态关联铺砖槽位数。
|
|
179
|
+
* 不处理检验项主体(f_jianyan1)与二维表,避免覆盖接口行或误扩纵向轴。
|
|
180
|
+
*/
|
|
181
|
+
private syncSubTableRowsToLayout;
|
|
182
|
+
/** 子表在 rawData 中的行数(支持尚未转成数组的 { data: [] } 接口形态,此时返回 0 且不在此阶段强转) */
|
|
183
|
+
private countSubTableDataRows;
|
|
184
|
+
/**
|
|
185
|
+
* 为检验表关联轴补足铺砖行:占位标记 + __gw_x_uid(与 push/insert 行为一致)。
|
|
186
|
+
*/
|
|
187
|
+
private ensureCheckTableLinkLayoutRows;
|
|
161
188
|
private applyInitDataCrossWildcard;
|
|
162
189
|
/**
|
|
163
190
|
* 解析子表初始化行数:接口已有行数、版面数据分组槽位。
|
|
@@ -210,9 +237,10 @@ export declare class DataManager {
|
|
|
210
237
|
*/
|
|
211
238
|
private emit;
|
|
212
239
|
/**
|
|
240
|
+
* 通知订阅者与依赖队列(不触发布局)
|
|
213
241
|
* 实际执行 emit 逻辑
|
|
214
242
|
*/
|
|
215
|
-
private
|
|
243
|
+
private doEmitNotify;
|
|
216
244
|
/**
|
|
217
245
|
* 获取父路径
|
|
218
246
|
*/
|
|
@@ -256,6 +284,8 @@ export declare class DataManager {
|
|
|
256
284
|
private collectDependencies;
|
|
257
285
|
/** 统一执行组件依赖 */
|
|
258
286
|
private flushDependencies;
|
|
287
|
+
/** 注册时立即执行无依赖的常量公式(true / 显示值等) */
|
|
288
|
+
private runImmediateDependency;
|
|
259
289
|
/** 执行依赖 */
|
|
260
290
|
private runDepsByPath;
|
|
261
291
|
/** 运行公式 */
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** 与 rawData 并存的 label 后缀(展示用) */
|
|
2
|
+
export declare const LABEL_SUFFIX = "_lb_";
|
|
3
|
+
/** 与 rawData 并存的外链 href 后缀(超链接字段) */
|
|
4
|
+
export declare const HREF_SUFFIX = "_href_";
|
|
5
|
+
export declare function getLabelPath(path: string): string;
|
|
6
|
+
export declare function getHrefPath(path: string): string;
|
|
7
|
+
export declare function isDerivedDataPath(path: string): boolean;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Wr } from '../../model/document';
|
|
2
|
+
import { PostChangePipelineContext } from '../post-change-pipeline';
|
|
3
|
+
import { DataEnricherRegistration } from '../enricher-types';
|
|
4
|
+
export declare function buildFieldEnricherRegistrations(instances: Wr[], ctx: PostChangePipelineContext): DataEnricherRegistration[];
|
|
5
|
+
/** 收集 init 后需 enrich 的运行时路径(将 [n] 等占位替换为 0) */
|
|
6
|
+
export declare function collectInitialEnrichPaths(instances: Wr[]): string[];
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { FIELD_TYPE } from '../../domain/field/field-type';
|
|
2
|
+
import { FieldManifest } from '../../capabilities/field-manifest';
|
|
3
|
+
import { FieldMeta } from '../../capabilities/model-field-runtime';
|
|
4
|
+
import { Doc } from '../view/Doc';
|
|
5
|
+
import { DataManager, EmitSource } from './DataManager';
|
|
6
|
+
/**
|
|
7
|
+
* Pipeline 运行时上下文
|
|
8
|
+
*
|
|
9
|
+
* 主要给 enrichers 使用:
|
|
10
|
+
* - 获取字段 manifest
|
|
11
|
+
* - 动态加载字段 meta
|
|
12
|
+
*/
|
|
13
|
+
export type PostChangePipelineContext = {
|
|
14
|
+
/**
|
|
15
|
+
* 根据字段类型获取 manifest
|
|
16
|
+
*/
|
|
17
|
+
getFieldManifest: (type: FIELD_TYPE) => FieldManifest | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* 根据模型 key + 字段 key 获取字段 meta
|
|
20
|
+
*/
|
|
21
|
+
loadFieldByKey: (modelKey: string, key: string) => Promise<FieldMeta | undefined>;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* 数据变更后的处理流水线
|
|
25
|
+
*
|
|
26
|
+
* 主要职责:
|
|
27
|
+
* 1. 等待依赖字段刷新完成
|
|
28
|
+
* 2. 根据 changedPaths 找到对应 enrichers
|
|
29
|
+
* 3. 执行 enrich 逻辑
|
|
30
|
+
* 4. 将 enrich 结果再次写回 DataManager
|
|
31
|
+
*
|
|
32
|
+
* 典型场景:
|
|
33
|
+
* - 自动填充字段
|
|
34
|
+
* - 字段联动
|
|
35
|
+
* - 数据增强
|
|
36
|
+
* - 根据某字段自动计算其它字段
|
|
37
|
+
*/
|
|
38
|
+
export declare class PostChangePipeline {
|
|
39
|
+
/**
|
|
40
|
+
* 数据管理器
|
|
41
|
+
*/
|
|
42
|
+
private dataManager;
|
|
43
|
+
/**
|
|
44
|
+
* 文档实例
|
|
45
|
+
*/
|
|
46
|
+
private doc;
|
|
47
|
+
/**
|
|
48
|
+
* 当前注册的 enrichers
|
|
49
|
+
*
|
|
50
|
+
* 每个 enricher:
|
|
51
|
+
* - match(path) 判断是否处理该字段
|
|
52
|
+
* - enrich(path, value) 生成补充数据
|
|
53
|
+
*/
|
|
54
|
+
private enrichers;
|
|
55
|
+
/**
|
|
56
|
+
* 防止同一路径重复并发执行
|
|
57
|
+
*
|
|
58
|
+
* key:
|
|
59
|
+
* path
|
|
60
|
+
*
|
|
61
|
+
* value:
|
|
62
|
+
* 当前执行中的 Promise
|
|
63
|
+
*/
|
|
64
|
+
private inFlight;
|
|
65
|
+
/**
|
|
66
|
+
* pipeline 上下文
|
|
67
|
+
*/
|
|
68
|
+
private pipelineCtx?;
|
|
69
|
+
constructor(
|
|
70
|
+
/**
|
|
71
|
+
* 数据管理器
|
|
72
|
+
*/
|
|
73
|
+
dataManager: DataManager,
|
|
74
|
+
/**
|
|
75
|
+
* 文档实例
|
|
76
|
+
*/
|
|
77
|
+
doc: Doc);
|
|
78
|
+
/**
|
|
79
|
+
* 设置 pipeline 上下文
|
|
80
|
+
*
|
|
81
|
+
* 设置后会重新构建 enrichers
|
|
82
|
+
*/
|
|
83
|
+
setContext(ctx: PostChangePipelineContext): void;
|
|
84
|
+
/**
|
|
85
|
+
* 重建 enricher 注册列表
|
|
86
|
+
*
|
|
87
|
+
* 从当前文档中的 widget instances
|
|
88
|
+
* 动态生成 enrichers
|
|
89
|
+
*/
|
|
90
|
+
rebuildRegistrations(): void;
|
|
91
|
+
/**
|
|
92
|
+
* 变更后执行流水线
|
|
93
|
+
*
|
|
94
|
+
* @param changedPaths 本次变化的字段路径
|
|
95
|
+
* @param source 变更来源
|
|
96
|
+
*/
|
|
97
|
+
flush(changedPaths: string[], source: EmitSource): Promise<void>;
|
|
98
|
+
/**
|
|
99
|
+
* 执行某个 path 对应的 enrichers
|
|
100
|
+
*/
|
|
101
|
+
private runEnrichersForPath;
|
|
102
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** 子表行软删 / 可见下标与存储下标映射(与后端 deleted_ 约定一致) */
|
|
2
|
+
type AxisType = 'x' | 'y';
|
|
3
|
+
export type PersistedSubtableRowContext = {
|
|
4
|
+
rawData?: Record<string, any>;
|
|
5
|
+
/** 子表 key,如 f_ewb、f_ewblink(不含 $.) */
|
|
6
|
+
tableKey?: string;
|
|
7
|
+
axis?: AxisType;
|
|
8
|
+
};
|
|
9
|
+
/** 是否应软删(打 deleted_)而非 splice */
|
|
10
|
+
export declare function isPersistedSubtableRow(row: Record<string, any> | undefined | null, ctx?: PersistedSubtableRowContext): boolean;
|
|
11
|
+
/** 未软删的行数;空数组返回 0 */
|
|
12
|
+
export declare function countActiveSubtableRows(rows: unknown): number;
|
|
13
|
+
/** 版面可见行下标 → rawData 数组中的实际下标 */
|
|
14
|
+
export declare function resolveSubtableStorageIndex(rows: any[], visibleIndex: number): number;
|
|
15
|
+
/** 在可见下标处插入时对应的 splice 位置 */
|
|
16
|
+
export declare function resolveSubtableInsertIndex(rows: any[], visibleIndex: number): number;
|
|
17
|
+
export {};
|
|
@@ -48,6 +48,8 @@ export declare class LayoutContext {
|
|
|
48
48
|
*/
|
|
49
49
|
getParagraphRemainingSize(): number;
|
|
50
50
|
addRun(run: LayoutNode): void;
|
|
51
|
+
/** 子表可见行下标 → rawData 存储下标(跳过 deleted_ 行) */
|
|
52
|
+
private mapSubtableVisibleIndex;
|
|
51
53
|
/**
|
|
52
54
|
* 根据 dataIndex 替换 path 中的 [n] 为实际值
|
|
53
55
|
* @param path 包含 [n] 的路径,如 "$.items[n].name"
|
|
@@ -2,4 +2,6 @@ import { WrText } from '../../model/document';
|
|
|
2
2
|
import { LayoutContext } from '../LayoutContext';
|
|
3
3
|
export declare class FieldHandler {
|
|
4
4
|
static layout(context: LayoutContext, wr: WrText): void;
|
|
5
|
+
/** 检验表交叉区 value_:按同行检验项 type_ 渲染,值路径固定 value_ */
|
|
6
|
+
private static layoutCheckTableCrossValue;
|
|
5
7
|
}
|
|
@@ -3,3 +3,4 @@ export { FieldImageHandler } from './FieldImageHandler';
|
|
|
3
3
|
export { SignatureHandler } from './SignatureHandler';
|
|
4
4
|
export { InputHandler } from './InputHandler';
|
|
5
5
|
export { AttachmentHandler } from './AttachmentHandler';
|
|
6
|
+
export { FieldBaseHandler } from './FieldBaseHandler';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BuiltinComponentType } from '../../constants';
|
|
2
|
+
import { LayoutNode } from '../../view/base';
|
|
2
3
|
import { TextWidget } from '../../view/runs/TextWidget';
|
|
3
4
|
import { Page } from '../../view/Page';
|
|
4
5
|
import { BaseMetaNode, LineInfo } from '../types';
|
|
@@ -30,3 +31,6 @@ export declare function validateTextWidgetMarker(raw: TextWidget, checkMarker: b
|
|
|
30
31
|
* @param node - 节点
|
|
31
32
|
*/
|
|
32
33
|
export declare function isClickPaperWidgetAllNode(node: BaseMetaNode): boolean;
|
|
34
|
+
export declare function isOverlayPageWidgetType(type?: string): boolean;
|
|
35
|
+
/** 表格内联纸张组件(时间差/序号等),布局为多 char run、模型为 WrPageWidget */
|
|
36
|
+
export declare function isInlineTextPageWidgetRun(run?: LayoutNode | null): run is TextWidget;
|
|
@@ -69,8 +69,8 @@ export declare class DocModel {
|
|
|
69
69
|
* 根据版面数据分组 / 动态关联铺砖,计算子表字段在 rawData 中应初始化的行数。
|
|
70
70
|
*
|
|
71
71
|
* - 固定表:槽位归 subFieldKey(bounded + itemRegion)
|
|
72
|
-
* - 二维表 /
|
|
73
|
-
* 纵向 subFieldKey(如
|
|
72
|
+
* - 二维表 / 检验表:动态分组铺砖槽位归 linkFieldKey(如 f_jianyan2);
|
|
73
|
+
* 纵向 subFieldKey(如 f_jianyan1)由检验项条数撑行,返回 0
|
|
74
74
|
* - 其它子表无分组:返回 1
|
|
75
75
|
*/
|
|
76
76
|
getSubTableLayoutSlotCount(subFieldKey: string): number;
|
|
@@ -110,6 +110,10 @@ export declare class WrText extends ModelNode {
|
|
|
110
110
|
cloneWithId(id: string): WrText;
|
|
111
111
|
/** 需要进行拼接成运行时的 modelId */
|
|
112
112
|
cloneWithSuffix(suffix: string, index: string | undefined): WrText;
|
|
113
|
+
/**
|
|
114
|
+
* 按 layout run 的 modelRef.id 拼接运行时后缀($p 页眉页脚 / @ 数据分组与动态关联)
|
|
115
|
+
*/
|
|
116
|
+
cloneWithRuntimeRefFrom(runtimeModelRefId: string): WrText;
|
|
113
117
|
/**
|
|
114
118
|
* 从原始 XML JSON 转换为 WrText 实例
|
|
115
119
|
* @param json w:r XML JSON 对象
|
|
@@ -116,6 +116,16 @@ export declare class TableExpander {
|
|
|
116
116
|
private getFillEndColForRegion;
|
|
117
117
|
private findLinkSubTableRegionForCell;
|
|
118
118
|
private resolveLinkSubTableCellMeta;
|
|
119
|
+
/**
|
|
120
|
+
* 检验表纵向主体下标(对应 subValuePath 上的 [n] / 交叉区 [n_y])。
|
|
121
|
+
* 二维表由 repeat 展开赋值;检验表由接口预扩行,按主体行在 region 内的偏移计算。
|
|
122
|
+
*/
|
|
123
|
+
private applyCheckTableYDataIndex;
|
|
124
|
+
private resolveCheckTableYDataIndex;
|
|
125
|
+
/** 检验表主体数据条数(与二维表 repeatCount 同源) */
|
|
126
|
+
private getCheckTableDataCount;
|
|
127
|
+
/** 单条数据占用的主体模板行数(接口预扩行后由「扩后行数 / 数据条数」反推) */
|
|
128
|
+
private getCheckTableTemplateBodyRowStride;
|
|
119
129
|
/** 根据主单元格的 rowspan/colspan,为被覆盖的从属单元格设置 mergeFromId */
|
|
120
130
|
private transformMergeRelations;
|
|
121
131
|
/**
|