Skip to content

Commit 3c18f45

Browse files
Build dist and .min files for 1.1.0
1 parent d85165c commit 3c18f45

File tree

3 files changed

+37
-37
lines changed

3 files changed

+37
-37
lines changed

dist/index.js

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -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-
196196
Winterfell.inputTypes = require('./inputTypes');
197197
Winterfell.errorMessages = require('./lib/errors');
198198
Winterfell.validation = require('./lib/validation');

dist/inputTypes/checkboxOptionsInput.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,20 @@ var CheckboxOptionsInput = (function (_React$Component) {
2727

2828
_createClass(CheckboxOptionsInput, [{
2929
key: 'handleChange',
30-
value: function handleChange(e) {
31-
var value = this.state.value;
30+
value: function handleChange(newVal, e) {
31+
var currentValue = this.state.value;
3232

3333
if (e.target.checked) {
34-
value.push(e.target.value);
34+
currentValue.push(newVal);
3535
} else {
36-
value = value.filter(function (val) {
37-
return val != e.target.value;
36+
currentValue = currentValue.filter(function (v) {
37+
return v != newVal;
3838
});
3939
}
4040

4141
this.setState({
42-
value: value
43-
}, this.props.onChange.bind(null, value));
42+
value: currentValue
43+
}, this.props.onChange.bind(null, currentValue));
4444
}
4545
}, {
4646
key: 'render',
@@ -66,7 +66,7 @@ var CheckboxOptionsInput = (function (_React$Component) {
6666
checked: _this.state.value.indexOf(opt.value) > -1,
6767
className: _this.props.classes.checkbox,
6868
required: _this.props.required ? 'required' : undefined,
69-
onChange: _this.handleChange.bind(_this),
69+
onChange: _this.handleChange.bind(_this, opt.value),
7070
onBlur: _this.props.onBlur.bind(null, _this.state.value) }),
7171
opt.text
7272
)

0 commit comments

Comments
 (0)