@guodun/antdv 1.4.2 → 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/ContractTemplateDesignerWorkspaceHeader.vue.mjs +186 -148
- 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 +104 -81
- package/dist/es/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.mjs +1205 -1035
- package/dist/es/components/pro-contract-template-designer/style/index.css +1 -1
- 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/ContractTemplateDesignerWorkspaceHeader.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/style/index.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/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/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 +3 -3
package/dist/es/components/pro-contract-template-designer/src/ContractTemplateTextBubbleMenu.vue.mjs
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { Fragment as e, createBlock as t, createElementBlock as n, createElementVNode as r, createVNode as i, defineComponent as a, normalizeClass as o, normalizeStyle as s, openBlock as c, ref as l, renderList as u, resolveDynamicComponent as d, unref as f, withCtx as p } from "vue";
|
|
2
|
+
import { Button as m, Select as h, Tooltip as g } from "ant-design-vue";
|
|
3
|
+
import { AlignCenterOutlined as _, AlignLeftOutlined as v, AlignRightOutlined as y, BoldOutlined as b, ClearOutlined as x, EllipsisOutlined as S, ItalicOutlined as C, UnderlineOutlined as w } from "@ant-design/icons-vue";
|
|
4
|
+
//#region src/components/pro-contract-template-designer/src/ContractTemplateTextBubbleMenu.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
+
var T = ["value"], E = /* @__PURE__ */ a({
|
|
6
|
+
name: "ContractTemplateTextBubbleMenu",
|
|
7
|
+
__name: "ContractTemplateTextBubbleMenu",
|
|
8
|
+
props: {
|
|
9
|
+
x: {},
|
|
10
|
+
y: {},
|
|
11
|
+
editorState: {},
|
|
12
|
+
fontSizePresetOptions: {},
|
|
13
|
+
currentEditorFontSize: {},
|
|
14
|
+
editorFontSizeSearchValue: {},
|
|
15
|
+
currentEditorTextColor: {},
|
|
16
|
+
textAlignOptions: {}
|
|
17
|
+
},
|
|
18
|
+
emits: [
|
|
19
|
+
"command",
|
|
20
|
+
"patch-font-size",
|
|
21
|
+
"patch-text-align",
|
|
22
|
+
"patch-color",
|
|
23
|
+
"font-size-search",
|
|
24
|
+
"font-size-commit",
|
|
25
|
+
"font-size-dropdown-change",
|
|
26
|
+
"font-size-keydown",
|
|
27
|
+
"more"
|
|
28
|
+
],
|
|
29
|
+
setup(a, { expose: E, emit: D }) {
|
|
30
|
+
let O = D, k = {
|
|
31
|
+
left: v,
|
|
32
|
+
center: _,
|
|
33
|
+
right: y
|
|
34
|
+
}, A = l();
|
|
35
|
+
function j(e) {
|
|
36
|
+
let t = e.currentTarget?.getBoundingClientRect();
|
|
37
|
+
O("more", t?.left ?? e.clientX, t?.bottom ?? e.clientY);
|
|
38
|
+
}
|
|
39
|
+
return E({ getMenuElement: () => A.value }), (l, _) => (c(), n("div", {
|
|
40
|
+
ref_key: "menuElement",
|
|
41
|
+
ref: A,
|
|
42
|
+
class: "gd-contract-template-designer__bubble-menu",
|
|
43
|
+
style: s({
|
|
44
|
+
left: `${a.x}px`,
|
|
45
|
+
top: `${a.y}px`
|
|
46
|
+
}),
|
|
47
|
+
role: "toolbar",
|
|
48
|
+
"aria-label": "选区格式工具条"
|
|
49
|
+
}, [
|
|
50
|
+
i(f(g), { title: "加粗" }, {
|
|
51
|
+
default: p(() => [i(f(m), {
|
|
52
|
+
size: "small",
|
|
53
|
+
class: o(["gd-contract-template-designer__icon-button", { "is-selected": a.editorState.isBold }]),
|
|
54
|
+
"aria-pressed": a.editorState.isBold,
|
|
55
|
+
"aria-label": "加粗",
|
|
56
|
+
onClick: _[0] ||= (e) => O("command", { type: "toggle-bold" })
|
|
57
|
+
}, {
|
|
58
|
+
default: p(() => [i(f(b), { "aria-hidden": "true" })]),
|
|
59
|
+
_: 1
|
|
60
|
+
}, 8, ["class", "aria-pressed"])]),
|
|
61
|
+
_: 1
|
|
62
|
+
}),
|
|
63
|
+
i(f(g), { title: "斜体" }, {
|
|
64
|
+
default: p(() => [i(f(m), {
|
|
65
|
+
size: "small",
|
|
66
|
+
class: o(["gd-contract-template-designer__icon-button", { "is-selected": a.editorState.isItalic }]),
|
|
67
|
+
"aria-pressed": a.editorState.isItalic,
|
|
68
|
+
"aria-label": "斜体",
|
|
69
|
+
onClick: _[1] ||= (e) => O("command", { type: "toggle-italic" })
|
|
70
|
+
}, {
|
|
71
|
+
default: p(() => [i(f(C), { "aria-hidden": "true" })]),
|
|
72
|
+
_: 1
|
|
73
|
+
}, 8, ["class", "aria-pressed"])]),
|
|
74
|
+
_: 1
|
|
75
|
+
}),
|
|
76
|
+
i(f(g), { title: "下划线" }, {
|
|
77
|
+
default: p(() => [i(f(m), {
|
|
78
|
+
size: "small",
|
|
79
|
+
class: o(["gd-contract-template-designer__icon-button", { "is-selected": a.editorState.isUnderline }]),
|
|
80
|
+
"aria-pressed": a.editorState.isUnderline,
|
|
81
|
+
"aria-label": "下划线",
|
|
82
|
+
onClick: _[2] ||= (e) => O("command", { type: "toggle-underline" })
|
|
83
|
+
}, {
|
|
84
|
+
default: p(() => [i(f(w), { "aria-hidden": "true" })]),
|
|
85
|
+
_: 1
|
|
86
|
+
}, 8, ["class", "aria-pressed"])]),
|
|
87
|
+
_: 1
|
|
88
|
+
}),
|
|
89
|
+
_[10] ||= r("span", {
|
|
90
|
+
class: "gd-contract-template-designer__bubble-divider",
|
|
91
|
+
"aria-hidden": "true"
|
|
92
|
+
}, null, -1),
|
|
93
|
+
i(f(h), {
|
|
94
|
+
class: "gd-contract-template-designer__bubble-font-size",
|
|
95
|
+
"popup-class-name": "gd-contract-template-designer__bubble-menu-popup",
|
|
96
|
+
value: a.currentEditorFontSize,
|
|
97
|
+
options: a.fontSizePresetOptions,
|
|
98
|
+
"show-search": "",
|
|
99
|
+
"filter-option": !1,
|
|
100
|
+
"search-value": a.editorFontSizeSearchValue,
|
|
101
|
+
size: "small",
|
|
102
|
+
onBlur: _[3] ||= (e) => O("font-size-commit"),
|
|
103
|
+
onChange: _[4] ||= (e) => O("patch-font-size", e),
|
|
104
|
+
onDropdownVisibleChange: _[5] ||= (e) => O("font-size-dropdown-change", e),
|
|
105
|
+
onInputKeyDown: _[6] ||= (e) => O("font-size-keydown", e),
|
|
106
|
+
onSearch: _[7] ||= (e) => O("font-size-search", e)
|
|
107
|
+
}, null, 8, [
|
|
108
|
+
"value",
|
|
109
|
+
"options",
|
|
110
|
+
"search-value"
|
|
111
|
+
]),
|
|
112
|
+
i(f(g), { title: "文字颜色" }, {
|
|
113
|
+
default: p(() => [r("input", {
|
|
114
|
+
class: "gd-contract-template-designer__bubble-color",
|
|
115
|
+
type: "color",
|
|
116
|
+
"aria-label": "文字颜色",
|
|
117
|
+
value: a.currentEditorTextColor,
|
|
118
|
+
onInput: _[8] ||= (e) => O("patch-color", e.target.value)
|
|
119
|
+
}, null, 40, T)]),
|
|
120
|
+
_: 1
|
|
121
|
+
}),
|
|
122
|
+
_[11] ||= r("span", {
|
|
123
|
+
class: "gd-contract-template-designer__bubble-divider",
|
|
124
|
+
"aria-hidden": "true"
|
|
125
|
+
}, null, -1),
|
|
126
|
+
(c(!0), n(e, null, u(a.textAlignOptions, (e) => (c(), t(f(g), {
|
|
127
|
+
key: e.value,
|
|
128
|
+
title: e.label
|
|
129
|
+
}, {
|
|
130
|
+
default: p(() => [i(f(m), {
|
|
131
|
+
size: "small",
|
|
132
|
+
class: o(["gd-contract-template-designer__icon-button", { "is-selected": a.editorState.textAlign === e.value }]),
|
|
133
|
+
"aria-pressed": a.editorState.textAlign === e.value,
|
|
134
|
+
"aria-label": e.label,
|
|
135
|
+
onClick: (t) => O("patch-text-align", e.value)
|
|
136
|
+
}, {
|
|
137
|
+
default: p(() => [(c(), t(d(k[e.value]), { "aria-hidden": "true" }))]),
|
|
138
|
+
_: 2
|
|
139
|
+
}, 1032, [
|
|
140
|
+
"class",
|
|
141
|
+
"aria-pressed",
|
|
142
|
+
"aria-label",
|
|
143
|
+
"onClick"
|
|
144
|
+
])]),
|
|
145
|
+
_: 2
|
|
146
|
+
}, 1032, ["title"]))), 128)),
|
|
147
|
+
_[12] ||= r("span", {
|
|
148
|
+
class: "gd-contract-template-designer__bubble-divider",
|
|
149
|
+
"aria-hidden": "true"
|
|
150
|
+
}, null, -1),
|
|
151
|
+
i(f(g), { title: "清除文字格式" }, {
|
|
152
|
+
default: p(() => [i(f(m), {
|
|
153
|
+
size: "small",
|
|
154
|
+
class: "gd-contract-template-designer__icon-button",
|
|
155
|
+
"aria-label": "清除文字格式",
|
|
156
|
+
onClick: _[9] ||= (e) => O("command", { type: "clear-text-format" })
|
|
157
|
+
}, {
|
|
158
|
+
default: p(() => [i(f(x), { "aria-hidden": "true" })]),
|
|
159
|
+
_: 1
|
|
160
|
+
})]),
|
|
161
|
+
_: 1
|
|
162
|
+
}),
|
|
163
|
+
i(f(g), { title: "更多操作" }, {
|
|
164
|
+
default: p(() => [i(f(m), {
|
|
165
|
+
size: "small",
|
|
166
|
+
class: "gd-contract-template-designer__icon-button",
|
|
167
|
+
"aria-label": "更多操作",
|
|
168
|
+
onClick: j
|
|
169
|
+
}, {
|
|
170
|
+
default: p(() => [i(f(S), { "aria-hidden": "true" })]),
|
|
171
|
+
_: 1
|
|
172
|
+
})]),
|
|
173
|
+
_: 1
|
|
174
|
+
})
|
|
175
|
+
], 4));
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
//#endregion
|
|
179
|
+
export { E as default };
|
|
@@ -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,7 +396,7 @@ 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
|
|
399
|
+
let He = p(() => {
|
|
379
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;
|
|
380
401
|
return {
|
|
381
402
|
width: `${E.pageSize.width}px`,
|
|
@@ -384,10 +405,10 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
|
|
|
384
405
|
paddingBottom: `${r}px`,
|
|
385
406
|
"--gd-contract-page-content-height": `${Math.max(120, E.pageSize.height - n - r)}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(() => te(E.pageSize));
|
|
391
412
|
function G(e, t) {
|
|
392
413
|
let n = k.value?.getBoundingClientRect();
|
|
393
414
|
return n ? {
|
|
@@ -398,7 +419,7 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
|
|
|
398
419
|
y: E.pageSize.height / 2
|
|
399
420
|
};
|
|
400
421
|
}
|
|
401
|
-
function
|
|
422
|
+
function Ke(e) {
|
|
402
423
|
let t = k.value?.getBoundingClientRect(), r = k.value?.closest(".gd-contract-template-designer__canvas")?.getBoundingClientRect(), i = n(e);
|
|
403
424
|
if (!t || !r) return {
|
|
404
425
|
x: Math.max(0, (E.pageSize.width - i.width) / 2),
|
|
@@ -410,7 +431,7 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
|
|
|
410
431
|
y: l.y - i.height / 2
|
|
411
432
|
};
|
|
412
433
|
}
|
|
413
|
-
function
|
|
434
|
+
function qe(n) {
|
|
414
435
|
if (!t(E.readonly, E.disabled)) {
|
|
415
436
|
n.preventDefault(), n.stopPropagation();
|
|
416
437
|
return;
|
|
@@ -430,11 +451,11 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
|
|
|
430
451
|
let o = n.dataTransfer?.getData(w);
|
|
431
452
|
o && o !== E.page.id && (n.preventDefault(), n.stopPropagation(), D("variable-move-blocked", E.page.id));
|
|
432
453
|
}
|
|
433
|
-
function
|
|
454
|
+
function Je(e, t) {
|
|
434
455
|
let n = j.value;
|
|
435
456
|
return n ? (ie(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,13 +496,13 @@ 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
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;
|
|
487
508
|
return Math.max(120, E.pageSize.height - n - r);
|
|
@@ -491,7 +512,7 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
|
|
|
491
512
|
let t = window.getComputedStyle(e), n = Number.parseFloat(t.paddingTop) || 0, r = Number.parseFloat(t.paddingBottom) || 0;
|
|
492
513
|
return Math.max(120, E.pageSize.height - n - r);
|
|
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 ? ne(j.value.getJSON().content,
|
|
528
|
+
return j.value ? ne(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,7 +553,7 @@ 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
558
|
let n = re(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 }) => {
|
|
@@ -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,9 +598,9 @@ 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
|
|
603
|
+
function ct(e) {
|
|
583
604
|
let t = i.find((t) => t.key === e), n = j.value;
|
|
584
605
|
if (!t || !n) return;
|
|
585
606
|
let r = n.chain().focus().clearNodes();
|
|
@@ -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 && oe(j.value, e.format) : 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();
|
|
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,40 +641,42 @@ 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
682
|
h(ce, {
|