@guodun/antdv 1.7.7 → 1.7.9
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/pro-contract-template-designer/src/ContractTemplateChoiceOptionsEditor.mjs +5 -0
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplateChoiceOptionsEditor.vue.mjs +132 -0
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplateDesignerInspector.vue.mjs +209 -246
- package/dist/es/components/pro-contract-template-designer/src/DesignerPage.vue.mjs +395 -325
- package/dist/es/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.mjs +1047 -1015
- package/dist/es/components/pro-contract-template-designer/src/composables/use-auto-pagination.mjs +122 -63
- package/dist/es/components/pro-contract-template-designer/src/composables/use-template-designer.mjs +192 -162
- package/dist/es/components/pro-contract-template-designer/src/extensions/template-variable.mjs +70 -68
- package/dist/es/components/pro-contract-template-designer/src/utils/advanced-controls.mjs +63 -25
- package/dist/es/components/pro-contract-template-designer/src/utils/caret-viewport.mjs +41 -0
- package/dist/es/components/pro-contract-template-designer/src/utils/template-renderer.mjs +129 -75
- package/dist/es/components/pro-contract-template-designer/src/utils/template-variable-render.mjs +17 -5
- package/dist/es/components/pro-contract-template-designer/style/index.css +1 -1
- package/dist/es/index.mjs +22 -22
- package/dist/es/node_modules/@tiptap/pm/dist/transform/index.mjs +1 -0
- package/dist/es/node_modules/prosemirror-transform/dist/index.mjs +161 -67
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateChoiceOptionsEditor.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateChoiceOptionsEditor.vue.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateDesignerInspector.vue.cjs +1 -2
- package/dist/lib/components/pro-contract-template-designer/src/DesignerPage.vue.cjs +2 -2
- package/dist/lib/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/composables/use-auto-pagination.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/composables/use-template-designer.cjs +4 -4
- package/dist/lib/components/pro-contract-template-designer/src/extensions/template-variable.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/utils/advanced-controls.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/utils/caret-viewport.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/utils/template-renderer.cjs +3 -3
- package/dist/lib/components/pro-contract-template-designer/src/utils/template-variable-render.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/style/index.css +1 -1
- package/dist/lib/index.cjs +1 -1
- package/dist/lib/node_modules/@tiptap/pm/dist/transform/index.cjs +1 -0
- package/dist/lib/node_modules/prosemirror-transform/dist/index.cjs +2 -2
- package/dist/theme/icon.css +1 -1
- package/dist/theme/index.css +1 -1
- package/dist/types/components/pro-contract-template-designer/src/ContractTemplateChoiceOptionsEditor.vue.d.ts +12 -0
- package/dist/types/components/pro-contract-template-designer/src/DesignerPage.vue.d.ts +14 -0
- package/dist/types/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.d.ts +2 -0
- package/dist/types/components/pro-contract-template-designer/src/composables/use-auto-pagination.d.ts +17 -0
- package/dist/types/components/pro-contract-template-designer/src/composables/use-template-designer.d.ts +5 -1
- package/dist/types/components/pro-contract-template-designer/src/types.d.ts +15 -2
- package/dist/types/components/pro-contract-template-designer/src/utils/advanced-controls.d.ts +10 -0
- package/dist/types/components/pro-contract-template-designer/src/utils/caret-viewport.d.ts +18 -0
- package/dist/types/components/pro-contract-template-designer/src/utils/template-variable-render.d.ts +7 -0
- package/package.json +5 -5
- package/dist/theme/dept-selector.css +0 -1
- package/dist/theme/pro-selector-group.css +0 -1
- package/dist/theme/role-selector.css +0 -1
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { Fragment as e, computed as t, createCommentVNode as n, createElementBlock as r, createElementVNode as i, createTextVNode as a, createVNode as o, defineComponent as s, normalizeClass as c, openBlock as l, ref as u, renderList as d, toDisplayString as f, unref as p, withCtx as m } from "vue";
|
|
2
|
+
import { Button as h, Input as g } from "ant-design-vue";
|
|
3
|
+
import { ArrowDownOutlined as _, ArrowUpOutlined as v, DeleteOutlined as y, PlusOutlined as b } from "@ant-design/icons-vue";
|
|
4
|
+
//#region src/components/pro-contract-template-designer/src/ContractTemplateChoiceOptionsEditor.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
+
var x = { class: "gd-contract-choice-options" }, S = {
|
|
6
|
+
key: 0,
|
|
7
|
+
class: "gd-contract-choice-options__error"
|
|
8
|
+
}, C = { class: "gd-contract-choice-options__actions" }, w = /* @__PURE__ */ s({
|
|
9
|
+
name: "ContractTemplateChoiceOptionsEditor",
|
|
10
|
+
__name: "ContractTemplateChoiceOptionsEditor",
|
|
11
|
+
props: {
|
|
12
|
+
options: {},
|
|
13
|
+
variableType: {},
|
|
14
|
+
readonly: { type: Boolean }
|
|
15
|
+
},
|
|
16
|
+
emits: ["change"],
|
|
17
|
+
setup(s, { emit: w }) {
|
|
18
|
+
let T = s, E = w, D = u((T.options ?? []).map((e) => ({
|
|
19
|
+
label: e.label ?? "",
|
|
20
|
+
value: String(e.value ?? "")
|
|
21
|
+
}))), O = t(() => D.value.map((e, t) => k(D.value, t)));
|
|
22
|
+
function k(e, t) {
|
|
23
|
+
let n = e[t]?.label.trim() ?? "", r = e[t]?.value.trim() ?? "";
|
|
24
|
+
return n ? r ? e.some((e, n) => n !== t && e.value.trim() === r) ? "选项值不能重复" : "" : "选项值不能为空" : "显示文本不能为空";
|
|
25
|
+
}
|
|
26
|
+
function A() {
|
|
27
|
+
T.readonly || O.value.some(Boolean) || E("change", D.value.map((e) => ({
|
|
28
|
+
value: e.value.trim(),
|
|
29
|
+
label: e.label.trim(),
|
|
30
|
+
type: T.variableType || "select"
|
|
31
|
+
})));
|
|
32
|
+
}
|
|
33
|
+
function j(e, t) {
|
|
34
|
+
T.readonly || (D.value = D.value.map((n, r) => r === e ? {
|
|
35
|
+
...n,
|
|
36
|
+
...t
|
|
37
|
+
} : n), A());
|
|
38
|
+
}
|
|
39
|
+
function M(e, t) {
|
|
40
|
+
if (T.readonly) return;
|
|
41
|
+
let n = e + t;
|
|
42
|
+
if (n < 0 || n >= D.value.length) return;
|
|
43
|
+
let r = D.value.slice(), [i] = r.splice(e, 1);
|
|
44
|
+
r.splice(n, 0, i), D.value = r, A();
|
|
45
|
+
}
|
|
46
|
+
function N(e) {
|
|
47
|
+
T.readonly || (D.value = D.value.filter((t, n) => n !== e), A());
|
|
48
|
+
}
|
|
49
|
+
function P() {
|
|
50
|
+
if (T.readonly) return;
|
|
51
|
+
let e = new Set(D.value.flatMap((e) => [e.label.trim(), e.value.trim()])), t = D.value.length + 1;
|
|
52
|
+
for (; e.has(`选项${t}`) || e.has(`option${t}`);) t += 1;
|
|
53
|
+
D.value = [...D.value, {
|
|
54
|
+
label: `选项${t}`,
|
|
55
|
+
value: `option${t}`
|
|
56
|
+
}], A();
|
|
57
|
+
}
|
|
58
|
+
return (t, u) => (l(), r("div", x, [(l(!0), r(e, null, d(D.value, (e, t) => (l(), r("div", {
|
|
59
|
+
key: t,
|
|
60
|
+
class: c(["gd-contract-choice-options__row", { "is-invalid": !!O.value[t] }])
|
|
61
|
+
}, [
|
|
62
|
+
o(p(g), {
|
|
63
|
+
value: e.label,
|
|
64
|
+
disabled: s.readonly,
|
|
65
|
+
placeholder: "显示文本",
|
|
66
|
+
"aria-label": `选项 ${t + 1} 显示文本`,
|
|
67
|
+
"onUpdate:value": (e) => j(t, { label: String(e ?? "") })
|
|
68
|
+
}, null, 8, [
|
|
69
|
+
"value",
|
|
70
|
+
"disabled",
|
|
71
|
+
"aria-label",
|
|
72
|
+
"onUpdate:value"
|
|
73
|
+
]),
|
|
74
|
+
o(p(g), {
|
|
75
|
+
value: e.value,
|
|
76
|
+
disabled: s.readonly,
|
|
77
|
+
placeholder: "选项值",
|
|
78
|
+
"aria-label": `选项 ${t + 1} 选项值`,
|
|
79
|
+
"onUpdate:value": (e) => j(t, { value: String(e ?? "") })
|
|
80
|
+
}, null, 8, [
|
|
81
|
+
"value",
|
|
82
|
+
"disabled",
|
|
83
|
+
"aria-label",
|
|
84
|
+
"onUpdate:value"
|
|
85
|
+
]),
|
|
86
|
+
O.value[t] ? (l(), r("p", S, f(O.value[t]), 1)) : n("", !0),
|
|
87
|
+
i("div", C, [
|
|
88
|
+
o(p(h), {
|
|
89
|
+
type: "text",
|
|
90
|
+
size: "small",
|
|
91
|
+
disabled: s.readonly || t === 0,
|
|
92
|
+
"aria-label": "上移选项",
|
|
93
|
+
onClick: (e) => M(t, -1)
|
|
94
|
+
}, {
|
|
95
|
+
default: m(() => [o(p(v), { "aria-hidden": "true" })]),
|
|
96
|
+
_: 1
|
|
97
|
+
}, 8, ["disabled", "onClick"]),
|
|
98
|
+
o(p(h), {
|
|
99
|
+
type: "text",
|
|
100
|
+
size: "small",
|
|
101
|
+
disabled: s.readonly || t === D.value.length - 1,
|
|
102
|
+
"aria-label": "下移选项",
|
|
103
|
+
onClick: (e) => M(t, 1)
|
|
104
|
+
}, {
|
|
105
|
+
default: m(() => [o(p(_), { "aria-hidden": "true" })]),
|
|
106
|
+
_: 1
|
|
107
|
+
}, 8, ["disabled", "onClick"]),
|
|
108
|
+
o(p(h), {
|
|
109
|
+
type: "text",
|
|
110
|
+
size: "small",
|
|
111
|
+
danger: "",
|
|
112
|
+
disabled: s.readonly,
|
|
113
|
+
"aria-label": "删除选项",
|
|
114
|
+
onClick: (e) => N(t)
|
|
115
|
+
}, {
|
|
116
|
+
default: m(() => [o(p(y), { "aria-hidden": "true" })]),
|
|
117
|
+
_: 1
|
|
118
|
+
}, 8, ["disabled", "onClick"])
|
|
119
|
+
])
|
|
120
|
+
], 2))), 128)), o(p(h), {
|
|
121
|
+
block: "",
|
|
122
|
+
disabled: s.readonly,
|
|
123
|
+
"aria-label": "添加选项",
|
|
124
|
+
onClick: P
|
|
125
|
+
}, {
|
|
126
|
+
default: m(() => [o(p(b), { "aria-hidden": "true" }), u[0] ||= a(" 添加选项 ", -1)]),
|
|
127
|
+
_: 1
|
|
128
|
+
}, 8, ["disabled"])]));
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
//#endregion
|
|
132
|
+
export { w as default };
|