@web-utils/component 2.7.3 → 2.7.4

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