@guodun/antdv 1.7.12 → 1.7.14
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/es/components/contract-signing-location/src/ContractSigningLocation.vue.mjs +373 -295
- package/dist/es/components/contract-signing-location/src/ContractSigningLocationCanvas.vue.mjs +219 -202
- package/dist/es/components/contract-signing-location/src/ContractSigningTemplatePage.vue.mjs +18 -18
- package/dist/es/components/contract-signing-location/src/template-source.mjs +62 -49
- package/dist/es/components/index.mjs +1 -0
- package/dist/es/components/pro-contract-template-designer/index.mjs +1 -0
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplatePreviewPage.vue.mjs +37 -42
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplateRendererPage.vue.mjs +69 -55
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplateSingleRenderer.vue.mjs +278 -270
- package/dist/es/components/pro-contract-template-designer/src/DesignerPage.vue.mjs +344 -343
- package/dist/es/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.mjs +1025 -964
- package/dist/es/components/pro-contract-template-designer/src/ProContractTemplateRenderer.vue.mjs +120 -74
- package/dist/es/components/pro-contract-template-designer/src/SigningLayoutCustomModal.vue.mjs +72 -59
- package/dist/es/components/pro-contract-template-designer/src/composables/use-template-designer.mjs +133 -132
- package/dist/es/components/pro-contract-template-designer/src/utils/contract-layout-check.mjs +239 -0
- package/dist/es/components/pro-contract-template-designer/src/utils/contract-print-document.mjs +95 -71
- package/dist/es/components/pro-contract-template-designer/src/utils/page-decorations.mjs +67 -76
- package/dist/es/components/pro-contract-template-designer/src/utils/signing-layout-presets.mjs +77 -61
- package/dist/es/components/pro-contract-template-designer/src/utils/template-renderer.mjs +96 -83
- package/dist/es/components/pro-contract-template-designer/src/utils/template-variable-render.mjs +23 -15
- package/dist/es/components/pro-contract-template-designer/style/index.css +1 -1
- package/dist/es/contract-print-css/index.mjs +134 -30
- package/dist/es/contract-print.mjs +2 -0
- package/dist/es/index.mjs +21 -20
- package/dist/lib/components/contract-signing-location/src/ContractSigningLocation.vue.cjs +1 -1
- package/dist/lib/components/contract-signing-location/src/ContractSigningLocationCanvas.vue.cjs +1 -1
- package/dist/lib/components/contract-signing-location/src/ContractSigningTemplatePage.vue.cjs +1 -1
- package/dist/lib/components/contract-signing-location/src/template-source.cjs +1 -1
- package/dist/lib/components/index.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/index.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplatePreviewPage.vue.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateRendererPage.vue.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateSingleRenderer.vue.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/DesignerPage.vue.cjs +2 -2
- package/dist/lib/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/ProContractTemplateRenderer.vue.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/SigningLayoutCustomModal.vue.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/composables/use-template-designer.cjs +4 -4
- package/dist/lib/components/pro-contract-template-designer/src/utils/contract-layout-check.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/utils/contract-print-document.cjs +50 -28
- package/dist/lib/components/pro-contract-template-designer/src/utils/page-decorations.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/utils/signing-layout-presets.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/utils/template-renderer.cjs +5 -5
- package/dist/lib/components/pro-contract-template-designer/src/utils/template-variable-render.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/style/index.css +1 -1
- package/dist/lib/contract-print-css/index.cjs +74 -23
- package/dist/lib/contract-print.cjs +1 -0
- package/dist/lib/index.cjs +1 -1
- package/dist/theme/icon.css +1 -1
- package/dist/theme/index.css +1 -1
- package/dist/types/components/contract-signing-location/src/ContractSigningLocation.vue.d.ts +9 -0
- package/dist/types/components/contract-signing-location/src/ContractSigningLocationCanvas.vue.d.ts +7 -0
- package/dist/types/components/contract-signing-location/src/template-source.d.ts +6 -0
- package/dist/types/components/pro-contract-template-designer/index.d.ts +1 -0
- package/dist/types/components/pro-contract-template-designer/src/ContractTemplateSingleRenderer.vue.d.ts +2 -0
- package/dist/types/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.d.ts +5 -1
- package/dist/types/components/pro-contract-template-designer/src/ProContractTemplateRenderer.vue.d.ts +7 -2
- package/dist/types/components/pro-contract-template-designer/src/composables/use-template-designer.d.ts +2 -2
- package/dist/types/components/pro-contract-template-designer/src/types.d.ts +36 -0
- package/dist/types/components/pro-contract-template-designer/src/utils/contract-layout-check.d.ts +104 -0
- package/dist/types/components/pro-contract-template-designer/src/utils/contract-print-document.d.ts +4 -1
- package/dist/types/components/pro-contract-template-designer/src/utils/page-decorations.d.ts +2 -8
- package/dist/types/components/pro-contract-template-designer/src/utils/signing-layout-presets.d.ts +9 -0
- package/dist/types/components/pro-contract-template-designer/src/utils/template-renderer.d.ts +6 -1
- package/dist/types/contract-print-css/index.d.ts +70 -0
- package/dist/types/contract-print.d.ts +2 -0
- package/package.json +14 -2
|
@@ -11,6 +11,7 @@ export * from './src/utils/signing-layout-presets';
|
|
|
11
11
|
export * from './src/utils/content-image';
|
|
12
12
|
export * from './src/utils/advanced-controls';
|
|
13
13
|
export { configureContractPrintFonts, resolveContractFontBaseUrl, toAbsoluteContractFontBaseUrl, CONTRACT_PRINT_FONT_UNCONFIGURED_MESSAGE, } from './src/utils/contract-print-document';
|
|
14
|
+
export { checkContractTemplateLayout, createContractTemplateLayoutChecker, describeContractTemplateLayoutIssue, isContractTemplateLayoutAbortError, type ContractTemplateLayoutCheckOptions, type ContractTemplateLayoutChecker, type ContractTemplateLayoutCheckerOptions, type ContractTemplateLayoutTarget, } from './src/utils/contract-layout-check';
|
|
14
15
|
export declare const GdAntProContractTemplateDesigner: SFCWithInstall<typeof ProContractTemplateDesigner>;
|
|
15
16
|
export declare const GdAntProContractTemplateRenderer: SFCWithInstall<typeof ProContractTemplateRenderer>;
|
|
16
17
|
export default GdAntProContractTemplateDesigner;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { VNode } from 'vue';
|
|
2
2
|
import { ContractTemplateRenderValues, ContractTemplateRendererFieldSlotProps, ContractTemplateRendererProps, ContractTemplateValidationError, ContractTemplateControlWarning } from './types';
|
|
3
|
+
import { ContractPrintFrameMetrics } from './utils/contract-print-document';
|
|
3
4
|
declare function __VLS_template(): {
|
|
4
5
|
attrs: Partial<{}>;
|
|
5
6
|
slots: Readonly<{
|
|
@@ -33,6 +34,7 @@ declare const __VLS_component: import('vue').DefineComponent<ContractTemplateRen
|
|
|
33
34
|
resetValues: () => ContractTemplateRenderValues;
|
|
34
35
|
showValidation: (errors: ContractTemplateValidationError[]) => void;
|
|
35
36
|
focusError: (error: ContractTemplateValidationError) => void;
|
|
37
|
+
getMountedLayoutMetrics: (key: string) => ContractPrintFrameMetrics | undefined;
|
|
36
38
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
37
39
|
validate: (errors: ContractTemplateValidationError[]) => any;
|
|
38
40
|
change: (value: ContractTemplateRenderValues) => any;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { nextTick } from 'vue';
|
|
2
|
-
import { ContractTemplateContentImage, ContractTemplateData, ContractTemplateFile, ContractTemplateFilesExportResult, ContractTemplateDesignerProps, ContractTemplateDraftCacheStatus, ContractTemplateEditorCommand, ContractTemplateEditorState, ContractTemplateEditorTextAlign, ContractTemplateFieldStyle, ContractTemplateFieldType, ContractTemplatePageDecorations, ContractTemplatePageSize, ContractTemplateTableCommandCapabilities, ContractTemplateValidationError, ContractTemplateVariable, ContractTemplateVariableData } from './types';
|
|
2
|
+
import { ContractTemplateContentImage, ContractTemplateData, ContractTemplateFile, ContractTemplateFilesExportResult, ContractTemplateLayoutIssue, ContractTemplateDesignerProps, ContractTemplateDraftCacheStatus, ContractTemplateEditorCommand, ContractTemplateEditorState, ContractTemplateEditorTextAlign, ContractTemplateFieldStyle, ContractTemplateFieldType, ContractTemplatePageDecorations, ContractTemplatePageSize, ContractTemplateTableCommandCapabilities, ContractTemplateValidationError, ContractTemplateVariable, ContractTemplateVariableData } from './types';
|
|
3
3
|
import { ContractTemplateImageSource } from './utils/content-image';
|
|
4
4
|
declare const _default: import('vue').DefineComponent<ContractTemplateDesignerProps, {
|
|
5
5
|
getValue: () => ContractTemplateData;
|
|
@@ -13,6 +13,7 @@ declare const _default: import('vue').DefineComponent<ContractTemplateDesignerPr
|
|
|
13
13
|
moveFile: (fileId: string, direction: -1 | 1) => ContractTemplateFile | undefined;
|
|
14
14
|
validate: () => ContractTemplateValidationError[];
|
|
15
15
|
exportTemplate: () => import('./types').ContractTemplateExportResult;
|
|
16
|
+
checkLayout: () => Promise<ContractTemplateLayoutIssue[]>;
|
|
16
17
|
exportFiles: () => ContractTemplateFilesExportResult;
|
|
17
18
|
getSubmitData: () => import('./types').ContractTemplateExportResult;
|
|
18
19
|
clearTemplate: () => ContractTemplateData;
|
|
@@ -53,6 +54,7 @@ declare const _default: import('vue').DefineComponent<ContractTemplateDesignerPr
|
|
|
53
54
|
"draft-cache-change": (status: ContractTemplateDraftCacheStatus) => any;
|
|
54
55
|
"page-limit": (maxPages: number, source: "add" | "duplicate" | "auto-pagination") => any;
|
|
55
56
|
"image-error": (error: Error, source: ContractTemplateImageSource) => any;
|
|
57
|
+
"layout-warning": (issues: ContractTemplateLayoutIssue[]) => any;
|
|
56
58
|
}, string, import('vue').PublicProps, Readonly<ContractTemplateDesignerProps> & Readonly<{
|
|
57
59
|
onValidate?: ((errors: ContractTemplateValidationError[]) => any) | undefined;
|
|
58
60
|
"onUpdate:modelValue"?: ((value: ContractTemplateData) => any) | undefined;
|
|
@@ -68,6 +70,7 @@ declare const _default: import('vue').DefineComponent<ContractTemplateDesignerPr
|
|
|
68
70
|
"onDraft-cache-change"?: ((status: ContractTemplateDraftCacheStatus) => any) | undefined;
|
|
69
71
|
"onPage-limit"?: ((maxPages: number, source: "add" | "duplicate" | "auto-pagination") => any) | undefined;
|
|
70
72
|
"onImage-error"?: ((error: Error, source: ContractTemplateImageSource) => any) | undefined;
|
|
73
|
+
"onLayout-warning"?: ((issues: ContractTemplateLayoutIssue[]) => any) | undefined;
|
|
71
74
|
}>, {
|
|
72
75
|
disabled: boolean;
|
|
73
76
|
modelValue: ContractTemplateData;
|
|
@@ -79,6 +82,7 @@ declare const _default: import('vue').DefineComponent<ContractTemplateDesignerPr
|
|
|
79
82
|
showClearButton: boolean;
|
|
80
83
|
showSubmitDataViewer: boolean;
|
|
81
84
|
showVariableDataViewer: boolean;
|
|
85
|
+
checkLayoutOnExport: boolean;
|
|
82
86
|
maxPages: number;
|
|
83
87
|
variableTypes: import('./types').ContractTemplateFieldTypeOption[];
|
|
84
88
|
showImageControl: boolean;
|
|
@@ -88,6 +88,7 @@ declare function __VLS_template(): {
|
|
|
88
88
|
resetValues: () => ContractTemplateRenderValues;
|
|
89
89
|
showValidation: (errors: ContractTemplateValidationError[]) => void;
|
|
90
90
|
focusError: (error: ContractTemplateValidationError) => void;
|
|
91
|
+
getMountedLayoutMetrics: (key: string) => import('./utils/contract-print-document').ContractPrintFrameMetrics | undefined;
|
|
91
92
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
92
93
|
validate: (errors: ContractTemplateValidationError[]) => any;
|
|
93
94
|
change: (value: ContractTemplateRenderValues) => any;
|
|
@@ -174,7 +175,7 @@ declare function __VLS_template(): {
|
|
|
174
175
|
"onUpdate:valuesByFile"?: ((value: import('./types').ContractTemplateRenderValuesByFile) => any) | undefined;
|
|
175
176
|
"onUpdate:values"?: ((value: ContractTemplateRenderValues) => any) | undefined;
|
|
176
177
|
"onControl-warning"?: ((warning: import('./types').ContractTemplateControlWarning) => any) | undefined;
|
|
177
|
-
}>, "validate" | "submit" | "fitWidth" | "scrollToPage" | "setZoom" | "getZoom" | "resetZoom" | "scrollToVariable" | "focusError" | "getValues" | "setValues" | "resetValues" | "showValidation" | ("values" | "disabled" | "title" | "template" | "readonly" | "zoom" | "showToolbar" | "showSubmitButton" | "contractFontBaseUrl" | "selectorHttp" | "selectorUrlPrefix" | "showValidateButton" | "showResetButton" | "interactionMode" | "validateOnSubmit" | "showPageMeta" | "collapsiblePanel" | "controlRegistry" | "optionResolver" | "requester" | "allowedRemoteOrigins" | "remoteRequestTimeoutMs" | "remoteOptionsCacheTtlMs")> & {
|
|
178
|
+
}>, "validate" | "submit" | "fitWidth" | "scrollToPage" | "setZoom" | "getZoom" | "resetZoom" | "scrollToVariable" | "focusError" | "getValues" | "setValues" | "resetValues" | "showValidation" | "getMountedLayoutMetrics" | ("values" | "disabled" | "title" | "template" | "readonly" | "zoom" | "showToolbar" | "showSubmitButton" | "contractFontBaseUrl" | "selectorHttp" | "selectorUrlPrefix" | "showValidateButton" | "showResetButton" | "interactionMode" | "validateOnSubmit" | "showPageMeta" | "collapsiblePanel" | "controlRegistry" | "optionResolver" | "requester" | "allowedRemoteOrigins" | "remoteRequestTimeoutMs" | "remoteOptionsCacheTtlMs")> & {
|
|
178
179
|
validate: () => ContractTemplateValidationError[];
|
|
179
180
|
submit: () => false | ContractTemplateRenderValues;
|
|
180
181
|
fitWidth: () => number;
|
|
@@ -188,6 +189,7 @@ declare function __VLS_template(): {
|
|
|
188
189
|
resetValues: () => ContractTemplateRenderValues;
|
|
189
190
|
showValidation: (errors: ContractTemplateValidationError[]) => void;
|
|
190
191
|
focusError: (error: ContractTemplateValidationError) => void;
|
|
192
|
+
getMountedLayoutMetrics: (key: string) => import('./utils/contract-print-document').ContractPrintFrameMetrics | undefined;
|
|
191
193
|
} & {} & import('vue').ComponentCustomProperties & {} & {
|
|
192
194
|
$slots: Readonly<{
|
|
193
195
|
field?: (props: ContractTemplateRendererFieldSlotProps) => VNode[] | undefined;
|
|
@@ -206,6 +208,7 @@ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
|
206
208
|
declare const __VLS_component: import('vue').DefineComponent<ContractTemplateRendererProps, {
|
|
207
209
|
getAllValues: () => import('./types').ContractTemplateRenderValuesByFile;
|
|
208
210
|
validateAll: () => ContractTemplateValidationError[];
|
|
211
|
+
validateLayoutAll: () => Promise<ContractTemplateValidationError[]>;
|
|
209
212
|
getValues: () => ContractTemplateRenderValues;
|
|
210
213
|
setValues: (values: ContractTemplateRenderValues) => void;
|
|
211
214
|
validate: () => ContractTemplateValidationError[];
|
|
@@ -338,6 +341,7 @@ declare const __VLS_component: import('vue').DefineComponent<ContractTemplateRen
|
|
|
338
341
|
resetValues: () => ContractTemplateRenderValues;
|
|
339
342
|
showValidation: (errors: ContractTemplateValidationError[]) => void;
|
|
340
343
|
focusError: (error: ContractTemplateValidationError) => void;
|
|
344
|
+
getMountedLayoutMetrics: (key: string) => import('./utils/contract-print-document').ContractPrintFrameMetrics | undefined;
|
|
341
345
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
342
346
|
validate: (errors: ContractTemplateValidationError[]) => any;
|
|
343
347
|
change: (value: ContractTemplateRenderValues) => any;
|
|
@@ -424,7 +428,7 @@ declare const __VLS_component: import('vue').DefineComponent<ContractTemplateRen
|
|
|
424
428
|
"onUpdate:valuesByFile"?: ((value: import('./types').ContractTemplateRenderValuesByFile) => any) | undefined;
|
|
425
429
|
"onUpdate:values"?: ((value: ContractTemplateRenderValues) => any) | undefined;
|
|
426
430
|
"onControl-warning"?: ((warning: import('./types').ContractTemplateControlWarning) => any) | undefined;
|
|
427
|
-
}>, "validate" | "submit" | "fitWidth" | "scrollToPage" | "setZoom" | "getZoom" | "resetZoom" | "scrollToVariable" | "focusError" | "getValues" | "setValues" | "resetValues" | "showValidation" | ("values" | "disabled" | "title" | "template" | "readonly" | "zoom" | "showToolbar" | "showSubmitButton" | "contractFontBaseUrl" | "selectorHttp" | "selectorUrlPrefix" | "showValidateButton" | "showResetButton" | "interactionMode" | "validateOnSubmit" | "showPageMeta" | "collapsiblePanel" | "controlRegistry" | "optionResolver" | "requester" | "allowedRemoteOrigins" | "remoteRequestTimeoutMs" | "remoteOptionsCacheTtlMs")> & {
|
|
431
|
+
}>, "validate" | "submit" | "fitWidth" | "scrollToPage" | "setZoom" | "getZoom" | "resetZoom" | "scrollToVariable" | "focusError" | "getValues" | "setValues" | "resetValues" | "showValidation" | "getMountedLayoutMetrics" | ("values" | "disabled" | "title" | "template" | "readonly" | "zoom" | "showToolbar" | "showSubmitButton" | "contractFontBaseUrl" | "selectorHttp" | "selectorUrlPrefix" | "showValidateButton" | "showResetButton" | "interactionMode" | "validateOnSubmit" | "showPageMeta" | "collapsiblePanel" | "controlRegistry" | "optionResolver" | "requester" | "allowedRemoteOrigins" | "remoteRequestTimeoutMs" | "remoteOptionsCacheTtlMs")> & {
|
|
428
432
|
validate: () => ContractTemplateValidationError[];
|
|
429
433
|
submit: () => false | ContractTemplateRenderValues;
|
|
430
434
|
fitWidth: () => number;
|
|
@@ -438,6 +442,7 @@ declare const __VLS_component: import('vue').DefineComponent<ContractTemplateRen
|
|
|
438
442
|
resetValues: () => ContractTemplateRenderValues;
|
|
439
443
|
showValidation: (errors: ContractTemplateValidationError[]) => void;
|
|
440
444
|
focusError: (error: ContractTemplateValidationError) => void;
|
|
445
|
+
getMountedLayoutMetrics: (key: string) => import('./utils/contract-print-document').ContractPrintFrameMetrics | undefined;
|
|
441
446
|
} & {} & import('vue').ComponentCustomProperties & {} & {
|
|
442
447
|
$slots: Readonly<{
|
|
443
448
|
field?: (props: ContractTemplateRendererFieldSlotProps) => VNode[] | undefined;
|
|
@@ -12,8 +12,8 @@ export declare const DEFAULT_MULTILINE_ROWS = 3;
|
|
|
12
12
|
export declare const DEFAULT_MULTILINE_LINE_HEIGHT = 28;
|
|
13
13
|
/** 渲染器版本快照,随导出结果一起下发,便于服务端复现渲染逻辑。 */
|
|
14
14
|
export declare const CONTRACT_TEMPLATE_RENDERER_VERSION = "contract-template-renderer-1.0.0";
|
|
15
|
-
/** 合同渲染 CSS 版本快照,用于服务端 PDF
|
|
16
|
-
export declare const CONTRACT_TEMPLATE_STYLE_VERSION = "contract-render-css-1.
|
|
15
|
+
/** 合同渲染 CSS 版本快照,用于服务端 PDF 复现;唯一来源是 contract-print-css。 */
|
|
16
|
+
export declare const CONTRACT_TEMPLATE_STYLE_VERSION = "contract-render-css-1.1.0";
|
|
17
17
|
/** 与 PDF 模板填值服务保持一致,避免设计器允许保存但服务端拒绝的变量标识。 */
|
|
18
18
|
export declare const CONTRACT_TEMPLATE_VARIABLE_KEY_PATTERN: RegExp;
|
|
19
19
|
export declare const CONTRACT_TEMPLATE_RESERVED_VARIABLE_KEYS: Set<string>;
|
|
@@ -603,6 +603,11 @@ export interface ContractTemplateRendererExpose {
|
|
|
603
603
|
getAllValues: () => ContractTemplateRenderValuesByFile;
|
|
604
604
|
/** 校验全部文件并切换、定位首个错误;disabled 时只校验、不切换。单文件等价于 validate。 */
|
|
605
605
|
validateAll: () => ContractTemplateValidationError[];
|
|
606
|
+
/**
|
|
607
|
+
* 生成前的排版预检:覆盖全部文件的全部页(含未挂载的页),检测正文纵向或横向超出纸张。
|
|
608
|
+
* 只测量,不切换文件、不改填写值;结果对应调用时的填写值。无法确认排版的页返回 PAGE_LAYOUT_UNVERIFIED,不视为通过。
|
|
609
|
+
*/
|
|
610
|
+
validateLayoutAll: () => Promise<ContractTemplateValidationError[]>;
|
|
606
611
|
/** 获取当前填写值快照 */
|
|
607
612
|
getValues: () => ContractTemplateRenderValues;
|
|
608
613
|
/** 替换当前填写值 */
|
|
@@ -655,6 +660,27 @@ export interface ContractTemplateDraftCacheStatus {
|
|
|
655
660
|
maxBytes?: number;
|
|
656
661
|
error?: string;
|
|
657
662
|
}
|
|
663
|
+
/**
|
|
664
|
+
* 按打印样式(统一 CSS)逐页度量得到的排版问题。
|
|
665
|
+
* 渲染器、指定位置用于阻断生成;设计器保存时只作为提示(checkLayoutOnExport)。
|
|
666
|
+
*/
|
|
667
|
+
export interface ContractTemplateLayoutIssue {
|
|
668
|
+
/** 多文件模式下的文件 id;单文件留空。 */
|
|
669
|
+
fileId?: string;
|
|
670
|
+
/** 模板 pages 数组下标,从 0 开始。 */
|
|
671
|
+
pageIndex: number;
|
|
672
|
+
/** 物理页号,从 1 开始。 */
|
|
673
|
+
pageNumber: number;
|
|
674
|
+
pageId: string;
|
|
675
|
+
/** overflow:正文超出纸张;measure-failed:无法确认排版(字体、图片或超时)。 */
|
|
676
|
+
kind: 'overflow' | 'measure-failed';
|
|
677
|
+
/** 相对「页高 − 底部安全边距」的纵向溢出量(CSS px)。 */
|
|
678
|
+
overflowHeight: number;
|
|
679
|
+
/** 横向超出纸张可用宽度的量(CSS px)。 */
|
|
680
|
+
overflowWidth: number;
|
|
681
|
+
/** 度量失败的原因,仅 measure-failed 存在。 */
|
|
682
|
+
error?: string;
|
|
683
|
+
}
|
|
658
684
|
export interface ContractTemplateDesignerProps {
|
|
659
685
|
/** 合同模板数据,正文占位统一写入 variables */
|
|
660
686
|
modelValue?: ContractTemplateData;
|
|
@@ -670,6 +696,12 @@ export interface ContractTemplateDesignerProps {
|
|
|
670
696
|
* @default false
|
|
671
697
|
*/
|
|
672
698
|
readonly?: boolean;
|
|
699
|
+
/**
|
|
700
|
+
* 保存/导出(exportTemplate / exportFiles / getSubmitData)后,后台按统一打印样式检查每页正文。
|
|
701
|
+
* 发现溢出只提示与触发 layout-warning,不阻断保存;生成合同时会被拦截。
|
|
702
|
+
* @default true
|
|
703
|
+
*/
|
|
704
|
+
checkLayoutOnExport?: boolean;
|
|
673
705
|
/**
|
|
674
706
|
* 禁用整个设计器
|
|
675
707
|
* @default false
|
|
@@ -817,6 +849,8 @@ export interface ContractTemplateDesignerEmits {
|
|
|
817
849
|
'page-limit': [maxPages: number, source: 'add' | 'duplicate' | 'auto-pagination'];
|
|
818
850
|
/** 本地图片读取、压缩或上传失败 */
|
|
819
851
|
'image-error': [error: Error, source: ContractTemplateImageSource];
|
|
852
|
+
/** 保存/导出后后台排版预检的结果;仅提示,不阻断保存。 */
|
|
853
|
+
'layout-warning': [issues: ContractTemplateLayoutIssue[]];
|
|
820
854
|
}
|
|
821
855
|
export interface ContractTemplateDesignerExpose {
|
|
822
856
|
/** 获取当前模板数据快照 */
|
|
@@ -841,6 +875,8 @@ export interface ContractTemplateDesignerExpose {
|
|
|
841
875
|
validate: () => ContractTemplateValidationError[];
|
|
842
876
|
/** 导出 HTML、页面、变量、模板 pageSize 与每页 pageSize */
|
|
843
877
|
exportTemplate: () => ContractTemplateExportResult;
|
|
878
|
+
/** 按打印样式对全部文件、全部页做排版预检(以默认值测量);仅返回问题页,不阻断保存。 */
|
|
879
|
+
checkLayout: () => Promise<ContractTemplateLayoutIssue[]>;
|
|
844
880
|
/** 逐文件导出,同时返回明确标注的连续预览 HTML。 */
|
|
845
881
|
exportFiles: () => ContractTemplateFilesExportResult;
|
|
846
882
|
/** 获取将提交给服务端的模板数据 */
|
package/dist/types/components/pro-contract-template-designer/src/utils/contract-layout-check.d.ts
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { ContractTemplateData, ContractTemplateLayoutIssue, ContractTemplateRenderValues } from '../types';
|
|
2
|
+
import { ContractTemplateRenderPage } from './template-renderer';
|
|
3
|
+
import { ContractPrintFrameMetrics } from './contract-print-document';
|
|
4
|
+
/**
|
|
5
|
+
* 共享布局预检:用与渲染器、指定位置底图相同的 srcdoc 与打印 CSS,逐页在隐藏 iframe 中测量溢出。
|
|
6
|
+
*
|
|
7
|
+
* - 串行执行:所有检查共用一个隐藏 iframe 与一条队列,不一次挂载全部页。
|
|
8
|
+
* - 缓存键 = 样式版本 + 页尺寸 + 页边距 + 装饰 HTML + 正文 HTML(正文已包含填充值)。输入变化自动落到新键。
|
|
9
|
+
* - 过期检查通过 AbortSignal 终止:被终止的检查 reject 为 AbortError,绝不返回「通过」。
|
|
10
|
+
* - 度量失败(超时、图片、环境不可用)记为 measure-failed,同样不被当作通过。
|
|
11
|
+
* - 只在浏览器中执行;无 document 时每页返回明确的 measure-failed 错误,不抛出异常。
|
|
12
|
+
*/
|
|
13
|
+
export interface ContractTemplateLayoutTarget {
|
|
14
|
+
/** 多文件模式的文件 id;单文件留空。 */
|
|
15
|
+
fileId?: string;
|
|
16
|
+
template: ContractTemplateData;
|
|
17
|
+
/** 与渲染器展示口径一致的填写值;缺省变量按模板默认值补齐。 */
|
|
18
|
+
values?: ContractTemplateRenderValues;
|
|
19
|
+
/**
|
|
20
|
+
* 宿主已按自身页面口径构建好的页(如指定位置底图的展示尺寸)。提供时直接使用,不再由 template 推导。
|
|
21
|
+
* 必须由 createContractTemplateLayoutPage 生成,保证缓存键与 iframe 入参一致。
|
|
22
|
+
*/
|
|
23
|
+
layoutPages?: ContractTemplateLayoutPage[];
|
|
24
|
+
}
|
|
25
|
+
export interface ContractTemplateLayoutPage {
|
|
26
|
+
fileId?: string;
|
|
27
|
+
/** 模板 pages 数组下标,从 0 开始。 */
|
|
28
|
+
pageIndex: number;
|
|
29
|
+
/** 物理页号,从 1 开始,与页眉页脚 {pageNumber} 口径一致。 */
|
|
30
|
+
pageNumber: number;
|
|
31
|
+
pageId: string;
|
|
32
|
+
pageFormat: string;
|
|
33
|
+
width: number;
|
|
34
|
+
height: number;
|
|
35
|
+
paddingTop: number;
|
|
36
|
+
paddingBottom: number;
|
|
37
|
+
classNames: string;
|
|
38
|
+
decorationsHtml: string;
|
|
39
|
+
contentHtml: string;
|
|
40
|
+
/** 测量缓存键;同一键的页在同一样式版本下排版结果相同。 */
|
|
41
|
+
key: string;
|
|
42
|
+
}
|
|
43
|
+
export type { ContractTemplateLayoutIssue } from '../types';
|
|
44
|
+
export interface ContractTemplateLayoutCheckOptions {
|
|
45
|
+
/** 调用方取消信号;取消后检查 reject 为 AbortError。 */
|
|
46
|
+
signal?: AbortSignal;
|
|
47
|
+
/** 已挂载页的测量结果,按页键查询;命中即跳过隐藏 iframe 测量。 */
|
|
48
|
+
reuse?: (key: string) => ContractPrintFrameMetrics | undefined;
|
|
49
|
+
/** 每页测完(无论是否有问题)后回调,用于统计首页结果时间。 */
|
|
50
|
+
onPage?: (page: ContractTemplateLayoutPage, issue: ContractTemplateLayoutIssue | undefined) => void;
|
|
51
|
+
}
|
|
52
|
+
export type ContractTemplateLayoutMeasurer = (page: ContractTemplateLayoutPage, signal: AbortSignal | undefined) => Promise<ContractPrintFrameMetrics>;
|
|
53
|
+
export interface ContractTemplateLayoutCheckerOptions {
|
|
54
|
+
/** 替换默认隐藏 iframe 测量器(测试或无浏览器环境使用)。 */
|
|
55
|
+
measure?: ContractTemplateLayoutMeasurer;
|
|
56
|
+
/** 缓存条数上限,超出按最近最少使用淘汰。 */
|
|
57
|
+
cacheLimit?: number;
|
|
58
|
+
}
|
|
59
|
+
export interface ContractTemplateLayoutChecker {
|
|
60
|
+
check: (targets: ContractTemplateLayoutTarget[], options?: ContractTemplateLayoutCheckOptions) => Promise<ContractTemplateLayoutIssue[]>;
|
|
61
|
+
/** 清空测量缓存;不影响进行中的检查。 */
|
|
62
|
+
clear: () => void;
|
|
63
|
+
/** 终止进行中的检查、清空缓存,并释放隐藏 iframe 的引用。dispose 之后 check 立即 reject。 */
|
|
64
|
+
dispose: () => void;
|
|
65
|
+
}
|
|
66
|
+
export declare class ContractTemplateLayoutMeasureError extends Error {
|
|
67
|
+
constructor(message: string);
|
|
68
|
+
}
|
|
69
|
+
/** 构建单页测量输入:与 ContractTemplateRendererPage / ContractSigningTemplatePage 的 iframe 入参完全一致。 */
|
|
70
|
+
export declare function createContractTemplateLayoutPage(rendered: ContractTemplateRenderPage, position: {
|
|
71
|
+
fileId?: string;
|
|
72
|
+
pageIndex: number;
|
|
73
|
+
pageNumber: number;
|
|
74
|
+
totalPages: number;
|
|
75
|
+
}): ContractTemplateLayoutPage;
|
|
76
|
+
/** 缓存键只包含影响排版的输入;messageId 等每次都变的字段不参与。 */
|
|
77
|
+
export declare function createContractTemplateLayoutKey(input: Pick<ContractTemplateLayoutPage, 'pageFormat' | 'width' | 'height' | 'paddingTop' | 'paddingBottom' | 'classNames' | 'decorationsHtml' | 'contentHtml'>): string;
|
|
78
|
+
/**
|
|
79
|
+
* 展开模板的全部页(按 pages 数组顺序)。非法页直接跳过:结构错误由结构校验单独报告。
|
|
80
|
+
* 填写值与渲染器展示口径一致:调用方传入的应是展示值(已做自定义控件展示适配)。
|
|
81
|
+
*/
|
|
82
|
+
export declare function buildContractTemplateLayoutPages(target: ContractTemplateLayoutTarget): ContractTemplateLayoutPage[];
|
|
83
|
+
/**
|
|
84
|
+
* 替换默认的浏览器测量器。仅用于单元测试和挂载测试(happy-dom 不会执行 srcdoc);
|
|
85
|
+
* 传 undefined 恢复隐藏 iframe 测量。生产代码不应调用。
|
|
86
|
+
*/
|
|
87
|
+
export declare function setContractTemplateLayoutMeasurer(measurer: ContractTemplateLayoutMeasurer | undefined): void;
|
|
88
|
+
/** 一次性检查:创建临时检查器、执行并释放。需要复用缓存时请使用 createContractTemplateLayoutChecker。 */
|
|
89
|
+
export declare function checkContractTemplateLayout(targets: ContractTemplateLayoutTarget[], options?: ContractTemplateLayoutCheckOptions & ContractTemplateLayoutCheckerOptions): Promise<ContractTemplateLayoutIssue[]>;
|
|
90
|
+
export declare function createContractTemplateLayoutChecker(options?: ContractTemplateLayoutCheckerOptions): ContractTemplateLayoutChecker;
|
|
91
|
+
/** 调用方可据此区分「已取消」与真正的失败;取消的结果不得展示为通过或失败。 */
|
|
92
|
+
export declare function isContractTemplateLayoutAbortError(error: unknown): boolean;
|
|
93
|
+
/** 默认测量器:在隐藏 iframe 中加载单页 srcdoc,等待 ready/metrics 或 error/超时。 */
|
|
94
|
+
declare function measureInHiddenFrame(page: ContractTemplateLayoutPage, signal: AbortSignal | undefined): Promise<ContractPrintFrameMetrics>;
|
|
95
|
+
/** 仅供 Chromium 端到端测试与诊断直接调用默认测量器;不从设计器 index 导出。 */
|
|
96
|
+
export { measureInHiddenFrame as measureContractPageInHiddenFrame };
|
|
97
|
+
/**
|
|
98
|
+
* 把一条问题转成可展示文案。一页可能同时溢出纵向与横向,因此返回数组。
|
|
99
|
+
* - generate:渲染器与指定位置,告诉用户在生成前修改模板;
|
|
100
|
+
* - design:设计器保存/导出提示,明确说明生成时会被拦截。
|
|
101
|
+
*/
|
|
102
|
+
export declare function describeContractTemplateLayoutIssue(issue: ContractTemplateLayoutIssue, variant?: 'generate' | 'design'): string[];
|
|
103
|
+
/** 度量失败原因的用户文案;原始技术细节只留给控制台。 */
|
|
104
|
+
export declare function describeLayoutMeasureFailure(error: string | undefined): "排版校验超时" | "底图图片未能加载" | "当前环境无法执行排版校验" | "字体或排版度量未通过";
|
package/dist/types/components/pro-contract-template-designer/src/utils/contract-print-document.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export declare const CONTRACT_PRINT_MESSAGE_NAMESPACE = "gd-contract-print";
|
|
|
2
2
|
/** 汉字/标点/数字与混排基线共用的容差;超过说明排版盒已分叉,不能靠 signTop 补偿。 */
|
|
3
3
|
export declare const CONTRACT_PRINT_METRICS_TOLERANCE = 0.5;
|
|
4
4
|
export declare const CONTRACT_PRINT_METRICS_SAMPLE = "\u5408\u540C\u7B7E\u7F72\u4F4D\u7F6E\uFF1A\u7532\u65B9\uFF08Company A\uFF09\u7F16\u53F7 2026-08-31\u3002";
|
|
5
|
-
/**
|
|
5
|
+
/** iframe 内字体与图片共用 CONTRACT_PRINT_FONT_TIMEOUT_MS 截止时间;父侧再多 1s,让内层错误先到达,而不是只报初始化超时。 */
|
|
6
6
|
export declare const CONTRACT_PRINT_FRAME_TIMEOUT_MS: number;
|
|
7
7
|
type FrameMessageHandler = (event: MessageEvent) => void;
|
|
8
8
|
export declare function subscribeContractPrintFrameMessages(handler: FrameMessageHandler): void;
|
|
@@ -32,6 +32,7 @@ export interface ContractPrintFrameMetrics {
|
|
|
32
32
|
pageHeight: number;
|
|
33
33
|
contentHeight: number;
|
|
34
34
|
overflowHeight: number;
|
|
35
|
+
overflowWidth: number;
|
|
35
36
|
paddingTop: number;
|
|
36
37
|
paddingBottom: number;
|
|
37
38
|
paddingLeft: number;
|
|
@@ -96,6 +97,8 @@ export interface BuildContractPrintDocumentOptions {
|
|
|
96
97
|
* 文案不能再写成「必须配置字体目录」。
|
|
97
98
|
*/
|
|
98
99
|
export declare const CONTRACT_PRINT_FONT_UNCONFIGURED_MESSAGE = "\u5408\u540C\u6392\u7248\u5EA6\u91CF\u6821\u9A8C\u5931\u8D25\uFF0C\u7981\u6B62\u751F\u6210\u7B7E\u7F72\u5750\u6807";
|
|
100
|
+
/** 合同底图图片加载失败的稳定标识;iframe 与父页提示共用,禁止两侧各写一份文案。 */
|
|
101
|
+
export declare const CONTRACT_PRINT_IMAGE_ERROR_MESSAGE = "\u5408\u540C\u56FE\u7247\u52A0\u8F7D\u5931\u8D25";
|
|
99
102
|
export interface ConfigureContractPrintFontsOptions {
|
|
100
103
|
/** 可选字体目录 URL,仅兼容旧宿主;系统字体路径不再依赖它。 */
|
|
101
104
|
baseUrl: string;
|
package/dist/types/components/pro-contract-template-designer/src/utils/page-decorations.d.ts
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { ContractTemplateHeaderFooterConfig, ContractTemplateHeaderFooterSlots, ContractTemplatePageDecorations, ContractTemplateRenderValues, ContractTemplateValidationError, ContractTemplateVariable, ContractTemplateWatermarkConfig } from '../types';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
readonly right: 64;
|
|
5
|
-
readonly bottom: 54;
|
|
6
|
-
readonly left: 64;
|
|
7
|
-
};
|
|
8
|
-
export declare const CONTRACT_PAGE_DECORATED_PADDING = 80;
|
|
2
|
+
import { CONTRACT_PAGE_BASE_PADDING } from '../../../../contract-print-css';
|
|
3
|
+
export { CONTRACT_PAGE_BASE_PADDING };
|
|
9
4
|
export declare const CONTRACT_PAGE_DECORATION_TOKEN_LIMIT = 240;
|
|
10
5
|
export type ContractTemplatePageDecorationPresetKey = 'none' | 'page-number' | 'internal-review' | 'draft' | 'custom';
|
|
11
6
|
export type ContractTemplateWatermarkDensity = 'sparse' | 'normal' | 'dense';
|
|
@@ -84,7 +79,6 @@ export declare function getWatermarkDensityGrid(density: ContractTemplateWaterma
|
|
|
84
79
|
columns: number;
|
|
85
80
|
rows: number;
|
|
86
81
|
};
|
|
87
|
-
export declare function getPageDecorationSafePadding(config: ContractTemplateHeaderFooterConfig): number;
|
|
88
82
|
export declare function buildPageDecorationClassNames(value?: Partial<ContractTemplatePageDecorations>, physicalPageNumber?: number): string;
|
|
89
83
|
/** 导出 HTML 只输出转义文本、白名单样式和静态平铺节点,不依赖运行时脚本。 */
|
|
90
84
|
export declare function buildPageDecorationsHtml(value: Partial<ContractTemplatePageDecorations> | undefined, physicalPageNumber: number, physicalTotalPages: number, variables?: readonly ContractTemplateVariable[], values?: ContractTemplateRenderValues): string;
|
package/dist/types/components/pro-contract-template-designer/src/utils/signing-layout-presets.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { JSONContent } from '@tiptap/core';
|
|
2
2
|
import { ContractTemplateSigningLayoutArrangement, ContractTemplateSigningLayoutFields, ContractTemplateSigningLayoutOptions, ContractTemplateSigningLayoutPreset, ContractTemplateSigningLayoutPresetKey } from '../types';
|
|
3
3
|
export declare const DUAL_PARTY_SIGNING_LAYOUT = "dual-party";
|
|
4
|
+
/** 单行多列(并排分栏、表格单元格、末页集中)允许的最多签署方数;再多则单格过窄,盖章框放不下。 */
|
|
5
|
+
export declare const MAX_SIDE_BY_SIDE_SIGNING_LAYOUT_PARTY_COUNT = 3;
|
|
4
6
|
/** 自定义参数生成的签署版式统一落这个标识,避免宿主 key 进入 schema 白名单。 */
|
|
5
7
|
export declare const CUSTOM_SIGNING_LAYOUT = "custom";
|
|
6
8
|
export declare const MIN_SIGNING_LAYOUT_PARTY_COUNT = 1;
|
|
@@ -19,6 +21,13 @@ export declare function isSigningLayoutPresetKey(value: unknown): value is Contr
|
|
|
19
21
|
export declare function isSigningLayoutAttributeValue(value: unknown): value is string;
|
|
20
22
|
/** 收敛外部入参:夹取签署方数量、校验排列方式、保证至少留一个签署占位。 */
|
|
21
23
|
export declare function normalizeSigningLayoutOptions(options: Partial<ContractTemplateSigningLayoutOptions> | undefined): ContractTemplateSigningLayoutOptions;
|
|
24
|
+
/** 单行多列排列(并排分栏、表格单元格、末页集中):true;逐行列出为整行宽,不受栏宽约束。 */
|
|
25
|
+
export declare function isSingleRowSigningLayoutArrangement(arrangement: ContractTemplateSigningLayoutArrangement): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* 单行多列时签字线按栏宽收缩,使每格内容不超出 A4 正文宽度;上限仍为默认 80mm。
|
|
28
|
+
* 盖章框代表实际印章尺寸,不在此缩小。
|
|
29
|
+
*/
|
|
30
|
+
export declare function resolveSingleRowSignatureLineWidth(partyCount: number): number;
|
|
22
31
|
/**
|
|
23
32
|
* 参数化生成正文流签署版式;内置预设与自定义面板共用这一个 builder。
|
|
24
33
|
*
|
package/dist/types/components/pro-contract-template-designer/src/utils/template-renderer.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ContractTemplateData, ContractTemplatePageFormat, ContractTemplatePageDecorations, ContractTemplateRenderValue, ContractTemplateRenderValues, ContractTemplateValidationError, ContractTemplateVariable, ContractTemplateControlOption, ContractTemplateVariableData } from '../types';
|
|
1
|
+
import { ContractTemplateControlRegistry, ContractTemplateData, ContractTemplatePageFormat, ContractTemplatePageDecorations, ContractTemplateRenderValue, ContractTemplateRenderValues, ContractTemplateValidationError, ContractTemplateVariable, ContractTemplateControlOption, ContractTemplateVariableData } from '../types';
|
|
2
2
|
import { isSafeContractImageUrl } from './image-url';
|
|
3
3
|
export { isSafeContractImageUrl };
|
|
4
4
|
/**
|
|
@@ -31,6 +31,11 @@ export interface ContractTemplateRenderPage {
|
|
|
31
31
|
export declare function buildInitialRenderValues(template: ContractTemplateData | undefined): ContractTemplateRenderValues;
|
|
32
32
|
/** 合并模板初始值与外部传入值,外部值优先。 */
|
|
33
33
|
export declare function normalizeRenderValues(template: ContractTemplateData | undefined, values: ContractTemplateRenderValues | undefined): ContractTemplateRenderValues;
|
|
34
|
+
/**
|
|
35
|
+
* 面板与只读展示使用的填写值:先对自定义控件的 `toDisplayText` 做展示适配,适配失败保留标准值。
|
|
36
|
+
* 渲染器画页与合同布局预检必须共用这一步,否则预检测到的正文与用户看到的不一致。
|
|
37
|
+
*/
|
|
38
|
+
export declare function resolveTemplateDisplayValues(template: ContractTemplateData | undefined, values: ContractTemplateRenderValues, controlRegistry?: ContractTemplateControlRegistry): ContractTemplateRenderValues;
|
|
34
39
|
/** 模板结构校验 + 按 PDF 服务规则逐项校验填写值。 */
|
|
35
40
|
export declare function validateTemplateRenderValues(template: ContractTemplateData | undefined, values: ContractTemplateRenderValues): ContractTemplateValidationError[];
|
|
36
41
|
/** 当前文本字段的容量校验;与全量/提交共用 PDF 估算,不能用 DOM 边框或滚动高度判溢出。 */
|
|
@@ -1,3 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 合同打印公共模块(无 Vue / DOM 模块依赖,浏览器与 Node 共用):排版几何、正文安全区、
|
|
3
|
+
* 版面度量函数与打印 CSS。不得在此新增 import,否则原生 Node 无法直接加载测试与 dist 产物。
|
|
4
|
+
*/
|
|
5
|
+
/** 合同排版共用几何:单位为 CSS px,签署坐标仍由既有 72/96 换算负责。 */
|
|
6
|
+
export declare const CONTRACT_PAGE_BASE_PADDING: {
|
|
7
|
+
readonly top: 54;
|
|
8
|
+
readonly right: 64;
|
|
9
|
+
readonly bottom: 54;
|
|
10
|
+
readonly left: 64;
|
|
11
|
+
};
|
|
12
|
+
/** 有效页眉/页脚占用的最小安全区;实际值还要与 offset + 字高 + 间距取最大。 */
|
|
13
|
+
export declare const CONTRACT_PAGE_DECORATED_SAFE_PADDING = 80;
|
|
14
|
+
export declare const CONTRACT_PAGE_LAYOUT_TOLERANCE = 1;
|
|
15
|
+
export declare const CONTRACT_PRINT_STYLE_VERSION = "contract-render-css-1.1.0";
|
|
16
|
+
export type ContractPageDecorationSlotKey = 'left' | 'center' | 'right';
|
|
17
|
+
/**
|
|
18
|
+
* 页眉或页脚的最小输入。宿主必须先经设计器 normalizePageDecorations 归一化:
|
|
19
|
+
* offset / fontSize 已夹紧到合法区间,slots 已补齐三栏。
|
|
20
|
+
*/
|
|
21
|
+
export interface ContractPageDecorationSafeAreaSide {
|
|
22
|
+
enabled: boolean;
|
|
23
|
+
showOnFirstPage: boolean;
|
|
24
|
+
slots: Record<ContractPageDecorationSlotKey, string>;
|
|
25
|
+
offset: number;
|
|
26
|
+
fontSize: number;
|
|
27
|
+
}
|
|
28
|
+
export interface ContractPageDecorationSafeAreaSource {
|
|
29
|
+
header?: ContractPageDecorationSafeAreaSide;
|
|
30
|
+
footer?: ContractPageDecorationSafeAreaSide;
|
|
31
|
+
}
|
|
32
|
+
export interface ContractPagePadding {
|
|
33
|
+
top: number;
|
|
34
|
+
right: number;
|
|
35
|
+
bottom: number;
|
|
36
|
+
left: number;
|
|
37
|
+
}
|
|
38
|
+
export interface ContractPageLayoutOptions {
|
|
39
|
+
width: number;
|
|
40
|
+
height: number;
|
|
41
|
+
contentSelector?: string;
|
|
42
|
+
}
|
|
43
|
+
export interface ContractPageLayoutMetrics {
|
|
44
|
+
pageWidth: number;
|
|
45
|
+
pageHeight: number;
|
|
46
|
+
contentHeight: number;
|
|
47
|
+
overflowHeight: number;
|
|
48
|
+
overflowWidth: number;
|
|
49
|
+
paddingTop: number;
|
|
50
|
+
paddingBottom: number;
|
|
51
|
+
paddingLeft: number;
|
|
52
|
+
paddingRight: number;
|
|
53
|
+
}
|
|
54
|
+
/** 页眉或页脚在指定物理页是否真实显示:启用、任一栏有文本,且首页受 showOnFirstPage 约束。 */
|
|
55
|
+
export declare function isContractPageDecorationVisible(side: ContractPageDecorationSafeAreaSide | undefined, pageNumber?: number): boolean;
|
|
56
|
+
/** 单侧装饰占用的安全区高度:offset + 1.5 倍字号(向上取整)+ 20px 间距,且不小于 80px。 */
|
|
57
|
+
export declare function resolveContractDecorationSafePadding(side: Pick<ContractPageDecorationSafeAreaSide, 'offset' | 'fontSize'>): number;
|
|
58
|
+
/**
|
|
59
|
+
* 正文四边内边距的唯一算法(纯函数,无 Vue/DOM 依赖)。
|
|
60
|
+
*
|
|
61
|
+
* 有效页眉时上边改为安全区,有效页脚时下边改为安全区;安全区与基础内边距取较大者。
|
|
62
|
+
* 浏览器 iframe、设计器与渲染器预览都必须调用这里;Node 渲染服务的同类逻辑须与此保持一致。
|
|
63
|
+
*/
|
|
64
|
+
export declare function resolveContractPagePadding(decorations?: ContractPageDecorationSafeAreaSource, pageNumber?: number): ContractPagePadding;
|
|
65
|
+
/**
|
|
66
|
+
* 同时用于浏览器 iframe 和 Node 的 page.evaluate(Locator.evaluate(measureContractPageLayout, options))。
|
|
67
|
+
* 函数必须自包含,不捕获模块变量,以便作为打印文档脚本序列化。
|
|
68
|
+
* 只测正文和实际文本行,不把水印/页眉页脚算成溢出,也不展开固定容量控件内部文本。
|
|
69
|
+
*/
|
|
70
|
+
export declare function measureContractPageLayout(page: HTMLElement, options: ContractPageLayoutOptions): ContractPageLayoutMetrics;
|
|
1
71
|
export declare const CONTRACT_RENDER_STYLE_MARKER = "data-contract-render-style=\"true\"";
|
|
2
72
|
/** 拉丁走 local Times/Arial 锁定盒宽;CJK 走系统宋体/黑体栈。不要用 @font-face local() 绑 CJK,Chromium 会匹配失败。 */
|
|
3
73
|
export declare const CONTRACT_PRINT_FONT_FAMILY = "\"GD Contract Latin\", \"Songti SC\", SimSun, \"Noto Serif CJK SC\", \"Source Han Serif SC\", serif";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@guodun/antdv",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.14",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"CHANGELOG.md",
|
|
@@ -23,11 +23,23 @@
|
|
|
23
23
|
"require": "./dist/lib/index.cjs"
|
|
24
24
|
},
|
|
25
25
|
"./src/*": "./src/*.js",
|
|
26
|
-
"./*": "./*"
|
|
26
|
+
"./*": "./*",
|
|
27
|
+
"./contract-print": {
|
|
28
|
+
"types": "./dist/types/contract-print.d.ts",
|
|
29
|
+
"import": "./dist/es/contract-print.mjs",
|
|
30
|
+
"require": "./dist/lib/contract-print.cjs"
|
|
31
|
+
}
|
|
27
32
|
},
|
|
28
33
|
"main": "./dist/lib/index.cjs",
|
|
29
34
|
"module": "./dist/es/index.mjs",
|
|
30
35
|
"types": "./dist/types/index.d.ts",
|
|
36
|
+
"typesVersions": {
|
|
37
|
+
"*": {
|
|
38
|
+
"contract-print": [
|
|
39
|
+
"./dist/types/contract-print.d.ts"
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
},
|
|
31
43
|
"sideEffects": [
|
|
32
44
|
"**/*.css",
|
|
33
45
|
"**/*.scss",
|