Skip to content

Commit 534982c

Browse files
authored
Merge pull request #109 from webdev-dev/master
FormField: fixed small bug on SelectionHybridCheckbox
2 parents 806eaac + 1fe0ce9 commit 534982c

2 files changed

Lines changed: 31 additions & 22 deletions

File tree

lib/FormFields/renderSelectionHybridCheckbox.js

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -103,17 +103,20 @@ var renderSelectionHybridCheckbox = function (_React$Component) {
103103
value: function parseOptionsAndSpecials(props) {
104104
var exclusives = [];
105105
var options = [];
106-
props.options.forEach(function (option) {
107-
var key = props.getOptKey(option);
108-
var special = props.getOptSpecial(option);
109-
if (special.includes('exclusive')) {
110-
exclusives.push(key);
111-
}
112-
options.push({
113-
key: key,
114-
value: props.getOptVal(option)
106+
107+
if (props.options) {
108+
props.options.forEach(function (option) {
109+
var key = props.getOptKey(option);
110+
var special = props.getOptSpecial(option);
111+
if (special.includes('exclusive')) {
112+
exclusives.push(key);
113+
}
114+
options.push({
115+
key: key,
116+
value: props.getOptVal(option)
117+
});
115118
});
116-
});
119+
}
117120
return { options: options, exclusives: exclusives };
118121
}
119122
}, {
@@ -131,7 +134,8 @@ var renderSelectionHybridCheckbox = function (_React$Component) {
131134
globalError = _props2.globalError,
132135
fieldMap = _props2.fieldMap,
133136
disabled = _props2.disabled,
134-
columnCount = _props2.columnCount;
137+
columnCount = _props2.columnCount,
138+
preview = _props2.preview;
135139
var options = this.state.options;
136140

137141

@@ -152,7 +156,7 @@ var renderSelectionHybridCheckbox = function (_React$Component) {
152156
return _react2.default.createElement(
153157
'div',
154158
{
155-
className: (0, _classnames2.default)(className, 'wfui-form-item', { 'wfui-form-item-error': globalError }, { 'wfui-form-disabled': disabled })
159+
className: (0, _classnames2.default)(className, 'wfui-form-item', { 'wfui-form-item-error': globalError }, { 'wfui-form-disabled': disabled }, { 'wfui-form-preview': preview })
156160
},
157161
_react2.default.createElement(
158162
_index.ControlLabel,

src/FormFields/renderSelectionHybridCheckbox.jsx

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,20 @@ class renderSelectionHybridCheckbox extends React.Component {
6262
parseOptionsAndSpecials(props) {
6363
const exclusives = [];
6464
let options = [];
65-
props.options.forEach(option => {
66-
const key = props.getOptKey(option);
67-
const special = props.getOptSpecial(option);
68-
if (special.includes('exclusive')) {
69-
exclusives.push(key);
70-
}
71-
options.push({
72-
key,
73-
value: props.getOptVal(option),
65+
66+
if (props.options) {
67+
props.options.forEach(option => {
68+
const key = props.getOptKey(option);
69+
const special = props.getOptSpecial(option);
70+
if (special.includes('exclusive')) {
71+
exclusives.push(key);
72+
}
73+
options.push({
74+
key,
75+
value: props.getOptVal(option),
76+
});
7477
});
75-
});
78+
}
7679
return { options, exclusives };
7780
}
7881
render() {
@@ -87,6 +90,7 @@ class renderSelectionHybridCheckbox extends React.Component {
8790
fieldMap,
8891
disabled,
8992
columnCount,
93+
preview,
9094
} = this.props;
9195

9296
const { options } = this.state;
@@ -112,6 +116,7 @@ class renderSelectionHybridCheckbox extends React.Component {
112116
'wfui-form-item',
113117
{ 'wfui-form-item-error': globalError },
114118
{ 'wfui-form-disabled': disabled },
119+
{ 'wfui-form-preview': preview },
115120
)}
116121
>
117122
<ControlLabel>{label}</ControlLabel>

0 commit comments

Comments
 (0)