@gct-paas/word 0.1.52-beta.2 → 0.1.52-beta.3

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 (96) hide show
  1. package/dist/base/checkbox/src/checkbox-group.vue.d.ts +1 -1
  2. package/dist/base/date-time-picker/src/DateTimePicker.vue.d.ts +1 -1
  3. package/dist/base/divider/src/divider.vue.d.ts +1 -1
  4. package/dist/base/form-item/src/form-item.vue.d.ts +1 -1
  5. package/dist/base/icon/src/icon.vue.d.ts +2 -2
  6. package/dist/base/input/src/input.vue.d.ts +4 -4
  7. package/dist/base/input/src/text-area.vue.d.ts +2 -2
  8. package/dist/base/radio/src/radio-group.vue.d.ts +1 -1
  9. package/dist/base/rdo-tree-select/src/rdo-tree-select.vue.d.ts +2 -2
  10. package/dist/base/select/src/basic-select.vue.d.ts +1 -1
  11. package/dist/base/select/src/searchable-select.vue.d.ts +2 -2
  12. package/dist/base/switch/src/switch.vue.d.ts +1 -1
  13. package/dist/base/table/src/table.vue.d.ts +1 -1
  14. package/dist/capabilities/model-field-runtime/types/field.d.ts +2 -0
  15. package/dist/core/data/DataManager.d.ts +7 -0
  16. package/dist/domain/field/field-props-schema-type.d.ts +1 -1
  17. package/dist/domain/field/field-type.d.ts +10 -1
  18. package/dist/domain/table/business/{check-table/profile.d.ts → check/check-table/profile/index.d.ts} +1 -1
  19. package/dist/domain/table/business/{material-balance/profile.d.ts → material/material-balance/profile/index.d.ts} +1 -1
  20. package/dist/domain/table/business/{material-consume/profile.d.ts → material/material-consume/profile/index.d.ts} +1 -1
  21. package/dist/domain/table/business/warehouse/warehouse-in-out/profile/fields.d.ts +2 -0
  22. package/dist/domain/table/business/warehouse/warehouse-in-out/profile/index.d.ts +2 -0
  23. package/dist/domain/table/business/warehouse/warehouse-inventory/actions/change-parse-rule.d.ts +7 -0
  24. package/dist/domain/table/business/warehouse/warehouse-inventory/actions/index.d.ts +2 -0
  25. package/dist/domain/table/business/warehouse/warehouse-inventory/actions/scan.d.ts +7 -0
  26. package/dist/domain/table/business/{warehouse-inventory → warehouse/warehouse-inventory}/index.d.ts +2 -0
  27. package/dist/domain/table/business/warehouse/warehouse-inventory/profile/field-keys.d.ts +63 -0
  28. package/dist/domain/table/business/warehouse/warehouse-inventory/profile/fields.d.ts +2 -0
  29. package/dist/domain/table/business/{warehouse-inventory/profile.d.ts → warehouse/warehouse-inventory/profile/index.d.ts} +1 -1
  30. package/dist/domain/table/business/warehouse/warehouse-inventory/runtime/index.d.ts +3 -0
  31. package/dist/domain/table/business/warehouse/warehouse-inventory/runtime/register-handlers.d.ts +1 -0
  32. package/dist/domain/table/business/warehouse/warehouse-inventory/runtime/remote-sync-apply.d.ts +9 -0
  33. package/dist/domain/table/business/warehouse/warehouse-inventory/runtime/row-change-handlers.d.ts +22 -0
  34. package/dist/domain/table/business/warehouse/warehouse-inventory/runtime/scan-config.d.ts +31 -0
  35. package/dist/domain/table/business/warehouse/warehouse-inventory/runtime/stocktake-calc.d.ts +72 -0
  36. package/dist/domain/table/business/warehouse/warehouse-inventory/runtime/warehouse-context.d.ts +3 -0
  37. package/dist/domain/table/business/{warehouse-transfer/profile.d.ts → warehouse/warehouse-transfer/profile/index.d.ts} +1 -1
  38. package/dist/domain/table/data/dynamic-table/{profile.d.ts → profile/index.d.ts} +1 -1
  39. package/dist/domain/table/data/fixed-table/{profile.d.ts → profile/index.d.ts} +1 -1
  40. package/dist/domain/table/data/two-d-table/{profile.d.ts → profile/index.d.ts} +1 -1
  41. package/dist/domain/table/{hooks → design/hooks}/on-field-attach.d.ts +2 -2
  42. package/dist/domain/table/design/hooks/on-repeating-default-props.d.ts +3 -0
  43. package/dist/domain/table/{hooks → design/hooks}/on-subtable-create.d.ts +4 -4
  44. package/dist/domain/table/design/label.d.ts +2 -0
  45. package/dist/domain/table/design/ribbon-options.d.ts +8 -0
  46. package/dist/domain/table/{_shared → design/theme}/region-item-theme.d.ts +1 -1
  47. package/dist/domain/table/index.d.ts +10 -8
  48. package/dist/domain/table/registry.d.ts +3 -13
  49. package/dist/domain/table/runtime/api/biz-service-api.d.ts +6 -0
  50. package/dist/domain/table/runtime/engines/init-load-engine.d.ts +16 -0
  51. package/dist/domain/table/runtime/engines/linkage-engine.d.ts +67 -0
  52. package/dist/domain/table/runtime/engines/main-field-bind-engine.d.ts +7 -0
  53. package/dist/domain/table/runtime/engines/remote-sync-engine.d.ts +25 -0
  54. package/dist/domain/table/runtime/engines/row-runtime-engine.d.ts +20 -0
  55. package/dist/domain/table/runtime/engines/rule-engine.d.ts +35 -0
  56. package/dist/domain/table/runtime/runtime-handlers.d.ts +72 -0
  57. package/dist/domain/table/runtime/table-runtime-context.d.ts +48 -0
  58. package/dist/domain/table/runtime/table-runtime-utils.d.ts +60 -0
  59. package/dist/domain/table/runtime/table-runtime.d.ts +64 -0
  60. package/dist/domain/table/types.d.ts +172 -62
  61. package/dist/domain/widget/component-type.d.ts +1 -1
  62. package/dist/index.es.js +19022 -16926
  63. package/dist/runtime/canvas/table/render/material-consume/tmpl-bom-controller.d.ts +1 -1
  64. package/dist/runtime/designer/toolkit/renderer/field-palette/field-palette.vue.d.ts +15 -0
  65. package/dist/runtime/designer/toolkit/renderer/field-palette/index.d.ts +14 -0
  66. package/dist/runtime/interface/fetchers.d.ts +3 -1
  67. package/dist/runtime/renderer/dialogs/device-scan/device-scan-dialog.vue.d.ts +9 -9
  68. package/dist/runtime/renderer/dropdowns/components/tables/rdo-table-dropdown.vue.d.ts +9 -9
  69. package/dist/runtime/renderer/dropdowns/components/tables/strategy/selectStrategy.d.ts +1 -1
  70. package/dist/runtime/renderer/dropdowns/components/tables/table-dropdown.vue.d.ts +9 -9
  71. package/dist/suites/edhr/manifest/field/object-type/material-consume-manifest.d.ts +2 -0
  72. package/dist/suites/edhr/manifest/field/object-type/qty-consumed-manifest.d.ts +2 -0
  73. package/dist/suites/edhr/manifest/field/object-type/qty-manifest.d.ts +2 -0
  74. package/dist/suites/edhr/manifest/field/object-type/qty-required-manifest.d.ts +2 -0
  75. package/dist/suites/edhr/manifest/field/trace/production-identifier-manifest.d.ts +2 -0
  76. package/dist/suites/edhr/panel-schema/data-init/object-init/object-init.vue.d.ts +9 -0
  77. package/dist/suites/shared/panel/config/editor/qrcode-parse-editor/barcode-parsing-rules-string-editor.vue.d.ts +1 -1
  78. package/dist/types/warehouse-inventory.type.d.ts +33 -0
  79. package/dist/utils/TriggerUtil.d.ts +1 -1
  80. package/dist/word.css +157 -100
  81. package/package.json +2 -2
  82. package/dist/domain/table/_shared/linkage-engine.d.ts +0 -25
  83. package/dist/domain/table/_shared/rule-engine.d.ts +0 -9
  84. package/dist/domain/table/_shared/runtime-engine.d.ts +0 -12
  85. package/dist/domain/table/_shared/table-runtime-shared.d.ts +0 -45
  86. package/dist/domain/table/business/warehouse-in-out/fields.d.ts +0 -2
  87. package/dist/domain/table/business/warehouse-in-out/profile.d.ts +0 -2
  88. package/dist/domain/table/hooks/on-repeating-default-props.d.ts +0 -3
  89. /package/dist/domain/table/business/{check-table → check/check-table}/index.d.ts +0 -0
  90. /package/dist/domain/table/business/{material-balance → material/material-balance}/index.d.ts +0 -0
  91. /package/dist/domain/table/business/{material-consume → material/material-consume}/index.d.ts +0 -0
  92. /package/dist/domain/table/business/{warehouse-in-out → warehouse/warehouse-in-out}/index.d.ts +0 -0
  93. /package/dist/domain/table/business/{warehouse-transfer → warehouse/warehouse-transfer}/index.d.ts +0 -0
  94. /package/dist/domain/table/{_shared → design}/autofill-expander.d.ts +0 -0
  95. /package/dist/domain/table/{_shared → design}/sub-model-matcher.d.ts +0 -0
  96. /package/dist/domain/table/{_shared → design/theme}/table-theme.d.ts +0 -0
@@ -1,17 +1,14 @@
1
- import { DropdownOption, DropdownOptionGroup } from '../../base';
2
- import { BusinessSubTableProfile, TableProfile } from './types';
3
- /** 表头(挂在数据表 Ribbon 首位) */
4
- export declare const TABLE_HEADER_RIBBON_OPTION: DropdownOption;
1
+ import { BusinessSubTableProfile, TableCategory, TableProfile } from './types';
5
2
  /** 所有已注册的子表 Profile */
6
3
  declare const ALL_TABLE_PROFILES: TableProfile[];
4
+ /** 按分类获取 Profile 列表 */
5
+ export declare function getProfilesByCategory(category: TableCategory): TableProfile[];
7
6
  /** 按表类型获取 Profile */
8
7
  export declare function getProfile(type: string): TableProfile | undefined;
9
8
  /** 按 Ribbon 下拉项 value 获取 Profile */
10
9
  export declare function getProfileByRibbonAction(ribbonAction: string): TableProfile | undefined;
11
10
  /** 按 layoutType 获取 Profile */
12
11
  export declare function getProfileByLayoutType(layoutType: string): TableProfile | undefined;
13
- /** 按 layout 类型获取展示名称 */
14
- export declare function getTableLabelByLayoutType(layoutType: string): string;
15
12
  /**
16
13
  * 收集所有已注册业务表的 refModelType
17
14
  * 用于判断 master_slave 字段是否属于业务子模型
@@ -19,11 +16,4 @@ export declare function getTableLabelByLayoutType(layoutType: string): string;
19
16
  export declare function getAllBusinessRefModelTypes(): string[];
20
17
  /** 按 refModelType 获取业务表 Profile */
21
18
  export declare function getBusinessProfileByRefModelType(refModelType: string): BusinessSubTableProfile | undefined;
22
- /**
23
- * 生成 Ribbon「数据表」「业务表」下拉选项
24
- */
25
- export declare function getRibbonTableOptions(): {
26
- dataTables: DropdownOption[];
27
- businessTables: DropdownOptionGroup[];
28
- };
29
19
  export { ALL_TABLE_PROFILES };
@@ -0,0 +1,6 @@
1
+ import { BizServiceApiDef } from '../../types';
2
+ export declare function callBizService(apiDef: BizServiceApiDef, body: Record<string, unknown>): Promise<unknown>;
3
+ /** 解析 biz-service 返回体 */
4
+ export declare function unwrapBizServiceData<T extends Record<string, unknown>>(res: unknown): T | null;
5
+ /** listAll 类接口取数组 */
6
+ export declare function unwrapBizServiceList(res: unknown): Record<string, unknown>[];
@@ -0,0 +1,16 @@
1
+ import { Doc } from '../../../../core';
2
+ import { TableRuntimeContext } from '../table-runtime-context';
3
+ export declare class InitLoadEngine {
4
+ private readonly doc;
5
+ constructor(doc: Doc);
6
+ apply(ctx: TableRuntimeContext): Promise<void>;
7
+ /**
8
+ * 判断当前子字段是否需要跳过赋值逻辑
9
+ * @param subFieldKey 子字段数据存储的key
10
+ * @param skipIfRowHasAny 存在任意一个指定字段有值时,就跳过该子字段
11
+ * @returns true-跳过,false-不跳过
12
+ */
13
+ private shouldSkip;
14
+ private readExistingRows;
15
+ private hasNonemptyRow;
16
+ }
@@ -0,0 +1,67 @@
1
+ import { Doc } from '../../../../core';
2
+ import { FieldChangeDetail } from '../../../../core/data/DataManager';
3
+ import { EachRowOptions, TableRuntimeContext } from '../table-runtime-context';
4
+ import { RuleContext } from '../../types';
5
+ /** 下拉级联解析结果 */
6
+ export interface BusinessSelectLinkageResult {
7
+ enabled: boolean;
8
+ linkFieldKey?: string;
9
+ linkValue?: unknown;
10
+ /** 为 false 时上游无值不阻断本字段下拉(可选过滤模式) */
11
+ requireLinkValue?: boolean;
12
+ }
13
+ /** 下拉级联联动类 */
14
+ export declare class LinkageEngine {
15
+ private readonly doc;
16
+ constructor(doc: Doc);
17
+ /**
18
+ * 执行子表级联联动
19
+ * @param options.rowIndex 仅处理某一行;不传遍历全部行
20
+ * @param options.changedFieldKey 本次变更字段(onFieldChange 时传)
21
+ * @param options.fieldChange 变更详情,用于判断是否清空下游
22
+ */
23
+ applyForSubTable(ctx: TableRuntimeContext, options?: EachRowOptions & {
24
+ fieldChange?: FieldChangeDetail;
25
+ }): void;
26
+ /**
27
+ * 收集因上游字段变更需批量清空的下游字段更新对象(key=完整路径, value=undefined)。
28
+ * 供编排器在 onChange 写入前预清空使用。
29
+ */
30
+ collectClearUpdates(ctx: TableRuntimeContext, ruleCtx: RuleContext, changedFieldKey: string): Record<string, undefined>;
31
+ /**
32
+ * 解析指定子表下拉字段的级联联动信息(联动配置 + 上游值)
33
+ */
34
+ resolveSelectLinkage(ctx: TableRuntimeContext, fieldKey: string, runtimeValuePath?: string): BusinessSelectLinkageResult | null;
35
+ /**
36
+ * 下拉选中选项后,按 reverseFillFromOption 从选项反向填充同行其他字段
37
+ * @returns 待批量赋值的路径-值映射,空对象代表无需填充
38
+ */
39
+ buildSelectReverseFill(ctx: TableRuntimeContext, fieldKey: string, rowIndex: number, selectedOption?: Record<string, unknown> | null): Record<string, unknown>;
40
+ /** 单行级联处理:上游变更清空下游 + 重新生成所有下拉级联请求参数 */
41
+ private applyLinkageForRow;
42
+ /** 为配置下拉级联的字段生成并存储联动参数 */
43
+ private applySelectLinkageForField;
44
+ /**
45
+ * 解析下拉级联上游值,优先级:
46
+ * 1.当前行同名字段 → 2.context 隐式字段 → 3.主表映射字段 → 4.主表顶层同名字段(配置允许时)
47
+ */
48
+ private resolveLinkFieldValue;
49
+ /** 判断下拉联动是否需要启用 */
50
+ private shouldEnableSelectLinkage;
51
+ /**
52
+ * 级联变更需清空的字段:
53
+ * - 显式配置了 clearOnLinkChange(含空数组)→ 使用配置值
54
+ * - 未配置(undefined)→ 退化为清空字段自身
55
+ * 空数组可用于显式声明"由 rowHandlers 负责清空,linkage 不介入"
56
+ */
57
+ private getDownstreamClearFieldKeys;
58
+ /**
59
+ * 选中下拉项后,按 profile.fillFromOption 从 option 数据同步填充同行字段
60
+ * @returns 待批量赋值的路径-值映射,空对象代表无需填充
61
+ */
62
+ buildFillFromOption(ctx: TableRuntimeContext, fieldKey: string, rowIndex: number, selectedOption: Record<string, unknown>): Record<string, unknown>;
63
+ /** 将单条 FieldOptionFillDef 映射写入 updates */
64
+ private applyOptionFillDef;
65
+ /** 构建字段清空更新对象(同时清值与 _lb_ 标签) */
66
+ private buildClearUpdates;
67
+ }
@@ -0,0 +1,7 @@
1
+ import { Doc } from '../../../../core';
2
+ import { MainFieldBindingDef } from '../../types';
3
+ export declare class MainFieldBindEngine {
4
+ private readonly doc;
5
+ constructor(doc: Doc);
6
+ apply(bindings: MainFieldBindingDef[]): void;
7
+ }
@@ -0,0 +1,25 @@
1
+ import { Doc } from '../../../../core';
2
+ import { FieldChangeDetail } from '../../../../core/data/DataManager';
3
+ import { RemoteSyncDef } from '../../types';
4
+ import { SubtableFieldPath } from '../table-runtime-utils';
5
+ import { TableRuntimeContext } from '../table-runtime-context';
6
+ export declare class RemoteSyncEngine {
7
+ private readonly doc;
8
+ private readonly ruleEngine;
9
+ constructor(doc: Doc);
10
+ /** 将远程同步结果写回行 */
11
+ applyToRow(ctx: TableRuntimeContext, rowIndex: number, config: RemoteSyncDef, data: Record<string, unknown>, rowPatch?: Record<string, unknown>): void;
12
+ /** 按 profile.remoteSync 从行数据组装请求体;条件不足返回 null */
13
+ buildBody(row: Record<string, unknown>, config: RemoteSyncDef): Record<string, unknown> | null;
14
+ /** 字段变更时按 profile.remoteSync 调度同步 */
15
+ applyOnFieldChange(ctx: TableRuntimeContext, change: SubtableFieldPath, fieldChange?: FieldChangeDetail): void;
16
+ /** 按当前行拉取 remoteSync 并回写 */
17
+ private syncRow;
18
+ private scheduleRowSync;
19
+ /** 取当前 doc 的去重集合(按 doc 隔离,避免多文档同键互相抑制) */
20
+ private pendingKeys;
21
+ private pendingTriggers;
22
+ private clearMissFields;
23
+ private afterApply;
24
+ private pickFields;
25
+ }
@@ -0,0 +1,20 @@
1
+ import { Doc } from '../../../../core';
2
+ import { FieldChangeDetail } from '../../../../core/data/DataManager';
3
+ import { SubtableFieldPath } from '../table-runtime-utils';
4
+ import { TableRuntimeContext } from '../table-runtime-context';
5
+ export declare class RowRuntimeEngine {
6
+ private readonly doc;
7
+ constructor(doc: Doc);
8
+ hasRowInit(ctx: TableRuntimeContext): boolean;
9
+ /** 对单行执行行初始化 */
10
+ applyRowInit(ctx: TableRuntimeContext, rowIndex: number, rowSource?: string): void;
11
+ /** 初始化时对所有行执行行初始化 */
12
+ applyRowInitForAllRows(ctx: TableRuntimeContext): void;
13
+ /** 字段变更时执行 when=onFieldChange 的行处理器(按 watch 过滤) */
14
+ applyRowHandlersOnFieldChange(ctx: TableRuntimeContext, change: SubtableFieldPath, fieldChange?: FieldChangeDetail): void;
15
+ /** 主表字段变更时,执行 when=onMainFieldChange 的上下文赋值,补填全部子表行 */
16
+ private assignmentsFor;
17
+ private handlersFor;
18
+ /** 从填报上下文取值写入行字段 */
19
+ private applyContextAssignment;
20
+ }
@@ -0,0 +1,35 @@
1
+ import { Doc } from '../../../../core';
2
+ import { FieldChangeDetail } from '../../../../core/data/DataManager';
3
+ import { TableRuntimeContext } from '../table-runtime-context';
4
+ /** 字段态规则类 */
5
+ export declare class RuleEngine {
6
+ private readonly doc;
7
+ constructor(doc: Doc);
8
+ /** 字段值变更后:应用 onFieldChange 规则 */
9
+ applyOnFieldChange(ctx: TableRuntimeContext, change: {
10
+ rowIndex: number;
11
+ fieldKey: string;
12
+ }, fieldChange?: FieldChangeDetail): void;
13
+ /** 子表插行后:应用 always + onRowInit 规则 */
14
+ applyOnRowInit(ctx: TableRuntimeContext, rowIndex: number): void;
15
+ /** 文档初始化后:应用 always + onRowInit 规则 */
16
+ applyOnInit(ctx: TableRuntimeContext): void;
17
+ /** remoteSync 等 enrichment 回写后:重新评估 always 规则(如条件只读) */
18
+ applyAlwaysForRow(ctx: TableRuntimeContext, rowIndex: number): void;
19
+ /**
20
+ * 执行整个子表下所有行的规则
21
+ * @param options.rowIndex 仅执行某一行;不传遍历全部行
22
+ * @param options.changedFieldKey 本次变更字段,仅 onFieldChange 使用
23
+ */
24
+ private applyForSubTable;
25
+ /** 执行单行下所有规则:每条规则按 fields 批量应用 effect */
26
+ private applyRulesForRow;
27
+ /** 执行字段运行时副作用:字段状态、接口参数、清空联动字段 */
28
+ private applyFieldRuntimeEffect;
29
+ /**
30
+ * 判断规则是否应当执行:匹配触发时机;onFieldChange 时按 watch 过滤
31
+ */
32
+ private shouldRunRule;
33
+ /** 解析 effect.queryParams */
34
+ private resolveQueryParams;
35
+ }
@@ -0,0 +1,72 @@
1
+ import { Doc } from '../../../core';
2
+ import { RemoteSyncDef } from '../../types';
3
+ import { TableRuntimeContext } from './table-runtime-context';
4
+ /**
5
+ * 单行运行时处理器类型定义
6
+ * @param doc 文档实例
7
+ * @param subFieldKey 子表格字段标识key
8
+ * @param rowIndex 当前行下标
9
+ */
10
+ export type RowRuntimeHandler = (doc: Doc, subFieldKey: string, rowIndex: number) => void;
11
+ /** 初始化数据转换上下文对象 */
12
+ export interface InitLoadMapContext {
13
+ /** 文档实例 */
14
+ doc: Doc;
15
+ /** 表格运行时上下文 */
16
+ runtimeCtx: TableRuntimeContext;
17
+ /** 是否开启分组 */
18
+ groupBy: boolean;
19
+ }
20
+ /**
21
+ * 初始化加载数据转换函数类型
22
+ * @param records 接口返回的原始行数据数组
23
+ * @param ctx 转换所需上下文
24
+ * @returns 处理完成后的行数据数组
25
+ */
26
+ export type InitLoadRecordsMapper = (records: Record<string, unknown>[], ctx: InitLoadMapContext) => Record<string, unknown>[];
27
+ /** remoteSync 回写解析上下文 */
28
+ export interface RemoteSyncApplyContext {
29
+ doc: Doc;
30
+ runtimeCtx: TableRuntimeContext;
31
+ rowIndex: number;
32
+ /** 当前行数据 */
33
+ row: Record<string, unknown>;
34
+ config: RemoteSyncDef;
35
+ /** 本次触发 remoteSync 的字段 */
36
+ changedFieldKey?: string;
37
+ }
38
+ /** remoteSync 回写解析结果 */
39
+ export interface RemoteSyncApplyResult {
40
+ /** 写入行字段(enrichment) */
41
+ apply: Record<string, unknown>;
42
+ /** 同行元数据补丁(如库位自动解析标记) */
43
+ rowPatch?: Record<string, unknown>;
44
+ }
45
+ /**
46
+ * remoteSync 回写解析器:根据接口返回条数决定 applyFields 的实际写入内容
47
+ */
48
+ export type RemoteSyncApplyResolver = (records: Record<string, unknown>[], ctx: RemoteSyncApplyContext) => RemoteSyncApplyResult;
49
+ /** 注册单行运行时钩子函数 */
50
+ export declare function registerRowHandler(name: string, handler: RowRuntimeHandler): void;
51
+ /** 注册初始化数据转换映射钩子函数 */
52
+ export declare function registerInitLoadMapper(name: string, mapper: InitLoadRecordsMapper): void;
53
+ /** 注册 remoteSync 回写解析钩子函数 */
54
+ export declare function registerRemoteSyncApplyResolver(name: string, resolver: RemoteSyncApplyResolver): void;
55
+ /**
56
+ * 执行指定名称的单行处理器
57
+ * @param name 注册名称
58
+ * @param doc 文档实例
59
+ * @param subFieldKey 子表格字段key
60
+ * @param rowIndex 当前行索引
61
+ */
62
+ export declare function runRowHandler(name: string | undefined, doc: Doc, subFieldKey: string, rowIndex: number): void;
63
+ /**
64
+ * 使用注册的转换函数处理初始化加载的表格数据
65
+ * @param name 注册名称
66
+ * @param records 接口原始行数据
67
+ * @param ctx 转换上下文
68
+ * @returns 转换后数据;无对应转换器时返回原数组
69
+ */
70
+ export declare function mapInitLoadRecords(name: string | undefined, records: Record<string, unknown>[], ctx: InitLoadMapContext): Record<string, unknown>[];
71
+ /** 使用注册的解析器决定 remoteSync 回写字段 */
72
+ export declare function resolveRemoteSyncApply(name: string | undefined, records: Record<string, unknown>[], ctx: RemoteSyncApplyContext): RemoteSyncApplyResult | null;
@@ -0,0 +1,48 @@
1
+ import { Doc } from '../../../core';
2
+ import { RepeatingRegion } from '../../../core/model/logic';
3
+ import { BusinessFieldProfile, BusinessSubTableProfile, RuleContext } from '../types';
4
+ /** 行遍历选项 */
5
+ export interface EachRowOptions {
6
+ /** 指定仅遍历某一行;不传则遍历全部行 */
7
+ rowIndex?: number;
8
+ /** onFieldChange 时透传的变更字段 key */
9
+ changedFieldKey?: string;
10
+ }
11
+ /** 业务子表运行时上下文 */
12
+ export declare class TableRuntimeContext {
13
+ readonly doc: Doc;
14
+ readonly profile: BusinessSubTableProfile;
15
+ readonly subFieldKey: string;
16
+ readonly region: RepeatingRegion;
17
+ private widgetFieldKeys?;
18
+ constructor(doc: Doc, profile: BusinessSubTableProfile, subFieldKey: string, region: RepeatingRegion);
19
+ /** 业务子模型 refModelType */
20
+ get refModelType(): string;
21
+ /** 子表数组路径 $.subFieldKey */
22
+ get arrayPath(): string;
23
+ /** 指定行路径 $.subFieldKey[rowIndex] */
24
+ rowPath(rowIndex: number): string;
25
+ /** 读取指定行数据 */
26
+ getRow(rowIndex: number): Record<string, unknown> | undefined;
27
+ /** 子表总行数,无数据默认返回 1 */
28
+ getRowCount(): number;
29
+ /** 构建单行规则执行上下文 */
30
+ buildRuleContext(rowIndex: number, changedFieldKey?: string): RuleContext;
31
+ /** 遍历子表数据行,支持指定单行或全量遍历,逐行注入 RuleContext */
32
+ eachRow(options: EachRowOptions, iteratee: (ctx: RuleContext) => void): void;
33
+ /** 在子表字段配置列表中查找指定字段配置 */
34
+ findFieldProfile(fieldKey: string): BusinessFieldProfile | undefined;
35
+ /** 本子表表单内已渲染的字段控件 key 集合 */
36
+ private get presentFieldWidgetKeys();
37
+ /** 本子表表单内是否存在绑定指定字段的控件 */
38
+ hasFieldWidget(fieldKey: string): boolean;
39
+ /**
40
+ * 判断变更字段是否是本子表的隐式联动上游字段
41
+ * 两种匹配:1.隐式字段自身 key;2.隐式字段映射的主表字段 key
42
+ */
43
+ isImplicitLinkField(changedFieldKey: string): boolean;
44
+ /** 一次模型遍历,收集文档内全部业务子表上下文 */
45
+ static collectAll(doc: Doc): TableRuntimeContext[];
46
+ /** 按子表唯一标识查找上下文 */
47
+ static find(doc: Doc, subFieldKey: string): TableRuntimeContext | undefined;
48
+ }
@@ -0,0 +1,60 @@
1
+ import { Doc } from '../../../core';
2
+ import { FieldChangeDetail } from '../../../core/data/DataManager';
3
+ import { BusinessFieldProfile } from '../../types';
4
+ /** 子表字段路径解析结果 */
5
+ export interface SubtableFieldPath {
6
+ subFieldKey: string;
7
+ rowIndex: number;
8
+ fieldKey: string;
9
+ }
10
+ /**
11
+ * 解析子表完整字段路径 $.subFieldKey[行号].fieldKey
12
+ * @returns 子表标识 / 行索引 / 字段标识;非子表路径返回 null
13
+ */
14
+ export declare function parseSubtableFieldPath(path: string): SubtableFieldPath | null;
15
+ /**
16
+ * 字段变更结构化类型
17
+ * - subtable:子表内字段变更
18
+ * - main:主表顶层字段变更
19
+ */
20
+ export type BusinessFieldChange = {
21
+ kind: 'subtable';
22
+ subFieldKey: string;
23
+ rowIndex: number;
24
+ fieldKey: string;
25
+ } | {
26
+ kind: 'main';
27
+ fieldKey: string;
28
+ };
29
+ /** 统一解析数据路径,区分主表 / 子表字段变更结构 */
30
+ export declare function parseBusinessFieldChange(changedPath: string): BusinessFieldChange | null;
31
+ /**
32
+ * 从字段匹配配置中提取有效字段 key
33
+ * @returns 单个字符串字段名;数组 / 空值返回 undefined
34
+ */
35
+ export declare function resolveFieldKeyFromMatch(fieldProfile: BusinessFieldProfile): string | undefined;
36
+ export declare function toNumber(value: unknown, fallback?: number): number;
37
+ /** 字段值是否「空」:null / undefined / 空串 */
38
+ export declare function isBlank(value: unknown): boolean;
39
+ /** 字段值是否「有值」 */
40
+ export declare function isPresent(value: unknown): boolean;
41
+ /** 按字段列表拼接行分组/合并 key,空值视为 '' */
42
+ export declare function buildRowGroupKey(row: Record<string, unknown>, fieldKeys: readonly string[], separator?: string): string;
43
+ /** 读取填报上下文参数;空值(null / undefined / 空串)统一返回 undefined */
44
+ export declare function readContextParam(doc: Doc, paramKey: string): unknown;
45
+ /** 写入子字段级联查询参数到 doc.paramsConfig._subFieldConfig */
46
+ export declare function setSubFieldQueryParams(doc: Doc, fieldValuePath: string, queryParams: Record<string, unknown>): void;
47
+ /** 控件字段条目:用于跨 engine 统一遍历 getWidgetInstances */
48
+ export interface WidgetFieldEntry {
49
+ field: any;
50
+ valuePath: unknown;
51
+ }
52
+ /** 收集文档内所有「带 field 的控件」条目 */
53
+ export declare function getWidgetFieldEntries(doc: Doc): WidgetFieldEntry[];
54
+ /** 判断两个字段值是否逻辑相等 */
55
+ export declare function isSameFieldValue(a: unknown, b: unknown): boolean;
56
+ /**
57
+ * 判断本次字段变更是否需要触发下游级联清空
58
+ * @returns true:新旧值不同,需要清空下游下拉
59
+ */
60
+ export declare function shouldClearDownstreamForFieldChange(change?: FieldChangeDetail): boolean;
@@ -0,0 +1,64 @@
1
+ import { Doc } from '../../../core';
2
+ import { FieldChangeMap } from '../../../core/data/DataManager';
3
+ import { BusinessSelectLinkageResult } from './engines/linkage-engine';
4
+ /** resolveSelectLinkage 入参 */
5
+ export interface ResolveSelectLinkageOptions {
6
+ subFieldKey?: string;
7
+ fieldKey?: string;
8
+ runtimeValuePath?: string;
9
+ }
10
+ /** buildSelectReverseFill 入参 */
11
+ export interface BuildSelectReverseFillOptions {
12
+ subFieldKey: string;
13
+ fieldKey: string;
14
+ rowIndex: number;
15
+ selectedOption?: Record<string, unknown> | null;
16
+ }
17
+ /** buildFillFromOption 入参 */
18
+ export interface BuildFillFromOptionOptions {
19
+ subFieldKey: string;
20
+ fieldKey: string;
21
+ rowIndex: number;
22
+ selectedOption: Record<string, unknown>;
23
+ }
24
+ export declare class TableRuntime {
25
+ private readonly doc;
26
+ private readonly contexts;
27
+ private readonly rule;
28
+ private readonly linkage;
29
+ private readonly row;
30
+ private readonly remoteSync;
31
+ private readonly initLoad;
32
+ private readonly mainFieldBind;
33
+ constructor(doc: Doc);
34
+ /** 文档是否包含业务子表 */
35
+ get hasBusinessTables(): boolean;
36
+ /** 文档初始化时执行全套运行时逻辑 */
37
+ onInit(): Promise<void>;
38
+ /**
39
+ * 子表新增行初始化:rowInit → 字段态规则 → 级联。
40
+ */
41
+ onRowInit(subFieldKey: string, rowIndex: number, rowSource?: string): void;
42
+ /**
43
+ * 批量字段变更:对每个变更只解析路径、查上下文一次,再分派给各 engine。
44
+ */
45
+ onFieldChanges(changedMap: FieldChangeMap): void;
46
+ /**
47
+ * 解析下拉字段级联联动信息(联动启用状态 + 上游值),供下拉组件使用。
48
+ */
49
+ resolveSelectLinkage(options: ResolveSelectLinkageOptions): BusinessSelectLinkageResult | null;
50
+ /**
51
+ * 下拉选中后从选项反向回填同行字段,供 onChange 使用。
52
+ */
53
+ buildSelectReverseFill(options: BuildSelectReverseFillOptions): Record<string, unknown>;
54
+ /**
55
+ * 选中下拉项后,按 profile.fillFromOption 同步填充同行字段(以 enrichment 写入,不触发 remoteSync)。
56
+ */
57
+ buildFillFromOption(options: BuildFillFromOptionOptions): Record<string, unknown>;
58
+ /**
59
+ * 批量构建因字段变更需清空的级联下游字段更新集合(写入前预清空)。
60
+ * 区分子表内字段变更 / 主表隐式联动字段变更两种场景。
61
+ */
62
+ buildDownstreamClears(pendingUpdates: Record<string, unknown>): Record<string, undefined>;
63
+ private findContext;
64
+ }