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,101 @@
|
|
|
1
|
+
.starfish-editor {
|
|
2
|
+
.shape {
|
|
3
|
+
box-sizing: content-box;
|
|
4
|
+
// padding-bottom: 12px;
|
|
5
|
+
border: 2px solid transparent;
|
|
6
|
+
position: relative;
|
|
7
|
+
cursor: move;
|
|
8
|
+
border: 2px dotted #dfe2e2;
|
|
9
|
+
box-sizing: border-box;
|
|
10
|
+
&::before {
|
|
11
|
+
content: "";
|
|
12
|
+
height: 2px;
|
|
13
|
+
width: 0;
|
|
14
|
+
background: $blue;
|
|
15
|
+
position: absolute;
|
|
16
|
+
bottom: 0;
|
|
17
|
+
left: 100%;
|
|
18
|
+
-webkit-transition: all 0.3s;
|
|
19
|
+
transition: all 0.3s;
|
|
20
|
+
}
|
|
21
|
+
.editbar {
|
|
22
|
+
position: absolute;
|
|
23
|
+
bottom: 0;
|
|
24
|
+
right: 0;
|
|
25
|
+
border-radius: 10px 0 0 0;
|
|
26
|
+
background: $blue;
|
|
27
|
+
color: white;
|
|
28
|
+
padding: 1px 5px;
|
|
29
|
+
z-index: 3333333;
|
|
30
|
+
cursor: pointer;
|
|
31
|
+
span {
|
|
32
|
+
padding: 0 5px;
|
|
33
|
+
font-weight: 500;
|
|
34
|
+
}
|
|
35
|
+
span:first-child,
|
|
36
|
+
span:nth-child(2) {
|
|
37
|
+
font-size: 14px;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
.fade-leave-to,
|
|
41
|
+
.fade-enter-from {
|
|
42
|
+
opacity: 0;
|
|
43
|
+
}
|
|
44
|
+
.fade-leave-from,
|
|
45
|
+
.fade-enter-to {
|
|
46
|
+
opacity: 1;
|
|
47
|
+
}
|
|
48
|
+
.fade-leave-active,
|
|
49
|
+
.fade-enter-to {
|
|
50
|
+
transition: all 0.2s ease-in;
|
|
51
|
+
}
|
|
52
|
+
.editForm {
|
|
53
|
+
position: absolute;
|
|
54
|
+
display: flex;
|
|
55
|
+
flex-direction: column;
|
|
56
|
+
z-index: 3333334;
|
|
57
|
+
user-select: none;
|
|
58
|
+
background-color: #fff;
|
|
59
|
+
box-sizing: border-box;
|
|
60
|
+
box-shadow: 0 10px 20px rgb(0 0 0 / 30%), 0 0 0 1px #eee;
|
|
61
|
+
padding: 5px 0;
|
|
62
|
+
min-width: 180px;
|
|
63
|
+
span {
|
|
64
|
+
padding: 6px 12px;
|
|
65
|
+
display: flex;
|
|
66
|
+
text-align: left;
|
|
67
|
+
white-space: nowrap;
|
|
68
|
+
color: #333;
|
|
69
|
+
position: relative;
|
|
70
|
+
&:hover {
|
|
71
|
+
background: $blue;
|
|
72
|
+
color: white;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
.itemGhost {
|
|
77
|
+
background-color: #e70c557e;
|
|
78
|
+
}
|
|
79
|
+
&.shape_border {
|
|
80
|
+
border: 2px solid $blue;
|
|
81
|
+
background: #d1e4f6;
|
|
82
|
+
&::before {
|
|
83
|
+
left: 0;
|
|
84
|
+
width: 100%;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
&.shape_border_layout {
|
|
88
|
+
background: rgba(152, 103, 247, 0.24);
|
|
89
|
+
border: 2px solid $layout_color;
|
|
90
|
+
&::before {
|
|
91
|
+
background: $layout_color;
|
|
92
|
+
}
|
|
93
|
+
.editbar {
|
|
94
|
+
background: $layout_color;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
&.noactive_layout {
|
|
98
|
+
background: rgba(152, 103, 247, 0.1);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
.starfish-editor {
|
|
2
|
+
.shortCutKey {
|
|
3
|
+
position: absolute;
|
|
4
|
+
width: 250px;
|
|
5
|
+
background: #fff;
|
|
6
|
+
// transform: translateY(-105%);
|
|
7
|
+
// left: -105px;
|
|
8
|
+
right: 120%;
|
|
9
|
+
top: 0;
|
|
10
|
+
box-shadow: 0 0 8px 0 rgba(0, 0, 0, 0.1);
|
|
11
|
+
z-index: 20;
|
|
12
|
+
padding-bottom: 20px;
|
|
13
|
+
.san {
|
|
14
|
+
position: absolute;
|
|
15
|
+
height: 0;
|
|
16
|
+
width: 0;
|
|
17
|
+
border: 8px solid transparent;
|
|
18
|
+
border-left-color: #fff;
|
|
19
|
+
right: 0;
|
|
20
|
+
top: 30%;
|
|
21
|
+
margin-right: -16px;
|
|
22
|
+
}
|
|
23
|
+
.title {
|
|
24
|
+
text-align: center;
|
|
25
|
+
font-size: 18px;
|
|
26
|
+
padding-top: 5px;
|
|
27
|
+
}
|
|
28
|
+
.keyContent {
|
|
29
|
+
> div {
|
|
30
|
+
display: flex;
|
|
31
|
+
justify-content: space-between;
|
|
32
|
+
align-items: center;
|
|
33
|
+
span {
|
|
34
|
+
padding: 0 15px;
|
|
35
|
+
color: rgb(95, 85, 85);
|
|
36
|
+
}
|
|
37
|
+
span:first-child {
|
|
38
|
+
color: rgb(219, 124, 124);
|
|
39
|
+
// border: 1px solid rgb(219, 124, 124);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// 编辑页面头部的高度
|
|
2
|
+
$editor_nav: 50px;
|
|
3
|
+
|
|
4
|
+
$editor-nav-background-color: white;
|
|
5
|
+
// 画布的最小高度
|
|
6
|
+
$editor_canvas_min_height: 667px;
|
|
7
|
+
|
|
8
|
+
$blue: #409eff;
|
|
9
|
+
|
|
10
|
+
$resizer_background_color: #d8dee8;
|
|
11
|
+
|
|
12
|
+
$resizer_hover_background_color: #ccc;
|
|
13
|
+
|
|
14
|
+
$layout_color: #9867f7;
|
|
15
|
+
@mixin scrollbar() {
|
|
16
|
+
&::-webkit-scrollbar {
|
|
17
|
+
width: 5px;
|
|
18
|
+
height: 2px;
|
|
19
|
+
background: transparent;
|
|
20
|
+
transition: all 0.3s;
|
|
21
|
+
}
|
|
22
|
+
&::-webkit-scrollbar-thumb {
|
|
23
|
+
border-radius: 8px;
|
|
24
|
+
background-color: rgba(0, 0, 0, 0.2);
|
|
25
|
+
transition: all 0.3s;
|
|
26
|
+
-webkit-box-shadow: none;
|
|
27
|
+
}
|
|
28
|
+
&::-webkit-scrollbar-track {
|
|
29
|
+
border-radius: 8px;
|
|
30
|
+
background: transparent;
|
|
31
|
+
}
|
|
32
|
+
&::-webkit-scrollbar-track-piece {
|
|
33
|
+
background: transparent;
|
|
34
|
+
border: none;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
.starfish-editor {
|
|
2
|
+
background: #fafafa;
|
|
3
|
+
.editor_pages_center {
|
|
4
|
+
position: relative;
|
|
5
|
+
height: calc(100% - 40px);
|
|
6
|
+
// overflow-y: auto;
|
|
7
|
+
outline: 0;
|
|
8
|
+
.editor_nav {
|
|
9
|
+
position: absolute;
|
|
10
|
+
top: 0;
|
|
11
|
+
left: 0;
|
|
12
|
+
width: 100%;
|
|
13
|
+
box-shadow: 0 0 10px #ebedf0;
|
|
14
|
+
}
|
|
15
|
+
.canvasBox {
|
|
16
|
+
position: absolute;
|
|
17
|
+
// left: 16px;
|
|
18
|
+
left: 50%;
|
|
19
|
+
transform: translateX(-50%) scale(var(--scale));
|
|
20
|
+
top: 16px;
|
|
21
|
+
// right: 16px;
|
|
22
|
+
bottom: 10px;
|
|
23
|
+
width: calc(100% - 32px);
|
|
24
|
+
// margin-left: -350px;
|
|
25
|
+
background: white;
|
|
26
|
+
box-shadow: 0 4px 12px #ebedf0;
|
|
27
|
+
transform-origin: 50% 50%;
|
|
28
|
+
transition: all 0.2s linear;
|
|
29
|
+
overflow: hidden;
|
|
30
|
+
box-sizing: border-box;
|
|
31
|
+
// &.fullScreenBox {
|
|
32
|
+
// width: 100% ;
|
|
33
|
+
// }
|
|
34
|
+
&.PC_layout {
|
|
35
|
+
width: calc(100% - 32px);
|
|
36
|
+
}
|
|
37
|
+
&.Pad_layout {
|
|
38
|
+
width: 70%;
|
|
39
|
+
border-radius: 15px;
|
|
40
|
+
// box-shadow: 0 0 1px 10px #495060;
|
|
41
|
+
border: 10px solid #495060;
|
|
42
|
+
}
|
|
43
|
+
&.H5_layout {
|
|
44
|
+
width: 50%;
|
|
45
|
+
border-radius: 15px;
|
|
46
|
+
// box-shadow: 0 0 1px 10px #495060;
|
|
47
|
+
border: 10px solid #495060;
|
|
48
|
+
}
|
|
49
|
+
.draggable_container {
|
|
50
|
+
width: 100%;
|
|
51
|
+
height: 100%;
|
|
52
|
+
// min-height: $editor_canvas_min_height;
|
|
53
|
+
min-height: 100%;
|
|
54
|
+
z-index: 1;
|
|
55
|
+
text-align: left;
|
|
56
|
+
position: relative;
|
|
57
|
+
.dragArea {
|
|
58
|
+
width: 100%;
|
|
59
|
+
height: 100%;
|
|
60
|
+
min-height: 100%;
|
|
61
|
+
@include scrollbar();
|
|
62
|
+
overflow-y: auto;
|
|
63
|
+
}
|
|
64
|
+
.form-empty {
|
|
65
|
+
position: absolute;
|
|
66
|
+
top: 50%;
|
|
67
|
+
left: 50%;
|
|
68
|
+
transform: translate(-50%, -50%);
|
|
69
|
+
text-align: center;
|
|
70
|
+
font-size: 20px;
|
|
71
|
+
color: #ccc;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
.grid_controller {
|
|
75
|
+
position: absolute;
|
|
76
|
+
top: -30px;
|
|
77
|
+
left: 50%;
|
|
78
|
+
transform: translateX(-50%);
|
|
79
|
+
height: 25px;
|
|
80
|
+
line-height: 25px;
|
|
81
|
+
display: flex;
|
|
82
|
+
background: white;
|
|
83
|
+
span {
|
|
84
|
+
font-size: 14px;
|
|
85
|
+
padding: 0 10px;
|
|
86
|
+
border: 1px solid #d9d9d9;
|
|
87
|
+
box-sizing: border-box;
|
|
88
|
+
}
|
|
89
|
+
.grid_check {
|
|
90
|
+
color: #40a9ff;
|
|
91
|
+
border-color: #40a9ff;
|
|
92
|
+
}
|
|
93
|
+
.grid_check_none2 {
|
|
94
|
+
border-left: transparent;
|
|
95
|
+
}
|
|
96
|
+
.grid_check_none1 {
|
|
97
|
+
border-right: transparent;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
.editForm {
|
|
102
|
+
position: absolute;
|
|
103
|
+
display: flex;
|
|
104
|
+
flex-direction: column;
|
|
105
|
+
z-index: 3;
|
|
106
|
+
user-select: none;
|
|
107
|
+
background-color: #fff;
|
|
108
|
+
box-sizing: border-box;
|
|
109
|
+
box-shadow: 0 10px 20px rgb(0 0 0 / 30%), 0 0 0 1px #eee;
|
|
110
|
+
padding: 5px 0;
|
|
111
|
+
min-width: 180px;
|
|
112
|
+
span {
|
|
113
|
+
padding: 6px 12px;
|
|
114
|
+
display: flex;
|
|
115
|
+
text-align: left;
|
|
116
|
+
white-space: nowrap;
|
|
117
|
+
color: #333;
|
|
118
|
+
position: relative;
|
|
119
|
+
&:hover {
|
|
120
|
+
background: #409eff;
|
|
121
|
+
color: white;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
package/src/type.ts
ADDED
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import type { UiControl } from "./controller/ui";
|
|
2
|
+
import type { hisContrl } from "./controller/history";
|
|
3
|
+
import type { formContrl } from "./controller/form";
|
|
4
|
+
import type { ActionForm } from "./controller/action";
|
|
5
|
+
import type { shortCut } from "./controller/shortcut";
|
|
6
|
+
import type { FormConfig, fields } from "starfish-form/src/main";
|
|
7
|
+
/**
|
|
8
|
+
* 组件名称枚举
|
|
9
|
+
*/
|
|
10
|
+
type ComponentListEnum = Omit<keyof typeof window.VApp.$formcomponents, "symbol">;
|
|
11
|
+
|
|
12
|
+
interface ColumnWidth {
|
|
13
|
+
left: number;
|
|
14
|
+
center: number;
|
|
15
|
+
right: number;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
declare type T1 = number;
|
|
19
|
+
|
|
20
|
+
export interface UiState {
|
|
21
|
+
/**
|
|
22
|
+
* 编辑器各模块宽度
|
|
23
|
+
*/
|
|
24
|
+
columnWidth: ColumnWidth;
|
|
25
|
+
/**
|
|
26
|
+
* 弹窗宽度
|
|
27
|
+
*/
|
|
28
|
+
dialogWidth: number;
|
|
29
|
+
/**
|
|
30
|
+
* 编辑器缩放比例
|
|
31
|
+
*/
|
|
32
|
+
scale: number;
|
|
33
|
+
/**
|
|
34
|
+
* 编辑器是否全屏
|
|
35
|
+
*/
|
|
36
|
+
isFullscreen: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* 页面类型
|
|
39
|
+
*/
|
|
40
|
+
pageType: string;
|
|
41
|
+
/**
|
|
42
|
+
* 右侧配置菜单是否隐藏
|
|
43
|
+
*/
|
|
44
|
+
rightClose: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* 左侧表单列表模块是否隐藏
|
|
47
|
+
*/
|
|
48
|
+
leftClose: boolean;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface Controls {
|
|
52
|
+
uiControl: UiControl;
|
|
53
|
+
hisContrl: hisContrl;
|
|
54
|
+
formStore: formContrl;
|
|
55
|
+
actionContrl: ActionForm;
|
|
56
|
+
store: shortCut;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface setColumnWidth {
|
|
60
|
+
left?: number;
|
|
61
|
+
center?: number | "auto";
|
|
62
|
+
right?: number;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface GetColumnWidth {
|
|
66
|
+
left: number;
|
|
67
|
+
center: number;
|
|
68
|
+
right: number;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface HistoryState {
|
|
72
|
+
/**
|
|
73
|
+
* 存储的所有历史行为
|
|
74
|
+
*/
|
|
75
|
+
historyList: HistoryItem[];
|
|
76
|
+
/**
|
|
77
|
+
* 当前所在的历史行为
|
|
78
|
+
*/
|
|
79
|
+
index: number;
|
|
80
|
+
/**
|
|
81
|
+
* 是否正在执行后退或前进,是则阻止进入历史快走中
|
|
82
|
+
*/
|
|
83
|
+
historyFlag: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* 历史回退最大步数
|
|
86
|
+
*/
|
|
87
|
+
maxStep: number;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export interface ShortCutState {
|
|
91
|
+
form: FormState;
|
|
92
|
+
copyContent: AllFormItem | Record<string, any>;
|
|
93
|
+
curList: AllFormItem[];
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export interface HistoryItem {
|
|
97
|
+
allFormList: AllFormItem[];
|
|
98
|
+
currentIndex: number;
|
|
99
|
+
currentId: string;
|
|
100
|
+
curControl: AllFormItem | Record<string, any>;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export type MenuItem = "delete" | "undo" | "redo" | "tree" | "save" | "preview" | "fullscreen" | "viewport" | "json-export" | "json-import";
|
|
104
|
+
export type MenuRight = "viewport" | "json-export" | "json-import";
|
|
105
|
+
export type MenuBarData = {
|
|
106
|
+
left: MenuItem[];
|
|
107
|
+
right: MenuRight[];
|
|
108
|
+
column: boolean;
|
|
109
|
+
};
|
|
110
|
+
export interface FormState {
|
|
111
|
+
/**
|
|
112
|
+
* 存储所有选择的表单控件
|
|
113
|
+
*/
|
|
114
|
+
allFormList: AllFormItem[];
|
|
115
|
+
/**
|
|
116
|
+
* 选中的表单控件
|
|
117
|
+
*/
|
|
118
|
+
curControl: AllFormItem | Record<string, any>;
|
|
119
|
+
/**
|
|
120
|
+
* 选中的控件的id
|
|
121
|
+
*/
|
|
122
|
+
currentId: string;
|
|
123
|
+
/**
|
|
124
|
+
* 选中的控件的索引
|
|
125
|
+
*/
|
|
126
|
+
currentIndex: number;
|
|
127
|
+
/**
|
|
128
|
+
* 开启预览进行表单验证
|
|
129
|
+
*/
|
|
130
|
+
preview: boolean;
|
|
131
|
+
/**
|
|
132
|
+
* 预览是否展示
|
|
133
|
+
*/
|
|
134
|
+
previewShow: boolean;
|
|
135
|
+
/**
|
|
136
|
+
* 保存
|
|
137
|
+
*/
|
|
138
|
+
save: boolean;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* 下一次保存的时候判断表单是否变更了,而不用变更就改变save,但是我们监听了save会形成死循环
|
|
142
|
+
* 判断表单是否更新
|
|
143
|
+
*/
|
|
144
|
+
formUpdate: boolean;
|
|
145
|
+
/**
|
|
146
|
+
* 预览和存储到数据库最终结果
|
|
147
|
+
*/
|
|
148
|
+
AllFormResult: any[];
|
|
149
|
+
/**
|
|
150
|
+
* 用户在动态表单输入的配置结果
|
|
151
|
+
*/
|
|
152
|
+
formResult: Record<string, any>;
|
|
153
|
+
/**
|
|
154
|
+
* 表单全局配置
|
|
155
|
+
*/
|
|
156
|
+
globalDatas: Record<string, any>;
|
|
157
|
+
/**
|
|
158
|
+
* 全局表单配置列表
|
|
159
|
+
*/
|
|
160
|
+
globalFormList: BaseFormConfig[];
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
interface FormRule {
|
|
164
|
+
fieldName: any[];
|
|
165
|
+
label: any[];
|
|
166
|
+
}
|
|
167
|
+
export interface AllFormItem {
|
|
168
|
+
/**
|
|
169
|
+
* 组件渲染唯一标识
|
|
170
|
+
*/
|
|
171
|
+
ControlType: ComponentListEnum;
|
|
172
|
+
/**
|
|
173
|
+
* 表单配置所需的表单配置列表
|
|
174
|
+
*/
|
|
175
|
+
controlItems: FormConfig[];
|
|
176
|
+
/**
|
|
177
|
+
* 表单配置
|
|
178
|
+
*/
|
|
179
|
+
data: fields;
|
|
180
|
+
/**
|
|
181
|
+
* 获取配置列表和配置方法列表
|
|
182
|
+
*/
|
|
183
|
+
formConfig: {
|
|
184
|
+
data: () => fields;
|
|
185
|
+
morenConfig: () => FormConfig[];
|
|
186
|
+
};
|
|
187
|
+
/**
|
|
188
|
+
* 组件icon图标
|
|
189
|
+
*/
|
|
190
|
+
icon: string;
|
|
191
|
+
/**
|
|
192
|
+
* 组件唯一id
|
|
193
|
+
*/
|
|
194
|
+
id: string;
|
|
195
|
+
/**
|
|
196
|
+
* 组件名称
|
|
197
|
+
*/
|
|
198
|
+
nameCn: string;
|
|
199
|
+
/**
|
|
200
|
+
* 是否是布局表单
|
|
201
|
+
*/
|
|
202
|
+
layout: boolean;
|
|
203
|
+
/**
|
|
204
|
+
* 规则
|
|
205
|
+
*/
|
|
206
|
+
rules: FormRule;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
export interface BaseComponentItem {
|
|
210
|
+
/**
|
|
211
|
+
* 组件渲染唯一标识
|
|
212
|
+
*/
|
|
213
|
+
ControlType: ComponentListEnum;
|
|
214
|
+
/**
|
|
215
|
+
* 组件icon图标
|
|
216
|
+
*/
|
|
217
|
+
icon: string;
|
|
218
|
+
/**
|
|
219
|
+
* 组件名称
|
|
220
|
+
*/
|
|
221
|
+
nameCn: string;
|
|
222
|
+
/**
|
|
223
|
+
* 是否是布局表单
|
|
224
|
+
*/
|
|
225
|
+
layout: boolean;
|
|
226
|
+
/**
|
|
227
|
+
* 规则
|
|
228
|
+
*/
|
|
229
|
+
rules?: FormRule;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
export type RequiredKey<T, K extends keyof T> = Omit<T, K> & {
|
|
233
|
+
[P in K]-?: T[P];
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
export type PartialKey<T, K extends keyof T> = Omit<T, K> & {
|
|
237
|
+
[P in K]?: T[P];
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
export type BaseFormConfig = FormConfig;
|