@gct-paas/word 0.1.35 → 0.1.36
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/README.md +6 -0
- package/dist/index.es.js +36 -1
- package/dist/sdk/doc-runtime/composables/useDocController.d.ts +0 -1
- package/dist/sdk/doc-runtime/composables/useDocOperations.d.ts +3 -0
- package/dist/sdk/doc-runtime/validators/validate-designer.d.ts +4 -0
- package/dist/sdk/doc-runtime/validators/validate-doc-designer.d.ts +4 -0
- package/dist/sdk/engine/index.d.ts +1 -1
- package/dist/sdk/types/designer-validation.d.ts +16 -0
- package/dist/sdk/types/index.d.ts +4 -0
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -289,6 +289,12 @@ const customPlugin: WordSuitePlugin = {
|
|
|
289
289
|
- 检查是否在 `setupPlatformAdapters` 初始化阶段完成注册
|
|
290
290
|
- 检查 `suiteKey` 与已注册插件 `key` 是否一致
|
|
291
291
|
|
|
292
|
+
## 本仓库开发与发布
|
|
293
|
+
|
|
294
|
+
维护 `@gct-paas/word` 的分支策略、版本号与 npm 发布约定见仓库根目录文档:
|
|
295
|
+
|
|
296
|
+
[开发与发布流程](../../docs/development-and-release.md)
|
|
297
|
+
|
|
292
298
|
## License
|
|
293
299
|
|
|
294
300
|
MIT
|
package/dist/index.es.js
CHANGED
|
@@ -56257,7 +56257,7 @@ function getDataIndexLayersMap({
|
|
|
56257
56257
|
convertExtraProps
|
|
56258
56258
|
}) {
|
|
56259
56259
|
const getDataIndex = (cell) => {
|
|
56260
|
-
return isLinkSubTableType(type4) && isDesign ? cell.subRenderer?.xDataIndex : cell.subRenderer?.yDataIndex;
|
|
56260
|
+
return isLinkSubTableType(type4) && isDesign ? cell.subRenderer?.xDataIndex : cell.subRenderer?.yDataIndex ?? cell.subRenderer?.dataIndex;
|
|
56261
56261
|
};
|
|
56262
56262
|
const getAllDataIndex = (cell) => {
|
|
56263
56263
|
const { dataIndex, xDataIndex, yDataIndex } = cell?.subRenderer || {};
|
|
@@ -58200,6 +58200,34 @@ function buildFieldChangeList(params) {
|
|
|
58200
58200
|
}
|
|
58201
58201
|
return changeList;
|
|
58202
58202
|
}
|
|
58203
|
+
function createDesignerValidationResult(errors) {
|
|
58204
|
+
return {
|
|
58205
|
+
valid: errors.length === 0,
|
|
58206
|
+
errors
|
|
58207
|
+
};
|
|
58208
|
+
}
|
|
58209
|
+
function validateDocDesigner(doc) {
|
|
58210
|
+
if (!doc?.model) {
|
|
58211
|
+
return createDesignerValidationResult([]);
|
|
58212
|
+
}
|
|
58213
|
+
const errors = [];
|
|
58214
|
+
const children = doc.model.document.body.children || [];
|
|
58215
|
+
const fixedTableRegions = children.filter((w2) => w2.name === "w:tbl" && w2.hasBounded).flatMap((w2) => w2.bounded);
|
|
58216
|
+
if (fixedTableRegions.some((r) => !r.itemRegion)) {
|
|
58217
|
+
errors.push({
|
|
58218
|
+
code: "item-region-required",
|
|
58219
|
+
message: "请给固定表设置数据分组",
|
|
58220
|
+
source: "doc"
|
|
58221
|
+
});
|
|
58222
|
+
}
|
|
58223
|
+
return createDesignerValidationResult(errors);
|
|
58224
|
+
}
|
|
58225
|
+
function validateDesigner(doc) {
|
|
58226
|
+
const errors = [];
|
|
58227
|
+
const docResult = validateDocDesigner(doc);
|
|
58228
|
+
errors.push(...docResult.errors);
|
|
58229
|
+
return createDesignerValidationResult(errors);
|
|
58230
|
+
}
|
|
58203
58231
|
function useDocOperations(docRef) {
|
|
58204
58232
|
function getDoc() {
|
|
58205
58233
|
return docRef.value ?? null;
|
|
@@ -58217,6 +58245,9 @@ function useDocOperations(docRef) {
|
|
|
58217
58245
|
if (!doc) return null;
|
|
58218
58246
|
return validateAllFields(doc);
|
|
58219
58247
|
}
|
|
58248
|
+
function validateDesigner$1() {
|
|
58249
|
+
return validateDesigner(getDoc());
|
|
58250
|
+
}
|
|
58220
58251
|
function exportModel() {
|
|
58221
58252
|
return getDoc()?.model?.toXmlJson() ?? null;
|
|
58222
58253
|
}
|
|
@@ -58296,6 +58327,7 @@ function useDocOperations(docRef) {
|
|
|
58296
58327
|
}
|
|
58297
58328
|
return {
|
|
58298
58329
|
validate,
|
|
58330
|
+
validateDesigner: validateDesigner$1,
|
|
58299
58331
|
exportModel,
|
|
58300
58332
|
getDocumentAttachmentPaths,
|
|
58301
58333
|
enterBaseline,
|
|
@@ -58363,6 +58395,9 @@ function useDocController(factory2, ops) {
|
|
|
58363
58395
|
validate() {
|
|
58364
58396
|
return ops.validate();
|
|
58365
58397
|
},
|
|
58398
|
+
validateDesigner() {
|
|
58399
|
+
return ops.validateDesigner();
|
|
58400
|
+
},
|
|
58366
58401
|
exportModel() {
|
|
58367
58402
|
return ops.exportModel();
|
|
58368
58403
|
},
|
|
@@ -12,6 +12,5 @@ import { DocOperations } from './useDocOperations';
|
|
|
12
12
|
* const factory = useDocumentFactory(docProps, docPayload);
|
|
13
13
|
* const ops = useDocOperations(factory.doc);
|
|
14
14
|
* const controller = useDocController(factory, ops);
|
|
15
|
-
* // controller.value?.validate()
|
|
16
15
|
*/
|
|
17
16
|
export declare function useDocController(factory: DocumentFactory, ops: DocOperations): ShallowRef<DocController | null>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ShallowRef } from 'vue';
|
|
2
2
|
import { Doc } from '../../../core';
|
|
3
3
|
import { FieldChangeItem, WidgetFieldMetaMap } from '../../../runtime/interface/change-diff';
|
|
4
|
+
import { DesignerValidationResult } from '../../types/designer-validation';
|
|
4
5
|
/** 数据变更基线上下文 */
|
|
5
6
|
export interface DocBaselineContext {
|
|
6
7
|
baselineSnapshot: Record<string, any> | undefined;
|
|
@@ -18,6 +19,8 @@ export interface DocGetUnsavedChangesOptions {
|
|
|
18
19
|
export interface DocOperations {
|
|
19
20
|
/** 校验所有字段,返回错误映射或 null(通过) */
|
|
20
21
|
validate(): Promise<Record<string, string[]> | null>;
|
|
22
|
+
/** 设计态保存前校验(文档配置 + 数据加载模板配置等) */
|
|
23
|
+
validateDesigner(): DesignerValidationResult;
|
|
21
24
|
/** 获取文档模型的 XmlJson(用于保存) */
|
|
22
25
|
exportModel(): any;
|
|
23
26
|
/**
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export { DocModeTypeConst, PageSizeEnumConst, BuiltinComponentTypeConst } from '../../core';
|
|
6
6
|
export type { DocModeType, CompleteComponentType, BuiltinComponentType } from '../../core';
|
|
7
|
-
export type { DocController, DocQueryAPI, WordRuntime, DocInfo, DocRuntimeMeta, DocRuntimeMetaHandleInfo, DocUnsavedChanges, DocGetUnsavedChangesOptions, UseWordProps, UseWordOptions, FieldModelQuery, } from '../types';
|
|
7
|
+
export type { DocController, DocQueryAPI, WordRuntime, DocInfo, DocRuntimeMeta, DocRuntimeMetaHandleInfo, DocUnsavedChanges, DocGetUnsavedChangesOptions, DesignerValidationError, DesignerValidationResult, DesignerValidationSource, UseWordProps, UseWordOptions, FieldModelQuery, } from '../types';
|
|
8
8
|
export type { Execute } from '../doc-runtime/factories/useDocumentFactory';
|
|
9
9
|
export { useWord } from '../doc-runtime/useWord';
|
|
10
10
|
export { useDocSuite } from '../doc-runtime/composables/useDocSuite';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** 设计态校验错误来源 */
|
|
2
|
+
export type DesignerValidationSource = 'doc';
|
|
3
|
+
/** 单条设计态校验错误 */
|
|
4
|
+
export interface DesignerValidationError {
|
|
5
|
+
code: string;
|
|
6
|
+
message: string;
|
|
7
|
+
source: DesignerValidationSource;
|
|
8
|
+
/** 便于定位 */
|
|
9
|
+
path?: string;
|
|
10
|
+
}
|
|
11
|
+
/** 设计态校验结果 */
|
|
12
|
+
export interface DesignerValidationResult {
|
|
13
|
+
valid: boolean;
|
|
14
|
+
errors: DesignerValidationError[];
|
|
15
|
+
}
|
|
16
|
+
export declare function createDesignerValidationResult(errors: DesignerValidationError[]): DesignerValidationResult;
|
|
@@ -6,7 +6,9 @@ import { DocBaselineContext, DocUnsavedChanges, DocOperations, DocGetUnsavedChan
|
|
|
6
6
|
import { OnlineFormInstanceResponse, OnlineFormTmplResponse } from '@gct-paas/api/apaas';
|
|
7
7
|
import { FieldChangeItem } from '../../runtime/interface/change-diff';
|
|
8
8
|
import { FormTmplConfigController } from '../../suites/edhr/panel-schema/data-load/hooks/form-tmpl-config';
|
|
9
|
+
import { DesignerValidationResult } from './designer-validation';
|
|
9
10
|
export type { DocUnsavedChanges, DocGetUnsavedChangesOptions, } from '../doc-runtime/composables/useDocOperations';
|
|
11
|
+
export type { DesignerValidationError, DesignerValidationResult, DesignerValidationSource, } from './designer-validation';
|
|
10
12
|
export type { FieldModelQuery } from './field-model-query';
|
|
11
13
|
/** 字段权限信息 */
|
|
12
14
|
export interface FieldPermissionInfo {
|
|
@@ -81,6 +83,8 @@ export interface DocControllerMethods extends DocOperations {
|
|
|
81
83
|
refreshData(): Promise<void>;
|
|
82
84
|
/** 校验全量字段,返回错误映射;通过时返回 null */
|
|
83
85
|
validate(): Promise<Record<string, string[]> | null>;
|
|
86
|
+
/** 设计态保存前校验;通过时 valid 为 true */
|
|
87
|
+
validateDesigner(): DesignerValidationResult;
|
|
84
88
|
/** 导出当前文档模型 XmlJson(常用于保存) */
|
|
85
89
|
exportModel(): any;
|
|
86
90
|
/** 获取文档内附件路径列表(默认提取 fw:file 组件) */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gct-paas/word",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.36",
|
|
4
4
|
"description": "GCT 在线 word",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vue",
|
|
@@ -34,8 +34,10 @@
|
|
|
34
34
|
"scripts": {
|
|
35
35
|
"build": "vite build",
|
|
36
36
|
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx --fix",
|
|
37
|
-
"
|
|
38
|
-
"
|
|
37
|
+
"version:beta": "npm version prerelease --preid=beta --no-git-tag-version",
|
|
38
|
+
"version:release": "npm version patch --no-git-tag-version",
|
|
39
|
+
"publish:beta": "pnpm run version:beta && pnpm run build && npm publish --registry=https://registry.npmjs.org/ --access public --tag beta",
|
|
40
|
+
"publish:prod": "pnpm run version:release && pnpm run build && npm publish --registry=https://registry.npmjs.org/ --access public",
|
|
39
41
|
"test": "vitest run"
|
|
40
42
|
},
|
|
41
43
|
"dependencies": {
|