@@ -22,20 +22,43 @@ var Winterfell = (function (_React$Component) {
2222
2323 _get ( Object . getPrototypeOf ( Winterfell . prototype ) , 'constructor' , this ) . call ( this , props ) ;
2424
25+ // Set our default values for props.
26+ var props = _ . extend ( {
27+ schema : {
28+ formPanels : [ ] ,
29+ questionPanels : [ ] ,
30+ questionSets : [ ] ,
31+ classes : { }
32+ } ,
33+ questionAnswers : { } ,
34+ ref : 'form' ,
35+ encType : 'application/x-www-form-urlencoded' ,
36+ method : 'POST' ,
37+ action : '' ,
38+ panelId : undefined ,
39+ disableSubmit : false ,
40+ renderError : undefined ,
41+ renderRequiredAsterisk : undefined ,
42+ onSubmit : function onSubmit ( ) { } ,
43+ onUpdate : function onUpdate ( ) { } ,
44+ onSwitchPanel : function onSwitchPanel ( ) { } ,
45+ onRender : function onRender ( ) { }
46+ } , this . props ) ;
47+
2548 this . panelHistory = [ ] ;
2649
2750 var schema = _ . extend ( {
2851 classes : { } ,
2952 formPanels : [ ] ,
3053 questionPanels : [ ] ,
3154 questionSets : [ ]
32- } , this . props . schema ) ;
55+ } , props . schema ) ;
3356
3457 schema . formPanels = schema . formPanels . sort ( function ( a , b ) {
3558 return a . index > b . index ;
3659 } ) ;
3760
38- var panelId = typeof this . props . panelId !== 'undefined' ? this . props . panelId : schema . formPanels . length > 0 ? schema . formPanels [ 0 ] . panelId : undefined ;
61+ var panelId = typeof props . panelId !== 'undefined' ? props . panelId : schema . formPanels . length > 0 ? schema . formPanels [ 0 ] . panelId : undefined ;
3962
4063 var currentPanel = typeof schema !== 'undefined' && typeof schema . formPanels !== 'undefined' && typeof panelId !== 'undefined' ? _ . find ( schema . formPanels , function ( panel ) {
4164 return panel . panelId == panelId ;
@@ -48,8 +71,8 @@ var Winterfell = (function (_React$Component) {
4871 this . state = {
4972 schema : schema ,
5073 currentPanel : currentPanel ,
51- action : this . props . action ,
52- questionAnswers : this . props . questionAnswers
74+ action : props . action ,
75+ questionAnswers : props . questionAnswers
5376 } ;
5477 }
5578
@@ -170,29 +193,6 @@ var Winterfell = (function (_React$Component) {
170193
171194;
172195
173- // @todo : Proptypes
174- Winterfell . defaultProps = {
175- schema : {
176- formPanels : [ ] ,
177- questionPanels : [ ] ,
178- questionSets : [ ] ,
179- classes : { }
180- } ,
181- questionAnswers : { } ,
182- ref : 'form' ,
183- encType : 'application/x-www-form-urlencoded' ,
184- method : 'POST' ,
185- action : '' ,
186- panelId : undefined ,
187- disableSubmit : false ,
188- renderError : undefined ,
189- renderRequiredAsterisk : undefined ,
190- onSubmit : function onSubmit ( ) { } ,
191- onUpdate : function onUpdate ( ) { } ,
192- onSwitchPanel : function onSwitchPanel ( ) { } ,
193- onRender : function onRender ( ) { }
194- } ;
195-
196196Winterfell . inputTypes = require ( './inputTypes' ) ;
197197Winterfell . errorMessages = require ( './lib/errors' ) ;
198198Winterfell . validation = require ( './lib/validation' ) ;
0 commit comments