1
1
/**
2
- * vue-formly-bootstrap v2.0.2
2
+ * vue-formly-bootstrap v2.2.0
3
3
* https://github.com/matt-sanders/vue-formly-bootstrap
4
4
* Released under the MIT License.
5
5
*/
@@ -634,9 +634,9 @@ return /******/ (function(modules) { // webpackBootstrap
634
634
635
635
var map = {
636
636
"./fieldInput.vue" : 38 ,
637
- "./fieldList.vue" : 42 ,
638
- "./fieldSelect.vue" : 45 ,
639
- "./fieldTextarea.vue" : 48
637
+ "./fieldList.vue" : 45 ,
638
+ "./fieldSelect.vue" : 48 ,
639
+ "./fieldTextarea.vue" : 51
640
640
} ;
641
641
function webpackContext ( req ) {
642
642
return __webpack_require__ ( webpackContextResolve ( req ) ) ;
@@ -662,7 +662,7 @@ return /******/ (function(modules) { // webpackBootstrap
662
662
__vue_script__ . __esModule &&
663
663
Object . keys ( __vue_script__ ) . length > 1 ) {
664
664
console . warn ( "[vue-loader] src/fields/fieldInput.vue: named exports in *.vue files are ignored." ) }
665
- __vue_template__ = __webpack_require__ ( 41 )
665
+ __vue_template__ = __webpack_require__ ( 44 )
666
666
module . exports = __vue_script__ || { }
667
667
if ( module . exports . __esModule ) module . exports = module . exports . default
668
668
if ( __vue_template__ ) {
@@ -712,19 +712,31 @@ return /******/ (function(modules) { // webpackBootstrap
712
712
713
713
/***/ } ,
714
714
/* 40 */
715
- /***/ function ( module , exports ) {
715
+ /***/ function ( module , exports , __webpack_require__ ) {
716
716
717
717
'use strict' ;
718
718
719
719
Object . defineProperty ( exports , "__esModule" , {
720
720
value : true
721
721
} ) ;
722
+
723
+ var _keys = __webpack_require__ ( 2 ) ;
724
+
725
+ var _keys2 = _interopRequireDefault ( _keys ) ;
726
+
727
+ var _errorDisplay = __webpack_require__ ( 41 ) ;
728
+
729
+ var _errorDisplay2 = _interopRequireDefault ( _errorDisplay ) ;
730
+
731
+ function _interopRequireDefault ( obj ) { return obj && obj . __esModule ? obj : { default : obj } ; }
732
+
722
733
exports . default = {
723
734
props : [ 'form' , 'field' , 'model' , 'to' ] ,
724
735
created : function created ( ) {
725
736
var state = {
726
737
'$dirty' : false ,
727
- '$active' : false
738
+ '$active' : false ,
739
+ '$hasError' : false
728
740
} ;
729
741
this . $set ( this . form , this . field . key , state ) ;
730
742
} ,
@@ -754,26 +766,111 @@ return /******/ (function(modules) { // webpackBootstrap
754
766
onKeydown : function onKeydown ( e ) {
755
767
this . runFunction ( 'onKeydown' , e ) ;
756
768
}
769
+ } ,
770
+ computed : {
771
+ hasError : function hasError ( ) {
772
+ if ( this . form [ this . field . key ] . $dirty == false || this . form [ this . field . key ] . $active == true ) {
773
+ return false ;
774
+ }
775
+ var errors = this . form . $errors [ this . field . key ] ;
776
+ var hasErrors = false ;
777
+ ( 0 , _keys2 . default ) ( errors ) . forEach ( function ( err ) {
778
+ if ( errors [ err ] !== false ) hasErrors = true ;
779
+ } ) ;
780
+ this . $set ( this . form [ this . field . key ] , '$hasError' , hasErrors ) ;
781
+ return hasErrors ;
782
+ }
783
+ } ,
784
+ components : {
785
+ 'error-display' : _errorDisplay2 . default
757
786
}
758
787
} ;
759
788
760
789
/***/ } ,
761
790
/* 41 */
762
- /***/ function ( module , exports ) {
791
+ /***/ function ( module , exports , __webpack_require__ ) {
763
792
764
- module . exports = "\n<div class=\"form-group formly-input\" :class=\"[ to.inputType, {'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.inputType\">\n</div>\n" ;
793
+ var __vue_script__ , __vue_template__
794
+ __vue_script__ = __webpack_require__ ( 42 )
795
+ if ( __vue_script__ &&
796
+ __vue_script__ . __esModule &&
797
+ Object . keys ( __vue_script__ ) . length > 1 ) {
798
+ console . warn ( "[vue-loader] src/components/errorDisplay.vue: named exports in *.vue files are ignored." ) }
799
+ __vue_template__ = __webpack_require__ ( 43 )
800
+ module . exports = __vue_script__ || { }
801
+ if ( module . exports . __esModule ) module . exports = module . exports . default
802
+ if ( __vue_template__ ) {
803
+ ( typeof module . exports === "function" ? ( module . exports . options || ( module . exports . options = { } ) ) : module . exports ) . template = __vue_template__
804
+ }
805
+ if ( false ) { ( function ( ) { module . hot . accept ( )
806
+ var hotAPI = require ( "vue-hot-reload-api" )
807
+ hotAPI . install ( require ( "vue" ) , false )
808
+ if ( ! hotAPI . compatible ) return
809
+ var id = "_v-54a3409b/errorDisplay.vue"
810
+ if ( ! module . hot . data ) {
811
+ hotAPI . createRecord ( id , module . exports )
812
+ } else {
813
+ hotAPI . update ( id , module . exports , __vue_template__ )
814
+ }
815
+ } ) ( ) }
765
816
766
817
/***/ } ,
767
818
/* 42 */
819
+ /***/ function ( module , exports , __webpack_require__ ) {
820
+
821
+ 'use strict' ;
822
+
823
+ Object . defineProperty ( exports , "__esModule" , {
824
+ value : true
825
+ } ) ;
826
+
827
+ var _keys = __webpack_require__ ( 2 ) ;
828
+
829
+ var _keys2 = _interopRequireDefault ( _keys ) ;
830
+
831
+ function _interopRequireDefault ( obj ) { return obj && obj . __esModule ? obj : { default : obj } ; }
832
+
833
+ exports . default = {
834
+ props : [ 'field' , 'form' ] ,
835
+ computed : {
836
+ message : function message ( ) {
837
+ var message = false ;
838
+ if ( ! ( this . field in this . form . $errors ) || ! ( this . field in this . form ) || this . form [ this . field ] . $active || ! this . form [ this . field ] . $dirty ) return message ;
839
+ var errors = this . form . $errors [ this . field ] ;
840
+ ( 0 , _keys2 . default ) ( errors ) . some ( function ( errorKey ) {
841
+ if ( typeof errors [ errorKey ] != 'boolean' ) {
842
+ message = errors [ errorKey ] ;
843
+ return true ;
844
+ }
845
+ } ) ;
846
+ return message ;
847
+ }
848
+ }
849
+ } ;
850
+
851
+ /***/ } ,
852
+ /* 43 */
853
+ /***/ function ( module , exports ) {
854
+
855
+ module . exports = "\n<span v-if=\"message\" class=\"help-block\">{{message}}</span>\n" ;
856
+
857
+ /***/ } ,
858
+ /* 44 */
859
+ /***/ function ( module , exports ) {
860
+
861
+ module . exports = "\n<div class=\"form-group formly-input\" :class=\"[ to.inputType, {'formly-has-value': model[field.key], 'formly-has-focus': form[field.key].$active, 'has-error': hasError}]\">\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.inputType\">\n <error-display :form=\"form\" :field=\"field.key\"></error-display>\n</div>\n" ;
862
+
863
+ /***/ } ,
864
+ /* 45 */
768
865
/***/ function ( module , exports , __webpack_require__ ) {
769
866
770
867
var __vue_script__ , __vue_template__
771
- __vue_script__ = __webpack_require__ ( 43 )
868
+ __vue_script__ = __webpack_require__ ( 46 )
772
869
if ( __vue_script__ &&
773
870
__vue_script__ . __esModule &&
774
871
Object . keys ( __vue_script__ ) . length > 1 ) {
775
872
console . warn ( "[vue-loader] src/fields/fieldList.vue: named exports in *.vue files are ignored." ) }
776
- __vue_template__ = __webpack_require__ ( 44 )
873
+ __vue_template__ = __webpack_require__ ( 47 )
777
874
module . exports = __vue_script__ || { }
778
875
if ( module . exports . __esModule ) module . exports = module . exports . default
779
876
if ( __vue_template__ ) {
@@ -792,7 +889,7 @@ return /******/ (function(modules) { // webpackBootstrap
792
889
} ) ( ) }
793
890
794
891
/***/ } ,
795
- /* 43 */
892
+ /* 46 */
796
893
/***/ function ( module , exports , __webpack_require__ ) {
797
894
798
895
'use strict' ;
@@ -816,22 +913,22 @@ return /******/ (function(modules) { // webpackBootstrap
816
913
} ;
817
914
818
915
/***/ } ,
819
- /* 44 */
916
+ /* 47 */
820
917
/***/ function ( module , exports ) {
821
918
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 v-if=\"!to.inputType || to.inputType == 'checkbox'\" 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\">\n <input v-if=\"to.inputType == 'radio'\" type=\"radio\" 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\">\n {{option.label || option}}\n </label>\n \n</div>\n" ;
919
+ module . exports = "\n<div class=\"checkbox formly-list\" :id=\"to.id\" :class=\"[ to.classes, {'has-error': hasError}] \">\n\n <label v-for=\"option in field.options\">\n <input v-if=\"!to.inputType || to.inputType == 'checkbox'\" 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\">\n <input v-if=\"to.inputType == 'radio'\" type=\"radio\" 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\">\n {{option.label || option}}\n </label>\n <error-display :form=\"form\" :field=\"field.key\"></error-display> \n</div>\n" ;
823
920
824
921
/***/ } ,
825
- /* 45 */
922
+ /* 48 */
826
923
/***/ function ( module , exports , __webpack_require__ ) {
827
924
828
925
var __vue_script__ , __vue_template__
829
- __vue_script__ = __webpack_require__ ( 46 )
926
+ __vue_script__ = __webpack_require__ ( 49 )
830
927
if ( __vue_script__ &&
831
928
__vue_script__ . __esModule &&
832
929
Object . keys ( __vue_script__ ) . length > 1 ) {
833
930
console . warn ( "[vue-loader] src/fields/fieldSelect.vue: named exports in *.vue files are ignored." ) }
834
- __vue_template__ = __webpack_require__ ( 47 )
931
+ __vue_template__ = __webpack_require__ ( 50 )
835
932
module . exports = __vue_script__ || { }
836
933
if ( module . exports . __esModule ) module . exports = module . exports . default
837
934
if ( __vue_template__ ) {
@@ -850,7 +947,7 @@ return /******/ (function(modules) { // webpackBootstrap
850
947
} ) ( ) }
851
948
852
949
/***/ } ,
853
- /* 46 */
950
+ /* 49 */
854
951
/***/ function ( module , exports , __webpack_require__ ) {
855
952
856
953
'use strict' ;
@@ -870,22 +967,22 @@ return /******/ (function(modules) { // webpackBootstrap
870
967
} ;
871
968
872
969
/***/ } ,
873
- /* 47 */
970
+ /* 50 */
874
971
/***/ function ( module , exports ) {
875
972
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" ;
973
+ module . exports = "\n<div class=\"form-group formly-select\" :class=\"{'has-error': hasError}\" >\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 <error-display :form=\"form\" :field=\"field.key\"></error-display >\n</div>\n" ;
877
974
878
975
/***/ } ,
879
- /* 48 */
976
+ /* 51 */
880
977
/***/ function ( module , exports , __webpack_require__ ) {
881
978
882
979
var __vue_script__ , __vue_template__
883
- __vue_script__ = __webpack_require__ ( 49 )
980
+ __vue_script__ = __webpack_require__ ( 52 )
884
981
if ( __vue_script__ &&
885
982
__vue_script__ . __esModule &&
886
983
Object . keys ( __vue_script__ ) . length > 1 ) {
887
984
console . warn ( "[vue-loader] src/fields/fieldTextarea.vue: named exports in *.vue files are ignored." ) }
888
- __vue_template__ = __webpack_require__ ( 50 )
985
+ __vue_template__ = __webpack_require__ ( 53 )
889
986
module . exports = __vue_script__ || { }
890
987
if ( module . exports . __esModule ) module . exports = module . exports . default
891
988
if ( __vue_template__ ) {
@@ -904,12 +1001,12 @@ return /******/ (function(modules) { // webpackBootstrap
904
1001
} ) ( ) }
905
1002
906
1003
/***/ } ,
907
- /* 49 */
908
- 46 ,
909
- /* 50 */
1004
+ /* 52 */
1005
+ 49 ,
1006
+ /* 53 */
910
1007
/***/ function ( module , exports ) {
911
1008
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" ;
1009
+ module . exports = "\n<div class=\"form-group formly-textarea\" :class=\"{'formly-has-value': model[field.key], 'formly-has-focus': form[field.key].$active, 'has-error': hasError}\" >\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 <error-display :form=\"form\" :field=\"field.key\"></error-display >\n</div>\n" ;
913
1010
914
1011
/***/ }
915
1012
/******/ ] ) ) )
0 commit comments