Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit 00ff7a1

Browse files
committed
0.14.0
1 parent 17e9da3 commit 00ff7a1

File tree

5 files changed

+136
-12
lines changed

5 files changed

+136
-12
lines changed

DropdownButton.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ var DropdownButton = React.createClass({displayName: "DropdownButton",
2222
href: React.PropTypes.string,
2323
onClick: React.PropTypes.func,
2424
onSelect: React.PropTypes.func,
25-
navItem: React.PropTypes.bool
25+
navItem: React.PropTypes.bool,
26+
noCaret: React.PropTypes.bool
2627
},
2728

2829
render: function () {
@@ -31,6 +32,9 @@ var DropdownButton = React.createClass({displayName: "DropdownButton",
3132
var renderMethod = this.props.navItem ?
3233
'renderNavItem' : 'renderButtonGroup';
3334

35+
var caret = this.props.noCaret ?
36+
null : (React.createElement("span", {className: "caret"}));
37+
3438
return this[renderMethod]([
3539
React.createElement(Button, React.__spread({},
3640
this.props,
@@ -44,7 +48,7 @@ var DropdownButton = React.createClass({displayName: "DropdownButton",
4448
pullRight: null,
4549
dropup: null}),
4650
this.props.title, ' ',
47-
React.createElement("span", {className: "caret"})
51+
caret
4852
),
4953
React.createElement(DropdownMenu, {
5054
ref: "menu",

Input.js

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ var Input = React.createClass({displayName: "Input",
3737
return this.props.value;
3838
}
3939
else if (this.props.type) {
40-
return this.getInputDOMNode().value;
40+
if (this.props.type == "select" && this.props.multiple) {
41+
return this.getSelectedOptions();
42+
} else {
43+
return this.getInputDOMNode().value;
44+
}
4145
}
4246
else {
4347
throw Error('Cannot use getValue without specifying input type.');
@@ -48,6 +52,23 @@ var Input = React.createClass({displayName: "Input",
4852
return this.getInputDOMNode().checked;
4953
},
5054

55+
getSelectedOptions: function () {
56+
var values = [];
57+
58+
Array.prototype.forEach.call(
59+
this.getInputDOMNode().getElementsByTagName('option'),
60+
function (option) {
61+
if (option.selected) {
62+
var value = option.getAttribute('value') || option.innerHTML;
63+
64+
values.push(value);
65+
}
66+
}
67+
);
68+
69+
return values;
70+
},
71+
5172
isCheckboxOrRadio: function () {
5273
return this.props.type === 'radio' || this.props.type === 'checkbox';
5374
},

Panel.js

Lines changed: 47 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ var Panel = React.createClass({displayName: "Panel",
4242
},
4343

4444
getCollapsableDimensionValue: function () {
45-
return this.refs.body.getDOMNode().offsetHeight;
45+
return this.refs.panel.getDOMNode().scrollHeight;
4646
},
4747

4848
getCollapsableDOMNode: function () {
@@ -76,11 +76,51 @@ var Panel = React.createClass({displayName: "Panel",
7676
},
7777

7878
renderBody: function () {
79-
return (
80-
React.createElement("div", {className: "panel-body", ref: "body"},
81-
this.props.children
82-
)
83-
);
79+
var allChildren = this.props.children;
80+
var bodyElements = [];
81+
82+
function getProps() {
83+
return {key: bodyElements.length};
84+
}
85+
86+
function addPanelBody (children) {
87+
bodyElements.push(
88+
React.createElement("div", React.__spread({className: "panel-body"}, getProps()),
89+
children
90+
)
91+
);
92+
}
93+
94+
// Handle edge cases where we should not iterate through children.
95+
if (!Array.isArray(allChildren) || allChildren.length == 0) {
96+
addPanelBody(allChildren);
97+
} else {
98+
var panelBodyChildren = [];
99+
100+
function maybeRenderPanelBody () {
101+
if (panelBodyChildren.length == 0) {
102+
return;
103+
}
104+
105+
addPanelBody(panelBodyChildren);
106+
panelBodyChildren = [];
107+
}
108+
109+
allChildren.forEach(function(child) {
110+
if (React.isValidElement(child) && child.props.fill != null) {
111+
maybeRenderPanelBody();
112+
113+
// Separately add the filled element.
114+
bodyElements.push(cloneWithProps(child, getProps()));
115+
} else {
116+
panelBodyChildren.push(child);
117+
}
118+
});
119+
120+
maybeRenderPanelBody();
121+
}
122+
123+
return bodyElements;
84124
},
85125

86126
renderHeading: function () {
@@ -143,4 +183,4 @@ var Panel = React.createClass({displayName: "Panel",
143183
}
144184
});
145185

146-
module.exports = Panel;
186+
module.exports = Panel;

constants.js

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ module.exports = {
4141
'asterisk',
4242
'plus',
4343
'euro',
44+
'eur',
4445
'minus',
4546
'cloud',
4647
'envelope',
@@ -237,6 +238,64 @@ module.exports = {
237238
'cloud-download',
238239
'cloud-upload',
239240
'tree-conifer',
240-
'tree-deciduous'
241+
'tree-deciduous',
242+
'cd',
243+
'save-file',
244+
'open-file',
245+
'level-up',
246+
'copy',
247+
'paste',
248+
'alert',
249+
'equalizer',
250+
'king',
251+
'queen',
252+
'pawn',
253+
'bishop',
254+
'knight',
255+
'baby-formula',
256+
'tent',
257+
'blackboard',
258+
'bed',
259+
'apple',
260+
'erase',
261+
'hourglass',
262+
'lamp',
263+
'duplicate',
264+
'piggy-bank',
265+
'scissors',
266+
'bitcoin',
267+
'yen',
268+
'ruble',
269+
'scale',
270+
'ice-lolly',
271+
'ice-lolly-tasted',
272+
'education',
273+
'option-horizontal',
274+
'option-vertical',
275+
'menu-hamburger',
276+
'modal-window',
277+
'oil',
278+
'grain',
279+
'sunglasses',
280+
'text-size',
281+
'text-color',
282+
'text-background',
283+
'object-align-top',
284+
'object-align-bottom',
285+
'object-align-horizontal',
286+
'object-align-left',
287+
'object-align-vertical',
288+
'object-align-right',
289+
'triangle-right',
290+
'triangle-left',
291+
'triangle-bottom',
292+
'triangle-top',
293+
'console',
294+
'superscript',
295+
'subscript',
296+
'menu-left',
297+
'menu-right',
298+
'menu-down',
299+
'menu-up'
241300
]
242301
};

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-bootstrap",
3-
"version": "0.13.3",
3+
"version": "0.14.0",
44
"description": "Bootstrap 3 components build with React",
55
"homepage": "http://react-bootstrap.github.io/",
66
"main": "main.js",

0 commit comments

Comments
 (0)