starfish-editor-custom 1.0.0

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 (108) hide show
  1. package/auto-imports.d.ts +10 -0
  2. package/babel.config.js +8 -0
  3. package/components.d.ts +46 -0
  4. package/dist/ConditionModule.js +892 -0
  5. package/dist/ConditionSelect.js +483 -0
  6. package/dist/CustomDialog.js +105 -0
  7. package/dist/formStyle.js +245 -0
  8. package/dist/globalFormList.js +59 -0
  9. package/dist/jsonCode.js +74 -0
  10. package/dist/jsonEditor.js +71 -0
  11. package/dist/main.js +3319 -0
  12. package/dist/starfish-editor.es.js +30 -0
  13. package/dist/style.css +1 -0
  14. package/dist/types/editor/src/common/ConditionSelect/ConditionGroup.vue.d.ts +61 -0
  15. package/dist/types/editor/src/common/ConditionSelect/ConditionModule.vue.d.ts +43 -0
  16. package/dist/types/editor/src/common/ConditionSelect/ConditionTanc.vue.d.ts +48 -0
  17. package/dist/types/editor/src/common/ConditionSelect.vue.d.ts +72 -0
  18. package/dist/types/editor/src/common/CustomDialog.vue.d.ts +25 -0
  19. package/dist/types/editor/src/common/Loading.vue.d.ts +3 -0
  20. package/dist/types/editor/src/common/formJson.d.ts +80 -0
  21. package/dist/types/editor/src/common/jsonCode.vue.d.ts +110 -0
  22. package/dist/types/editor/src/components/ComponentList.vue.d.ts +32 -0
  23. package/dist/types/editor/src/components/FormPreview.vue.d.ts +25 -0
  24. package/dist/types/editor/src/components/Nav.vue.d.ts +9 -0
  25. package/dist/types/editor/src/components/PropsPanel.vue.d.ts +53 -0
  26. package/dist/types/editor/src/components/Shape.vue.d.ts +40 -0
  27. package/dist/types/editor/src/components/Workspace.vue.d.ts +22 -0
  28. package/dist/types/editor/src/components/globalFormList.vue.d.ts +6 -0
  29. package/dist/types/editor/src/components/jsonEditor.vue.d.ts +6 -0
  30. package/dist/types/editor/src/controller/action.d.ts +18 -0
  31. package/dist/types/editor/src/controller/form.d.ts +24 -0
  32. package/dist/types/editor/src/controller/history.d.ts +12 -0
  33. package/dist/types/editor/src/controller/shortcut.d.ts +20 -0
  34. package/dist/types/editor/src/controller/ui.d.ts +10 -0
  35. package/dist/types/editor/src/layouts/ControlEditSize.vue.d.ts +17 -0
  36. package/dist/types/editor/src/layouts/Framework.vue.d.ts +33 -0
  37. package/dist/types/editor/src/layouts/Resizer.vue.d.ts +13 -0
  38. package/dist/types/editor/src/layouts/ShortcutKey.vue.d.ts +8 -0
  39. package/dist/types/editor/src/main.d.ts +5 -0
  40. package/dist/types/editor/src/shims-vue.d.ts +23 -0
  41. package/dist/types/editor/src/starfish-editor.vue.d.ts +109 -0
  42. package/dist/types/editor/src/type.d.ts +224 -0
  43. package/dist/types/editor/src/utils/_.d.ts +33 -0
  44. package/dist/types/editor/src/utils/formKeycon.d.ts +18 -0
  45. package/dist/types/editor/src/utils/shortcutKey.d.ts +3 -0
  46. package/dist/types/editor/src/utils/vm.d.ts +3 -0
  47. package/dist/types/starfish-editor.d.ts +3 -0
  48. package/package.json +55 -0
  49. package/src/common/ConditionSelect/ConditionGroup.vue +167 -0
  50. package/src/common/ConditionSelect/ConditionModule.vue +118 -0
  51. package/src/common/ConditionSelect/ConditionTanc.vue +319 -0
  52. package/src/common/ConditionSelect.vue +268 -0
  53. package/src/common/CustomDialog.vue +77 -0
  54. package/src/common/Loading.vue +10 -0
  55. package/src/common/formJson.ts +143 -0
  56. package/src/common/formStyle.vue +170 -0
  57. package/src/common/jsonCode.vue +45 -0
  58. package/src/components/ComponentList.vue +156 -0
  59. package/src/components/FormPreview.vue +197 -0
  60. package/src/components/Nav.vue +128 -0
  61. package/src/components/NavList.vue +560 -0
  62. package/src/components/PropsPanel.vue +376 -0
  63. package/src/components/Shape.vue +178 -0
  64. package/src/components/Workspace.vue +258 -0
  65. package/src/components/globalFormList.vue +30 -0
  66. package/src/components/jsonEditor.vue +41 -0
  67. package/src/controller/action.ts +37 -0
  68. package/src/controller/form.ts +207 -0
  69. package/src/controller/history.ts +57 -0
  70. package/src/controller/shortcut.ts +81 -0
  71. package/src/controller/ui.ts +91 -0
  72. package/src/layouts/ControlEditSize.vue +52 -0
  73. package/src/layouts/Framework.vue +76 -0
  74. package/src/layouts/Resizer.vue +54 -0
  75. package/src/layouts/ShortcutKey.vue +61 -0
  76. package/src/main.ts +56 -0
  77. package/src/shims-vue.d.ts +23 -0
  78. package/src/starfish-editor.vue +176 -0
  79. package/src/styles/common/normalize.css +455 -0
  80. package/src/styles/component-list.scss +64 -0
  81. package/src/styles/condition-select.scss +176 -0
  82. package/src/styles/control_edit_size.scss +36 -0
  83. package/src/styles/custom-dialog.scss +110 -0
  84. package/src/styles/form-preview.scss +47 -0
  85. package/src/styles/framework.scss +150 -0
  86. package/src/styles/iconfont/iconfont.css +247 -0
  87. package/src/styles/iconfont/iconfont.js +1 -0
  88. package/src/styles/iconfont/iconfont.json +415 -0
  89. package/src/styles/iconfont/iconfont.ttf +0 -0
  90. package/src/styles/iconfont/iconfont.woff +0 -0
  91. package/src/styles/iconfont/iconfont.woff2 +0 -0
  92. package/src/styles/index.scss +18 -0
  93. package/src/styles/nav-list.scss +59 -0
  94. package/src/styles/nav.scss +46 -0
  95. package/src/styles/props-panel.scss +115 -0
  96. package/src/styles/resizer.scss +15 -0
  97. package/src/styles/shape.scss +101 -0
  98. package/src/styles/shortcutkey.scss +44 -0
  99. package/src/styles/variables.scss +36 -0
  100. package/src/styles/work-space.scss +126 -0
  101. package/src/type.ts +240 -0
  102. package/src/utils/_.ts +349 -0
  103. package/src/utils/formKeycon.ts +42 -0
  104. package/src/utils/shortcutKey.ts +46 -0
  105. package/src/utils/vm.ts +3 -0
  106. package/stats.html +4949 -0
  107. package/tsconfig.json +19 -0
  108. package/vite.config.ts +111 -0
package/dist/main.js ADDED
@@ -0,0 +1,3319 @@
1
+ import { reactive, toRaw, defineComponent, defineAsyncComponent, computed, ref, watch, resolveComponent, openBlock, createBlock, withCtx, createElementVNode, normalizeClass, createVNode, createTextVNode, createElementBlock, Fragment, renderList, toDisplayString, inject, Transition, withDirectives, vShow, getCurrentInstance, createCommentVNode, resolveDynamicComponent, nextTick, normalizeStyle, renderSlot, withModifiers, mergeProps, onMounted, onUnmounted, createStaticVNode, provide, createSlots } from "vue";
2
+ import "element-plus/dist/index.css";
3
+ import "jsoneditor/dist/jsoneditor.min.css";
4
+ import StarfishForm, { Dynamicform } from "starfish-form";
5
+ import mitt from "mitt";
6
+ import { ElNotification } from "element-plus";
7
+ import { nanoid } from "nanoid";
8
+ import "starfish-form/dist/style.css";
9
+ import { ElMessage, ElButton, ElFooter, ElLoadingDirective, ElNotification as ElNotification$1, ElFormItem, ElForm, ElEmpty, ElScrollbar, ElTabPane, ElTabs, ElInput, ElTooltip, ElTree, ElDrawer, ElUpload } from "element-plus/es";
10
+ import "element-plus/es/components/base/style/css";
11
+ import "element-plus/es/components/footer/style/css";
12
+ import "element-plus/es/components/button/style/css";
13
+ import Clipboard from "clipboard";
14
+ import "element-plus/es/components/message/style/css";
15
+ import "element-plus/es/components/tabs/style/css";
16
+ import "element-plus/es/components/tab-pane/style/css";
17
+ import "element-plus/es/components/scrollbar/style/css";
18
+ import "element-plus/es/components/empty/style/css";
19
+ import "element-plus/es/components/form/style/css";
20
+ import "element-plus/es/components/form-item/style/css";
21
+ import "element-plus/es/components/loading/style/css";
22
+ import "element-plus/es/components/notification/style/css";
23
+ import "element-plus/es/components/input/style/css";
24
+ import "element-plus/es/components/upload/style/css";
25
+ import "element-plus/es/components/drawer/style/css";
26
+ import "element-plus/es/components/tree/style/css";
27
+ import "element-plus/es/components/tooltip/style/css";
28
+ import Gesto from "gesto";
29
+ import KeyController from "keycon";
30
+ var index = "";
31
+ var vm = mitt();
32
+ const state$4 = reactive({
33
+ historyList: [],
34
+ index: -1,
35
+ maxStep: 20,
36
+ historyFlag: false
37
+ });
38
+ class History {
39
+ setValue(value) {
40
+ state$4.historyList.push(value);
41
+ if (state$4.historyList.length > state$4.maxStep) {
42
+ state$4.historyList = state$4.historyList.slice(state$4.historyList.length - state$4.maxStep);
43
+ }
44
+ state$4.index = state$4.historyList.length - 1;
45
+ }
46
+ back() {
47
+ if (state$4.index == -1)
48
+ return;
49
+ state$4.index -= 1;
50
+ if (state$4.index > -1) {
51
+ state$4.historyFlag = true;
52
+ formStore == null ? void 0 : formStore.set("allFormList", state$4.historyList[state$4.index].allFormList);
53
+ formStore == null ? void 0 : formStore.set("currentIndex", state$4.historyList[state$4.index].currentIndex);
54
+ formStore == null ? void 0 : formStore.set("curControl", state$4.historyList[state$4.index].curControl);
55
+ formStore == null ? void 0 : formStore.set("currentId", state$4.historyList[state$4.index].currentId);
56
+ } else {
57
+ state$4.historyFlag = true;
58
+ formStore == null ? void 0 : formStore.set("allFormList", []);
59
+ formStore == null ? void 0 : formStore.set("currentIndex", -1);
60
+ formStore == null ? void 0 : formStore.set("curControl", {});
61
+ formStore == null ? void 0 : formStore.set("currentId", "");
62
+ }
63
+ }
64
+ go() {
65
+ if (state$4.index >= state$4.historyList.length - 1) {
66
+ return;
67
+ }
68
+ state$4.index += 1;
69
+ state$4.historyFlag = true;
70
+ formStore == null ? void 0 : formStore.set("allFormList", state$4.historyList[state$4.index].allFormList);
71
+ formStore == null ? void 0 : formStore.set("currentIndex", state$4.historyList[state$4.index].currentIndex);
72
+ formStore == null ? void 0 : formStore.set("curControl", state$4.historyList[state$4.index].curControl);
73
+ }
74
+ get(name) {
75
+ return state$4[name];
76
+ }
77
+ set(name, value) {
78
+ state$4[name] = value;
79
+ }
80
+ }
81
+ var hisContrl = new History();
82
+ const state$3 = reactive({
83
+ allFormList: [],
84
+ curControl: {},
85
+ currentIndex: -1,
86
+ currentId: "",
87
+ preview: false,
88
+ previewShow: false,
89
+ save: true,
90
+ formUpdate: false,
91
+ AllFormResult: [],
92
+ formResult: {},
93
+ globalDatas: {},
94
+ globalFormList: []
95
+ });
96
+ class Form {
97
+ updateAllFormList(allFormList) {
98
+ console.log("allForm", allFormList);
99
+ state$3.allFormList = allFormList;
100
+ if (state$3.currentIndex != -1) {
101
+ state$3.curControl = allFormList[state$3.currentIndex];
102
+ }
103
+ }
104
+ setHistory() {
105
+ hisContrl == null ? void 0 : hisContrl.setValue({
106
+ allFormList: window.VueContext.$Flex.deepClone(state$3.allFormList),
107
+ currentIndex: state$3.currentIndex,
108
+ currentId: state$3.currentId,
109
+ curControl: window.VueContext.$Flex.deepClone(state$3.allFormList[state$3.currentIndex])
110
+ });
111
+ }
112
+ setFormCurrentIndex(index2) {
113
+ state$3.currentIndex = index2;
114
+ }
115
+ setFormCurrentId(id) {
116
+ state$3.currentId = id;
117
+ if (id) {
118
+ const result2 = this.getCurrentItem(id);
119
+ state$3.curControl = result2 || {};
120
+ } else {
121
+ state$3.curControl = {};
122
+ }
123
+ }
124
+ getCurrentItem(id) {
125
+ let result2;
126
+ state$3.allFormList.find((item) => {
127
+ if (item.id == id) {
128
+ result2 = item;
129
+ return item;
130
+ } else if (item.layout) {
131
+ const res = this.getLayoutCurCtrol(item, id);
132
+ if (res) {
133
+ result2 = res;
134
+ return item;
135
+ }
136
+ }
137
+ });
138
+ return result2;
139
+ }
140
+ getLayoutCurCtrol(item, id) {
141
+ let result2;
142
+ if (item.ControlType == "TableLayout") {
143
+ const trs = item.data.trs;
144
+ if (trs && trs.length > 0) {
145
+ trs.find((trItem) => {
146
+ return trItem.tds.find((tdItem) => {
147
+ return tdItem.list.find((listItem) => {
148
+ if (listItem.layout) {
149
+ if (listItem.id == id) {
150
+ result2 = listItem;
151
+ } else {
152
+ result2 = this.getLayoutCurCtrol(listItem, id);
153
+ }
154
+ return result2;
155
+ } else if (listItem.id == id) {
156
+ result2 = listItem;
157
+ return result2;
158
+ }
159
+ });
160
+ });
161
+ });
162
+ }
163
+ } else if (item.ControlType == "Grid") {
164
+ const columns = item.data.columns;
165
+ if (columns && columns.length > 0) {
166
+ columns.find((colItem) => {
167
+ return colItem.list.find((listItem) => {
168
+ if (listItem.layout) {
169
+ if (listItem.id == id) {
170
+ result2 = listItem;
171
+ } else {
172
+ result2 = this.getLayoutCurCtrol(listItem, id);
173
+ }
174
+ return result2;
175
+ } else if (listItem.id == id) {
176
+ result2 = listItem;
177
+ return result2;
178
+ }
179
+ });
180
+ });
181
+ }
182
+ } else if (item.ControlType == "Collapse" || item.ControlType == "Tabs") {
183
+ const items = item.data.items;
184
+ if (items && items.length > 0) {
185
+ items.find((colItem) => {
186
+ return colItem.list.find((listItem) => {
187
+ if (listItem.layout) {
188
+ if (listItem.id == id) {
189
+ result2 = listItem;
190
+ } else {
191
+ result2 = this.getLayoutCurCtrol(listItem, id);
192
+ }
193
+ return result2;
194
+ } else if (listItem.id == id) {
195
+ result2 = listItem;
196
+ return result2;
197
+ }
198
+ });
199
+ });
200
+ }
201
+ }
202
+ return result2;
203
+ }
204
+ handleDynamicForm() {
205
+ state$3.formResult = this.getDynamicForm(state$3.AllFormResult);
206
+ console.log("formResult", state$3.formResult);
207
+ }
208
+ getDynamicForm(list) {
209
+ const data = {};
210
+ list.forEach((item) => {
211
+ if (item.layout) {
212
+ if (item.ControlType == "Grid" && item.data.columns) {
213
+ item.data.columns.forEach((colItem) => {
214
+ Object.assign(data, this.getDynamicForm(colItem.list));
215
+ });
216
+ } else if (item.ControlType == "TableLayout") {
217
+ const trs = item.data.trs;
218
+ if (trs && trs.length > 0) {
219
+ trs.forEach((trItem) => {
220
+ trItem.tds.forEach((tdItem) => {
221
+ Object.assign(data, this.getDynamicForm(tdItem.list));
222
+ });
223
+ });
224
+ }
225
+ } else if (item.ControlType == "Collapse" || item.ControlType == "Tabs") {
226
+ const items = item.data.items;
227
+ if (items) {
228
+ items.forEach((colItem) => {
229
+ Object.assign(data, this.getDynamicForm(colItem.list));
230
+ });
231
+ }
232
+ }
233
+ } else if (!item.layout) {
234
+ if (item.data.itemConfig) {
235
+ if (typeof item.data.itemConfig.value == "string") {
236
+ data[item.data.fieldName] = item.data.itemConfig.value;
237
+ } else {
238
+ data[item.data.fieldName] = [...item.data.itemConfig.value];
239
+ }
240
+ } else {
241
+ data[item.data.fieldName] = item.data.default;
242
+ }
243
+ }
244
+ });
245
+ return data;
246
+ }
247
+ openPreview(preview) {
248
+ state$3.preview = preview;
249
+ }
250
+ setSave(type) {
251
+ state$3.save = type;
252
+ }
253
+ setFormUpdate(type) {
254
+ state$3.formUpdate = type;
255
+ }
256
+ getControlItems() {
257
+ return state$3.curControl && state$3.curControl.controlItems;
258
+ }
259
+ getAllFormList() {
260
+ return state$3.allFormList;
261
+ }
262
+ setAllFormList(item) {
263
+ state$3.allFormList.push(item);
264
+ }
265
+ set(name, value) {
266
+ state$3[name] = value;
267
+ }
268
+ get(name) {
269
+ return state$3[name];
270
+ }
271
+ }
272
+ var formStore = new Form();
273
+ class Flex {
274
+ constructor() {
275
+ this.lastClickTime = 0;
276
+ this.openTanc = false;
277
+ }
278
+ clickCountLimit() {
279
+ let isCanGo = false;
280
+ if (window.clickCountLimitMock) {
281
+ return true;
282
+ }
283
+ if (!this.lastClickTime) {
284
+ this.lastClickTime = new Date().getTime();
285
+ isCanGo = true;
286
+ } else {
287
+ const shicha = new Date().getTime() - this.lastClickTime;
288
+ this.lastClickTime = new Date().getTime();
289
+ isCanGo = shicha >= 1e3;
290
+ }
291
+ if (!isCanGo) {
292
+ console.log("\u624B\u6B8B\u515A\u70B9\u51FB\u592A\u5FEB\u4E86");
293
+ }
294
+ return isCanGo;
295
+ }
296
+ generateMixed(size) {
297
+ return nanoid(size);
298
+ }
299
+ controlFormRule(controlItems) {
300
+ const rules = {};
301
+ controlItems.forEach((item) => {
302
+ const rule = [];
303
+ if (item.data.required) {
304
+ rule.push({
305
+ required: true,
306
+ message: "\u8BF7\u8F93\u5165" + item.data.label,
307
+ trigger: "blur"
308
+ });
309
+ rules[item.data.fieldName] = rule;
310
+ }
311
+ if (item.ControlType === "JsonEditor") {
312
+ rules[item.data.fieldName] = this.getJsonValidate();
313
+ }
314
+ });
315
+ return rules;
316
+ }
317
+ deepClone(target) {
318
+ let result2;
319
+ if (typeof target === "object") {
320
+ if (Array.isArray(target)) {
321
+ result2 = [];
322
+ for (let i = 0; i < target.length; i++) {
323
+ if (Object.prototype.hasOwnProperty.call(target, i)) {
324
+ result2.push(this.deepClone(target[i]));
325
+ }
326
+ }
327
+ } else if (target === null) {
328
+ result2 = null;
329
+ } else if (target.constructor === RegExp) {
330
+ result2 = target;
331
+ } else {
332
+ result2 = {};
333
+ for (const i in target) {
334
+ if (Object.prototype.hasOwnProperty.call(target, i)) {
335
+ result2[i] = this.deepClone(target[i]);
336
+ }
337
+ }
338
+ }
339
+ } else {
340
+ result2 = target;
341
+ }
342
+ return result2;
343
+ }
344
+ tryParseJson(json) {
345
+ try {
346
+ return JSON.parse(json);
347
+ } catch (E) {
348
+ if (json && json.startsWith && json.startsWith('"[')) {
349
+ return [];
350
+ }
351
+ return {};
352
+ }
353
+ }
354
+ open(message, title = "Success", type = "success") {
355
+ ElNotification({
356
+ title: title || "Success",
357
+ message,
358
+ type
359
+ });
360
+ }
361
+ getJsonValidate() {
362
+ return this.deepClone([
363
+ {
364
+ validator: (rule, value, callback) => {
365
+ try {
366
+ JSON.parse(value);
367
+ callback();
368
+ } catch (e) {
369
+ console.error(e);
370
+ return callback(new Error("\u8BF7\u8F93\u5165\u6B63\u786E\u7684json\u683C\u5F0F"));
371
+ }
372
+ },
373
+ trigger: "blur"
374
+ }
375
+ ]);
376
+ }
377
+ getDataType(data) {
378
+ const str = Object.prototype.toString.call(data);
379
+ const reg = /\[object (.*)\]/;
380
+ return str.match(reg)[1];
381
+ }
382
+ jsonToForm(item) {
383
+ var _a, _b;
384
+ if (!item.data || !item.controlItems) {
385
+ item = this.deepClone(item);
386
+ const currentComponent = window.VApp.$formcomponents[item.ControlType];
387
+ item.formConfig = ((_a = window.VApp.$formcomponents[item.ControlType]) == null ? void 0 : _a.formConfig) || {};
388
+ if (!item.data) {
389
+ item.data = item.formConfig.data();
390
+ }
391
+ if (!item.data.fieldName) {
392
+ item.data.fieldName = item.ControlType + "_" + this.generateMixed();
393
+ }
394
+ if (item.layout) {
395
+ if (item.ControlType == "Grid" && item.data.columns && item.data.columns.length > 0) {
396
+ item.data.columns = item.data.columns.map((colItem) => {
397
+ if (colItem.list && colItem.list.length > 0) {
398
+ colItem.list = this.jsonToForm(colItem.list);
399
+ }
400
+ return colItem;
401
+ });
402
+ } else if (item.ControlType == "TableLayout" && item.data.trs && item.data.trs.length > 0) {
403
+ item.data.trs = item.data.trs.map((trItem) => {
404
+ trItem.tds.forEach((tdItem) => {
405
+ if (tdItem.list && tdItem.list.length > 0) {
406
+ tdItem.list = this.jsonToForm(tdItem.list);
407
+ }
408
+ return tdItem;
409
+ });
410
+ return trItem;
411
+ });
412
+ } else if ((item.ControlType == "Collapse" || item.ControlType == "Tabs") && item.data.items && item.data.items.length > 0) {
413
+ item.data.items = item.data.items.map((colItem) => {
414
+ if (colItem.list && colItem.list.length > 0) {
415
+ colItem.list = this.jsonToForm(colItem.list);
416
+ }
417
+ return colItem;
418
+ });
419
+ }
420
+ }
421
+ const dynamicList = (_b = formStore == null ? void 0 : formStore.get("globalFormList")) == null ? void 0 : _b.filter((item2) => {
422
+ if (item2.dynamic) {
423
+ return item2;
424
+ }
425
+ });
426
+ item.id = this.generateMixed();
427
+ let controlItems = item.formConfig.morenConfig().concat(dynamicList);
428
+ if (currentComponent.actionType && currentComponent.actionType.length > 0) {
429
+ console.log(controlItems);
430
+ controlItems.find((item2) => {
431
+ if (item2.ControlType == "Action") {
432
+ item2.data.formConfig = {
433
+ value: {},
434
+ items: []
435
+ };
436
+ currentComponent.actionType.forEach((action2, index2) => {
437
+ item2.data.formConfig.items.push({
438
+ label: action2,
439
+ value: action2,
440
+ id: index2 + 1
441
+ });
442
+ });
443
+ }
444
+ });
445
+ } else {
446
+ controlItems = controlItems.filter((item2) => {
447
+ if (item2.ControlType !== "Action") {
448
+ return item2;
449
+ }
450
+ });
451
+ }
452
+ item.rules = this.controlFormRule(controlItems);
453
+ item.controlItems = controlItems;
454
+ }
455
+ return item;
456
+ }
457
+ initFormToJson(formlist) {
458
+ const jsonData = [];
459
+ formlist.forEach((item) => {
460
+ if (item.layout) {
461
+ if (item.ControlType == "Grid" && item.data.columns && item.data.columns.length > 0) {
462
+ item.data.columns = item.data.columns.map((colItem) => {
463
+ colItem.list = this.initFormToJson(colItem.list);
464
+ return colItem;
465
+ });
466
+ } else if (item.ControlType == "TableLayout" && item.data.trs && item.data.trs.length > 0) {
467
+ item.data.trs = item.data.trs.map((trItem) => {
468
+ trItem.tds.forEach((tdItem) => {
469
+ if (tdItem.list && tdItem.list.length > 0) {
470
+ tdItem.list = this.initFormToJson(tdItem.list);
471
+ }
472
+ return tdItem;
473
+ });
474
+ return trItem;
475
+ });
476
+ } else if ((item.ControlType == "Collapse" || item.ControlType == "Tabs") && item.data.items && item.data.items.length > 0) {
477
+ item.data.items = item.data.items.map((colItem) => {
478
+ colItem.list = this.initFormToJson(colItem.list);
479
+ return colItem;
480
+ });
481
+ }
482
+ }
483
+ const obj = {
484
+ ControlType: item.ControlType,
485
+ nameCn: item.nameCn,
486
+ id: item.id,
487
+ layout: !!item.layout,
488
+ data: item.data
489
+ };
490
+ jsonData.push(obj);
491
+ });
492
+ return jsonData;
493
+ }
494
+ funcExec(action, proxy, argus = []) {
495
+ const actionObj = JSON.parse(action || "{}");
496
+ const funcStr = actionObj.funcStr;
497
+ eval(`(function(${this.getField(actionObj.methods)}){${funcStr}}).apply(proxy, argus)`);
498
+ }
499
+ getField(methods) {
500
+ if (methods == "onChange") {
501
+ return "value, oldValue, subFormData";
502
+ } else if (["onForce", "onBlur", "onClick"].includes(methods)) {
503
+ return "field";
504
+ } else {
505
+ return "";
506
+ }
507
+ }
508
+ getFormDataList(item, result2 = [], fieldName) {
509
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
510
+ if (!item.layout) {
511
+ if (item.data.fieldName != fieldName) {
512
+ if (item.nameCn == "\u5F00\u5173") {
513
+ result2.push({
514
+ value: (_a = item == null ? void 0 : item.data) == null ? void 0 : _a.fieldName,
515
+ label: ((_b = item == null ? void 0 : item.data) == null ? void 0 : _b.label) + "-" + ((_c = item == null ? void 0 : item.data) == null ? void 0 : _c.fieldName),
516
+ switch: true
517
+ });
518
+ return;
519
+ }
520
+ if (item.data.itemConfig) {
521
+ let multiple = false;
522
+ if (Array.isArray(item.data.itemConfig.value)) {
523
+ multiple = true;
524
+ }
525
+ const options = item.data.itemConfig.items;
526
+ result2.push({
527
+ value: (_d = item == null ? void 0 : item.data) == null ? void 0 : _d.fieldName,
528
+ label: ((_e = item == null ? void 0 : item.data) == null ? void 0 : _e.label) + "-" + ((_f = item == null ? void 0 : item.data) == null ? void 0 : _f.fieldName),
529
+ multiple,
530
+ options
531
+ });
532
+ return;
533
+ }
534
+ result2.push({
535
+ value: (_g = item == null ? void 0 : item.data) == null ? void 0 : _g.fieldName,
536
+ label: ((_h = item == null ? void 0 : item.data) == null ? void 0 : _h.label) + "-" + ((_i = item == null ? void 0 : item.data) == null ? void 0 : _i.fieldName)
537
+ });
538
+ }
539
+ } else {
540
+ if (item.data.fieldName != fieldName) {
541
+ result2.push({
542
+ value: (_j = item == null ? void 0 : item.data) == null ? void 0 : _j.fieldName,
543
+ label: ((_k = item == null ? void 0 : item.data) == null ? void 0 : _k.label) + "-" + ((_l = item == null ? void 0 : item.data) == null ? void 0 : _l.fieldName)
544
+ });
545
+ if (item.ControlType == "Grid" && item.data.columns) {
546
+ item.data.columns.forEach((colItem) => {
547
+ colItem.list.forEach((listItem) => {
548
+ this.getFormDataList(listItem, result2, fieldName);
549
+ });
550
+ });
551
+ } else if (item.ControlType == "TableLayout" && item.data.trs) {
552
+ item.data.trs.forEach((trItem) => {
553
+ trItem.tds.forEach((tdItem) => {
554
+ tdItem.list.forEach((listItem) => {
555
+ this.getFormDataList(listItem, result2, fieldName);
556
+ });
557
+ });
558
+ });
559
+ } else if ((item.ControlType == "Collapse" || item.ControlType == "Tabs") && item.data.items) {
560
+ item.data.items.forEach((colItem) => {
561
+ colItem.list.forEach((listItem) => {
562
+ this.getFormDataList(listItem, result2, fieldName);
563
+ });
564
+ });
565
+ }
566
+ }
567
+ }
568
+ }
569
+ }
570
+ var flex = new Flex();
571
+ const DEFAUTL_LEFT_COLUMN_WIDTH = 300;
572
+ const DEFAUTL_RIGHT_COLUMN_WIDTH = 400;
573
+ const defaultColumnWidth = {
574
+ left: DEFAUTL_LEFT_COLUMN_WIDTH,
575
+ center: window.document.body.clientWidth - DEFAUTL_LEFT_COLUMN_WIDTH - DEFAUTL_RIGHT_COLUMN_WIDTH,
576
+ right: DEFAUTL_RIGHT_COLUMN_WIDTH
577
+ };
578
+ const DIALOG_WIDTH = 500;
579
+ const scale = 1;
580
+ const state$2 = reactive({
581
+ columnWidth: defaultColumnWidth,
582
+ dialogWidth: DIALOG_WIDTH,
583
+ scale,
584
+ isFullscreen: false,
585
+ pageType: "PC",
586
+ rightClose: false,
587
+ leftClose: false
588
+ });
589
+ class Ui {
590
+ get(name) {
591
+ return state$2[name];
592
+ }
593
+ set(name, value) {
594
+ if (name === "columnWidth") {
595
+ this.setColumnWidth(value);
596
+ } else if (name === "scale") {
597
+ this.setScale(Number(value));
598
+ } else if (name == "isFullscreen") {
599
+ state$2[name] = value;
600
+ state$2.pageType = "";
601
+ } else if (name == "pageType") {
602
+ state$2[name] = value;
603
+ state$2.isFullscreen = true;
604
+ } else {
605
+ state$2[name] = value;
606
+ }
607
+ }
608
+ setScale(size) {
609
+ const range = [0.2, 1.5];
610
+ if (size >= range[0] && size <= range[1]) {
611
+ state$2.scale = size;
612
+ }
613
+ }
614
+ setColumnWidth({ left, center, right }) {
615
+ const columnWidth = {
616
+ ...toRaw(this.get("columnWidth"))
617
+ };
618
+ if (left && left >= 0) {
619
+ columnWidth.left = left;
620
+ } else {
621
+ columnWidth.left = defaultColumnWidth.left;
622
+ }
623
+ if (right != void 0 && right >= 0) {
624
+ columnWidth.right = right;
625
+ } else {
626
+ columnWidth.right = defaultColumnWidth.right;
627
+ }
628
+ if (!center || center == "auto") {
629
+ const bodyWidth = window.document.body.clientWidth;
630
+ columnWidth.center = bodyWidth - ((columnWidth == null ? void 0 : columnWidth.left) || 0) - ((columnWidth == null ? void 0 : columnWidth.right) || 0);
631
+ if (columnWidth.center <= 0) {
632
+ columnWidth.left = defaultColumnWidth.left;
633
+ columnWidth.center = defaultColumnWidth.center;
634
+ columnWidth.right = defaultColumnWidth.right;
635
+ }
636
+ } else {
637
+ columnWidth.center = center;
638
+ }
639
+ state$2.columnWidth = columnWidth;
640
+ }
641
+ }
642
+ var uiControl = new Ui();
643
+ var _export_sfc = (sfc, props) => {
644
+ const target = sfc.__vccOpts || sfc;
645
+ for (const [key, val] of props) {
646
+ target[key] = val;
647
+ }
648
+ return target;
649
+ };
650
+ const _sfc_main$c = defineComponent({
651
+ components: {
652
+ Dynamicform,
653
+ JsonCode: defineAsyncComponent(() => import("./jsonCode.js"))
654
+ },
655
+ setup() {
656
+ const previewShow = computed(() => formStore.get("previewShow"));
657
+ const allFormList = computed(() => formStore.get("AllFormResult"));
658
+ const formResult = computed(() => formStore.get("formResult"));
659
+ const globalDatas = computed(() => formStore == null ? void 0 : formStore.get("globalDatas"));
660
+ const pageType = computed(() => uiControl == null ? void 0 : uiControl.get("pageType"));
661
+ const codeDialog = ref();
662
+ const code = ref();
663
+ let clipboard;
664
+ const dynamicform = ref();
665
+ const previewDialog = ref();
666
+ const handlePreviewShow = () => {
667
+ formStore.set("previewShow", false);
668
+ };
669
+ watch(previewShow, async () => {
670
+ if (!previewShow.value) {
671
+ previewDialog.value.close();
672
+ } else {
673
+ previewDialog.value.init("\u8868\u5355\u9884\u89C8", "icon-biaodan");
674
+ previewDialog.value.show();
675
+ previewDialog.value.isFullScreen = true;
676
+ }
677
+ });
678
+ const JsonViewerDialog = ref();
679
+ return {
680
+ code,
681
+ pageType,
682
+ codeDialog,
683
+ globalDatas,
684
+ dialogWidth: computed(() => uiControl == null ? void 0 : uiControl.get("dialogWidth")),
685
+ previewShow,
686
+ previewDialog,
687
+ handlePreviewShow,
688
+ JsonViewerDialog,
689
+ allFormList,
690
+ formResult,
691
+ dynamicform,
692
+ resetForm() {
693
+ dynamicform.value.reset();
694
+ },
695
+ closeDialog() {
696
+ previewDialog.value.close();
697
+ },
698
+ getData() {
699
+ var _a;
700
+ (_a = dynamicform.value) == null ? void 0 : _a.getValidate().then((valide) => {
701
+ if (valide) {
702
+ console.log("formResult", formResult.value);
703
+ code.value = JSON.stringify((formResult == null ? void 0 : formResult.value) || {}, null, 4);
704
+ codeDialog.value.show();
705
+ codeDialog.value.init("\u8868\u5355\u6570\u636E", "icon-biaodan");
706
+ } else {
707
+ ElMessage({
708
+ type: "error",
709
+ message: "\u6821\u9A8C\u5931\u8D25"
710
+ });
711
+ }
712
+ });
713
+ },
714
+ closeCodeDialog() {
715
+ codeDialog.value.close();
716
+ },
717
+ copyJson() {
718
+ if (!clipboard) {
719
+ clipboard = new Clipboard(".copy_btn");
720
+ }
721
+ clipboard.on("success", () => {
722
+ ElMessage({
723
+ type: "success",
724
+ message: "\u590D\u5236\u6210\u529F"
725
+ });
726
+ });
727
+ clipboard.on("error", () => {
728
+ ElMessage({
729
+ type: "error",
730
+ message: "\u590D\u5236\u5931\u8D25"
731
+ });
732
+ });
733
+ setTimeout(() => {
734
+ clipboard.destroy();
735
+ }, 2e4);
736
+ },
737
+ saveFile(fileName = "demo.json") {
738
+ let content = "data:application/json;charset=utf-8,";
739
+ try {
740
+ const result2 = code.value;
741
+ content += result2;
742
+ const encodedUri = encodeURI(content);
743
+ const actions = document.createElement("a");
744
+ actions.setAttribute("href", encodedUri);
745
+ actions.setAttribute("download", fileName);
746
+ actions.click();
747
+ ElMessage({
748
+ type: "success",
749
+ message: "\u6587\u4EF6\u4FDD\u5B58\u6210\u529F"
750
+ });
751
+ } catch (e) {
752
+ ElMessage({
753
+ type: "error",
754
+ message: "\u6587\u4EF6\u4FDD\u5B58\u5931\u8D25"
755
+ });
756
+ }
757
+ }
758
+ };
759
+ }
760
+ });
761
+ const _hoisted_1$b = { class: "custom_code" };
762
+ function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
763
+ const _component_dynamicform = resolveComponent("dynamicform");
764
+ const _component_el_button = ElButton;
765
+ const _component_el_footer = ElFooter;
766
+ const _component_JsonCode = resolveComponent("JsonCode");
767
+ const _component_custom_dialog = resolveComponent("custom-dialog");
768
+ const _component_CustomDialog = resolveComponent("CustomDialog");
769
+ return openBlock(), createBlock(_component_CustomDialog, {
770
+ ref: "previewDialog",
771
+ showDialog: _ctx.previewShow,
772
+ onClose: _ctx.handlePreviewShow,
773
+ dialogclass: "previewDialog"
774
+ }, {
775
+ default: withCtx(() => [
776
+ createElementVNode("div", {
777
+ class: normalizeClass(["page_box", _ctx.pageType + "_layout"])
778
+ }, [
779
+ createVNode(_component_dynamicform, {
780
+ formResult: _ctx.formResult,
781
+ allFormList: _ctx.allFormList,
782
+ globalConfig: _ctx.globalDatas,
783
+ ref: "dynamicform"
784
+ }, null, 8, ["formResult", "allFormList", "globalConfig"])
785
+ ], 2),
786
+ createVNode(_component_el_footer, {
787
+ class: "my-Footer",
788
+ style: { "text-align": "center" }
789
+ }, {
790
+ default: withCtx(() => [
791
+ createVNode(_component_el_button, {
792
+ type: "primary",
793
+ onClick: _ctx.resetForm
794
+ }, {
795
+ default: withCtx(() => _cache[1] || (_cache[1] = [
796
+ createTextVNode("\u91CD\u7F6E\u8868\u5355", -1)
797
+ ])),
798
+ _: 1,
799
+ __: [1]
800
+ }, 8, ["onClick"]),
801
+ createVNode(_component_el_button, {
802
+ type: "primary",
803
+ onClick: _ctx.getData
804
+ }, {
805
+ default: withCtx(() => _cache[2] || (_cache[2] = [
806
+ createTextVNode("\u83B7\u53D6\u6570\u636E", -1)
807
+ ])),
808
+ _: 1,
809
+ __: [2]
810
+ }, 8, ["onClick"]),
811
+ createVNode(_component_el_button, { onClick: _ctx.closeDialog }, {
812
+ default: withCtx(() => _cache[3] || (_cache[3] = [
813
+ createTextVNode("\u5173\u95ED", -1)
814
+ ])),
815
+ _: 1,
816
+ __: [3]
817
+ }, 8, ["onClick"])
818
+ ]),
819
+ _: 1
820
+ }),
821
+ createVNode(_component_custom_dialog, {
822
+ ref: "codeDialog",
823
+ dialogclass: "codeDialog",
824
+ width: "1000"
825
+ }, {
826
+ default: withCtx(() => [
827
+ createElementVNode("div", _hoisted_1$b, [
828
+ createVNode(_component_JsonCode, {
829
+ value: _ctx.code,
830
+ "onUpdate:value": _cache[0] || (_cache[0] = ($event) => _ctx.code = $event)
831
+ }, null, 8, ["value"])
832
+ ]),
833
+ createVNode(_component_el_footer, {
834
+ class: "my-Footer",
835
+ style: { "text-align": "center", "position": "absolute", "bottom": "0", "width": "100%", "display": "flex", "align-items": "center" }
836
+ }, {
837
+ default: withCtx(() => [
838
+ createVNode(_component_el_button, {
839
+ type: "primary",
840
+ onClick: _ctx.copyJson,
841
+ class: "copy_btn",
842
+ "data-clipboard-action": "copy",
843
+ "data-clipboard-text": _ctx.code
844
+ }, {
845
+ default: withCtx(() => _cache[4] || (_cache[4] = [
846
+ createTextVNode("\u590D\u5236json", -1)
847
+ ])),
848
+ _: 1,
849
+ __: [4]
850
+ }, 8, ["onClick", "data-clipboard-text"]),
851
+ createVNode(_component_el_button, {
852
+ type: "primary",
853
+ onClick: _ctx.saveFile
854
+ }, {
855
+ default: withCtx(() => _cache[5] || (_cache[5] = [
856
+ createTextVNode("\u4FDD\u5B58\u4E3A\u6587\u4EF6", -1)
857
+ ])),
858
+ _: 1,
859
+ __: [5]
860
+ }, 8, ["onClick"]),
861
+ createVNode(_component_el_button, { onClick: _ctx.closeCodeDialog }, {
862
+ default: withCtx(() => _cache[6] || (_cache[6] = [
863
+ createTextVNode("\u5173\u95ED", -1)
864
+ ])),
865
+ _: 1,
866
+ __: [6]
867
+ }, 8, ["onClick"])
868
+ ]),
869
+ _: 1
870
+ })
871
+ ]),
872
+ _: 1
873
+ }, 512)
874
+ ]),
875
+ _: 1
876
+ }, 8, ["showDialog", "onClose"]);
877
+ }
878
+ var __unplugin_components_5 = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["render", _sfc_render$c]]);
879
+ var FormPreview = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
880
+ __proto__: null,
881
+ "default": __unplugin_components_5
882
+ }, Symbol.toStringTag, { value: "Module" }));
883
+ const _sfc_main$b = defineComponent({
884
+ setup() {
885
+ const keyList = reactive([
886
+ {
887
+ key: "ctrl + C",
888
+ value: "\u590D\u5236\u7EC4\u4EF6"
889
+ },
890
+ {
891
+ key: "ctrl + V",
892
+ value: "\u7C98\u8D34\u7EC4\u4EF6"
893
+ },
894
+ {
895
+ key: "ctrl + X",
896
+ value: "\u88C1\u526A\u7EC4\u4EF6"
897
+ },
898
+ {
899
+ key: "delete",
900
+ value: "\u5220\u9664\u7EC4\u4EF6"
901
+ },
902
+ {
903
+ key: "ctrl + E",
904
+ value: "\u6E05\u7A7A\u753B\u5E03"
905
+ },
906
+ {
907
+ key: "ctrl + \u2191",
908
+ value: "\u7EC4\u4EF6\u4E0A\u79FB"
909
+ },
910
+ {
911
+ key: "ctrl + \u2193",
912
+ value: "\u7EC4\u4EF6\u4E0B\u79FB"
913
+ },
914
+ {
915
+ key: "\u2191",
916
+ value: "\u9009\u4E2D\u4E0A\u79FB"
917
+ },
918
+ {
919
+ key: "\u2193",
920
+ value: "\u9009\u4E2D\u4E0B\u79FB"
921
+ }
922
+ ]);
923
+ return {
924
+ keyList
925
+ };
926
+ }
927
+ });
928
+ const _hoisted_1$a = { class: "shortCutKey" };
929
+ const _hoisted_2$7 = { class: "keyContent" };
930
+ function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
931
+ return openBlock(), createElementBlock("div", _hoisted_1$a, [
932
+ _cache[0] || (_cache[0] = createElementVNode("div", { class: "title" }, "\u5FEB\u6377\u952E", -1)),
933
+ createElementVNode("div", _hoisted_2$7, [
934
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.keyList, (item, index2) => {
935
+ return openBlock(), createElementBlock("div", { key: index2 }, [
936
+ createElementVNode("span", null, toDisplayString(item.key), 1),
937
+ createElementVNode("span", null, toDisplayString(item.value), 1)
938
+ ]);
939
+ }), 128))
940
+ ]),
941
+ _cache[1] || (_cache[1] = createElementVNode("div", { class: "san" }, null, -1))
942
+ ]);
943
+ }
944
+ var shortcutKey = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["render", _sfc_render$b]]);
945
+ const _sfc_main$a = defineComponent({
946
+ components: {
947
+ shortcutKey
948
+ },
949
+ setup() {
950
+ const { uiControl: uiControl2 } = inject("control") || {};
951
+ const controllerSize = ref();
952
+ const shortCutShow = ref(false);
953
+ const handleCanvasSize = (size) => {
954
+ if (!size) {
955
+ uiControl2 == null ? void 0 : uiControl2.set("scale", 1);
956
+ } else {
957
+ uiControl2 == null ? void 0 : uiControl2.set("scale", ((uiControl2 == null ? void 0 : uiControl2.get("scale")) || 1) + size);
958
+ }
959
+ };
960
+ const handleShortCutHidden = () => {
961
+ shortCutShow.value = false;
962
+ };
963
+ const handleShortcutShow = () => {
964
+ shortCutShow.value = true;
965
+ };
966
+ return {
967
+ size: computed(() => (uiControl2 == null ? void 0 : uiControl2.get("scale")) || 1),
968
+ handleCanvasSize,
969
+ controllerSize,
970
+ shortCutShow,
971
+ handleShortCutHidden,
972
+ handleShortcutShow
973
+ };
974
+ }
975
+ });
976
+ const _hoisted_1$9 = {
977
+ class: "controller_edit_size",
978
+ ref: "controllerSize"
979
+ };
980
+ function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
981
+ const _component_shortcutKey = resolveComponent("shortcutKey");
982
+ return openBlock(), createElementBlock("div", _hoisted_1$9, [
983
+ createElementVNode("span", {
984
+ onClick: _cache[0] || (_cache[0] = ($event) => _ctx.handleCanvasSize(0.1))
985
+ }, _cache[5] || (_cache[5] = [
986
+ createElementVNode("i", { class: "iconfontui icon-jiahao" }, null, -1)
987
+ ])),
988
+ createElementVNode("span", null, toDisplayString(parseInt(String(_ctx.size * 100))) + "%", 1),
989
+ createElementVNode("span", {
990
+ onClick: _cache[1] || (_cache[1] = ($event) => _ctx.handleCanvasSize(-0.1))
991
+ }, _cache[6] || (_cache[6] = [
992
+ createElementVNode("i", { class: "iconfontui icon-jianhao" }, null, -1)
993
+ ])),
994
+ createElementVNode("span", {
995
+ onMouseover: _cache[2] || (_cache[2] = (...args) => _ctx.handleShortcutShow && _ctx.handleShortcutShow(...args)),
996
+ onMouseleave: _cache[3] || (_cache[3] = (...args) => _ctx.handleShortCutHidden && _ctx.handleShortCutHidden(...args))
997
+ }, [
998
+ _cache[7] || (_cache[7] = createElementVNode("i", { class: "iconfontui icon-jianpan_o" }, null, -1)),
999
+ createVNode(Transition, { name: "slide-fade" }, {
1000
+ default: withCtx(() => [
1001
+ withDirectives(createVNode(_component_shortcutKey, null, null, 512), [
1002
+ [vShow, _ctx.shortCutShow]
1003
+ ])
1004
+ ]),
1005
+ _: 1
1006
+ })
1007
+ ], 32),
1008
+ createElementVNode("span", {
1009
+ onClick: _cache[4] || (_cache[4] = ($event) => _ctx.handleCanvasSize()),
1010
+ title: "\u590D\u4F4D"
1011
+ }, _cache[8] || (_cache[8] = [
1012
+ createElementVNode("i", { class: "iconfontui icon-huanyuan" }, null, -1)
1013
+ ]))
1014
+ ], 512);
1015
+ }
1016
+ var ControllEditSize = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["render", _sfc_render$a]]);
1017
+ const globalFormList = [
1018
+ {
1019
+ ControlType: "RadioGroup",
1020
+ nameCn: "\u9009\u62E9\u5668",
1021
+ data: {
1022
+ fieldName: "labelalign",
1023
+ label: "\u6807\u7B7E\u5BF9\u9F50\u65B9\u5F0F",
1024
+ showRule: "{}",
1025
+ rule: "[]",
1026
+ itemConfig: {
1027
+ value: "right",
1028
+ items: [
1029
+ {
1030
+ label: "Top",
1031
+ value: "top",
1032
+ select: true,
1033
+ id: 1
1034
+ },
1035
+ {
1036
+ label: "Left",
1037
+ value: "left",
1038
+ id: 2
1039
+ },
1040
+ {
1041
+ label: "Right",
1042
+ value: "right",
1043
+ select: false,
1044
+ id: 4
1045
+ }
1046
+ ],
1047
+ id: 4
1048
+ }
1049
+ }
1050
+ },
1051
+ {
1052
+ ControlType: "RadioGroup",
1053
+ nameCn: "\u9009\u62E9\u5668",
1054
+ data: {
1055
+ fieldName: "size",
1056
+ label: "\u7EC4\u4EF6\u5C3A\u5BF8",
1057
+ showRule: "{}",
1058
+ rule: "[]",
1059
+ itemConfig: {
1060
+ value: "small",
1061
+ items: [
1062
+ {
1063
+ label: "large",
1064
+ value: "large",
1065
+ select: false,
1066
+ id: 1
1067
+ },
1068
+ {
1069
+ label: "default",
1070
+ value: "default",
1071
+ select: false,
1072
+ id: 2
1073
+ },
1074
+ {
1075
+ label: "small",
1076
+ value: "small",
1077
+ select: true,
1078
+ id: 3
1079
+ }
1080
+ ],
1081
+ id: 3
1082
+ }
1083
+ }
1084
+ },
1085
+ {
1086
+ ControlType: "InputNumber",
1087
+ data: {
1088
+ fieldName: "labelWidth",
1089
+ label: "\u6807\u7B7E\u5BBD\u5EA6",
1090
+ tip: "",
1091
+ showRule: "{}",
1092
+ required: false,
1093
+ rule: "[]",
1094
+ default: 100
1095
+ }
1096
+ },
1097
+ {
1098
+ ControlType: "Text",
1099
+ nameCn: "\u6587\u672C\u6846",
1100
+ data: {
1101
+ fieldName: "suffix",
1102
+ label: "\u8868\u5355\u9879\u540E\u7F00",
1103
+ tip: "",
1104
+ placeholder: "",
1105
+ showRule: "{}",
1106
+ required: false,
1107
+ rule: "[]",
1108
+ default: ":"
1109
+ }
1110
+ },
1111
+ {
1112
+ ControlType: "FormStyle",
1113
+ nameCn: "\u6587\u672C\u6846",
1114
+ data: {
1115
+ fieldName: "styles",
1116
+ label: "\u8868\u5355\u6837\u5F0F\u8868",
1117
+ tip: "",
1118
+ placeholder: "",
1119
+ showRule: "{}",
1120
+ required: false,
1121
+ rule: "[]",
1122
+ default: ""
1123
+ }
1124
+ },
1125
+ {
1126
+ ControlType: "Selecteds",
1127
+ nameCn: "\u6587\u672C\u6846",
1128
+ dynamic: true,
1129
+ data: {
1130
+ fieldName: "csslist",
1131
+ label: "\u81EA\u5B9A\u4E49Class",
1132
+ tip: "",
1133
+ placeholder: "",
1134
+ showRule: "{}",
1135
+ required: false,
1136
+ rule: "[]",
1137
+ itemConfig: {
1138
+ value: [],
1139
+ items: []
1140
+ }
1141
+ }
1142
+ }
1143
+ ];
1144
+ var Loading_vue_vue_type_style_index_0_scoped_true_lang = "";
1145
+ const _sfc_main$9 = {};
1146
+ const _hoisted_1$8 = { class: "loading" };
1147
+ function _sfc_render$9(_ctx, _cache) {
1148
+ const _directive_loading = ElLoadingDirective;
1149
+ return withDirectives((openBlock(), createElementBlock("div", _hoisted_1$8, null, 512)), [
1150
+ [_directive_loading, true]
1151
+ ]);
1152
+ }
1153
+ var Loading = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["render", _sfc_render$9], ["__scopeId", "data-v-1e4ed2fd"]]);
1154
+ const _sfc_main$8 = defineComponent({
1155
+ props: {
1156
+ column: {
1157
+ type: Boolean,
1158
+ default: true
1159
+ },
1160
+ panel: {
1161
+ type: Array,
1162
+ default: () => ["form", "json", "global"]
1163
+ }
1164
+ },
1165
+ components: {
1166
+ ControllEditSize,
1167
+ jsonEnter: defineAsyncComponent({
1168
+ loader: () => import("./jsonEditor.js"),
1169
+ loadingComponent: Loading
1170
+ }),
1171
+ globalFormComponent: defineAsyncComponent({
1172
+ loader: () => import("./globalFormList.js"),
1173
+ loadingComponent: Loading
1174
+ })
1175
+ },
1176
+ setup(props, { emit }) {
1177
+ const { proxy: proxy2 } = getCurrentInstance();
1178
+ const { uiControl: uiControl2, hisContrl: hisContrl2, formStore: formStore2 } = inject("control") || {};
1179
+ const moduleIsHidden = ref(true);
1180
+ const show = ref(true);
1181
+ const ruleForm = ref();
1182
+ const editRight = ref();
1183
+ const activeName = ref("form");
1184
+ const jsonCenter = ref();
1185
+ let jsonEditor = null;
1186
+ const isTransition = ref(true);
1187
+ const controlItems = computed(() => formStore2 == null ? void 0 : formStore2.getControlItems());
1188
+ const curControl = computed(() => formStore2 == null ? void 0 : formStore2.get("curControl"));
1189
+ const newCurControl = computed(
1190
+ () => proxy2.$Flex.deepClone(formStore2 == null ? void 0 : formStore2.get("curControl"))
1191
+ );
1192
+ const historyFlag = computed(() => hisContrl2 == null ? void 0 : hisContrl2.get("historyFlag"));
1193
+ const save = computed(() => formStore2 == null ? void 0 : formStore2.get("save"));
1194
+ const currentIndex = computed(() => formStore2 == null ? void 0 : formStore2.get("currentIndex"));
1195
+ const handleEditBtn = () => {
1196
+ moduleIsHidden.value = !moduleIsHidden.value;
1197
+ if (moduleIsHidden.value) {
1198
+ uiControl2 == null ? void 0 : uiControl2.set("columnWidth", { right: void 0 });
1199
+ } else {
1200
+ uiControl2 == null ? void 0 : uiControl2.set("columnWidth", { right: 0 });
1201
+ }
1202
+ };
1203
+ const globalData = formStore2 == null ? void 0 : formStore2.getDynamicForm(globalFormList);
1204
+ formStore2 == null ? void 0 : formStore2.set("globalDatas", globalData);
1205
+ formStore2 == null ? void 0 : formStore2.set("globalFormList", globalFormList);
1206
+ const globalFormLists = computed(() => formStore2 == null ? void 0 : formStore2.get("globalFormList"));
1207
+ const globalDatas = computed(() => formStore2 == null ? void 0 : formStore2.get("globalDatas"));
1208
+ const handleMouseDown = async () => {
1209
+ formStore2 == null ? void 0 : formStore2.setFormCurrentId("");
1210
+ formStore2 == null ? void 0 : formStore2.setFormCurrentIndex(-1);
1211
+ };
1212
+ const preview = computed(() => formStore2 == null ? void 0 : formStore2.get("preview"));
1213
+ const allFormList = computed(
1214
+ () => formStore2 == null ? void 0 : formStore2.getAllFormList()
1215
+ );
1216
+ const checkNowFormValidate = function(content) {
1217
+ return new Promise((resolve) => {
1218
+ ruleForm.value.validate((valid) => {
1219
+ if (!valid) {
1220
+ ElNotification$1({
1221
+ title: "Error",
1222
+ message: content,
1223
+ type: "error"
1224
+ });
1225
+ resolve(false);
1226
+ } else {
1227
+ resolve(true);
1228
+ }
1229
+ });
1230
+ });
1231
+ };
1232
+ function checkLayoutForm(curControl2) {
1233
+ if (curControl2.ControlType == "TableLayout") {
1234
+ const trs = curControl2.data.trs || [];
1235
+ for (let i = 0; i < trs.length; i++) {
1236
+ const tds = trs[i].tds;
1237
+ for (let j = 0; j < tds.length; j++) {
1238
+ const state2 = checkFormValidate(tds[j].list);
1239
+ if (!state2) {
1240
+ return state2;
1241
+ }
1242
+ }
1243
+ }
1244
+ } else if (curControl2.ControlType == "Grid") {
1245
+ const columns = curControl2.data.columns || [];
1246
+ for (let i = 0; i < columns.length; i++) {
1247
+ const list = columns[i].list;
1248
+ const state2 = checkFormValidate(list);
1249
+ if (!state2) {
1250
+ return state2;
1251
+ }
1252
+ }
1253
+ }
1254
+ return true;
1255
+ }
1256
+ const checkFormValidate = async (list) => {
1257
+ var _a;
1258
+ if (!list)
1259
+ return;
1260
+ const len = list.length;
1261
+ for (let i = 0; i < len; ++i) {
1262
+ let validate = true;
1263
+ const curControl2 = list[i];
1264
+ (_a = curControl2.controlItems) == null ? void 0 : _a.forEach((item) => {
1265
+ if (item.data.required) {
1266
+ validate = !!curControl2.data[item.data.fieldName];
1267
+ }
1268
+ });
1269
+ if (validate && curControl2.layout) {
1270
+ validate = checkLayoutForm(curControl2);
1271
+ }
1272
+ if (!validate) {
1273
+ formStore2 == null ? void 0 : formStore2.setFormCurrentId(curControl2.id);
1274
+ activeName.value = "form";
1275
+ await nextTick();
1276
+ const valid = await checkNowFormValidate(
1277
+ "\u8BF7\u68C0\u67E5\u52A8\u6001\u8868\u5355\u8F93\u5165\u683C\u5F0F\u95EE\u9898"
1278
+ );
1279
+ if (!valid) {
1280
+ return false;
1281
+ }
1282
+ }
1283
+ }
1284
+ return true;
1285
+ };
1286
+ const formUpdate = computed(() => formStore2 == null ? void 0 : formStore2.get("formUpdate"));
1287
+ const newAllmainlist = computed(
1288
+ () => proxy2.$Flex.deepClone(formStore2 == null ? void 0 : formStore2.get("allFormList"))
1289
+ );
1290
+ const checkValidates = async (formSave = false, type) => {
1291
+ const curControlIndex = formStore2 == null ? void 0 : formStore2.get("currentIndex");
1292
+ if (type && preview.value)
1293
+ return;
1294
+ if (preview.value || save.value || formUpdate.value) {
1295
+ const ispreview = await checkFormValidate(allFormList.value);
1296
+ if (ispreview) {
1297
+ formStore2 == null ? void 0 : formStore2.setFormCurrentIndex(curControlIndex);
1298
+ }
1299
+ formStore2 == null ? void 0 : formStore2.setSave(true);
1300
+ formStore2 == null ? void 0 : formStore2.setFormUpdate(false);
1301
+ if (ispreview) {
1302
+ const result2 = initFormToJson(allFormList.value);
1303
+ formStore2 == null ? void 0 : formStore2.set("AllFormResult", result2);
1304
+ formStore2 == null ? void 0 : formStore2.handleDynamicForm();
1305
+ emit("save");
1306
+ }
1307
+ if (!formSave) {
1308
+ formStore2 == null ? void 0 : formStore2.set("previewShow", ispreview);
1309
+ formStore2 == null ? void 0 : formStore2.set("preview", false);
1310
+ } else if (ispreview) {
1311
+ ElNotification$1({
1312
+ title: "Success",
1313
+ message: type ? "\u5DF2\u81EA\u52A8\u4FDD\u5B58" : "\u4FDD\u5B58\u6210\u529F",
1314
+ type: "success"
1315
+ });
1316
+ }
1317
+ }
1318
+ };
1319
+ const initFormToJson = (formlist) => {
1320
+ return window.VueContext.$Flex.initFormToJson(toRaw(formlist));
1321
+ };
1322
+ function complareControl(newControl, oldContrl) {
1323
+ if (newControl !== oldContrl)
1324
+ return false;
1325
+ let same = true;
1326
+ for (const key in newControl) {
1327
+ if (newControl[key] !== oldContrl[key]) {
1328
+ same = false;
1329
+ }
1330
+ }
1331
+ return same;
1332
+ }
1333
+ function initJsonToForm(list) {
1334
+ return toRaw(list).map((item) => {
1335
+ return proxy2.$Flex.jsonToForm(item);
1336
+ });
1337
+ }
1338
+ function handleClick(tab) {
1339
+ if (tab.props.name == "json" && jsonCenter.value) {
1340
+ jsonEditor = jsonCenter.value.initJsonCenter();
1341
+ } else if (tab.props.name == "form" && jsonEditor) {
1342
+ try {
1343
+ const list = proxy2.$Flex.tryParseJson(jsonEditor.getText());
1344
+ let newAllList = [];
1345
+ newAllList = initJsonToForm(list);
1346
+ formStore2 == null ? void 0 : formStore2.updateAllFormList(newAllList);
1347
+ } catch (e) {
1348
+ console.error(e);
1349
+ }
1350
+ }
1351
+ }
1352
+ function onEditor(editor) {
1353
+ jsonEditor = editor;
1354
+ }
1355
+ proxy2.$EventBus.on("openPreview", async () => {
1356
+ checkValidates();
1357
+ });
1358
+ proxy2.$EventBus.on("setSave", async (type) => {
1359
+ checkValidates(true, type);
1360
+ });
1361
+ watch(
1362
+ () => {
1363
+ var _a;
1364
+ return [newAllmainlist.value, (_a = newCurControl.value) == null ? void 0 : _a.data];
1365
+ },
1366
+ ([, b], [, d]) => {
1367
+ if (activeName.value == "json" && jsonCenter.value) {
1368
+ jsonCenter.value.initJsonCenter();
1369
+ }
1370
+ if (historyFlag.value) {
1371
+ hisContrl2 == null ? void 0 : hisContrl2.set("historyFlag", false);
1372
+ return;
1373
+ }
1374
+ if (!complareControl(b, d)) {
1375
+ formStore2 == null ? void 0 : formStore2.setHistory();
1376
+ }
1377
+ },
1378
+ {
1379
+ deep: true
1380
+ }
1381
+ );
1382
+ watch(
1383
+ () => {
1384
+ var _a;
1385
+ return (_a = curControl.value) == null ? void 0 : _a.data;
1386
+ },
1387
+ async () => {
1388
+ if (!formUpdate.value) {
1389
+ formStore2 == null ? void 0 : formStore2.setFormUpdate(true);
1390
+ }
1391
+ },
1392
+ { deep: true }
1393
+ );
1394
+ return {
1395
+ globalFormLists,
1396
+ globalDatas,
1397
+ jsonCenter,
1398
+ handleClick,
1399
+ jsonEditor,
1400
+ onEditor,
1401
+ activeName,
1402
+ handleMouseDown,
1403
+ moduleIsHidden,
1404
+ handleEditBtn,
1405
+ isTransition,
1406
+ editRight,
1407
+ controlItems,
1408
+ curControl,
1409
+ ruleForm,
1410
+ show,
1411
+ currentIndex
1412
+ };
1413
+ }
1414
+ });
1415
+ const _hoisted_1$7 = {
1416
+ class: "editor_pages_right editor_pages_right_visible",
1417
+ ref: "editRight"
1418
+ };
1419
+ const _hoisted_2$6 = {
1420
+ key: 0,
1421
+ class: "json"
1422
+ };
1423
+ function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
1424
+ const _component_ControllEditSize = resolveComponent("ControllEditSize");
1425
+ const _component_el_form_item = ElFormItem;
1426
+ const _component_el_form = ElForm;
1427
+ const _component_el_empty = ElEmpty;
1428
+ const _component_el_scrollbar = ElScrollbar;
1429
+ const _component_el_tab_pane = ElTabPane;
1430
+ const _component_jsonEnter = resolveComponent("jsonEnter");
1431
+ const _component_globalFormComponent = resolveComponent("globalFormComponent");
1432
+ const _component_el_tabs = ElTabs;
1433
+ return openBlock(), createElementBlock("div", _hoisted_1$7, [
1434
+ _ctx.column ? (openBlock(), createElementBlock("div", {
1435
+ key: 0,
1436
+ class: "editor_container",
1437
+ onMousedown: _cache[0] || (_cache[0] = (...args) => _ctx.handleMouseDown && _ctx.handleMouseDown(...args))
1438
+ }, [
1439
+ createVNode(_component_ControllEditSize)
1440
+ ], 32)) : createCommentVNode("", true),
1441
+ createVNode(_component_el_tabs, {
1442
+ modelValue: _ctx.activeName,
1443
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.activeName = $event),
1444
+ class: "demo-tabs",
1445
+ onTabClick: _ctx.handleClick,
1446
+ style: { "height": "100%" }
1447
+ }, {
1448
+ default: withCtx(() => [
1449
+ _ctx.panel.includes("form") ? (openBlock(), createBlock(_component_el_tab_pane, {
1450
+ key: 0,
1451
+ label: "\u7EC4\u4EF6\u914D\u7F6E",
1452
+ name: "form"
1453
+ }, {
1454
+ default: withCtx(() => [
1455
+ createVNode(_component_el_scrollbar, { class: "dynamic" }, {
1456
+ default: withCtx(() => [
1457
+ createVNode(_component_el_form, {
1458
+ ref: "ruleForm",
1459
+ model: _ctx.curControl && (_ctx.curControl.data || {}),
1460
+ rules: _ctx.curControl && _ctx.curControl.rules,
1461
+ "label-width": "120px",
1462
+ "status-icon": true
1463
+ }, {
1464
+ default: withCtx(() => [
1465
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.controlItems, (item) => {
1466
+ return openBlock(), createBlock(_component_el_form_item, {
1467
+ key: item.id,
1468
+ control: item.ControlType,
1469
+ prop: item.data.fieldName
1470
+ }, {
1471
+ default: withCtx(() => [
1472
+ _ctx.show && item.ControlType === "JsonEditor" || item.ControlType !== "JsonEditor" ? (openBlock(), createBlock(resolveDynamicComponent(item.ControlType), {
1473
+ key: 0,
1474
+ drag: false,
1475
+ data: _ctx.curControl.data,
1476
+ item,
1477
+ size: _ctx.globalDatas.size,
1478
+ labelWidth: _ctx.globalDatas.labelWidth,
1479
+ labelalign: _ctx.globalDatas.labelalign
1480
+ }, null, 8, ["data", "item", "size", "labelWidth", "labelalign"])) : createCommentVNode("", true)
1481
+ ]),
1482
+ _: 2
1483
+ }, 1032, ["control", "prop"]);
1484
+ }), 128))
1485
+ ]),
1486
+ _: 1
1487
+ }, 8, ["model", "rules"]),
1488
+ !_ctx.curControl || !_ctx.curControl.data ? (openBlock(), createBlock(_component_el_empty, {
1489
+ key: 0,
1490
+ "image-size": 200,
1491
+ description: "\u6CA1\u6709\u9009\u4E2D\u8868\u5355\u63A7\u4EF6"
1492
+ })) : createCommentVNode("", true)
1493
+ ]),
1494
+ _: 1
1495
+ })
1496
+ ]),
1497
+ _: 1
1498
+ })) : createCommentVNode("", true),
1499
+ _ctx.panel.includes("json") ? (openBlock(), createBlock(_component_el_tab_pane, {
1500
+ key: 1,
1501
+ label: "JSON\u914D\u7F6E",
1502
+ name: "json"
1503
+ }, {
1504
+ default: withCtx(() => [
1505
+ _ctx.activeName == "json" ? (openBlock(), createElementBlock("div", _hoisted_2$6, [
1506
+ createVNode(_component_jsonEnter, {
1507
+ ref: "jsonCenter",
1508
+ onEditor: _ctx.onEditor
1509
+ }, null, 8, ["onEditor"])
1510
+ ])) : createCommentVNode("", true)
1511
+ ]),
1512
+ _: 1
1513
+ })) : createCommentVNode("", true),
1514
+ _ctx.panel.includes("global") ? (openBlock(), createBlock(_component_el_tab_pane, {
1515
+ key: 2,
1516
+ label: "\u8868\u5355\u914D\u7F6E",
1517
+ name: "global"
1518
+ }, {
1519
+ default: withCtx(() => [
1520
+ _ctx.activeName == "global" ? (openBlock(), createBlock(_component_el_scrollbar, {
1521
+ key: 0,
1522
+ class: "form_tab3"
1523
+ }, {
1524
+ default: withCtx(() => [
1525
+ createVNode(_component_globalFormComponent)
1526
+ ]),
1527
+ _: 1
1528
+ })) : createCommentVNode("", true)
1529
+ ]),
1530
+ _: 1
1531
+ })) : createCommentVNode("", true)
1532
+ ]),
1533
+ _: 1
1534
+ }, 8, ["modelValue", "onTabClick"]),
1535
+ createElementVNode("div", {
1536
+ class: "editor_right_accept",
1537
+ onClick: _cache[2] || (_cache[2] = (...args) => _ctx.handleEditBtn && _ctx.handleEditBtn(...args))
1538
+ }, [
1539
+ createElementVNode("i", {
1540
+ class: normalizeClass([
1541
+ "iconfontui icon-jiantou_xiangyouliangci",
1542
+ _ctx.moduleIsHidden ? "icon-jiantou_xiangyouliangci" : "icon-jiantou_xiangzuoliangci"
1543
+ ])
1544
+ }, null, 2)
1545
+ ])
1546
+ ], 512);
1547
+ }
1548
+ var __unplugin_components_4 = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["render", _sfc_render$8]]);
1549
+ const state$1 = reactive({
1550
+ form: state$3,
1551
+ copyContent: {},
1552
+ curList: []
1553
+ });
1554
+ class ShortCut {
1555
+ copy(list) {
1556
+ if (state$1.form.currentIndex > -1) {
1557
+ state$1.copyContent = list[state$1.form.currentIndex];
1558
+ }
1559
+ }
1560
+ paste(list) {
1561
+ if (state$1.copyContent) {
1562
+ const pasteControl = window.VueContext.$Flex.deepClone(state$1.copyContent);
1563
+ if (pasteControl.data) {
1564
+ pasteControl.data.fieldName = pasteControl.ControlType + "_" + window.VueContext.$Flex.generateMixed();
1565
+ pasteControl.id = window.VueContext.$Flex.generateMixed();
1566
+ list.push(pasteControl);
1567
+ state$1.form.formUpdate = true;
1568
+ }
1569
+ }
1570
+ }
1571
+ delete(list) {
1572
+ list.splice(state$1.form.currentIndex, 1);
1573
+ state$1.form.curControl = {};
1574
+ state$1.form.formUpdate = true;
1575
+ state$1.form.currentIndex = -1;
1576
+ state$1.form.currentId = "";
1577
+ }
1578
+ onTop(list) {
1579
+ if (state$1.form.currentIndex > 0) {
1580
+ const temp = list.splice(state$1.form.currentIndex, 1);
1581
+ state$1.form.currentIndex -= 1;
1582
+ list.splice(state$1.form.currentIndex, 0, ...temp);
1583
+ }
1584
+ }
1585
+ onBottom(list) {
1586
+ if (state$1.form.currentIndex < list.length - 1) {
1587
+ const temp = list.splice(state$1.form.currentIndex, 1);
1588
+ state$1.form.currentIndex += 1;
1589
+ list.splice(state$1.form.currentIndex, 0, ...temp);
1590
+ }
1591
+ }
1592
+ clear() {
1593
+ state$1.form.allFormList.length = 0;
1594
+ state$1.form.formUpdate = true;
1595
+ }
1596
+ moveTop() {
1597
+ if (state$1.form.currentIndex > 0) {
1598
+ state$1.form.currentIndex -= 1;
1599
+ }
1600
+ }
1601
+ moveBottom(list) {
1602
+ if (state$1.form.currentIndex < list.length - 1) {
1603
+ state$1.form.currentIndex += 1;
1604
+ }
1605
+ }
1606
+ set(name, value) {
1607
+ state$1[name] = value;
1608
+ }
1609
+ get(name) {
1610
+ return state$1[name];
1611
+ }
1612
+ commit(event) {
1613
+ this[event](state$1.curList);
1614
+ }
1615
+ }
1616
+ var store = new ShortCut();
1617
+ function clearCanvas() {
1618
+ store.commit("clear");
1619
+ }
1620
+ function copy() {
1621
+ store.commit("copy");
1622
+ }
1623
+ function paste() {
1624
+ store.commit("paste");
1625
+ }
1626
+ function cut() {
1627
+ store.commit("copy");
1628
+ store.commit("delete");
1629
+ }
1630
+ function onDelete() {
1631
+ store.commit("delete");
1632
+ }
1633
+ function onTop() {
1634
+ store.commit("onTop");
1635
+ }
1636
+ function onBottom() {
1637
+ store.commit("onBottom");
1638
+ }
1639
+ const result = {
1640
+ copy,
1641
+ paste,
1642
+ cut,
1643
+ delete: onDelete,
1644
+ onTop,
1645
+ onBottom,
1646
+ clearCanvas
1647
+ };
1648
+ const _sfc_main$7 = defineComponent({
1649
+ props: {
1650
+ active: Boolean,
1651
+ currentIndex: Number,
1652
+ len: {
1653
+ type: Number,
1654
+ default: 0
1655
+ },
1656
+ inline: Boolean,
1657
+ layout: Boolean,
1658
+ currentId: String,
1659
+ item: Object
1660
+ },
1661
+ setup(props, context) {
1662
+ const isShow = ref(false);
1663
+ const editForm = ref();
1664
+ const { store: store2 } = inject("control") || {};
1665
+ const { emit } = context;
1666
+ const copyContent = computed(() => store2 == null ? void 0 : store2.get("copyContent"));
1667
+ const handleShortCut = (e) => {
1668
+ if (props.active) {
1669
+ e.preventDefault();
1670
+ isShow.value = true;
1671
+ const x = e.offsetX;
1672
+ const y = e.offsetY;
1673
+ nextTick(() => {
1674
+ editForm.value.style.left = x + "px";
1675
+ editForm.value.style.top = y + "px";
1676
+ });
1677
+ }
1678
+ };
1679
+ watch(
1680
+ () => props.active,
1681
+ () => {
1682
+ if (!props.active) {
1683
+ isShow.value = props.active;
1684
+ }
1685
+ }
1686
+ );
1687
+ const handleMenu = () => {
1688
+ isShow.value = false;
1689
+ };
1690
+ const handleActive = (type) => {
1691
+ if (type === "copy") {
1692
+ copy();
1693
+ } else if (type === "paste") {
1694
+ emit("paste");
1695
+ paste();
1696
+ } else if (type === "cut") {
1697
+ cut();
1698
+ } else if (type === "delete") {
1699
+ onDelete();
1700
+ } else if (type === "top") {
1701
+ onTop();
1702
+ } else if (type === "bottom") {
1703
+ onBottom();
1704
+ }
1705
+ };
1706
+ const handleCopyAndPaste = () => {
1707
+ copy();
1708
+ emit("paste");
1709
+ paste();
1710
+ };
1711
+ document.addEventListener("click", () => {
1712
+ isShow.value = false;
1713
+ });
1714
+ const handleColumn = () => {
1715
+ var _a;
1716
+ const td = {
1717
+ tds: [
1718
+ {
1719
+ colspan: 1,
1720
+ rowspan: 1,
1721
+ list: []
1722
+ },
1723
+ {
1724
+ colspan: 1,
1725
+ rowspan: 1,
1726
+ list: []
1727
+ }
1728
+ ]
1729
+ };
1730
+ (_a = props.item) == null ? void 0 : _a.data.trs.push(td);
1731
+ };
1732
+ const handleRow = () => {
1733
+ var _a;
1734
+ (_a = props.item) == null ? void 0 : _a.data.trs.forEach((trs) => {
1735
+ trs.tds.push({
1736
+ colspan: 1,
1737
+ rowspan: 1,
1738
+ list: []
1739
+ });
1740
+ });
1741
+ };
1742
+ return {
1743
+ isShow,
1744
+ handleShortCut,
1745
+ handleMenu,
1746
+ editForm,
1747
+ handleActive,
1748
+ handleCopyAndPaste,
1749
+ copyContent,
1750
+ handleColumn,
1751
+ handleRow
1752
+ };
1753
+ }
1754
+ });
1755
+ const _hoisted_1$6 = {
1756
+ class: "editForm",
1757
+ ref: "editForm"
1758
+ };
1759
+ const _hoisted_2$5 = {
1760
+ key: 0,
1761
+ class: "editbar"
1762
+ };
1763
+ function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
1764
+ return openBlock(), createElementBlock("div", {
1765
+ class: normalizeClass([
1766
+ "shape",
1767
+ _ctx.active ? _ctx.layout ? "shape_border shape_border_layout" : "shape_border" : _ctx.layout ? "noactive_layout" : ""
1768
+ ]),
1769
+ onContextmenu: _cache[12] || (_cache[12] = (...args) => _ctx.handleShortCut && _ctx.handleShortCut(...args)),
1770
+ onClick: _cache[13] || (_cache[13] = (...args) => _ctx.handleMenu && _ctx.handleMenu(...args)),
1771
+ style: normalizeStyle({ display: _ctx.inline ? "inline-block" : "block" })
1772
+ }, [
1773
+ createVNode(Transition, {
1774
+ name: "fade",
1775
+ mode: "out-in",
1776
+ appear: ""
1777
+ }, {
1778
+ default: withCtx(() => [
1779
+ withDirectives(createElementVNode("div", _hoisted_1$6, [
1780
+ createElementVNode("span", {
1781
+ onClick: _cache[0] || (_cache[0] = ($event) => _ctx.handleActive("copy"))
1782
+ }, "\u590D\u5236"),
1783
+ createElementVNode("span", {
1784
+ onClick: _cache[1] || (_cache[1] = ($event) => _ctx.handleActive("cut"))
1785
+ }, "\u526A\u5207"),
1786
+ createElementVNode("span", {
1787
+ onClick: _cache[2] || (_cache[2] = ($event) => _ctx.handleActive("delete"))
1788
+ }, "\u5220\u9664"),
1789
+ _ctx.copyContent ? (openBlock(), createElementBlock("span", {
1790
+ key: 0,
1791
+ onClick: _cache[3] || (_cache[3] = ($event) => _ctx.handleActive("paste"))
1792
+ }, "\u7C98\u8D34")) : createCommentVNode("", true),
1793
+ _ctx.currentIndex != 0 ? (openBlock(), createElementBlock("span", {
1794
+ key: 1,
1795
+ onClick: _cache[4] || (_cache[4] = ($event) => _ctx.handleActive("top"))
1796
+ }, "\u4E0A\u79FB")) : createCommentVNode("", true),
1797
+ _ctx.currentIndex != _ctx.len - 1 ? (openBlock(), createElementBlock("span", {
1798
+ key: 2,
1799
+ onClick: _cache[5] || (_cache[5] = ($event) => _ctx.handleActive("bottom"))
1800
+ }, "\u4E0B\u79FB")) : createCommentVNode("", true)
1801
+ ], 512), [
1802
+ [vShow, _ctx.isShow && _ctx.active]
1803
+ ])
1804
+ ]),
1805
+ _: 1
1806
+ }),
1807
+ renderSlot(_ctx.$slots, "default"),
1808
+ _ctx.active ? (openBlock(), createElementBlock("div", _hoisted_2$5, [
1809
+ _ctx.currentIndex != 0 ? (openBlock(), createElementBlock("span", {
1810
+ key: 0,
1811
+ class: "iconfontui icon-xiangshang1",
1812
+ onClick: _cache[6] || (_cache[6] = withModifiers(($event) => _ctx.handleActive("top"), ["stop"]))
1813
+ })) : createCommentVNode("", true),
1814
+ _ctx.currentIndex != _ctx.len - 1 ? (openBlock(), createElementBlock("span", {
1815
+ key: 1,
1816
+ class: "iconfontui icon-xiangxia1",
1817
+ onClick: _cache[7] || (_cache[7] = withModifiers(($event) => _ctx.handleActive("bottom"), ["stop"]))
1818
+ })) : createCommentVNode("", true),
1819
+ _ctx.item && _ctx.item.ControlType == "TableLayout" ? (openBlock(), createElementBlock("span", {
1820
+ key: 2,
1821
+ class: "iconfontui icon--charulie",
1822
+ onClick: _cache[8] || (_cache[8] = (...args) => _ctx.handleRow && _ctx.handleRow(...args))
1823
+ })) : createCommentVNode("", true),
1824
+ _ctx.item && _ctx.item.ControlType == "TableLayout" ? (openBlock(), createElementBlock("span", {
1825
+ key: 3,
1826
+ class: "iconfontui icon--charuhang",
1827
+ onClick: _cache[9] || (_cache[9] = (...args) => _ctx.handleColumn && _ctx.handleColumn(...args))
1828
+ })) : createCommentVNode("", true),
1829
+ createElementVNode("span", {
1830
+ class: "iconfontui icon-fuzhi",
1831
+ onClick: _cache[10] || (_cache[10] = withModifiers((...args) => _ctx.handleCopyAndPaste && _ctx.handleCopyAndPaste(...args), ["stop"]))
1832
+ }),
1833
+ createElementVNode("span", {
1834
+ class: "iconfontui icon-shanchu1",
1835
+ onClick: _cache[11] || (_cache[11] = withModifiers(($event) => _ctx.handleActive("delete"), ["stop"]))
1836
+ })
1837
+ ])) : createCommentVNode("", true)
1838
+ ], 38);
1839
+ }
1840
+ var __unplugin_components_0$1 = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$7]]);
1841
+ var Shape = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1842
+ __proto__: null,
1843
+ "default": __unplugin_components_0$1
1844
+ }, Symbol.toStringTag, { value: "Module" }));
1845
+ const _sfc_main$6 = defineComponent({
1846
+ setup() {
1847
+ const { proxy: proxy2 } = getCurrentInstance();
1848
+ const { uiControl: uiControl2, store: store2, formStore: formStore2 } = inject("control") || {};
1849
+ const formcomponents = proxy2.$formcomponents;
1850
+ const canvasBox = ref();
1851
+ const canvasSize = ref(1);
1852
+ const dragDom = ref();
1853
+ const pasteShow = ref(false);
1854
+ const editForm = ref();
1855
+ const globalDatas = computed(() => formStore2 == null ? void 0 : formStore2.get("globalDatas"));
1856
+ const fullScreen = computed(() => uiControl2 == null ? void 0 : uiControl2.get("isFullscreen"));
1857
+ const pageType = computed(() => uiControl2 == null ? void 0 : uiControl2.get("pageType"));
1858
+ const dynamicList = computed(
1859
+ () => {
1860
+ var _a;
1861
+ return (_a = formStore2 == null ? void 0 : formStore2.get("globalFormList")) == null ? void 0 : _a.filter((item) => {
1862
+ if (item.dynamic) {
1863
+ return item;
1864
+ }
1865
+ });
1866
+ }
1867
+ );
1868
+ const allmainList = computed({
1869
+ get() {
1870
+ return formStore2 == null ? void 0 : formStore2.get("allFormList");
1871
+ },
1872
+ set(value) {
1873
+ value = value.map((item) => {
1874
+ console.log(formcomponents[item.ControlType]);
1875
+ if (!item.data && !item.controlItems) {
1876
+ item = proxy2.$Flex.deepClone(item);
1877
+ const currentComponent = formcomponents[item.ControlType];
1878
+ item.formConfig = currentComponent.formConfig;
1879
+ item.data = item.formConfig.data();
1880
+ if (!item.data.fieldName) {
1881
+ item.data.fieldName = item.ControlType + "_" + proxy2.$Flex.generateMixed();
1882
+ }
1883
+ item.id = proxy2.$Flex.generateMixed();
1884
+ let controlItems = item.formConfig.morenConfig().concat(dynamicList.value);
1885
+ if (currentComponent.actionType && currentComponent.actionType.length > 0) {
1886
+ console.log(controlItems);
1887
+ controlItems.find((item2) => {
1888
+ if (item2.ControlType == "Action") {
1889
+ item2.data.formConfig = {
1890
+ value: {},
1891
+ items: []
1892
+ };
1893
+ currentComponent.actionType.forEach(
1894
+ (action2, index2) => {
1895
+ item2.data.formConfig.items.push({
1896
+ label: action2,
1897
+ value: action2,
1898
+ id: index2 + 1
1899
+ });
1900
+ }
1901
+ );
1902
+ }
1903
+ });
1904
+ } else {
1905
+ controlItems = controlItems.filter((item2) => {
1906
+ if (item2.ControlType !== "Action") {
1907
+ return item2;
1908
+ }
1909
+ });
1910
+ }
1911
+ item.rules = proxy2.$Flex.controlFormRule(controlItems, item);
1912
+ item.controlItems = controlItems;
1913
+ }
1914
+ return item;
1915
+ });
1916
+ console.log("value", value);
1917
+ formStore2 == null ? void 0 : formStore2.updateAllFormList(value);
1918
+ }
1919
+ });
1920
+ const currentId = computed(() => {
1921
+ return formStore2 == null ? void 0 : formStore2.get("currentId");
1922
+ });
1923
+ const handleCanvasScale = () => {
1924
+ canvasBox.value.style.transform = `scale(${canvasSize.value})`;
1925
+ };
1926
+ const handleCanvasSize = (size) => {
1927
+ if (proxy2.$Flex.clickCountLimit()) {
1928
+ if (size === "add" && canvasSize.value < 1.5) {
1929
+ canvasSize.value = Number((canvasSize.value + 0.1).toFixed(2));
1930
+ } else if (size === "cut" && canvasSize.value > 0.5) {
1931
+ canvasSize.value = Number((canvasSize.value - 0.1).toFixed(2));
1932
+ } else if (size === "restore") {
1933
+ canvasSize.value = 1;
1934
+ }
1935
+ handleCanvasScale();
1936
+ }
1937
+ };
1938
+ const chooseClick = (e) => {
1939
+ var _a;
1940
+ formStore2 == null ? void 0 : formStore2.setFormCurrentId((_a = allmainList.value[e.oldIndex]) == null ? void 0 : _a.id);
1941
+ formStore2 == null ? void 0 : formStore2.setFormCurrentIndex(e.oldIndex);
1942
+ store2 == null ? void 0 : store2.set("curList", allmainList.value);
1943
+ };
1944
+ const changePos = (e) => {
1945
+ var _a;
1946
+ formStore2 == null ? void 0 : formStore2.setFormCurrentId((_a = allmainList.value[e.newIndex]) == null ? void 0 : _a.id);
1947
+ formStore2 == null ? void 0 : formStore2.setFormCurrentIndex(e.newIndex);
1948
+ store2 == null ? void 0 : store2.set("curList", allmainList.value);
1949
+ };
1950
+ const addControl = (e) => {
1951
+ var _a;
1952
+ formStore2 == null ? void 0 : formStore2.setFormCurrentId((_a = allmainList.value[e.newIndex]) == null ? void 0 : _a.id);
1953
+ formStore2 == null ? void 0 : formStore2.setFormCurrentIndex(e.newIndex);
1954
+ store2 == null ? void 0 : store2.set("curList", allmainList.value);
1955
+ };
1956
+ const handlePaste = () => {
1957
+ pasteShow.value = false;
1958
+ paste();
1959
+ };
1960
+ const handleNoDraggable = (e) => {
1961
+ if (pasteShow.value) {
1962
+ pasteShow.value = false;
1963
+ }
1964
+ e.preventDefault();
1965
+ const path = e.path;
1966
+ for (let i = 0; i < path.length; i++) {
1967
+ if (path[i].getAttribute && path[i].getAttribute("class") && path[i].getAttribute("class").indexOf("shape") >= 0) {
1968
+ return;
1969
+ }
1970
+ }
1971
+ const x = e.offsetX;
1972
+ const y = e.offsetY;
1973
+ nextTick(() => {
1974
+ editForm.value.style.left = x + "px";
1975
+ editForm.value.style.top = y + "px";
1976
+ pasteShow.value = true;
1977
+ });
1978
+ };
1979
+ return {
1980
+ scale: computed(() => uiControl2 == null ? void 0 : uiControl2.get("scale")),
1981
+ globalDatas,
1982
+ canvasBox,
1983
+ editForm,
1984
+ handleCanvasSize,
1985
+ pageType,
1986
+ canvasSize,
1987
+ dragDom,
1988
+ chooseClick,
1989
+ addControl,
1990
+ changePos,
1991
+ allmainList,
1992
+ currentId,
1993
+ handleNoDraggable,
1994
+ handlePaste,
1995
+ pasteShow,
1996
+ fullScreen,
1997
+ onEditorCenter: (e) => {
1998
+ if (e && e.path && e.path[0].className == "editor_pages_center") {
1999
+ formStore2 == null ? void 0 : formStore2.setFormCurrentId("");
2000
+ pasteShow.value = false;
2001
+ }
2002
+ }
2003
+ };
2004
+ }
2005
+ });
2006
+ const _hoisted_1$5 = {
2007
+ class: "editForm",
2008
+ ref: "editForm"
2009
+ };
2010
+ const _hoisted_2$4 = {
2011
+ key: 0,
2012
+ class: "form-empty"
2013
+ };
2014
+ function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
2015
+ var _a;
2016
+ const _component_Shape = __unplugin_components_0$1;
2017
+ const _component_draggable = resolveComponent("draggable");
2018
+ return openBlock(), createElementBlock("div", {
2019
+ class: "editor_pages_center",
2020
+ onClick: _cache[3] || (_cache[3] = (...args) => _ctx.onEditorCenter && _ctx.onEditorCenter(...args)),
2021
+ tabindex: "1"
2022
+ }, [
2023
+ createElementVNode("div", {
2024
+ class: normalizeClass(["canvasBox", [
2025
+ _ctx.fullScreen ? "fullScreenBox" : "",
2026
+ _ctx.pageType + "_layout",
2027
+ (_a = _ctx.globalDatas.csslist) == null ? void 0 : _a.join(" ")
2028
+ ]]),
2029
+ ref: "canvasBox",
2030
+ style: normalizeStyle(`--scale:${_ctx.scale} `)
2031
+ }, [
2032
+ createElementVNode("div", {
2033
+ class: "draggable_container",
2034
+ ref: "dragDom",
2035
+ onContextmenu: _cache[2] || (_cache[2] = (...args) => _ctx.handleNoDraggable && _ctx.handleNoDraggable(...args))
2036
+ }, [
2037
+ withDirectives(createElementVNode("div", _hoisted_1$5, [
2038
+ createElementVNode("span", {
2039
+ onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handlePaste && _ctx.handlePaste(...args))
2040
+ }, "\u7C98\u8D34")
2041
+ ], 512), [
2042
+ [vShow, _ctx.pasteShow]
2043
+ ]),
2044
+ createVNode(_component_draggable, {
2045
+ class: "dragArea",
2046
+ animation: "300",
2047
+ ghostClass: "itemGhost",
2048
+ modelValue: _ctx.allmainList,
2049
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.allmainList = $event),
2050
+ onAdd: _ctx.addControl,
2051
+ group: "starfish-form",
2052
+ onChoose: _ctx.chooseClick,
2053
+ "item-key": "id",
2054
+ onUpdate: _ctx.changePos
2055
+ }, {
2056
+ item: withCtx(({ element, index: index2 }) => [
2057
+ createVNode(_component_Shape, {
2058
+ active: _ctx.currentId == element.id,
2059
+ currentIndex: index2,
2060
+ currentId: element.id,
2061
+ item: element,
2062
+ len: _ctx.allmainList.length
2063
+ }, {
2064
+ default: withCtx(() => [
2065
+ (openBlock(), createBlock(resolveDynamicComponent(element.ControlType), mergeProps({
2066
+ drag: true,
2067
+ item: element,
2068
+ data: {}
2069
+ }, _ctx.globalDatas), null, 16, ["item"]))
2070
+ ]),
2071
+ _: 2
2072
+ }, 1032, ["active", "currentIndex", "currentId", "item", "len"])
2073
+ ]),
2074
+ _: 1
2075
+ }, 8, ["modelValue", "onAdd", "onChoose", "onUpdate"]),
2076
+ _ctx.allmainList.length == 0 ? (openBlock(), createElementBlock("div", _hoisted_2$4, " \u4ECE\u5DE6\u4FA7\u62D6\u62FD\u6765\u6DFB\u52A0\u5B57\u6BB5 ")) : createCommentVNode("", true)
2077
+ ], 544)
2078
+ ], 6)
2079
+ ]);
2080
+ }
2081
+ var __unplugin_components_3 = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["render", _sfc_render$6]]);
2082
+ const _sfc_main$5 = defineComponent({
2083
+ props: {
2084
+ basicFields: {
2085
+ type: Array,
2086
+ default() {
2087
+ return [];
2088
+ }
2089
+ },
2090
+ layoutFields: {
2091
+ type: Array,
2092
+ default() {
2093
+ return [];
2094
+ }
2095
+ }
2096
+ },
2097
+ data() {
2098
+ const formcomponents = this.$formcomponents;
2099
+ const lastFormComponents = [];
2100
+ for (const key in formcomponents) {
2101
+ const item = formcomponents[key];
2102
+ if (item.isHide) {
2103
+ continue;
2104
+ }
2105
+ const model = {};
2106
+ model.ControlType = item.ControlType;
2107
+ model.icon = item.icon;
2108
+ model.nameCn = item.nameCn;
2109
+ model.layout = !!item.layout;
2110
+ if (item.rule) {
2111
+ model.rule = item.rule;
2112
+ }
2113
+ lastFormComponents.push(model);
2114
+ }
2115
+ return {
2116
+ formcomponents: lastFormComponents,
2117
+ filterContent: ""
2118
+ };
2119
+ },
2120
+ computed: {
2121
+ newcomponentlist() {
2122
+ return this.formcomponents.filter((item) => {
2123
+ if (item.nameCn && item.nameCn.indexOf(this.filterContent) != -1 && !item.layout) {
2124
+ if (this.basicFields.length == 0) {
2125
+ return true;
2126
+ } else if (this.basicFields.length > 0) {
2127
+ let isHave = false;
2128
+ this.basicFields.find((fieldItem) => {
2129
+ if (fieldItem.toLocaleLowerCase() == item.ControlType.toLocaleLowerCase()) {
2130
+ isHave = true;
2131
+ return fieldItem;
2132
+ }
2133
+ });
2134
+ return isHave;
2135
+ }
2136
+ }
2137
+ });
2138
+ },
2139
+ layoutList() {
2140
+ return this.formcomponents.filter((item) => {
2141
+ if (item.nameCn && item.nameCn.indexOf(this.filterContent) != -1 && item.layout) {
2142
+ if (this.layoutFields.length == 0) {
2143
+ return true;
2144
+ } else if (this.layoutFields.length > 0) {
2145
+ let isHave = false;
2146
+ this.layoutFields.find((fieldItem) => {
2147
+ if (fieldItem.toLocaleLowerCase() == item.ControlType.toLocaleLowerCase()) {
2148
+ isHave = true;
2149
+ return fieldItem;
2150
+ }
2151
+ });
2152
+ return isHave;
2153
+ }
2154
+ }
2155
+ });
2156
+ }
2157
+ },
2158
+ methods: {
2159
+ clickAddControl(item) {
2160
+ formStore.setAllFormList(this.$Flex.jsonToForm(item));
2161
+ }
2162
+ }
2163
+ });
2164
+ const _hoisted_1$4 = { class: "filter" };
2165
+ const _hoisted_2$3 = ["alt", "onClick"];
2166
+ const _hoisted_3$3 = { class: "form-item" };
2167
+ const _hoisted_4$2 = { class: "item-text" };
2168
+ const _hoisted_5$2 = ["alt", "onClick"];
2169
+ const _hoisted_6$2 = { class: "form-item" };
2170
+ const _hoisted_7$1 = { class: "item-text" };
2171
+ function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
2172
+ const _component_el_input = ElInput;
2173
+ const _component_el_button = ElButton;
2174
+ const _component_draggable = resolveComponent("draggable");
2175
+ const _component_el_scrollbar = ElScrollbar;
2176
+ return openBlock(), createBlock(_component_el_scrollbar, { class: "editor_pages_left" }, {
2177
+ default: withCtx(() => [
2178
+ createElementVNode("div", _hoisted_1$4, [
2179
+ createVNode(_component_el_input, {
2180
+ placeholder: "\u8BF7\u8F93\u5165\u5173\u952E\u8BCD\u8FDB\u884C\u8FC7\u6EE4",
2181
+ size: "",
2182
+ modelValue: _ctx.filterContent,
2183
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.filterContent = $event)
2184
+ }, null, 8, ["modelValue"])
2185
+ ]),
2186
+ _ctx.newcomponentlist.length > 0 ? (openBlock(), createBlock(_component_el_button, {
2187
+ key: 0,
2188
+ text: ""
2189
+ }, {
2190
+ default: withCtx(() => _cache[1] || (_cache[1] = [
2191
+ createTextVNode("\u57FA\u7840\u63A7\u4EF6", -1)
2192
+ ])),
2193
+ _: 1,
2194
+ __: [1]
2195
+ })) : createCommentVNode("", true),
2196
+ createVNode(_component_draggable, {
2197
+ class: "dragArea list-group",
2198
+ list: _ctx.newcomponentlist,
2199
+ group: { name: "starfish-form", pull: "clone", put: false },
2200
+ sort: false,
2201
+ "item-key": "id"
2202
+ }, {
2203
+ item: withCtx(({ element }) => [
2204
+ createElementVNode("div", {
2205
+ class: "list-group-item",
2206
+ alt: element.nameCn,
2207
+ onClick: withModifiers(($event) => _ctx.clickAddControl(element), ["stop"])
2208
+ }, [
2209
+ createElementVNode("div", _hoisted_3$3, [
2210
+ createElementVNode("span", {
2211
+ class: normalizeClass(["iconfontui", element.icon])
2212
+ }, null, 2)
2213
+ ]),
2214
+ createElementVNode("div", _hoisted_4$2, toDisplayString(element.nameCn), 1)
2215
+ ], 8, _hoisted_2$3)
2216
+ ]),
2217
+ _: 1
2218
+ }, 8, ["list"]),
2219
+ _ctx.layoutList.length > 0 ? (openBlock(), createBlock(_component_el_button, {
2220
+ key: 1,
2221
+ text: ""
2222
+ }, {
2223
+ default: withCtx(() => _cache[2] || (_cache[2] = [
2224
+ createTextVNode("\u5E03\u5C40\u63A7\u4EF6", -1)
2225
+ ])),
2226
+ _: 1,
2227
+ __: [2]
2228
+ })) : createCommentVNode("", true),
2229
+ createVNode(_component_draggable, {
2230
+ class: "dragArea list-group",
2231
+ list: _ctx.layoutList,
2232
+ group: { name: "starfish-form", pull: "clone", put: false },
2233
+ sort: false,
2234
+ "item-key": "id"
2235
+ }, {
2236
+ item: withCtx(({ element }) => [
2237
+ createElementVNode("div", {
2238
+ class: "list-group-item",
2239
+ alt: element.nameCn,
2240
+ onClick: withModifiers(($event) => _ctx.clickAddControl(element), ["stop"])
2241
+ }, [
2242
+ createElementVNode("div", _hoisted_6$2, [
2243
+ createElementVNode("span", {
2244
+ class: normalizeClass(["iconfontui", element.icon])
2245
+ }, null, 2)
2246
+ ]),
2247
+ createElementVNode("div", _hoisted_7$1, toDisplayString(element.nameCn), 1)
2248
+ ], 8, _hoisted_5$2)
2249
+ ]),
2250
+ _: 1
2251
+ }, 8, ["list"])
2252
+ ]),
2253
+ _: 1
2254
+ });
2255
+ }
2256
+ var __unplugin_components_2 = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render$5]]);
2257
+ const _sfc_main$4 = defineComponent({
2258
+ components: {
2259
+ JsonCode: defineAsyncComponent(() => import("./jsonCode.js"))
2260
+ },
2261
+ props: {
2262
+ menu: {
2263
+ type: Object,
2264
+ default: () => ({ left: [], right: [], column: true })
2265
+ }
2266
+ },
2267
+ setup(props) {
2268
+ const { proxy: proxy2 } = getCurrentInstance();
2269
+ const { hisContrl: hisContrl2, uiControl: uiControl2, formStore: formStore2 } = inject("control") || {};
2270
+ const clearIsDisable = computed(
2271
+ () => {
2272
+ var _a;
2273
+ return ((_a = formStore2 == null ? void 0 : formStore2.get("allFormList")) == null ? void 0 : _a.length) == 0;
2274
+ }
2275
+ );
2276
+ const historyIndex = computed(() => hisContrl2 == null ? void 0 : hisContrl2.get("index"));
2277
+ const historyLen = computed(
2278
+ () => (hisContrl2 == null ? void 0 : hisContrl2.get("historyList").length) || 0
2279
+ );
2280
+ const fullscreen = computed(() => uiControl2 == null ? void 0 : uiControl2.get("isFullscreen"));
2281
+ const allFormList = computed(() => formStore2 == null ? void 0 : formStore2.get("allFormList"));
2282
+ const pageType = computed(() => uiControl2 == null ? void 0 : uiControl2.get("pageType"));
2283
+ const supportFullScreen = ref(!!document.fullscreenEnabled);
2284
+ const jsonDialog = ref();
2285
+ const tree = ref();
2286
+ const treeRef = ref();
2287
+ const filterText = ref();
2288
+ const code = ref();
2289
+ const propsData = ref({
2290
+ value: "id",
2291
+ label: "label",
2292
+ children: "children"
2293
+ });
2294
+ const initTree = () => {
2295
+ if (allFormList.value && allFormList.value.length > 0) {
2296
+ const treeList = toRaw(allFormList.value).map((item) => {
2297
+ return toTree(item);
2298
+ });
2299
+ return treeList;
2300
+ } else {
2301
+ return [];
2302
+ }
2303
+ };
2304
+ function toTree(item) {
2305
+ if (!item.layout) {
2306
+ return {
2307
+ id: item.id,
2308
+ label: item.nameCn,
2309
+ icon: item.icon
2310
+ };
2311
+ } else {
2312
+ let children;
2313
+ if (item.ControlType == "Grid") {
2314
+ children = item.data.columns.map(
2315
+ (colItem) => {
2316
+ const children2 = colItem.list.map((listItem) => {
2317
+ return toTree(listItem);
2318
+ });
2319
+ return {
2320
+ id: "",
2321
+ label: "GridChild",
2322
+ children: children2
2323
+ };
2324
+ }
2325
+ );
2326
+ } else if (item.ControlType == "TableLayout") {
2327
+ children = item.data.trs.map((trItem) => {
2328
+ const children2 = trItem.tds.map((tdItem) => {
2329
+ const children3 = tdItem.list.map((listItem) => {
2330
+ return toTree(listItem);
2331
+ });
2332
+ return {
2333
+ id: "",
2334
+ label: "\u5217",
2335
+ children: children3
2336
+ };
2337
+ });
2338
+ return {
2339
+ id: "",
2340
+ label: "\u884C",
2341
+ children: children2
2342
+ };
2343
+ });
2344
+ } else if (item.ControlType == "Collapse" || item.ControlType == "Tabs") {
2345
+ children = item.data.items.map((colItem) => {
2346
+ const children2 = colItem.list.map((listItem) => {
2347
+ return toTree(listItem);
2348
+ });
2349
+ return {
2350
+ id: "",
2351
+ label: item.nameCn + "-child",
2352
+ children: children2
2353
+ };
2354
+ });
2355
+ }
2356
+ return {
2357
+ id: item.id,
2358
+ label: item.nameCn,
2359
+ children
2360
+ };
2361
+ }
2362
+ }
2363
+ const dialog = ref(false);
2364
+ const timer = null;
2365
+ const filterNode = (value, data) => {
2366
+ if (!value)
2367
+ return true;
2368
+ return data.label.includes(value);
2369
+ };
2370
+ const handleFormSave = (type) => {
2371
+ proxy2.$EventBus.emit("setSave", type);
2372
+ };
2373
+ const handleFormPre = () => {
2374
+ formStore2 == null ? void 0 : formStore2.set("preview", true);
2375
+ proxy2.$EventBus.emit("openPreview");
2376
+ };
2377
+ const handleImportJson = () => {
2378
+ try {
2379
+ const result2 = JSON.parse(code.value);
2380
+ const formList = result2.map((item) => {
2381
+ return window.VueContext.$Flex.jsonToForm(item);
2382
+ });
2383
+ code.value = JSON.stringify(formList, null, 4);
2384
+ } catch (e) {
2385
+ code.value = JSON.stringify({});
2386
+ console.error(e);
2387
+ ElMessage({
2388
+ type: "error",
2389
+ message: "\u5BFC\u5165\u5931\u8D25\uFF0C\u6570\u636E\u683C\u5F0F\u4E0D\u5BF9"
2390
+ });
2391
+ }
2392
+ };
2393
+ watch(filterText, (val) => {
2394
+ var _a;
2395
+ (_a = treeRef.value) == null ? void 0 : _a.filter(val);
2396
+ });
2397
+ onMounted(() => {
2398
+ });
2399
+ onUnmounted(() => {
2400
+ clearInterval(timer);
2401
+ });
2402
+ return {
2403
+ code,
2404
+ supportFullScreen,
2405
+ handleFormSave,
2406
+ handleFormPre,
2407
+ jsonDialog,
2408
+ pageType,
2409
+ historyIndex,
2410
+ historyLen,
2411
+ fullscreen,
2412
+ clearIsDisable,
2413
+ filterText,
2414
+ propsData,
2415
+ dialog,
2416
+ tree,
2417
+ treeRef,
2418
+ filterNode,
2419
+ btnIsShow(type, btn) {
2420
+ if (props.menu[type].length == 0) {
2421
+ return true;
2422
+ }
2423
+ return props.menu[type].includes(btn);
2424
+ },
2425
+ updatePageType(type) {
2426
+ uiControl2 == null ? void 0 : uiControl2.set("pageType", type);
2427
+ },
2428
+ handleClear: () => {
2429
+ clearCanvas();
2430
+ formStore2 == null ? void 0 : formStore2.setFormCurrentId("");
2431
+ },
2432
+ handleBack: () => {
2433
+ hisContrl2 == null ? void 0 : hisContrl2.back();
2434
+ },
2435
+ handleForward: () => {
2436
+ hisContrl2 == null ? void 0 : hisContrl2.go();
2437
+ },
2438
+ handleFullScreen: () => {
2439
+ const value = !(uiControl2 == null ? void 0 : uiControl2.get("isFullscreen"));
2440
+ uiControl2 == null ? void 0 : uiControl2.set("isFullscreen", value);
2441
+ if (value) {
2442
+ const element = document.documentElement;
2443
+ if (element.requestFullscreen) {
2444
+ element.requestFullscreen();
2445
+ } else if (element.mozRequestFullScreen) {
2446
+ element.mozRequestFullScreen();
2447
+ } else if (element.webkitRequestFullscreen) {
2448
+ element.webkitRequestFullscreen();
2449
+ } else if (element.msRequestFullscreen) {
2450
+ element.msRequestFullscreen();
2451
+ }
2452
+ } else {
2453
+ const doc = document;
2454
+ if (doc.exitFullscreen) {
2455
+ doc.exitFullscreen();
2456
+ } else if (doc.mozCancelFullScreen) {
2457
+ doc.mozCancelFullScreen();
2458
+ } else if (doc.webkitExitFullscreen) {
2459
+ doc.webkitExitFullscreen();
2460
+ } else if (doc.msExitFullscreen) {
2461
+ doc.msExitFullscreen();
2462
+ }
2463
+ }
2464
+ },
2465
+ handleTree() {
2466
+ dialog.value = true;
2467
+ tree.value = initTree();
2468
+ },
2469
+ handleClose() {
2470
+ dialog.value = false;
2471
+ },
2472
+ myClick(currentNode) {
2473
+ formStore2 == null ? void 0 : formStore2.setFormCurrentId(currentNode.id);
2474
+ },
2475
+ ImportJson() {
2476
+ jsonDialog.value.show();
2477
+ jsonDialog.value.init("json\u5BFC\u5165", "icon-biaodan");
2478
+ },
2479
+ handleChange(file) {
2480
+ const reader = new FileReader();
2481
+ reader.readAsText(file.raw);
2482
+ reader.onload = (e) => {
2483
+ code.value = e.currentTarget.result;
2484
+ handleImportJson();
2485
+ };
2486
+ },
2487
+ closeCodeDialog() {
2488
+ jsonDialog.value.close();
2489
+ },
2490
+ saveJson() {
2491
+ debugger;
2492
+ formStore2 == null ? void 0 : formStore2.updateAllFormList(JSON.parse(code.value));
2493
+ jsonDialog.value.close();
2494
+ },
2495
+ exportJson(fileName = `demo.json`) {
2496
+ let content = "data:application/json;charset=utf-8,";
2497
+ try {
2498
+ const result2 = JSON.stringify(
2499
+ window.VueContext.$Flex.initFormToJson(allFormList.value)
2500
+ );
2501
+ content += result2;
2502
+ const encodedUri = encodeURI(content);
2503
+ const actions = document.createElement("a");
2504
+ actions.setAttribute("href", encodedUri);
2505
+ actions.setAttribute("download", fileName);
2506
+ actions.click();
2507
+ ElMessage({
2508
+ type: "success",
2509
+ message: "\u5BFC\u51FA\u6210\u529F"
2510
+ });
2511
+ } catch (e) {
2512
+ ElMessage({
2513
+ type: "error",
2514
+ message: "\u5BFC\u51FA\u5931\u8D25,\u6570\u636E\u683C\u5F0F\u4E0D\u5BF9"
2515
+ });
2516
+ }
2517
+ }
2518
+ };
2519
+ }
2520
+ });
2521
+ const _hoisted_1$3 = { class: "nav_list" };
2522
+ const _hoisted_2$2 = { class: "detailBtn" };
2523
+ const _hoisted_3$2 = { class: "pageBtn" };
2524
+ const _hoisted_4$1 = {
2525
+ key: 0,
2526
+ class: "el-button-group"
2527
+ };
2528
+ const _hoisted_5$1 = { class: "demo-drawer__content" };
2529
+ const _hoisted_6$1 = { class: "custom-tree-node" };
2530
+ const _hoisted_7 = { class: "custom_code" };
2531
+ function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
2532
+ const _component_el_tooltip = ElTooltip;
2533
+ const _component_el_input = ElInput;
2534
+ const _component_el_tree = ElTree;
2535
+ const _component_el_drawer = ElDrawer;
2536
+ const _component_JsonCode = resolveComponent("JsonCode");
2537
+ const _component_el_button = ElButton;
2538
+ const _component_el_upload = ElUpload;
2539
+ const _component_el_footer = ElFooter;
2540
+ const _component_custom_dialog = resolveComponent("custom-dialog");
2541
+ return openBlock(), createElementBlock("div", _hoisted_1$3, [
2542
+ createElementVNode("div", _hoisted_2$2, [
2543
+ _ctx.btnIsShow("left", "save") ? (openBlock(), createBlock(_component_el_tooltip, {
2544
+ key: 0,
2545
+ class: "box-item",
2546
+ effect: "dark",
2547
+ content: "\u4FDD\u5B58",
2548
+ placement: "top"
2549
+ }, {
2550
+ default: withCtx(() => [
2551
+ createElementVNode("span", {
2552
+ class: normalizeClass(["iconfontui icon-baocun", _ctx.clearIsDisable ? "noactive" : ""]),
2553
+ onClick: _cache[0] || (_cache[0] = ($event) => _ctx.handleFormSave())
2554
+ }, null, 2)
2555
+ ]),
2556
+ _: 1
2557
+ })) : createCommentVNode("", true),
2558
+ _ctx.btnIsShow("left", "preview") ? (openBlock(), createBlock(_component_el_tooltip, {
2559
+ key: 1,
2560
+ class: "box-item",
2561
+ effect: "dark",
2562
+ content: "\u9884\u89C8",
2563
+ placement: "top"
2564
+ }, {
2565
+ default: withCtx(() => [
2566
+ createElementVNode("span", {
2567
+ class: normalizeClass(["iconfontui icon-icon_yulan", _ctx.clearIsDisable ? "noactive" : ""]),
2568
+ onClick: _cache[1] || (_cache[1] = ($event) => _ctx.handleFormPre())
2569
+ }, null, 2)
2570
+ ]),
2571
+ _: 1
2572
+ })) : createCommentVNode("", true),
2573
+ !_ctx.fullscreen && _ctx.btnIsShow("left", "fullscreen") && _ctx.supportFullScreen ? (openBlock(), createBlock(_component_el_tooltip, {
2574
+ key: 2,
2575
+ class: "box-item",
2576
+ effect: "dark",
2577
+ content: "\u5168\u5C4F",
2578
+ placement: "top"
2579
+ }, {
2580
+ default: withCtx(() => [
2581
+ createElementVNode("span", {
2582
+ class: "iconfontui icon-quanping",
2583
+ onClick: _cache[2] || (_cache[2] = ($event) => _ctx.handleFullScreen())
2584
+ })
2585
+ ]),
2586
+ _: 1
2587
+ })) : createCommentVNode("", true),
2588
+ _ctx.fullscreen && _ctx.btnIsShow("left", "fullscreen") && _ctx.supportFullScreen ? (openBlock(), createBlock(_component_el_tooltip, {
2589
+ key: 3,
2590
+ class: "box-item",
2591
+ effect: "dark",
2592
+ content: "\u975E\u5168\u5C4F",
2593
+ placement: "top"
2594
+ }, {
2595
+ default: withCtx(() => [
2596
+ createElementVNode("span", {
2597
+ class: "iconfontui icon-suoxiao1",
2598
+ onClick: _cache[3] || (_cache[3] = ($event) => _ctx.handleFullScreen())
2599
+ })
2600
+ ]),
2601
+ _: 1
2602
+ })) : createCommentVNode("", true),
2603
+ _ctx.btnIsShow("left", "delete") ? (openBlock(), createBlock(_component_el_tooltip, {
2604
+ key: 4,
2605
+ class: "box-item",
2606
+ effect: "dark",
2607
+ content: "\u6E05\u7A7A",
2608
+ placement: "top"
2609
+ }, {
2610
+ default: withCtx(() => [
2611
+ createElementVNode("span", {
2612
+ class: normalizeClass(["iconfontui icon-shanchu1", _ctx.clearIsDisable ? "noactive" : ""]),
2613
+ onClick: _cache[4] || (_cache[4] = ($event) => _ctx.handleClear())
2614
+ }, null, 2)
2615
+ ]),
2616
+ _: 1
2617
+ })) : createCommentVNode("", true),
2618
+ _ctx.btnIsShow("left", "tree") ? (openBlock(), createBlock(_component_el_tooltip, {
2619
+ key: 5,
2620
+ class: "box-item",
2621
+ effect: "dark",
2622
+ content: "\u7EC4\u4EF6\u7ED3\u6784\u6811",
2623
+ placement: "top"
2624
+ }, {
2625
+ default: withCtx(() => [
2626
+ createElementVNode("span", {
2627
+ class: "iconfontui icon-tree",
2628
+ onClick: _cache[5] || (_cache[5] = ($event) => _ctx.handleTree())
2629
+ })
2630
+ ]),
2631
+ _: 1
2632
+ })) : createCommentVNode("", true),
2633
+ _ctx.btnIsShow("left", "undo") ? (openBlock(), createBlock(_component_el_tooltip, {
2634
+ key: 6,
2635
+ class: "box-item",
2636
+ effect: "dark",
2637
+ content: "\u64A4\u9500",
2638
+ placement: "top"
2639
+ }, {
2640
+ default: withCtx(() => [
2641
+ createElementVNode("span", {
2642
+ class: normalizeClass(["iconfontui icon-24gl-undo3", _ctx.historyIndex == -1 ? "noactive" : ""]),
2643
+ onClick: _cache[6] || (_cache[6] = ($event) => _ctx.handleBack())
2644
+ }, null, 2)
2645
+ ]),
2646
+ _: 1
2647
+ })) : createCommentVNode("", true),
2648
+ _ctx.btnIsShow("left", "redo") ? (openBlock(), createBlock(_component_el_tooltip, {
2649
+ key: 7,
2650
+ class: "box-item",
2651
+ effect: "dark",
2652
+ content: "\u91CD\u505A",
2653
+ placement: "top"
2654
+ }, {
2655
+ default: withCtx(() => [
2656
+ createElementVNode("span", {
2657
+ class: normalizeClass(["iconfontui icon-24gl-redo3", _ctx.historyIndex == _ctx.historyLen - 1 ? "noactive" : ""]),
2658
+ onClick: _cache[7] || (_cache[7] = ($event) => _ctx.handleForward())
2659
+ }, null, 2)
2660
+ ]),
2661
+ _: 1
2662
+ })) : createCommentVNode("", true)
2663
+ ]),
2664
+ createElementVNode("div", _hoisted_3$2, [
2665
+ _ctx.btnIsShow("right", "viewport") ? (openBlock(), createElementBlock("div", _hoisted_4$1, [
2666
+ _ctx.btnIsShow("left", "redo") ? (openBlock(), createBlock(_component_el_tooltip, {
2667
+ key: 0,
2668
+ class: "box-item",
2669
+ effect: "dark",
2670
+ content: "PC",
2671
+ placement: "top"
2672
+ }, {
2673
+ default: withCtx(() => [
2674
+ createElementVNode("span", {
2675
+ class: normalizeClass(_ctx.pageType == "PC" ? "info" : ""),
2676
+ onClick: _cache[8] || (_cache[8] = ($event) => _ctx.updatePageType("PC"))
2677
+ }, _cache[16] || (_cache[16] = [
2678
+ createElementVNode("i", { class: "iconfontui icon-diannao" }, null, -1)
2679
+ ]), 2)
2680
+ ]),
2681
+ _: 1
2682
+ })) : createCommentVNode("", true),
2683
+ _ctx.btnIsShow("left", "redo") ? (openBlock(), createBlock(_component_el_tooltip, {
2684
+ key: 1,
2685
+ class: "box-item",
2686
+ effect: "dark",
2687
+ content: "Pad",
2688
+ placement: "top"
2689
+ }, {
2690
+ default: withCtx(() => [
2691
+ createElementVNode("span", {
2692
+ class: normalizeClass(_ctx.pageType == "Pad" ? "info" : ""),
2693
+ onClick: _cache[9] || (_cache[9] = ($event) => _ctx.updatePageType("Pad"))
2694
+ }, _cache[17] || (_cache[17] = [
2695
+ createElementVNode("i", { class: "iconfontui icon-pingbandiannao" }, null, -1)
2696
+ ]), 2)
2697
+ ]),
2698
+ _: 1
2699
+ })) : createCommentVNode("", true),
2700
+ _ctx.btnIsShow("left", "redo") ? (openBlock(), createBlock(_component_el_tooltip, {
2701
+ key: 2,
2702
+ class: "box-item",
2703
+ effect: "dark",
2704
+ content: "H5",
2705
+ placement: "top"
2706
+ }, {
2707
+ default: withCtx(() => [
2708
+ createElementVNode("span", {
2709
+ class: normalizeClass(_ctx.pageType == "H5" ? "info" : ""),
2710
+ onClick: _cache[10] || (_cache[10] = ($event) => _ctx.updatePageType("H5"))
2711
+ }, _cache[18] || (_cache[18] = [
2712
+ createElementVNode("i", { class: "iconfontui icon-shouji" }, null, -1)
2713
+ ]), 2)
2714
+ ]),
2715
+ _: 1
2716
+ })) : createCommentVNode("", true),
2717
+ createVNode(_component_el_tooltip, {
2718
+ class: "box-item",
2719
+ effect: "dark",
2720
+ content: "\u5BFC\u5165json",
2721
+ placement: "top"
2722
+ }, {
2723
+ default: withCtx(() => [
2724
+ _ctx.btnIsShow("right", "json-import") ? (openBlock(), createElementBlock("span", {
2725
+ key: 0,
2726
+ type: "text",
2727
+ plain: "",
2728
+ onClick: _cache[11] || (_cache[11] = (...args) => _ctx.ImportJson && _ctx.ImportJson(...args))
2729
+ }, _cache[19] || (_cache[19] = [
2730
+ createElementVNode("i", { class: "iconfontui icon-daoru" }, null, -1)
2731
+ ]))) : createCommentVNode("", true)
2732
+ ]),
2733
+ _: 1
2734
+ }),
2735
+ createVNode(_component_el_tooltip, {
2736
+ class: "box-item",
2737
+ effect: "dark",
2738
+ content: "\u5BFC\u51FAjson",
2739
+ placement: "top"
2740
+ }, {
2741
+ default: withCtx(() => [
2742
+ _ctx.btnIsShow("right", "json-export") ? (openBlock(), createElementBlock("span", {
2743
+ key: 0,
2744
+ type: "text",
2745
+ plain: "",
2746
+ onClick: _cache[12] || (_cache[12] = (...args) => _ctx.exportJson && _ctx.exportJson(...args))
2747
+ }, _cache[20] || (_cache[20] = [
2748
+ createElementVNode("i", { class: "iconfontui icon-daochu" }, null, -1)
2749
+ ]))) : createCommentVNode("", true)
2750
+ ]),
2751
+ _: 1
2752
+ })
2753
+ ])) : createCommentVNode("", true)
2754
+ ]),
2755
+ createVNode(_component_el_drawer, {
2756
+ ref: "drawerRef",
2757
+ modelValue: _ctx.dialog,
2758
+ "onUpdate:modelValue": _cache[14] || (_cache[14] = ($event) => _ctx.dialog = $event),
2759
+ title: "\u8868\u5355\u7ED3\u6784\u6811",
2760
+ "before-close": _ctx.handleClose,
2761
+ direction: "ltr",
2762
+ "custom-class": "demo-drawer"
2763
+ }, {
2764
+ default: withCtx(() => [
2765
+ createElementVNode("div", _hoisted_5$1, [
2766
+ createVNode(_component_el_input, {
2767
+ modelValue: _ctx.filterText,
2768
+ "onUpdate:modelValue": _cache[13] || (_cache[13] = ($event) => _ctx.filterText = $event),
2769
+ placeholder: "Filter keyword"
2770
+ }, null, 8, ["modelValue"]),
2771
+ createVNode(_component_el_tree, {
2772
+ data: _ctx.tree,
2773
+ props: _ctx.propsData,
2774
+ ref: "treeRef",
2775
+ "default-expand-all": "",
2776
+ "filter-node-method": _ctx.filterNode,
2777
+ onNodeClick: _ctx.myClick,
2778
+ style: { "margin-top": "20px" }
2779
+ }, {
2780
+ default: withCtx(({ node, data }) => [
2781
+ createElementVNode("span", _hoisted_6$1, [
2782
+ createElementVNode("i", {
2783
+ class: normalizeClass(["iconfontui", data.icon]),
2784
+ style: { "font-size": "12px", "margin-right": "5px" }
2785
+ }, null, 2),
2786
+ createElementVNode("span", null, toDisplayString(node.label), 1)
2787
+ ])
2788
+ ]),
2789
+ _: 1
2790
+ }, 8, ["data", "props", "filter-node-method", "onNodeClick"])
2791
+ ])
2792
+ ]),
2793
+ _: 1
2794
+ }, 8, ["modelValue", "before-close"]),
2795
+ createVNode(_component_custom_dialog, {
2796
+ ref: "jsonDialog",
2797
+ width: 800,
2798
+ dialogclass: "codeDialog"
2799
+ }, {
2800
+ default: withCtx(() => [
2801
+ createElementVNode("div", _hoisted_7, [
2802
+ createVNode(_component_JsonCode, {
2803
+ value: _ctx.code,
2804
+ "onUpdate:value": _cache[15] || (_cache[15] = ($event) => _ctx.code = $event)
2805
+ }, null, 8, ["value"]),
2806
+ createVNode(_component_el_upload, {
2807
+ accept: "application/json",
2808
+ class: "upload-demo",
2809
+ action: "https://run.mocky.io/v3/9d059bf9-4660-45f2-925d-ce80ad6c4d15",
2810
+ "on-change": _ctx.handleChange
2811
+ }, {
2812
+ default: withCtx(() => [
2813
+ createVNode(_component_el_button, { type: "primary" }, {
2814
+ default: withCtx(() => _cache[21] || (_cache[21] = [
2815
+ createTextVNode("\u5BFC\u5165json\u6587\u4EF6", -1)
2816
+ ])),
2817
+ _: 1,
2818
+ __: [21]
2819
+ })
2820
+ ]),
2821
+ _: 1
2822
+ }, 8, ["on-change"])
2823
+ ]),
2824
+ createVNode(_component_el_footer, {
2825
+ class: "my-Footer",
2826
+ style: { "text-align": "center" }
2827
+ }, {
2828
+ default: withCtx(() => [
2829
+ createVNode(_component_el_button, {
2830
+ type: "primary",
2831
+ onClick: _ctx.saveJson
2832
+ }, {
2833
+ default: withCtx(() => _cache[22] || (_cache[22] = [
2834
+ createTextVNode("\u786E\u5B9A", -1)
2835
+ ])),
2836
+ _: 1,
2837
+ __: [22]
2838
+ }, 8, ["onClick"]),
2839
+ createVNode(_component_el_button, { onClick: _ctx.closeCodeDialog }, {
2840
+ default: withCtx(() => _cache[23] || (_cache[23] = [
2841
+ createTextVNode("\u5173\u95ED", -1)
2842
+ ])),
2843
+ _: 1,
2844
+ __: [23]
2845
+ }, 8, ["onClick"])
2846
+ ]),
2847
+ _: 1
2848
+ })
2849
+ ]),
2850
+ _: 1
2851
+ }, 512)
2852
+ ]);
2853
+ }
2854
+ var __unplugin_components_1 = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render$4]]);
2855
+ const _sfc_main$3 = defineComponent({
2856
+ setup() {
2857
+ return {
2858
+ onLink() {
2859
+ window.open("https://github.com/haixin-fang/vue-form-design");
2860
+ }
2861
+ };
2862
+ }
2863
+ });
2864
+ const _hoisted_1$2 = { class: "header_nav" };
2865
+ const _hoisted_2$1 = { class: "logo" };
2866
+ const _hoisted_3$1 = {
2867
+ version: "1.0",
2868
+ xmlns: "http://www.w3.org/2000/svg",
2869
+ "xmlns:xlink": "http://www.w3.org/1999/xlink",
2870
+ "color-interpolation-filters": "sRGB",
2871
+ style: { "margin": "auto" }
2872
+ };
2873
+ const _hoisted_4 = { fill: "rgba(0, 0, 0, .9)" };
2874
+ const _hoisted_5 = {
2875
+ x: "0",
2876
+ y: "0",
2877
+ width: "60",
2878
+ height: "69.34652458334297",
2879
+ filtersec: "colorsb4782532531",
2880
+ class: "image-svg-svg primary",
2881
+ style: { "overflow": "visible" }
2882
+ };
2883
+ const _hoisted_6 = { class: "starfish-link" };
2884
+ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
2885
+ return openBlock(), createElementBlock("div", _hoisted_1$2, [
2886
+ createElementVNode("div", _hoisted_2$1, [
2887
+ (openBlock(), createElementBlock("svg", _hoisted_3$1, [
2888
+ createElementVNode("g", _hoisted_4, [
2889
+ createElementVNode("g", null, [
2890
+ createElementVNode("g", null, [
2891
+ _cache[2] || (_cache[2] = createElementVNode("rect", {
2892
+ fill: "#ffffff",
2893
+ "fill-opacity": "0",
2894
+ "stroke-width": "2",
2895
+ x: "0",
2896
+ y: "0",
2897
+ width: "60",
2898
+ height: "69.34652458334297",
2899
+ class: "image-rect"
2900
+ }, null, -1)),
2901
+ (openBlock(), createElementBlock("svg", _hoisted_5, _cache[1] || (_cache[1] = [
2902
+ createStaticVNode('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 7.190000534057617 8.3100004196167"><g><g fill-rule="evenodd"><path fill="#054ba3" d="M1.8 2.4L0 2.08v4.15L1.8 2.4z"></path><path fill="#0691ca" d="M4.21 1.72L3.6 0 0 2.08l4.21-.36z"></path><path fill="#054ba3" d="M5.4 5.9l1.79.33V2.08L5.4 5.9z"></path><path fill="#0691ca" d="M2.98 6.59l.62 1.72 3.59-2.08-4.21.36z"></path><path fill="#44c2f4" d="M0 6.23l3.6 2.08-2.42-3.47L0 6.23z"></path><path fill="#054ba3" d="M6.01 3.47l1.18-1.39L3.6 0l2.41 3.47z"></path></g></g></svg>', 1)
2903
+ ])))
2904
+ ])
2905
+ ]),
2906
+ _cache[3] || (_cache[3] = createElementVNode("g", { transform: "translate(67,17.723264694213867)" }, [
2907
+ createElementVNode("g", {
2908
+ "data-gra": "path-name",
2909
+ "fill-rule": "",
2910
+ class: "tp-name iconsvg-namesvg"
2911
+ }, [
2912
+ createElementVNode("g", { transform: "scale(1)" }, [
2913
+ createElementVNode("g", null, [
2914
+ createElementVNode("path", {
2915
+ d: "M9.58 1.95L7.93 1.95Q3.45 1.85 0.19 1.56L0.19 1.56 0.92-3.7Q5.69-3.26 8.56-3.16L8.56-3.16 10.21-3.16Q13.33-3.16 14.57-3.94 15.81-4.72 16.1-6.18L16.1-6.18Q16.15-6.42 16.15-6.86L16.15-6.86Q16.15-8.07 15.76-8.46L15.76-8.46Q15.42-9 14.64-9.19 13.86-9.39 11.67-9.63L11.67-9.63 10.55-9.78Q8.02-9.97 5.74-10.65L5.74-10.65Q3.94-11.33 3.06-12.62 2.19-13.91 2.19-16.05L2.19-16.05Q2.19-16.49 2.29-17.56L2.29-17.56Q2.63-20.52 3.99-22.2 5.35-23.88 7.78-24.61 10.21-25.34 14.06-25.34L14.06-25.34 16.05-25.34 22.91-25.29 22.28-20.14 13.42-20.14Q11.28-20.14 10.16-19.92 9.05-19.7 8.54-19.19 8.02-18.68 7.88-17.7L7.88-17.7Q7.83-17.46 7.83-17.07L7.83-17.07Q7.83-16.29 8.27-15.76L8.27-15.76Q8.75-15.17 9.7-14.96 10.65-14.74 13.23-14.44L13.23-14.44Q16.29-14.15 18.24-13.52L18.24-13.52Q19.94-12.94 20.84-11.53 21.74-10.12 21.74-7.88L21.74-7.88Q21.74-6.81 21.64-6.23L21.64-6.23Q21.06-1.7 18.24 0.12 15.42 1.95 9.58 1.95L9.58 1.95ZM30.79-20.14L24.71-20.14 25.34-25.34 31.47-25.34 32.29-32.25 37.89-32.25 37.06-25.34 45.33-25.34 44.7-20.14 36.43-20.14 34.92-7.73Q34.87-7.39 34.87-6.81L34.87-6.81Q34.87-3.55 38.08-3.55L38.08-3.55Q39.44-3.55 42.95-3.65L42.95-3.65 42.31 1.65Q40.37 1.75 37.45 1.75L37.45 1.75Q33.46 1.75 31.27-0.05 29.08-1.85 29.08-5.4L29.08-5.4Q29.08-5.79 29.18-6.86L29.18-6.86 30.79-20.14ZM68.28 1.75L54.18 1.75Q50.53 1.75 48.34-0.32 46.16-2.38 46.16-5.69L46.16-5.69Q46.16-6.42 46.2-6.81L46.2-6.81Q46.64-9.82 47.76-11.6 48.88-13.37 50.99-14.18 53.11-14.98 56.56-14.98L56.56-14.98 64.73-14.98 64.78-15.37Q64.83-15.61 64.83-16.05L64.83-16.05Q64.83-17.95 63.57-19.11 62.3-20.28 59.63-20.28L59.63-20.28 58.36-20.28Q54.03-20.28 50.58-20.04L50.58-20.04 51.31-25 52.72-25.1Q53.5-25.14 55.47-25.24 57.44-25.34 58.9-25.34L58.9-25.34 60.21-25.34Q65.22-25.34 67.8-22.96 70.38-20.57 70.38-16.58L70.38-16.58Q70.38-16.15 70.28-15.08L70.28-15.08 68.28 1.75ZM51.8-6.81L51.75-6.23Q51.75-4.81 52.55-4.06 53.35-3.31 54.86-3.31L54.86-3.31 63.32-3.31 64.15-10.12 56.08-10.16Q54.23-10.21 53.13-9.46 52.04-8.71 51.8-6.81L51.8-6.81ZM92.5-25.19L91.63-20.04Q88.61-20.14 87.74-20.14L87.74-20.14Q84.63-20.14 83.07-18.65 81.51-17.17 81.12-13.76L81.12-13.76 79.18 1.75 73.59 1.75 75.48-13.62Q76.21-19.79 79.2-22.57 82.19-25.34 88.37-25.34L88.37-25.34Q90.8-25.34 92.5-25.19L92.5-25.19ZM105.1-26.46L104.96-25.34 120.52-25.34 117.16 1.75 111.57 1.75 114.29-20.14 104.32-20.14 101.65 1.75 96.06 1.75 98.73-20.14 93.09-20.14 93.72-25.34 99.36-25.34 99.61-27.33Q100.68-35.94 109.53-35.94L109.53-35.94Q111.72-35.94 114.63-35.7L114.63-35.7 113.86-30.54 112.25-30.64Q109.92-30.74 109.43-30.74L109.43-30.74Q107.29-30.74 106.32-29.69 105.34-28.65 105.1-26.46L105.1-26.46ZM131.46 1.95L129.81 1.95Q125.33 1.85 122.08 1.56L122.08 1.56 122.8-3.7Q127.57-3.26 130.44-3.16L130.44-3.16 132.09-3.16Q135.21-3.16 136.45-3.94 137.69-4.72 137.98-6.18L137.98-6.18Q138.03-6.42 138.03-6.86L138.03-6.86Q138.03-8.07 137.64-8.46L137.64-8.46Q137.3-9 136.52-9.19 135.74-9.39 133.55-9.63L133.55-9.63 132.43-9.78Q129.91-9.97 127.62-10.65L127.62-10.65Q125.82-11.33 124.94-12.62 124.07-13.91 124.07-16.05L124.07-16.05Q124.07-16.49 124.17-17.56L124.17-17.56Q124.51-20.52 125.87-22.2 127.23-23.88 129.66-24.61 132.09-25.34 135.94-25.34L135.94-25.34 137.93-25.34 144.79-25.29 144.16-20.14 135.3-20.14Q133.16-20.14 132.05-19.92 130.93-19.7 130.42-19.19 129.91-18.68 129.76-17.7L129.76-17.7Q129.71-17.46 129.71-17.07L129.71-17.07Q129.71-16.29 130.15-15.76L130.15-15.76Q130.63-15.17 131.58-14.96 132.53-14.74 135.11-14.44L135.11-14.44Q138.17-14.15 140.12-13.52L140.12-13.52Q141.82-12.94 142.72-11.53 143.62-10.12 143.62-7.88L143.62-7.88Q143.62-6.81 143.52-6.23L143.52-6.23Q142.94-1.7 140.12 0.12 137.3 1.95 131.46 1.95L131.46 1.95ZM147.41 1.75L151.99-35.75 157.58-35.75 156.31-25.34 162.93-25.34Q173-25.34 173-16.1L173-16.1Q173-14.98 172.85-13.67L172.85-13.67 170.95 1.75 165.36 1.75 167.26-13.81Q167.35-14.79 167.35-15.17L167.35-15.17Q167.35-20.14 162.3-20.14L162.3-20.14 155.68-20.14 153.01 1.75 147.41 1.75Z",
2916
+ transform: "translate(-0.1899999976158142, 35.939998626708984)"
2917
+ })
2918
+ ])
2919
+ ])
2920
+ ])
2921
+ ], -1))
2922
+ ])
2923
+ ]))
2924
+ ]),
2925
+ createElementVNode("div", _hoisted_6, [
2926
+ (openBlock(), createElementBlock("svg", {
2927
+ width: "32",
2928
+ height: "32",
2929
+ viewBox: "0 0 32 32",
2930
+ fill: "none",
2931
+ xmlns: "http://www.w3.org/2000/svg",
2932
+ onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onLink && _ctx.onLink(...args))
2933
+ }, _cache[4] || (_cache[4] = [
2934
+ createElementVNode("path", {
2935
+ "fill-rule": "evenodd",
2936
+ "clip-rule": "evenodd",
2937
+ d: "M12 2.23999C6.475 2.23999 2 6.71499 2 12.24C2 16.665 4.8625 20.4025 8.8375 21.7275C9.3375 21.815 9.525 21.515 9.525 21.2525C9.525 21.015 9.5125 20.2275 9.5125 19.39C7 19.8525 6.35 18.7775 6.15 18.215C6.0375 17.9275 5.55 17.04 5.125 16.8025C4.775 16.615 4.275 16.1525 5.1125 16.14C5.9 16.1275 6.4625 16.865 6.65 17.165C7.55 18.6775 8.9875 18.2525 9.5625 17.99C9.65 17.34 9.9125 16.9025 10.2 16.6525C7.975 16.4025 5.65 15.54 5.65 11.715C5.65 10.6275 6.0375 9.72749 6.675 9.02749C6.575 8.77749 6.225 7.75249 6.775 6.37749C6.775 6.37749 7.6125 6.11499 9.525 7.40249C10.325 7.17749 11.175 7.06499 12.025 7.06499C12.875 7.06499 13.725 7.17749 14.525 7.40249C16.4375 6.10249 17.275 6.37749 17.275 6.37749C17.825 7.75249 17.475 8.77749 17.375 9.02749C18.0125 9.72749 18.4 10.615 18.4 11.715C18.4 15.5525 16.0625 16.4025 13.8375 16.6525C14.2 16.965 14.5125 17.565 14.5125 18.5025C14.5125 19.84 14.5 20.915 14.5 21.2525C14.5 21.515 14.6875 21.8275 15.1875 21.7275C17.1727 21.0573 18.8977 19.7815 20.1198 18.0795C21.3419 16.3776 21.9995 14.3352 22 12.24C22 6.71499 17.525 2.23999 12 2.23999Z",
2938
+ fill: "currentColor"
2939
+ }, null, -1)
2940
+ ])))
2941
+ ])
2942
+ ]);
2943
+ }
2944
+ var __unplugin_components_0 = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render$3]]);
2945
+ const _sfc_main$2 = defineComponent({
2946
+ props: {
2947
+ type: {
2948
+ type: String
2949
+ }
2950
+ },
2951
+ setup(props) {
2952
+ const target = ref();
2953
+ const { uiControl: uiControl2 } = inject("control") || {};
2954
+ let getso;
2955
+ onMounted(() => {
2956
+ if (!target.value)
2957
+ return;
2958
+ getso = new Gesto(target.value, {
2959
+ container: window,
2960
+ pinchOutside: true
2961
+ }).on("drag", (e) => {
2962
+ if (!target.value || !uiControl2)
2963
+ return;
2964
+ let { right, left } = {
2965
+ ...toRaw(uiControl2 == null ? void 0 : uiControl2.get("columnWidth"))
2966
+ };
2967
+ if (props.type == "right") {
2968
+ right -= e.deltaX;
2969
+ } else {
2970
+ left += e.deltaX;
2971
+ }
2972
+ uiControl2 == null ? void 0 : uiControl2.set("columnWidth", { left, right });
2973
+ });
2974
+ });
2975
+ onUnmounted(() => {
2976
+ getso == null ? void 0 : getso.unset();
2977
+ });
2978
+ return {
2979
+ target
2980
+ };
2981
+ }
2982
+ });
2983
+ const _hoisted_1$1 = {
2984
+ class: "starfish-editor-resizer",
2985
+ ref: "target"
2986
+ };
2987
+ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
2988
+ return openBlock(), createElementBlock("div", _hoisted_1$1, null, 512);
2989
+ }
2990
+ var Resizer = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$2]]);
2991
+ const _sfc_main$1 = defineComponent({
2992
+ props: {
2993
+ headerShow: {
2994
+ type: Boolean,
2995
+ default: true
2996
+ }
2997
+ },
2998
+ components: {
2999
+ Resizer
3000
+ },
3001
+ setup() {
3002
+ const { uiControl: uiControl2 } = inject("control") || {};
3003
+ const columnWidth = computed(
3004
+ () => (uiControl2 == null ? void 0 : uiControl2.get("columnWidth")) || {}
3005
+ );
3006
+ const leftClose = computed(() => uiControl2 == null ? void 0 : uiControl2.get("leftClose"));
3007
+ const rightClose = computed(() => uiControl2 == null ? void 0 : uiControl2.get("rightClose"));
3008
+ function onLeftArrow() {
3009
+ uiControl2 == null ? void 0 : uiControl2.set("leftClose", !leftClose.value);
3010
+ }
3011
+ function onRightArrow() {
3012
+ uiControl2 == null ? void 0 : uiControl2.set("rightClose", !rightClose.value);
3013
+ }
3014
+ return {
3015
+ columnWidth,
3016
+ leftClose,
3017
+ rightClose,
3018
+ onLeftArrow,
3019
+ onRightArrow
3020
+ };
3021
+ }
3022
+ });
3023
+ const _hoisted_1 = { class: "starfish-editor" };
3024
+ const _hoisted_2 = { class: "starfish-editor-nav" };
3025
+ const _hoisted_3 = { class: "starfish-editor-framework-center" };
3026
+ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
3027
+ var _a, _b;
3028
+ const _component_resizer = resolveComponent("resizer");
3029
+ return openBlock(), createElementBlock("div", _hoisted_1, [
3030
+ createElementVNode("div", _hoisted_2, [
3031
+ renderSlot(_ctx.$slots, "nav")
3032
+ ]),
3033
+ createElementVNode("div", {
3034
+ class: normalizeClass(["starfish-editor-content", !_ctx.headerShow ? "starfish-editor-content-page" : ""])
3035
+ }, [
3036
+ createElementVNode("div", {
3037
+ class: normalizeClass(["starfish-editor-framework-left", _ctx.leftClose ? "hide-status" : ""]),
3038
+ style: normalizeStyle(`width:${_ctx.leftClose ? 0 : (_a = _ctx.columnWidth) == null ? void 0 : _a.left}px`)
3039
+ }, [
3040
+ renderSlot(_ctx.$slots, "left"),
3041
+ createElementVNode("div", {
3042
+ class: "container-left-arrow",
3043
+ onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onLeftArrow && _ctx.onLeftArrow(...args))
3044
+ })
3045
+ ], 6),
3046
+ createVNode(_component_resizer, { type: "left" }),
3047
+ createElementVNode("div", _hoisted_3, [
3048
+ renderSlot(_ctx.$slots, "navlist"),
3049
+ renderSlot(_ctx.$slots, "workspace")
3050
+ ]),
3051
+ createVNode(_component_resizer, { type: "right" }),
3052
+ createElementVNode("div", {
3053
+ class: normalizeClass(["starfish-editor-framework-right", _ctx.rightClose ? "hide-status" : ""]),
3054
+ style: normalizeStyle(`width:${_ctx.rightClose ? 0 : (_b = _ctx.columnWidth) == null ? void 0 : _b.right}px`)
3055
+ }, [
3056
+ renderSlot(_ctx.$slots, "propsPanel"),
3057
+ createElementVNode("div", {
3058
+ class: "container-right-arrow",
3059
+ onClick: _cache[1] || (_cache[1] = (...args) => _ctx.onRightArrow && _ctx.onRightArrow(...args))
3060
+ })
3061
+ ], 6)
3062
+ ], 2),
3063
+ renderSlot(_ctx.$slots, "other")
3064
+ ]);
3065
+ }
3066
+ var Framework = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1]]);
3067
+ const state = reactive({
3068
+ action: [
3069
+ {
3070
+ funcName: "mounted",
3071
+ type: "mounted",
3072
+ methods: "mounted",
3073
+ funcStr: "",
3074
+ disabled: true
3075
+ },
3076
+ {
3077
+ funcName: "updated",
3078
+ type: "updated",
3079
+ methods: "updated",
3080
+ funcStr: "",
3081
+ disabled: true
3082
+ }
3083
+ ],
3084
+ currentAction: null
3085
+ });
3086
+ class Action {
3087
+ set(name, value) {
3088
+ state[name] = value;
3089
+ }
3090
+ get(name) {
3091
+ return state[name];
3092
+ }
3093
+ }
3094
+ var actionContrl = new Action();
3095
+ function listenGlobalKeyDown(list, dom) {
3096
+ const keycons = new KeyController(dom);
3097
+ const isMac = /mac os x/.test(navigator.userAgent.toLowerCase());
3098
+ const ctrl = isMac ? "meta" : "ctrl";
3099
+ keycons.keyup("delete", (e) => {
3100
+ e.inputEvent.preventDefault();
3101
+ list.delete();
3102
+ }).keyup("backspace", (e) => {
3103
+ e.inputEvent.preventDefault();
3104
+ list.delete();
3105
+ }).keydown([ctrl, "c"], (e) => {
3106
+ e.inputEvent.preventDefault();
3107
+ list.copy();
3108
+ }).keydown([ctrl, "e"], (e) => {
3109
+ e.inputEvent.preventDefault();
3110
+ list.clearCanvas();
3111
+ }).keydown([ctrl, "v"], (e) => {
3112
+ e.inputEvent.preventDefault();
3113
+ list.paste();
3114
+ }).keydown([ctrl, "z"], (e) => {
3115
+ e.inputEvent.preventDefault();
3116
+ hisContrl == null ? void 0 : hisContrl.back();
3117
+ }).keydown([ctrl, "x"], (e) => {
3118
+ e.inputEvent.preventDefault();
3119
+ list.cut();
3120
+ }).keydown([ctrl, "up"], (e) => {
3121
+ e.inputEvent.preventDefault();
3122
+ list.onTop();
3123
+ }).keydown([ctrl, "down"], (e) => {
3124
+ e.inputEvent.preventDefault();
3125
+ list.onBottom();
3126
+ });
3127
+ return keycons;
3128
+ }
3129
+ var starfishEditor_vue_vue_type_style_index_0_lang = "";
3130
+ const _sfc_main = defineComponent({
3131
+ name: "StarfishEditor",
3132
+ components: {
3133
+ Framework,
3134
+ NavList: __unplugin_components_1,
3135
+ ComponentList: __unplugin_components_2,
3136
+ Workspace: __unplugin_components_3,
3137
+ PropsPanel: __unplugin_components_4,
3138
+ FormPreview: defineAsyncComponent(() => Promise.resolve().then(function() {
3139
+ return FormPreview;
3140
+ })),
3141
+ Nav: __unplugin_components_0
3142
+ },
3143
+ props: {
3144
+ basicFields: {
3145
+ type: Array,
3146
+ default() {
3147
+ return [];
3148
+ }
3149
+ },
3150
+ layoutFields: {
3151
+ type: Array,
3152
+ default() {
3153
+ return [];
3154
+ }
3155
+ },
3156
+ shortcutDisabled: {
3157
+ type: Boolean,
3158
+ default: false
3159
+ },
3160
+ headerShow: {
3161
+ type: Boolean,
3162
+ default: true
3163
+ },
3164
+ menu: {
3165
+ type: Object,
3166
+ default: () => ({ left: [], right: [], column: true })
3167
+ },
3168
+ panel: {
3169
+ type: Array,
3170
+ default: () => ["form", "json", "global"]
3171
+ }
3172
+ },
3173
+ setup(props, { emit }) {
3174
+ const workspace = ref();
3175
+ const formPreview = ref();
3176
+ let dom;
3177
+ const mouseenterHandler = () => {
3178
+ dom == null ? void 0 : dom.focus();
3179
+ };
3180
+ const mouseleaveHandler = () => {
3181
+ dom == null ? void 0 : dom.blur();
3182
+ };
3183
+ const control = {
3184
+ uiControl,
3185
+ hisContrl,
3186
+ formStore,
3187
+ actionContrl,
3188
+ store
3189
+ };
3190
+ let keycons;
3191
+ onMounted(() => {
3192
+ var _a;
3193
+ dom = (_a = workspace.value) == null ? void 0 : _a.$el;
3194
+ if (!props.shortcutDisabled) {
3195
+ dom.addEventListener("mouseenter", mouseenterHandler);
3196
+ dom.addEventListener("mouseleave", mouseleaveHandler);
3197
+ keycons = listenGlobalKeyDown(result, dom);
3198
+ }
3199
+ });
3200
+ onUnmounted(() => {
3201
+ if (!props.shortcutDisabled) {
3202
+ dom.removeEventListener("mouseenter", mouseenterHandler);
3203
+ dom.removeEventListener("mouseleave", mouseleaveHandler);
3204
+ keycons.destroy();
3205
+ }
3206
+ });
3207
+ provide("control", control);
3208
+ return {
3209
+ workspace,
3210
+ formPreview,
3211
+ onSave() {
3212
+ emit("save", formStore == null ? void 0 : formStore.get("AllFormResult"));
3213
+ },
3214
+ getJson() {
3215
+ window.VApp.$EventBus.emit("setSave");
3216
+ },
3217
+ setJson(jsonList) {
3218
+ const newJson = jsonList.map((json) => {
3219
+ return window.VApp.$Flex.jsonToForm(json);
3220
+ });
3221
+ formStore.updateAllFormList(newJson);
3222
+ formStore == null ? void 0 : formStore.set("save", true);
3223
+ }
3224
+ };
3225
+ }
3226
+ });
3227
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
3228
+ const _component_Nav = __unplugin_components_0;
3229
+ const _component_nav_list = __unplugin_components_1;
3230
+ const _component_component_list = __unplugin_components_2;
3231
+ const _component_workspace = __unplugin_components_3;
3232
+ const _component_props_panel = __unplugin_components_4;
3233
+ const _component_form_preview = __unplugin_components_5;
3234
+ const _component_framework = resolveComponent("framework");
3235
+ return openBlock(), createBlock(_component_framework, { headerShow: _ctx.headerShow }, createSlots({
3236
+ navlist: withCtx(() => [
3237
+ createVNode(_component_nav_list, { menu: _ctx.menu }, null, 8, ["menu"])
3238
+ ]),
3239
+ left: withCtx(() => [
3240
+ createVNode(_component_component_list, {
3241
+ "basic-fields": _ctx.basicFields,
3242
+ "layout-fields": _ctx.layoutFields
3243
+ }, null, 8, ["basic-fields", "layout-fields"])
3244
+ ]),
3245
+ workspace: withCtx(() => [
3246
+ createVNode(_component_workspace, { ref: "workspace" }, null, 512)
3247
+ ]),
3248
+ other: withCtx(() => [
3249
+ createVNode(_component_form_preview, { ref: "formPreview" }, null, 512)
3250
+ ]),
3251
+ _: 2
3252
+ }, [
3253
+ _ctx.headerShow ? {
3254
+ name: "nav",
3255
+ fn: withCtx(() => [
3256
+ createVNode(_component_Nav)
3257
+ ]),
3258
+ key: "0"
3259
+ } : void 0,
3260
+ _ctx.panel.length > 0 ? {
3261
+ name: "propsPanel",
3262
+ fn: withCtx(() => [
3263
+ createVNode(_component_props_panel, {
3264
+ onSave: _ctx.onSave,
3265
+ column: _ctx.menu.column,
3266
+ panel: _ctx.panel
3267
+ }, null, 8, ["onSave", "column", "panel"])
3268
+ ]),
3269
+ key: "1"
3270
+ } : void 0
3271
+ ]), 1032, ["headerShow"]);
3272
+ }
3273
+ var StarfishEditor = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
3274
+ var main = {
3275
+ install: (app) => {
3276
+ app.config.globalProperties.$EventBus = vm;
3277
+ app.config.globalProperties.$Flex = flex;
3278
+ window.VApp = app.config.globalProperties;
3279
+ window.VueContext = {
3280
+ $Flex: flex
3281
+ };
3282
+ app.use(StarfishForm);
3283
+ const starfishformlist = app.config.globalProperties.$formcomponents;
3284
+ for (const key in starfishformlist) {
3285
+ app.component(key, starfishformlist[key]);
3286
+ }
3287
+ app.component(
3288
+ "CustomDialog",
3289
+ defineAsyncComponent(() => import("./CustomDialog.js"))
3290
+ );
3291
+ app.component(
3292
+ "ConditionSelect",
3293
+ defineAsyncComponent(() => import("./ConditionSelect.js"))
3294
+ );
3295
+ app.component(
3296
+ "HighConditionSelect",
3297
+ defineAsyncComponent(() => import("./ConditionModule.js"))
3298
+ );
3299
+ app.component(
3300
+ "draggable",
3301
+ defineAsyncComponent({
3302
+ loader: () => import("vuedraggable"),
3303
+ loadingComponent: Loading
3304
+ })
3305
+ );
3306
+ app.component(
3307
+ "Shape",
3308
+ defineAsyncComponent(() => Promise.resolve().then(function() {
3309
+ return Shape;
3310
+ }))
3311
+ );
3312
+ app.component(
3313
+ "FormStyle",
3314
+ defineAsyncComponent(() => import("./formStyle.js"))
3315
+ );
3316
+ app.component("StarfishEditor", StarfishEditor);
3317
+ }
3318
+ };
3319
+ export { _export_sfc as _, formStore as f, main as m };