dragPage.ejs
7.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
<!DOCTYPE html>
<html><head>
<meta charset="utf-8">
<meta content="" name="keywords">
<meta content="" name="description">
<meta content="" name="apple-mobile-web-app-title">
<meta content="no-cache" http-equiv="Cache-Control">
<meta content="telephone=no" name="format-detection">
<meta content="email=no" name="format-detection">
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
<title>—— dragPage</title>
<link href="/imgs/favicon.ico" rel="shortcut icon">
<script src="/js/libs/jquery.js"></script>
<% include ../chatUtils.ejs %>
<script src="/js/app/formeditor.js"></script>
<style>
.parent {
background-color: rgba(255, 255, 255, 0.2);
margin: 50px 0;
padding: 20px;
}
input {
border: none;
outline: none;
background-color: #ecf0f1;
padding: 10px;
color: #942A57;
border: 0;
margin: 5px 0;
display: block;
width: 100%;
}
/* dragula-specific example page styles */
.wrapper {
display: table;
}
.container {
display: table-cell;
background-color: rgba(255, 255, 255, 0.2);
width: 50%;
}
.container:nth-child(odd) {
background-color: rgba(0, 0, 0, 0.2);
}
/*
* note that styling gu-mirror directly is a bad practice because it's too generic.
* you're better off giving the draggable elements a unique class and styling that directly!
*/
.container > div,
.gu-mirror {
margin: 10px;
padding: 10px;
background-color: rgba(0, 0, 0, 0.2);
transition: opacity 0.4s ease-in-out;
}
.container > div {
cursor: move;
cursor: grab;
cursor: -moz-grab;
cursor: -webkit-grab;
}
.gu-mirror {
cursor: grabbing;
cursor: -moz-grabbing;
cursor: -webkit-grabbing;
}
.container .ex-moved {
background-color: #e74c3c;
}
.container.ex-over {
background-color: rgba(255, 255, 255, 0.3);
}
#left-lovehandles > div,
#right-lovehandles > div {
cursor: initial;
}
.handle {
padding: 0 5px;
margin-right: 5px;
background-color: rgba(0, 0, 0, 0.4);
cursor: move;
}
.image-thing {
margin: 20px 0;
display: block;
text-align: center;
}
</style>
</head>
<body class="">
<div class="form-tools-wrap">
<div class="form-tools form-tools-row" id='left-defaults' >
<div class="fields-wrap">
<i class="tool-icon singleline"></i>
<div class="tool-title">单行</div>
<div class="field-target"></div>
</div>
<div class="fields-wrap">
<i class="tool-icon email"></i>
<div class="tool-title">电子邮件</div>
<div class="field-target"></div>
</div>
<div class="fields-wrap">
<i class="tool-icon number"></i>
<div class="tool-title">数字</div>
<div class="field-target"></div>
</div>
<div class="fields-wrap">
<i class="tool-icon currency"></i>
<div class="tool-title">货币</div>
<div class="field-target"></div>
</div>
<div class="fields-wrap">
<i class="tool-icon dropdown"></i>
<div class="tool-title">下拉</div>
<div class="field-target"></div>
</div>
<div class="fields-wrap">
<i class="tool-icon date"></i>
<div class="tool-title">日期</div>
<div class="field-target"></div>
</div>
<div class="fields-wrap">
<i class="tool-icon image"></i>
<div class="tool-title">图片</div>
<div class="field-target"></div>
</div>
<div class="fields-wrap">
<i class="tool-icon dcheckbox"></i>
<div class="tool-title">复选框</div>
<div class="field-target"></div>
</div>
<div class="fields-wrap">
<i class="tool-icon country"></i>
<div class="tool-title">国家</div>
<div class="field-target"></div>
</div>
<div class="fields-wrap">
<i class="tool-icon gender"></i>
<div class="tool-title">性别</div>
<div class="field-target"></div>
</div>
<div class="fields-wrap">
<i class="tool-icon lookup"></i>
<div class="tool-title">查找</div>
<div class="field-target"></div>
</div>
<div class="fields-wrap">
<i class="tool-icon multiline"></i>
<div class="tool-title">多行</div>
<div class="field-target"></div>
</div>
<div class="fields-wrap">
<i class="tool-icon url"></i>
<div class="tool-title">Url</div>
<div class="field-target"></div>
</div>
<div class="fields-wrap">
<i class="tool-icon decimal"></i>
<div class="tool-title">小数</div>
<div class="field-target"></div>
</div>
<div class="fields-wrap">
<i class="tool-icon radiobutton"></i>
<div class="tool-title">单选按钮</div>
<div class="field-target"></div>
</div>
<div class="fields-wrap">
<i class="tool-icon datetime"></i>
<div class="tool-title">日期-时间</div>
<div class="field-target"></div>
</div>
<div class="fields-wrap">
<i class="tool-icon upload"></i>
<div class="tool-title">文件上传</div>
<div class="field-target"></div>
</div>
<div class="fields-wrap">
<i class="tool-icon addnotes"></i>
<div class="tool-title">添加备注</div>
<div class="field-target"></div>
</div>
<div class="fields-wrap">
<i class="tool-icon bloodgroup"></i>
<div class="tool-title">血型</div>
<div class="field-target"></div>
</div>
<div class="fields-wrap">
<i class="tool-icon phone"></i>
<div class="tool-title">电话</div>
<div class="field-target"></div>
</div>
<div class="fields-wrap">
<i class="tool-icon formula"></i>
<div class="tool-title">公式</div>
<div class="field-target"></div>
</div>
</div>
<div class="add-section-btn">
<a class="add-form-section">添加表单单元</a>
<a class="add-form-table-section">添加表格单元</a>
</div>
</div>
<div class='parent'>
<div class='wrapper'>
<div id='right-defaults' class='container'>
<div class="left">There's also the possibility of moving elements around in the same container, changing their position</div>
<div class="right">This is the default use case. You only need to specify the containers you want to use</div>
<div>More interactive use cases lie ahead</div>
<div>Moving <code><input/></code> elements works just fine. You can still focus them, too. <input placeholder='See?' /></div>
<div>Make sure to check out the <a href='#'>documentation on GitHub!</a></div>
</div>
</div>
</div>
<script>
// console.log($('#left-defaults')[0]);
// console.log($('#right-defaults')[0]);
// dragula([$('#left-defaults')[0], $('#right-defaults')[0]],{
// copy: function (el, source) { //console.log(source === $('#left-defaults')[0]);
// return source === $('#left-defaults')[0];
// },
// accepts: function (el, target) { //console.log(target !== $('#left-defaults')[0]);
// return target !== $('#left-defaults')[0];
// }
// }).on('drag', function (el) {
// el.className = el.className.replace('ex-moved', '');
// }).on('drop', function (el) {
// el.className += ' ex-moved';
// }).on('over', function (el, container) {
// container.className += ' ex-over';
// }).on('out', function (el, container) {
// container.className = container.className.replace('ex-over', '');
// });
var formEditor= new HRFormEditor({
toolsWrapId:'#left-defaults',
targetWrapId:'#right-defaults',
});
formEditor.init();
</script>
</body>
</html>