react-bootstrap 0.32.0 → 0.32.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/dist/react-bootstrap.js +37 -32
- package/dist/react-bootstrap.min.js +37 -32
- package/es/Panel.js +24 -22
- package/es/PanelGroup.js +13 -10
- package/lib/Panel.js +27 -22
- package/lib/PanelGroup.js +13 -10
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
## [v0.32.1]
|
|
2
|
+
> 2018-01-24
|
|
3
|
+
|
|
4
|
+
- **Bugfix:** Do not allow more than one open panel in an accordion group ([#2940])
|
|
5
|
+
|
|
6
|
+
[v0.32.1]: https://github.com/react-bootstrap/react-bootstrap/compare/v0.32.0...v0.32.1
|
|
7
|
+
[#2940]: https://github.com/react-bootstrap/react-bootstrap/pull/2940
|
|
8
|
+
|
|
9
|
+
|
|
1
10
|
## [v0.32.0]
|
|
2
11
|
> 2018-01-04
|
|
3
12
|
|
|
@@ -19,6 +28,7 @@
|
|
|
19
28
|
[#2676]: https://github.com/react-bootstrap/react-bootstrap/pull/2676
|
|
20
29
|
[#1769]: https://github.com/react-bootstrap/react-bootstrap/pull/1769
|
|
21
30
|
|
|
31
|
+
|
|
22
32
|
## [v0.31.5]
|
|
23
33
|
> 2017-10-24
|
|
24
34
|
|
package/dist/react-bootstrap.js
CHANGED
|
@@ -3929,13 +3929,22 @@ var childContextTypes = {
|
|
|
3929
3929
|
var PanelGroup_PanelGroup = function (_React$Component) {
|
|
3930
3930
|
inherits_default()(PanelGroup, _React$Component);
|
|
3931
3931
|
|
|
3932
|
-
function PanelGroup(
|
|
3932
|
+
function PanelGroup() {
|
|
3933
|
+
var _temp, _this, _ret;
|
|
3934
|
+
|
|
3933
3935
|
classCallCheck_default()(this, PanelGroup);
|
|
3934
3936
|
|
|
3935
|
-
var
|
|
3937
|
+
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
|
3938
|
+
args[_key] = arguments[_key];
|
|
3939
|
+
}
|
|
3936
3940
|
|
|
3937
|
-
_this
|
|
3938
|
-
|
|
3941
|
+
return _ret = (_temp = (_this = possibleConstructorReturn_default()(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.handleSelect = function (key, expanded, e) {
|
|
3942
|
+
if (expanded) {
|
|
3943
|
+
_this.props.onSelect(key, e);
|
|
3944
|
+
} else if (_this.props.activeKey === key) {
|
|
3945
|
+
_this.props.onSelect(null, e);
|
|
3946
|
+
}
|
|
3947
|
+
}, _temp), possibleConstructorReturn_default()(_this, _ret);
|
|
3939
3948
|
}
|
|
3940
3949
|
|
|
3941
3950
|
PanelGroup.prototype.getChildContext = function getChildContext() {
|
|
@@ -3965,12 +3974,6 @@ var PanelGroup_PanelGroup = function (_React$Component) {
|
|
|
3965
3974
|
};
|
|
3966
3975
|
};
|
|
3967
3976
|
|
|
3968
|
-
PanelGroup.prototype.handleSelect = function handleSelect(key, expanded, e) {
|
|
3969
|
-
if (expanded) {
|
|
3970
|
-
this.props.onSelect(key, e);
|
|
3971
|
-
}
|
|
3972
|
-
};
|
|
3973
|
-
|
|
3974
3977
|
PanelGroup.prototype.render = function render() {
|
|
3975
3978
|
var _props2 = this.props,
|
|
3976
3979
|
accordion = _props2.accordion,
|
|
@@ -11596,6 +11599,9 @@ PanelFooter_PanelFooter.contextTypes = PanelFooter_contextTypes;
|
|
|
11596
11599
|
|
|
11597
11600
|
|
|
11598
11601
|
|
|
11602
|
+
|
|
11603
|
+
var has = Object.prototype.hasOwnProperty;
|
|
11604
|
+
|
|
11599
11605
|
var defaultGetId = function defaultGetId(id, type) {
|
|
11600
11606
|
return id ? id + '--' + type : null;
|
|
11601
11607
|
};
|
|
@@ -11645,16 +11651,24 @@ var Panel_Panel = function (_React$Component) {
|
|
|
11645
11651
|
inherits_default()(Panel, _React$Component);
|
|
11646
11652
|
|
|
11647
11653
|
function Panel() {
|
|
11654
|
+
var _temp, _this, _ret;
|
|
11655
|
+
|
|
11648
11656
|
classCallCheck_default()(this, Panel);
|
|
11649
11657
|
|
|
11650
11658
|
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
|
11651
11659
|
args[_key] = arguments[_key];
|
|
11652
11660
|
}
|
|
11653
11661
|
|
|
11654
|
-
|
|
11662
|
+
return _ret = (_temp = (_this = possibleConstructorReturn_default()(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.handleToggle = function (e) {
|
|
11663
|
+
var panelGroup = _this.context.$bs_panelGroup;
|
|
11664
|
+
var expanded = !_this.getExpanded();
|
|
11655
11665
|
|
|
11656
|
-
|
|
11657
|
-
|
|
11666
|
+
if (panelGroup && panelGroup.onToggle) {
|
|
11667
|
+
panelGroup.onToggle(_this.props.eventKey, expanded, e);
|
|
11668
|
+
} else {
|
|
11669
|
+
_this.props.onToggle(expanded, e);
|
|
11670
|
+
}
|
|
11671
|
+
}, _temp), possibleConstructorReturn_default()(_this, _ret);
|
|
11658
11672
|
}
|
|
11659
11673
|
|
|
11660
11674
|
Panel.prototype.getChildContext = function getChildContext() {
|
|
@@ -11662,14 +11676,14 @@ var Panel_Panel = function (_React$Component) {
|
|
|
11662
11676
|
eventKey = _props.eventKey,
|
|
11663
11677
|
id = _props.id;
|
|
11664
11678
|
|
|
11665
|
-
var
|
|
11666
|
-
getId = _ref.getId;
|
|
11679
|
+
var idKey = eventKey == null ? id : eventKey;
|
|
11667
11680
|
|
|
11668
11681
|
var ids = void 0;
|
|
11669
|
-
var idKey = eventKey == null ? id : eventKey;
|
|
11670
11682
|
|
|
11671
11683
|
if (idKey !== null) {
|
|
11672
|
-
|
|
11684
|
+
var panelGroup = this.context.$bs_panelGroup;
|
|
11685
|
+
var getId = panelGroup && panelGroup.getId || defaultGetId;
|
|
11686
|
+
|
|
11673
11687
|
ids = {
|
|
11674
11688
|
headingId: getId(idKey, 'heading'),
|
|
11675
11689
|
bodyId: getId(idKey, 'body')
|
|
@@ -11686,24 +11700,15 @@ var Panel_Panel = function (_React$Component) {
|
|
|
11686
11700
|
};
|
|
11687
11701
|
|
|
11688
11702
|
Panel.prototype.getExpanded = function getExpanded() {
|
|
11689
|
-
var
|
|
11690
|
-
|
|
11691
|
-
var _ref2 = this.context.$bs_panelGroup || {},
|
|
11692
|
-
activeKey = _ref2.activeKey;
|
|
11693
|
-
|
|
11694
|
-
return this.props.expanded != null || activeKey === undefined ? this.props.expanded : activeKey === eventKey;
|
|
11695
|
-
};
|
|
11696
|
-
|
|
11697
|
-
Panel.prototype.handleToggle = function handleToggle(e) {
|
|
11698
|
-
var _ref3 = this.context.$bs_panelGroup || {},
|
|
11699
|
-
onToggle = _ref3.onToggle;
|
|
11703
|
+
var panelGroup = this.context.$bs_panelGroup;
|
|
11700
11704
|
|
|
11701
|
-
|
|
11705
|
+
if (panelGroup && has.call(panelGroup, 'activeKey')) {
|
|
11706
|
+
undefined !== 'production' ? warning_browser_default()(this.props.expanded == null, 'Specifying `<Panel>` `expanded` in the context of an accordion ' + '`<PanelGroup>` is not supported. Set `activeKey` on the ' + '`<PanelGroup>` instead.') : void 0;
|
|
11702
11707
|
|
|
11703
|
-
|
|
11704
|
-
if (onToggle) {
|
|
11705
|
-
onToggle(this.props.eventKey, expanded, e);
|
|
11708
|
+
return panelGroup.activeKey === this.props.eventKey;
|
|
11706
11709
|
}
|
|
11710
|
+
|
|
11711
|
+
return !!this.props.expanded;
|
|
11707
11712
|
};
|
|
11708
11713
|
|
|
11709
11714
|
Panel.prototype.render = function render() {
|
|
@@ -3929,13 +3929,22 @@ var childContextTypes = {
|
|
|
3929
3929
|
var PanelGroup_PanelGroup = function (_React$Component) {
|
|
3930
3930
|
inherits_default()(PanelGroup, _React$Component);
|
|
3931
3931
|
|
|
3932
|
-
function PanelGroup(
|
|
3932
|
+
function PanelGroup() {
|
|
3933
|
+
var _temp, _this, _ret;
|
|
3934
|
+
|
|
3933
3935
|
classCallCheck_default()(this, PanelGroup);
|
|
3934
3936
|
|
|
3935
|
-
var
|
|
3937
|
+
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
|
3938
|
+
args[_key] = arguments[_key];
|
|
3939
|
+
}
|
|
3936
3940
|
|
|
3937
|
-
_this
|
|
3938
|
-
|
|
3941
|
+
return _ret = (_temp = (_this = possibleConstructorReturn_default()(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.handleSelect = function (key, expanded, e) {
|
|
3942
|
+
if (expanded) {
|
|
3943
|
+
_this.props.onSelect(key, e);
|
|
3944
|
+
} else if (_this.props.activeKey === key) {
|
|
3945
|
+
_this.props.onSelect(null, e);
|
|
3946
|
+
}
|
|
3947
|
+
}, _temp), possibleConstructorReturn_default()(_this, _ret);
|
|
3939
3948
|
}
|
|
3940
3949
|
|
|
3941
3950
|
PanelGroup.prototype.getChildContext = function getChildContext() {
|
|
@@ -3965,12 +3974,6 @@ var PanelGroup_PanelGroup = function (_React$Component) {
|
|
|
3965
3974
|
};
|
|
3966
3975
|
};
|
|
3967
3976
|
|
|
3968
|
-
PanelGroup.prototype.handleSelect = function handleSelect(key, expanded, e) {
|
|
3969
|
-
if (expanded) {
|
|
3970
|
-
this.props.onSelect(key, e);
|
|
3971
|
-
}
|
|
3972
|
-
};
|
|
3973
|
-
|
|
3974
3977
|
PanelGroup.prototype.render = function render() {
|
|
3975
3978
|
var _props2 = this.props,
|
|
3976
3979
|
accordion = _props2.accordion,
|
|
@@ -11596,6 +11599,9 @@ PanelFooter_PanelFooter.contextTypes = PanelFooter_contextTypes;
|
|
|
11596
11599
|
|
|
11597
11600
|
|
|
11598
11601
|
|
|
11602
|
+
|
|
11603
|
+
var has = Object.prototype.hasOwnProperty;
|
|
11604
|
+
|
|
11599
11605
|
var defaultGetId = function defaultGetId(id, type) {
|
|
11600
11606
|
return id ? id + '--' + type : null;
|
|
11601
11607
|
};
|
|
@@ -11645,16 +11651,24 @@ var Panel_Panel = function (_React$Component) {
|
|
|
11645
11651
|
inherits_default()(Panel, _React$Component);
|
|
11646
11652
|
|
|
11647
11653
|
function Panel() {
|
|
11654
|
+
var _temp, _this, _ret;
|
|
11655
|
+
|
|
11648
11656
|
classCallCheck_default()(this, Panel);
|
|
11649
11657
|
|
|
11650
11658
|
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
|
11651
11659
|
args[_key] = arguments[_key];
|
|
11652
11660
|
}
|
|
11653
11661
|
|
|
11654
|
-
|
|
11662
|
+
return _ret = (_temp = (_this = possibleConstructorReturn_default()(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.handleToggle = function (e) {
|
|
11663
|
+
var panelGroup = _this.context.$bs_panelGroup;
|
|
11664
|
+
var expanded = !_this.getExpanded();
|
|
11655
11665
|
|
|
11656
|
-
|
|
11657
|
-
|
|
11666
|
+
if (panelGroup && panelGroup.onToggle) {
|
|
11667
|
+
panelGroup.onToggle(_this.props.eventKey, expanded, e);
|
|
11668
|
+
} else {
|
|
11669
|
+
_this.props.onToggle(expanded, e);
|
|
11670
|
+
}
|
|
11671
|
+
}, _temp), possibleConstructorReturn_default()(_this, _ret);
|
|
11658
11672
|
}
|
|
11659
11673
|
|
|
11660
11674
|
Panel.prototype.getChildContext = function getChildContext() {
|
|
@@ -11662,14 +11676,14 @@ var Panel_Panel = function (_React$Component) {
|
|
|
11662
11676
|
eventKey = _props.eventKey,
|
|
11663
11677
|
id = _props.id;
|
|
11664
11678
|
|
|
11665
|
-
var
|
|
11666
|
-
getId = _ref.getId;
|
|
11679
|
+
var idKey = eventKey == null ? id : eventKey;
|
|
11667
11680
|
|
|
11668
11681
|
var ids = void 0;
|
|
11669
|
-
var idKey = eventKey == null ? id : eventKey;
|
|
11670
11682
|
|
|
11671
11683
|
if (idKey !== null) {
|
|
11672
|
-
|
|
11684
|
+
var panelGroup = this.context.$bs_panelGroup;
|
|
11685
|
+
var getId = panelGroup && panelGroup.getId || defaultGetId;
|
|
11686
|
+
|
|
11673
11687
|
ids = {
|
|
11674
11688
|
headingId: getId(idKey, 'heading'),
|
|
11675
11689
|
bodyId: getId(idKey, 'body')
|
|
@@ -11686,24 +11700,15 @@ var Panel_Panel = function (_React$Component) {
|
|
|
11686
11700
|
};
|
|
11687
11701
|
|
|
11688
11702
|
Panel.prototype.getExpanded = function getExpanded() {
|
|
11689
|
-
var
|
|
11690
|
-
|
|
11691
|
-
var _ref2 = this.context.$bs_panelGroup || {},
|
|
11692
|
-
activeKey = _ref2.activeKey;
|
|
11693
|
-
|
|
11694
|
-
return this.props.expanded != null || activeKey === undefined ? this.props.expanded : activeKey === eventKey;
|
|
11695
|
-
};
|
|
11696
|
-
|
|
11697
|
-
Panel.prototype.handleToggle = function handleToggle(e) {
|
|
11698
|
-
var _ref3 = this.context.$bs_panelGroup || {},
|
|
11699
|
-
onToggle = _ref3.onToggle;
|
|
11703
|
+
var panelGroup = this.context.$bs_panelGroup;
|
|
11700
11704
|
|
|
11701
|
-
|
|
11705
|
+
if (panelGroup && has.call(panelGroup, 'activeKey')) {
|
|
11706
|
+
undefined !== 'production' ? warning_browser_default()(this.props.expanded == null, 'Specifying `<Panel>` `expanded` in the context of an accordion ' + '`<PanelGroup>` is not supported. Set `activeKey` on the ' + '`<PanelGroup>` instead.') : void 0;
|
|
11702
11707
|
|
|
11703
|
-
|
|
11704
|
-
if (onToggle) {
|
|
11705
|
-
onToggle(this.props.eventKey, expanded, e);
|
|
11708
|
+
return panelGroup.activeKey === this.props.eventKey;
|
|
11706
11709
|
}
|
|
11710
|
+
|
|
11711
|
+
return !!this.props.expanded;
|
|
11707
11712
|
};
|
|
11708
11713
|
|
|
11709
11714
|
Panel.prototype.render = function render() {
|
package/es/Panel.js
CHANGED
|
@@ -8,6 +8,7 @@ import classNames from 'classnames';
|
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
9
|
import React from 'react';
|
|
10
10
|
import uncontrollable from 'uncontrollable';
|
|
11
|
+
import warning from 'warning';
|
|
11
12
|
|
|
12
13
|
import { bsStyles, bsClass, getClassSet, splitBsPropsAndOmit } from './utils/bootstrapUtils';
|
|
13
14
|
import { State, Style } from './utils/StyleConfig';
|
|
@@ -18,6 +19,8 @@ import Footer from './PanelFooter';
|
|
|
18
19
|
import Toggle from './PanelToggle';
|
|
19
20
|
import Collapse from './PanelCollapse';
|
|
20
21
|
|
|
22
|
+
var has = Object.prototype.hasOwnProperty;
|
|
23
|
+
|
|
21
24
|
var defaultGetId = function defaultGetId(id, type) {
|
|
22
25
|
return id ? id + '--' + type : null;
|
|
23
26
|
};
|
|
@@ -67,16 +70,24 @@ var Panel = function (_React$Component) {
|
|
|
67
70
|
_inherits(Panel, _React$Component);
|
|
68
71
|
|
|
69
72
|
function Panel() {
|
|
73
|
+
var _temp, _this, _ret;
|
|
74
|
+
|
|
70
75
|
_classCallCheck(this, Panel);
|
|
71
76
|
|
|
72
77
|
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
|
73
78
|
args[_key] = arguments[_key];
|
|
74
79
|
}
|
|
75
80
|
|
|
76
|
-
|
|
81
|
+
return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.handleToggle = function (e) {
|
|
82
|
+
var panelGroup = _this.context.$bs_panelGroup;
|
|
83
|
+
var expanded = !_this.getExpanded();
|
|
77
84
|
|
|
78
|
-
|
|
79
|
-
|
|
85
|
+
if (panelGroup && panelGroup.onToggle) {
|
|
86
|
+
panelGroup.onToggle(_this.props.eventKey, expanded, e);
|
|
87
|
+
} else {
|
|
88
|
+
_this.props.onToggle(expanded, e);
|
|
89
|
+
}
|
|
90
|
+
}, _temp), _possibleConstructorReturn(_this, _ret);
|
|
80
91
|
}
|
|
81
92
|
|
|
82
93
|
Panel.prototype.getChildContext = function getChildContext() {
|
|
@@ -84,14 +95,14 @@ var Panel = function (_React$Component) {
|
|
|
84
95
|
eventKey = _props.eventKey,
|
|
85
96
|
id = _props.id;
|
|
86
97
|
|
|
87
|
-
var
|
|
88
|
-
getId = _ref.getId;
|
|
98
|
+
var idKey = eventKey == null ? id : eventKey;
|
|
89
99
|
|
|
90
100
|
var ids = void 0;
|
|
91
|
-
var idKey = eventKey == null ? id : eventKey;
|
|
92
101
|
|
|
93
102
|
if (idKey !== null) {
|
|
94
|
-
|
|
103
|
+
var panelGroup = this.context.$bs_panelGroup;
|
|
104
|
+
var getId = panelGroup && panelGroup.getId || defaultGetId;
|
|
105
|
+
|
|
95
106
|
ids = {
|
|
96
107
|
headingId: getId(idKey, 'heading'),
|
|
97
108
|
bodyId: getId(idKey, 'body')
|
|
@@ -108,24 +119,15 @@ var Panel = function (_React$Component) {
|
|
|
108
119
|
};
|
|
109
120
|
|
|
110
121
|
Panel.prototype.getExpanded = function getExpanded() {
|
|
111
|
-
var
|
|
122
|
+
var panelGroup = this.context.$bs_panelGroup;
|
|
112
123
|
|
|
113
|
-
|
|
114
|
-
|
|
124
|
+
if (panelGroup && has.call(panelGroup, 'activeKey')) {
|
|
125
|
+
process.env.NODE_ENV !== 'production' ? warning(this.props.expanded == null, 'Specifying `<Panel>` `expanded` in the context of an accordion ' + '`<PanelGroup>` is not supported. Set `activeKey` on the ' + '`<PanelGroup>` instead.') : void 0;
|
|
115
126
|
|
|
116
|
-
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
Panel.prototype.handleToggle = function handleToggle(e) {
|
|
120
|
-
var _ref3 = this.context.$bs_panelGroup || {},
|
|
121
|
-
onToggle = _ref3.onToggle;
|
|
122
|
-
|
|
123
|
-
var expanded = !this.getExpanded();
|
|
124
|
-
|
|
125
|
-
this.props.onToggle(expanded, e);
|
|
126
|
-
if (onToggle) {
|
|
127
|
-
onToggle(this.props.eventKey, expanded, e);
|
|
127
|
+
return panelGroup.activeKey === this.props.eventKey;
|
|
128
128
|
}
|
|
129
|
+
|
|
130
|
+
return !!this.props.expanded;
|
|
129
131
|
};
|
|
130
132
|
|
|
131
133
|
Panel.prototype.render = function render() {
|
package/es/PanelGroup.js
CHANGED
|
@@ -70,13 +70,22 @@ var childContextTypes = {
|
|
|
70
70
|
var PanelGroup = function (_React$Component) {
|
|
71
71
|
_inherits(PanelGroup, _React$Component);
|
|
72
72
|
|
|
73
|
-
function PanelGroup(
|
|
73
|
+
function PanelGroup() {
|
|
74
|
+
var _temp, _this, _ret;
|
|
75
|
+
|
|
74
76
|
_classCallCheck(this, PanelGroup);
|
|
75
77
|
|
|
76
|
-
var
|
|
78
|
+
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
|
79
|
+
args[_key] = arguments[_key];
|
|
80
|
+
}
|
|
77
81
|
|
|
78
|
-
_this
|
|
79
|
-
|
|
82
|
+
return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.handleSelect = function (key, expanded, e) {
|
|
83
|
+
if (expanded) {
|
|
84
|
+
_this.props.onSelect(key, e);
|
|
85
|
+
} else if (_this.props.activeKey === key) {
|
|
86
|
+
_this.props.onSelect(null, e);
|
|
87
|
+
}
|
|
88
|
+
}, _temp), _possibleConstructorReturn(_this, _ret);
|
|
80
89
|
}
|
|
81
90
|
|
|
82
91
|
PanelGroup.prototype.getChildContext = function getChildContext() {
|
|
@@ -106,12 +115,6 @@ var PanelGroup = function (_React$Component) {
|
|
|
106
115
|
};
|
|
107
116
|
};
|
|
108
117
|
|
|
109
|
-
PanelGroup.prototype.handleSelect = function handleSelect(key, expanded, e) {
|
|
110
|
-
if (expanded) {
|
|
111
|
-
this.props.onSelect(key, e);
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
|
|
115
118
|
PanelGroup.prototype.render = function render() {
|
|
116
119
|
var _props2 = this.props,
|
|
117
120
|
accordion = _props2.accordion,
|
package/lib/Panel.js
CHANGED
|
@@ -42,6 +42,10 @@ var _uncontrollable = require('uncontrollable');
|
|
|
42
42
|
|
|
43
43
|
var _uncontrollable2 = _interopRequireDefault(_uncontrollable);
|
|
44
44
|
|
|
45
|
+
var _warning = require('warning');
|
|
46
|
+
|
|
47
|
+
var _warning2 = _interopRequireDefault(_warning);
|
|
48
|
+
|
|
45
49
|
var _bootstrapUtils = require('./utils/bootstrapUtils');
|
|
46
50
|
|
|
47
51
|
var _StyleConfig = require('./utils/StyleConfig');
|
|
@@ -72,6 +76,8 @@ var _PanelCollapse2 = _interopRequireDefault(_PanelCollapse);
|
|
|
72
76
|
|
|
73
77
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
74
78
|
|
|
79
|
+
var has = Object.prototype.hasOwnProperty;
|
|
80
|
+
|
|
75
81
|
var defaultGetId = function defaultGetId(id, type) {
|
|
76
82
|
return id ? id + '--' + type : null;
|
|
77
83
|
};
|
|
@@ -121,16 +127,24 @@ var Panel = function (_React$Component) {
|
|
|
121
127
|
(0, _inherits3.default)(Panel, _React$Component);
|
|
122
128
|
|
|
123
129
|
function Panel() {
|
|
130
|
+
var _temp, _this, _ret;
|
|
131
|
+
|
|
124
132
|
(0, _classCallCheck3.default)(this, Panel);
|
|
125
133
|
|
|
126
134
|
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
|
127
135
|
args[_key] = arguments[_key];
|
|
128
136
|
}
|
|
129
137
|
|
|
130
|
-
|
|
138
|
+
return _ret = (_temp = (_this = (0, _possibleConstructorReturn3.default)(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.handleToggle = function (e) {
|
|
139
|
+
var panelGroup = _this.context.$bs_panelGroup;
|
|
140
|
+
var expanded = !_this.getExpanded();
|
|
131
141
|
|
|
132
|
-
|
|
133
|
-
|
|
142
|
+
if (panelGroup && panelGroup.onToggle) {
|
|
143
|
+
panelGroup.onToggle(_this.props.eventKey, expanded, e);
|
|
144
|
+
} else {
|
|
145
|
+
_this.props.onToggle(expanded, e);
|
|
146
|
+
}
|
|
147
|
+
}, _temp), (0, _possibleConstructorReturn3.default)(_this, _ret);
|
|
134
148
|
}
|
|
135
149
|
|
|
136
150
|
Panel.prototype.getChildContext = function getChildContext() {
|
|
@@ -138,14 +152,14 @@ var Panel = function (_React$Component) {
|
|
|
138
152
|
eventKey = _props.eventKey,
|
|
139
153
|
id = _props.id;
|
|
140
154
|
|
|
141
|
-
var
|
|
142
|
-
getId = _ref.getId;
|
|
155
|
+
var idKey = eventKey == null ? id : eventKey;
|
|
143
156
|
|
|
144
157
|
var ids = void 0;
|
|
145
|
-
var idKey = eventKey == null ? id : eventKey;
|
|
146
158
|
|
|
147
159
|
if (idKey !== null) {
|
|
148
|
-
|
|
160
|
+
var panelGroup = this.context.$bs_panelGroup;
|
|
161
|
+
var getId = panelGroup && panelGroup.getId || defaultGetId;
|
|
162
|
+
|
|
149
163
|
ids = {
|
|
150
164
|
headingId: getId(idKey, 'heading'),
|
|
151
165
|
bodyId: getId(idKey, 'body')
|
|
@@ -162,24 +176,15 @@ var Panel = function (_React$Component) {
|
|
|
162
176
|
};
|
|
163
177
|
|
|
164
178
|
Panel.prototype.getExpanded = function getExpanded() {
|
|
165
|
-
var
|
|
166
|
-
|
|
167
|
-
var _ref2 = this.context.$bs_panelGroup || {},
|
|
168
|
-
activeKey = _ref2.activeKey;
|
|
169
|
-
|
|
170
|
-
return this.props.expanded != null || activeKey === undefined ? this.props.expanded : activeKey === eventKey;
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
Panel.prototype.handleToggle = function handleToggle(e) {
|
|
174
|
-
var _ref3 = this.context.$bs_panelGroup || {},
|
|
175
|
-
onToggle = _ref3.onToggle;
|
|
179
|
+
var panelGroup = this.context.$bs_panelGroup;
|
|
176
180
|
|
|
177
|
-
|
|
181
|
+
if (panelGroup && has.call(panelGroup, 'activeKey')) {
|
|
182
|
+
process.env.NODE_ENV !== 'production' ? (0, _warning2.default)(this.props.expanded == null, 'Specifying `<Panel>` `expanded` in the context of an accordion ' + '`<PanelGroup>` is not supported. Set `activeKey` on the ' + '`<PanelGroup>` instead.') : void 0;
|
|
178
183
|
|
|
179
|
-
|
|
180
|
-
if (onToggle) {
|
|
181
|
-
onToggle(this.props.eventKey, expanded, e);
|
|
184
|
+
return panelGroup.activeKey === this.props.eventKey;
|
|
182
185
|
}
|
|
186
|
+
|
|
187
|
+
return !!this.props.expanded;
|
|
183
188
|
};
|
|
184
189
|
|
|
185
190
|
Panel.prototype.render = function render() {
|
package/lib/PanelGroup.js
CHANGED
|
@@ -106,13 +106,22 @@ var childContextTypes = {
|
|
|
106
106
|
var PanelGroup = function (_React$Component) {
|
|
107
107
|
(0, _inherits3.default)(PanelGroup, _React$Component);
|
|
108
108
|
|
|
109
|
-
function PanelGroup(
|
|
109
|
+
function PanelGroup() {
|
|
110
|
+
var _temp, _this, _ret;
|
|
111
|
+
|
|
110
112
|
(0, _classCallCheck3.default)(this, PanelGroup);
|
|
111
113
|
|
|
112
|
-
var
|
|
114
|
+
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
|
115
|
+
args[_key] = arguments[_key];
|
|
116
|
+
}
|
|
113
117
|
|
|
114
|
-
_this
|
|
115
|
-
|
|
118
|
+
return _ret = (_temp = (_this = (0, _possibleConstructorReturn3.default)(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.handleSelect = function (key, expanded, e) {
|
|
119
|
+
if (expanded) {
|
|
120
|
+
_this.props.onSelect(key, e);
|
|
121
|
+
} else if (_this.props.activeKey === key) {
|
|
122
|
+
_this.props.onSelect(null, e);
|
|
123
|
+
}
|
|
124
|
+
}, _temp), (0, _possibleConstructorReturn3.default)(_this, _ret);
|
|
116
125
|
}
|
|
117
126
|
|
|
118
127
|
PanelGroup.prototype.getChildContext = function getChildContext() {
|
|
@@ -142,12 +151,6 @@ var PanelGroup = function (_React$Component) {
|
|
|
142
151
|
};
|
|
143
152
|
};
|
|
144
153
|
|
|
145
|
-
PanelGroup.prototype.handleSelect = function handleSelect(key, expanded, e) {
|
|
146
|
-
if (expanded) {
|
|
147
|
-
this.props.onSelect(key, e);
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
|
|
151
154
|
PanelGroup.prototype.render = function render() {
|
|
152
155
|
var _props2 = this.props,
|
|
153
156
|
accordion = _props2.accordion,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-bootstrap",
|
|
3
|
-
"version": "0.32.
|
|
3
|
+
"version": "0.32.1",
|
|
4
4
|
"description": "Bootstrap 3 components built with React",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -122,6 +122,6 @@
|
|
|
122
122
|
"release-script": {
|
|
123
123
|
"bowerRepo": "git@github.com:react-bootstrap/react-bootstrap-bower.git",
|
|
124
124
|
"docsRepo": "git@github.com:react-bootstrap/react-bootstrap.github.io.git",
|
|
125
|
-
"docsRoot": "www/public"
|
|
125
|
+
"docsRoot": "www/public/"
|
|
126
126
|
}
|
|
127
127
|
}
|