@guodun/antdv 1.4.8 → 1.5.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.
Files changed (68) hide show
  1. package/dist/es/components/contract-signing-location/src/ContractSigningLocation.vue.mjs +315 -286
  2. package/dist/es/components/contract-signing-location/src/ContractSigningLocationCanvas.vue.mjs +316 -285
  3. package/dist/es/components/contract-signing-location/src/ContractSigningTemplatePage.vue.mjs +62 -54
  4. package/dist/es/components/contract-signing-location/style/index.css +1 -1
  5. package/dist/es/components/index.mjs +1 -0
  6. package/dist/es/components/pro-contract-template-designer/index.mjs +1 -0
  7. package/dist/es/components/pro-contract-template-designer/src/ContractPrintIframe.mjs +5 -0
  8. package/dist/es/components/pro-contract-template-designer/src/ContractPrintIframe.vue.mjs +136 -0
  9. package/dist/es/components/pro-contract-template-designer/src/ContractTemplatePreviewModal.vue.mjs +10 -5
  10. package/dist/es/components/pro-contract-template-designer/src/ContractTemplatePreviewPage.vue.mjs +64 -43
  11. package/dist/es/components/pro-contract-template-designer/src/ContractTemplateRendererPage.vue.mjs +82 -53
  12. package/dist/es/components/pro-contract-template-designer/src/DesignerPage.vue.mjs +271 -265
  13. package/dist/es/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.mjs +762 -751
  14. package/dist/es/components/pro-contract-template-designer/src/ProContractTemplateRenderer.vue.mjs +217 -197
  15. package/dist/es/components/pro-contract-template-designer/src/constants.mjs +29 -51
  16. package/dist/es/components/pro-contract-template-designer/src/extensions/template-variable.mjs +103 -103
  17. package/dist/es/components/pro-contract-template-designer/src/extensions/word-paste.mjs +24 -21
  18. package/dist/es/components/pro-contract-template-designer/src/utils/contract-print-document.mjs +314 -0
  19. package/dist/es/components/pro-contract-template-designer/src/utils/page-decorations.mjs +1 -1
  20. package/dist/es/components/pro-contract-template-designer/src/utils/template-variable-render.mjs +47 -47
  21. package/dist/es/components/pro-contract-template-designer/src/utils/word-paste.mjs +216 -148
  22. package/dist/es/components/pro-contract-template-designer/style/index.css +1 -1
  23. package/dist/es/index.mjs +27 -26
  24. package/dist/lib/components/contract-signing-location/src/ContractSigningLocation.vue.cjs +1 -1
  25. package/dist/lib/components/contract-signing-location/src/ContractSigningLocationCanvas.vue.cjs +1 -1
  26. package/dist/lib/components/contract-signing-location/src/ContractSigningTemplatePage.vue.cjs +1 -1
  27. package/dist/lib/components/contract-signing-location/style/index.css +1 -1
  28. package/dist/lib/components/index.cjs +1 -1
  29. package/dist/lib/components/pro-contract-template-designer/index.cjs +1 -1
  30. package/dist/lib/components/pro-contract-template-designer/src/ContractPrintIframe.cjs +1 -0
  31. package/dist/lib/components/pro-contract-template-designer/src/ContractPrintIframe.vue.cjs +1 -0
  32. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplatePreviewModal.vue.cjs +1 -1
  33. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplatePreviewPage.vue.cjs +1 -1
  34. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateRendererPage.vue.cjs +1 -1
  35. package/dist/lib/components/pro-contract-template-designer/src/DesignerPage.vue.cjs +2 -2
  36. package/dist/lib/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.cjs +1 -1
  37. package/dist/lib/components/pro-contract-template-designer/src/ProContractTemplateRenderer.vue.cjs +1 -1
  38. package/dist/lib/components/pro-contract-template-designer/src/constants.cjs +1 -1
  39. package/dist/lib/components/pro-contract-template-designer/src/extensions/template-variable.cjs +1 -1
  40. package/dist/lib/components/pro-contract-template-designer/src/extensions/word-paste.cjs +1 -1
  41. package/dist/lib/components/pro-contract-template-designer/src/utils/contract-print-document.cjs +211 -0
  42. package/dist/lib/components/pro-contract-template-designer/src/utils/page-decorations.cjs +1 -1
  43. package/dist/lib/components/pro-contract-template-designer/src/utils/template-variable-render.cjs +1 -1
  44. package/dist/lib/components/pro-contract-template-designer/src/utils/word-paste.cjs +2 -2
  45. package/dist/lib/components/pro-contract-template-designer/style/index.css +1 -1
  46. package/dist/lib/index.cjs +1 -1
  47. package/dist/theme/contract-signing-location.css +1 -1
  48. package/dist/theme/icon.css +1 -1
  49. package/dist/theme/index.css +1 -1
  50. package/dist/types/components/contract-signing-location/src/ContractSigningLocation.vue.d.ts +7 -0
  51. package/dist/types/components/contract-signing-location/src/ContractSigningLocationCanvas.vue.d.ts +4 -0
  52. package/dist/types/components/contract-signing-location/src/ContractSigningTemplatePage.vue.d.ts +9 -3
  53. package/dist/types/components/contract-signing-location/src/types.d.ts +5 -0
  54. package/dist/types/components/pro-contract-template-designer/index.d.ts +1 -0
  55. package/dist/types/components/pro-contract-template-designer/src/ContractPrintIframe.vue.d.ts +35 -0
  56. package/dist/types/components/pro-contract-template-designer/src/ContractTemplateDesignerToolbar.vue.d.ts +2 -2
  57. package/dist/types/components/pro-contract-template-designer/src/ContractTemplatePreviewModal.vue.d.ts +1 -0
  58. package/dist/types/components/pro-contract-template-designer/src/ContractTemplatePreviewPage.vue.d.ts +1 -0
  59. package/dist/types/components/pro-contract-template-designer/src/ContractTemplateRendererPage.vue.d.ts +13 -1
  60. package/dist/types/components/pro-contract-template-designer/src/DesignerPage.vue.d.ts +6 -0
  61. package/dist/types/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.d.ts +1 -0
  62. package/dist/types/components/pro-contract-template-designer/src/ProContractTemplateRenderer.vue.d.ts +1 -0
  63. package/dist/types/components/pro-contract-template-designer/src/constants.d.ts +4 -4
  64. package/dist/types/components/pro-contract-template-designer/src/extensions/word-paste.d.ts +8 -0
  65. package/dist/types/components/pro-contract-template-designer/src/types.d.ts +10 -0
  66. package/dist/types/components/pro-contract-template-designer/src/utils/contract-print-document.d.ts +119 -0
  67. package/dist/types/components/pro-contract-template-designer/src/utils/word-paste.d.ts +2 -0
  68. package/package.json +2 -1
@@ -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 e = "Noto Serif SC, Source Han Serif SC, Songti SC, STSong, SimSun, serif", t = [
3
- {
4
- label: "合同宋体",
5
- value: e
6
- },
7
- {
8
- label: "合同楷体",
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
- ], r = [
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
- ], i = [
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 a(e) {
112
- return i.find((t) => t.format === e);
89
+ function s(e) {
90
+ return o.find((t) => t.format === e);
113
91
  }
114
- var o = [
92
+ var c = [
115
93
  {
116
94
  key: "contractTitle",
117
95
  label: "合同标题",
118
96
  headingLevel: 1,
119
97
  fontSize: 26,
120
- fontFamily: e,
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: e,
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: e,
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: e,
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 s(e) {
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 c = Object.fromEntries(o.map((e) => [e.key, s(e)]));
184
- function l(e) {
185
- return o.find((t) => t.key === e);
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 u(e) {
188
- return (c[e] ?? []).map((e) => ({ ...e }));
165
+ function f(e) {
166
+ return (u[e] ?? []).map((e) => ({ ...e }));
189
167
  }
190
- function d(e) {
168
+ function p(e) {
191
169
  return String(e || "").replace(/["']/g, "").replace(/\s*,\s*/g, ",").trim().toLowerCase();
192
170
  }
193
- function f(e, n = "append") {
194
- let r = n === "replace" ? e ?? t : [...t, ...e ?? []], i = /* @__PURE__ */ new Map();
195
- return r.forEach((e) => {
196
- e?.value && i.set(d(e.value), e);
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 { 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 };
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 };
@@ -1,37 +1,37 @@
1
- import "../constants.mjs";
2
- import { resolveTemplateVariablePresentation as e } from "../utils/template-variable-render.mjs";
3
- import { decodeContractTemplateJsonAttribute as t, encodeContractTemplateJsonAttribute as n } from "../utils/advanced-controls.mjs";
4
- import { Node as r, mergeAttributes as i } from "@tiptap/core";
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 a(e, t, n = "") {
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 o(e, t, n) {
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 s(e, t) {
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 c(e, r, i) {
27
+ function l(e, t, i) {
28
28
  return {
29
29
  default: i,
30
- parseHTML: (e) => t(e.getAttribute(r)) ?? i,
31
- renderHTML: (t) => t[e] === void 0 || t[e] === null ? {} : { [r]: n(t[e]) }
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 l = r.create({
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: a("key", "data-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: a("type", "data-variable-type", "text"),
50
- placeholder: a("placeholder", "data-placeholder"),
51
- width: o("width", "data-width", 160),
52
- height: o("height", "data-height", 32),
53
- required: s("required", "data-required"),
54
- defaultValue: a("defaultValue", "data-default-value"),
55
- format: a("format", "data-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: a("checkedText", "data-checked-text"),
73
- uncheckedText: a("uncheckedText", "data-unchecked-text"),
74
- options: c("options", "data-control-options", []),
75
- dataSource: c("dataSource", "data-control-source", void 0),
76
- multiple: s("multiple", "data-multiple"),
77
- componentKey: a("componentKey", "data-component-key"),
78
- componentConfig: c("componentConfig", "data-component-config", {}),
79
- multiline: s("multiline", "data-multiline"),
80
- rows: o("rows", "data-rows", 3),
81
- lineHeight: o("lineHeight", "data-line-height", 28),
82
- border: s("border", "data-border"),
83
- underline: s("underline", "data-underline"),
84
- color: a("color", "data-color", "#1f2937"),
85
- background: a("background", "data-background", "transparent"),
86
- fontSize: o("fontSize", "data-font-size", 14),
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: a("placeholderColor", "data-placeholder-color", "#7a818b"),
93
- lineColor: a("lineColor", "data-line-color", "#565b66"),
94
- textAlign: a("textAlign", "data-text-align", "left"),
95
- borderStyle: a("borderStyle", "data-border-style", "solid"),
96
- objectFit: a("objectFit", "data-object-fit", "contain")
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: t }) {
103
- let n = t["data-border"] ?? t.border, r = t["data-precision"] ?? t.precision, a = r === void 0 || r === "" ? void 0 : Number(r), o = t["data-use-grouping"] ?? t.useGrouping, s = o === void 0 || o === "" ? void 0 : o === !0 || o === "true", c = e({
104
- type: String(t["data-variable-type"] || t.type || "text"),
105
- width: t["data-width"] || t.width || 160,
106
- height: t["data-height"] || t.height || 32,
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: t["data-underline"] === "true" || t.underline === !0,
109
- color: String(t["data-color"] || t.color || "#1f2937"),
110
- background: String(t["data-background"] || t.background || "transparent"),
111
- fontSize: t["data-font-size"] || t.fontSize || 14,
112
- fontFamily: String(t["data-font-family"] || t.fontFamily || ""),
113
- placeholder: String(t["data-placeholder"] || t.placeholder || ""),
114
- defaultValue: String(t["data-default-value"] || t.defaultValue || ""),
115
- format: String(t["data-format"] || t.format || ""),
116
- precision: a,
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(t["data-checked-text"] || t.checkedText || ""),
119
- uncheckedText: String(t["data-unchecked-text"] || t.uncheckedText || ""),
120
- multiline: t["data-multiline"] === "true" || t.multiline === !0,
121
- rows: t["data-rows"] || t.rows || 3,
122
- lineHeight: t["data-line-height"] || t.lineHeight || 28,
123
- placeholderColor: String(t["data-placeholder-color"] || t.placeholderColor || "#7a818b"),
124
- lineColor: String(t["data-line-color"] || t.lineColor || "#565b66"),
125
- textAlign: String(t["data-text-align"] || t.textAlign || "left"),
126
- borderStyle: String(t["data-border-style"] || t.borderStyle || "solid"),
127
- objectFit: String(t["data-object-fit"] || t.objectFit || "contain")
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
- i(t, {
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(t["data-multiline"] === "true" || t.multiline === !0),
139
- "data-rows": String(Math.max(1, Number(t["data-rows"] || t.rows || 3))),
140
- "data-line-height": String(Math.max(18, Number(t["data-line-height"] || t.lineHeight || 28))),
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 u(e) {
157
+ function d(t) {
158
158
  return {
159
- key: e.key,
160
- label: e.label,
161
- type: e.type ?? "text",
162
- placeholder: e.placeholder || "",
163
- width: e.width ?? 160,
164
- height: e.height ?? 32,
165
- required: !!e.required,
166
- defaultValue: e.defaultValue || "",
167
- format: e.format || "",
168
- precision: e.precision,
169
- useGrouping: e.useGrouping,
170
- checkedText: e.checkedText || "",
171
- uncheckedText: e.uncheckedText || "",
172
- options: e.options?.map((e) => ({ ...e })) ?? [],
173
- dataSource: e.dataSource ? { ...e.dataSource } : void 0,
174
- multiple: !!e.multiple,
175
- componentKey: e.componentKey || "",
176
- componentConfig: e.componentConfig ? { ...e.componentConfig } : {},
177
- multiline: !!e.multiline,
178
- rows: Math.max(1, Math.round(e.rows ?? 3)),
179
- lineHeight: Math.max(18, Math.round(e.lineHeight ?? 28)),
180
- border: e.style?.border ?? e.type === "image",
181
- underline: e.style?.underline ?? (e.type !== "image" && e.type !== "checkbox"),
182
- color: e.style?.color || "#1f2937",
183
- background: e.style?.background || "transparent",
184
- fontSize: e.style?.fontSize ?? 14,
185
- fontFamily: e.style?.fontFamily || "Noto Serif SC, Source Han Serif SC, Songti SC, STSong, SimSun, serif",
186
- placeholderColor: e.style?.placeholderColor || "#7a818b",
187
- lineColor: e.style?.lineColor || "#565b66",
188
- textAlign: e.style?.textAlign || "left",
189
- borderStyle: e.style?.borderStyle || "solid",
190
- objectFit: e.style?.objectFit || "contain"
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 d(e, t, n) {
193
+ function f(e, t, n) {
194
194
  if (!e) return !1;
195
195
  let r = {
196
196
  type: "templateVariable",
197
- attrs: u(t)
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 { l as TemplateVariable, u as buildTemplateVariableAttrs, d as insertTemplateVariableNode };
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) => m(e, t, !1),
52
- cut: (e, t) => m(e, t, !0),
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: _(r),
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 : _(s.clipboardData), p = u.recoveredRtfImages || v(u.rtf), m = d.length > 0 && p === 0 && !u.trustedInternal;
74
- if (o.pending = void 0, !m) return !1;
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 y = `word-paste-${++l}`, b = {
77
- token: y,
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
- ...b
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(y);
86
+ let a = f.getState(n.state)?.get(b);
87
87
  if (!a) return;
88
- let o = t.filter((e) => !!e);
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
- }).html : o.length ? `<p>${o.map((t) => `<img src="${e(t)}" alt="">`).join("")}</p>` : i(u.plainText)) || i(u.plainText));
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(y);
99
- e ? g(n, e, i(u.plainText)) : h(n, y);
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 h(e, t) {
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 g(e, t, n) {
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() || h(e, t.token);
131
+ }), e.setMeta("paste", !0), e.setMeta("uiEvent", "paste"), !0)).run() || g(e, t.token);
129
132
  }
130
- function _(e) {
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 v(e) {
144
+ function y(e) {
142
145
  return n(e).length;
143
146
  }
144
147
  //#endregion