forked from formio/ngFormBuilder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
355 lines (346 loc) · 13 KB
/
index.html
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
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
<!doctype html>
<html class="no-js">
<head>
<meta charset="utf-8">
<title>Form.io Form Builder</title>
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="https://cdn.rawgit.com/odra/ng-json-explorer/master/dist/angular-json-explorer.min.css">
<link rel="stylesheet" href="https://unpkg.com/[email protected]/yeti/bootstrap.min.css" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" />
<link rel="stylesheet" href="dist/ngFormBuilder-full.css" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" />
</head>
<body ng-app="formBuilder">
<!-- BROWSE HAPPY BEGINS HERE -->
<style>
.browsehappy {
display:block;
width:100%;
height:100px;
background-color:#f2dede;
margin: 0 0 10px;
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
font-size: 22px;
line-height: 1.4;
color: #333;
padding-top: 15px;
vertical-align:middle;
}
.browsehappy span {
vertical-align:middle;
margin:20px 20px 20px 20px;
background:url("https://cdn.rawgit.com/alrra/browser-logos/master/internet-explorer/internet-explorer_64x64.png") no-repeat;
height:64px;
width:64px;
display:inline-block;
}
.formbuilder {
height: 600px;
}
.formcomponents {
width: 30%;
}
.formarea {
width: 70%;
}
.component-settings .nav-link {
font-size: 0.6em;
}
.jsonviewer {
max-height: 600px;
overflow: scroll;
}
.form-type-select {
display: inline-block;
width: 100px;
height: 28px;
vertical-align: top;
}
</style>
<!--[if IE 6]><p class="browsehappy"><img />You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p><![endif]-->
<!--[if IE 7]><p class="browsehappy"><img src="https://cdn.rawgit.com/alrra/browser-logos/master/internet-explorer/internet-explorer_64x64.png" />You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p><![endif]-->
<!--[if IE 8]><p class="browsehappy"><img src="https://cdn.rawgit.com/alrra/browser-logos/master/internet-explorer/internet-explorer_64x64.png" />You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p><![endif]-->
<!--[if IE 9]><p class="browsehappy"><img src="https://cdn.rawgit.com/alrra/browser-logos/master/internet-explorer/internet-explorer_64x64.png" />You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p><![endif]-->
<!-- BROWSE HAPPY ENDS HERE -->
<div class="jumbotron">
<div class="container text-center">
<p><img src="http://code-maven.com/img/angularjs.png" /></p>
<h1>Form <a href="https://github.com/formio/ngFormBuilder" target="_blank">Builder</a> & <a href="https://github.com/formio/ngFormio" target="_blank">Renderer</a></h1>
<p><strong>Open Source</strong> by <a target="_blank" href="https://form.io"><img src="https://help.form.io/assets/formio-logo.png" /></a></p>
</div>
</div>
<div class="page-content" ng-app="formioApp">
<div class="container-fluid">
<div>
<div class="row">
<div class="col-sm-8">
<h3 class="text-center text-muted">The <a href="https://github.com/formio/ngFormBuilder" target="_blank">Form Builder</a> allows you to build a <select class="form-control form-type-select" ng-model="form.display" ng-options="display.name as display.title for display in displays"></select></h3>
<pre class="text-center bg-info"><h4><code><form-builder form="form"></form-builder></code></h4></pre>
<div class="well" style="background-color: #fdfdfd;">
<form-builder form="form"></form-builder>
</div>
</div>
<div class="col-sm-4">
<h3 class="text-center text-muted">as JSON Schema</h3>
<pre class="bg-info"><h4><code>$rootScope.form = </code></h4></pre>
<div class="well jsonviewer">
<json-explorer data="form" collapsed="jsonCollapsed"></json-explorer>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-8 col-sm-offset-2">
<h3 class="text-center text-muted">which <a href="https://github.com/formio/ngFormio" target="_blank">Renders as a Form</a> in your Application</h3>
<pre class="text-center bg-info"><h4><code><formio form="form"></formio></code></h4></pre>
<div class="well">
<formio form="form" ng-if="renderForm"></formio>
</div>
</div>
<div class="clearfix"></div>
</div>
<div class="row">
<div class="col-sm-10 col-sm-offset-1 text-center">
<h3 class="text-center text-muted">which connects to our API Platform</h3>
<p>hosted or on-premise</p>
<a href="https://form.io" target="_blank"><img style="width:100%" src="https://raw.githubusercontent.com/formio/help.form.io/gh-pages/assets/img/formioapi2.png" /></a>
</div>
</div>
<div class="row" style="margin-top: 40px;">
<div class="col-sm-12 text-center">
<a href="https://form.io" target="_blank" class="btn btn-lg btn-success">Get Started</a>
</div>
</div>
<div class="row well" style="margin-top: 50px;">
<div class="container">
<div class="row">
<div class="col-lg-12 text-center">
<h2 class="section-heading">We are Open Source!</h2>
<h3 class="section-subheading text-muted">We are proud to offer our core Form & API platform as Open Source.</h3>
<h3 class="section-subheading text-muted">Find us on GitHub @ <a href="https://github.com/formio/formio" target="_blank">https://github.com/formio/formio</a></h3>
</div>
</div>
<div class="row">
<div class="col-md-4"><a href="https://github.com/formio/formio" target="_blank"><img class="img-responsive" src="https://form.io/assets/images/github-logo.png"></a></div>
<div class="col-md-8">
<p>Getting started is as easy as...</p>
<pre style="background-color: white;">git clone https://github.com/formio/formio.git
cd formio
npm install
node server</pre>
</div>
</div>
</div>
</div>
</div>
</div>
<a href="https://github.com/formio/formio" target="_blank"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/e7bbb0521b397edbd5fe43e7f760759336b5e05f/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f677265656e5f3030373230302e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_green_007200.png"></a>
</div>
<script src="https://cdn.ckeditor.com/4.5.11/standard/ckeditor.js"></script>
<script src="https://unpkg.com/[email protected]/signature_pad.min.js"></script>
<script src="dist/ngFormBuilder-full.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.4/lodash.min.js"></script>
<script src="https://cdn.rawgit.com/odra/ng-json-explorer/master/dist/angular-json-explorer.min.js"></script>
<script type="text/javascript">
angular
.module("formBuilder", ["ui.bootstrap", "ui.select", "formio", "ngFormBuilder", "ngJsonExplorer"])
.run([
"$rootScope",
'formioComponents',
'$timeout',
function(
$rootScope,
formioComponents,
$timeout
) {
$rootScope.displays = [{
name: 'form',
title: 'Form'
}, {
name: 'wizard',
title: 'Wizard'
}];
$rootScope.form = {
components: [{
input: true,
tableView: true,
inputType: 'text',
inputMask: '',
label: 'First Name',
key: 'firstName',
placeholder: 'Enter your first name',
prefix: '',
suffix: '',
multiple: false,
defaultValue: '',
protected: false,
unique: false,
persistent: true,
validate: {
required: false,
minLength: '',
maxLength: '',
pattern: '',
custom: '',
customPrivate: false
},
conditional: {
show: false,
when: null,
eq: ''
},
type: 'textfield'
}, {
input: true,
tableView: true,
inputType: 'text',
inputMask: '',
label: 'Last Name',
key: 'lastName',
placeholder: 'Enter your last name',
prefix: '',
suffix: '',
multiple: false,
defaultValue: '',
protected: false,
unique: false,
persistent: true,
validate: {
required: false,
minLength: '',
maxLength: '',
pattern: '',
custom: '',
customPrivate: false
},
conditional: {
show: false,
when: null,
eq: ''
},
type: 'textfield'
}, {
type: 'select',
validate: {
required: false
},
clearOnHide: true,
persistent: true,
unique: false,
protected: false,
multiple: true,
template: '<span>{{ item.label }}</span>',
authenticate: false,
filter: '',
refreshOn: '',
defaultValue: '',
valueProperty: '',
dataSrc: 'values',
data: {
custom: '',
resource: '',
url: '',
json: '',
values: [
{
label: 'Raindrops on roses',
value: 'raindropsOnRoses'
},
{
label: 'Whiskers on Kittens',
value: 'whiskersOnKittens'
},
{
label: 'Bright copper kettles',
value: 'brightCopperKettles'
},
{
label: 'Warm woolen Mittens',
value: 'warmWoolenMittens'
},
[
]
]
},
placeholder: 'Select a few',
key: 'favoriteThings',
label: 'Favorite Things',
tableView: true,
input: true
}, {
input: true,
tableView: true,
label: 'Message',
key: 'message',
placeholder: 'What do you think?',
prefix: '',
suffix: '',
rows: 3,
multiple: false,
defaultValue: '',
protected: false,
persistent: true,
validate: {
required: false,
minLength: '',
maxLength: '',
pattern: '',
custom: ''
},
type: 'textarea',
conditional: {
show: false,
when: null,
eq: ''
}
}, {
type: 'button',
theme: 'primary',
disableOnInvalid: true,
action: 'submit',
block: false,
rightIcon: '',
leftIcon: '',
size: 'md',
key: 'submit',
tableView: false,
label: 'Submit',
input: true
}],
display: 'form'
};
$rootScope.renderForm = true;
$rootScope.$on('formUpdate', function(event, form) {
angular.merge($rootScope.form, form);
$rootScope.renderForm = false;
setTimeout(function() {
$rootScope.renderForm = true;
}, 10);
});
var originalComps = _.cloneDeep($rootScope.form.components);
originalComps.push(angular.copy(formioComponents.components.button.settings));
$rootScope.jsonCollapsed = true;
$timeout(function() {
$rootScope.jsonCollapsed = false;
}, 200);
var currentDisplay = 'form';
$rootScope.$watch('form.display', function(display) {
if (display && (display !== currentDisplay)) {
currentDisplay = display;
if (display === 'form') {
$rootScope.form.components = originalComps;
} else {
$rootScope.form.components = [{
type: 'panel',
input: false,
title: 'Page 1',
theme: 'default',
components: originalComps
}];
}
}
});
}
]);
</script>
</body>
</html>