1
1
/**
2
- * vue-formly-bootstrap v1.0.4
2
+ * vue-formly-bootstrap v1.0.5
3
3
* https://github.com/matt-sanders/vue-formly-bootstrap
4
4
* Released under the MIT License.
5
5
*/
@@ -123,22 +123,32 @@ return /******/ (function(modules) { // webpackBootstrap
123
123
'use strict' ;
124
124
125
125
Object . defineProperty ( exports , "__esModule" , {
126
- value : true
126
+ value : true
127
127
} ) ;
128
128
129
129
var _keys = __webpack_require__ ( 2 ) ;
130
130
131
131
var _keys2 = _interopRequireDefault ( _keys ) ;
132
132
133
133
exports . default = function ( Vue ) {
134
- Vue . directive ( 'formly-atts' , function ( value ) {
135
- var _this = this ;
134
+ Vue . directive ( 'formly-atts' , {
135
+ bind : function bind ( el , binding ) {
136
136
137
- if ( typeof value == 'undefined' ) return ;
138
- ( 0 , _keys2 . default ) ( value ) . forEach ( function ( key ) {
139
- _this . el . setAttribute ( key , value [ key ] ) ;
140
- } ) ;
141
- } ) ;
137
+ if ( ! binding . value ) return ;
138
+
139
+ ( 0 , _keys2 . default ) ( binding . value ) . forEach ( function ( key ) {
140
+ el . setAttribute ( key , binding . value [ key ] ) ;
141
+ } ) ;
142
+ }
143
+ } ) ;
144
+
145
+ Vue . directive ( 'formly-input-type' , {
146
+ bind : function bind ( el , binding ) {
147
+ if ( ! binding . value ) return ;
148
+
149
+ el . setAttribute ( 'type' , binding . value ) ;
150
+ }
151
+ } ) ;
142
152
} ;
143
153
144
154
function _interopRequireDefault ( obj ) { return obj && obj . __esModule ? obj : { default : obj } ; }
@@ -662,7 +672,7 @@ return /******/ (function(modules) { // webpackBootstrap
662
672
var hotAPI = require ( "vue-hot-reload-api" )
663
673
hotAPI . install ( require ( "vue" ) , false )
664
674
if ( ! hotAPI . compatible ) return
665
- var id = "_v-6282284c /fieldInput.vue"
675
+ var id = "_v-78aa6b2e /fieldInput.vue"
666
676
if ( ! module . hot . data ) {
667
677
hotAPI . createRecord ( id , module . exports )
668
678
} else {
@@ -677,7 +687,7 @@ return /******/ (function(modules) { // webpackBootstrap
677
687
'use strict' ;
678
688
679
689
Object . defineProperty ( exports , "__esModule" , {
680
- value : true
690
+ value : true
681
691
} ) ;
682
692
683
693
var _baseField = __webpack_require__ ( 40 ) ;
@@ -687,16 +697,17 @@ return /******/ (function(modules) { // webpackBootstrap
687
697
function _interopRequireDefault ( obj ) { return obj && obj . __esModule ? obj : { default : obj } ; }
688
698
689
699
exports . default = {
690
- mixins : [ _baseField2 . default ] ,
691
- methods : {
692
- onChange : function onChange ( e ) {
693
- this . $set ( 'form.' + this . key + '.$dirty' , true ) ;
694
- this . runFunction ( 'onChange ', e ) ;
695
- if ( this . form [ this . key ] . inputType == 'file' ) {
696
- this . $set ( 'form.' + this . key + '.files' , this . $el . querySelector ( 'input' ) . files ) ;
697
- }
698
- }
700
+ mixins : [ _baseField2 . default ] ,
701
+ methods : {
702
+ onChange : function onChange ( e ) {
703
+
704
+ this . $set ( this . form [ this . field . key ] , '$dirty ', true ) ;
705
+ this . runFunction ( 'onChange' , e ) ;
706
+ if ( this . to . type == 'file' ) {
707
+ this . $set ( this . model , this . field . key , this . $el . querySelector ( 'input' ) . files ) ;
708
+ }
699
709
}
710
+ }
700
711
} ;
701
712
702
713
/***/ } ,
@@ -706,48 +717,51 @@ return /******/ (function(modules) { // webpackBootstrap
706
717
'use strict' ;
707
718
708
719
Object . defineProperty ( exports , "__esModule" , {
709
- value : true
720
+ value : true
710
721
} ) ;
711
722
exports . default = {
712
- props : [ 'form' , 'key' ] ,
713
- created : function created ( ) {
714
- this . $set ( 'form.' + this . key + '.$dirty' , false ) ;
715
- this . $set ( 'form.' + this . key + '.$active' , false ) ;
723
+ props : [ 'form' , 'field' , 'model' , 'to' ] ,
724
+ created : function created ( ) {
725
+ var state = {
726
+ '$dirty' : false ,
727
+ '$active' : false
728
+ } ;
729
+ this . $set ( this . form , this . field . key , state ) ;
730
+ } ,
731
+ methods : {
732
+ runFunction : function runFunction ( action , e ) {
733
+ if ( typeof this . to [ action ] == 'function' ) this . to [ action ] . call ( this , e ) ;
734
+ } ,
735
+ onFocus : function onFocus ( e ) {
736
+ this . $set ( this . form [ this . field . key ] , '$active' , true ) ;
737
+ this . runFunction ( 'onFocus' , e ) ;
738
+ } ,
739
+ onBlur : function onBlur ( e ) {
740
+ this . $set ( this . form [ this . field . key ] , '$dirty' , true ) ;
741
+ this . $set ( this . form [ this . field . key ] , '$active' , false ) ;
742
+ this . runFunction ( 'onBlur' , e ) ;
716
743
} ,
717
- methods : {
718
- runFunction : function runFunction ( action , e ) {
719
- if ( typeof this . form [ this . key ] [ action ] == 'function' ) this . form [ this . key ] [ action ] . call ( this , e ) ;
720
- } ,
721
- onFocus : function onFocus ( e ) {
722
- this . $set ( 'form.' + this . key + '.$active' , true ) ;
723
- this . runFunction ( 'onFocus' , e ) ;
724
- } ,
725
- onBlur : function onBlur ( e ) {
726
- this . $set ( 'form.' + this . key + '.$dirty' , true ) ;
727
- this . $set ( 'form.' + this . key + '.$active' , false ) ;
728
- this . runFunction ( 'onBlur' , e ) ;
729
- } ,
730
- onClick : function onClick ( e ) {
731
- this . runFunction ( 'onClick' , e ) ;
732
- } ,
733
- onChange : function onChange ( e ) {
734
- this . $set ( 'form.' + this . key + '.$dirty' , true ) ;
735
- this . runFunction ( 'onChange' , e ) ;
736
- } ,
737
- onKeyup : function onKeyup ( e ) {
738
- this . runFunction ( 'onKeyup' , e ) ;
739
- } ,
740
- onKeydown : function onKeydown ( e ) {
741
- this . runFunction ( 'onKeydown' , e ) ;
742
- }
744
+ onClick : function onClick ( e ) {
745
+ this . runFunction ( 'onClick' , e ) ;
746
+ } ,
747
+ onChange : function onChange ( e ) {
748
+ this . $set ( this . form [ this . field . key ] , '$dirty' , true ) ;
749
+ this . runFunction ( 'onChange' , e ) ;
750
+ } ,
751
+ onKeyup : function onKeyup ( e ) {
752
+ this . runFunction ( 'onKeyup' , e ) ;
753
+ } ,
754
+ onKeydown : function onKeydown ( e ) {
755
+ this . runFunction ( 'onKeydown' , e ) ;
743
756
}
757
+ }
744
758
} ;
745
759
746
760
/***/ } ,
747
761
/* 41 */
748
762
/***/ function ( module , exports ) {
749
763
750
- module . exports = "\n<div class=\"form-group formly-input\" :class=\"[ form[key].inputType , {'formly-has-value': form[ key].value , 'formly-has-focus': form[key].$active}]\">\n <label v-if=\"form[key] .label\" :for=\"form[key] .id ? form[key] .id : null\">{{form[key] .label}}</label>\n <input class=\"form-control\" :class=\"form[key] .classes\" :id=\"form[key] .id ? form[key] .id : null\" : type=\"form[key].inputType || text\" v-model=\"form[ key].value \" @blur=\"onBlur\" @focus=\"onFocus\" @click=\"onClick\" @change=\"onChange\" @keyup=\"onKeyup\" @keydown=\"onKeydown\" v-formly-atts=\"form[key] .atts\">\n</div>\n" ;
764
+ module . exports = "\n<div class=\"form-group formly-input\" :class=\"[ to.type , {'formly-has-value': model[field. key], 'formly-has-focus': form[field. key].$active}]\">\n <label v-if=\"to .label\" :for=\"to .id ? to .id : null\">{{to .label}}</label>\n <input class=\"form-control\" :class=\"to .classes\" :id=\"to .id ? to .id : null\" type=\"text\" v-model=\"model[field. key]\" @blur=\"onBlur\" @focus=\"onFocus\" @click=\"onClick\" @change=\"onChange\" @keyup=\"onKeyup\" @keydown=\"onKeydown\" v-formly-atts=\"to .atts\" v-formly-input-type=\"to.type \">\n</div>\n" ;
751
765
752
766
/***/ } ,
753
767
/* 42 */
@@ -769,7 +783,7 @@ return /******/ (function(modules) { // webpackBootstrap
769
783
var hotAPI = require ( "vue-hot-reload-api" )
770
784
hotAPI . install ( require ( "vue" ) , false )
771
785
if ( ! hotAPI . compatible ) return
772
- var id = "_v-584bcc0c /fieldList.vue"
786
+ var id = "_v-487ea4ea /fieldList.vue"
773
787
if ( ! module . hot . data ) {
774
788
hotAPI . createRecord ( id , module . exports )
775
789
} else {
@@ -796,16 +810,16 @@ return /******/ (function(modules) { // webpackBootstrap
796
810
exports . default = {
797
811
mixins : [ _baseField2 . default ] ,
798
812
created : function created ( ) {
799
- var type = this . form [ this . key ] . inputType ;
800
- if ( ( ! type || type == 'checkbox' ) && this . form [ this . key ] . value == '' ) this . $set ( 'form.' + this . key + '.value' , [ ] ) ;
813
+ var type = this . to . type ;
814
+ if ( ( ! type || type == 'checkbox' ) && this . model [ this . field . key ] == '' ) this . $set ( this . model , this . field . key , [ ] ) ;
801
815
}
802
816
} ;
803
817
804
818
/***/ } ,
805
819
/* 44 */
806
820
/***/ function ( module , exports ) {
807
821
808
- module . exports = "\n<div class=\"checkbox\" :id=\"form[key] .id\" :class=\"form[key] .classes\">\n\n <label v-for=\"option in form[key] .options\">\n <input : type=\"form[key].inputType || ' checkbox' \" v-model=\"form[ key].value \" :value=\"option.value || option\" @blur=\"onBlur\" @focus=\"onFocus\" @click=\"onClick\" @change=\"onChange\" @keyup=\"onKeyup\" @keydown=\"onKeydown\" v-formly-atts=\"form[key] .atts\"> {{option.label || option}}\n </label>\n \n</div>\n" ;
822
+ module . exports = "\n<div class=\"checkbox formly-list \" :id=\"to .id\" :class=\"to .classes\">\n\n <label v-for=\"option in field .options\">\n <input type=\"checkbox\" v-model=\"model[field. key]\" :value=\"option.value || option\" @blur=\"onBlur\" @focus=\"onFocus\" @click=\"onClick\" @change=\"onChange\" @keyup=\"onKeyup\" @keydown=\"onKeydown\" v-formly-atts=\"to .atts\" v-formly-input-type=\"to.type \"> {{option.label || option}}\n </label>\n \n</div>\n" ;
809
823
810
824
/***/ } ,
811
825
/* 45 */
@@ -827,7 +841,7 @@ return /******/ (function(modules) { // webpackBootstrap
827
841
var hotAPI = require ( "vue-hot-reload-api" )
828
842
hotAPI . install ( require ( "vue" ) , false )
829
843
if ( ! hotAPI . compatible ) return
830
- var id = "_v-3b0853ea /fieldSelect.vue"
844
+ var id = "_v-2c2f2570 /fieldSelect.vue"
831
845
if ( ! module . hot . data ) {
832
846
hotAPI . createRecord ( id , module . exports )
833
847
} else {
@@ -859,7 +873,7 @@ return /******/ (function(modules) { // webpackBootstrap
859
873
/* 47 */
860
874
/***/ function ( module , exports ) {
861
875
862
- module . exports = "\n<div class=\"form-group\">\n <label v-if=\"form[key] .label\" :for=\"form[key] .id ? form[key] .id : null\">{{form[key] .label}}</label>\n <select class=\"form-control\" :class=\"form[key] .classes\" :id=\"form[key] .id ? form[key] .id : null\" v-model=\"form[ key].value \" @blur=\"onBlur\" @focus=\"onFocus\" @click=\"onClick\" @change=\"onChange\" @keyup=\"onKeyup\" @keydown=\"onKeydown\" v-formly-atts=\"form[key] .atts\">\n <option v-for=\"option in form[key] .options\" :value=\"option.value || option\">{{option.label || option}}</option>\n </select>\n</div>\n" ;
876
+ module . exports = "\n<div class=\"form-group formly-select \">\n <label v-if=\"to .label\" :for=\"to .id ? to .id : null\">{{to .label}}</label>\n <select class=\"form-control\" :class=\"to .classes\" :id=\"to .id ? to .id : null\" v-model=\"model[field. key]\" @blur=\"onBlur\" @focus=\"onFocus\" @click=\"onClick\" @change=\"onChange\" @keyup=\"onKeyup\" @keydown=\"onKeydown\" v-formly-atts=\"to .atts\">\n <option v-for=\"option in field .options\" :value=\"option.value || option\">{{option.label || option}}</option>\n </select>\n</div>\n" ;
863
877
864
878
/***/ } ,
865
879
/* 48 */
@@ -881,7 +895,7 @@ return /******/ (function(modules) { // webpackBootstrap
881
895
var hotAPI = require ( "vue-hot-reload-api" )
882
896
hotAPI . install ( require ( "vue" ) , false )
883
897
if ( ! hotAPI . compatible ) return
884
- var id = "_v-2f276cb0 /fieldTextarea.vue"
898
+ var id = "_v-5fab8386 /fieldTextarea.vue"
885
899
if ( ! module . hot . data ) {
886
900
hotAPI . createRecord ( id , module . exports )
887
901
} else {
@@ -895,7 +909,7 @@ return /******/ (function(modules) { // webpackBootstrap
895
909
/* 50 */
896
910
/***/ function ( module , exports ) {
897
911
898
- module . exports = "\n<div class=\"form-group\">\n <label v-if=\"form[key] .label\" :for=\"form[key] .id ? form[key] .id : null\">{{form[key] .label}}</label>\n <textarea class=\"form-control\" :class=\"form[key] .classes\" :id=\"form[key] .id ? form[key] .id : null\" v-model=\"form[ key].value \" @blur=\"onBlur\" @focus=\"onFocus\" @click=\"onClick\" @change=\"onChange\" @keyup=\"onKeyup\" @keydown=\"onKeydown\" v-formly-atts=\"form[key] .atts\"></textarea>\n</div>\n" ;
912
+ module . exports = "\n<div class=\"form-group formly-textarea \">\n <label v-if=\"to .label\" :for=\"to .id ? to .id : null\">{{to .label}}</label>\n <textarea class=\"form-control\" :class=\"to .classes\" :id=\"to .id ? to .id : null\" v-model=\"model[field. key]\" @blur=\"onBlur\" @focus=\"onFocus\" @click=\"onClick\" @change=\"onChange\" @keyup=\"onKeyup\" @keydown=\"onKeydown\" v-formly-atts=\"to .atts\"></textarea>\n</div>\n" ;
899
913
900
914
/***/ }
901
915
/******/ ] ) ) )
0 commit comments