@guodun/antdv 1.4.8 → 1.5.1
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 +315 -286
- package/dist/es/components/contract-signing-location/src/ContractSigningLocationCanvas.vue.mjs +316 -285
- package/dist/es/components/contract-signing-location/src/ContractSigningTemplatePage.vue.mjs +62 -54
- package/dist/es/components/contract-signing-location/style/index.css +1 -1
- package/dist/es/components/index.mjs +1 -0
- package/dist/es/components/pro-contract-template-designer/index.mjs +1 -0
- package/dist/es/components/pro-contract-template-designer/src/ContractPrintIframe.mjs +7 -0
- package/dist/es/components/pro-contract-template-designer/src/ContractPrintIframe.vue.mjs +129 -0
- package/dist/es/components/pro-contract-template-designer/src/ContractPrintIframe.vue_vue_type_style_index_0_scoped_a9912ff0_lang.css +1 -0
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplatePreviewModal.vue.mjs +10 -5
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplatePreviewPage.vue.mjs +64 -43
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplateRendererPage.vue.mjs +82 -53
- package/dist/es/components/pro-contract-template-designer/src/DesignerPage.vue.mjs +271 -265
- package/dist/es/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.mjs +762 -751
- package/dist/es/components/pro-contract-template-designer/src/ProContractTemplateRenderer.vue.mjs +217 -197
- package/dist/es/components/pro-contract-template-designer/src/constants.mjs +29 -51
- package/dist/es/components/pro-contract-template-designer/src/extensions/template-variable.mjs +103 -103
- package/dist/es/components/pro-contract-template-designer/src/extensions/word-paste.mjs +24 -21
- package/dist/es/components/pro-contract-template-designer/src/utils/contract-print-document.mjs +314 -0
- package/dist/es/components/pro-contract-template-designer/src/utils/page-decorations.mjs +1 -1
- package/dist/es/components/pro-contract-template-designer/src/utils/template-variable-render.mjs +47 -47
- package/dist/es/components/pro-contract-template-designer/src/utils/word-paste.mjs +216 -148
- package/dist/es/components/pro-contract-template-designer/style/index.css +1 -1
- package/dist/es/index.mjs +27 -26
- package/dist/lib/components/contract-signing-location/src/ContractSigningLocation.vue.cjs +1 -1
- package/dist/lib/components/contract-signing-location/src/ContractSigningLocationCanvas.vue.cjs +1 -1
- package/dist/lib/components/contract-signing-location/src/ContractSigningTemplatePage.vue.cjs +1 -1
- package/dist/lib/components/contract-signing-location/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/ContractPrintIframe.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/ContractPrintIframe.vue.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/ContractPrintIframe.vue_vue_type_style_index_0_scoped_a9912ff0_lang.css +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplatePreviewModal.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/ContractTemplateRendererPage.vue.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/DesignerPage.vue.cjs +2 -2
- package/dist/lib/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/ProContractTemplateRenderer.vue.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/constants.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/extensions/template-variable.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/extensions/word-paste.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/utils/contract-print-document.cjs +211 -0
- 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/template-variable-render.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/utils/word-paste.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/ContractSigningLocation.vue.d.ts +7 -0
- package/dist/types/components/contract-signing-location/src/ContractSigningLocationCanvas.vue.d.ts +4 -0
- package/dist/types/components/contract-signing-location/src/ContractSigningTemplatePage.vue.d.ts +9 -3
- package/dist/types/components/contract-signing-location/src/types.d.ts +5 -0
- package/dist/types/components/pro-contract-template-designer/index.d.ts +1 -0
- package/dist/types/components/pro-contract-template-designer/src/ContractPrintIframe.vue.d.ts +35 -0
- package/dist/types/components/pro-contract-template-designer/src/ContractTemplateDesignerToolbar.vue.d.ts +2 -2
- package/dist/types/components/pro-contract-template-designer/src/ContractTemplatePreviewModal.vue.d.ts +1 -0
- package/dist/types/components/pro-contract-template-designer/src/ContractTemplatePreviewPage.vue.d.ts +1 -0
- package/dist/types/components/pro-contract-template-designer/src/ContractTemplateRendererPage.vue.d.ts +13 -1
- package/dist/types/components/pro-contract-template-designer/src/DesignerPage.vue.d.ts +6 -0
- package/dist/types/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.d.ts +1 -0
- package/dist/types/components/pro-contract-template-designer/src/ProContractTemplateRenderer.vue.d.ts +1 -0
- package/dist/types/components/pro-contract-template-designer/src/constants.d.ts +4 -4
- package/dist/types/components/pro-contract-template-designer/src/extensions/word-paste.d.ts +8 -0
- package/dist/types/components/pro-contract-template-designer/src/types.d.ts +10 -0
- package/dist/types/components/pro-contract-template-designer/src/utils/contract-print-document.d.ts +119 -0
- package/dist/types/components/pro-contract-template-designer/src/utils/word-paste.d.ts +2 -0
- package/package.json +4 -3
|
@@ -1,34 +1,12 @@
|
|
|
1
|
+
import { CONTRACT_PRINT_FONT_FAMILY as e, CONTRACT_PRINT_SANS_FONT_FAMILY as t } from "@guodun/contract-print-css";
|
|
1
2
|
//#region src/components/pro-contract-template-designer/src/constants.ts
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
value: "KaiTi, STKaiti, Kaiti SC, serif"
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
label: "合同仿宋",
|
|
13
|
-
value: "FangSong, STFangsong, serif"
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
label: "文档黑体",
|
|
17
|
-
value: "Noto Sans SC, Source Han Sans SC, PingFang SC, Microsoft YaHei, sans-serif"
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
label: "Arial",
|
|
21
|
-
value: "Arial, Helvetica, sans-serif"
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
label: "Times New Roman",
|
|
25
|
-
value: "\"Times New Roman\", Times, serif"
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
label: "Courier New",
|
|
29
|
-
value: "\"Courier New\", Consolas, monospace"
|
|
30
|
-
}
|
|
31
|
-
], n = [
|
|
3
|
+
var n = e, r = [{
|
|
4
|
+
label: "合同宋体",
|
|
5
|
+
value: n
|
|
6
|
+
}, {
|
|
7
|
+
label: "文档黑体",
|
|
8
|
+
value: t
|
|
9
|
+
}], i = [
|
|
32
10
|
12,
|
|
33
11
|
14,
|
|
34
12
|
16,
|
|
@@ -37,7 +15,7 @@ var e = "Noto Serif SC, Source Han Serif SC, Songti SC, STSong, SimSun, serif",
|
|
|
37
15
|
24,
|
|
38
16
|
28,
|
|
39
17
|
32
|
|
40
|
-
],
|
|
18
|
+
], a = [
|
|
41
19
|
{
|
|
42
20
|
label: "左对齐",
|
|
43
21
|
value: "left"
|
|
@@ -50,7 +28,7 @@ var e = "Noto Serif SC, Source Han Serif SC, Songti SC, STSong, SimSun, serif",
|
|
|
50
28
|
label: "右对齐",
|
|
51
29
|
value: "right"
|
|
52
30
|
}
|
|
53
|
-
],
|
|
31
|
+
], o = [
|
|
54
32
|
{
|
|
55
33
|
format: "paragraph",
|
|
56
34
|
label: "正文",
|
|
@@ -108,16 +86,16 @@ var e = "Noto Serif SC, Source Han Serif SC, Songti SC, STSong, SimSun, serif",
|
|
|
108
86
|
marginBottom: 6
|
|
109
87
|
}
|
|
110
88
|
];
|
|
111
|
-
function
|
|
112
|
-
return
|
|
89
|
+
function s(e) {
|
|
90
|
+
return o.find((t) => t.format === e);
|
|
113
91
|
}
|
|
114
|
-
var
|
|
92
|
+
var c = [
|
|
115
93
|
{
|
|
116
94
|
key: "contractTitle",
|
|
117
95
|
label: "合同标题",
|
|
118
96
|
headingLevel: 1,
|
|
119
97
|
fontSize: 26,
|
|
120
|
-
fontFamily:
|
|
98
|
+
fontFamily: n,
|
|
121
99
|
textAlign: "center",
|
|
122
100
|
bold: !0,
|
|
123
101
|
italic: !1,
|
|
@@ -128,7 +106,7 @@ var o = [
|
|
|
128
106
|
label: "条款标题",
|
|
129
107
|
headingLevel: 2,
|
|
130
108
|
fontSize: 18,
|
|
131
|
-
fontFamily:
|
|
109
|
+
fontFamily: n,
|
|
132
110
|
textAlign: "left",
|
|
133
111
|
bold: !0,
|
|
134
112
|
italic: !1,
|
|
@@ -139,7 +117,7 @@ var o = [
|
|
|
139
117
|
label: "正文条款",
|
|
140
118
|
paragraph: !0,
|
|
141
119
|
fontSize: 14,
|
|
142
|
-
fontFamily:
|
|
120
|
+
fontFamily: n,
|
|
143
121
|
textAlign: "left",
|
|
144
122
|
bold: !1,
|
|
145
123
|
italic: !1,
|
|
@@ -150,14 +128,14 @@ var o = [
|
|
|
150
128
|
label: "附件标题",
|
|
151
129
|
headingLevel: 2,
|
|
152
130
|
fontSize: 20,
|
|
153
|
-
fontFamily:
|
|
131
|
+
fontFamily: n,
|
|
154
132
|
textAlign: "center",
|
|
155
133
|
bold: !0,
|
|
156
134
|
italic: !1,
|
|
157
135
|
underline: !1
|
|
158
136
|
}
|
|
159
137
|
];
|
|
160
|
-
function
|
|
138
|
+
function l(e) {
|
|
161
139
|
return [
|
|
162
140
|
e.paragraph ? { type: "set-paragraph" } : {
|
|
163
141
|
type: "set-heading",
|
|
@@ -180,21 +158,21 @@ function s(e) {
|
|
|
180
158
|
e.underline ? { type: "set-underline" } : { type: "unset-underline" }
|
|
181
159
|
];
|
|
182
160
|
}
|
|
183
|
-
var
|
|
184
|
-
function
|
|
185
|
-
return
|
|
161
|
+
var u = Object.fromEntries(c.map((e) => [e.key, l(e)]));
|
|
162
|
+
function d(e) {
|
|
163
|
+
return c.find((t) => t.key === e);
|
|
186
164
|
}
|
|
187
|
-
function
|
|
188
|
-
return (
|
|
165
|
+
function f(e) {
|
|
166
|
+
return (u[e] ?? []).map((e) => ({ ...e }));
|
|
189
167
|
}
|
|
190
|
-
function
|
|
168
|
+
function p(e) {
|
|
191
169
|
return String(e || "").replace(/["']/g, "").replace(/\s*,\s*/g, ",").trim().toLowerCase();
|
|
192
170
|
}
|
|
193
|
-
function
|
|
194
|
-
let
|
|
195
|
-
return
|
|
196
|
-
e?.value && i.set(
|
|
171
|
+
function m(e, t = "append") {
|
|
172
|
+
let n = t === "replace" ? e ?? r : [...r, ...e ?? []], i = /* @__PURE__ */ new Map();
|
|
173
|
+
return n.forEach((e) => {
|
|
174
|
+
e?.value && i.set(p(e.value), e);
|
|
197
175
|
}), Array.from(i.values());
|
|
198
176
|
}
|
|
199
177
|
//#endregion
|
|
200
|
-
export {
|
|
178
|
+
export { o as CONTRACT_BLOCK_STYLES, c as CONTRACT_TEXT_STYLE_PRESETS, u as CONTRACT_TEXT_STYLE_PRESET_COMMANDS, n as DEFAULT_CONTRACT_FONT_FAMILY, r as DEFAULT_FONT_FAMILY_OPTIONS, i as DEFAULT_FONT_SIZE_PRESETS, a as DEFAULT_TEXT_ALIGN_OPTIONS, s as getContractBlockStyle, d as getContractTextStylePreset, p as normalizeFontFamilyValue, f as resolveContractTextStylePresetCommands, m as resolveFontFamilyOptions };
|
package/dist/es/components/pro-contract-template-designer/src/extensions/template-variable.mjs
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import "../constants.mjs";
|
|
2
|
-
import { resolveTemplateVariablePresentation as
|
|
3
|
-
import { decodeContractTemplateJsonAttribute as
|
|
4
|
-
import { Node as
|
|
1
|
+
import { DEFAULT_CONTRACT_FONT_FAMILY as e } from "../constants.mjs";
|
|
2
|
+
import { resolveTemplateVariablePresentation as t } from "../utils/template-variable-render.mjs";
|
|
3
|
+
import { decodeContractTemplateJsonAttribute as n, encodeContractTemplateJsonAttribute as r } from "../utils/advanced-controls.mjs";
|
|
4
|
+
import { Node as i, mergeAttributes as a } from "@tiptap/core";
|
|
5
5
|
//#region src/components/pro-contract-template-designer/src/extensions/template-variable.ts
|
|
6
|
-
function
|
|
6
|
+
function o(e, t, n = "") {
|
|
7
7
|
return {
|
|
8
8
|
default: n,
|
|
9
9
|
parseHTML: (e) => e.getAttribute(t) ?? n,
|
|
10
10
|
renderHTML: (n) => ({ [t]: n[e] })
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
|
-
function
|
|
13
|
+
function s(e, t, n) {
|
|
14
14
|
return {
|
|
15
15
|
default: n,
|
|
16
16
|
parseHTML: (e) => Number(e.getAttribute(t) || n),
|
|
17
17
|
renderHTML: (n) => ({ [t]: n[e] })
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function c(e, t) {
|
|
21
21
|
return {
|
|
22
22
|
default: !1,
|
|
23
23
|
parseHTML: (e) => e.getAttribute(t) === "true",
|
|
24
24
|
renderHTML: (n) => ({ [t]: String(!!n[e]) })
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function l(e, t, i) {
|
|
28
28
|
return {
|
|
29
29
|
default: i,
|
|
30
|
-
parseHTML: (e) =>
|
|
31
|
-
renderHTML: (
|
|
30
|
+
parseHTML: (e) => n(e.getAttribute(t)) ?? i,
|
|
31
|
+
renderHTML: (n) => n[e] === void 0 || n[e] === null ? {} : { [t]: r(n[e]) }
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
|
-
var
|
|
34
|
+
var u = i.create({
|
|
35
35
|
name: "templateVariable",
|
|
36
36
|
group: "inline",
|
|
37
37
|
inline: !0,
|
|
@@ -40,19 +40,19 @@ var l = r.create({
|
|
|
40
40
|
draggable: !0,
|
|
41
41
|
addAttributes() {
|
|
42
42
|
return {
|
|
43
|
-
key:
|
|
43
|
+
key: o("key", "data-key"),
|
|
44
44
|
label: {
|
|
45
45
|
default: "",
|
|
46
46
|
parseHTML: (e) => e.getAttribute("data-label") ?? e.textContent ?? "",
|
|
47
47
|
renderHTML: (e) => ({ "data-label": e.label })
|
|
48
48
|
},
|
|
49
|
-
type:
|
|
50
|
-
placeholder:
|
|
51
|
-
width:
|
|
52
|
-
height:
|
|
53
|
-
required:
|
|
54
|
-
defaultValue:
|
|
55
|
-
format:
|
|
49
|
+
type: o("type", "data-variable-type", "text"),
|
|
50
|
+
placeholder: o("placeholder", "data-placeholder"),
|
|
51
|
+
width: s("width", "data-width", 160),
|
|
52
|
+
height: s("height", "data-height", 32),
|
|
53
|
+
required: c("required", "data-required"),
|
|
54
|
+
defaultValue: o("defaultValue", "data-default-value"),
|
|
55
|
+
format: o("format", "data-format"),
|
|
56
56
|
precision: {
|
|
57
57
|
default: void 0,
|
|
58
58
|
parseHTML: (e) => {
|
|
@@ -69,75 +69,75 @@ var l = r.create({
|
|
|
69
69
|
},
|
|
70
70
|
renderHTML: (e) => e.useGrouping === void 0 ? {} : { "data-use-grouping": String(!!e.useGrouping) }
|
|
71
71
|
},
|
|
72
|
-
checkedText:
|
|
73
|
-
uncheckedText:
|
|
74
|
-
options:
|
|
75
|
-
dataSource:
|
|
76
|
-
multiple:
|
|
77
|
-
componentKey:
|
|
78
|
-
componentConfig:
|
|
79
|
-
multiline:
|
|
80
|
-
rows:
|
|
81
|
-
lineHeight:
|
|
82
|
-
border:
|
|
83
|
-
underline:
|
|
84
|
-
color:
|
|
85
|
-
background:
|
|
86
|
-
fontSize:
|
|
72
|
+
checkedText: o("checkedText", "data-checked-text"),
|
|
73
|
+
uncheckedText: o("uncheckedText", "data-unchecked-text"),
|
|
74
|
+
options: l("options", "data-control-options", []),
|
|
75
|
+
dataSource: l("dataSource", "data-control-source", void 0),
|
|
76
|
+
multiple: c("multiple", "data-multiple"),
|
|
77
|
+
componentKey: o("componentKey", "data-component-key"),
|
|
78
|
+
componentConfig: l("componentConfig", "data-component-config", {}),
|
|
79
|
+
multiline: c("multiline", "data-multiline"),
|
|
80
|
+
rows: s("rows", "data-rows", 3),
|
|
81
|
+
lineHeight: s("lineHeight", "data-line-height", 28),
|
|
82
|
+
border: c("border", "data-border"),
|
|
83
|
+
underline: c("underline", "data-underline"),
|
|
84
|
+
color: o("color", "data-color", "#1f2937"),
|
|
85
|
+
background: o("background", "data-background", "transparent"),
|
|
86
|
+
fontSize: s("fontSize", "data-font-size", 14),
|
|
87
87
|
fontFamily: {
|
|
88
88
|
default: "",
|
|
89
89
|
parseHTML: (e) => e.getAttribute("data-font-family") ?? "",
|
|
90
90
|
renderHTML: (e) => e.fontFamily ? { "data-font-family": e.fontFamily } : {}
|
|
91
91
|
},
|
|
92
|
-
placeholderColor:
|
|
93
|
-
lineColor:
|
|
94
|
-
textAlign:
|
|
95
|
-
borderStyle:
|
|
96
|
-
objectFit:
|
|
92
|
+
placeholderColor: o("placeholderColor", "data-placeholder-color", "#7a818b"),
|
|
93
|
+
lineColor: o("lineColor", "data-line-color", "#565b66"),
|
|
94
|
+
textAlign: o("textAlign", "data-text-align", "left"),
|
|
95
|
+
borderStyle: o("borderStyle", "data-border-style", "solid"),
|
|
96
|
+
objectFit: o("objectFit", "data-object-fit", "contain")
|
|
97
97
|
};
|
|
98
98
|
},
|
|
99
99
|
parseHTML() {
|
|
100
100
|
return [{ tag: "span[data-template-variable]" }];
|
|
101
101
|
},
|
|
102
|
-
renderHTML({ HTMLAttributes:
|
|
103
|
-
let n =
|
|
104
|
-
type: String(
|
|
105
|
-
width:
|
|
106
|
-
height:
|
|
102
|
+
renderHTML({ HTMLAttributes: e }) {
|
|
103
|
+
let n = e["data-border"] ?? e.border, r = e["data-precision"] ?? e.precision, i = r === void 0 || r === "" ? void 0 : Number(r), o = e["data-use-grouping"] ?? e.useGrouping, s = o === void 0 || o === "" ? void 0 : o === !0 || o === "true", c = t({
|
|
104
|
+
type: String(e["data-variable-type"] || e.type || "text"),
|
|
105
|
+
width: e["data-width"] || e.width || 160,
|
|
106
|
+
height: e["data-height"] || e.height || 32,
|
|
107
107
|
border: n === !0 || n === "true",
|
|
108
|
-
underline:
|
|
109
|
-
color: String(
|
|
110
|
-
background: String(
|
|
111
|
-
fontSize:
|
|
112
|
-
fontFamily: String(
|
|
113
|
-
placeholder: String(
|
|
114
|
-
defaultValue: String(
|
|
115
|
-
format: String(
|
|
116
|
-
precision:
|
|
108
|
+
underline: e["data-underline"] === "true" || e.underline === !0,
|
|
109
|
+
color: String(e["data-color"] || e.color || "#1f2937"),
|
|
110
|
+
background: String(e["data-background"] || e.background || "transparent"),
|
|
111
|
+
fontSize: e["data-font-size"] || e.fontSize || 14,
|
|
112
|
+
fontFamily: String(e["data-font-family"] || e.fontFamily || ""),
|
|
113
|
+
placeholder: String(e["data-placeholder"] || e.placeholder || ""),
|
|
114
|
+
defaultValue: String(e["data-default-value"] || e.defaultValue || ""),
|
|
115
|
+
format: String(e["data-format"] || e.format || ""),
|
|
116
|
+
precision: i,
|
|
117
117
|
useGrouping: s,
|
|
118
|
-
checkedText: String(
|
|
119
|
-
uncheckedText: String(
|
|
120
|
-
multiline:
|
|
121
|
-
rows:
|
|
122
|
-
lineHeight:
|
|
123
|
-
placeholderColor: String(
|
|
124
|
-
lineColor: String(
|
|
125
|
-
textAlign: String(
|
|
126
|
-
borderStyle: String(
|
|
127
|
-
objectFit: String(
|
|
118
|
+
checkedText: String(e["data-checked-text"] || e.checkedText || ""),
|
|
119
|
+
uncheckedText: String(e["data-unchecked-text"] || e.uncheckedText || ""),
|
|
120
|
+
multiline: e["data-multiline"] === "true" || e.multiline === !0,
|
|
121
|
+
rows: e["data-rows"] || e.rows || 3,
|
|
122
|
+
lineHeight: e["data-line-height"] || e.lineHeight || 28,
|
|
123
|
+
placeholderColor: String(e["data-placeholder-color"] || e.placeholderColor || "#7a818b"),
|
|
124
|
+
lineColor: String(e["data-line-color"] || e.lineColor || "#565b66"),
|
|
125
|
+
textAlign: String(e["data-text-align"] || e.textAlign || "left"),
|
|
126
|
+
borderStyle: String(e["data-border-style"] || e.borderStyle || "solid"),
|
|
127
|
+
objectFit: String(e["data-object-fit"] || e.objectFit || "contain")
|
|
128
128
|
});
|
|
129
129
|
return [
|
|
130
130
|
"span",
|
|
131
|
-
|
|
131
|
+
a(e, {
|
|
132
132
|
"data-template-variable": "true",
|
|
133
133
|
"data-variable-type": c.type,
|
|
134
134
|
"data-width": String(c.width),
|
|
135
135
|
"data-height": String(c.height),
|
|
136
136
|
"data-border": String(c.border),
|
|
137
137
|
"data-underline": String(c.underline),
|
|
138
|
-
"data-multiline": String(
|
|
139
|
-
"data-rows": String(Math.max(1, Number(
|
|
140
|
-
"data-line-height": String(Math.max(18, Number(
|
|
138
|
+
"data-multiline": String(e["data-multiline"] === "true" || e.multiline === !0),
|
|
139
|
+
"data-rows": String(Math.max(1, Number(e["data-rows"] || e.rows || 3))),
|
|
140
|
+
"data-line-height": String(Math.max(18, Number(e["data-line-height"] || e.lineHeight || 28))),
|
|
141
141
|
"data-color": c.color,
|
|
142
142
|
"data-background": c.background,
|
|
143
143
|
"data-font-size": String(c.fontSize),
|
|
@@ -154,49 +154,49 @@ var l = r.create({
|
|
|
154
154
|
];
|
|
155
155
|
}
|
|
156
156
|
});
|
|
157
|
-
function
|
|
157
|
+
function d(t) {
|
|
158
158
|
return {
|
|
159
|
-
key:
|
|
160
|
-
label:
|
|
161
|
-
type:
|
|
162
|
-
placeholder:
|
|
163
|
-
width:
|
|
164
|
-
height:
|
|
165
|
-
required: !!
|
|
166
|
-
defaultValue:
|
|
167
|
-
format:
|
|
168
|
-
precision:
|
|
169
|
-
useGrouping:
|
|
170
|
-
checkedText:
|
|
171
|
-
uncheckedText:
|
|
172
|
-
options:
|
|
173
|
-
dataSource:
|
|
174
|
-
multiple: !!
|
|
175
|
-
componentKey:
|
|
176
|
-
componentConfig:
|
|
177
|
-
multiline: !!
|
|
178
|
-
rows: Math.max(1, Math.round(
|
|
179
|
-
lineHeight: Math.max(18, Math.round(
|
|
180
|
-
border:
|
|
181
|
-
underline:
|
|
182
|
-
color:
|
|
183
|
-
background:
|
|
184
|
-
fontSize:
|
|
185
|
-
fontFamily:
|
|
186
|
-
placeholderColor:
|
|
187
|
-
lineColor:
|
|
188
|
-
textAlign:
|
|
189
|
-
borderStyle:
|
|
190
|
-
objectFit:
|
|
159
|
+
key: t.key,
|
|
160
|
+
label: t.label,
|
|
161
|
+
type: t.type ?? "text",
|
|
162
|
+
placeholder: t.placeholder || "",
|
|
163
|
+
width: t.width ?? 160,
|
|
164
|
+
height: t.height ?? 32,
|
|
165
|
+
required: !!t.required,
|
|
166
|
+
defaultValue: t.defaultValue || "",
|
|
167
|
+
format: t.format || "",
|
|
168
|
+
precision: t.precision,
|
|
169
|
+
useGrouping: t.useGrouping,
|
|
170
|
+
checkedText: t.checkedText || "",
|
|
171
|
+
uncheckedText: t.uncheckedText || "",
|
|
172
|
+
options: t.options?.map((e) => ({ ...e })) ?? [],
|
|
173
|
+
dataSource: t.dataSource ? { ...t.dataSource } : void 0,
|
|
174
|
+
multiple: !!t.multiple,
|
|
175
|
+
componentKey: t.componentKey || "",
|
|
176
|
+
componentConfig: t.componentConfig ? { ...t.componentConfig } : {},
|
|
177
|
+
multiline: !!t.multiline,
|
|
178
|
+
rows: Math.max(1, Math.round(t.rows ?? 3)),
|
|
179
|
+
lineHeight: Math.max(18, Math.round(t.lineHeight ?? 28)),
|
|
180
|
+
border: t.style?.border ?? t.type === "image",
|
|
181
|
+
underline: t.style?.underline ?? (t.type !== "image" && t.type !== "checkbox"),
|
|
182
|
+
color: t.style?.color || "#1f2937",
|
|
183
|
+
background: t.style?.background || "transparent",
|
|
184
|
+
fontSize: t.style?.fontSize ?? 14,
|
|
185
|
+
fontFamily: t.style?.fontFamily || e,
|
|
186
|
+
placeholderColor: t.style?.placeholderColor || "#7a818b",
|
|
187
|
+
lineColor: t.style?.lineColor || "#565b66",
|
|
188
|
+
textAlign: t.style?.textAlign || "left",
|
|
189
|
+
borderStyle: t.style?.borderStyle || "solid",
|
|
190
|
+
objectFit: t.style?.objectFit || "contain"
|
|
191
191
|
};
|
|
192
192
|
}
|
|
193
|
-
function
|
|
193
|
+
function f(e, t, n) {
|
|
194
194
|
if (!e) return !1;
|
|
195
195
|
let r = {
|
|
196
196
|
type: "templateVariable",
|
|
197
|
-
attrs:
|
|
197
|
+
attrs: d(t)
|
|
198
198
|
}, i = e.chain().focus();
|
|
199
199
|
return typeof n == "number" ? i.insertContentAt(n, r).run() : i.insertContent(r).run();
|
|
200
200
|
}
|
|
201
201
|
//#endregion
|
|
202
|
-
export {
|
|
202
|
+
export { u as TemplateVariable, d as buildTemplateVariableAttrs, f as insertTemplateVariableNode };
|
|
@@ -10,7 +10,7 @@ var l = 0, u = "application/x-gd-contract-template", d = `contract-template-${Da
|
|
|
10
10
|
return {};
|
|
11
11
|
},
|
|
12
12
|
addStorage() {
|
|
13
|
-
return {};
|
|
13
|
+
return { lastReplacedFontFamilies: [] };
|
|
14
14
|
},
|
|
15
15
|
transformPastedHTML(e) {
|
|
16
16
|
let t = this.storage.pending, n = r(e, {
|
|
@@ -18,7 +18,7 @@ var l = 0, u = "application/x-gd-contract-template", d = `contract-template-${Da
|
|
|
18
18
|
rtf: t?.rtf,
|
|
19
19
|
trustedInternal: t?.trustedInternal
|
|
20
20
|
});
|
|
21
|
-
return t && (t.source = n.source, t.recoveredRtfImages = n.recoveredImageCount), n.html;
|
|
21
|
+
return t && (t.source = n.source, t.recoveredRtfImages = n.recoveredImageCount), m(this.editor, this.storage, n.replacedFontFamilies), n.html;
|
|
22
22
|
},
|
|
23
23
|
addProseMirrorPlugins() {
|
|
24
24
|
let n = this.editor, o = this.storage, c = this.options.processImageFile;
|
|
@@ -48,8 +48,8 @@ var l = 0, u = "application/x-gd-contract-template", d = `contract-template-${Da
|
|
|
48
48
|
},
|
|
49
49
|
props: {
|
|
50
50
|
handleDOMEvents: {
|
|
51
|
-
copy: (e, t) =>
|
|
52
|
-
cut: (e, t) =>
|
|
51
|
+
copy: (e, t) => h(e, t, !1),
|
|
52
|
+
cut: (e, t) => h(e, t, !0),
|
|
53
53
|
paste: (e, n) => {
|
|
54
54
|
let r = n.clipboardData;
|
|
55
55
|
if (!r) return !1;
|
|
@@ -57,7 +57,7 @@ var l = 0, u = "application/x-gd-contract-template", d = `contract-template-${Da
|
|
|
57
57
|
html: i,
|
|
58
58
|
plainText: r.getData("text/plain"),
|
|
59
59
|
rtf: r.getData("text/rtf") || r.getData("application/rtf"),
|
|
60
|
-
files:
|
|
60
|
+
files: v(r),
|
|
61
61
|
source: t(i),
|
|
62
62
|
recoveredRtfImages: 0,
|
|
63
63
|
trustedInternal: r.getData(u) === d || i.includes(`data-gd-contract-copy="${d}"`) || i.includes(`data-gd-contract-copy='${d}'`)
|
|
@@ -70,33 +70,33 @@ var l = 0, u = "application/x-gd-contract-template", d = `contract-template-${Da
|
|
|
70
70
|
handlePaste: (t, s) => {
|
|
71
71
|
let u = o.pending;
|
|
72
72
|
if (!u) return !1;
|
|
73
|
-
let d = u.files.length ? u.files :
|
|
74
|
-
if (o.pending = void 0, !
|
|
73
|
+
let d = u.files.length ? u.files : v(s.clipboardData), p = u.recoveredRtfImages || y(u.rtf), h = d.length > 0 && p === 0 && !u.trustedInternal;
|
|
74
|
+
if (o.pending = void 0, !h) return !1;
|
|
75
75
|
s.preventDefault();
|
|
76
|
-
let
|
|
77
|
-
token:
|
|
76
|
+
let b = `word-paste-${++l}`, x = {
|
|
77
|
+
token: b,
|
|
78
78
|
from: t.state.selection.from,
|
|
79
79
|
to: t.state.selection.to
|
|
80
80
|
};
|
|
81
81
|
return t.dispatch(t.state.tr.setMeta(f, {
|
|
82
82
|
type: "set",
|
|
83
|
-
...
|
|
83
|
+
...x
|
|
84
84
|
}).setMeta("addToHistory", !1)), a(d, c).then((t) => {
|
|
85
85
|
if (n.isDestroyed) return;
|
|
86
|
-
let a = f.getState(n.state)?.get(
|
|
86
|
+
let a = f.getState(n.state)?.get(b);
|
|
87
87
|
if (!a) return;
|
|
88
|
-
let
|
|
89
|
-
g(n, a, (u.html ? r(u.html, {
|
|
88
|
+
let s = t.filter((e) => !!e), c = u.html ? r(u.html, {
|
|
90
89
|
plainText: u.plainText,
|
|
91
90
|
rtf: u.rtf,
|
|
92
91
|
clipboardImages: t,
|
|
93
92
|
preferClipboardImages: !0,
|
|
94
93
|
trustedInternal: u.trustedInternal
|
|
95
|
-
})
|
|
94
|
+
}) : void 0, l = c?.html || (s.length ? `<p>${s.map((t) => `<img src="${e(t)}" alt="">`).join("")}</p>` : i(u.plainText));
|
|
95
|
+
c && m(n, o, c.replacedFontFamilies), _(n, a, l || i(u.plainText));
|
|
96
96
|
}).catch(() => {
|
|
97
97
|
if (n.isDestroyed) return;
|
|
98
|
-
let e = f.getState(n.state)?.get(
|
|
99
|
-
e ?
|
|
98
|
+
let e = f.getState(n.state)?.get(b);
|
|
99
|
+
e ? _(n, e, i(u.plainText)) : g(n, b);
|
|
100
100
|
}), !0;
|
|
101
101
|
}
|
|
102
102
|
}
|
|
@@ -104,6 +104,9 @@ var l = 0, u = "application/x-gd-contract-template", d = `contract-template-${Da
|
|
|
104
104
|
}
|
|
105
105
|
});
|
|
106
106
|
function m(e, t, n) {
|
|
107
|
+
t.lastReplacedFontFamilies = n, n.length && e.emit("contract-word-paste", { replacedFontFamilies: n });
|
|
108
|
+
}
|
|
109
|
+
function h(e, t, n) {
|
|
107
110
|
if (e.state.selection.empty || !t.clipboardData) return !1;
|
|
108
111
|
let { dom: r, text: i } = e.serializeForClipboard(e.state.selection.content());
|
|
109
112
|
r.firstElementChild?.setAttribute("data-gd-contract-copy", d), t.preventDefault(), t.clipboardData.clearData(), t.clipboardData.setData("text/html", r.innerHTML), t.clipboardData.setData("text/plain", i);
|
|
@@ -112,22 +115,22 @@ function m(e, t, n) {
|
|
|
112
115
|
} catch {}
|
|
113
116
|
return n && e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent", "cut")), !0;
|
|
114
117
|
}
|
|
115
|
-
function
|
|
118
|
+
function g(e, t) {
|
|
116
119
|
e.isDestroyed || e.view.dispatch(e.state.tr.setMeta(f, {
|
|
117
120
|
type: "clear",
|
|
118
121
|
token: t
|
|
119
122
|
}).setMeta("addToHistory", !1));
|
|
120
123
|
}
|
|
121
|
-
function
|
|
124
|
+
function _(e, t, n) {
|
|
122
125
|
e.chain().insertContentAt({
|
|
123
126
|
from: t.from,
|
|
124
127
|
to: t.to
|
|
125
128
|
}, n, { updateSelection: !1 }).command(({ tr: e }) => (e.setMeta(f, {
|
|
126
129
|
type: "clear",
|
|
127
130
|
token: t.token
|
|
128
|
-
}), e.setMeta("paste", !0), e.setMeta("uiEvent", "paste"), !0)).run() ||
|
|
131
|
+
}), e.setMeta("paste", !0), e.setMeta("uiEvent", "paste"), !0)).run() || g(e, t.token);
|
|
129
132
|
}
|
|
130
|
-
function
|
|
133
|
+
function v(e) {
|
|
131
134
|
if (!e) return [];
|
|
132
135
|
let t = [];
|
|
133
136
|
for (let n of Array.from(e.items)) {
|
|
@@ -138,7 +141,7 @@ function _(e) {
|
|
|
138
141
|
if (!t.length) for (let n of Array.from(e.files)) n.type.toLowerCase().startsWith("image/") && t.push(n);
|
|
139
142
|
return t;
|
|
140
143
|
}
|
|
141
|
-
function
|
|
144
|
+
function y(e) {
|
|
142
145
|
return n(e).length;
|
|
143
146
|
}
|
|
144
147
|
//#endregion
|