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.
- package/auto-imports.d.ts +10 -0
- package/babel.config.js +8 -0
- package/components.d.ts +46 -0
- package/dist/ConditionModule.js +892 -0
- package/dist/ConditionSelect.js +483 -0
- package/dist/CustomDialog.js +105 -0
- package/dist/formStyle.js +245 -0
- package/dist/globalFormList.js +59 -0
- package/dist/jsonCode.js +74 -0
- package/dist/jsonEditor.js +71 -0
- package/dist/main.js +3319 -0
- package/dist/starfish-editor.es.js +30 -0
- package/dist/style.css +1 -0
- package/dist/types/editor/src/common/ConditionSelect/ConditionGroup.vue.d.ts +61 -0
- package/dist/types/editor/src/common/ConditionSelect/ConditionModule.vue.d.ts +43 -0
- package/dist/types/editor/src/common/ConditionSelect/ConditionTanc.vue.d.ts +48 -0
- package/dist/types/editor/src/common/ConditionSelect.vue.d.ts +72 -0
- package/dist/types/editor/src/common/CustomDialog.vue.d.ts +25 -0
- package/dist/types/editor/src/common/Loading.vue.d.ts +3 -0
- package/dist/types/editor/src/common/formJson.d.ts +80 -0
- package/dist/types/editor/src/common/jsonCode.vue.d.ts +110 -0
- package/dist/types/editor/src/components/ComponentList.vue.d.ts +32 -0
- package/dist/types/editor/src/components/FormPreview.vue.d.ts +25 -0
- package/dist/types/editor/src/components/Nav.vue.d.ts +9 -0
- package/dist/types/editor/src/components/PropsPanel.vue.d.ts +53 -0
- package/dist/types/editor/src/components/Shape.vue.d.ts +40 -0
- package/dist/types/editor/src/components/Workspace.vue.d.ts +22 -0
- package/dist/types/editor/src/components/globalFormList.vue.d.ts +6 -0
- package/dist/types/editor/src/components/jsonEditor.vue.d.ts +6 -0
- package/dist/types/editor/src/controller/action.d.ts +18 -0
- package/dist/types/editor/src/controller/form.d.ts +24 -0
- package/dist/types/editor/src/controller/history.d.ts +12 -0
- package/dist/types/editor/src/controller/shortcut.d.ts +20 -0
- package/dist/types/editor/src/controller/ui.d.ts +10 -0
- package/dist/types/editor/src/layouts/ControlEditSize.vue.d.ts +17 -0
- package/dist/types/editor/src/layouts/Framework.vue.d.ts +33 -0
- package/dist/types/editor/src/layouts/Resizer.vue.d.ts +13 -0
- package/dist/types/editor/src/layouts/ShortcutKey.vue.d.ts +8 -0
- package/dist/types/editor/src/main.d.ts +5 -0
- package/dist/types/editor/src/shims-vue.d.ts +23 -0
- package/dist/types/editor/src/starfish-editor.vue.d.ts +109 -0
- package/dist/types/editor/src/type.d.ts +224 -0
- package/dist/types/editor/src/utils/_.d.ts +33 -0
- package/dist/types/editor/src/utils/formKeycon.d.ts +18 -0
- package/dist/types/editor/src/utils/shortcutKey.d.ts +3 -0
- package/dist/types/editor/src/utils/vm.d.ts +3 -0
- package/dist/types/starfish-editor.d.ts +3 -0
- package/package.json +55 -0
- package/src/common/ConditionSelect/ConditionGroup.vue +167 -0
- package/src/common/ConditionSelect/ConditionModule.vue +118 -0
- package/src/common/ConditionSelect/ConditionTanc.vue +319 -0
- package/src/common/ConditionSelect.vue +268 -0
- package/src/common/CustomDialog.vue +77 -0
- package/src/common/Loading.vue +10 -0
- package/src/common/formJson.ts +143 -0
- package/src/common/formStyle.vue +170 -0
- package/src/common/jsonCode.vue +45 -0
- package/src/components/ComponentList.vue +156 -0
- package/src/components/FormPreview.vue +197 -0
- package/src/components/Nav.vue +128 -0
- package/src/components/NavList.vue +560 -0
- package/src/components/PropsPanel.vue +376 -0
- package/src/components/Shape.vue +178 -0
- package/src/components/Workspace.vue +258 -0
- package/src/components/globalFormList.vue +30 -0
- package/src/components/jsonEditor.vue +41 -0
- package/src/controller/action.ts +37 -0
- package/src/controller/form.ts +207 -0
- package/src/controller/history.ts +57 -0
- package/src/controller/shortcut.ts +81 -0
- package/src/controller/ui.ts +91 -0
- package/src/layouts/ControlEditSize.vue +52 -0
- package/src/layouts/Framework.vue +76 -0
- package/src/layouts/Resizer.vue +54 -0
- package/src/layouts/ShortcutKey.vue +61 -0
- package/src/main.ts +56 -0
- package/src/shims-vue.d.ts +23 -0
- package/src/starfish-editor.vue +176 -0
- package/src/styles/common/normalize.css +455 -0
- package/src/styles/component-list.scss +64 -0
- package/src/styles/condition-select.scss +176 -0
- package/src/styles/control_edit_size.scss +36 -0
- package/src/styles/custom-dialog.scss +110 -0
- package/src/styles/form-preview.scss +47 -0
- package/src/styles/framework.scss +150 -0
- package/src/styles/iconfont/iconfont.css +247 -0
- package/src/styles/iconfont/iconfont.js +1 -0
- package/src/styles/iconfont/iconfont.json +415 -0
- package/src/styles/iconfont/iconfont.ttf +0 -0
- package/src/styles/iconfont/iconfont.woff +0 -0
- package/src/styles/iconfont/iconfont.woff2 +0 -0
- package/src/styles/index.scss +18 -0
- package/src/styles/nav-list.scss +59 -0
- package/src/styles/nav.scss +46 -0
- package/src/styles/props-panel.scss +115 -0
- package/src/styles/resizer.scss +15 -0
- package/src/styles/shape.scss +101 -0
- package/src/styles/shortcutkey.scss +44 -0
- package/src/styles/variables.scss +36 -0
- package/src/styles/work-space.scss +126 -0
- package/src/type.ts +240 -0
- package/src/utils/_.ts +349 -0
- package/src/utils/formKeycon.ts +42 -0
- package/src/utils/shortcutKey.ts +46 -0
- package/src/utils/vm.ts +3 -0
- package/stats.html +4949 -0
- package/tsconfig.json +19 -0
- package/vite.config.ts +111 -0
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="header_nav">
|
|
3
|
+
<div class="logo">
|
|
4
|
+
<svg
|
|
5
|
+
version="1.0"
|
|
6
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
7
|
+
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
8
|
+
color-interpolation-filters="sRGB"
|
|
9
|
+
style="margin: auto"
|
|
10
|
+
>
|
|
11
|
+
<g fill="rgba(0, 0, 0, .9)">
|
|
12
|
+
<g>
|
|
13
|
+
<g>
|
|
14
|
+
<rect
|
|
15
|
+
fill="#ffffff"
|
|
16
|
+
fill-opacity="0"
|
|
17
|
+
stroke-width="2"
|
|
18
|
+
x="0"
|
|
19
|
+
y="0"
|
|
20
|
+
width="60"
|
|
21
|
+
height="69.34652458334297"
|
|
22
|
+
class="image-rect"
|
|
23
|
+
></rect>
|
|
24
|
+
<svg
|
|
25
|
+
x="0"
|
|
26
|
+
y="0"
|
|
27
|
+
width="60"
|
|
28
|
+
height="69.34652458334297"
|
|
29
|
+
filtersec="colorsb4782532531"
|
|
30
|
+
class="image-svg-svg primary"
|
|
31
|
+
style="overflow: visible"
|
|
32
|
+
>
|
|
33
|
+
<svg
|
|
34
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
35
|
+
viewBox="0 0 7.190000534057617 8.3100004196167"
|
|
36
|
+
>
|
|
37
|
+
<g>
|
|
38
|
+
<g fill-rule="evenodd">
|
|
39
|
+
<path
|
|
40
|
+
fill="#054ba3"
|
|
41
|
+
d="M1.8 2.4L0 2.08v4.15L1.8 2.4z"
|
|
42
|
+
></path>
|
|
43
|
+
<path
|
|
44
|
+
fill="#0691ca"
|
|
45
|
+
d="M4.21 1.72L3.6 0 0 2.08l4.21-.36z"
|
|
46
|
+
></path>
|
|
47
|
+
<path
|
|
48
|
+
fill="#054ba3"
|
|
49
|
+
d="M5.4 5.9l1.79.33V2.08L5.4 5.9z"
|
|
50
|
+
></path>
|
|
51
|
+
<path
|
|
52
|
+
fill="#0691ca"
|
|
53
|
+
d="M2.98 6.59l.62 1.72 3.59-2.08-4.21.36z"
|
|
54
|
+
></path>
|
|
55
|
+
<path
|
|
56
|
+
fill="#44c2f4"
|
|
57
|
+
d="M0 6.23l3.6 2.08-2.42-3.47L0 6.23z"
|
|
58
|
+
></path>
|
|
59
|
+
<path
|
|
60
|
+
fill="#054ba3"
|
|
61
|
+
d="M6.01 3.47l1.18-1.39L3.6 0l2.41 3.47z"
|
|
62
|
+
></path>
|
|
63
|
+
</g>
|
|
64
|
+
</g>
|
|
65
|
+
</svg>
|
|
66
|
+
</svg>
|
|
67
|
+
<!---->
|
|
68
|
+
</g>
|
|
69
|
+
</g>
|
|
70
|
+
<g transform="translate(67,17.723264694213867)">
|
|
71
|
+
<g
|
|
72
|
+
data-gra="path-name"
|
|
73
|
+
fill-rule=""
|
|
74
|
+
class="tp-name iconsvg-namesvg"
|
|
75
|
+
>
|
|
76
|
+
<g transform="scale(1)">
|
|
77
|
+
<g>
|
|
78
|
+
<path
|
|
79
|
+
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"
|
|
80
|
+
transform="translate(-0.1899999976158142, 35.939998626708984)"
|
|
81
|
+
></path>
|
|
82
|
+
</g>
|
|
83
|
+
</g>
|
|
84
|
+
</g>
|
|
85
|
+
</g>
|
|
86
|
+
</g>
|
|
87
|
+
</svg>
|
|
88
|
+
|
|
89
|
+
<!-- <iframe src="https://ghbtns.com/github-btn.html?user=haixin-fang&repo=vue-form-design&type=star&count=true" frameborder="0" scrolling="0" width="160px" height="30px" style="vertical-align: middle; margin-top: 10px; margin-left: 10px"></iframe> -->
|
|
90
|
+
</div>
|
|
91
|
+
<div class="starfish-link">
|
|
92
|
+
<!-- <a href="https://github.com/haixin-fang/vue-form-design" target="_black"
|
|
93
|
+
>GitHub</a
|
|
94
|
+
> -->
|
|
95
|
+
<svg
|
|
96
|
+
width="32"
|
|
97
|
+
height="32"
|
|
98
|
+
viewBox="0 0 32 32"
|
|
99
|
+
fill="none"
|
|
100
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
101
|
+
@click="onLink"
|
|
102
|
+
>
|
|
103
|
+
<path
|
|
104
|
+
fill-rule="evenodd"
|
|
105
|
+
clip-rule="evenodd"
|
|
106
|
+
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"
|
|
107
|
+
fill="currentColor"
|
|
108
|
+
></path>
|
|
109
|
+
</svg>
|
|
110
|
+
</div>
|
|
111
|
+
</div>
|
|
112
|
+
</template>
|
|
113
|
+
<script lang="ts">
|
|
114
|
+
import { defineComponent } from "vue";
|
|
115
|
+
/**
|
|
116
|
+
* 2022.7.1想到的优化点
|
|
117
|
+
* 新增json导入导出功能
|
|
118
|
+
*/
|
|
119
|
+
export default defineComponent({
|
|
120
|
+
setup() {
|
|
121
|
+
return {
|
|
122
|
+
onLink() {
|
|
123
|
+
window.open("https://github.com/haixin-fang/vue-form-design");
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
},
|
|
127
|
+
});
|
|
128
|
+
</script>
|
|
@@ -0,0 +1,560 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="nav_list">
|
|
3
|
+
<div class="detailBtn">
|
|
4
|
+
<el-tooltip
|
|
5
|
+
class="box-item"
|
|
6
|
+
effect="dark"
|
|
7
|
+
content="保存"
|
|
8
|
+
placement="top"
|
|
9
|
+
v-if="btnIsShow('left', 'save')"
|
|
10
|
+
>
|
|
11
|
+
<span
|
|
12
|
+
class="iconfontui icon-baocun"
|
|
13
|
+
:class="clearIsDisable ? 'noactive' : ''"
|
|
14
|
+
@click="handleFormSave()"
|
|
15
|
+
></span>
|
|
16
|
+
</el-tooltip>
|
|
17
|
+
<el-tooltip
|
|
18
|
+
class="box-item"
|
|
19
|
+
effect="dark"
|
|
20
|
+
content="预览"
|
|
21
|
+
placement="top"
|
|
22
|
+
v-if="btnIsShow('left', 'preview')"
|
|
23
|
+
>
|
|
24
|
+
<span
|
|
25
|
+
class="iconfontui icon-icon_yulan"
|
|
26
|
+
:class="clearIsDisable ? 'noactive' : ''"
|
|
27
|
+
@click="handleFormPre()"
|
|
28
|
+
></span>
|
|
29
|
+
</el-tooltip>
|
|
30
|
+
<el-tooltip
|
|
31
|
+
class="box-item"
|
|
32
|
+
effect="dark"
|
|
33
|
+
content="全屏"
|
|
34
|
+
placement="top"
|
|
35
|
+
v-if="
|
|
36
|
+
!fullscreen && btnIsShow('left', 'fullscreen') && supportFullScreen
|
|
37
|
+
"
|
|
38
|
+
>
|
|
39
|
+
<span class="iconfontui icon-quanping" @click="handleFullScreen()"></span>
|
|
40
|
+
</el-tooltip>
|
|
41
|
+
<el-tooltip
|
|
42
|
+
class="box-item"
|
|
43
|
+
effect="dark"
|
|
44
|
+
content="非全屏"
|
|
45
|
+
placement="top"
|
|
46
|
+
v-if="
|
|
47
|
+
fullscreen && btnIsShow('left', 'fullscreen') && supportFullScreen
|
|
48
|
+
"
|
|
49
|
+
>
|
|
50
|
+
<span class="iconfontui icon-suoxiao1" @click="handleFullScreen()"></span>
|
|
51
|
+
</el-tooltip>
|
|
52
|
+
<el-tooltip
|
|
53
|
+
class="box-item"
|
|
54
|
+
effect="dark"
|
|
55
|
+
content="清空"
|
|
56
|
+
placement="top"
|
|
57
|
+
v-if="btnIsShow('left', 'delete')"
|
|
58
|
+
>
|
|
59
|
+
<span
|
|
60
|
+
class="iconfontui icon-shanchu1"
|
|
61
|
+
:class="clearIsDisable ? 'noactive' : ''"
|
|
62
|
+
@click="handleClear()"
|
|
63
|
+
>
|
|
64
|
+
</span>
|
|
65
|
+
</el-tooltip>
|
|
66
|
+
<el-tooltip
|
|
67
|
+
class="box-item"
|
|
68
|
+
effect="dark"
|
|
69
|
+
content="组件结构树"
|
|
70
|
+
placement="top"
|
|
71
|
+
v-if="btnIsShow('left', 'tree')"
|
|
72
|
+
>
|
|
73
|
+
<span class="iconfontui icon-tree" @click="handleTree()"> </span>
|
|
74
|
+
</el-tooltip>
|
|
75
|
+
<el-tooltip
|
|
76
|
+
class="box-item"
|
|
77
|
+
effect="dark"
|
|
78
|
+
content="撤销"
|
|
79
|
+
placement="top"
|
|
80
|
+
v-if="btnIsShow('left', 'undo')"
|
|
81
|
+
>
|
|
82
|
+
<span
|
|
83
|
+
class="iconfontui icon-24gl-undo3"
|
|
84
|
+
:class="historyIndex == -1 ? 'noactive' : ''"
|
|
85
|
+
@click="handleBack()"
|
|
86
|
+
></span>
|
|
87
|
+
</el-tooltip>
|
|
88
|
+
<el-tooltip
|
|
89
|
+
class="box-item"
|
|
90
|
+
effect="dark"
|
|
91
|
+
content="重做"
|
|
92
|
+
placement="top"
|
|
93
|
+
v-if="btnIsShow('left', 'redo')"
|
|
94
|
+
>
|
|
95
|
+
<span
|
|
96
|
+
class="iconfontui icon-24gl-redo3"
|
|
97
|
+
:class="historyIndex == historyLen - 1 ? 'noactive' : ''"
|
|
98
|
+
@click="handleForward()"
|
|
99
|
+
></span>
|
|
100
|
+
</el-tooltip>
|
|
101
|
+
<!-- <el-button text @click="handleFormSave()" size="small" :disabled="clearIsDisable">保存</el-button>
|
|
102
|
+
<el-button text @click="handleFormPre()" size="small" :disabled="clearIsDisable">预览</el-button>
|
|
103
|
+
<el-button text @click="handleFullScreen()" size="small">全屏/非全屏</el-button>
|
|
104
|
+
<el-button text @click="handleClear()" size="small" :disabled="clearIsDisable">清空</el-button>
|
|
105
|
+
<el-button text @click="handleBack()" size="small" :disabled="historyIndex == -1">后退</el-button>
|
|
106
|
+
<el-button text @click="handleForward()" size="small" :disabled="historyIndex == historyLen - 1">前进</el-button> -->
|
|
107
|
+
</div>
|
|
108
|
+
<div class="pageBtn">
|
|
109
|
+
<div class="el-button-group" v-if="btnIsShow('right', 'viewport')">
|
|
110
|
+
<el-tooltip
|
|
111
|
+
class="box-item"
|
|
112
|
+
effect="dark"
|
|
113
|
+
content="PC"
|
|
114
|
+
placement="top"
|
|
115
|
+
v-if="btnIsShow('left', 'redo')"
|
|
116
|
+
>
|
|
117
|
+
<span
|
|
118
|
+
:class="pageType == 'PC' ? 'info' : ''"
|
|
119
|
+
@click="updatePageType('PC')"
|
|
120
|
+
><i class="iconfontui icon-diannao"></i
|
|
121
|
+
></span>
|
|
122
|
+
</el-tooltip>
|
|
123
|
+
<el-tooltip
|
|
124
|
+
class="box-item"
|
|
125
|
+
effect="dark"
|
|
126
|
+
content="Pad"
|
|
127
|
+
placement="top"
|
|
128
|
+
v-if="btnIsShow('left', 'redo')"
|
|
129
|
+
>
|
|
130
|
+
<span
|
|
131
|
+
:class="pageType == 'Pad' ? 'info' : ''"
|
|
132
|
+
@click="updatePageType('Pad')"
|
|
133
|
+
><i class="iconfontui icon-pingbandiannao"></i
|
|
134
|
+
></span>
|
|
135
|
+
</el-tooltip>
|
|
136
|
+
<el-tooltip
|
|
137
|
+
class="box-item"
|
|
138
|
+
effect="dark"
|
|
139
|
+
content="H5"
|
|
140
|
+
placement="top"
|
|
141
|
+
v-if="btnIsShow('left', 'redo')"
|
|
142
|
+
>
|
|
143
|
+
<span
|
|
144
|
+
:class="pageType == 'H5' ? 'info' : ''"
|
|
145
|
+
@click="updatePageType('H5')"
|
|
146
|
+
><i class="iconfontui icon-shouji"></i
|
|
147
|
+
></span>
|
|
148
|
+
</el-tooltip>
|
|
149
|
+
<el-tooltip
|
|
150
|
+
class="box-item"
|
|
151
|
+
effect="dark"
|
|
152
|
+
content="导入json"
|
|
153
|
+
placement="top"
|
|
154
|
+
>
|
|
155
|
+
<span
|
|
156
|
+
type="text"
|
|
157
|
+
plain
|
|
158
|
+
@click="ImportJson"
|
|
159
|
+
v-if="btnIsShow('right', 'json-import')"
|
|
160
|
+
><i class="iconfontui icon-daoru"></i
|
|
161
|
+
></span>
|
|
162
|
+
</el-tooltip>
|
|
163
|
+
<el-tooltip
|
|
164
|
+
class="box-item"
|
|
165
|
+
effect="dark"
|
|
166
|
+
content="导出json"
|
|
167
|
+
placement="top"
|
|
168
|
+
>
|
|
169
|
+
<span
|
|
170
|
+
type="text"
|
|
171
|
+
plain
|
|
172
|
+
@click="exportJson"
|
|
173
|
+
v-if="btnIsShow('right', 'json-export')"
|
|
174
|
+
><i class="iconfontui icon-daochu"></i
|
|
175
|
+
></span>
|
|
176
|
+
</el-tooltip>
|
|
177
|
+
</div>
|
|
178
|
+
</div>
|
|
179
|
+
<el-drawer
|
|
180
|
+
ref="drawerRef"
|
|
181
|
+
v-model="dialog"
|
|
182
|
+
title="表单结构树"
|
|
183
|
+
:before-close="handleClose"
|
|
184
|
+
direction="ltr"
|
|
185
|
+
custom-class="demo-drawer"
|
|
186
|
+
>
|
|
187
|
+
<div class="demo-drawer__content">
|
|
188
|
+
<el-input v-model="filterText" placeholder="Filter keyword" />
|
|
189
|
+
<el-tree
|
|
190
|
+
:data="tree"
|
|
191
|
+
:props="propsData"
|
|
192
|
+
ref="treeRef"
|
|
193
|
+
default-expand-all
|
|
194
|
+
:filter-node-method="filterNode"
|
|
195
|
+
@node-click="myClick"
|
|
196
|
+
style="margin-top: 20px"
|
|
197
|
+
>
|
|
198
|
+
<template #default="{ node, data }">
|
|
199
|
+
<span class="custom-tree-node">
|
|
200
|
+
<i
|
|
201
|
+
class="iconfontui"
|
|
202
|
+
:class="data.icon"
|
|
203
|
+
style="font-size: 12px; margin-right: 5px"
|
|
204
|
+
></i>
|
|
205
|
+
<span>{{ node.label }}</span>
|
|
206
|
+
<!-- <span>
|
|
207
|
+
<i
|
|
208
|
+
@click="remove(node, data)"
|
|
209
|
+
class="iconfontui icon-shanchu1"
|
|
210
|
+
></i>
|
|
211
|
+
</span> -->
|
|
212
|
+
</span>
|
|
213
|
+
</template>
|
|
214
|
+
</el-tree>
|
|
215
|
+
</div>
|
|
216
|
+
</el-drawer>
|
|
217
|
+
<custom-dialog ref="jsonDialog" :width="800" dialogclass="codeDialog">
|
|
218
|
+
<div class="custom_code">
|
|
219
|
+
<!-- <codemirror
|
|
220
|
+
v-model="code"
|
|
221
|
+
placeholder="json导入"
|
|
222
|
+
mode="text/json"
|
|
223
|
+
:style="{ height: '400px' }"
|
|
224
|
+
:extensions="extensions"
|
|
225
|
+
/> -->
|
|
226
|
+
<JsonCode v-model:value="code" />
|
|
227
|
+
<el-upload
|
|
228
|
+
accept="application/json"
|
|
229
|
+
class="upload-demo"
|
|
230
|
+
action="https://run.mocky.io/v3/9d059bf9-4660-45f2-925d-ce80ad6c4d15"
|
|
231
|
+
:on-change="handleChange"
|
|
232
|
+
>
|
|
233
|
+
<el-button type="primary">导入json文件</el-button>
|
|
234
|
+
</el-upload>
|
|
235
|
+
</div>
|
|
236
|
+
|
|
237
|
+
<el-footer class="my-Footer" style="text-align: center">
|
|
238
|
+
<el-button type="primary" @click="saveJson">确定</el-button>
|
|
239
|
+
<el-button @click="closeCodeDialog">关闭</el-button>
|
|
240
|
+
</el-footer>
|
|
241
|
+
</custom-dialog>
|
|
242
|
+
</div>
|
|
243
|
+
</template>
|
|
244
|
+
<script lang="ts">
|
|
245
|
+
import {
|
|
246
|
+
defineComponent,
|
|
247
|
+
computed,
|
|
248
|
+
getCurrentInstance,
|
|
249
|
+
onMounted,
|
|
250
|
+
onUnmounted,
|
|
251
|
+
inject,
|
|
252
|
+
ref,
|
|
253
|
+
toRaw,
|
|
254
|
+
watch,
|
|
255
|
+
PropType,
|
|
256
|
+
defineAsyncComponent,
|
|
257
|
+
} from "vue";
|
|
258
|
+
import type {
|
|
259
|
+
Controls,
|
|
260
|
+
MenuBarData,
|
|
261
|
+
AllFormItem,
|
|
262
|
+
BaseComponentItem,
|
|
263
|
+
} from "@/type";
|
|
264
|
+
import { clearCanvas } from "@/utils/formKeycon";
|
|
265
|
+
// import { json } from "@codemirror/lang-json";
|
|
266
|
+
// import Codemirror from "vue-codemirror";
|
|
267
|
+
// import JsonCode from "@/common/jsonCode.vue";
|
|
268
|
+
export default defineComponent({
|
|
269
|
+
components: {
|
|
270
|
+
JsonCode: defineAsyncComponent(() => import("@/common/jsonCode.vue")),
|
|
271
|
+
},
|
|
272
|
+
props: {
|
|
273
|
+
/** 顶部工具栏配置 */
|
|
274
|
+
menu: {
|
|
275
|
+
type: Object as PropType<MenuBarData>,
|
|
276
|
+
default: () => ({ left: [], right: [], column: true }),
|
|
277
|
+
},
|
|
278
|
+
},
|
|
279
|
+
setup(props) {
|
|
280
|
+
const { proxy } = getCurrentInstance() as any;
|
|
281
|
+
const { hisContrl, uiControl, formStore } =
|
|
282
|
+
inject<Controls>("control") || {};
|
|
283
|
+
const clearIsDisable = computed(
|
|
284
|
+
() => formStore?.get("allFormList")?.length == 0
|
|
285
|
+
);
|
|
286
|
+
const historyIndex = computed(() => hisContrl?.get("index"));
|
|
287
|
+
const historyLen = computed(
|
|
288
|
+
() => hisContrl?.get<Array<any>>("historyList").length || 0
|
|
289
|
+
);
|
|
290
|
+
const fullscreen = computed(() => uiControl?.get("isFullscreen"));
|
|
291
|
+
const allFormList = computed(() => formStore?.get("allFormList"));
|
|
292
|
+
const pageType = computed(() => uiControl?.get("pageType"));
|
|
293
|
+
const supportFullScreen = ref(!!document.fullscreenEnabled);
|
|
294
|
+
// const extensions = [json()];
|
|
295
|
+
const jsonDialog = ref();
|
|
296
|
+
const tree = ref();
|
|
297
|
+
const treeRef = ref();
|
|
298
|
+
const filterText = ref();
|
|
299
|
+
const code = ref();
|
|
300
|
+
const propsData = ref({
|
|
301
|
+
value: "id",
|
|
302
|
+
label: "label",
|
|
303
|
+
children: "children",
|
|
304
|
+
});
|
|
305
|
+
interface Tree {
|
|
306
|
+
id: string;
|
|
307
|
+
label: string;
|
|
308
|
+
children?: Tree[];
|
|
309
|
+
name?: string;
|
|
310
|
+
}
|
|
311
|
+
const initTree = () => {
|
|
312
|
+
if (allFormList.value && allFormList.value.length > 0) {
|
|
313
|
+
const treeList = toRaw(allFormList.value).map((item: any): Tree => {
|
|
314
|
+
return toTree(item);
|
|
315
|
+
});
|
|
316
|
+
return treeList;
|
|
317
|
+
} else {
|
|
318
|
+
return [];
|
|
319
|
+
}
|
|
320
|
+
};
|
|
321
|
+
function toTree(item: any): any {
|
|
322
|
+
if (!item.layout) {
|
|
323
|
+
return {
|
|
324
|
+
id: item.id,
|
|
325
|
+
label: item.nameCn,
|
|
326
|
+
icon: item.icon,
|
|
327
|
+
};
|
|
328
|
+
} else {
|
|
329
|
+
let children;
|
|
330
|
+
if (item.ControlType == "Grid") {
|
|
331
|
+
children = item.data.columns.map(
|
|
332
|
+
(colItem: { list: AllFormItem[] }) => {
|
|
333
|
+
const children = colItem.list.map((listItem: AllFormItem) => {
|
|
334
|
+
return toTree(listItem);
|
|
335
|
+
});
|
|
336
|
+
return {
|
|
337
|
+
id: "",
|
|
338
|
+
label: "GridChild",
|
|
339
|
+
children,
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
);
|
|
343
|
+
} else if (item.ControlType == "TableLayout") {
|
|
344
|
+
children = item.data.trs.map((trItem: any) => {
|
|
345
|
+
const children = trItem.tds.map((tdItem: any) => {
|
|
346
|
+
const children = tdItem.list.map((listItem: AllFormItem) => {
|
|
347
|
+
return toTree(listItem);
|
|
348
|
+
});
|
|
349
|
+
return {
|
|
350
|
+
id: "",
|
|
351
|
+
label: "列",
|
|
352
|
+
children,
|
|
353
|
+
};
|
|
354
|
+
});
|
|
355
|
+
return {
|
|
356
|
+
id: "",
|
|
357
|
+
label: "行",
|
|
358
|
+
children,
|
|
359
|
+
};
|
|
360
|
+
});
|
|
361
|
+
} else if (
|
|
362
|
+
item.ControlType == "Collapse" ||
|
|
363
|
+
item.ControlType == "Tabs"
|
|
364
|
+
) {
|
|
365
|
+
children = item.data.items.map((colItem: any) => {
|
|
366
|
+
const children = colItem.list.map((listItem: AllFormItem) => {
|
|
367
|
+
return toTree(listItem);
|
|
368
|
+
});
|
|
369
|
+
return {
|
|
370
|
+
id: "",
|
|
371
|
+
label: item.nameCn + "-child",
|
|
372
|
+
children,
|
|
373
|
+
};
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
return {
|
|
377
|
+
id: item.id,
|
|
378
|
+
label: item.nameCn,
|
|
379
|
+
children,
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
const dialog = ref(false);
|
|
384
|
+
const timer: unknown = null;
|
|
385
|
+
const filterNode = (value: string, data: Tree) => {
|
|
386
|
+
if (!value) return true;
|
|
387
|
+
return data.label.includes(value);
|
|
388
|
+
};
|
|
389
|
+
const handleFormSave = (type?: string) => {
|
|
390
|
+
proxy.$EventBus.emit("setSave", type);
|
|
391
|
+
};
|
|
392
|
+
const handleFormPre = () => {
|
|
393
|
+
formStore?.set("preview", true);
|
|
394
|
+
proxy.$EventBus.emit("openPreview");
|
|
395
|
+
};
|
|
396
|
+
|
|
397
|
+
const setTimeSave = () => {
|
|
398
|
+
// timer = setInterval(() => {
|
|
399
|
+
// handleFormSave("auto");
|
|
400
|
+
// }, 20000);
|
|
401
|
+
};
|
|
402
|
+
|
|
403
|
+
const handleImportJson = () => {
|
|
404
|
+
try {
|
|
405
|
+
const result = JSON.parse(code.value);
|
|
406
|
+
const formList = result.map((item: BaseComponentItem) => {
|
|
407
|
+
return window.VueContext.$Flex.jsonToForm(item);
|
|
408
|
+
});
|
|
409
|
+
code.value = JSON.stringify(formList, null, 4);
|
|
410
|
+
} catch (e) {
|
|
411
|
+
code.value = JSON.stringify({});
|
|
412
|
+
console.error(e);
|
|
413
|
+
ElMessage({
|
|
414
|
+
type: "error",
|
|
415
|
+
message: "导入失败,数据格式不对",
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
};
|
|
419
|
+
|
|
420
|
+
watch(filterText, (val) => {
|
|
421
|
+
treeRef.value?.filter(val);
|
|
422
|
+
});
|
|
423
|
+
|
|
424
|
+
// 每隔一分钟判断是否更改了内容,如果有更改则自动保存
|
|
425
|
+
onMounted(() => {
|
|
426
|
+
setTimeSave();
|
|
427
|
+
});
|
|
428
|
+
onUnmounted(() => {
|
|
429
|
+
clearInterval(timer as any);
|
|
430
|
+
});
|
|
431
|
+
|
|
432
|
+
return {
|
|
433
|
+
// extensions,
|
|
434
|
+
code,
|
|
435
|
+
supportFullScreen,
|
|
436
|
+
handleFormSave,
|
|
437
|
+
handleFormPre,
|
|
438
|
+
jsonDialog,
|
|
439
|
+
pageType,
|
|
440
|
+
historyIndex,
|
|
441
|
+
historyLen,
|
|
442
|
+
fullscreen,
|
|
443
|
+
clearIsDisable,
|
|
444
|
+
filterText,
|
|
445
|
+
propsData,
|
|
446
|
+
dialog,
|
|
447
|
+
tree,
|
|
448
|
+
treeRef,
|
|
449
|
+
filterNode,
|
|
450
|
+
btnIsShow(type: "left" | "right", btn: any) {
|
|
451
|
+
if (props.menu[type].length == 0) {
|
|
452
|
+
return true;
|
|
453
|
+
}
|
|
454
|
+
return props.menu[type].includes(btn);
|
|
455
|
+
},
|
|
456
|
+
updatePageType(type: string) {
|
|
457
|
+
uiControl?.set("pageType", type);
|
|
458
|
+
},
|
|
459
|
+
handleClear: () => {
|
|
460
|
+
clearCanvas();
|
|
461
|
+
formStore?.setFormCurrentId("");
|
|
462
|
+
},
|
|
463
|
+
handleBack: () => {
|
|
464
|
+
hisContrl?.back();
|
|
465
|
+
},
|
|
466
|
+
handleForward: () => {
|
|
467
|
+
hisContrl?.go();
|
|
468
|
+
},
|
|
469
|
+
handleFullScreen: () => {
|
|
470
|
+
const value = !uiControl?.get("isFullscreen");
|
|
471
|
+
uiControl?.set("isFullscreen", value);
|
|
472
|
+
if (value) {
|
|
473
|
+
const element: any = document.documentElement;
|
|
474
|
+
|
|
475
|
+
if (element.requestFullscreen) {
|
|
476
|
+
element.requestFullscreen();
|
|
477
|
+
} else if (element.mozRequestFullScreen) {
|
|
478
|
+
// Firefox
|
|
479
|
+
element.mozRequestFullScreen();
|
|
480
|
+
} else if (element.webkitRequestFullscreen) {
|
|
481
|
+
// Chrome, Safari and Opera
|
|
482
|
+
element.webkitRequestFullscreen();
|
|
483
|
+
} else if (element.msRequestFullscreen) {
|
|
484
|
+
// IE/Edge
|
|
485
|
+
element.msRequestFullscreen();
|
|
486
|
+
}
|
|
487
|
+
} else {
|
|
488
|
+
const doc: any = document;
|
|
489
|
+
if (doc.exitFullscreen) {
|
|
490
|
+
doc.exitFullscreen();
|
|
491
|
+
} else if (doc.mozCancelFullScreen) {
|
|
492
|
+
// Firefox
|
|
493
|
+
doc.mozCancelFullScreen();
|
|
494
|
+
} else if (doc.webkitExitFullscreen) {
|
|
495
|
+
// Chrome, Safari and Opera
|
|
496
|
+
doc.webkitExitFullscreen();
|
|
497
|
+
} else if (doc.msExitFullscreen) {
|
|
498
|
+
// IE/Edge
|
|
499
|
+
doc.msExitFullscreen();
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
},
|
|
503
|
+
handleTree() {
|
|
504
|
+
dialog.value = true;
|
|
505
|
+
tree.value = initTree();
|
|
506
|
+
},
|
|
507
|
+
handleClose() {
|
|
508
|
+
dialog.value = false;
|
|
509
|
+
},
|
|
510
|
+
myClick(currentNode: any) {
|
|
511
|
+
formStore?.setFormCurrentId(currentNode.id);
|
|
512
|
+
},
|
|
513
|
+
ImportJson() {
|
|
514
|
+
jsonDialog.value.show();
|
|
515
|
+
jsonDialog.value.init("json导入", "icon-biaodan");
|
|
516
|
+
},
|
|
517
|
+
handleChange(file: any) {
|
|
518
|
+
const reader = new FileReader();
|
|
519
|
+
reader.readAsText(file.raw);
|
|
520
|
+
reader.onload = (e: any) => {
|
|
521
|
+
code.value = e.currentTarget.result;
|
|
522
|
+
handleImportJson();
|
|
523
|
+
};
|
|
524
|
+
},
|
|
525
|
+
closeCodeDialog() {
|
|
526
|
+
jsonDialog.value.close();
|
|
527
|
+
},
|
|
528
|
+
saveJson() {
|
|
529
|
+
debugger;
|
|
530
|
+
formStore?.updateAllFormList(JSON.parse(code.value));
|
|
531
|
+
jsonDialog.value.close();
|
|
532
|
+
},
|
|
533
|
+
exportJson(fileName = `demo.json`) {
|
|
534
|
+
let content = "data:application/json;charset=utf-8,";
|
|
535
|
+
try {
|
|
536
|
+
const result = JSON.stringify(
|
|
537
|
+
window.VueContext.$Flex.initFormToJson(allFormList.value)
|
|
538
|
+
);
|
|
539
|
+
content += result;
|
|
540
|
+
const encodedUri = encodeURI(content);
|
|
541
|
+
const actions = document.createElement("a");
|
|
542
|
+
actions.setAttribute("href", encodedUri);
|
|
543
|
+
actions.setAttribute("download", fileName);
|
|
544
|
+
actions.click();
|
|
545
|
+
ElMessage({
|
|
546
|
+
type: "success",
|
|
547
|
+
message: "导出成功",
|
|
548
|
+
});
|
|
549
|
+
} catch (e) {
|
|
550
|
+
ElMessage({
|
|
551
|
+
type: "error",
|
|
552
|
+
message: "导出失败,数据格式不对",
|
|
553
|
+
});
|
|
554
|
+
}
|
|
555
|
+
},
|
|
556
|
+
// remove(node, data) {},
|
|
557
|
+
};
|
|
558
|
+
},
|
|
559
|
+
});
|
|
560
|
+
</script>
|