@web-utils/component 2.7.3 → 2.7.5
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/chunks/AfdColumn.vue_vue_type_template_lang.768f2ed2.js +302 -0
- package/dist/chunks/ConfigArray.vue_vue_type_template_lang.66483daa.js +51 -0
- package/dist/chunks/ConfigColor.vue_vue_type_template_lang.cd880091.js +24 -0
- package/dist/chunks/ConfigCustom.vue_vue_type_template_lang.6e03d7fd.js +52 -0
- package/dist/chunks/ConfigDate.vue_vue_type_template_lang.420fa897.js +104 -0
- package/dist/chunks/ConfigDynamic.vue_vue_type_template_lang.82d24ab0.js +133 -0
- package/dist/chunks/ConfigEvent.vue_vue_type_template_lang.5e8ed6cc.js +96 -0
- package/dist/chunks/ConfigGroup.vue_vue_type_template_lang.44117322.js +48 -0
- package/dist/chunks/ConfigInput.vue_vue_type_template_lang.cc1eb052.js +96 -0
- package/dist/chunks/ConfigMap.vue_vue_type_template_lang.daee4d38.js +31 -0
- package/dist/chunks/ConfigNumber.vue_vue_type_template_lang.d60231d7.js +130 -0
- package/dist/chunks/ConfigRate.vue_vue_type_style_index_0_scoped_true_lang.cf5d437d.js +125 -0
- package/dist/chunks/ConfigSelect.vue_vue_type_template_lang.7db7e57f.js +483 -0
- package/dist/chunks/ConfigSlider.vue_vue_type_template_lang.27b8cc7b.js +99 -0
- package/dist/chunks/ConfigSwitch.vue_vue_type_style_index_0_scoped_true_lang.4caf1bd0.js +54 -0
- package/dist/chunks/ConfigTable.vue_vue_type_template_lang.3e8136d9.js +341 -0
- package/dist/chunks/ConfigTextarea.vue_vue_type_template_lang.5cddf41c.js +88 -0
- package/dist/chunks/ConfigTitle.vue_vue_type_template_lang.57d9deb5.js +87 -0
- package/dist/chunks/ConfigTree.vue_vue_type_style_index_0_scoped_true_lang.3770c37e.js +464 -0
- package/dist/chunks/ConfigUEditor.vue_vue_type_template_lang.9726b4f5.js +240 -0
- package/dist/chunks/ConfigUpload.vue_vue_type_template_lang.531a9b2a.js +471 -0
- package/dist/chunks/FormConfig.vue_vue_type_template_lang.85b4ee87.js +232 -0
- package/dist/chunks/WidgetConfig.vue_vue_type_template_lang.fbbbff76.js +1765 -0
- package/dist/chunks/WidgetForm.vue_vue_type_template_lang.82248338.js +242 -0
- package/dist/chunks/WidgetFormGroup.vue_vue_type_template_lang.c636aabd.js +266 -0
- package/dist/chunks/WidgetFormItem.vue_vue_type_template_lang.48d55a5c.js +24 -0
- package/dist/chunks/WidgetFormTable.vue_vue_type_template_lang.30625146.js +228 -0
- package/dist/chunks/{dataformat.3cfcf62c.js → dataformat.d3fd2d1b.js} +25 -24
- package/dist/chunks/{detail.a3249549.js → detail.ac4d421a.js} +7 -7
- package/dist/chunks/{dic.5f7e3523.js → dic.79d9f595.js} +28 -27
- package/dist/chunks/{event.b76c568a.js → event.43b42228.js} +7 -6
- package/dist/chunks/{init.352281f5.js → init.3b47bb80.js} +8 -7
- package/dist/chunks/monaco.1dbdc960.js +283 -0
- package/dist/chunks/{packages.5d7a86c4.js → packages.6f252850.js} +5 -61
- package/dist/chunks/{util.5053d54e.js → util.80e28481.js} +37 -51
- package/dist/components/afd-column/index.js +54 -0
- package/dist/components/chat/index.js +1 -1
- package/dist/components/code/index.js +1 -1
- package/dist/components/column/index.js +8 -7
- package/dist/components/column-default/index.js +1 -1
- package/dist/components/column-dynamic/index.js +1 -1
- package/dist/components/column-menu/index.js +1 -1
- package/dist/components/column-slot/index.js +27 -26
- package/dist/components/config-array/index.js +26 -0
- package/dist/components/config-color/index.js +26 -0
- package/dist/components/config-custom/index.js +60 -0
- package/dist/components/config-date/index.js +26 -0
- package/dist/components/config-dynamic/index.js +26 -0
- package/dist/components/config-event/index.js +72 -0
- package/dist/components/config-group/index.js +34 -0
- package/dist/components/config-input/index.js +26 -0
- package/dist/components/config-map/index.js +26 -0
- package/dist/components/config-number/index.js +26 -0
- package/dist/components/config-rate/index.js +69 -0
- package/dist/components/config-rate/style.css +1 -0
- package/dist/components/config-select/index.js +88 -0
- package/dist/components/config-slider/index.js +26 -0
- package/dist/components/config-switch/index.js +31 -0
- package/dist/components/config-switch/style.css +1 -0
- package/dist/components/config-table/index.js +120 -0
- package/dist/components/config-textarea/index.js +26 -0
- package/dist/components/config-title/index.js +31 -0
- package/dist/components/config-tree/index.js +120 -0
- package/dist/components/config-tree/style.css +1 -0
- package/dist/components/config-u-editor/index.js +32 -0
- package/dist/components/config-upload/index.js +56 -0
- package/dist/components/custom-scrollbar/index.js +6 -1
- package/dist/components/dialog-excel/index.js +2 -2
- package/dist/components/dialog-filter/index.js +1 -1
- package/dist/components/dialog-form/index.js +8 -7
- package/dist/components/flex-item/index.js +4 -1
- package/dist/components/flow/index.js +1 -1
- package/dist/components/flow-node/index.js +1 -1
- package/dist/components/form-config/index.js +26 -0
- package/dist/components/form-group/index.js +1 -1
- package/dist/components/form-temp/index.js +2 -2
- package/dist/components/{array → fy-array}/index.js +5 -5
- package/dist/components/{array → fy-array}/style.css +0 -0
- package/dist/components/fy-cascader/index.js +1 -1
- package/dist/components/fy-checkbox/index.js +1 -1
- package/dist/components/fy-curd/index.js +7 -6
- package/dist/components/fy-date/index.js +1 -1
- package/dist/components/fy-dialog-form/index.js +9 -8
- package/dist/components/{draggable → fy-draggable}/index.js +2 -2
- package/dist/components/{draggable → fy-draggable}/style.css +0 -0
- package/dist/components/fy-dynamic/index.js +2 -2
- package/dist/components/{empty → fy-empty}/index.js +6 -6
- package/dist/components/{empty → fy-empty}/style.css +0 -0
- package/dist/components/fy-form/index.js +9 -8
- package/dist/components/fy-form-design/index.js +1255 -0
- package/dist/components/fy-form-design/style.css +1 -0
- package/dist/components/fy-input/index.js +1 -1
- package/dist/components/fy-input-color/index.js +1 -1
- package/dist/components/fy-input-icon/index.js +1 -1
- package/dist/components/fy-input-map/index.js +4 -4
- package/dist/components/fy-input-number/index.js +1 -1
- package/dist/components/fy-input-table/index.js +4 -4
- package/dist/components/fy-input-tree/index.js +2 -2
- package/dist/components/fy-radio/index.js +1 -1
- package/dist/components/fy-rate/index.js +1 -1
- package/dist/components/fy-select/index.js +18 -17
- package/dist/components/fy-slider/index.js +2 -2
- package/dist/components/fy-switch/index.js +1 -1
- package/dist/components/fy-time/index.js +2 -2
- package/dist/components/fy-title/index.js +1 -1
- package/dist/components/fy-tree/index.js +7 -6
- package/dist/components/fy-upload/index.js +11 -10
- package/dist/components/header-menu/index.js +1 -1
- package/dist/components/header-search/index.js +2 -2
- package/dist/components/license/index.js +5 -5
- package/dist/components/login/index.js +9 -8
- package/dist/components/record-video/index.js +1 -1
- package/dist/components/search/index.js +10 -9
- package/dist/components/sign/index.js +1 -1
- package/dist/components/table-column/index.js +4 -1
- package/dist/components/table-page/index.js +1 -1
- package/dist/components/text-ellipsis/index.js +1 -1
- package/dist/components/verify/index.js +1 -1
- package/dist/components/watermark/index.js +5 -1
- package/dist/components/widget-config/index.js +107 -0
- package/dist/components/widget-form/index.js +68 -0
- package/dist/components/widget-form-group/index.js +91 -0
- package/dist/components/widget-form-item/index.js +70 -0
- package/dist/components/widget-form-table/index.js +90 -0
- package/dist/index.css +761 -201
- package/dist/index.es.js +24100 -16510
- package/package.json +5 -3
- package/web-types.json +1880 -1781
|
@@ -0,0 +1,1255 @@
|
|
|
1
|
+
import { s as staticRenderFns$3, r as render$3, C as ConfigCustom, a as ConfigInput, b as ConfigTextarea, c as ConfigNumber, d as ConfigDynamic, e as ConfigSwitch, f as ConfigRate, g as ConfigSlider, h as ConfigColor, i as ConfigSelect, j as ConfigTree, k as ConfigDate, l as ConfigUpload, m as ConfigUEditor, n as ConfigMap, o as ConfigGroup, p as ConfigArray, q as ConfigTitle, t as ConfigEvent, u as ConfigTable, v as fields } from "../../chunks/WidgetConfig.vue_vue_type_template_lang.fbbbff76.js";
|
|
2
|
+
import { isBlank } from "@web-utils/core";
|
|
3
|
+
import { c as convert, M as MonacoEditor } from "../../chunks/monaco.1dbdc960.js";
|
|
4
|
+
import { d as deepClone } from "../../chunks/util.80e28481.js";
|
|
5
|
+
import Draggable from "vuedraggable";
|
|
6
|
+
import { W as WidgetFormItem } from "../../chunks/WidgetFormTable.vue_vue_type_template_lang.30625146.js";
|
|
7
|
+
import { W as WidgetFormTable } from "../../chunks/WidgetFormGroup.vue_vue_type_template_lang.c636aabd.js";
|
|
8
|
+
import { s as staticRenderFns$1, r as render$1, W as WidgetFormGroup } from "../../chunks/WidgetForm.vue_vue_type_template_lang.82248338.js";
|
|
9
|
+
import { n as normalizeComponent } from "../../chunks/vueComponentNormalizer.71e2aa87.js";
|
|
10
|
+
import { s as staticRenderFns$2, r as render$2 } from "../../chunks/FormConfig.vue_vue_type_template_lang.85b4ee87.js";
|
|
11
|
+
const widgetEmpty = "data:image/png;base64,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", history = {
|
|
12
|
+
data() {
|
|
13
|
+
return {
|
|
14
|
+
historySteps: {
|
|
15
|
+
index: 0,
|
|
16
|
+
maxStep: 20,
|
|
17
|
+
steps: [],
|
|
18
|
+
storage: !1
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
},
|
|
22
|
+
watch: {
|
|
23
|
+
historySteps: {
|
|
24
|
+
handler(t) {
|
|
25
|
+
t.storage ? localStorage.setItem("avue-form-history", convert(t)) : localStorage.removeItem("avue-form-history");
|
|
26
|
+
},
|
|
27
|
+
deep: !0
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
methods: {
|
|
31
|
+
initHistory(data) {
|
|
32
|
+
if (data.storage) {
|
|
33
|
+
const history = localStorage.getItem("avue-form-history");
|
|
34
|
+
if (history) {
|
|
35
|
+
this.historySteps = eval("(" + history + ")");
|
|
36
|
+
const { index, steps } = this.historySteps;
|
|
37
|
+
return deepClone(steps[index]);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
this.historySteps = {
|
|
41
|
+
...this.historySteps,
|
|
42
|
+
...data
|
|
43
|
+
};
|
|
44
|
+
const { index, steps } = this.historySteps;
|
|
45
|
+
return deepClone(steps[index]);
|
|
46
|
+
},
|
|
47
|
+
handleHistoryChange(t) {
|
|
48
|
+
this.historySteps.index == this.historySteps.maxStep - 1 ? this.historySteps.steps.shift() : this.historySteps.index++, this.historySteps.steps[this.historySteps.index] = deepClone(t), this.historySteps.index < this.historySteps.steps.length - 1 && (this.historySteps.steps = this.historySteps.steps.slice(0, this.historySteps.index + 1));
|
|
49
|
+
},
|
|
50
|
+
handleUndo() {
|
|
51
|
+
return this.historySteps.index != 0 && this.historySteps.index--, deepClone(this.historySteps.steps[this.historySteps.index]);
|
|
52
|
+
},
|
|
53
|
+
handleRedo() {
|
|
54
|
+
return this.historySteps.index != this.historySteps.steps.length - 1 && this.historySteps.index++, deepClone(this.historySteps.steps[this.historySteps.index]);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}, __vue2_script$3 = {
|
|
58
|
+
name: "WidgetForm",
|
|
59
|
+
components: { Draggable, WidgetFormItem, WidgetFormTable, WidgetFormGroup },
|
|
60
|
+
props: ["data", "select"],
|
|
61
|
+
data() {
|
|
62
|
+
return {
|
|
63
|
+
selectWidget: this.select,
|
|
64
|
+
form: {}
|
|
65
|
+
};
|
|
66
|
+
},
|
|
67
|
+
watch: {
|
|
68
|
+
select(t) {
|
|
69
|
+
this.selectWidget = t;
|
|
70
|
+
},
|
|
71
|
+
selectWidget: {
|
|
72
|
+
handler(t) {
|
|
73
|
+
this.$emit("update:select", t);
|
|
74
|
+
},
|
|
75
|
+
deep: !0
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
methods: {
|
|
79
|
+
handleSelectWidget(t) {
|
|
80
|
+
this.selectWidget = this.data.column[t];
|
|
81
|
+
},
|
|
82
|
+
handleWidgetAdd(t) {
|
|
83
|
+
const n = t.newIndex, o = deepClone(this.data.column[n]);
|
|
84
|
+
o.prop || (o.prop = "a" + Date.now() + Math.ceil(Math.random() * 99999)), delete o.icon, delete o.subfield, o.type === "title" && (delete o.label, this.form[o.prop] = o.value), this.$set(this.data.column, n, o), this.handleSelectWidget(n), this.$emit("change");
|
|
85
|
+
},
|
|
86
|
+
handleWidgetDelete(t) {
|
|
87
|
+
this.data.column.length - 1 === t ? t === 0 ? this.selectWidget = {} : this.handleSelectWidget(t - 1) : this.handleSelectWidget(t + 1), this.$nextTick(() => {
|
|
88
|
+
this.data.column.splice(t, 1), this.$emit("change");
|
|
89
|
+
});
|
|
90
|
+
},
|
|
91
|
+
handleWidgetClone(t) {
|
|
92
|
+
let n = deepClone(this.data.column[t]);
|
|
93
|
+
n.prop = "a" + Date.now() + Math.ceil(Math.random() * 99999), this.data.column.push(n), this.$nextTick(() => {
|
|
94
|
+
this.handleSelectWidget(this.data.column.length - 1), this.$emit("change");
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}, __cssModules$3 = {};
|
|
99
|
+
var __component__$3 = /* @__PURE__ */ normalizeComponent(
|
|
100
|
+
__vue2_script$3,
|
|
101
|
+
render$1,
|
|
102
|
+
staticRenderFns$1,
|
|
103
|
+
!1,
|
|
104
|
+
__vue2_injectStyles$3,
|
|
105
|
+
null,
|
|
106
|
+
null,
|
|
107
|
+
null
|
|
108
|
+
);
|
|
109
|
+
function __vue2_injectStyles$3(t) {
|
|
110
|
+
for (let n in __cssModules$3)
|
|
111
|
+
this[n] = __cssModules$3[n];
|
|
112
|
+
}
|
|
113
|
+
const WidgetForm = /* @__PURE__ */ function() {
|
|
114
|
+
return __component__$3.exports;
|
|
115
|
+
}(), __vue2_script$2 = {
|
|
116
|
+
name: "FormConfig",
|
|
117
|
+
props: ["data"]
|
|
118
|
+
}, __cssModules$2 = {};
|
|
119
|
+
var __component__$2 = /* @__PURE__ */ normalizeComponent(
|
|
120
|
+
__vue2_script$2,
|
|
121
|
+
render$2,
|
|
122
|
+
staticRenderFns$2,
|
|
123
|
+
!1,
|
|
124
|
+
__vue2_injectStyles$2,
|
|
125
|
+
null,
|
|
126
|
+
null,
|
|
127
|
+
null
|
|
128
|
+
);
|
|
129
|
+
function __vue2_injectStyles$2(t) {
|
|
130
|
+
for (let n in __cssModules$2)
|
|
131
|
+
this[n] = __cssModules$2[n];
|
|
132
|
+
}
|
|
133
|
+
const FormConfig = /* @__PURE__ */ function() {
|
|
134
|
+
return __component__$2.exports;
|
|
135
|
+
}(), dateArr = [
|
|
136
|
+
"year",
|
|
137
|
+
"month",
|
|
138
|
+
"week",
|
|
139
|
+
"date",
|
|
140
|
+
"datetime",
|
|
141
|
+
"time",
|
|
142
|
+
"daterange",
|
|
143
|
+
"timerange",
|
|
144
|
+
"datetimerange",
|
|
145
|
+
"dates"
|
|
146
|
+
], __vue2_script$1 = {
|
|
147
|
+
name: "WidgetConfig",
|
|
148
|
+
components: {
|
|
149
|
+
ConfigCustom,
|
|
150
|
+
ConfigInput,
|
|
151
|
+
ConfigTextarea,
|
|
152
|
+
ConfigNumber,
|
|
153
|
+
ConfigDynamic,
|
|
154
|
+
ConfigSwitch,
|
|
155
|
+
ConfigRate,
|
|
156
|
+
ConfigSlider,
|
|
157
|
+
ConfigColor,
|
|
158
|
+
ConfigSelect,
|
|
159
|
+
ConfigTree,
|
|
160
|
+
ConfigDate,
|
|
161
|
+
ConfigUpload,
|
|
162
|
+
ConfigUEditor,
|
|
163
|
+
ConfigMap,
|
|
164
|
+
ConfigGroup,
|
|
165
|
+
ConfigArray,
|
|
166
|
+
ConfigTitle,
|
|
167
|
+
ConfigEvent,
|
|
168
|
+
ConfigTable
|
|
169
|
+
},
|
|
170
|
+
props: ["data", "defaultValues"],
|
|
171
|
+
data() {
|
|
172
|
+
return {
|
|
173
|
+
fields,
|
|
174
|
+
collapse: ["1", "2", "3"],
|
|
175
|
+
validator: {
|
|
176
|
+
type: null,
|
|
177
|
+
required: null,
|
|
178
|
+
pattern: null,
|
|
179
|
+
length: null
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
},
|
|
183
|
+
computed: {
|
|
184
|
+
getComponent() {
|
|
185
|
+
const t = "config-", { type: n, component: o } = this.data;
|
|
186
|
+
if ((!n || o) && n != "ueditor")
|
|
187
|
+
return t + "custom";
|
|
188
|
+
let s = "input";
|
|
189
|
+
return [void 0, "input", "password", "url"].includes(n) ? s = "input" : dateArr.includes(n) ? s = "date" : ["array", "img"].includes(n) ? s = "array" : ["tree", "cascader"].includes(n) ? s = "tree" : ["radio", "checkbox", "select"].includes(n) ? s = "select" : s = n, t + s;
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
watch: {
|
|
193
|
+
"data.required"(t) {
|
|
194
|
+
t ? this.validator.required = { required: !0, message: `${this.data.label}必须填写` } : this.validator.required = null, this.generateRule();
|
|
195
|
+
},
|
|
196
|
+
"data.pattern"(t) {
|
|
197
|
+
t ? this.validator.pattern = { pattern: new RegExp(t), message: `${this.data.label}格式不匹配` } : this.validator.pattern = null, this.generateRule();
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
methods: {
|
|
201
|
+
handleChangeType(t) {
|
|
202
|
+
if (!t)
|
|
203
|
+
return;
|
|
204
|
+
let n;
|
|
205
|
+
for (let o of this.fields)
|
|
206
|
+
if (n = o.list.find((s) => s.type == t), n)
|
|
207
|
+
break;
|
|
208
|
+
if (n)
|
|
209
|
+
for (let o in n)
|
|
210
|
+
n && Object.prototype.hasOwnProperty.call(n, o) && !["icon", "label", "span"].includes(o) && (this.data[o] = n[o]);
|
|
211
|
+
},
|
|
212
|
+
generateRule() {
|
|
213
|
+
const t = [];
|
|
214
|
+
Object.keys(this.validator).forEach((n) => {
|
|
215
|
+
this.validator[n] && t.push(this.validator[n]);
|
|
216
|
+
}), t.length == 0 ? delete this.data.rules : this.data.rules = t;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}, __cssModules$1 = {};
|
|
220
|
+
var __component__$1 = /* @__PURE__ */ normalizeComponent(
|
|
221
|
+
__vue2_script$1,
|
|
222
|
+
render$3,
|
|
223
|
+
staticRenderFns$3,
|
|
224
|
+
!1,
|
|
225
|
+
__vue2_injectStyles$1,
|
|
226
|
+
null,
|
|
227
|
+
null,
|
|
228
|
+
null
|
|
229
|
+
);
|
|
230
|
+
function __vue2_injectStyles$1(t) {
|
|
231
|
+
for (let n in __cssModules$1)
|
|
232
|
+
this[n] = __cssModules$1[n];
|
|
233
|
+
}
|
|
234
|
+
const WidgetConfig = /* @__PURE__ */ function() {
|
|
235
|
+
return __component__$1.exports;
|
|
236
|
+
}();
|
|
237
|
+
var render = function() {
|
|
238
|
+
var t = this, n = t.$createElement, o = t._self._c || n;
|
|
239
|
+
return o("div", {
|
|
240
|
+
staticClass: "form-designer"
|
|
241
|
+
}, [o("ElContainer", [o("ElAside", {
|
|
242
|
+
attrs: {
|
|
243
|
+
width: t.leftWidth
|
|
244
|
+
}
|
|
245
|
+
}, [o("div", {
|
|
246
|
+
staticClass: "fields-list"
|
|
247
|
+
}, [t.customFields && t.customFields.length > 0 ? [t.customFields[0].title && t.customFields[0].list && t.customFields[0].list.length > 0 ? [t._l(t.customFields, function(s, a) {
|
|
248
|
+
return [o("div", {
|
|
249
|
+
key: "f_" + a,
|
|
250
|
+
staticClass: "field-title"
|
|
251
|
+
}, [t._v(" " + t._s(s.title) + " ")]), o("Draggable", {
|
|
252
|
+
key: "d_" + a,
|
|
253
|
+
attrs: {
|
|
254
|
+
tag: "ul",
|
|
255
|
+
list: s.list,
|
|
256
|
+
group: {
|
|
257
|
+
name: "form",
|
|
258
|
+
pull: "clone",
|
|
259
|
+
put: !1
|
|
260
|
+
},
|
|
261
|
+
"ghost-class": "ghost",
|
|
262
|
+
sort: !1
|
|
263
|
+
}
|
|
264
|
+
}, [t._l(s.list, function(r, l) {
|
|
265
|
+
return [o("li", {
|
|
266
|
+
key: "c_" + l,
|
|
267
|
+
staticClass: "field-label"
|
|
268
|
+
}, [o("a", {
|
|
269
|
+
on: {
|
|
270
|
+
click: function(c) {
|
|
271
|
+
return t.handleFieldClick(r);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}, [o("i", {
|
|
275
|
+
staticClass: "icon iconfont",
|
|
276
|
+
class: r.icon
|
|
277
|
+
}), o("span", [t._v(t._s(r.title || r.label))])])])];
|
|
278
|
+
})], 2)];
|
|
279
|
+
})] : [o("ElLink", {
|
|
280
|
+
staticClass: "field-title",
|
|
281
|
+
attrs: {
|
|
282
|
+
underline: !1,
|
|
283
|
+
href: "https://github.com/sscfaith/avue-form-design/blob/master/CHANGELOG.md#2020-09-22",
|
|
284
|
+
target: "_blank"
|
|
285
|
+
}
|
|
286
|
+
}, [t._v(" 自定义字段 "), o("i", {
|
|
287
|
+
staticClass: "el-icon-question"
|
|
288
|
+
})]), o("Draggable", {
|
|
289
|
+
attrs: {
|
|
290
|
+
tag: "ul",
|
|
291
|
+
list: t.customFields,
|
|
292
|
+
group: {
|
|
293
|
+
name: "form",
|
|
294
|
+
pull: "clone",
|
|
295
|
+
put: !1
|
|
296
|
+
},
|
|
297
|
+
"ghost-class": "ghost",
|
|
298
|
+
sort: !1
|
|
299
|
+
}
|
|
300
|
+
}, [t._l(t.customFields, function(s, a) {
|
|
301
|
+
return [s.tips ? o("ElTooltip", {
|
|
302
|
+
key: a,
|
|
303
|
+
attrs: {
|
|
304
|
+
effect: "dark",
|
|
305
|
+
content: s.tips
|
|
306
|
+
}
|
|
307
|
+
}, [o("li", {
|
|
308
|
+
key: a,
|
|
309
|
+
staticClass: "field-label"
|
|
310
|
+
}, [o("a", {
|
|
311
|
+
staticStyle: {
|
|
312
|
+
padding: "0 5px"
|
|
313
|
+
},
|
|
314
|
+
on: {
|
|
315
|
+
click: function(r) {
|
|
316
|
+
return t.handleFieldClick(s);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}, [o("i", {
|
|
320
|
+
class: s.icon
|
|
321
|
+
}), o("span", {
|
|
322
|
+
staticStyle: {
|
|
323
|
+
"margin-left": "5px"
|
|
324
|
+
}
|
|
325
|
+
}, [t._v(t._s(s.title || s.label))])])])]) : o("li", {
|
|
326
|
+
key: a,
|
|
327
|
+
staticClass: "field-label"
|
|
328
|
+
}, [o("a", {
|
|
329
|
+
staticStyle: {
|
|
330
|
+
padding: "0 5px"
|
|
331
|
+
},
|
|
332
|
+
on: {
|
|
333
|
+
click: function(r) {
|
|
334
|
+
return t.handleFieldClick(s);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}, [o("i", {
|
|
338
|
+
class: s.icon
|
|
339
|
+
}), o("span", {
|
|
340
|
+
staticStyle: {
|
|
341
|
+
"margin-left": "5px"
|
|
342
|
+
}
|
|
343
|
+
}, [t._v(t._s(s.title || s.label))])])])];
|
|
344
|
+
})], 2)]] : t._e(), t._l(t.fields, function(s, a) {
|
|
345
|
+
return o("div", {
|
|
346
|
+
key: a
|
|
347
|
+
}, [s.list.find(function(r) {
|
|
348
|
+
return t.includeFields.includes(r.type);
|
|
349
|
+
}) ? [o("div", {
|
|
350
|
+
staticClass: "field-title"
|
|
351
|
+
}, [t._v(" " + t._s(s.title) + " ")]), o("Draggable", {
|
|
352
|
+
attrs: {
|
|
353
|
+
tag: "ul",
|
|
354
|
+
list: s.list,
|
|
355
|
+
group: {
|
|
356
|
+
name: "form",
|
|
357
|
+
pull: "clone",
|
|
358
|
+
put: !1
|
|
359
|
+
},
|
|
360
|
+
"ghost-class": "ghost",
|
|
361
|
+
sort: !1
|
|
362
|
+
}
|
|
363
|
+
}, [t._l(s.list, function(r, l) {
|
|
364
|
+
return [t.includeFields.includes(r.type) ? o("li", {
|
|
365
|
+
key: "c_" + l,
|
|
366
|
+
staticClass: "field-label"
|
|
367
|
+
}, [o("a", {
|
|
368
|
+
on: {
|
|
369
|
+
click: function(c) {
|
|
370
|
+
return t.handleFieldClick(r);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
}, [o("i", {
|
|
374
|
+
staticClass: "icon iconfont",
|
|
375
|
+
class: r.icon
|
|
376
|
+
}), o("span", [t._v(t._s(r.title || r.label))])])]) : t._e()];
|
|
377
|
+
})], 2)] : t._e()], 2);
|
|
378
|
+
})], 2)]), o("ElContainer", {
|
|
379
|
+
staticClass: "widget-container",
|
|
380
|
+
attrs: {
|
|
381
|
+
direction: "vertical"
|
|
382
|
+
}
|
|
383
|
+
}, [o("ElHeader", {
|
|
384
|
+
staticClass: "widget-container-header"
|
|
385
|
+
}, [o("div", [t.undoRedo ? [o("ElButton", {
|
|
386
|
+
attrs: {
|
|
387
|
+
type: "text",
|
|
388
|
+
size: "medium",
|
|
389
|
+
icon: "el-icon-refresh-left",
|
|
390
|
+
disabled: t.historySteps.index === 0
|
|
391
|
+
},
|
|
392
|
+
on: {
|
|
393
|
+
click: function(s) {
|
|
394
|
+
t.widgetForm = t.handleUndo();
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
}, [t._v(" 撤销 ")]), o("ElButton", {
|
|
398
|
+
attrs: {
|
|
399
|
+
type: "text",
|
|
400
|
+
size: "medium",
|
|
401
|
+
icon: "el-icon-refresh-right",
|
|
402
|
+
disabled: t.historySteps.index === t.historySteps.steps.length - 1
|
|
403
|
+
},
|
|
404
|
+
on: {
|
|
405
|
+
click: function(s) {
|
|
406
|
+
t.widgetForm = t.handleRedo();
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
}, [t._v(" 重做 ")])] : t._e()], 2), o("div", {
|
|
410
|
+
staticStyle: {
|
|
411
|
+
display: "flex",
|
|
412
|
+
"align-items": "center"
|
|
413
|
+
}
|
|
414
|
+
}, [t.showGithubStar ? o("iframe", {
|
|
415
|
+
staticStyle: {
|
|
416
|
+
"margin-left": "10px"
|
|
417
|
+
},
|
|
418
|
+
attrs: {
|
|
419
|
+
src: "https://ghbtns.com/github-btn.html?user=sscfaith&repo=avue-form-design&type=star&count=true",
|
|
420
|
+
frameborder: "0",
|
|
421
|
+
scrolling: "0",
|
|
422
|
+
width: "100",
|
|
423
|
+
height: "20",
|
|
424
|
+
title: "GitHub"
|
|
425
|
+
}
|
|
426
|
+
}) : t._e(), t._t("toolbar-left"), t.toolbar.includes("avue-doc") ? o("ElButton", {
|
|
427
|
+
attrs: {
|
|
428
|
+
type: "text",
|
|
429
|
+
size: "medium",
|
|
430
|
+
icon: "el-icon-document"
|
|
431
|
+
},
|
|
432
|
+
on: {
|
|
433
|
+
click: t.handleAvueDoc
|
|
434
|
+
}
|
|
435
|
+
}, [t._v(" Avue文档 ")]) : t._e(), t.toolbar.includes("import") ? o("ElButton", {
|
|
436
|
+
attrs: {
|
|
437
|
+
type: "text",
|
|
438
|
+
size: "medium",
|
|
439
|
+
icon: "el-icon-upload2"
|
|
440
|
+
},
|
|
441
|
+
on: {
|
|
442
|
+
click: function(s) {
|
|
443
|
+
t.importJsonVisible = !0;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
}, [t._v(" 导入JSON ")]) : t._e(), t.toolbar.includes("generate") ? o("ElButton", {
|
|
447
|
+
attrs: {
|
|
448
|
+
type: "text",
|
|
449
|
+
size: "medium",
|
|
450
|
+
icon: "el-icon-download"
|
|
451
|
+
},
|
|
452
|
+
on: {
|
|
453
|
+
click: t.handleGenerateJson
|
|
454
|
+
}
|
|
455
|
+
}, [t._v(" 生成JSON ")]) : t._e(), t.toolbar.includes("preview") ? o("ElButton", {
|
|
456
|
+
attrs: {
|
|
457
|
+
type: "text",
|
|
458
|
+
size: "medium",
|
|
459
|
+
icon: "el-icon-view"
|
|
460
|
+
},
|
|
461
|
+
on: {
|
|
462
|
+
click: t.handlePreview
|
|
463
|
+
}
|
|
464
|
+
}, [t._v(" 预览 ")]) : t._e(), t.toolbar.includes("clear") ? o("ElButton", {
|
|
465
|
+
staticClass: "danger",
|
|
466
|
+
attrs: {
|
|
467
|
+
type: "text",
|
|
468
|
+
size: "medium",
|
|
469
|
+
icon: "el-icon-delete"
|
|
470
|
+
},
|
|
471
|
+
on: {
|
|
472
|
+
click: t.handleClear
|
|
473
|
+
}
|
|
474
|
+
}, [t._v(" 清空 ")]) : t._e(), t._t("toolbar")], 2)]), o("ElMain", {
|
|
475
|
+
style: {
|
|
476
|
+
background: t.widgetForm.column.length === 0 ? `url(${t.widgetEmpty}) no-repeat 50%` : ""
|
|
477
|
+
}
|
|
478
|
+
}, [o("WidgetForm", {
|
|
479
|
+
ref: "widgetForm",
|
|
480
|
+
attrs: {
|
|
481
|
+
data: t.widgetForm,
|
|
482
|
+
select: t.widgetFormSelect
|
|
483
|
+
},
|
|
484
|
+
on: {
|
|
485
|
+
"update:select": function(s) {
|
|
486
|
+
t.widgetFormSelect = s;
|
|
487
|
+
},
|
|
488
|
+
change: function(s) {
|
|
489
|
+
return t.handleHistoryChange(t.widgetForm);
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
})], 1)], 1), o("ElAside", {
|
|
493
|
+
staticClass: "widget-config-container",
|
|
494
|
+
attrs: {
|
|
495
|
+
width: t.rightWidth
|
|
496
|
+
}
|
|
497
|
+
}, [o("ElTabs", {
|
|
498
|
+
attrs: {
|
|
499
|
+
stretch: ""
|
|
500
|
+
},
|
|
501
|
+
model: {
|
|
502
|
+
value: t.configTab,
|
|
503
|
+
callback: function(s) {
|
|
504
|
+
t.configTab = s;
|
|
505
|
+
},
|
|
506
|
+
expression: "configTab"
|
|
507
|
+
}
|
|
508
|
+
}, [o("ElTabPane", {
|
|
509
|
+
staticStyle: {
|
|
510
|
+
padding: "0 10px"
|
|
511
|
+
},
|
|
512
|
+
attrs: {
|
|
513
|
+
label: "字段属性",
|
|
514
|
+
name: "widget"
|
|
515
|
+
}
|
|
516
|
+
}, [o("WidgetConfig", {
|
|
517
|
+
attrs: {
|
|
518
|
+
data: t.widgetFormSelect,
|
|
519
|
+
"default-values": t.defaultValues
|
|
520
|
+
}
|
|
521
|
+
})], 1), o("ElTabPane", {
|
|
522
|
+
staticStyle: {
|
|
523
|
+
padding: "0 10px"
|
|
524
|
+
},
|
|
525
|
+
attrs: {
|
|
526
|
+
label: "表单属性",
|
|
527
|
+
name: "form",
|
|
528
|
+
lazy: ""
|
|
529
|
+
}
|
|
530
|
+
}, [o("FormConfig", {
|
|
531
|
+
attrs: {
|
|
532
|
+
data: t.widgetForm
|
|
533
|
+
}
|
|
534
|
+
})], 1)], 1)], 1), o("ElDrawer", {
|
|
535
|
+
attrs: {
|
|
536
|
+
title: "导入JSON",
|
|
537
|
+
visible: t.importJsonVisible,
|
|
538
|
+
size: "50%",
|
|
539
|
+
"append-to-body": "",
|
|
540
|
+
"destroy-on-close": ""
|
|
541
|
+
},
|
|
542
|
+
on: {
|
|
543
|
+
"update:visible": function(s) {
|
|
544
|
+
t.importJsonVisible = s;
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
}, [o("MonacoEditor", {
|
|
548
|
+
attrs: {
|
|
549
|
+
"key-index": "import",
|
|
550
|
+
height: "82%"
|
|
551
|
+
},
|
|
552
|
+
model: {
|
|
553
|
+
value: t.importJson,
|
|
554
|
+
callback: function(s) {
|
|
555
|
+
t.importJson = s;
|
|
556
|
+
},
|
|
557
|
+
expression: "importJson"
|
|
558
|
+
}
|
|
559
|
+
}), o("div", {
|
|
560
|
+
staticClass: "afd-drawer-foot"
|
|
561
|
+
}, [o("ElButton", {
|
|
562
|
+
attrs: {
|
|
563
|
+
size: "medium",
|
|
564
|
+
type: "primary"
|
|
565
|
+
},
|
|
566
|
+
on: {
|
|
567
|
+
click: t.handleImportJsonSubmit
|
|
568
|
+
}
|
|
569
|
+
}, [t._v(" 确定 ")]), o("ElButton", {
|
|
570
|
+
attrs: {
|
|
571
|
+
size: "medium",
|
|
572
|
+
type: "danger"
|
|
573
|
+
},
|
|
574
|
+
on: {
|
|
575
|
+
click: function(s) {
|
|
576
|
+
t.importJsonVisible = !1;
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
}, [t._v(" 取消 ")])], 1)], 1), o("ElDrawer", {
|
|
580
|
+
attrs: {
|
|
581
|
+
title: "生成JSON",
|
|
582
|
+
visible: t.generateJsonVisible,
|
|
583
|
+
size: "50%",
|
|
584
|
+
"append-to-body": "",
|
|
585
|
+
"destroy-on-close": ""
|
|
586
|
+
},
|
|
587
|
+
on: {
|
|
588
|
+
"update:visible": function(s) {
|
|
589
|
+
t.generateJsonVisible = s;
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
}, [o("MonacoEditor", {
|
|
593
|
+
attrs: {
|
|
594
|
+
"key-index": "generate",
|
|
595
|
+
height: "82%",
|
|
596
|
+
"read-only": !0
|
|
597
|
+
},
|
|
598
|
+
model: {
|
|
599
|
+
value: t.option,
|
|
600
|
+
callback: function(s) {
|
|
601
|
+
t.option = s;
|
|
602
|
+
},
|
|
603
|
+
expression: "option"
|
|
604
|
+
}
|
|
605
|
+
}), o("div", {
|
|
606
|
+
staticClass: "afd-drawer-foot"
|
|
607
|
+
}, [o("ElButton", {
|
|
608
|
+
attrs: {
|
|
609
|
+
size: "medium",
|
|
610
|
+
type: "primary"
|
|
611
|
+
},
|
|
612
|
+
on: {
|
|
613
|
+
click: t.handleGenerate
|
|
614
|
+
}
|
|
615
|
+
}, [t._v(" 生成 ")]), o("ElPopover", {
|
|
616
|
+
attrs: {
|
|
617
|
+
placement: "top",
|
|
618
|
+
trigger: "hover",
|
|
619
|
+
width: "350px"
|
|
620
|
+
}
|
|
621
|
+
}, [o("ElForm", {
|
|
622
|
+
staticStyle: {
|
|
623
|
+
padding: "0 20px"
|
|
624
|
+
},
|
|
625
|
+
attrs: {
|
|
626
|
+
"label-suffix": ":",
|
|
627
|
+
"label-width": "180px",
|
|
628
|
+
"label-position": "left"
|
|
629
|
+
},
|
|
630
|
+
model: {
|
|
631
|
+
value: t.configOption,
|
|
632
|
+
callback: function(s) {
|
|
633
|
+
t.configOption = s;
|
|
634
|
+
},
|
|
635
|
+
expression: "configOption"
|
|
636
|
+
}
|
|
637
|
+
}, [o("ElFormItem", {
|
|
638
|
+
attrs: {
|
|
639
|
+
label: "类型"
|
|
640
|
+
}
|
|
641
|
+
}, [o("ElPopover", {
|
|
642
|
+
staticStyle: {
|
|
643
|
+
"margin-right": "15px"
|
|
644
|
+
},
|
|
645
|
+
attrs: {
|
|
646
|
+
placement: "top-start",
|
|
647
|
+
trigger: "hover",
|
|
648
|
+
content: "复制json对象"
|
|
649
|
+
}
|
|
650
|
+
}, [o("ElRadio", {
|
|
651
|
+
attrs: {
|
|
652
|
+
slot: "reference",
|
|
653
|
+
label: "json"
|
|
654
|
+
},
|
|
655
|
+
slot: "reference",
|
|
656
|
+
model: {
|
|
657
|
+
value: t.configOption.generateType,
|
|
658
|
+
callback: function(s) {
|
|
659
|
+
t.$set(t.configOption, "generateType", s);
|
|
660
|
+
},
|
|
661
|
+
expression: "configOption.generateType"
|
|
662
|
+
}
|
|
663
|
+
}, [t._v(" json ")])], 1), o("ElPopover", {
|
|
664
|
+
attrs: {
|
|
665
|
+
placement: "top-start",
|
|
666
|
+
trigger: "hover",
|
|
667
|
+
content: "复制string字符串,可直接用于后端保存无需再次处理。"
|
|
668
|
+
}
|
|
669
|
+
}, [o("ElRadio", {
|
|
670
|
+
attrs: {
|
|
671
|
+
slot: "reference",
|
|
672
|
+
label: "string"
|
|
673
|
+
},
|
|
674
|
+
slot: "reference",
|
|
675
|
+
model: {
|
|
676
|
+
value: t.configOption.generateType,
|
|
677
|
+
callback: function(s) {
|
|
678
|
+
t.$set(t.configOption, "generateType", s);
|
|
679
|
+
},
|
|
680
|
+
expression: "configOption.generateType"
|
|
681
|
+
}
|
|
682
|
+
}, [t._v(" string ")])], 1)], 1), o("ElFormItem", {
|
|
683
|
+
attrs: {
|
|
684
|
+
label: "缩进长度-空格数量"
|
|
685
|
+
}
|
|
686
|
+
}, [o("ElSlider", {
|
|
687
|
+
attrs: {
|
|
688
|
+
"show-stops": "",
|
|
689
|
+
marks: {
|
|
690
|
+
1: "1",
|
|
691
|
+
2: "2",
|
|
692
|
+
3: "3",
|
|
693
|
+
4: "4"
|
|
694
|
+
},
|
|
695
|
+
min: 1,
|
|
696
|
+
max: 4,
|
|
697
|
+
step: 1
|
|
698
|
+
},
|
|
699
|
+
model: {
|
|
700
|
+
value: t.configOption.space,
|
|
701
|
+
callback: function(s) {
|
|
702
|
+
t.$set(t.configOption, "space", s);
|
|
703
|
+
},
|
|
704
|
+
expression: "configOption.space"
|
|
705
|
+
}
|
|
706
|
+
})], 1), o("ElFormItem", {
|
|
707
|
+
attrs: {
|
|
708
|
+
label: "引号类型"
|
|
709
|
+
}
|
|
710
|
+
}, [o("ElSwitch", {
|
|
711
|
+
attrs: {
|
|
712
|
+
"active-value": "single",
|
|
713
|
+
"inactive-value": "double",
|
|
714
|
+
"active-text": "单引号",
|
|
715
|
+
"inactive-text": "双引号"
|
|
716
|
+
},
|
|
717
|
+
model: {
|
|
718
|
+
value: t.configOption.quoteType,
|
|
719
|
+
callback: function(s) {
|
|
720
|
+
t.$set(t.configOption, "quoteType", s);
|
|
721
|
+
},
|
|
722
|
+
expression: "configOption.quoteType"
|
|
723
|
+
}
|
|
724
|
+
})], 1), o("ElFormItem", {
|
|
725
|
+
attrs: {
|
|
726
|
+
label: "移除key的引号"
|
|
727
|
+
}
|
|
728
|
+
}, [o("ElSwitch", {
|
|
729
|
+
model: {
|
|
730
|
+
value: t.configOption.dropQuotesOnKeys,
|
|
731
|
+
callback: function(s) {
|
|
732
|
+
t.$set(t.configOption, "dropQuotesOnKeys", s);
|
|
733
|
+
},
|
|
734
|
+
expression: "configOption.dropQuotesOnKeys"
|
|
735
|
+
}
|
|
736
|
+
})], 1), o("ElFormItem", {
|
|
737
|
+
attrs: {
|
|
738
|
+
label: "移除数字字符串的引号"
|
|
739
|
+
}
|
|
740
|
+
}, [o("ElSwitch", {
|
|
741
|
+
model: {
|
|
742
|
+
value: t.configOption.dropQuotesOnNumbers,
|
|
743
|
+
callback: function(s) {
|
|
744
|
+
t.$set(t.configOption, "dropQuotesOnNumbers", s);
|
|
745
|
+
},
|
|
746
|
+
expression: "configOption.dropQuotesOnNumbers"
|
|
747
|
+
}
|
|
748
|
+
})], 1)], 1), o("ElButton", {
|
|
749
|
+
staticStyle: {
|
|
750
|
+
"margin-left": "10px"
|
|
751
|
+
},
|
|
752
|
+
attrs: {
|
|
753
|
+
slot: "reference",
|
|
754
|
+
size: "medium",
|
|
755
|
+
type: "primary"
|
|
756
|
+
},
|
|
757
|
+
on: {
|
|
758
|
+
click: t.handleCopy
|
|
759
|
+
},
|
|
760
|
+
slot: "reference"
|
|
761
|
+
}, [t._v(" 复制 ")])], 1)], 1)], 1), o("ElDrawer", {
|
|
762
|
+
attrs: {
|
|
763
|
+
title: "预览",
|
|
764
|
+
visible: t.previewVisible,
|
|
765
|
+
size: "60%",
|
|
766
|
+
"append-to-body": "",
|
|
767
|
+
"before-close": t.handleBeforeClose
|
|
768
|
+
},
|
|
769
|
+
on: {
|
|
770
|
+
"update:visible": function(s) {
|
|
771
|
+
t.previewVisible = s;
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
}, [t.previewVisible ? o("FyForm", {
|
|
775
|
+
ref: "form",
|
|
776
|
+
staticClass: "afd-preview-form",
|
|
777
|
+
attrs: {
|
|
778
|
+
option: t.option
|
|
779
|
+
},
|
|
780
|
+
on: {
|
|
781
|
+
submit: t.handlePreviewSubmit
|
|
782
|
+
},
|
|
783
|
+
model: {
|
|
784
|
+
value: t.form,
|
|
785
|
+
callback: function(s) {
|
|
786
|
+
t.form = s;
|
|
787
|
+
},
|
|
788
|
+
expression: "form"
|
|
789
|
+
}
|
|
790
|
+
}) : t._e(), o("div", {
|
|
791
|
+
staticClass: "afd-drawer-foot"
|
|
792
|
+
}, [o("ElButton", {
|
|
793
|
+
attrs: {
|
|
794
|
+
size: "medium",
|
|
795
|
+
type: "primary"
|
|
796
|
+
},
|
|
797
|
+
on: {
|
|
798
|
+
click: t.handlePreviewSubmit
|
|
799
|
+
}
|
|
800
|
+
}, [t._v(" 确定 ")]), o("ElButton", {
|
|
801
|
+
attrs: {
|
|
802
|
+
size: "medium",
|
|
803
|
+
type: "danger"
|
|
804
|
+
},
|
|
805
|
+
on: {
|
|
806
|
+
click: t.handleBeforeClose
|
|
807
|
+
}
|
|
808
|
+
}, [t._v(" 取消 ")])], 1)], 1)], 1)], 1);
|
|
809
|
+
}, staticRenderFns = [];
|
|
810
|
+
const FyFormDesign_vue_vue_type_style_index_0_lang = "", __vue2_script = {
|
|
811
|
+
name: "FyFormDesign",
|
|
812
|
+
components: { Draggable, MonacoEditor, WidgetForm, FormConfig, WidgetConfig },
|
|
813
|
+
mixins: [history],
|
|
814
|
+
props: {
|
|
815
|
+
options: {
|
|
816
|
+
type: [Object, String],
|
|
817
|
+
default: () => ({
|
|
818
|
+
column: []
|
|
819
|
+
})
|
|
820
|
+
},
|
|
821
|
+
storage: {
|
|
822
|
+
type: Boolean,
|
|
823
|
+
default: !1
|
|
824
|
+
},
|
|
825
|
+
asideLeftWidth: {
|
|
826
|
+
type: [String, Number],
|
|
827
|
+
default: "270px"
|
|
828
|
+
},
|
|
829
|
+
asideRightWidth: {
|
|
830
|
+
type: [String, Number],
|
|
831
|
+
default: "380px"
|
|
832
|
+
},
|
|
833
|
+
showGithubStar: Boolean,
|
|
834
|
+
toolbar: {
|
|
835
|
+
type: Array,
|
|
836
|
+
default: () => ["import", "generate", "preview", "clear"]
|
|
837
|
+
},
|
|
838
|
+
undoRedo: {
|
|
839
|
+
type: Boolean,
|
|
840
|
+
default: !0
|
|
841
|
+
},
|
|
842
|
+
includeFields: {
|
|
843
|
+
type: Array,
|
|
844
|
+
default: () => {
|
|
845
|
+
const t = [];
|
|
846
|
+
return fields.forEach((n) => {
|
|
847
|
+
n.list.forEach((o) => {
|
|
848
|
+
t.push(o.type);
|
|
849
|
+
});
|
|
850
|
+
}), t;
|
|
851
|
+
}
|
|
852
|
+
},
|
|
853
|
+
customFields: {
|
|
854
|
+
type: Array
|
|
855
|
+
},
|
|
856
|
+
defaultValues: {
|
|
857
|
+
type: Object
|
|
858
|
+
}
|
|
859
|
+
},
|
|
860
|
+
data() {
|
|
861
|
+
return {
|
|
862
|
+
widgetEmpty,
|
|
863
|
+
fields,
|
|
864
|
+
widgetForm: {
|
|
865
|
+
column: [],
|
|
866
|
+
labelPosition: "left",
|
|
867
|
+
labelSuffix: ":",
|
|
868
|
+
labelWidth: 120,
|
|
869
|
+
gutter: 0,
|
|
870
|
+
menuBtn: !0,
|
|
871
|
+
submitBtn: !0,
|
|
872
|
+
submitText: "提交",
|
|
873
|
+
emptyBtn: !0,
|
|
874
|
+
emptyText: "清空",
|
|
875
|
+
menuPosition: "center"
|
|
876
|
+
},
|
|
877
|
+
option: {},
|
|
878
|
+
configTab: "form",
|
|
879
|
+
widgetFormSelect: {},
|
|
880
|
+
previewVisible: !1,
|
|
881
|
+
generateJsonVisible: !1,
|
|
882
|
+
importJsonVisible: !1,
|
|
883
|
+
importJson: {},
|
|
884
|
+
form: {},
|
|
885
|
+
configOption: {
|
|
886
|
+
generateType: "json",
|
|
887
|
+
space: 2,
|
|
888
|
+
quoteType: "single",
|
|
889
|
+
dropQuotesOnKeys: !0
|
|
890
|
+
},
|
|
891
|
+
history: {
|
|
892
|
+
index: 0,
|
|
893
|
+
// 当前下标
|
|
894
|
+
maxStep: 20,
|
|
895
|
+
// 最大记录步数
|
|
896
|
+
steps: []
|
|
897
|
+
// 历史步数
|
|
898
|
+
}
|
|
899
|
+
};
|
|
900
|
+
},
|
|
901
|
+
computed: {
|
|
902
|
+
leftWidth() {
|
|
903
|
+
return typeof this.asideLeftWidth == "string" ? this.asideLeftWidth : `${this.asideLeftWidth}px`;
|
|
904
|
+
},
|
|
905
|
+
rightWidth() {
|
|
906
|
+
return typeof this.asideRightWidth == "string" ? this.asideRightWidth : `${this.asideRightWidth}px`;
|
|
907
|
+
}
|
|
908
|
+
},
|
|
909
|
+
watch: {
|
|
910
|
+
options: {
|
|
911
|
+
handler(val) {
|
|
912
|
+
let options = val;
|
|
913
|
+
if (typeof options == "string")
|
|
914
|
+
try {
|
|
915
|
+
options = eval("(" + options + ")");
|
|
916
|
+
} catch (t) {
|
|
917
|
+
console.error("非法配置"), options = { column: [] };
|
|
918
|
+
}
|
|
919
|
+
this.transAvueOptionsToFormDesigner(options).then((t) => {
|
|
920
|
+
this.widgetForm = { ...this.widgetForm, ...t };
|
|
921
|
+
});
|
|
922
|
+
},
|
|
923
|
+
deep: !0
|
|
924
|
+
},
|
|
925
|
+
widgetFormSelect: {
|
|
926
|
+
handler() {
|
|
927
|
+
this.configTab === "form" && (this.configTab = "widget");
|
|
928
|
+
},
|
|
929
|
+
deep: !0
|
|
930
|
+
}
|
|
931
|
+
},
|
|
932
|
+
mounted() {
|
|
933
|
+
this.handleLoadStorage(), this.handleLoadCss();
|
|
934
|
+
},
|
|
935
|
+
methods: {
|
|
936
|
+
// 组件初始化时加载本地存储中的options(需开启storage),若不存在则读取用户配置的options
|
|
937
|
+
async handleLoadStorage() {
|
|
938
|
+
let options = this.options;
|
|
939
|
+
if (typeof options == "string")
|
|
940
|
+
try {
|
|
941
|
+
options = eval("(" + options + ")");
|
|
942
|
+
} catch (t) {
|
|
943
|
+
console.error("非法配置"), options = { column: [] };
|
|
944
|
+
}
|
|
945
|
+
options.column || (options.column = []), this.widgetForm = this.initHistory({
|
|
946
|
+
index: 0,
|
|
947
|
+
maxStep: 20,
|
|
948
|
+
steps: [await this.transAvueOptionsToFormDesigner({ ...this.widgetForm, ...options })],
|
|
949
|
+
storage: this.storage
|
|
950
|
+
}), this.undoRedo && window.addEventListener("keydown", (t) => {
|
|
951
|
+
(t.metaKey && !t.shiftKey && t.keyCode == 90 || t.ctrlKey && !t.shiftKey && t.keyCode == 90) && (this.widgetForm = this.handleUndo()), (t.metaKey && t.shiftKey && t.keyCode == 90 || t.ctrlKey && t.shiftKey && t.keyCode == 90 || t.ctrlKey && t.keyCode == 89) && (this.widgetForm = this.handleRedo());
|
|
952
|
+
}, !1);
|
|
953
|
+
},
|
|
954
|
+
// 加载icon
|
|
955
|
+
handleLoadCss() {
|
|
956
|
+
const t = document.getElementsByTagName("head")[0], n = document.createElement("link");
|
|
957
|
+
n.rel = "stylesheet", n.type = "text/css", n.href = "https://at.alicdn.com/t/font_1254447_zc9iezc230c.css", t.appendChild(n);
|
|
958
|
+
},
|
|
959
|
+
// Avue文档链接
|
|
960
|
+
handleAvueDoc() {
|
|
961
|
+
window.open("https://avuejs.com/form/form.html", "_blank");
|
|
962
|
+
},
|
|
963
|
+
// 左侧字段点击
|
|
964
|
+
handleFieldClick(t) {
|
|
965
|
+
const n = this.widgetForm.column.findIndex((s) => s.prop === this.widgetFormSelect.prop) + 1;
|
|
966
|
+
let o = 0;
|
|
967
|
+
n === -1 ? (this.widgetForm.column.push(t), o = this.widgetForm.column.length - 1) : (this.widgetForm.column.splice(n, 0, t), o = n), this.$refs.widgetForm.handleWidgetAdd({ newIndex: o });
|
|
968
|
+
},
|
|
969
|
+
// 预览 - 弹窗
|
|
970
|
+
handlePreview() {
|
|
971
|
+
!this.widgetForm.column || this.widgetForm.column.length === 0 ? this.$message.error("没有需要展示的内容") : this.transformToAvueOptions(this.widgetForm, !0).then((t) => {
|
|
972
|
+
this.option = t, this.previewVisible = !0;
|
|
973
|
+
});
|
|
974
|
+
},
|
|
975
|
+
// 导入JSON - 弹窗 - 确定
|
|
976
|
+
handleImportJsonSubmit() {
|
|
977
|
+
try {
|
|
978
|
+
this.transAvueOptionsToFormDesigner(this.importJson).then((t) => {
|
|
979
|
+
this.widgetForm = t, this.importJsonVisible = !1, this.handleHistoryChange(this.widgetForm);
|
|
980
|
+
});
|
|
981
|
+
} catch (t) {
|
|
982
|
+
this.$message.error(t.message);
|
|
983
|
+
}
|
|
984
|
+
},
|
|
985
|
+
// 生成JSON - 弹窗
|
|
986
|
+
handleGenerateJson() {
|
|
987
|
+
this.transformToAvueOptions(this.widgetForm).then((t) => {
|
|
988
|
+
this.option = t, this.generateJsonVisible = !0;
|
|
989
|
+
});
|
|
990
|
+
},
|
|
991
|
+
// 生成JSON - 弹窗 - 确定
|
|
992
|
+
handleGenerate() {
|
|
993
|
+
this.transformToAvueOptions(this.widgetForm).then((t) => {
|
|
994
|
+
this.configOption.generateType && this.configOption.generateType === "string" ? this.$emit("submit", convert(t, {
|
|
995
|
+
minify: !0,
|
|
996
|
+
...this.configOption
|
|
997
|
+
})) : this.$emit("submit", t);
|
|
998
|
+
});
|
|
999
|
+
},
|
|
1000
|
+
// 生成JSON - 弹窗 - 拷贝
|
|
1001
|
+
handleCopy() {
|
|
1002
|
+
this.transformToAvueOptions(this.widgetForm).then((t) => {
|
|
1003
|
+
this.$Clipboard({
|
|
1004
|
+
text: convert(t, {
|
|
1005
|
+
minify: !0,
|
|
1006
|
+
...this.configOption
|
|
1007
|
+
})
|
|
1008
|
+
}).then(() => {
|
|
1009
|
+
this.$message.success("复制成功");
|
|
1010
|
+
}).catch(() => {
|
|
1011
|
+
this.$message.error("复制失败");
|
|
1012
|
+
});
|
|
1013
|
+
});
|
|
1014
|
+
},
|
|
1015
|
+
// 预览 - 弹窗 - 确定
|
|
1016
|
+
handlePreviewSubmit(t, n) {
|
|
1017
|
+
n ? this.$alert(this.form).then(() => {
|
|
1018
|
+
n();
|
|
1019
|
+
}).catch(() => {
|
|
1020
|
+
n();
|
|
1021
|
+
}) : this.$refs.form.validate((o, s) => {
|
|
1022
|
+
o && this.$alert(this.form).then(() => {
|
|
1023
|
+
s();
|
|
1024
|
+
}).catch(() => {
|
|
1025
|
+
s();
|
|
1026
|
+
});
|
|
1027
|
+
});
|
|
1028
|
+
},
|
|
1029
|
+
// 预览 - 弹窗 - 关闭前
|
|
1030
|
+
handleBeforeClose() {
|
|
1031
|
+
this.$refs.form.resetForm(), this.form = {}, this.previewVisible = !1;
|
|
1032
|
+
},
|
|
1033
|
+
// 清空
|
|
1034
|
+
handleClear() {
|
|
1035
|
+
this.widgetForm && this.widgetForm.column && this.widgetForm.column.length > 0 ? this.$confirm("确定要清空吗?", "警告", {
|
|
1036
|
+
type: "warning"
|
|
1037
|
+
}).then(() => {
|
|
1038
|
+
this.$set(this.widgetForm, "column", []), this.$set(this, "form", {}), this.$set(this, "widgetFormSelect", {}), this.handleHistoryChange(this.widgetForm);
|
|
1039
|
+
}).catch(() => {
|
|
1040
|
+
}) : this.$message.error("没有需要清空的内容");
|
|
1041
|
+
},
|
|
1042
|
+
// 表单设计器配置项 转化为 Avue配置项
|
|
1043
|
+
transformToAvueOptions(obj, isPreview = !1) {
|
|
1044
|
+
return new Promise((resolve, reject) => {
|
|
1045
|
+
try {
|
|
1046
|
+
const data = deepClone(obj);
|
|
1047
|
+
for (let t in data)
|
|
1048
|
+
isBlank(data[t]) && delete data[t];
|
|
1049
|
+
for (let i = 0; i < data.column.length; i++) {
|
|
1050
|
+
const col = data.column[i];
|
|
1051
|
+
if (isPreview) {
|
|
1052
|
+
let event = ["change", "blur", "click", "focus"];
|
|
1053
|
+
event.forEach((e) => {
|
|
1054
|
+
col[e] && (col[e] = eval((col[e] + "").replace(/this/g, "_this")));
|
|
1055
|
+
}), col.event && Object.keys(col.event).forEach((key) => col.event[key] = eval((col.event[key] + "").replace(/this/g, "_this")));
|
|
1056
|
+
}
|
|
1057
|
+
if (col.type === "dynamic" && col.children && col.children.column && col.children.column.length > 0)
|
|
1058
|
+
col.children.column.forEach((n) => {
|
|
1059
|
+
delete n.subfield;
|
|
1060
|
+
}), this.transformToAvueOptions(col.children, isPreview).then((n) => {
|
|
1061
|
+
col.children = n;
|
|
1062
|
+
});
|
|
1063
|
+
else if (col.type === "group") {
|
|
1064
|
+
data.group || (data.group = []);
|
|
1065
|
+
const t = {
|
|
1066
|
+
label: col.label,
|
|
1067
|
+
icon: col.icon,
|
|
1068
|
+
prop: col.prop,
|
|
1069
|
+
arrow: col.arrow,
|
|
1070
|
+
collapse: col.collapse,
|
|
1071
|
+
display: col.display
|
|
1072
|
+
};
|
|
1073
|
+
this.transformToAvueOptions(col.children, isPreview).then((n) => {
|
|
1074
|
+
t.column = n.column, data.group.push(t);
|
|
1075
|
+
}), data.column.splice(i, 1), i--;
|
|
1076
|
+
} else if (["checkbox", "radio", "tree", "cascader", "select"].includes(col.type)) {
|
|
1077
|
+
if (col.dicOption === "static") {
|
|
1078
|
+
delete col.dicUrl, delete col.dicMethod, delete col.dicQuery, delete col.dicQueryConfig;
|
|
1079
|
+
const { label: t, value: n, desc: o } = col.props;
|
|
1080
|
+
col.dicData.forEach((s) => {
|
|
1081
|
+
if (s.label) {
|
|
1082
|
+
const a = s.label;
|
|
1083
|
+
delete s.label, s[t] = a;
|
|
1084
|
+
}
|
|
1085
|
+
if (s.value) {
|
|
1086
|
+
const a = s.value;
|
|
1087
|
+
delete s.value, s[n] = a;
|
|
1088
|
+
}
|
|
1089
|
+
if (s.desc) {
|
|
1090
|
+
const a = s.desc;
|
|
1091
|
+
delete s.desc, s[o] = a;
|
|
1092
|
+
}
|
|
1093
|
+
});
|
|
1094
|
+
} else if (col.dicOption === "remote")
|
|
1095
|
+
if (delete col.dicData, col.dicQueryConfig && col.dicQueryConfig.length > 0) {
|
|
1096
|
+
const t = {};
|
|
1097
|
+
col.dicQueryConfig.forEach((n) => {
|
|
1098
|
+
n.key && n.value && (t[n.key] = n.value);
|
|
1099
|
+
}), col.dicQuery = t, delete col.dicQueryConfig;
|
|
1100
|
+
} else
|
|
1101
|
+
delete col.dicQueryConfig;
|
|
1102
|
+
delete col.dicOption;
|
|
1103
|
+
} else if (["upload"].includes(col.type)) {
|
|
1104
|
+
if (col.headersConfig && col.headersConfig.length > 0) {
|
|
1105
|
+
const t = {};
|
|
1106
|
+
col.headersConfig.forEach((n) => {
|
|
1107
|
+
n.key && n.value && (t[n.key] = n.value);
|
|
1108
|
+
}), col.headers = t;
|
|
1109
|
+
} else
|
|
1110
|
+
delete col.headers;
|
|
1111
|
+
if (delete col.headersConfig, col.dataConfig && col.dataConfig.length > 0) {
|
|
1112
|
+
const t = {};
|
|
1113
|
+
col.dataConfig.forEach((n) => {
|
|
1114
|
+
n.key && n.value && (t[n.key] = n.value);
|
|
1115
|
+
}), col.data = t;
|
|
1116
|
+
} else
|
|
1117
|
+
delete col.data;
|
|
1118
|
+
delete col.dataConfig;
|
|
1119
|
+
}
|
|
1120
|
+
for (let t in col)
|
|
1121
|
+
isBlank(col[t]) && delete col[t];
|
|
1122
|
+
}
|
|
1123
|
+
resolve(data);
|
|
1124
|
+
} catch (t) {
|
|
1125
|
+
reject(t);
|
|
1126
|
+
}
|
|
1127
|
+
});
|
|
1128
|
+
},
|
|
1129
|
+
// Avue配置项 转化为 表单设计器配置项
|
|
1130
|
+
transAvueOptionsToFormDesigner(obj) {
|
|
1131
|
+
typeof obj == "string" && (obj = eval("(" + obj + ")"));
|
|
1132
|
+
const data = deepClone(obj);
|
|
1133
|
+
return new Promise((t, n) => {
|
|
1134
|
+
try {
|
|
1135
|
+
if (data.column && data.column.length > 0 && data.column.forEach((o) => {
|
|
1136
|
+
if (o.type === "dynamic" && o.children && o.children.column && o.children.column.length > 0)
|
|
1137
|
+
o.children.column.forEach((a) => {
|
|
1138
|
+
a.subfield = !0;
|
|
1139
|
+
}), this.transAvueOptionsToFormDesigner(o.children).then((a) => {
|
|
1140
|
+
o.children = a;
|
|
1141
|
+
});
|
|
1142
|
+
else if (["checkbox", "radio", "tree", "cascader", "select"].includes(o.type)) {
|
|
1143
|
+
if (!o.dicData && o.dicQuery && typeof o.dicQuery == "object") {
|
|
1144
|
+
const s = [];
|
|
1145
|
+
for (let a in o.dicQuery)
|
|
1146
|
+
s.push({
|
|
1147
|
+
key: a,
|
|
1148
|
+
value: o.dicQuery[a],
|
|
1149
|
+
$cellEdit: !0
|
|
1150
|
+
});
|
|
1151
|
+
o.dicQueryConfig = s;
|
|
1152
|
+
}
|
|
1153
|
+
o.dicUrl ? o.dicOption = "remote" : o.dicOption = "static", o.dicData ? o.props && o.dicData.forEach((s) => {
|
|
1154
|
+
const { label: a, value: r, desc: l } = o.props;
|
|
1155
|
+
if (a) {
|
|
1156
|
+
const c = s[a];
|
|
1157
|
+
delete s[a], s.label = c;
|
|
1158
|
+
}
|
|
1159
|
+
if (r) {
|
|
1160
|
+
const c = s[r];
|
|
1161
|
+
delete s[r], s.value = c;
|
|
1162
|
+
}
|
|
1163
|
+
if (l) {
|
|
1164
|
+
const c = s[l];
|
|
1165
|
+
delete s[l], s.desc = c;
|
|
1166
|
+
}
|
|
1167
|
+
}) : o.dicData = [];
|
|
1168
|
+
} else if (["upload"].includes(o.type)) {
|
|
1169
|
+
if (o.headers && typeof o.headers == "object") {
|
|
1170
|
+
const s = [];
|
|
1171
|
+
for (let a in o.headers)
|
|
1172
|
+
s.push({
|
|
1173
|
+
key: a,
|
|
1174
|
+
value: o.headers[a],
|
|
1175
|
+
$cellEdit: !0
|
|
1176
|
+
});
|
|
1177
|
+
o.headersConfig = s;
|
|
1178
|
+
} else
|
|
1179
|
+
o.headersConfig = [];
|
|
1180
|
+
if (o.data && typeof o.data == "object") {
|
|
1181
|
+
const s = [];
|
|
1182
|
+
for (let a in o.data)
|
|
1183
|
+
s.push({
|
|
1184
|
+
key: a,
|
|
1185
|
+
value: o.data[a],
|
|
1186
|
+
$cellEdit: !0
|
|
1187
|
+
});
|
|
1188
|
+
o.dataConfig = s;
|
|
1189
|
+
} else
|
|
1190
|
+
o.dataConfig = [];
|
|
1191
|
+
}
|
|
1192
|
+
}), data.group && data.group.length > 0) {
|
|
1193
|
+
for (let o = 0; o < data.group.length; o++) {
|
|
1194
|
+
data.column || (data.column = []);
|
|
1195
|
+
const s = data.group[o], a = {
|
|
1196
|
+
type: "group",
|
|
1197
|
+
label: s.label,
|
|
1198
|
+
icon: s.icon,
|
|
1199
|
+
prop: s.prop,
|
|
1200
|
+
arrow: s.arrow,
|
|
1201
|
+
collapse: s.collapse,
|
|
1202
|
+
display: s.display
|
|
1203
|
+
};
|
|
1204
|
+
this.transAvueOptionsToFormDesigner(s).then((r) => {
|
|
1205
|
+
a.children = r, data.column.push(a);
|
|
1206
|
+
});
|
|
1207
|
+
}
|
|
1208
|
+
delete data.group;
|
|
1209
|
+
}
|
|
1210
|
+
t(data);
|
|
1211
|
+
} catch (o) {
|
|
1212
|
+
n(o);
|
|
1213
|
+
}
|
|
1214
|
+
});
|
|
1215
|
+
},
|
|
1216
|
+
async getData(t = "json", n = {}) {
|
|
1217
|
+
if (t === "string")
|
|
1218
|
+
return convert(await this.transformToAvueOptions(this.widgetForm), {
|
|
1219
|
+
minify: !0,
|
|
1220
|
+
...n
|
|
1221
|
+
});
|
|
1222
|
+
if (t === "app") {
|
|
1223
|
+
const o = await this.transformToAvueOptions(this.widgetForm);
|
|
1224
|
+
return this.parseJson(o), o;
|
|
1225
|
+
} else
|
|
1226
|
+
return await this.transformToAvueOptions(this.widgetForm);
|
|
1227
|
+
},
|
|
1228
|
+
parseJson(t) {
|
|
1229
|
+
for (var n in t) {
|
|
1230
|
+
var o = t[n];
|
|
1231
|
+
o && o.length > 0 && typeof o == "object" || typeof o == "object" ? this.parseJson(o) : typeof o == "function" && (t[n] = o + "");
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
1234
|
+
}
|
|
1235
|
+
}, __cssModules = {};
|
|
1236
|
+
var __component__ = /* @__PURE__ */ normalizeComponent(
|
|
1237
|
+
__vue2_script,
|
|
1238
|
+
render,
|
|
1239
|
+
staticRenderFns,
|
|
1240
|
+
!1,
|
|
1241
|
+
__vue2_injectStyles,
|
|
1242
|
+
null,
|
|
1243
|
+
null,
|
|
1244
|
+
null
|
|
1245
|
+
);
|
|
1246
|
+
function __vue2_injectStyles(t) {
|
|
1247
|
+
for (let n in __cssModules)
|
|
1248
|
+
this[n] = __cssModules[n];
|
|
1249
|
+
}
|
|
1250
|
+
const FyFormDesign = /* @__PURE__ */ function() {
|
|
1251
|
+
return __component__.exports;
|
|
1252
|
+
}();
|
|
1253
|
+
export {
|
|
1254
|
+
FyFormDesign as default
|
|
1255
|
+
};
|