File tree 8 files changed +347
-147
lines changed
8 files changed +347
-147
lines changed Original file line number Diff line number Diff line change 13
13
## Installation
14
14
### NPM
15
15
TODO
16
+
16
17
### Manual
17
18
TODO
18
19
@@ -35,13 +36,14 @@ npm run build
35
36
TODO
36
37
37
38
## TODO
38
- * [ ] Date picker with bootstrap-datepicker
39
+ * [x ] Date picker with bootstrap-datepicker
39
40
* [ ] Time picker
40
41
* [ ] Color picker with spectrum
41
42
* [ ] Image editor
42
43
* [ ] Better slider
43
44
* [ ] Groupable fields
44
45
* [ ] Validation handling with multiple models
46
+ * [ ] Bundle for vendor files
45
47
46
48
## License
47
49
vue-form-generator is available under the [ MIT license] ( https://tldrlegal.com/license/mit-license ) .
Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ module.exports = {
41
41
user . language = lang ;
42
42
user . status = faker . helpers . randomize ( [ true , false , true ] ) ;
43
43
user . created = faker . date . recent ( 30 ) . valueOf ( ) ;
44
+ user . dt = faker . date . recent ( 30 ) . valueOf ( ) ;
44
45
45
46
if ( user . type == "business" ) {
46
47
user . company = {
Original file line number Diff line number Diff line change 7
7
< link rel ="stylesheet " type ="text/css " href ="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/css/bootstrap.css ">
8
8
< link rel ="stylesheet " type ="text/css " href ="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.10.0/css/bootstrap-select.min.css ">
9
9
< link rel ="stylesheet " type ="text/css " href ="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-slider/7.0.2/css/bootstrap-slider.css ">
10
+ < link rel ="stylesheet " type ="text/css " href ="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.37/css/bootstrap-datetimepicker.css ">
10
11
11
12
< script type ="text/javascript " src ="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.3/jquery.js "> </ script >
13
+ < script type ="text/javascript " src ="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.13.0/moment.min.js "> </ script >
14
+
12
15
< script type ="text/javascript " src ="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/js/bootstrap.js "> </ script >
13
16
< script type ="text/javascript " src ="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.10.0/js/bootstrap-select.min.js "> </ script >
14
17
< script type ="text/javascript " src ="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-slider/7.0.2/bootstrap-slider.min.js "> </ script >
18
+ < script type ="text/javascript " src ="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.37/js/bootstrap-datetimepicker.min.js "> </ script >
15
19
< script type ="text/javascript " src ="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.3.0/lodash.min.js "> </ script >
16
20
</ head >
17
21
< body >
Original file line number Diff line number Diff line change @@ -143,7 +143,21 @@ module.exports = {
143
143
model . age = moment ( ) . year ( ) - moment ( newVal ) . year ( ) ;
144
144
}
145
145
146
- } ,
146
+ } ,
147
+
148
+ {
149
+ type : "dateTime" ,
150
+ label : "DT" ,
151
+ model : "dt" ,
152
+ multi : true ,
153
+ validator : [
154
+ validators . date
155
+ ] ,
156
+ dateTimePickerOptions : {
157
+ format : "YYYY-MM-DD HH:mm:ss"
158
+ }
159
+
160
+ } ,
147
161
{
148
162
type : "slider" ,
149
163
label : "Rank" ,
Load Diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change
1
+ <template lang="jade">
2
+ .input-group.date
3
+ input.form-control(type="text", v-model="value", :disabled="disabled")
4
+ span.input-group-addon
5
+ span.glyphicon.glyphicon-calendar
6
+ </template >
7
+
8
+ <script >
9
+ import abstractField from ' ./abstractField' ;
10
+ import moment from " moment" ;
11
+
12
+ let inputFormat = " YYYY-MM-DD HH:mm:ss" ;
13
+
14
+ export default {
15
+ mixins: [ abstractField ],
16
+
17
+ methods: {
18
+
19
+ formatValueToField (value ) {
20
+ if (value != null )
21
+ return moment (value, this .schema .format ).format (inputFormat);
22
+
23
+ return value;
24
+ },
25
+
26
+ formatValueToModel (value ) {
27
+ if (value != null ) {
28
+ let m = moment (value, inputFormat);
29
+ if (this .schema .format )
30
+ value = m .format (this .schema .format );
31
+ else
32
+ value = m .toDate ().valueOf ();
33
+ }
34
+
35
+ return value;
36
+ }
37
+
38
+ },
39
+
40
+ ready () {
41
+ if ($ .fn .datetimepicker )
42
+ $ (this .$el ).datetimepicker (this .schema .dateTimePickerOptions );
43
+ }
44
+ }
45
+ </script >
46
+
47
+
48
+ <style lang="sass" scoped>
49
+ input {
50
+ width : 100% ;
51
+ }
52
+ </style >
Original file line number Diff line number Diff line change @@ -22,44 +22,43 @@ var loaders = [
22
22
] ;
23
23
24
24
module . exports = [
25
-
26
- {
27
- entry : "./src/index" ,
28
- output : {
29
- path : "./dist" ,
30
- filename : "vue-form-generator.js" ,
31
- library : "VueFormGenerator" ,
32
- libraryTarget : "umd"
25
+ {
26
+ entry : "./src/index" ,
27
+ output : {
28
+ path : "./dist" ,
29
+ filename : "vue-form-generator.js" ,
30
+ library : "VueFormGenerator" ,
31
+ libraryTarget : "umd"
32
+ } ,
33
+ plugins : [
34
+ new webpack . BannerPlugin ( banner , {
35
+ raw : true
36
+ } ) ] ,
37
+ module : {
38
+ loaders : loaders
39
+ }
33
40
} ,
34
- plugins : [
35
- new webpack . BannerPlugin ( banner , {
36
- raw : true
37
- } ) ] ,
38
- module : {
39
- loaders : loaders
40
- }
41
- } ,
42
41
43
- {
44
- entry : "./src/index" ,
45
- output : {
46
- path : "./dist" ,
47
- filename : "vue-form-generator.min.js" ,
48
- library : "VueFormGenerator" ,
49
- libraryTarget : "umd"
50
- } ,
51
- plugins : [
52
- new webpack . optimize . UglifyJsPlugin ( {
53
- compress : {
54
- warnings : false
42
+ {
43
+ entry : "./src/index" ,
44
+ output : {
45
+ path : "./dist" ,
46
+ filename : "vue-form-generator.min.js" ,
47
+ library : "VueFormGenerator" ,
48
+ libraryTarget : "umd"
49
+ } ,
50
+ plugins : [
51
+ new webpack . optimize . UglifyJsPlugin ( {
52
+ compress : {
53
+ warnings : false
54
+ }
55
+ } ) ,
56
+ new webpack . BannerPlugin ( banner , {
57
+ raw : true
58
+ } ) ] ,
59
+ module : {
60
+ loaders : loaders
55
61
}
56
- } ) ,
57
- new webpack . BannerPlugin ( banner , {
58
- raw : true
59
- } ) ] ,
60
- module : {
61
- loaders : loaders
62
62
}
63
- }
64
63
65
64
] ;
You can’t perform that action at this time.
0 commit comments