@guodun/antdv 1.4.0 → 1.4.2
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 +8 -1
- package/dist/es/components/contract-signing-location/src/ContractSigningLocationInspector.vue.mjs +3 -2
- package/dist/es/components/pro-contract-signing-flow/src/ContractSigningFlowInspector.vue.mjs +4 -1
- package/dist/es/components/pro-contract-signing-flow/src/ProContractSigningFlow.vue.mjs +67 -66
- 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 +215 -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/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 +313 -267
- package/dist/es/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.mjs +1278 -2293
- 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/ContractSigningLocation.vue.cjs +1 -1
- package/dist/lib/components/contract-signing-location/src/ContractSigningLocationInspector.vue.cjs +1 -1
- package/dist/lib/components/pro-contract-signing-flow/src/ContractSigningFlowInspector.vue.cjs +1 -1
- package/dist/lib/components/pro-contract-signing-flow/src/ProContractSigningFlow.vue.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/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/ContractSigningLocation.vue.d.ts +1 -0
- package/dist/types/components/contract-signing-location/src/ContractSigningLocationInspector.vue.d.ts +1 -0
- package/dist/types/components/contract-signing-location/src/types.d.ts +2 -0
- package/dist/types/components/pro-contract-signing-flow/src/types.d.ts +2 -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 +50 -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/ContractTemplateTextContextMenu.vue.d.ts +77 -0
- package/dist/types/components/pro-contract-template-designer/src/DesignerPage.vue.d.ts +8 -32
- package/dist/types/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.d.ts +366 -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 +22 -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
package/dist/es/components/pro-contract-template-designer/src/composables/use-template-files.mjs
CHANGED
|
@@ -1,63 +1,76 @@
|
|
|
1
|
-
import { cloneTemplateValue as e,
|
|
1
|
+
import { cloneTemplateValue as e, constrainTemplatePageSizes as t, createBlankTemplate as n, createDesignerId as r, exportTemplateValue as i, normalizeTemplateValue as a } from "./use-template-designer.mjs";
|
|
2
2
|
//#region src/components/pro-contract-template-designer/src/composables/use-template-files.ts
|
|
3
|
-
function
|
|
3
|
+
function o(t) {
|
|
4
4
|
return t.map((t) => ({
|
|
5
5
|
id: t.id,
|
|
6
6
|
name: t.name,
|
|
7
7
|
template: e(t.template)
|
|
8
8
|
}));
|
|
9
9
|
}
|
|
10
|
-
function
|
|
10
|
+
function s(e = "合同文件 1", t) {
|
|
11
11
|
return {
|
|
12
|
-
id:
|
|
12
|
+
id: r("contract-file"),
|
|
13
13
|
name: e.trim() || "合同文件",
|
|
14
|
-
template: t
|
|
14
|
+
template: n(t)
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function c(e, t, i) {
|
|
18
18
|
let o = Array.isArray(e) && e.length ? e : [{
|
|
19
|
-
id:
|
|
19
|
+
id: r("contract-file"),
|
|
20
20
|
name: "合同文件 1",
|
|
21
|
-
template:
|
|
21
|
+
template: t ?? n(i)
|
|
22
22
|
}], s = /* @__PURE__ */ new Set();
|
|
23
23
|
return o.map((e, t) => {
|
|
24
|
-
let
|
|
25
|
-
return (!
|
|
26
|
-
id:
|
|
24
|
+
let n = typeof e?.id == "string" ? e.id.trim() : "";
|
|
25
|
+
return (!n || s.has(n)) && (n = r("contract-file")), s.add(n), {
|
|
26
|
+
id: n,
|
|
27
27
|
name: String(e?.name || "").trim() || `合同文件 ${t + 1}`,
|
|
28
|
-
template:
|
|
28
|
+
template: a(e?.template, i)
|
|
29
29
|
};
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function l(e, n) {
|
|
33
|
+
let r = /* @__PURE__ */ new Map();
|
|
34
|
+
return {
|
|
35
|
+
files: e.map((e) => {
|
|
36
|
+
let i = t(e.template, n);
|
|
37
|
+
return i.resizedSigningPlacementIds.length && r.set(e.id, i.resizedSigningPlacementIds), {
|
|
38
|
+
...e,
|
|
39
|
+
template: i.value
|
|
40
|
+
};
|
|
41
|
+
}),
|
|
42
|
+
resizedSigningPlacementIds: r
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function u(e, t) {
|
|
33
46
|
let n = typeof t == "string" ? t.trim() : "";
|
|
34
47
|
return e.some((e) => e.id === n) ? n : e[0]?.id ?? "";
|
|
35
48
|
}
|
|
36
|
-
function
|
|
49
|
+
function d(t, n, r) {
|
|
37
50
|
return t.map((t) => t.id === n ? {
|
|
38
51
|
...t,
|
|
39
52
|
template: e(r)
|
|
40
53
|
} : t);
|
|
41
54
|
}
|
|
42
|
-
function
|
|
55
|
+
function f(e, t, n) {
|
|
43
56
|
let r = n.trim();
|
|
44
57
|
return e.map((e) => e.id === t ? {
|
|
45
58
|
...e,
|
|
46
59
|
name: r || e.name
|
|
47
60
|
} : e);
|
|
48
61
|
}
|
|
49
|
-
function
|
|
62
|
+
function p(e, t) {
|
|
50
63
|
return e.length <= 1 || !e.some((e) => e.id === t) ? [...e] : e.filter((e) => e.id !== t);
|
|
51
64
|
}
|
|
52
|
-
function
|
|
65
|
+
function m(e, t, n) {
|
|
53
66
|
let r = e.findIndex((e) => e.id === t), i = r + n;
|
|
54
67
|
if (r < 0 || i < 0 || i >= e.length) return [...e];
|
|
55
68
|
let a = [...e], [o] = a.splice(r, 1);
|
|
56
69
|
return o && a.splice(i, 0, o), a;
|
|
57
70
|
}
|
|
58
|
-
function
|
|
71
|
+
function h(e) {
|
|
59
72
|
let t = e.map((e) => {
|
|
60
|
-
let t =
|
|
73
|
+
let t = i(e.template);
|
|
61
74
|
return {
|
|
62
75
|
id: e.id,
|
|
63
76
|
name: e.name,
|
|
@@ -67,11 +80,11 @@ function p(e) {
|
|
|
67
80
|
});
|
|
68
81
|
return {
|
|
69
82
|
files: t,
|
|
70
|
-
combinedHtml: t.map((e) => `<section data-contract-file-id="${
|
|
83
|
+
combinedHtml: t.map((e) => `<section data-contract-file-id="${g(e.id)}" data-contract-file-name="${g(e.name)}">${e.template.html}</section>`).join("\n")
|
|
71
84
|
};
|
|
72
85
|
}
|
|
73
|
-
function
|
|
86
|
+
function g(e) {
|
|
74
87
|
return e.replaceAll("&", "&").replaceAll("\"", """).replaceAll("<", "<").replaceAll(">", ">");
|
|
75
88
|
}
|
|
76
89
|
//#endregion
|
|
77
|
-
export {
|
|
90
|
+
export { o as cloneContractTemplateFiles, l as constrainContractTemplateFiles, s as createContractTemplateFile, h as exportContractTemplateFiles, m as moveContractTemplateFile, c as normalizeContractTemplateFiles, p as removeContractTemplateFile, f as renameContractTemplateFile, d as replaceContractTemplateFile, u as resolveContractTemplateActiveFileId };
|
package/dist/es/components/pro-contract-template-designer/src/composables/use-toolbar-overflow.mjs
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { CONTRACT_TEMPLATE_TOOLBAR_OVERFLOW_PRIORITY as e, resolveContractTemplateToolbarOverflowKeys as t } from "../utils/toolbar-overflow.mjs";
|
|
2
|
+
import { computed as n, nextTick as r, onBeforeUnmount as i, onMounted as a, ref as o, watch as s } from "vue";
|
|
3
|
+
//#region src/components/pro-contract-template-designer/src/composables/use-toolbar-overflow.ts
|
|
4
|
+
var c = 43, l = 6, u = 4;
|
|
5
|
+
function d(d) {
|
|
6
|
+
let f = o([]), p = /* @__PURE__ */ new Map(), m = 0, h = n(() => f.value.length > 0);
|
|
7
|
+
function g(e) {
|
|
8
|
+
return f.value.includes(e);
|
|
9
|
+
}
|
|
10
|
+
function _(e, t) {
|
|
11
|
+
let n = f.value;
|
|
12
|
+
n.length === e.length && e.every((e) => n.includes(e)) || (f.value = e, e.length || (d.toolbarMoreOpen.value = !1), !(t >= u) && r(() => v(t + 1)));
|
|
13
|
+
}
|
|
14
|
+
function v(n = 0) {
|
|
15
|
+
let r = d.toolbarMainElement.value;
|
|
16
|
+
if (!r) return;
|
|
17
|
+
if (typeof window < "u" && window.matchMedia("(max-width: 760px)").matches) {
|
|
18
|
+
_([], n);
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
let i = r.clientWidth;
|
|
22
|
+
if (i <= 0) return;
|
|
23
|
+
let a = d.toolbarMoreElement.value, o = 0;
|
|
24
|
+
for (let e of Array.from(r.children)) {
|
|
25
|
+
if (!(e instanceof HTMLElement)) continue;
|
|
26
|
+
if (e === a) {
|
|
27
|
+
e.offsetWidth > 0 && (m = e.offsetWidth);
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
let t = e.dataset.toolbarOverflowKey;
|
|
31
|
+
if (t) {
|
|
32
|
+
e.offsetWidth > 0 && p.set(t, e.offsetWidth);
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
o += e.offsetWidth;
|
|
36
|
+
}
|
|
37
|
+
let s = Object.fromEntries(e.map((e) => [e, p.get(e) ?? 0]));
|
|
38
|
+
_(t({
|
|
39
|
+
availableWidth: i,
|
|
40
|
+
fixedWidth: o,
|
|
41
|
+
groupWidths: s,
|
|
42
|
+
moreWidth: m || c,
|
|
43
|
+
buffer: l
|
|
44
|
+
}), n);
|
|
45
|
+
}
|
|
46
|
+
s(() => d.measureDependencies(), () => {
|
|
47
|
+
r(() => v());
|
|
48
|
+
}, { immediate: !0 }), a(() => {
|
|
49
|
+
r(() => v()), typeof document < "u" && document.fonts?.ready && document.fonts.ready.then(() => {
|
|
50
|
+
d.isDisposed() || !d.toolbarMainElement.value || r(() => {
|
|
51
|
+
d.isDisposed() || v();
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
}), i(() => {
|
|
55
|
+
typeof document > "u" || document.removeEventListener("mousedown", y, !0);
|
|
56
|
+
});
|
|
57
|
+
function y(e) {
|
|
58
|
+
let t = e.target instanceof HTMLElement ? e.target : null;
|
|
59
|
+
t && (t.closest(".gd-contract-template-designer__toolbar-more, .ant-popover, .ant-select-dropdown") || (d.toolbarMoreOpen.value = !1));
|
|
60
|
+
}
|
|
61
|
+
return s(d.toolbarMoreOpen, (e) => {
|
|
62
|
+
typeof document > "u" || (e ? document.addEventListener("mousedown", y, !0) : document.removeEventListener("mousedown", y, !0));
|
|
63
|
+
}), {
|
|
64
|
+
toolbarOverflowKeys: f,
|
|
65
|
+
toolbarHasOverflow: h,
|
|
66
|
+
isToolbarGroupOverflowed: g,
|
|
67
|
+
measureToolbarOverflow: v
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
//#endregion
|
|
71
|
+
export { d as useToolbarOverflow };
|
|
@@ -51,6 +51,67 @@ var e = "Noto Serif SC, Source Han Serif SC, Songti SC, STSong, SimSun, serif",
|
|
|
51
51
|
value: "right"
|
|
52
52
|
}
|
|
53
53
|
], i = [
|
|
54
|
+
{
|
|
55
|
+
format: "paragraph",
|
|
56
|
+
label: "正文",
|
|
57
|
+
fontSize: 14,
|
|
58
|
+
bold: !1,
|
|
59
|
+
marginTop: 0,
|
|
60
|
+
marginBottom: 10
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
format: 1,
|
|
64
|
+
label: "标题 1",
|
|
65
|
+
fontSize: 28,
|
|
66
|
+
bold: !0,
|
|
67
|
+
marginTop: 20,
|
|
68
|
+
marginBottom: 12
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
format: 2,
|
|
72
|
+
label: "标题 2",
|
|
73
|
+
fontSize: 24,
|
|
74
|
+
bold: !0,
|
|
75
|
+
marginTop: 16,
|
|
76
|
+
marginBottom: 10
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
format: 3,
|
|
80
|
+
label: "标题 3",
|
|
81
|
+
fontSize: 20,
|
|
82
|
+
bold: !0,
|
|
83
|
+
marginTop: 14,
|
|
84
|
+
marginBottom: 8
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
format: 4,
|
|
88
|
+
label: "标题 4",
|
|
89
|
+
fontSize: 18,
|
|
90
|
+
bold: !0,
|
|
91
|
+
marginTop: 12,
|
|
92
|
+
marginBottom: 8
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
format: 5,
|
|
96
|
+
label: "标题 5",
|
|
97
|
+
fontSize: 16,
|
|
98
|
+
bold: !0,
|
|
99
|
+
marginTop: 10,
|
|
100
|
+
marginBottom: 6
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
format: 6,
|
|
104
|
+
label: "标题 6",
|
|
105
|
+
fontSize: 14,
|
|
106
|
+
bold: !0,
|
|
107
|
+
marginTop: 8,
|
|
108
|
+
marginBottom: 6
|
|
109
|
+
}
|
|
110
|
+
];
|
|
111
|
+
function a(e) {
|
|
112
|
+
return i.find((t) => t.format === e);
|
|
113
|
+
}
|
|
114
|
+
var o = [
|
|
54
115
|
{
|
|
55
116
|
key: "contractTitle",
|
|
56
117
|
label: "合同标题",
|
|
@@ -96,7 +157,7 @@ var e = "Noto Serif SC, Source Han Serif SC, Songti SC, STSong, SimSun, serif",
|
|
|
96
157
|
underline: !1
|
|
97
158
|
}
|
|
98
159
|
];
|
|
99
|
-
function
|
|
160
|
+
function s(e) {
|
|
100
161
|
return [
|
|
101
162
|
e.paragraph ? { type: "set-paragraph" } : {
|
|
102
163
|
type: "set-heading",
|
|
@@ -119,21 +180,21 @@ function a(e) {
|
|
|
119
180
|
e.underline ? { type: "set-underline" } : { type: "unset-underline" }
|
|
120
181
|
];
|
|
121
182
|
}
|
|
122
|
-
var
|
|
123
|
-
function
|
|
124
|
-
return
|
|
183
|
+
var c = Object.fromEntries(o.map((e) => [e.key, s(e)]));
|
|
184
|
+
function l(e) {
|
|
185
|
+
return o.find((t) => t.key === e);
|
|
125
186
|
}
|
|
126
|
-
function
|
|
127
|
-
return (
|
|
187
|
+
function u(e) {
|
|
188
|
+
return (c[e] ?? []).map((e) => ({ ...e }));
|
|
128
189
|
}
|
|
129
|
-
function
|
|
190
|
+
function d(e) {
|
|
130
191
|
return String(e || "").replace(/["']/g, "").replace(/\s*,\s*/g, ",").trim().toLowerCase();
|
|
131
192
|
}
|
|
132
|
-
function
|
|
193
|
+
function f(e, n = "append") {
|
|
133
194
|
let r = n === "replace" ? e ?? t : [...t, ...e ?? []], i = /* @__PURE__ */ new Map();
|
|
134
195
|
return r.forEach((e) => {
|
|
135
|
-
e?.value && i.set(
|
|
196
|
+
e?.value && i.set(d(e.value), e);
|
|
136
197
|
}), Array.from(i.values());
|
|
137
198
|
}
|
|
138
199
|
//#endregion
|
|
139
|
-
export { i as
|
|
200
|
+
export { i as CONTRACT_BLOCK_STYLES, o as CONTRACT_TEXT_STYLE_PRESETS, c as CONTRACT_TEXT_STYLE_PRESET_COMMANDS, e as DEFAULT_CONTRACT_FONT_FAMILY, t as DEFAULT_FONT_FAMILY_OPTIONS, n as DEFAULT_FONT_SIZE_PRESETS, r as DEFAULT_TEXT_ALIGN_OPTIONS, a as getContractBlockStyle, l as getContractTextStylePreset, d as normalizeFontFamilyValue, u as resolveContractTextStylePresetCommands, f as resolveFontFamilyOptions };
|
package/dist/es/components/pro-contract-template-designer/src/extensions/editor-extensions.mjs
CHANGED
|
@@ -65,6 +65,7 @@ function T(t, n) {
|
|
|
65
65
|
case "select-all": return t.selectAll();
|
|
66
66
|
case "set-paragraph": return t.setParagraph();
|
|
67
67
|
case "set-heading": return t.setHeading({ level: n.level });
|
|
68
|
+
case "apply-block-style": return n.format === "paragraph" ? t.setParagraph() : t.setHeading({ level: n.format });
|
|
68
69
|
case "toggle-heading": return t.toggleHeading({ level: n.level });
|
|
69
70
|
case "set-bold": return t.setBold();
|
|
70
71
|
case "toggle-bold": return t.toggleBold();
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { getContractBlockStyle as e } from "../constants.mjs";
|
|
2
|
+
//#region src/components/pro-contract-template-designer/src/utils/block-style.ts
|
|
3
|
+
function t(e) {
|
|
4
|
+
let { doc: t, selection: n } = e.state;
|
|
5
|
+
if (n.empty) {
|
|
6
|
+
for (let e = n.$from.depth; e > 0; e--) {
|
|
7
|
+
let t = n.$from.node(e);
|
|
8
|
+
if (t.type.name === "paragraph" || t.type.name === "heading") {
|
|
9
|
+
let r = n.$from.start(e);
|
|
10
|
+
return {
|
|
11
|
+
from: r,
|
|
12
|
+
to: Math.max(r, r + t.content.size)
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return {
|
|
17
|
+
from: n.from,
|
|
18
|
+
to: n.to
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
let r = Infinity, i = -Infinity;
|
|
22
|
+
return t.nodesBetween(n.from, n.to, (e, t) => e.type.name !== "paragraph" && e.type.name !== "heading" ? !0 : (r = Math.min(r, t), i = Math.max(i, t + e.nodeSize), !0)), !Number.isFinite(r) || !Number.isFinite(i) ? {
|
|
23
|
+
from: n.from,
|
|
24
|
+
to: n.to
|
|
25
|
+
} : {
|
|
26
|
+
from: r + 1,
|
|
27
|
+
to: Math.max(r + 1, i - 1)
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function n(n, r) {
|
|
31
|
+
let i = e(r);
|
|
32
|
+
if (!i) return !1;
|
|
33
|
+
let a = t(n), o = n.chain().focus().setTextSelection(a);
|
|
34
|
+
return r === "paragraph" ? o.setParagraph() : o.setHeading({ level: r }), o.setFontSize(`${i.fontSize}px`), i.bold ? o.setBold() : o.unsetBold(), o.updateAttributes("paragraph", {
|
|
35
|
+
marginTop: `${i.marginTop}px`,
|
|
36
|
+
marginBottom: `${i.marginBottom}px`
|
|
37
|
+
}), o.updateAttributes("heading", {
|
|
38
|
+
marginTop: `${i.marginTop}px`,
|
|
39
|
+
marginBottom: `${i.marginBottom}px`
|
|
40
|
+
}), o.run(), !0;
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
43
|
+
export { n as applyContractTemplateBlockStyle };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
function e(e, t, n, r, i = 12) {
|
|
2
|
+
let a = typeof window > "u" ? n + i * 2 : window.innerWidth, o = typeof window > "u" ? r + i * 2 : window.innerHeight;
|
|
3
|
+
return {
|
|
4
|
+
x: Math.max(i, Math.min(e, a - n - i)),
|
|
5
|
+
y: Math.max(i, Math.min(t, o - r - i))
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
function t(t, n, r, i = 12) {
|
|
9
|
+
let a = r.getBoundingClientRect();
|
|
10
|
+
return e(t, n, a.width, a.height, i);
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { e as clampContextMenuPosition, t as clampContextMenuToElement };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { serializeFingerprint as e } from "./serialize-fingerprint.mjs";
|
|
2
|
+
//#region src/components/pro-contract-template-designer/src/utils/editor-state.ts
|
|
3
|
+
function t(t, n) {
|
|
4
|
+
return t.isFocused === n.isFocused && t.canUndo === n.canUndo && t.canRedo === n.canRedo && t.isBold === n.isBold && t.isItalic === n.isItalic && t.isUnderline === n.isUnderline && t.isBulletList === n.isBulletList && t.isOrderedList === n.isOrderedList && t.isTableActive === n.isTableActive && t.currentHeadingLevel === n.currentHeadingLevel && t.hasMixedBlockFormats === n.hasMixedBlockFormats && t.textAlign === n.textAlign && t.fontFamily === n.fontFamily && t.fontSize === n.fontSize && t.textColor === n.textColor && t.selectionText === n.selectionText && e(t.selectedContentImage) === e(n.selectedContentImage);
|
|
5
|
+
}
|
|
6
|
+
//#endregion
|
|
7
|
+
export { t as isSameEditorState };
|