@gct-paas/word 0.1.38 → 0.1.41

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.
@@ -28,6 +28,10 @@ export declare class SuiteRuntime implements FieldModelQuery {
28
28
  getFieldByKeyAsync(modelKey: ModelKey, key: string): FieldMeta | undefined;
29
29
  getFieldByIdAsync(modelKey: ModelKey, id: string): FieldMeta | undefined;
30
30
  getModel(modelKey: ModelKey): ModelMeta | undefined;
31
+ /**
32
+ * 确保主模型字段已拉取并写入缓存(避免 preload 与文档 immediate 加载竞态)。
33
+ */
34
+ ensureModelFieldsReady(modelKey: ModelKey): Promise<void>;
31
35
  getMasterSlaveFieldList(modelKey: ModelKey): FieldMeta[];
32
36
  reloadFields(modelKey: ModelKey): Promise<import('../../../capabilities/model-field-runtime').FieldListResult>;
33
37
  reloadModel(modelKey: ModelKey): Promise<[ModelMeta | undefined, import('../../../capabilities/model-field-runtime').FieldListResult]>;
@@ -1,3 +1,4 @@
1
+ import { SubTableInfo } from '../../sdk/types';
1
2
  interface WidgetFieldMeta {
2
3
  id: string;
3
4
  metaKey: string;
@@ -22,5 +23,6 @@ export declare function buildFieldChangeList(params: {
22
23
  baselineData: Record<string, any> | undefined;
23
24
  currentData: Record<string, any> | undefined;
24
25
  widgetMetaMap?: WidgetFieldMetaMap;
26
+ subTableInfoList?: SubTableInfo[];
25
27
  }): FieldChangeItem[];
26
28
  export {};
@@ -1,5 +1,5 @@
1
1
  import { CheckTableItemInfosPayload } from './types';
2
- /** 从检验项详情推导每张检验表需要扩的主体行数 */
2
+ /** 从检验项详情推导每张检验表需要扩的主体行数(仅检验项条数,不含关联轴铺砖槽位) */
3
3
  export declare function resolveItemCountByRegionId(runtimeJson: unknown, infos: CheckTableItemInfosPayload): Record<string, number>;
4
4
  /**
5
5
  * 将接口返回的检验项配置写入 defaults(展开为 $.f_jianyan1[0].type_ 等字段路径)。
@@ -2,10 +2,12 @@ import { ShallowRef } from 'vue';
2
2
  import { Doc } from '../../../core';
3
3
  import { FieldChangeItem, WidgetFieldMetaMap } from '../../../runtime/interface/change-diff';
4
4
  import { DesignerValidationResult } from '../../types/designer-validation';
5
+ import { SubTableInfo } from '../../types';
5
6
  /** 数据变更基线上下文 */
6
7
  export interface DocBaselineContext {
7
8
  baselineSnapshot: Record<string, any> | undefined;
8
9
  widgetMetaMap: WidgetFieldMetaMap;
10
+ subTableInfoList: SubTableInfo[];
9
11
  }
10
12
  export interface DocUnsavedChanges {
11
13
  /** 是否存在未保存改动 */
@@ -0,0 +1,8 @@
1
+ import { Doc } from '../../../core';
2
+ /**
3
+ * 等待 Vue 响应式与 DataManager 后置流水线(依赖 / enrich / emit 队列)完成一轮 settle。
4
+ * 与 refreshData 收尾一致,避免过早读取 rawData 或误判 dirty。
5
+ */
6
+ export declare function waitForDataManagerSettle(): Promise<void>;
7
+ /** 将当前 rawData 写入 initRawDataSnapshot,供 getUnsavedChanges({ includeRawData: true }) 比对 */
8
+ export declare function syncInitRawDataSnapshot(doc: Doc): void;
@@ -12,4 +12,3 @@ export { useDocumentFactory } from '../doc-runtime/factories/useDocumentFactory'
12
12
  export { useDocRuntimeProvider } from '../doc-runtime/composables/useDocRuntimeProvider';
13
13
  export { useDocOperations } from '../doc-runtime/composables/useDocOperations';
14
14
  export { useDocController } from '../doc-runtime/composables/useDocController';
15
- export { getSubmitFormData } from '../../utils/func/render';
@@ -14,6 +14,8 @@ export interface FieldModelQuery {
14
14
  getFieldByIdAsync(modelKey: ModelKey, id: string): FieldMeta | undefined;
15
15
  getModel(modelKey: ModelKey): ModelMeta | undefined;
16
16
  getMasterSlaveFieldList(modelKey: ModelKey): FieldMeta[];
17
+ /** 拉取并缓存模型字段(幂等,有缓存则跳过请求) */
18
+ ensureModelFieldsReady(modelKey: ModelKey): Promise<void>;
17
19
  reloadFields(modelKey: ModelKey): Promise<FieldListResult>;
18
20
  reloadModel(modelKey: ModelKey): Promise<[ModelMeta | undefined, FieldListResult]>;
19
21
  }
@@ -10,6 +10,16 @@ import { DesignerValidationResult } from './designer-validation';
10
10
  export type { DocUnsavedChanges, DocGetUnsavedChangesOptions, } from '../doc-runtime/composables/useDocOperations';
11
11
  export type { DesignerValidationError, DesignerValidationResult, DesignerValidationSource, } from './designer-validation';
12
12
  export type { FieldModelQuery } from './field-model-query';
13
+ /** 文档模型层子表元信息 */
14
+ export interface SubTableInfo {
15
+ field: string;
16
+ subType: string;
17
+ name: string;
18
+ key: string;
19
+ /** 二维/检验表交叉区 rawData key,形如 f_sub:f_link */
20
+ crossKey?: string;
21
+ [key: string]: any;
22
+ }
13
23
  /** 字段权限信息 */
14
24
  export interface FieldPermissionInfo {
15
25
  modelKey: string;
@@ -62,18 +72,17 @@ export interface DocControllerMethods extends DocOperations {
62
72
  setModel(model: DocModel): void;
63
73
  /** 获取当前文档原始填报数据快照 */
64
74
  rawData(): Recordable<any>;
75
+ /**
76
+ * 将填报数据转为提交结构(二维交叉区合并回子表、清理前端占位字段等)。
77
+ * 未传 formData 时使用当前 rawData。
78
+ */
79
+ getSubmitFormData(formData?: Record<string, any>): Record<string, any>;
65
80
  /** 设置当前文档整个原始数据 */
66
81
  setRawData(data: Record<string, any>, defaultDataMap?: Record<string, any>): void;
67
82
  /** 根据 jsonpath 批量设置文档数据 */
68
83
  setMultiple(updates: Record<string, any>): boolean;
69
84
  /** 获取当前文档的所有子表信息 */
70
- getSubTableInfoList(): Array<{
71
- field: string;
72
- subType: string;
73
- name: string;
74
- key: string;
75
- [key: string]: any;
76
- }>;
85
+ getSubTableInfoList(): SubTableInfo[];
77
86
  /** 手动触发文档重新加载 */
78
87
  reload(): void;
79
88
  /**
@@ -198,12 +207,14 @@ export interface UseWordOptions {
198
207
  /** 指定渲染模式 */
199
208
  renderModeType?: DocModeType;
200
209
  /**
201
- * 文档接口请求成功且引擎挂载完成后的回调(每轮成功加载触发一次)。
210
+ * 文档接口请求成功且引擎挂载完成、dataManager 首轮 settle 后的回调(每轮成功加载触发一次)。
211
+ * 此时 controller.rawData() 已与内部 initRawDataSnapshot 对齐,适合做外部自动保存基线。
202
212
  * 不会在 requestId 为空、请求被丢弃、或初始化抛错时调用。
203
213
  */
204
214
  onDocumentLoadSuccess?: () => void;
205
215
  /**
206
- * 文档数据发生变化(防抖 300ms 后)的回调,可在此处触发外部自动保存通知。
216
+ * 文档数据发生变化(防抖 300ms 后)且存在未保存改动时的回调,可触发外部自动保存轮询。
217
+ * 保存成功后请调用 controller.markAsSaved(),避免重复通知。
207
218
  * 例:() => emitter.emit(EmitterEnum.__on_looper_auto_save)
208
219
  */
209
220
  onLooperAutoSave?: (payload?: {
@@ -1,5 +1,5 @@
1
1
  import { FieldMeta } from '../../capabilities/model-field-runtime';
2
- import { Wr } from '../../core/model/document';
2
+ import { SubTableInfo } from '../../sdk/types';
3
3
  export declare function transformSourceData(sourceData: any, i18nData: any): any;
4
4
  export declare function transformSourceDataList(data: any[], dict?: {}): {
5
5
  _DICT: object;
@@ -13,7 +13,15 @@ export declare function conversionFormState(payload: {
13
13
  /** 渲染数据列表 */
14
14
  interfaceData: any;
15
15
  /** 主要是 WrField */
16
- instances: Wr[];
16
+ subTableInfoList: {
17
+ field: string;
18
+ key: string;
19
+ name: string;
20
+ subType: string;
21
+ crossKey?: string;
22
+ }[];
17
23
  }): Record<string, any>;
24
+ /** 从模型子表元信息解析二维/检验表交叉区 key;无元信息时回退为 formData 中含 `:` 的 key */
25
+ export declare function resolveSubmitCrossKeys(formData: Record<string, any>, subTableInfoList?: SubTableInfo[]): string[];
18
26
  /** 数据转成真实提交数据 */
19
- export declare function getSubmitFormData(formData: any): any;
27
+ export declare function getSubmitFormData(formData: any, subTableInfoList?: SubTableInfo[]): any;
package/dist/word.css CHANGED
@@ -8170,17 +8170,17 @@ textarea[data-v-57fe54a3]::placeholder {
8170
8170
  .table-action .row-headers .row-header:last-child .row-add-btn[data-v-c40eef9f] .gct-icon.bottom {
8171
8171
  transform: translateY(-100%);
8172
8172
  }
8173
- .sub-table-action[data-v-a58c6b2e] {
8173
+ .sub-table-action[data-v-da25771b] {
8174
8174
  position: absolute;
8175
8175
  z-index: 999;
8176
8176
  }
8177
- .sub-table-action-content[data-v-a58c6b2e] {
8177
+ .sub-table-action-content[data-v-da25771b] {
8178
8178
  display: flex;
8179
8179
  align-items: center;
8180
8180
  gap: 4px;
8181
8181
  padding: 4px;
8182
8182
  }
8183
- .action-group[data-v-a58c6b2e] {
8183
+ .action-group[data-v-da25771b] {
8184
8184
  display: flex;
8185
8185
  align-items: center;
8186
8186
  gap: 4px;
@@ -8188,15 +8188,15 @@ textarea[data-v-57fe54a3]::placeholder {
8188
8188
  border-radius: 4px;
8189
8189
  overflow: hidden;
8190
8190
  }
8191
- .action-group .sub-table-btn[data-v-a58c6b2e] {
8191
+ .action-group .sub-table-btn[data-v-da25771b] {
8192
8192
  border-radius: 0;
8193
8193
  }
8194
- .sub-table-action-bar[data-v-a58c6b2e],
8195
- .sub-table-action-content[data-v-a58c6b2e] {
8194
+ .sub-table-action-bar[data-v-da25771b],
8195
+ .sub-table-action-content[data-v-da25771b] {
8196
8196
  pointer-events: auto;
8197
8197
  user-select: none;
8198
8198
  }
8199
- .sub-table-btn[data-v-a58c6b2e] {
8199
+ .sub-table-btn[data-v-da25771b] {
8200
8200
  display: flex;
8201
8201
  align-items: center;
8202
8202
  justify-content: center;
@@ -8206,25 +8206,25 @@ textarea[data-v-57fe54a3]::placeholder {
8206
8206
  border-radius: 4px;
8207
8207
  cursor: pointer;
8208
8208
  }
8209
- .sub-table-btn.delete-icon[data-v-a58c6b2e] {
8209
+ .sub-table-btn.delete-icon[data-v-da25771b] {
8210
8210
  border: none;
8211
8211
  background-color: #ff7875;
8212
8212
  }
8213
- .insert-row-container[data-v-a58c6b2e] {
8213
+ .insert-row-container[data-v-da25771b] {
8214
8214
  padding: 6px;
8215
8215
  }
8216
- .insert-row-container .insert-row-item[data-v-a58c6b2e] {
8216
+ .insert-row-container .insert-row-item[data-v-da25771b] {
8217
8217
  display: flex;
8218
8218
  align-items: center;
8219
8219
  gap: 8px;
8220
8220
  padding: 5px 8px;
8221
8221
  cursor: pointer;
8222
8222
  }
8223
- .insert-row-container .insert-row-item[data-v-a58c6b2e]:hover {
8223
+ .insert-row-container .insert-row-item[data-v-da25771b]:hover {
8224
8224
  background: rgba(13, 13, 13, 0.06);
8225
8225
  border-radius: 4px;
8226
8226
  }
8227
- .insert-row-container .insert-row-item .title[data-v-a58c6b2e] {
8227
+ .insert-row-container .insert-row-item .title[data-v-da25771b] {
8228
8228
  font-size: 14px;
8229
8229
  line-height: 28px;
8230
8230
  color: #0d0d0d;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gct-paas/word",
3
- "version": "0.1.38",
3
+ "version": "0.1.41",
4
4
  "description": "GCT 在线 word",
5
5
  "keywords": [
6
6
  "vue",
@@ -34,11 +34,11 @@
34
34
  "scripts": {
35
35
  "build": "vite build",
36
36
  "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx --fix",
37
- "version:beta": "npm version prerelease --preid=beta --no-git-tag-version",
38
- "version:release": "npm version patch --no-git-tag-version",
39
37
  "publish:beta": "pnpm run version:beta && pnpm run build && npm publish --registry=https://registry.npmjs.org/ --access public --tag beta",
40
38
  "publish:prod": "pnpm run version:release && pnpm run build && npm publish --registry=https://registry.npmjs.org/ --access public",
41
- "test": "vitest run"
39
+ "test": "vitest run",
40
+ "version:beta": "npm version prerelease --preid=beta --no-git-tag-version",
41
+ "version:release": "npm version patch --no-git-tag-version"
42
42
  },
43
43
  "dependencies": {
44
44
  "@gct-paas/api": "0.1.0-word.7",
@@ -47,6 +47,7 @@
47
47
  "bignumber.js": "^9.3.1",
48
48
  "dayjs": "^1.11.19",
49
49
  "hotkeys-js": "4.0.0-beta.7",
50
+ "jsonpath-plus": "^10.4.0",
50
51
  "less": "^4.4.2",
51
52
  "lodash-es": "^4.17.21",
52
53
  "node-sql-parser": "^5.4.0",