@guodun/antdv 1.4.2 → 1.4.4
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/ContractSigningTemplatePage.vue.mjs +66 -13
- package/dist/es/components/contract-signing-location/src/constants.mjs +27 -17
- 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 +52 -34
- package/dist/es/components/contract-signing-location/style/index.css +1 -1
- package/dist/es/components/index.mjs +1 -1
- package/dist/es/components/pro-contract-template-designer/index.mjs +1 -1
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplateDesignerWorkspaceHeader.vue.mjs +186 -148
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplatePreviewPage.vue.mjs +4 -4
- 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/DesignerPage.vue.mjs +149 -126
- package/dist/es/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.mjs +1229 -1059
- package/dist/es/components/pro-contract-template-designer/src/composables/use-template-designer.mjs +34 -34
- package/dist/es/components/pro-contract-template-designer/src/utils/page-decorations.mjs +17 -17
- package/dist/es/components/pro-contract-template-designer/src/utils/signing-placement.mjs +14 -14
- package/dist/es/components/pro-contract-template-designer/src/utils/template-renderer.mjs +89 -89
- package/dist/es/components/pro-contract-template-designer/style/index.css +1 -1
- package/dist/es/index.mjs +25 -25
- 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/constants.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/contract-signing-location/style/index.css +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/ContractTemplateDesignerWorkspaceHeader.vue.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/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/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-template-designer.cjs +3 -3
- 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-placement.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/utils/template-renderer.cjs +2 -2
- package/dist/lib/components/pro-contract-template-designer/style/index.css +1 -1
- package/dist/lib/index.cjs +1 -1
- package/dist/theme/contract-signing-location.css +1 -1
- package/dist/theme/icon.css +1 -1
- package/dist/theme/index.css +1 -1
- package/dist/types/components/contract-signing-location/src/ContractSigningTemplatePage.vue.d.ts +3 -1
- package/dist/types/components/contract-signing-location/src/constants.d.ts +18 -0
- package/dist/types/components/contract-signing-location/src/coordinates.d.ts +8 -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 +19 -0
- package/dist/types/components/contract-signing-location/src/types.d.ts +3 -0
- package/dist/types/components/pro-contract-template-designer/src/ContractTemplateDesignerWorkspaceHeader.vue.d.ts +10 -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/DesignerPage.vue.d.ts +22 -0
- package/dist/types/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.d.ts +90 -0
- package/dist/types/components/pro-contract-template-designer/src/utils/context-menu-viewport.d.ts +3 -0
- package/package.json +5 -3
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { CONTRACT_TEXT_STYLE_PRESETS as e } from "./constants.mjs";
|
|
2
|
+
import { CONTRACT_PAGE_BASE_PADDING as t, getPageDecorationSafePadding as n, hasEnabledPageFooter as r, hasEnabledPageHeader as i, normalizePageDecorations as a } from "./utils/page-decorations.mjs";
|
|
3
|
+
import o from "./ContractTemplatePageDecorations.mjs";
|
|
4
|
+
import { SIGNING_PLACEMENT_MIME as s, canMutateSigningPlacements as c, getSigningPlacementDefaultSize as ee, parseSigningPlacementDragPayload as te } from "./utils/signing-placement.mjs";
|
|
5
|
+
import { DEFAULT_FIELD_STYLE as ne, resolvePageSize as re, splitPageContentByMeasurements as ie } from "./composables/use-template-designer.mjs";
|
|
6
|
+
import { buildTemplateVariableAttrs as l, insertTemplateVariableNode as ae } from "./extensions/template-variable.mjs";
|
|
6
7
|
import { normalizeContractImageDimension as u } from "./utils/content-image.mjs";
|
|
7
|
-
import { createEditorExtensions as
|
|
8
|
+
import { createEditorExtensions as oe, runContractTemplateEditorCommand as d } from "./extensions/editor-extensions.mjs";
|
|
8
9
|
import { resolveEditorContextMenuKind as f } from "./utils/context-variable.mjs";
|
|
9
|
-
import { applyContractTemplateBlockStyle as
|
|
10
|
-
import
|
|
11
|
-
import ce from "./ContractTemplatePageDecorations.mjs";
|
|
10
|
+
import { applyContractTemplateBlockStyle as se } from "./utils/block-style.mjs";
|
|
11
|
+
import ce from "./SigningPlacementLayer.mjs";
|
|
12
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
13
|
import { EditorContent as _e, useEditor as ve } from "@tiptap/vue-3";
|
|
14
14
|
import { generateHTML as ye } from "@tiptap/core";
|
|
@@ -60,7 +60,7 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
|
|
|
60
60
|
"editor-context-menu"
|
|
61
61
|
],
|
|
62
62
|
setup(g, { expose: T, emit: Te }) {
|
|
63
|
-
let E = g, D = Te, O = p(() => E.readonly || E.disabled), k = he(), A =
|
|
63
|
+
let E = g, D = Te, O = p(() => E.readonly || E.disabled), k = he(), A = oe("请输入合同正文,或从 WPS / Word 粘贴合同内容", {
|
|
64
64
|
processImageFile: E.processImageFile,
|
|
65
65
|
getZoom: () => Math.max(.1, E.zoom || 1)
|
|
66
66
|
}), j = ve({
|
|
@@ -78,7 +78,7 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
|
|
|
78
78
|
handleDOMEvents: {
|
|
79
79
|
contextmenu: (e, t) => {
|
|
80
80
|
if (O.value) return !1;
|
|
81
|
-
let n =
|
|
81
|
+
let n = Le(e, t.target);
|
|
82
82
|
if (n) return t.preventDefault(), L({
|
|
83
83
|
pageId: E.page.id,
|
|
84
84
|
clientX: t.clientX,
|
|
@@ -89,7 +89,7 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
|
|
|
89
89
|
selectionEmpty: !r || r.empty,
|
|
90
90
|
inTable: a
|
|
91
91
|
});
|
|
92
|
-
return t.preventDefault(), o === "table" && (i ||
|
|
92
|
+
return t.preventDefault(), o === "table" && (i || Pe(t.clientX, t.clientY, t.target)) ? (B({
|
|
93
93
|
pageId: E.page.id,
|
|
94
94
|
clientX: t.clientX,
|
|
95
95
|
clientY: t.clientY
|
|
@@ -108,7 +108,7 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
|
|
|
108
108
|
}
|
|
109
109
|
},
|
|
110
110
|
handleKeyDown: (e, t) => {
|
|
111
|
-
if (O.value || !
|
|
111
|
+
if (O.value || !je(t)) return !1;
|
|
112
112
|
let n = j.value;
|
|
113
113
|
if (!n) return !1;
|
|
114
114
|
t.preventDefault();
|
|
@@ -128,7 +128,7 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
|
|
|
128
128
|
inTable: n.isActive("table")
|
|
129
129
|
}) === "table") {
|
|
130
130
|
if (!a) {
|
|
131
|
-
let e =
|
|
131
|
+
let e = Ne();
|
|
132
132
|
typeof e == "number" && n.view.dispatch(n.state.tr.setSelection(S.create(n.state.doc, e)));
|
|
133
133
|
}
|
|
134
134
|
let e = n.view.coordsAtPos(n.state.selection.from);
|
|
@@ -182,6 +182,20 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
|
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
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() {
|
|
185
199
|
let e = j.value;
|
|
186
200
|
if (!e) return "";
|
|
187
201
|
let t = e.state.selection.$from, n = t.pos;
|
|
@@ -194,7 +208,7 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
|
|
|
194
208
|
}
|
|
195
209
|
return e.state.doc.textBetween(n, e.state.selection.from, "");
|
|
196
210
|
}
|
|
197
|
-
function
|
|
211
|
+
function je(e) {
|
|
198
212
|
return e.key === "ContextMenu" || e.shiftKey && e.key === "F10";
|
|
199
213
|
}
|
|
200
214
|
function M(e) {
|
|
@@ -203,22 +217,22 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
|
|
|
203
217
|
if (n === "cell" || n === "header_cell") return e.before(t);
|
|
204
218
|
}
|
|
205
219
|
}
|
|
206
|
-
function
|
|
220
|
+
function Me(e, t) {
|
|
207
221
|
let n = j.value, r = n?.view.posAtCoords({
|
|
208
222
|
left: e,
|
|
209
223
|
top: t
|
|
210
224
|
})?.pos;
|
|
211
225
|
if (!(!n || typeof r != "number")) return M(n.state.doc.resolve(r));
|
|
212
226
|
}
|
|
213
|
-
function
|
|
227
|
+
function Ne() {
|
|
214
228
|
let e = j.value;
|
|
215
229
|
if (e) return M(e.state.selection.$from);
|
|
216
230
|
}
|
|
217
|
-
function
|
|
231
|
+
function Pe(e, t, n) {
|
|
218
232
|
let r = j.value, i = n instanceof HTMLElement ? n : null;
|
|
219
233
|
if (!r || !i?.closest("td,th")) return !1;
|
|
220
234
|
if (r.state.selection instanceof S && i.closest("td.selectedCell,th.selectedCell")) return !0;
|
|
221
|
-
let a =
|
|
235
|
+
let a = Me(e, t);
|
|
222
236
|
return typeof a == "number" ? (r.view.dispatch(r.state.tr.setSelection(S.create(r.state.doc, a))), !0) : !1;
|
|
223
237
|
}
|
|
224
238
|
function N() {
|
|
@@ -240,7 +254,7 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
|
|
|
240
254
|
deleteTable: n((e) => e.deleteTable())
|
|
241
255
|
};
|
|
242
256
|
}
|
|
243
|
-
function
|
|
257
|
+
function Fe() {
|
|
244
258
|
let e = j.value, t = e?.state.selection;
|
|
245
259
|
if (!e || !(t instanceof S)) return "left";
|
|
246
260
|
let n = /* @__PURE__ */ new Set();
|
|
@@ -270,7 +284,14 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
|
|
|
270
284
|
...e,
|
|
271
285
|
hasSelection: n,
|
|
272
286
|
selectionWidth: n ? Oe() : void 0,
|
|
273
|
-
leadingText:
|
|
287
|
+
leadingText: Ae()
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
function Ie(e, t) {
|
|
291
|
+
I({
|
|
292
|
+
pageId: E.page.id,
|
|
293
|
+
clientX: e,
|
|
294
|
+
clientY: t
|
|
274
295
|
});
|
|
275
296
|
}
|
|
276
297
|
function L(e, t) {
|
|
@@ -294,7 +315,7 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
|
|
|
294
315
|
let e = j.value?.state.selection;
|
|
295
316
|
if (e instanceof C) return R(e.node, e.from);
|
|
296
317
|
}
|
|
297
|
-
function
|
|
318
|
+
function Le(e, t) {
|
|
298
319
|
let n = t instanceof HTMLElement ? t.closest("[data-template-variable], img[src]") : null;
|
|
299
320
|
if (n) try {
|
|
300
321
|
let t = e.posAtDOM(n, 0), r = e.state.doc.nodeAt(t);
|
|
@@ -308,7 +329,7 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
|
|
|
308
329
|
type: "table",
|
|
309
330
|
...e,
|
|
310
331
|
capabilities: N(),
|
|
311
|
-
activeAlignment:
|
|
332
|
+
activeAlignment: Fe(),
|
|
312
333
|
affectedVariableCounts: {
|
|
313
334
|
deleteRow: F("delete-table-row"),
|
|
314
335
|
deleteColumn: F("delete-table-column"),
|
|
@@ -316,14 +337,14 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
|
|
|
316
337
|
}
|
|
317
338
|
});
|
|
318
339
|
}
|
|
319
|
-
function
|
|
340
|
+
function Re(e) {
|
|
320
341
|
return typeof e == "number" && Number.isInteger(e) && e >= 1 && e <= 6;
|
|
321
342
|
}
|
|
322
343
|
function V() {
|
|
323
344
|
let e = j.value;
|
|
324
345
|
if (!e) return [];
|
|
325
346
|
let { doc: t, selection: n } = e.state, r = [], i = (e) => {
|
|
326
|
-
e.type.name === "paragraph" ? r.push("paragraph") : e.type.name === "heading" &&
|
|
347
|
+
e.type.name === "paragraph" ? r.push("paragraph") : e.type.name === "heading" && Re(e.attrs.level) && r.push(e.attrs.level);
|
|
327
348
|
};
|
|
328
349
|
if (n.empty) for (let e = n.$from.depth; e > 0; e--) {
|
|
329
350
|
let t = n.$from.node(e);
|
|
@@ -335,14 +356,14 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
|
|
|
335
356
|
else t.nodesBetween(n.from, n.to, (e) => (i(e), !0));
|
|
336
357
|
return Array.from(new Set(r));
|
|
337
358
|
}
|
|
338
|
-
function
|
|
359
|
+
function ze() {
|
|
339
360
|
let e = V();
|
|
340
361
|
return e.length === 1 && e[0] !== "paragraph" ? e[0] : void 0;
|
|
341
362
|
}
|
|
342
|
-
function
|
|
363
|
+
function Be() {
|
|
343
364
|
return V().length > 1;
|
|
344
365
|
}
|
|
345
|
-
function
|
|
366
|
+
function Ve() {
|
|
346
367
|
return ["center", "right"].find((e) => j.value?.isActive("heading", { textAlign: e }) || j.value?.isActive("paragraph", { textAlign: e })) ?? "left";
|
|
347
368
|
}
|
|
348
369
|
function H() {
|
|
@@ -357,9 +378,9 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
|
|
|
357
378
|
isBulletList: t("bulletList"),
|
|
358
379
|
isOrderedList: t("orderedList"),
|
|
359
380
|
isTableActive: t("table"),
|
|
360
|
-
currentHeadingLevel:
|
|
361
|
-
hasMixedBlockFormats:
|
|
362
|
-
textAlign:
|
|
381
|
+
currentHeadingLevel: ze(),
|
|
382
|
+
hasMixedBlockFormats: Be(),
|
|
383
|
+
textAlign: Ve(),
|
|
363
384
|
fontFamily: typeof n.fontFamily == "string" ? n.fontFamily : void 0,
|
|
364
385
|
fontSize: Ee(n.fontSize),
|
|
365
386
|
textColor: typeof n.color == "string" ? n.color : void 0,
|
|
@@ -375,19 +396,19 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
|
|
|
375
396
|
}), x(() => E.page.contentHtml, (e) => {
|
|
376
397
|
!j.value || e === j.value.getHTML() || (j.value.commands.setContent(e || "<p></p>", { emitUpdate: !1 }), U());
|
|
377
398
|
});
|
|
378
|
-
let
|
|
379
|
-
let e =
|
|
399
|
+
let He = p(() => {
|
|
400
|
+
let e = a(E.pageDecorations), o = E.pageIndex + 1, s = i(e, o) ? n(e.header) : t.top, c = r(e, o) ? n(e.footer) : t.bottom;
|
|
380
401
|
return {
|
|
381
402
|
width: `${E.pageSize.width}px`,
|
|
382
403
|
height: `${E.pageSize.height}px`,
|
|
383
|
-
paddingTop: `${
|
|
384
|
-
paddingBottom: `${
|
|
385
|
-
"--gd-contract-page-content-height": `${Math.max(120, E.pageSize.height -
|
|
404
|
+
paddingTop: `${s}px`,
|
|
405
|
+
paddingBottom: `${c}px`,
|
|
406
|
+
"--gd-contract-page-content-height": `${Math.max(120, E.pageSize.height - s - c)}px`
|
|
386
407
|
};
|
|
387
|
-
}), W = p(() => Math.max(.1, E.zoom || 1)),
|
|
408
|
+
}), W = p(() => Math.max(.1, E.zoom || 1)), Ue = p(() => ({
|
|
388
409
|
width: `${Math.ceil((E.pageSize.width + 10) * W.value)}px`,
|
|
389
410
|
height: `${Math.ceil((E.pageSize.height + 40) * W.value)}px`
|
|
390
|
-
})),
|
|
411
|
+
})), We = p(() => ({ "--gd-contract-page-zoom": String(W.value) })), Ge = p(() => re(E.pageSize));
|
|
391
412
|
function G(e, t) {
|
|
392
413
|
let n = k.value?.getBoundingClientRect();
|
|
393
414
|
return n ? {
|
|
@@ -398,43 +419,43 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
|
|
|
398
419
|
y: E.pageSize.height / 2
|
|
399
420
|
};
|
|
400
421
|
}
|
|
401
|
-
function
|
|
402
|
-
let t = k.value?.getBoundingClientRect(),
|
|
403
|
-
if (!t || !
|
|
404
|
-
x: Math.max(0, (E.pageSize.width -
|
|
405
|
-
y: Math.max(0, (E.pageSize.height -
|
|
422
|
+
function Ke(e) {
|
|
423
|
+
let t = k.value?.getBoundingClientRect(), n = k.value?.closest(".gd-contract-template-designer__canvas")?.getBoundingClientRect(), r = ee(e);
|
|
424
|
+
if (!t || !n) return {
|
|
425
|
+
x: Math.max(0, (E.pageSize.width - r.width) / 2),
|
|
426
|
+
y: Math.max(0, (E.pageSize.height - r.height) / 2)
|
|
406
427
|
};
|
|
407
|
-
let
|
|
428
|
+
let i = Math.max(t.left, n.left), a = Math.max(t.top, n.top), o = Math.min(t.right, n.right), s = Math.min(t.bottom, n.bottom), c = G(o > i ? (i + o) / 2 : (t.left + t.right) / 2, s > a ? (a + s) / 2 : (t.top + t.bottom) / 2);
|
|
408
429
|
return {
|
|
409
|
-
x:
|
|
410
|
-
y:
|
|
430
|
+
x: c.x - r.width / 2,
|
|
431
|
+
y: c.y - r.height / 2
|
|
411
432
|
};
|
|
412
433
|
}
|
|
413
|
-
function
|
|
414
|
-
if (!
|
|
415
|
-
|
|
434
|
+
function qe(e) {
|
|
435
|
+
if (!c(E.readonly, E.disabled)) {
|
|
436
|
+
e.preventDefault(), e.stopPropagation();
|
|
416
437
|
return;
|
|
417
438
|
}
|
|
418
|
-
let
|
|
419
|
-
if (
|
|
420
|
-
|
|
421
|
-
let
|
|
422
|
-
D("signing-placement-drop", E.page.id,
|
|
439
|
+
let t = te(e.dataTransfer?.getData(s));
|
|
440
|
+
if (t) {
|
|
441
|
+
e.preventDefault(), e.stopPropagation();
|
|
442
|
+
let n = G(e.clientX, e.clientY);
|
|
443
|
+
D("signing-placement-drop", E.page.id, t, n.x, n.y);
|
|
423
444
|
return;
|
|
424
445
|
}
|
|
425
|
-
let
|
|
426
|
-
if (
|
|
427
|
-
|
|
446
|
+
let n = e.dataTransfer?.getData("application/x-gd-contract-variable");
|
|
447
|
+
if (n) {
|
|
448
|
+
e.preventDefault(), e.stopPropagation(), D("variable-drop", E.page.id, n, e.clientX, e.clientY);
|
|
428
449
|
return;
|
|
429
450
|
}
|
|
430
|
-
let
|
|
431
|
-
|
|
451
|
+
let r = e.dataTransfer?.getData(w);
|
|
452
|
+
r && r !== E.page.id && (e.preventDefault(), e.stopPropagation(), D("variable-move-blocked", E.page.id));
|
|
432
453
|
}
|
|
433
|
-
function
|
|
454
|
+
function Je(e, t) {
|
|
434
455
|
let n = j.value;
|
|
435
|
-
return n ? (
|
|
456
|
+
return n ? (ae(n, e, t ? n.view.posAtCoords(t)?.pos : void 0), $(), K()) : void 0;
|
|
436
457
|
}
|
|
437
|
-
function
|
|
458
|
+
function Ye(e, t) {
|
|
438
459
|
let n = j.value;
|
|
439
460
|
if (n) return d(n, {
|
|
440
461
|
type: "insert-content-image",
|
|
@@ -442,7 +463,7 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
|
|
|
442
463
|
position: t
|
|
443
464
|
}), K();
|
|
444
465
|
}
|
|
445
|
-
function
|
|
466
|
+
function Xe(e) {
|
|
446
467
|
let t = j.value, n = t?.state.selection;
|
|
447
468
|
if (!t || !(n instanceof C) || n.node.type.name !== "image") return;
|
|
448
469
|
let r = { ...n.node.attrs }, i = !1;
|
|
@@ -454,7 +475,7 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
|
|
|
454
475
|
let a = t.state.tr.setNodeMarkup(n.from, void 0, r);
|
|
455
476
|
return a.setSelection(C.create(a.doc, n.from)), t.view.dispatch(a), K();
|
|
456
477
|
}
|
|
457
|
-
function
|
|
478
|
+
function Ze() {
|
|
458
479
|
let e = j.value?.state.selection;
|
|
459
480
|
return e ? {
|
|
460
481
|
from: e.from,
|
|
@@ -464,7 +485,7 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
|
|
|
464
485
|
function K() {
|
|
465
486
|
return {
|
|
466
487
|
...E.page,
|
|
467
|
-
pageSize:
|
|
488
|
+
pageSize: Ge.value,
|
|
468
489
|
contentHtml: j.value?.getHTML() ?? E.page.contentHtml,
|
|
469
490
|
contentJson: j.value?.getJSON() ?? E.page.contentJson
|
|
470
491
|
};
|
|
@@ -475,23 +496,23 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
|
|
|
475
496
|
content: e.length ? e : [{ type: "paragraph" }]
|
|
476
497
|
};
|
|
477
498
|
}
|
|
478
|
-
function
|
|
499
|
+
function Qe(e) {
|
|
479
500
|
return e?.length ? e.length === 1 && e[0].type === "paragraph" && !e[0].content?.length : !0;
|
|
480
501
|
}
|
|
481
|
-
function
|
|
502
|
+
function $e(e) {
|
|
482
503
|
return ye(q(e), A);
|
|
483
504
|
}
|
|
484
|
-
function
|
|
505
|
+
function et() {
|
|
485
506
|
if (E.pageDecorations) {
|
|
486
|
-
let e =
|
|
487
|
-
return Math.max(120, E.pageSize.height -
|
|
507
|
+
let e = a(E.pageDecorations), o = E.pageIndex + 1, s = i(e, o) ? n(e.header) : t.top, c = r(e, o) ? n(e.footer) : t.bottom;
|
|
508
|
+
return Math.max(120, E.pageSize.height - s - c);
|
|
488
509
|
}
|
|
489
510
|
let e = k.value;
|
|
490
511
|
if (!e) return E.pageSize.height - 108;
|
|
491
|
-
let
|
|
492
|
-
return Math.max(120, E.pageSize.height -
|
|
512
|
+
let o = window.getComputedStyle(e), s = Number.parseFloat(o.paddingTop) || 0, c = Number.parseFloat(o.paddingBottom) || 0;
|
|
513
|
+
return Math.max(120, E.pageSize.height - s - c);
|
|
493
514
|
}
|
|
494
|
-
function
|
|
515
|
+
function tt() {
|
|
495
516
|
let e = k.value?.querySelector(".gd-contract-template-designer__editor-prose");
|
|
496
517
|
if (!e) return [];
|
|
497
518
|
let t = e.getBoundingClientRect(), n = W.value;
|
|
@@ -504,23 +525,23 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
|
|
|
504
525
|
});
|
|
505
526
|
}
|
|
506
527
|
function J() {
|
|
507
|
-
return j.value ?
|
|
528
|
+
return j.value ? ie(j.value.getJSON().content, tt(), et()) : void 0;
|
|
508
529
|
}
|
|
509
|
-
function
|
|
530
|
+
function nt() {
|
|
510
531
|
return !!J();
|
|
511
532
|
}
|
|
512
|
-
function
|
|
533
|
+
function rt() {
|
|
513
534
|
if (!j.value) return;
|
|
514
535
|
let e = J();
|
|
515
536
|
if (e) return j.value.commands.setContent(q(e.currentContent), { emitUpdate: !1 }), {
|
|
516
537
|
page: K(),
|
|
517
538
|
overflowContent: e.overflowContent,
|
|
518
|
-
overflowHtml:
|
|
539
|
+
overflowHtml: $e(e.overflowContent)
|
|
519
540
|
};
|
|
520
541
|
}
|
|
521
|
-
function
|
|
542
|
+
function it(e) {
|
|
522
543
|
if (!j.value || !e.length) return;
|
|
523
|
-
let t = j.value.getJSON().content, n = [...e, ...
|
|
544
|
+
let t = j.value.getJSON().content, n = [...e, ...Qe(t) ? [] : t ?? []];
|
|
524
545
|
return j.value.commands.setContent(q(n), { emitUpdate: !1 }), K();
|
|
525
546
|
}
|
|
526
547
|
function Y(e, t) {
|
|
@@ -532,9 +553,9 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
|
|
|
532
553
|
});
|
|
533
554
|
}), n;
|
|
534
555
|
}
|
|
535
|
-
function
|
|
556
|
+
function X(e, t = e.key) {
|
|
536
557
|
if (!j.value) return;
|
|
537
|
-
let n =
|
|
558
|
+
let n = l(e), r = !1;
|
|
538
559
|
return j.value.commands.command(({ tr: e, state: i, dispatch: a }) => (Y(i.doc, t).forEach(({ node: t, pos: i }) => {
|
|
539
560
|
e.setNodeMarkup(i, void 0, {
|
|
540
561
|
...t.attrs,
|
|
@@ -542,7 +563,7 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
|
|
|
542
563
|
}), r = !0;
|
|
543
564
|
}), r && a?.(e), r)), $(), r ? K() : void 0;
|
|
544
565
|
}
|
|
545
|
-
function
|
|
566
|
+
function at(e) {
|
|
546
567
|
if (!j.value) return;
|
|
547
568
|
let t = 0;
|
|
548
569
|
return j.value.commands.command(({ tr: n, state: r, dispatch: i }) => {
|
|
@@ -553,22 +574,22 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
|
|
|
553
574
|
return a.forEach((e) => n.delete(e.from, e.to)), t = a.length, t && i?.(n), t > 0;
|
|
554
575
|
}), t ? K() : void 0;
|
|
555
576
|
}
|
|
556
|
-
function
|
|
577
|
+
function Z() {
|
|
557
578
|
k.value?.querySelectorAll(".gd-contract-template-variable.is-active").forEach((e) => e.classList.remove("is-active"));
|
|
558
579
|
}
|
|
559
|
-
function
|
|
580
|
+
function Q(e) {
|
|
560
581
|
if (e) return Array.from(k.value?.querySelectorAll("[data-template-variable]") ?? []).find((t) => t.dataset.key === e);
|
|
561
582
|
}
|
|
562
|
-
function
|
|
563
|
-
|
|
564
|
-
let t =
|
|
583
|
+
function ot(e) {
|
|
584
|
+
Z();
|
|
585
|
+
let t = Q(e);
|
|
565
586
|
return t ? (t.classList.add("is-active"), t.scrollIntoView({
|
|
566
587
|
behavior: "smooth",
|
|
567
588
|
block: "center",
|
|
568
589
|
inline: "center"
|
|
569
590
|
}), j.value?.commands.focus(), !0) : !1;
|
|
570
591
|
}
|
|
571
|
-
function
|
|
592
|
+
function st(e) {
|
|
572
593
|
let t = Array.from(k.value?.querySelectorAll("[data-signing-placement-id]") ?? []).find((t) => t.dataset.signingPlacementId === e);
|
|
573
594
|
return t?.scrollIntoView({
|
|
574
595
|
behavior: "smooth",
|
|
@@ -577,13 +598,13 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
|
|
|
577
598
|
}), !!t;
|
|
578
599
|
}
|
|
579
600
|
function $() {
|
|
580
|
-
|
|
601
|
+
Z(), Q(E.selectedVariableKey)?.classList.add("is-active");
|
|
581
602
|
}
|
|
582
|
-
function
|
|
583
|
-
let
|
|
584
|
-
if (!
|
|
585
|
-
let
|
|
586
|
-
|
|
603
|
+
function ct(t) {
|
|
604
|
+
let n = e.find((e) => e.key === t), r = j.value;
|
|
605
|
+
if (!n || !r) return;
|
|
606
|
+
let i = r.chain().focus().clearNodes();
|
|
607
|
+
n.headingLevel ? i.setHeading({ level: n.headingLevel }) : i.setParagraph(), i.unsetAllMarks().unsetTextAlign().unsetFontSize().unsetFontFamily().unsetColor().setTextAlign(n.textAlign).setFontSize(`${n.fontSize}px`).setFontFamily(n.fontFamily || "Noto Serif SC, Source Han Serif SC, Songti SC, STSong, SimSun, serif").setColor(ne.color || "#1f2937"), n.bold ? i.setBold() : i.unsetBold(), n.italic ? i.setItalic() : i.unsetItalic(), n.underline ? i.setUnderline() : i.unsetUnderline(), i.run();
|
|
587
608
|
}
|
|
588
609
|
x([() => E.selectedVariableKey, () => E.variables], () => {
|
|
589
610
|
fe($);
|
|
@@ -591,26 +612,26 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
|
|
|
591
612
|
deep: !0,
|
|
592
613
|
flush: "post"
|
|
593
614
|
});
|
|
594
|
-
function
|
|
595
|
-
e.type === "apply-block-style" ? j.value &&
|
|
615
|
+
function lt(e) {
|
|
616
|
+
e.type === "apply-block-style" ? j.value && se(j.value, e.format) : e.type === "apply-text-style-preset" ? ct(e.preset) : d(j.value, e), U();
|
|
596
617
|
}
|
|
597
|
-
function
|
|
618
|
+
function ut() {
|
|
598
619
|
j.value?.commands.focus();
|
|
599
620
|
}
|
|
600
|
-
function
|
|
621
|
+
function dt() {
|
|
601
622
|
return j.value?.getJSON();
|
|
602
623
|
}
|
|
603
|
-
function
|
|
624
|
+
function ft() {
|
|
604
625
|
return j.value?.getHTML() ?? E.page.contentHtml;
|
|
605
626
|
}
|
|
606
|
-
function
|
|
607
|
-
let t = E.variables.find((t) => t.id === e || t.key === e), n = 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;
|
|
608
629
|
$(), n?.scrollIntoView({
|
|
609
630
|
behavior: "smooth",
|
|
610
631
|
block: "center"
|
|
611
632
|
});
|
|
612
633
|
}
|
|
613
|
-
function
|
|
634
|
+
function mt() {
|
|
614
635
|
k.value?.scrollIntoView({
|
|
615
636
|
behavior: "smooth",
|
|
616
637
|
block: "start",
|
|
@@ -620,43 +641,45 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
|
|
|
620
641
|
return me(() => {
|
|
621
642
|
j.value?.destroy();
|
|
622
643
|
}), T({
|
|
623
|
-
focus:
|
|
624
|
-
getHTML:
|
|
625
|
-
getJSON:
|
|
644
|
+
focus: ut,
|
|
645
|
+
getHTML: ft,
|
|
646
|
+
getJSON: dt,
|
|
626
647
|
getEditorState: H,
|
|
627
648
|
getTableCommandCapabilities: N,
|
|
628
649
|
getAffectedVariableCount: F,
|
|
629
|
-
getVisibleSigningPlacementPosition:
|
|
630
|
-
insertVariable:
|
|
631
|
-
insertContentImage:
|
|
632
|
-
updateSelectedContentImage:
|
|
633
|
-
getSelectionRange:
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
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
|
|
644
667
|
}), (e, t) => (v(), de("section", {
|
|
645
668
|
class: "gd-contract-template-designer__page-shell",
|
|
646
|
-
style: _(
|
|
669
|
+
style: _(Ue.value)
|
|
647
670
|
}, [m("div", {
|
|
648
671
|
class: pe(["gd-contract-template-designer__page-zoom", { "is-active": g.active }]),
|
|
649
|
-
style: _(
|
|
672
|
+
style: _(We.value)
|
|
650
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", {
|
|
651
674
|
ref_key: "pageElement",
|
|
652
675
|
ref: k,
|
|
653
676
|
class: "gd-contract-template-designer__page",
|
|
654
|
-
style: _(
|
|
677
|
+
style: _(He.value),
|
|
655
678
|
onDragover: t[3] ||= ge(() => {}, ["prevent"]),
|
|
656
|
-
onDrop:
|
|
679
|
+
onDrop: qe,
|
|
657
680
|
onClick: t[4] ||= (e) => D("editor-focus", g.page.id)
|
|
658
681
|
}, [
|
|
659
|
-
h(
|
|
682
|
+
h(o, {
|
|
660
683
|
decorations: g.pageDecorations,
|
|
661
684
|
"page-number": g.pageIndex + 1,
|
|
662
685
|
"total-pages": g.totalPages,
|
|
@@ -672,7 +695,7 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
|
|
|
672
695
|
class: "gd-contract-template-page__content",
|
|
673
696
|
editor: b(j)
|
|
674
697
|
}, null, 8, ["editor"])) : ue("", !0),
|
|
675
|
-
h(
|
|
698
|
+
h(ce, {
|
|
676
699
|
"page-size": g.pageSize,
|
|
677
700
|
placements: g.signingPlacements,
|
|
678
701
|
"selected-id": g.selectedSigningPlacementId,
|