11/**
2- * vue-formly-bootstrap v1.0.4
2+ * vue-formly-bootstrap v1.0.5
33 * https://github.com/matt-sanders/vue-formly-bootstrap
44 * Released under the MIT License.
55 */
@@ -123,22 +123,32 @@ return /******/ (function(modules) { // webpackBootstrap
123123 'use strict' ;
124124
125125 Object . defineProperty ( exports , "__esModule" , {
126- value : true
126+ value : true
127127 } ) ;
128128
129129 var _keys = __webpack_require__ ( 2 ) ;
130130
131131 var _keys2 = _interopRequireDefault ( _keys ) ;
132132
133133 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 ) {
136136
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+ } ) ;
142152 } ;
143153
144154 function _interopRequireDefault ( obj ) { return obj && obj . __esModule ? obj : { default : obj } ; }
@@ -662,7 +672,7 @@ return /******/ (function(modules) { // webpackBootstrap
662672 var hotAPI = require ( "vue-hot-reload-api" )
663673 hotAPI . install ( require ( "vue" ) , false )
664674 if ( ! hotAPI . compatible ) return
665- var id = "_v-6282284c /fieldInput.vue"
675+ var id = "_v-78aa6b2e /fieldInput.vue"
666676 if ( ! module . hot . data ) {
667677 hotAPI . createRecord ( id , module . exports )
668678 } else {
@@ -677,7 +687,7 @@ return /******/ (function(modules) { // webpackBootstrap
677687 'use strict' ;
678688
679689 Object . defineProperty ( exports , "__esModule" , {
680- value : true
690+ value : true
681691 } ) ;
682692
683693 var _baseField = __webpack_require__ ( 40 ) ;
@@ -687,16 +697,17 @@ return /******/ (function(modules) { // webpackBootstrap
687697 function _interopRequireDefault ( obj ) { return obj && obj . __esModule ? obj : { default : obj } ; }
688698
689699 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+ }
699709 }
710+ }
700711 } ;
701712
702713/***/ } ,
@@ -706,48 +717,51 @@ return /******/ (function(modules) { // webpackBootstrap
706717 'use strict' ;
707718
708719 Object . defineProperty ( exports , "__esModule" , {
709- value : true
720+ value : true
710721 } ) ;
711722 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 ) ;
716743 } ,
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 ) ;
743756 }
757+ }
744758 } ;
745759
746760/***/ } ,
747761/* 41 */
748762/***/ function ( module , exports ) {
749763
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" ;
751765
752766/***/ } ,
753767/* 42 */
@@ -769,7 +783,7 @@ return /******/ (function(modules) { // webpackBootstrap
769783 var hotAPI = require ( "vue-hot-reload-api" )
770784 hotAPI . install ( require ( "vue" ) , false )
771785 if ( ! hotAPI . compatible ) return
772- var id = "_v-584bcc0c /fieldList.vue"
786+ var id = "_v-487ea4ea /fieldList.vue"
773787 if ( ! module . hot . data ) {
774788 hotAPI . createRecord ( id , module . exports )
775789 } else {
@@ -796,16 +810,16 @@ return /******/ (function(modules) { // webpackBootstrap
796810 exports . default = {
797811 mixins : [ _baseField2 . default ] ,
798812 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 , [ ] ) ;
801815 }
802816 } ;
803817
804818/***/ } ,
805819/* 44 */
806820/***/ function ( module , exports ) {
807821
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" ;
809823
810824/***/ } ,
811825/* 45 */
@@ -827,7 +841,7 @@ return /******/ (function(modules) { // webpackBootstrap
827841 var hotAPI = require ( "vue-hot-reload-api" )
828842 hotAPI . install ( require ( "vue" ) , false )
829843 if ( ! hotAPI . compatible ) return
830- var id = "_v-3b0853ea /fieldSelect.vue"
844+ var id = "_v-2c2f2570 /fieldSelect.vue"
831845 if ( ! module . hot . data ) {
832846 hotAPI . createRecord ( id , module . exports )
833847 } else {
@@ -859,7 +873,7 @@ return /******/ (function(modules) { // webpackBootstrap
859873/* 47 */
860874/***/ function ( module , exports ) {
861875
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" ;
863877
864878/***/ } ,
865879/* 48 */
@@ -881,7 +895,7 @@ return /******/ (function(modules) { // webpackBootstrap
881895 var hotAPI = require ( "vue-hot-reload-api" )
882896 hotAPI . install ( require ( "vue" ) , false )
883897 if ( ! hotAPI . compatible ) return
884- var id = "_v-2f276cb0 /fieldTextarea.vue"
898+ var id = "_v-5fab8386 /fieldTextarea.vue"
885899 if ( ! module . hot . data ) {
886900 hotAPI . createRecord ( id , module . exports )
887901 } else {
@@ -895,7 +909,7 @@ return /******/ (function(modules) { // webpackBootstrap
895909/* 50 */
896910/***/ function ( module , exports ) {
897911
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" ;
899913
900914/***/ }
901915/******/ ] ) ) )
0 commit comments