Skip to content

Commit d050643

Browse files
committed
Tests + docs
1 parent 96c399f commit d050643

File tree

5 files changed

+941
-789
lines changed

5 files changed

+941
-789
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ The [custom editor example](https://github.com/plotly/react-chart-editor/tree/ma
6666

6767
### General-purpose Containers
6868

69-
* `<Panel />`: renders as a generic rectangular container with special handling for collapsing/expanding child `<Fold />`s and optionally an 'add' button for creating them
7069
* `<PanelMenuWrapper />`: renders as a sidebar selector menu for `<Panel />`s
71-
* `<Fold />`: collapsable container within a `<Panel />`
72-
* `<Section />`: uncollapsable container within a `<Panel />` or `<Fold />`
73-
* `<SectionHeader/>`: a `SectionHeader` to use separately with custom layouts.
70+
* `<PlotlyPanel />`: renders as a generic rectangular container with special handling for collapsing/expanding child `<Fold />`s and optionally an 'add' button for creating them, has special [visibility rules](https://github.com/plotly/react-chart-editor/tree/master/src/components/containers/_tests_/ConnectedContainersVisibility-test.js) that depend on plotly figure
71+
* `<PlotlyFold />`: collapsable container within a `<Panel />`, has special [visibility rules](https://github.com/plotly/react-chart-editor/tree/master/src/components/containers/_tests_/ConnectedContainersVisibility-test.js) that depend on plotly figure
72+
* `<PlotlySection />`: uncollapsable container within a `<Panel />` or `<Fold />`, has special [visibility rules](https://github.com/plotly/react-chart-editor/tree/master/src/components/containers/_tests_/ConnectedContainersVisibility-test.js) that depend on plotly figure
73+
* `<Panel/>`, `<Fold/>`, `<Section/>`: same as `PlotlyPanel`, `PlotlyFold`, `PlotlySection`, but there are no special visibility rules, those containers [always show, and always show their children](https://github.com/plotly/react-chart-editor/tree/master/src/components/containers/_tests_/UnconnectedContainersVisibility-test.js)
7474
* `<SingleSidebarItem/>`: wraps any item you would like to see appear in the sidebar menu.
7575

7676
### General-purpose Fields

src/components/containers/PlotlyFold.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ class PlotlyFold extends Component {
2525
determineVisibility(nextProps, nextContext) {
2626
this.foldVisible = false;
2727

28+
if (this.props.forceVisibility) {
29+
this.foldVisible = true;
30+
return;
31+
}
32+
2833
React.Children.forEach(nextProps.children, child => {
2934
if (!child || this.foldVisible) {
3035
return;
@@ -149,6 +154,7 @@ PlotlyFold.propTypes = {
149154
messageIfEmpty: PropTypes.string,
150155
localize: PropTypes.func,
151156
name: PropTypes.string,
157+
forceVisibility: PropTypes.bool,
152158
};
153159

154160
PlotlyFold.contextTypes = Object.assign(
@@ -160,8 +166,7 @@ PlotlyFold.contextTypes = Object.assign(
160166

161167
export default localize(PlotlyFold);
162168

163-
// just to keep naming consistent
164169
export class Fold extends PlotlyFold {}
165-
Fold.plotly_editor_traits = {
166-
foldable: true,
170+
Fold.defaultProps = {
171+
forceVisibility: true,
167172
};

0 commit comments

Comments
 (0)