@guodun/antdv 1.4.1 → 1.4.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.
- package/dist/es/components/contract-signing-location/src/ContractSigningLocationCanvas.vue.mjs +304 -293
- package/dist/es/components/contract-signing-location/src/coordinates.mjs +23 -23
- package/dist/es/components/contract-signing-location/src/location-rules.mjs +20 -10
- package/dist/es/components/contract-signing-location/src/page-layout.mjs +12 -9
- package/dist/es/components/contract-signing-location/src/template-source.mjs +2 -0
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplateDesignerInspector.vue.mjs +208 -180
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplateDesignerSidebar.vue.mjs +2 -1
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplateDesignerToolbar.mjs +5 -0
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplateDesignerToolbar.vue.mjs +690 -0
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplateDesignerWorkspaceHeader.mjs +5 -0
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplateDesignerWorkspaceHeader.vue.mjs +253 -0
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplateImageContextMenu.mjs +5 -0
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplateImageContextMenu.vue.mjs +87 -0
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplatePageDecorations.mjs +5 -0
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplatePageDecorations.vue.mjs +98 -0
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplatePageDecorationsInspector.mjs +5 -0
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplatePageDecorationsInspector.vue.mjs +550 -0
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplatePageDecorationsStudio.mjs +5 -0
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplatePageDecorationsStudio.vue.mjs +117 -0
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplatePreviewModal.mjs +5 -0
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplatePreviewModal.vue.mjs +96 -0
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplatePreviewPage.vue.mjs +51 -26
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplateRendererPage.vue.mjs +56 -33
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplateSubmitDataModal.mjs +5 -0
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplateSubmitDataModal.vue.mjs +29 -0
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplateTextBubbleMenu.mjs +5 -0
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplateTextBubbleMenu.vue.mjs +179 -0
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplateTextContextMenu.mjs +5 -0
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplateTextContextMenu.vue.mjs +390 -0
- package/dist/es/components/pro-contract-template-designer/src/DesignerPage.vue.mjs +332 -263
- package/dist/es/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.mjs +1442 -2287
- package/dist/es/components/pro-contract-template-designer/src/composables/use-auto-pagination.mjs +71 -0
- package/dist/es/components/pro-contract-template-designer/src/composables/use-designer-files.mjs +11 -0
- package/dist/es/components/pro-contract-template-designer/src/composables/use-draft-cache-session.mjs +111 -0
- package/dist/es/components/pro-contract-template-designer/src/composables/use-signing-placement-editor.mjs +79 -0
- package/dist/es/components/pro-contract-template-designer/src/composables/use-template-designer.mjs +189 -160
- package/dist/es/components/pro-contract-template-designer/src/composables/use-template-files.mjs +35 -22
- package/dist/es/components/pro-contract-template-designer/src/composables/use-toolbar-overflow.mjs +71 -0
- package/dist/es/components/pro-contract-template-designer/src/constants.mjs +71 -10
- package/dist/es/components/pro-contract-template-designer/src/extensions/editor-extensions.mjs +1 -0
- package/dist/es/components/pro-contract-template-designer/src/utils/block-style.mjs +43 -0
- package/dist/es/components/pro-contract-template-designer/src/utils/context-menu-viewport.mjs +13 -0
- package/dist/es/components/pro-contract-template-designer/src/utils/editor-state.mjs +7 -0
- package/dist/es/components/pro-contract-template-designer/src/utils/page-decorations.mjs +398 -0
- package/dist/es/components/pro-contract-template-designer/src/utils/serialize-fingerprint.mjs +6 -0
- package/dist/es/components/pro-contract-template-designer/src/utils/template-renderer.mjs +88 -72
- package/dist/es/components/pro-contract-template-designer/style/index.css +1 -1
- package/dist/es/index.mjs +20 -20
- package/dist/lib/components/contract-signing-location/src/ContractSigningLocationCanvas.vue.cjs +1 -1
- package/dist/lib/components/contract-signing-location/src/coordinates.cjs +1 -1
- package/dist/lib/components/contract-signing-location/src/location-rules.cjs +1 -1
- package/dist/lib/components/contract-signing-location/src/page-layout.cjs +1 -1
- package/dist/lib/components/contract-signing-location/src/template-source.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateDesignerInspector.vue.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateDesignerSidebar.vue.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateDesignerToolbar.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateDesignerToolbar.vue.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateDesignerWorkspaceHeader.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateDesignerWorkspaceHeader.vue.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateImageContextMenu.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateImageContextMenu.vue.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplatePageDecorations.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplatePageDecorations.vue.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplatePageDecorationsInspector.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplatePageDecorationsInspector.vue.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplatePageDecorationsStudio.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplatePageDecorationsStudio.vue.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplatePreviewModal.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplatePreviewModal.vue.cjs +1 -0
- 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/ContractTemplateSubmitDataModal.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateSubmitDataModal.vue.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateTextBubbleMenu.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateTextBubbleMenu.vue.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateTextContextMenu.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateTextContextMenu.vue.cjs +1 -0
- 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/composables/use-auto-pagination.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/composables/use-designer-files.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/composables/use-draft-cache-session.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/composables/use-signing-placement-editor.cjs +1 -0
- 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/composables/use-template-files.cjs +2 -2
- package/dist/lib/components/pro-contract-template-designer/src/composables/use-toolbar-overflow.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/constants.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/extensions/editor-extensions.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/utils/block-style.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/utils/context-menu-viewport.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/utils/editor-state.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/utils/page-decorations.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/utils/serialize-fingerprint.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/utils/template-renderer.cjs +3 -3
- package/dist/lib/components/pro-contract-template-designer/style/index.css +1 -1
- 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/coordinates.d.ts +2 -2
- package/dist/types/components/contract-signing-location/src/page-layout.d.ts +2 -2
- package/dist/types/components/contract-signing-location/src/template-source.d.ts +2 -0
- package/dist/types/components/contract-signing-location/src/types.d.ts +3 -0
- package/dist/types/components/pro-contract-template-designer/src/ContractTemplateDesignerInspector.vue.d.ts +3 -0
- package/dist/types/components/pro-contract-template-designer/src/ContractTemplateDesignerSidebar.vue.d.ts +1 -0
- package/dist/types/components/pro-contract-template-designer/src/ContractTemplateDesignerToolbar.vue.d.ts +104 -0
- package/dist/types/components/pro-contract-template-designer/src/ContractTemplateDesignerWorkspaceHeader.vue.d.ts +60 -0
- package/dist/types/components/pro-contract-template-designer/src/ContractTemplateImageContextMenu.vue.d.ts +27 -0
- package/dist/types/components/pro-contract-template-designer/src/ContractTemplatePageDecorations.vue.d.ts +13 -0
- package/dist/types/components/pro-contract-template-designer/src/ContractTemplatePageDecorationsInspector.vue.d.ts +28 -0
- package/dist/types/components/pro-contract-template-designer/src/ContractTemplatePageDecorationsStudio.vue.d.ts +77 -0
- package/dist/types/components/pro-contract-template-designer/src/ContractTemplatePreviewModal.vue.d.ts +36 -0
- package/dist/types/components/pro-contract-template-designer/src/ContractTemplatePreviewPage.vue.d.ts +5 -1
- package/dist/types/components/pro-contract-template-designer/src/ContractTemplateRendererHeader.vue.d.ts +4 -4
- package/dist/types/components/pro-contract-template-designer/src/ContractTemplateRendererToolbar.vue.d.ts +4 -4
- package/dist/types/components/pro-contract-template-designer/src/ContractTemplateSubmitDataModal.vue.d.ts +12 -0
- package/dist/types/components/pro-contract-template-designer/src/ContractTemplateTextBubbleMenu.vue.d.ts +43 -0
- package/dist/types/components/pro-contract-template-designer/src/ContractTemplateTextContextMenu.vue.d.ts +77 -0
- package/dist/types/components/pro-contract-template-designer/src/DesignerPage.vue.d.ts +30 -32
- package/dist/types/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.d.ts +456 -12
- package/dist/types/components/pro-contract-template-designer/src/composables/use-auto-pagination.d.ts +43 -0
- package/dist/types/components/pro-contract-template-designer/src/composables/use-designer-files.d.ts +22 -0
- package/dist/types/components/pro-contract-template-designer/src/composables/use-draft-cache-session.d.ts +41 -0
- package/dist/types/components/pro-contract-template-designer/src/composables/use-signing-placement-editor.d.ts +49 -0
- package/dist/types/components/pro-contract-template-designer/src/composables/use-template-designer.d.ts +15 -1
- package/dist/types/components/pro-contract-template-designer/src/composables/use-template-files.d.ts +13 -0
- package/dist/types/components/pro-contract-template-designer/src/composables/use-toolbar-overflow.d.ts +19 -0
- package/dist/types/components/pro-contract-template-designer/src/constants.d.ts +7 -1
- package/dist/types/components/pro-contract-template-designer/src/types.d.ts +89 -0
- package/dist/types/components/pro-contract-template-designer/src/utils/block-style.d.ts +4 -0
- package/dist/types/components/pro-contract-template-designer/src/utils/context-menu-viewport.d.ts +25 -0
- package/dist/types/components/pro-contract-template-designer/src/utils/editor-state.d.ts +8 -0
- package/dist/types/components/pro-contract-template-designer/src/utils/page-decorations.d.ts +90 -0
- package/dist/types/components/pro-contract-template-designer/src/utils/serialize-fingerprint.d.ts +8 -0
- package/dist/types/components/pro-contract-template-designer/src/utils/template-renderer.d.ts +4 -1
- package/package.json +3 -3
|
@@ -1,24 +1,29 @@
|
|
|
1
1
|
import { SIGNING_PLACEMENT_MIME as e, canMutateSigningPlacements as t, getSigningPlacementDefaultSize as n, parseSigningPlacementDragPayload as r } from "./utils/signing-placement.mjs";
|
|
2
2
|
import { CONTRACT_TEXT_STYLE_PRESETS as i } from "./constants.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { CONTRACT_PAGE_BASE_PADDING as a, getPageDecorationSafePadding as o, hasEnabledPageFooter as s, hasEnabledPageHeader as c, normalizePageDecorations as l } from "./utils/page-decorations.mjs";
|
|
4
|
+
import { DEFAULT_FIELD_STYLE as ee, resolvePageSize as te, splitPageContentByMeasurements as ne } from "./composables/use-template-designer.mjs";
|
|
5
|
+
import { buildTemplateVariableAttrs as re, insertTemplateVariableNode as ie } from "./extensions/template-variable.mjs";
|
|
5
6
|
import { normalizeContractImageDimension as u } from "./utils/content-image.mjs";
|
|
6
|
-
import { createEditorExtensions as
|
|
7
|
+
import { createEditorExtensions as ae, runContractTemplateEditorCommand as d } from "./extensions/editor-extensions.mjs";
|
|
7
8
|
import { resolveEditorContextMenuKind as f } from "./utils/context-variable.mjs";
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
9
|
+
import { applyContractTemplateBlockStyle as oe } from "./utils/block-style.mjs";
|
|
10
|
+
import se from "./SigningPlacementLayer.mjs";
|
|
11
|
+
import ce from "./ContractTemplatePageDecorations.mjs";
|
|
12
|
+
import { computed as p, createBlock as le, createCommentVNode as ue, createElementBlock as de, createElementVNode as m, createVNode as h, defineComponent as g, nextTick as fe, normalizeClass as pe, normalizeStyle as _, onBeforeUnmount as me, openBlock as v, ref as he, toDisplayString as y, unref as b, watch as x, withModifiers as ge } from "vue";
|
|
13
|
+
import { EditorContent as _e, useEditor as ve } from "@tiptap/vue-3";
|
|
14
|
+
import { generateHTML as ye } from "@tiptap/core";
|
|
15
|
+
import { CellSelection as S, deleteColumn as be, deleteRow as xe, deleteTable as Se } from "@tiptap/pm/tables";
|
|
16
|
+
import { NodeSelection as C } from "@tiptap/pm/state";
|
|
14
17
|
//#region src/components/pro-contract-template-designer/src/DesignerPage.vue?vue&type=script&setup=true&lang.ts
|
|
15
|
-
var
|
|
18
|
+
var Ce = { class: "gd-contract-template-designer__page-title" }, w = "application/x-gd-contract-variable-move", we = 8, T = /* @__PURE__ */ g({
|
|
16
19
|
name: "ProContractTemplateDesignerPage",
|
|
17
20
|
__name: "DesignerPage",
|
|
18
21
|
props: {
|
|
19
22
|
page: {},
|
|
20
23
|
pageIndex: {},
|
|
21
24
|
pageSize: {},
|
|
25
|
+
pageDecorations: { default: void 0 },
|
|
26
|
+
totalPages: { default: 1 },
|
|
22
27
|
variables: {},
|
|
23
28
|
selectedVariableKey: { default: "" },
|
|
24
29
|
active: {
|
|
@@ -54,130 +59,144 @@ var _e = { class: "gd-contract-template-designer__page-title" }, C = "applicatio
|
|
|
54
59
|
"editor-state-change",
|
|
55
60
|
"editor-context-menu"
|
|
56
61
|
],
|
|
57
|
-
setup(
|
|
58
|
-
let
|
|
59
|
-
processImageFile:
|
|
60
|
-
getZoom: () => Math.max(.1,
|
|
61
|
-
}),
|
|
62
|
-
content:
|
|
63
|
-
editable: !
|
|
64
|
-
extensions:
|
|
62
|
+
setup(g, { expose: T, emit: Te }) {
|
|
63
|
+
let E = g, D = Te, O = p(() => E.readonly || E.disabled), k = he(), A = ae("请输入合同正文,或从 WPS / Word 粘贴合同内容", {
|
|
64
|
+
processImageFile: E.processImageFile,
|
|
65
|
+
getZoom: () => Math.max(.1, E.zoom || 1)
|
|
66
|
+
}), j = ve({
|
|
67
|
+
content: E.page.contentHtml,
|
|
68
|
+
editable: !O.value,
|
|
69
|
+
extensions: A,
|
|
65
70
|
editorProps: {
|
|
66
71
|
attributes: { class: "gd-contract-template-designer__editor-prose" },
|
|
67
72
|
handleClick: (e, t, n) => {
|
|
68
73
|
let r = (n.target instanceof HTMLElement ? n.target.closest("[data-template-variable]") : void 0)?.dataset.key;
|
|
69
74
|
if (!r) return !1;
|
|
70
|
-
let i =
|
|
71
|
-
return i &&
|
|
75
|
+
let i = E.variables.find((e) => e.key === r);
|
|
76
|
+
return i && D("variable-select", i.key), !1;
|
|
72
77
|
},
|
|
73
78
|
handleDOMEvents: {
|
|
74
79
|
contextmenu: (e, t) => {
|
|
75
|
-
if (
|
|
76
|
-
let n =
|
|
80
|
+
if (O.value) return !1;
|
|
81
|
+
let n = Le(e, t.target);
|
|
77
82
|
if (n) return t.preventDefault(), L({
|
|
78
|
-
pageId:
|
|
83
|
+
pageId: E.page.id,
|
|
79
84
|
clientX: t.clientX,
|
|
80
85
|
clientY: t.clientY
|
|
81
86
|
}, n), !0;
|
|
82
|
-
let r =
|
|
87
|
+
let r = j.value?.state.selection, i = r instanceof S, a = t.target instanceof HTMLElement ? !!t.target.closest("td, th") : !1, o = f({
|
|
83
88
|
isCellSelection: i,
|
|
84
89
|
selectionEmpty: !r || r.empty,
|
|
85
90
|
inTable: a
|
|
86
91
|
});
|
|
87
|
-
return t.preventDefault(), o === "table" && (i ||
|
|
88
|
-
pageId:
|
|
92
|
+
return t.preventDefault(), o === "table" && (i || Pe(t.clientX, t.clientY, t.target)) ? (B({
|
|
93
|
+
pageId: E.page.id,
|
|
89
94
|
clientX: t.clientX,
|
|
90
95
|
clientY: t.clientY
|
|
91
96
|
}), !0) : (I({
|
|
92
|
-
pageId:
|
|
97
|
+
pageId: E.page.id,
|
|
93
98
|
clientX: t.clientX,
|
|
94
99
|
clientY: t.clientY
|
|
95
100
|
}), !0);
|
|
96
101
|
},
|
|
97
|
-
dragstart: (e, t) =>
|
|
98
|
-
dragend: () => (
|
|
102
|
+
dragstart: (e, t) => O.value ? (t.preventDefault(), !0) : (t.target instanceof HTMLElement ? t.target : null)?.closest("[data-template-variable]") ? (t.dataTransfer?.setData(w, E.page.id), t.dataTransfer && (t.dataTransfer.effectAllowed = "move"), k.value?.classList.add("is-variable-dragging"), !1) : !1,
|
|
103
|
+
dragend: () => (k.value?.classList.remove("is-variable-dragging"), !1),
|
|
99
104
|
drop: (e, t) => {
|
|
100
|
-
if (
|
|
101
|
-
let n = t.dataTransfer?.getData(
|
|
102
|
-
return !n || n ===
|
|
105
|
+
if (O.value) return t.preventDefault(), t.stopPropagation(), !0;
|
|
106
|
+
let n = t.dataTransfer?.getData(w);
|
|
107
|
+
return !n || n === E.page.id ? !1 : (t.preventDefault(), D("variable-move-blocked", E.page.id), !0);
|
|
103
108
|
}
|
|
104
109
|
},
|
|
105
110
|
handleKeyDown: (e, t) => {
|
|
106
|
-
if (
|
|
107
|
-
let n =
|
|
111
|
+
if (O.value || !je(t)) return !1;
|
|
112
|
+
let n = j.value;
|
|
108
113
|
if (!n) return !1;
|
|
109
114
|
t.preventDefault();
|
|
110
115
|
let r = n.state.selection, i = z();
|
|
111
116
|
if (i) {
|
|
112
117
|
let e = n.view.coordsAtPos(r.from);
|
|
113
118
|
return L({
|
|
114
|
-
pageId:
|
|
119
|
+
pageId: E.page.id,
|
|
115
120
|
clientX: e.left,
|
|
116
121
|
clientY: e.bottom
|
|
117
122
|
}, i), !0;
|
|
118
123
|
}
|
|
119
|
-
let a = r instanceof
|
|
124
|
+
let a = r instanceof S;
|
|
120
125
|
if (f({
|
|
121
126
|
isCellSelection: a,
|
|
122
127
|
selectionEmpty: r.empty,
|
|
123
128
|
inTable: n.isActive("table")
|
|
124
129
|
}) === "table") {
|
|
125
130
|
if (!a) {
|
|
126
|
-
let e =
|
|
127
|
-
typeof e == "number" && n.view.dispatch(n.state.tr.setSelection(
|
|
131
|
+
let e = Ne();
|
|
132
|
+
typeof e == "number" && n.view.dispatch(n.state.tr.setSelection(S.create(n.state.doc, e)));
|
|
128
133
|
}
|
|
129
134
|
let e = n.view.coordsAtPos(n.state.selection.from);
|
|
130
135
|
return B({
|
|
131
|
-
pageId:
|
|
136
|
+
pageId: E.page.id,
|
|
132
137
|
clientX: e.left,
|
|
133
138
|
clientY: e.bottom
|
|
134
139
|
}), !0;
|
|
135
140
|
}
|
|
136
141
|
let o = n.view.coordsAtPos(n.state.selection.from);
|
|
137
142
|
return I({
|
|
138
|
-
pageId:
|
|
143
|
+
pageId: E.page.id,
|
|
139
144
|
clientX: o.left,
|
|
140
145
|
clientY: o.bottom
|
|
141
146
|
}), !0;
|
|
142
147
|
}
|
|
143
148
|
},
|
|
144
149
|
onUpdate: ({ editor: e }) => {
|
|
145
|
-
|
|
146
|
-
...
|
|
150
|
+
D("page-update", {
|
|
151
|
+
...E.page,
|
|
147
152
|
contentHtml: e.getHTML(),
|
|
148
153
|
contentJson: e.getJSON()
|
|
149
|
-
}),
|
|
154
|
+
}), U();
|
|
150
155
|
},
|
|
151
156
|
onFocus: () => {
|
|
152
|
-
|
|
157
|
+
D("editor-focus", E.page.id), U();
|
|
153
158
|
},
|
|
154
|
-
onBlur:
|
|
155
|
-
onSelectionUpdate:
|
|
156
|
-
onCreate:
|
|
159
|
+
onBlur: U,
|
|
160
|
+
onSelectionUpdate: U,
|
|
161
|
+
onCreate: U
|
|
157
162
|
});
|
|
158
|
-
function
|
|
163
|
+
function Ee(e) {
|
|
159
164
|
if (typeof e == "number" && Number.isFinite(e)) return e;
|
|
160
165
|
let t = String(e || "").match(/(\d+(\.\d+)?)/);
|
|
161
166
|
return t ? Number(t[1]) : void 0;
|
|
162
167
|
}
|
|
163
|
-
function
|
|
164
|
-
if (!
|
|
165
|
-
let { from: e, to: t } =
|
|
166
|
-
return
|
|
168
|
+
function De() {
|
|
169
|
+
if (!j.value) return "";
|
|
170
|
+
let { from: e, to: t } = j.value.state.selection;
|
|
171
|
+
return j.value.state.doc.textBetween(e, t, "\n");
|
|
167
172
|
}
|
|
168
|
-
function
|
|
169
|
-
let e =
|
|
173
|
+
function Oe() {
|
|
174
|
+
let e = j.value, t = e?.state.selection;
|
|
170
175
|
if (!(!e || !t || t.empty)) try {
|
|
171
176
|
let n = e.view.coordsAtPos(t.from), r = e.view.coordsAtPos(t.to, -1);
|
|
172
|
-
if (Math.abs(r.top - n.top) >
|
|
173
|
-
let i = Math.abs(r.left - n.left) /
|
|
177
|
+
if (Math.abs(r.top - n.top) > we) return;
|
|
178
|
+
let i = Math.abs(r.left - n.left) / W.value;
|
|
174
179
|
return Number.isFinite(i) && i > 0 ? i : void 0;
|
|
175
180
|
} catch {
|
|
176
181
|
return;
|
|
177
182
|
}
|
|
178
183
|
}
|
|
179
|
-
function
|
|
180
|
-
let e =
|
|
184
|
+
function ke() {
|
|
185
|
+
let e = j.value, t = e?.state.selection;
|
|
186
|
+
if (!(!e || !t || t.empty) && !(t instanceof S || t instanceof C)) try {
|
|
187
|
+
let n = e.view.coordsAtPos(t.from), r = e.view.coordsAtPos(t.to, -1);
|
|
188
|
+
return {
|
|
189
|
+
top: Math.min(n.top, r.top),
|
|
190
|
+
bottom: Math.max(n.bottom, r.bottom),
|
|
191
|
+
left: Math.min(n.left, r.left),
|
|
192
|
+
right: Math.max(n.left, r.right)
|
|
193
|
+
};
|
|
194
|
+
} catch {
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
function Ae() {
|
|
199
|
+
let e = j.value;
|
|
181
200
|
if (!e) return "";
|
|
182
201
|
let t = e.state.selection.$from, n = t.pos;
|
|
183
202
|
for (let e = t.depth; e > 0; --e) {
|
|
@@ -189,7 +208,7 @@ var _e = { class: "gd-contract-template-designer__page-title" }, C = "applicatio
|
|
|
189
208
|
}
|
|
190
209
|
return e.state.doc.textBetween(n, e.state.selection.from, "");
|
|
191
210
|
}
|
|
192
|
-
function
|
|
211
|
+
function je(e) {
|
|
193
212
|
return e.key === "ContextMenu" || e.shiftKey && e.key === "F10";
|
|
194
213
|
}
|
|
195
214
|
function M(e) {
|
|
@@ -198,26 +217,26 @@ var _e = { class: "gd-contract-template-designer__page-title" }, C = "applicatio
|
|
|
198
217
|
if (n === "cell" || n === "header_cell") return e.before(t);
|
|
199
218
|
}
|
|
200
219
|
}
|
|
201
|
-
function
|
|
202
|
-
let n =
|
|
220
|
+
function Me(e, t) {
|
|
221
|
+
let n = j.value, r = n?.view.posAtCoords({
|
|
203
222
|
left: e,
|
|
204
223
|
top: t
|
|
205
224
|
})?.pos;
|
|
206
225
|
if (!(!n || typeof r != "number")) return M(n.state.doc.resolve(r));
|
|
207
226
|
}
|
|
208
|
-
function
|
|
209
|
-
let e =
|
|
227
|
+
function Ne() {
|
|
228
|
+
let e = j.value;
|
|
210
229
|
if (e) return M(e.state.selection.$from);
|
|
211
230
|
}
|
|
212
|
-
function
|
|
213
|
-
let r =
|
|
231
|
+
function Pe(e, t, n) {
|
|
232
|
+
let r = j.value, i = n instanceof HTMLElement ? n : null;
|
|
214
233
|
if (!r || !i?.closest("td,th")) return !1;
|
|
215
|
-
if (r.state.selection instanceof
|
|
216
|
-
let a =
|
|
217
|
-
return typeof a == "number" ? (r.view.dispatch(r.state.tr.setSelection(
|
|
234
|
+
if (r.state.selection instanceof S && i.closest("td.selectedCell,th.selectedCell")) return !0;
|
|
235
|
+
let a = Me(e, t);
|
|
236
|
+
return typeof a == "number" ? (r.view.dispatch(r.state.tr.setSelection(S.create(r.state.doc, a))), !0) : !1;
|
|
218
237
|
}
|
|
219
238
|
function N() {
|
|
220
|
-
let e =
|
|
239
|
+
let e = j.value, t = e?.isActive("table") ? e.can() : void 0, n = (e) => !!(t && e(t));
|
|
221
240
|
return {
|
|
222
241
|
addRowBefore: n((e) => e.addRowBefore()),
|
|
223
242
|
addRowAfter: n((e) => e.addRowAfter()),
|
|
@@ -235,41 +254,48 @@ var _e = { class: "gd-contract-template-designer__page-title" }, C = "applicatio
|
|
|
235
254
|
deleteTable: n((e) => e.deleteTable())
|
|
236
255
|
};
|
|
237
256
|
}
|
|
238
|
-
function
|
|
239
|
-
let e =
|
|
240
|
-
if (!e || !(t instanceof
|
|
257
|
+
function Fe() {
|
|
258
|
+
let e = j.value, t = e?.state.selection;
|
|
259
|
+
if (!e || !(t instanceof S)) return "left";
|
|
241
260
|
let n = /* @__PURE__ */ new Set();
|
|
242
261
|
return t.forEachCell((e) => {
|
|
243
262
|
let t = e.attrs.textAlign;
|
|
244
263
|
n.add(t === "center" || t === "right" ? t : "left");
|
|
245
264
|
}), n.size === 1 ? n.values().next().value ?? "left" : "mixed";
|
|
246
265
|
}
|
|
247
|
-
function P(e =
|
|
266
|
+
function P(e = j.value?.state.doc) {
|
|
248
267
|
let t = 0;
|
|
249
268
|
return e?.descendants((e) => {
|
|
250
269
|
e.type.name === "templateVariable" && (t += 1);
|
|
251
270
|
}), t;
|
|
252
271
|
}
|
|
253
272
|
function F(e) {
|
|
254
|
-
let t =
|
|
273
|
+
let t = j.value;
|
|
255
274
|
if (!t) return 0;
|
|
256
275
|
let n = P(t.state.doc), r = n, i = (e) => {
|
|
257
276
|
r = P(e.doc);
|
|
258
277
|
};
|
|
259
|
-
return e === "delete-table-row" ?
|
|
278
|
+
return e === "delete-table-row" ? xe(t.state, i) : e === "delete-table-column" ? be(t.state, i) : Se(t.state, i), Math.max(0, n - r);
|
|
260
279
|
}
|
|
261
280
|
function I(e) {
|
|
262
|
-
let t =
|
|
263
|
-
|
|
281
|
+
let t = j.value?.state.selection, n = !!(t && !t.empty);
|
|
282
|
+
D("editor-context-menu", {
|
|
264
283
|
type: "text",
|
|
265
284
|
...e,
|
|
266
285
|
hasSelection: n,
|
|
267
|
-
selectionWidth: n ?
|
|
268
|
-
leadingText:
|
|
286
|
+
selectionWidth: n ? Oe() : void 0,
|
|
287
|
+
leadingText: Ae()
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
function Ie(e, t) {
|
|
291
|
+
I({
|
|
292
|
+
pageId: E.page.id,
|
|
293
|
+
clientX: e,
|
|
294
|
+
clientY: t
|
|
269
295
|
});
|
|
270
296
|
}
|
|
271
297
|
function L(e, t) {
|
|
272
|
-
|
|
298
|
+
D("editor-context-menu", {
|
|
273
299
|
type: "image",
|
|
274
300
|
...e,
|
|
275
301
|
image: t
|
|
@@ -286,24 +312,24 @@ var _e = { class: "gd-contract-template-designer__page-title" }, C = "applicatio
|
|
|
286
312
|
};
|
|
287
313
|
}
|
|
288
314
|
function z() {
|
|
289
|
-
let e =
|
|
290
|
-
if (e instanceof
|
|
315
|
+
let e = j.value?.state.selection;
|
|
316
|
+
if (e instanceof C) return R(e.node, e.from);
|
|
291
317
|
}
|
|
292
|
-
function
|
|
318
|
+
function Le(e, t) {
|
|
293
319
|
let n = t instanceof HTMLElement ? t.closest("[data-template-variable], img[src]") : null;
|
|
294
320
|
if (n) try {
|
|
295
321
|
let t = e.posAtDOM(n, 0), r = e.state.doc.nodeAt(t);
|
|
296
|
-
return !r || r.type.name !== "templateVariable" && r.type.name !== "image" ? void 0 : (r.type.name === "templateVariable" && typeof r.attrs.key == "string" &&
|
|
322
|
+
return !r || r.type.name !== "templateVariable" && r.type.name !== "image" ? void 0 : (r.type.name === "templateVariable" && typeof r.attrs.key == "string" && D("variable-select", r.attrs.key), (!(e.state.selection instanceof C) || e.state.selection.from !== t) && e.dispatch(e.state.tr.setSelection(C.create(e.state.doc, t))), R(r, t));
|
|
297
323
|
} catch {
|
|
298
324
|
return;
|
|
299
325
|
}
|
|
300
326
|
}
|
|
301
327
|
function B(e) {
|
|
302
|
-
|
|
328
|
+
D("editor-context-menu", {
|
|
303
329
|
type: "table",
|
|
304
330
|
...e,
|
|
305
331
|
capabilities: N(),
|
|
306
|
-
activeAlignment:
|
|
332
|
+
activeAlignment: Fe(),
|
|
307
333
|
affectedVariableCounts: {
|
|
308
334
|
deleteRow: F("delete-table-row"),
|
|
309
335
|
deleteColumn: F("delete-table-column"),
|
|
@@ -311,21 +337,37 @@ var _e = { class: "gd-contract-template-designer__page-title" }, C = "applicatio
|
|
|
311
337
|
}
|
|
312
338
|
});
|
|
313
339
|
}
|
|
314
|
-
function
|
|
315
|
-
return
|
|
316
|
-
1,
|
|
317
|
-
2,
|
|
318
|
-
3,
|
|
319
|
-
4,
|
|
320
|
-
5,
|
|
321
|
-
6
|
|
322
|
-
].find((e) => A.value?.isActive("heading", { level: e })) : void 0;
|
|
323
|
-
}
|
|
324
|
-
function Ae() {
|
|
325
|
-
return ["center", "right"].find((e) => A.value?.isActive("heading", { textAlign: e }) || A.value?.isActive("paragraph", { textAlign: e })) ?? "left";
|
|
340
|
+
function Re(e) {
|
|
341
|
+
return typeof e == "number" && Number.isInteger(e) && e >= 1 && e <= 6;
|
|
326
342
|
}
|
|
327
343
|
function V() {
|
|
328
|
-
let e =
|
|
344
|
+
let e = j.value;
|
|
345
|
+
if (!e) return [];
|
|
346
|
+
let { doc: t, selection: n } = e.state, r = [], i = (e) => {
|
|
347
|
+
e.type.name === "paragraph" ? r.push("paragraph") : e.type.name === "heading" && Re(e.attrs.level) && r.push(e.attrs.level);
|
|
348
|
+
};
|
|
349
|
+
if (n.empty) for (let e = n.$from.depth; e > 0; e--) {
|
|
350
|
+
let t = n.$from.node(e);
|
|
351
|
+
if (t.type.name === "paragraph" || t.type.name === "heading") {
|
|
352
|
+
i(t);
|
|
353
|
+
break;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
else t.nodesBetween(n.from, n.to, (e) => (i(e), !0));
|
|
357
|
+
return Array.from(new Set(r));
|
|
358
|
+
}
|
|
359
|
+
function ze() {
|
|
360
|
+
let e = V();
|
|
361
|
+
return e.length === 1 && e[0] !== "paragraph" ? e[0] : void 0;
|
|
362
|
+
}
|
|
363
|
+
function Be() {
|
|
364
|
+
return V().length > 1;
|
|
365
|
+
}
|
|
366
|
+
function Ve() {
|
|
367
|
+
return ["center", "right"].find((e) => j.value?.isActive("heading", { textAlign: e }) || j.value?.isActive("paragraph", { textAlign: e })) ?? "left";
|
|
368
|
+
}
|
|
369
|
+
function H() {
|
|
370
|
+
let e = j.value, t = (t) => !!e?.isActive(t), n = e?.getAttributes("textStyle") ?? {};
|
|
329
371
|
return {
|
|
330
372
|
isFocused: !!e?.isFocused,
|
|
331
373
|
canUndo: !!e?.can().undo(),
|
|
@@ -336,88 +378,94 @@ var _e = { class: "gd-contract-template-designer__page-title" }, C = "applicatio
|
|
|
336
378
|
isBulletList: t("bulletList"),
|
|
337
379
|
isOrderedList: t("orderedList"),
|
|
338
380
|
isTableActive: t("table"),
|
|
339
|
-
currentHeadingLevel:
|
|
340
|
-
|
|
381
|
+
currentHeadingLevel: ze(),
|
|
382
|
+
hasMixedBlockFormats: Be(),
|
|
383
|
+
textAlign: Ve(),
|
|
341
384
|
fontFamily: typeof n.fontFamily == "string" ? n.fontFamily : void 0,
|
|
342
|
-
fontSize:
|
|
385
|
+
fontSize: Ee(n.fontSize),
|
|
343
386
|
textColor: typeof n.color == "string" ? n.color : void 0,
|
|
344
|
-
selectionText:
|
|
387
|
+
selectionText: De(),
|
|
345
388
|
selectedContentImage: z()
|
|
346
389
|
};
|
|
347
390
|
}
|
|
348
|
-
function
|
|
349
|
-
|
|
391
|
+
function U() {
|
|
392
|
+
D("editor-state-change", E.page.id, H());
|
|
350
393
|
}
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
}),
|
|
354
|
-
!
|
|
394
|
+
x(O, (e) => {
|
|
395
|
+
j.value?.setEditable(!e), U();
|
|
396
|
+
}), x(() => E.page.contentHtml, (e) => {
|
|
397
|
+
!j.value || e === j.value.getHTML() || (j.value.commands.setContent(e || "<p></p>", { emitUpdate: !1 }), U());
|
|
355
398
|
});
|
|
356
|
-
let
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
399
|
+
let He = p(() => {
|
|
400
|
+
let e = l(E.pageDecorations), t = E.pageIndex + 1, n = c(e, t) ? o(e.header) : a.top, r = s(e, t) ? o(e.footer) : a.bottom;
|
|
401
|
+
return {
|
|
402
|
+
width: `${E.pageSize.width}px`,
|
|
403
|
+
height: `${E.pageSize.height}px`,
|
|
404
|
+
paddingTop: `${n}px`,
|
|
405
|
+
paddingBottom: `${r}px`,
|
|
406
|
+
"--gd-contract-page-content-height": `${Math.max(120, E.pageSize.height - n - r)}px`
|
|
407
|
+
};
|
|
408
|
+
}), W = p(() => Math.max(.1, E.zoom || 1)), Ue = p(() => ({
|
|
409
|
+
width: `${Math.ceil((E.pageSize.width + 10) * W.value)}px`,
|
|
410
|
+
height: `${Math.ceil((E.pageSize.height + 40) * W.value)}px`
|
|
411
|
+
})), We = p(() => ({ "--gd-contract-page-zoom": String(W.value) })), Ge = p(() => te(E.pageSize));
|
|
412
|
+
function G(e, t) {
|
|
413
|
+
let n = k.value?.getBoundingClientRect();
|
|
366
414
|
return n ? {
|
|
367
|
-
x: Math.min(
|
|
368
|
-
y: Math.min(
|
|
415
|
+
x: Math.min(E.pageSize.width, Math.max(0, (e - n.left) / W.value)),
|
|
416
|
+
y: Math.min(E.pageSize.height, Math.max(0, (t - n.top) / W.value))
|
|
369
417
|
} : {
|
|
370
|
-
x:
|
|
371
|
-
y:
|
|
418
|
+
x: E.pageSize.width / 2,
|
|
419
|
+
y: E.pageSize.height / 2
|
|
372
420
|
};
|
|
373
421
|
}
|
|
374
|
-
function
|
|
375
|
-
let t =
|
|
422
|
+
function Ke(e) {
|
|
423
|
+
let t = k.value?.getBoundingClientRect(), r = k.value?.closest(".gd-contract-template-designer__canvas")?.getBoundingClientRect(), i = n(e);
|
|
376
424
|
if (!t || !r) return {
|
|
377
|
-
x: Math.max(0, (
|
|
378
|
-
y: Math.max(0, (
|
|
425
|
+
x: Math.max(0, (E.pageSize.width - i.width) / 2),
|
|
426
|
+
y: Math.max(0, (E.pageSize.height - i.height) / 2)
|
|
379
427
|
};
|
|
380
|
-
let a = Math.max(t.left, r.left), o = Math.max(t.top, r.top), s = Math.min(t.right, r.right), c = Math.min(t.bottom, r.bottom), l =
|
|
428
|
+
let a = Math.max(t.left, r.left), o = Math.max(t.top, r.top), s = Math.min(t.right, r.right), c = Math.min(t.bottom, r.bottom), l = G(s > a ? (a + s) / 2 : (t.left + t.right) / 2, c > o ? (o + c) / 2 : (t.top + t.bottom) / 2);
|
|
381
429
|
return {
|
|
382
430
|
x: l.x - i.width / 2,
|
|
383
431
|
y: l.y - i.height / 2
|
|
384
432
|
};
|
|
385
433
|
}
|
|
386
|
-
function
|
|
387
|
-
if (!t(
|
|
434
|
+
function qe(n) {
|
|
435
|
+
if (!t(E.readonly, E.disabled)) {
|
|
388
436
|
n.preventDefault(), n.stopPropagation();
|
|
389
437
|
return;
|
|
390
438
|
}
|
|
391
439
|
let i = r(n.dataTransfer?.getData(e));
|
|
392
440
|
if (i) {
|
|
393
441
|
n.preventDefault(), n.stopPropagation();
|
|
394
|
-
let e =
|
|
395
|
-
|
|
442
|
+
let e = G(n.clientX, n.clientY);
|
|
443
|
+
D("signing-placement-drop", E.page.id, i, e.x, e.y);
|
|
396
444
|
return;
|
|
397
445
|
}
|
|
398
446
|
let a = n.dataTransfer?.getData("application/x-gd-contract-variable");
|
|
399
447
|
if (a) {
|
|
400
|
-
n.preventDefault(), n.stopPropagation(),
|
|
448
|
+
n.preventDefault(), n.stopPropagation(), D("variable-drop", E.page.id, a, n.clientX, n.clientY);
|
|
401
449
|
return;
|
|
402
450
|
}
|
|
403
|
-
let o = n.dataTransfer?.getData(
|
|
404
|
-
o && o !==
|
|
451
|
+
let o = n.dataTransfer?.getData(w);
|
|
452
|
+
o && o !== E.page.id && (n.preventDefault(), n.stopPropagation(), D("variable-move-blocked", E.page.id));
|
|
405
453
|
}
|
|
406
|
-
function
|
|
407
|
-
let n =
|
|
408
|
-
return n ? (
|
|
454
|
+
function Je(e, t) {
|
|
455
|
+
let n = j.value;
|
|
456
|
+
return n ? (ie(n, e, t ? n.view.posAtCoords(t)?.pos : void 0), $(), K()) : void 0;
|
|
409
457
|
}
|
|
410
|
-
function
|
|
411
|
-
let n =
|
|
458
|
+
function Ye(e, t) {
|
|
459
|
+
let n = j.value;
|
|
412
460
|
if (n) return d(n, {
|
|
413
461
|
type: "insert-content-image",
|
|
414
462
|
image: e,
|
|
415
463
|
position: t
|
|
416
|
-
}),
|
|
464
|
+
}), K();
|
|
417
465
|
}
|
|
418
|
-
function
|
|
419
|
-
let t =
|
|
420
|
-
if (!t || !(n instanceof
|
|
466
|
+
function Xe(e) {
|
|
467
|
+
let t = j.value, n = t?.state.selection;
|
|
468
|
+
if (!t || !(n instanceof C) || n.node.type.name !== "image") return;
|
|
421
469
|
let r = { ...n.node.attrs }, i = !1;
|
|
422
470
|
if (["width", "height"].forEach((t) => {
|
|
423
471
|
if (!Object.prototype.hasOwnProperty.call(e, t)) return;
|
|
@@ -425,45 +473,49 @@ var _e = { class: "gd-contract-template-designer__page-title" }, C = "applicatio
|
|
|
425
473
|
r[t] !== n && (r[t] = n, i = !0);
|
|
426
474
|
}), !i) return;
|
|
427
475
|
let a = t.state.tr.setNodeMarkup(n.from, void 0, r);
|
|
428
|
-
return a.setSelection(
|
|
476
|
+
return a.setSelection(C.create(a.doc, n.from)), t.view.dispatch(a), K();
|
|
429
477
|
}
|
|
430
|
-
function
|
|
431
|
-
let e =
|
|
478
|
+
function Ze() {
|
|
479
|
+
let e = j.value?.state.selection;
|
|
432
480
|
return e ? {
|
|
433
481
|
from: e.from,
|
|
434
482
|
to: e.to
|
|
435
483
|
} : void 0;
|
|
436
484
|
}
|
|
437
|
-
function
|
|
485
|
+
function K() {
|
|
438
486
|
return {
|
|
439
|
-
...
|
|
440
|
-
pageSize:
|
|
441
|
-
contentHtml:
|
|
442
|
-
contentJson:
|
|
487
|
+
...E.page,
|
|
488
|
+
pageSize: Ge.value,
|
|
489
|
+
contentHtml: j.value?.getHTML() ?? E.page.contentHtml,
|
|
490
|
+
contentJson: j.value?.getJSON() ?? E.page.contentJson
|
|
443
491
|
};
|
|
444
492
|
}
|
|
445
|
-
function
|
|
493
|
+
function q(e) {
|
|
446
494
|
return {
|
|
447
495
|
type: "doc",
|
|
448
496
|
content: e.length ? e : [{ type: "paragraph" }]
|
|
449
497
|
};
|
|
450
498
|
}
|
|
451
|
-
function
|
|
499
|
+
function Qe(e) {
|
|
452
500
|
return e?.length ? e.length === 1 && e[0].type === "paragraph" && !e[0].content?.length : !0;
|
|
453
501
|
}
|
|
454
|
-
function
|
|
455
|
-
return
|
|
502
|
+
function $e(e) {
|
|
503
|
+
return ye(q(e), A);
|
|
456
504
|
}
|
|
457
|
-
function
|
|
458
|
-
|
|
459
|
-
|
|
505
|
+
function et() {
|
|
506
|
+
if (E.pageDecorations) {
|
|
507
|
+
let e = l(E.pageDecorations), t = E.pageIndex + 1, n = c(e, t) ? o(e.header) : a.top, r = s(e, t) ? o(e.footer) : a.bottom;
|
|
508
|
+
return Math.max(120, E.pageSize.height - n - r);
|
|
509
|
+
}
|
|
510
|
+
let e = k.value;
|
|
511
|
+
if (!e) return E.pageSize.height - 108;
|
|
460
512
|
let t = window.getComputedStyle(e), n = Number.parseFloat(t.paddingTop) || 0, r = Number.parseFloat(t.paddingBottom) || 0;
|
|
461
|
-
return Math.max(120,
|
|
513
|
+
return Math.max(120, E.pageSize.height - n - r);
|
|
462
514
|
}
|
|
463
|
-
function
|
|
464
|
-
let e =
|
|
515
|
+
function tt() {
|
|
516
|
+
let e = k.value?.querySelector(".gd-contract-template-designer__editor-prose");
|
|
465
517
|
if (!e) return [];
|
|
466
|
-
let t = e.getBoundingClientRect(), n =
|
|
518
|
+
let t = e.getBoundingClientRect(), n = W.value;
|
|
467
519
|
return Array.from(e.children).map((e) => {
|
|
468
520
|
let r = e.getBoundingClientRect();
|
|
469
521
|
return {
|
|
@@ -473,26 +525,26 @@ var _e = { class: "gd-contract-template-designer__page-title" }, C = "applicatio
|
|
|
473
525
|
});
|
|
474
526
|
}
|
|
475
527
|
function J() {
|
|
476
|
-
return
|
|
528
|
+
return j.value ? ne(j.value.getJSON().content, tt(), et()) : void 0;
|
|
477
529
|
}
|
|
478
|
-
function
|
|
530
|
+
function nt() {
|
|
479
531
|
return !!J();
|
|
480
532
|
}
|
|
481
|
-
function
|
|
482
|
-
if (!
|
|
533
|
+
function rt() {
|
|
534
|
+
if (!j.value) return;
|
|
483
535
|
let e = J();
|
|
484
|
-
if (e) return
|
|
485
|
-
page:
|
|
536
|
+
if (e) return j.value.commands.setContent(q(e.currentContent), { emitUpdate: !1 }), {
|
|
537
|
+
page: K(),
|
|
486
538
|
overflowContent: e.overflowContent,
|
|
487
|
-
overflowHtml:
|
|
539
|
+
overflowHtml: $e(e.overflowContent)
|
|
488
540
|
};
|
|
489
541
|
}
|
|
490
|
-
function
|
|
491
|
-
if (!
|
|
492
|
-
let t =
|
|
493
|
-
return
|
|
542
|
+
function it(e) {
|
|
543
|
+
if (!j.value || !e.length) return;
|
|
544
|
+
let t = j.value.getJSON().content, n = [...e, ...Qe(t) ? [] : t ?? []];
|
|
545
|
+
return j.value.commands.setContent(q(n), { emitUpdate: !1 }), K();
|
|
494
546
|
}
|
|
495
|
-
function
|
|
547
|
+
function Y(e, t) {
|
|
496
548
|
let n = [];
|
|
497
549
|
return e.descendants((e, r) => {
|
|
498
550
|
e.type.name === "templateVariable" && e.attrs.key === t && n.push({
|
|
@@ -501,44 +553,44 @@ var _e = { class: "gd-contract-template-designer__page-title" }, C = "applicatio
|
|
|
501
553
|
});
|
|
502
554
|
}), n;
|
|
503
555
|
}
|
|
504
|
-
function
|
|
505
|
-
if (!
|
|
506
|
-
let n =
|
|
507
|
-
return
|
|
556
|
+
function X(e, t = e.key) {
|
|
557
|
+
if (!j.value) return;
|
|
558
|
+
let n = re(e), r = !1;
|
|
559
|
+
return j.value.commands.command(({ tr: e, state: i, dispatch: a }) => (Y(i.doc, t).forEach(({ node: t, pos: i }) => {
|
|
508
560
|
e.setNodeMarkup(i, void 0, {
|
|
509
561
|
...t.attrs,
|
|
510
562
|
...n
|
|
511
563
|
}), r = !0;
|
|
512
|
-
}), r && a?.(e), r)), $(), r ?
|
|
564
|
+
}), r && a?.(e), r)), $(), r ? K() : void 0;
|
|
513
565
|
}
|
|
514
|
-
function
|
|
515
|
-
if (!
|
|
566
|
+
function at(e) {
|
|
567
|
+
if (!j.value) return;
|
|
516
568
|
let t = 0;
|
|
517
|
-
return
|
|
518
|
-
let a =
|
|
569
|
+
return j.value.commands.command(({ tr: n, state: r, dispatch: i }) => {
|
|
570
|
+
let a = Y(r.doc, e).map(({ node: e, pos: t }) => ({
|
|
519
571
|
from: t,
|
|
520
572
|
to: t + e.nodeSize
|
|
521
573
|
})).sort((e, t) => t.from - e.from);
|
|
522
574
|
return a.forEach((e) => n.delete(e.from, e.to)), t = a.length, t && i?.(n), t > 0;
|
|
523
|
-
}), t ?
|
|
575
|
+
}), t ? K() : void 0;
|
|
524
576
|
}
|
|
525
577
|
function Z() {
|
|
526
|
-
|
|
578
|
+
k.value?.querySelectorAll(".gd-contract-template-variable.is-active").forEach((e) => e.classList.remove("is-active"));
|
|
527
579
|
}
|
|
528
580
|
function Q(e) {
|
|
529
|
-
if (e) return Array.from(
|
|
581
|
+
if (e) return Array.from(k.value?.querySelectorAll("[data-template-variable]") ?? []).find((t) => t.dataset.key === e);
|
|
530
582
|
}
|
|
531
|
-
function
|
|
583
|
+
function ot(e) {
|
|
532
584
|
Z();
|
|
533
585
|
let t = Q(e);
|
|
534
586
|
return t ? (t.classList.add("is-active"), t.scrollIntoView({
|
|
535
587
|
behavior: "smooth",
|
|
536
588
|
block: "center",
|
|
537
589
|
inline: "center"
|
|
538
|
-
}),
|
|
590
|
+
}), j.value?.commands.focus(), !0) : !1;
|
|
539
591
|
}
|
|
540
|
-
function
|
|
541
|
-
let t = Array.from(
|
|
592
|
+
function st(e) {
|
|
593
|
+
let t = Array.from(k.value?.querySelectorAll("[data-signing-placement-id]") ?? []).find((t) => t.dataset.signingPlacementId === e);
|
|
542
594
|
return t?.scrollIntoView({
|
|
543
595
|
behavior: "smooth",
|
|
544
596
|
block: "center",
|
|
@@ -546,106 +598,123 @@ var _e = { class: "gd-contract-template-designer__page-title" }, C = "applicatio
|
|
|
546
598
|
}), !!t;
|
|
547
599
|
}
|
|
548
600
|
function $() {
|
|
549
|
-
Z(), Q(
|
|
601
|
+
Z(), Q(E.selectedVariableKey)?.classList.add("is-active");
|
|
550
602
|
}
|
|
551
|
-
function
|
|
552
|
-
let t = i.find((t) => t.key === e), n =
|
|
603
|
+
function ct(e) {
|
|
604
|
+
let t = i.find((t) => t.key === e), n = j.value;
|
|
553
605
|
if (!t || !n) return;
|
|
554
606
|
let r = n.chain().focus().clearNodes();
|
|
555
|
-
t.headingLevel ? r.setHeading({ level: t.headingLevel }) : r.setParagraph(), r.unsetAllMarks().unsetTextAlign().unsetFontSize().unsetFontFamily().unsetColor().setTextAlign(t.textAlign).setFontSize(`${t.fontSize}px`).setFontFamily(t.fontFamily || "Noto Serif SC, Source Han Serif SC, Songti SC, STSong, SimSun, serif").setColor(
|
|
607
|
+
t.headingLevel ? r.setHeading({ level: t.headingLevel }) : r.setParagraph(), r.unsetAllMarks().unsetTextAlign().unsetFontSize().unsetFontFamily().unsetColor().setTextAlign(t.textAlign).setFontSize(`${t.fontSize}px`).setFontFamily(t.fontFamily || "Noto Serif SC, Source Han Serif SC, Songti SC, STSong, SimSun, serif").setColor(ee.color || "#1f2937"), t.bold ? r.setBold() : r.unsetBold(), t.italic ? r.setItalic() : r.unsetItalic(), t.underline ? r.setUnderline() : r.unsetUnderline(), r.run();
|
|
556
608
|
}
|
|
557
|
-
|
|
558
|
-
|
|
609
|
+
x([() => E.selectedVariableKey, () => E.variables], () => {
|
|
610
|
+
fe($);
|
|
559
611
|
}, {
|
|
560
612
|
deep: !0,
|
|
561
613
|
flush: "post"
|
|
562
614
|
});
|
|
563
|
-
function
|
|
564
|
-
e.type === "apply-text-style-preset" ?
|
|
615
|
+
function lt(e) {
|
|
616
|
+
e.type === "apply-block-style" ? j.value && oe(j.value, e.format) : e.type === "apply-text-style-preset" ? ct(e.preset) : d(j.value, e), U();
|
|
565
617
|
}
|
|
566
|
-
function
|
|
567
|
-
|
|
618
|
+
function ut() {
|
|
619
|
+
j.value?.commands.focus();
|
|
568
620
|
}
|
|
569
|
-
function
|
|
570
|
-
return
|
|
621
|
+
function dt() {
|
|
622
|
+
return j.value?.getJSON();
|
|
571
623
|
}
|
|
572
|
-
function
|
|
573
|
-
return
|
|
624
|
+
function ft() {
|
|
625
|
+
return j.value?.getHTML() ?? E.page.contentHtml;
|
|
574
626
|
}
|
|
575
|
-
function
|
|
576
|
-
let t =
|
|
627
|
+
function pt(e) {
|
|
628
|
+
let t = E.variables.find((t) => t.id === e || t.key === e), n = t ? Q(t.key) : void 0;
|
|
577
629
|
$(), n?.scrollIntoView({
|
|
578
630
|
behavior: "smooth",
|
|
579
631
|
block: "center"
|
|
580
632
|
});
|
|
581
633
|
}
|
|
582
|
-
function
|
|
583
|
-
|
|
634
|
+
function mt() {
|
|
635
|
+
k.value?.scrollIntoView({
|
|
584
636
|
behavior: "smooth",
|
|
585
637
|
block: "start",
|
|
586
638
|
inline: "center"
|
|
587
639
|
});
|
|
588
640
|
}
|
|
589
|
-
return
|
|
590
|
-
|
|
591
|
-
}),
|
|
592
|
-
focus:
|
|
593
|
-
getHTML:
|
|
594
|
-
getJSON:
|
|
595
|
-
getEditorState:
|
|
641
|
+
return me(() => {
|
|
642
|
+
j.value?.destroy();
|
|
643
|
+
}), T({
|
|
644
|
+
focus: ut,
|
|
645
|
+
getHTML: ft,
|
|
646
|
+
getJSON: dt,
|
|
647
|
+
getEditorState: H,
|
|
596
648
|
getTableCommandCapabilities: N,
|
|
597
649
|
getAffectedVariableCount: F,
|
|
598
|
-
getVisibleSigningPlacementPosition:
|
|
599
|
-
insertVariable:
|
|
600
|
-
insertContentImage:
|
|
601
|
-
updateSelectedContentImage:
|
|
602
|
-
getSelectionRange:
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
650
|
+
getVisibleSigningPlacementPosition: Ke,
|
|
651
|
+
insertVariable: Je,
|
|
652
|
+
insertContentImage: Ye,
|
|
653
|
+
updateSelectedContentImage: Xe,
|
|
654
|
+
getSelectionRange: Ze,
|
|
655
|
+
getSelectionViewportRect: ke,
|
|
656
|
+
requestTextContextMenu: Ie,
|
|
657
|
+
hasOverflowContent: nt,
|
|
658
|
+
updateVariable: X,
|
|
659
|
+
removeVariable: at,
|
|
660
|
+
splitOverflowContent: rt,
|
|
661
|
+
prependContent: it,
|
|
662
|
+
runCommand: lt,
|
|
663
|
+
scrollIntoField: pt,
|
|
664
|
+
scrollIntoVariable: ot,
|
|
665
|
+
scrollIntoSigningPlacement: st,
|
|
666
|
+
scrollIntoPage: mt
|
|
667
|
+
}), (e, t) => (v(), de("section", {
|
|
614
668
|
class: "gd-contract-template-designer__page-shell",
|
|
615
|
-
style:
|
|
669
|
+
style: _(Ue.value)
|
|
616
670
|
}, [m("div", {
|
|
617
|
-
class:
|
|
618
|
-
style:
|
|
619
|
-
}, [m("header",
|
|
671
|
+
class: pe(["gd-contract-template-designer__page-zoom", { "is-active": g.active }]),
|
|
672
|
+
style: _(We.value)
|
|
673
|
+
}, [m("header", Ce, [m("span", null, y(g.page.title || `第 ${g.pageIndex + 1} 页`), 1), m("span", null, "第 " + y(g.pageIndex + 1) + " 页 · " + y(g.pageSize.label || "A4") + " · " + y(g.pageSize.width) + " × " + y(g.pageSize.height), 1)]), m("div", {
|
|
620
674
|
ref_key: "pageElement",
|
|
621
|
-
ref:
|
|
675
|
+
ref: k,
|
|
622
676
|
class: "gd-contract-template-designer__page",
|
|
623
|
-
style:
|
|
624
|
-
onDragover: t[3] ||=
|
|
625
|
-
onDrop:
|
|
626
|
-
onClick: t[4] ||= (e) =>
|
|
627
|
-
}, [
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
"
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
677
|
+
style: _(He.value),
|
|
678
|
+
onDragover: t[3] ||= ge(() => {}, ["prevent"]),
|
|
679
|
+
onDrop: qe,
|
|
680
|
+
onClick: t[4] ||= (e) => D("editor-focus", g.page.id)
|
|
681
|
+
}, [
|
|
682
|
+
h(ce, {
|
|
683
|
+
decorations: g.pageDecorations,
|
|
684
|
+
"page-number": g.pageIndex + 1,
|
|
685
|
+
"total-pages": g.totalPages,
|
|
686
|
+
variables: g.variables
|
|
687
|
+
}, null, 8, [
|
|
688
|
+
"decorations",
|
|
689
|
+
"page-number",
|
|
690
|
+
"total-pages",
|
|
691
|
+
"variables"
|
|
692
|
+
]),
|
|
693
|
+
b(j) ? (v(), le(b(_e), {
|
|
694
|
+
key: 0,
|
|
695
|
+
class: "gd-contract-template-page__content",
|
|
696
|
+
editor: b(j)
|
|
697
|
+
}, null, 8, ["editor"])) : ue("", !0),
|
|
698
|
+
h(se, {
|
|
699
|
+
"page-size": g.pageSize,
|
|
700
|
+
placements: g.signingPlacements,
|
|
701
|
+
"selected-id": g.selectedSigningPlacementId,
|
|
702
|
+
zoom: W.value,
|
|
703
|
+
readonly: g.readonly,
|
|
704
|
+
disabled: g.disabled,
|
|
705
|
+
onSelect: t[0] ||= (e) => D("signing-placement-select", e),
|
|
706
|
+
onMove: t[1] ||= (e) => D("signing-placement-move", e),
|
|
707
|
+
onRemove: t[2] ||= (e) => D("signing-placement-remove", e)
|
|
708
|
+
}, null, 8, [
|
|
709
|
+
"page-size",
|
|
710
|
+
"placements",
|
|
711
|
+
"selected-id",
|
|
712
|
+
"zoom",
|
|
713
|
+
"readonly",
|
|
714
|
+
"disabled"
|
|
715
|
+
])
|
|
716
|
+
], 36)], 6)], 4));
|
|
648
717
|
}
|
|
649
718
|
});
|
|
650
719
|
//#endregion
|
|
651
|
-
export {
|
|
720
|
+
export { T as default };
|