diff --git a/.prettierrc b/.prettierrc index 9361deac8..4d40e22c7 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,5 +1,6 @@ { "singleQuote": true, "bracketSpacing": false, - "trailingComma": "es5" + "trailingComma": "es5", + "printWidth": 100 } diff --git a/src/DefaultEditor.js b/src/DefaultEditor.js index 2786f432c..365bc6bcb 100644 --- a/src/DefaultEditor.js +++ b/src/DefaultEditor.js @@ -31,9 +31,7 @@ class DefaultEditor extends Component { } hasTransforms() { - return this.context.fullData.some(d => - TRANSFORMABLE_TRACES.includes(d.type) - ); + return this.context.fullData.some(d => TRANSFORMABLE_TRACES.includes(d.type)); } hasAxes() { @@ -75,27 +73,17 @@ class DefaultEditor extends Component { {logo ? logo : null} - {this.hasTransforms() && ( - - )} + {this.hasTransforms() && } - {this.hasAxes() && ( - - )} + {this.hasAxes() && } - {this.hasColorbars() && ( - - )} + {this.hasColorbars() && } - {this.hasSliders() && ( - - )} - {this.hasMenus() && ( - - )} + {this.hasSliders() && } + {this.hasMenus() && } {this.props.children ? this.props.children : null} ); diff --git a/src/EditorControls.js b/src/EditorControls.js index fd21bc918..2e32b3284 100644 --- a/src/EditorControls.js +++ b/src/EditorControls.js @@ -21,8 +21,7 @@ class EditorControls extends Component { constructor(props, context) { super(props, context); - this.localize = key => - localizeString(this.props.dictionaries || {}, this.props.locale, key); + this.localize = key => localizeString(this.props.dictionaries || {}, this.props.locale, key); // we only need to compute this once. if (this.props.plotly) { @@ -85,12 +84,7 @@ class EditorControls extends Component { const value = payload.update[attr]; if (splitTraceGroup) { - props = shamefullyCreateSplitStyleProps( - graphDiv, - attr, - traceIndex, - splitTraceGroup - ); + props = shamefullyCreateSplitStyleProps(graphDiv, attr, traceIndex, splitTraceGroup); } props.forEach(p => { @@ -262,17 +256,11 @@ class EditorControls extends Component { break; case EDITOR_ACTIONS.DELETE_TRANSFORM: - if ( - isNumeric(payload.transformIndex) && - payload.traceIndex < graphDiv.data.length - ) { + if (isNumeric(payload.transformIndex) && payload.traceIndex < graphDiv.data.length) { if (graphDiv.data[payload.traceIndex].transforms.length === 1) { delete graphDiv.data[payload.traceIndex].transforms; } else { - graphDiv.data[payload.traceIndex].transforms.splice( - payload.transformIndex, - 1 - ); + graphDiv.data[payload.traceIndex].transforms.splice(payload.transformIndex, 1); } if (this.props.onUpdate) { this.props.onUpdate( @@ -285,9 +273,7 @@ class EditorControls extends Component { break; default: - throw new Error( - this.localize('must specify an action type to handleEditorUpdate') - ); + throw new Error(this.localize('must specify an action type to handleEditorUpdate')); } } diff --git a/src/PlotlyEditor.js b/src/PlotlyEditor.js index e23a280c3..5be6f6524 100644 --- a/src/PlotlyEditor.js +++ b/src/PlotlyEditor.js @@ -29,18 +29,13 @@ class PlotlyEditor extends Component { srcConverters={this.props.srcConverters} makeDefaultTrace={this.props.makeDefaultTrace} glByDefault={this.props.glByDefault} - mapBoxAccess={Boolean( - this.props.config && this.props.config.mapboxAccessToken - )} + mapBoxAccess={Boolean(this.props.config && this.props.config.mapboxAccessToken)} fontOptions={this.props.fontOptions} > {this.props.children} )} -
+
{ const snapshotWidth = 500; Object.keys(mocks).forEach(m => { - const selectedPanels = panelsToTest[m] - ? panelsToTest[m] - : Object.keys(panels); + const selectedPanels = panelsToTest[m] ? panelsToTest[m] : Object.keys(panels); selectedPanels.forEach(p => { const words = p.split(/(?=[A-Z])/); diff --git a/src/__tests__/syntax-test.js b/src/__tests__/syntax-test.js index e361387af..daf88b1f6 100644 --- a/src/__tests__/syntax-test.js +++ b/src/__tests__/syntax-test.js @@ -2,14 +2,7 @@ import fs from 'fs'; import glob from 'glob'; -const BLACK_LIST = [ - 'fdescribe', - 'fit', - 'xdescribe', - 'xit', - 'it\\.only', - 'describe\\.only', -]; +const BLACK_LIST = ['fdescribe', 'fit', 'xdescribe', 'xit', 'it\\.only', 'describe\\.only']; const REGEXS = BLACK_LIST.map(token => new RegExp(`^\\s*${token}\\(.*`)); describe('Syntax and test validation', () => { diff --git a/src/components/PanelMenuWrapper.js b/src/components/PanelMenuWrapper.js index b0d79590b..a9996ff95 100644 --- a/src/components/PanelMenuWrapper.js +++ b/src/components/PanelMenuWrapper.js @@ -30,10 +30,7 @@ class PanelsWithSidebar extends Component { } renderSection(section, i) { - if ( - section.type && - (section.type.plotly_editor_traits || {}).sidebar_element - ) { + if (section.type && (section.type.plotly_editor_traits || {}).sidebar_element) { return cloneElement(section, {key: i}); } return ( diff --git a/src/components/containers/AnnotationAccordion.js b/src/components/containers/AnnotationAccordion.js index aeaaf0acf..98795f9f4 100644 --- a/src/components/containers/AnnotationAccordion.js +++ b/src/components/containers/AnnotationAccordion.js @@ -17,12 +17,7 @@ class AnnotationAccordion extends Component { const content = annotations.length && annotations.map((ann, i) => ( - + {children} )); diff --git a/src/components/containers/FoldEmpty.js b/src/components/containers/FoldEmpty.js index 8cd10e009..7a78fbaaa 100644 --- a/src/components/containers/FoldEmpty.js +++ b/src/components/containers/FoldEmpty.js @@ -13,14 +13,10 @@ export default class FoldEmpty extends Component {
) : null} {messagePrimary ? ( -
- {messagePrimary} -
+
{messagePrimary}
) : null} {messageSecondary ? ( -
- {messageSecondary} -
+
{messageSecondary}
) : null} {children ? children : null}
diff --git a/src/components/containers/Modal.js b/src/components/containers/Modal.js index 9b0e0b862..356842dc4 100644 --- a/src/components/containers/Modal.js +++ b/src/components/containers/Modal.js @@ -6,19 +6,14 @@ const ModalHeader = ({title, handleClose}) => (
{title ?
{title}
: null} {handleClose ? ( -
handleClose() : null} - > +
handleClose() : null}>
) : null}
); -const ModalContent = ({children}) => ( -
{children}
-); +const ModalContent = ({children}) =>
{children}
; class Modal extends Component { constructor(props) { @@ -50,16 +45,10 @@ class Modal extends Component { return (
- this.context.handleClose()} - /> + this.context.handleClose()} /> {children}
-
this.context.handleClose()} - /> +
this.context.handleClose()} />
); } diff --git a/src/components/containers/ModalProvider.js b/src/components/containers/ModalProvider.js index bc46ccd0f..6cbb13958 100644 --- a/src/components/containers/ModalProvider.js +++ b/src/components/containers/ModalProvider.js @@ -75,9 +75,7 @@ class ModalProvider extends React.Component { return ( {this.props.children} - {this.state.open ? ( - - ) : null} + {this.state.open ? : null} ); } diff --git a/src/components/containers/PanelEmpty.js b/src/components/containers/PanelEmpty.js index ae30c3870..cd72bbb9c 100644 --- a/src/components/containers/PanelEmpty.js +++ b/src/components/containers/PanelEmpty.js @@ -11,9 +11,7 @@ class PanelEmpty extends Component { return (
-
- {Icon ? : } -
+
{Icon ? : }
{heading}
{children}
diff --git a/src/components/containers/PanelHeader.js b/src/components/containers/PanelHeader.js index f7463c81c..e08c60244 100644 --- a/src/components/containers/PanelHeader.js +++ b/src/components/containers/PanelHeader.js @@ -17,13 +17,7 @@ class PanelHeader extends Component { render() { const {localize: _} = this.context; - const { - children, - addAction, - allowCollapse, - toggleFolds, - hasOpen, - } = this.props; + const {children, addAction, allowCollapse, toggleFolds, hasOpen} = this.props; // dropdown is styled with same styles as react-select component - see _dropdown.scss const icon = ; diff --git a/src/components/containers/PlotlyPanel.js b/src/components/containers/PlotlyPanel.js index 87d6253f5..2281dd718 100644 --- a/src/components/containers/PlotlyPanel.js +++ b/src/components/containers/PlotlyPanel.js @@ -11,10 +11,7 @@ class PanelErrorImpl extends Component { const {localize: _} = this.context; return ( - +

{_('This panel could not be displayed due to an error.')}

); @@ -50,18 +47,14 @@ export class Panel extends Component { toggleFolds() { const {individualFoldStates} = this.state; - const hasOpen = - individualFoldStates.length > 0 && - individualFoldStates.some(s => s !== true); + const hasOpen = individualFoldStates.length > 0 && individualFoldStates.some(s => s !== true); this.setState({ individualFoldStates: individualFoldStates.map(() => hasOpen), }); } toggleFold(index) { - this.setState( - update(this.state, {individualFoldStates: {$toggle: [index]}}) - ); + this.setState(update(this.state, {individualFoldStates: {$toggle: [index]}})); } calculateFolds() { @@ -69,10 +62,7 @@ export class Panel extends Component { let numFolds = 0; React.Children.forEach(this.props.children, child => { - if ( - ((child && child.type && child.type.plotly_editor_traits) || {}) - .foldable - ) { + if (((child && child.type && child.type.plotly_editor_traits) || {}).foldable) { numFolds++; } }); @@ -101,32 +91,22 @@ export class Panel extends Component { return ; } - const newChildren = React.Children.map( - this.props.children, - (child, index) => { - if ( - ((child && child.type && child.type.plotly_editor_traits) || {}) - .foldable - ) { - return cloneElement(child, { - key: index, - folded: individualFoldStates[index] || false, - toggleFold: () => this.toggleFold(index), - }); - } - return child; + const newChildren = React.Children.map(this.props.children, (child, index) => { + if (((child && child.type && child.type.plotly_editor_traits) || {}).foldable) { + return cloneElement(child, { + key: index, + folded: individualFoldStates[index] || false, + toggleFold: () => this.toggleFold(index), + }); } - ); + return child; + }); return ( -
+
1 - } + allowCollapse={this.props.showExpandCollapse && individualFoldStates.length > 1} toggleFolds={this.toggleFolds} hasOpen={individualFoldStates.some(s => s === false)} /> diff --git a/src/components/containers/RangeSelectorAccordion.js b/src/components/containers/RangeSelectorAccordion.js index 5747c06f8..940799ec1 100644 --- a/src/components/containers/RangeSelectorAccordion.js +++ b/src/components/containers/RangeSelectorAccordion.js @@ -29,12 +29,7 @@ class RangeSelectorAccordion extends Component { const content = buttons.length && buttons.map((btn, i) => ( - + {children} )); @@ -44,9 +39,7 @@ class RangeSelectorAccordion extends Component { handler: context => { const {fullContainer, updateContainer} = context; if (updateContainer) { - const rangeselectorIndex = Array.isArray( - fullContainer.rangeselector.buttons - ) + const rangeselectorIndex = Array.isArray(fullContainer.rangeselector.buttons) ? fullContainer.rangeselector.buttons.length : 0; @@ -57,11 +50,7 @@ class RangeSelectorAccordion extends Component { }, }; - return ( - - {content ? content : null} - - ); + return {content ? content : null}; } } diff --git a/src/components/containers/SubplotAccordion.js b/src/components/containers/SubplotAccordion.js index c93e26359..e7f3924fd 100644 --- a/src/components/containers/SubplotAccordion.js +++ b/src/components/containers/SubplotAccordion.js @@ -25,19 +25,13 @@ class SubplotAccordion extends Component { const xaxis = 'xaxis' + (curVal.xaxis ? curVal.xaxis.substring(1) : ''); const yaxis = 'yaxis' + (curVal.yaxis ? curVal.yaxis.substring(1) : ''); - const existingComboIndex = acc.findIndex( - t => t.xaxis === xaxis && t.yaxis === yaxis - ); + const existingComboIndex = acc.findIndex(t => t.xaxis === xaxis && t.yaxis === yaxis); if (existingComboIndex === -1) { acc.push({ xaxis: xaxis, yaxis: yaxis, - xaxisName: curVal.xaxis - ? getSubplotTitle(curVal.xaxis, 'x', _) - : 'X 1', - yaxisName: curVal.yaxis - ? getSubplotTitle(curVal.yaxis, 'y', _) - : 'Y 1', + xaxisName: curVal.xaxis ? getSubplotTitle(curVal.xaxis, 'x', _) : 'X 1', + yaxisName: curVal.yaxis ? getSubplotTitle(curVal.yaxis, 'y', _) : 'Y 1', index: [inx], }); } else { @@ -97,13 +91,8 @@ class SubplotAccordion extends Component { subplotName = getSubplotTitle(layoutKey, subplotType, _); const trIndex = SUBPLOT_TO_ATTR[subplotType].layout === layoutKey - ? data.findIndex(trace => - TRACE_TO_AXIS[subplotType].some(tt => tt === trace.type) - ) - : data.findIndex( - trace => - trace[SUBPLOT_TO_ATTR[subplotType].data] === layoutKey - ); + ? data.findIndex(trace => TRACE_TO_AXIS[subplotType].some(tt => tt === trace.type)) + : data.findIndex(trace => trace[SUBPLOT_TO_ATTR[subplotType].data] === layoutKey); if (trIndex !== -1) { traceIndexes.push(trIndex); } diff --git a/src/components/containers/TraceAccordion.js b/src/components/containers/TraceAccordion.js index 216f1a863..0db578da2 100644 --- a/src/components/containers/TraceAccordion.js +++ b/src/components/containers/TraceAccordion.js @@ -23,8 +23,7 @@ class TraceAccordion extends Component { setLocals(props, context) { // we don't want to include analysis transforms when we're in the create panel const base = props.canGroup ? context.fullData : context.data; - const traceFilterCondition = - this.props.traceFilterCondition || (() => true); + const traceFilterCondition = this.props.traceFilterCondition || (() => true); this.filteredTracesIndexes = []; this.filteredTraces = base.filter((t, i) => { @@ -56,9 +55,7 @@ class TraceAccordion extends Component { } dataArrayPositionsByTraceType[traceType].push(trace.index); - fullDataArrayPositionsByTraceType[traceType].push( - this.filteredTracesIndexes[index] - ); + fullDataArrayPositionsByTraceType[traceType].push(this.filteredTracesIndexes[index]); }); return Object.keys(fullDataArrayPositionsByTraceType).map((type, index) => ( @@ -114,20 +111,12 @@ class TraceAccordion extends Component { }, }; - return ( - - {this.renderTraceFolds()} - - ); + return {this.renderTraceFolds()}; } if (canGroup) { if (this.filteredTraces.length === 1) { - return ( - - {this.renderUngroupedTraceFolds()} - - ); + return {this.renderUngroupedTraceFolds()}; } if (this.filteredTraces.length > 1) { diff --git a/src/components/containers/TraceMarkerSection.js b/src/components/containers/TraceMarkerSection.js index f227a3de0..88d5de2cf 100644 --- a/src/components/containers/TraceMarkerSection.js +++ b/src/components/containers/TraceMarkerSection.js @@ -25,9 +25,7 @@ class TraceMarkerSection extends Component { } render() { - return ( - {this.props.children} - ); + return {this.props.children}; } } diff --git a/src/components/containers/TraceRequiredPanel.js b/src/components/containers/TraceRequiredPanel.js index 5d95583f7..ad03bcf41 100644 --- a/src/components/containers/TraceRequiredPanel.js +++ b/src/components/containers/TraceRequiredPanel.js @@ -19,14 +19,10 @@ class TraceRequiredPanel extends Component { return this.hasTrace() ? ( {children} ) : ( - +

{_('Go to the ')} - this.context.setPanel('Graph', 'Create')}> - {_('Create')} - + this.context.setPanel('Graph', 'Create')}>{_('Create')} {_(' panel to define traces.')}

diff --git a/src/components/containers/TransformAccordion.js b/src/components/containers/TransformAccordion.js index d64eb8122..9b6f528b4 100644 --- a/src/components/containers/TransformAccordion.js +++ b/src/components/containers/TransformAccordion.js @@ -29,18 +29,12 @@ class TransformAccordion extends Component { let foldNameSuffix = ''; if (tr.groupssrc) { const groupssrc = - dataSourceOptions && - dataSourceOptions.find(d => d.value === tr.groupssrc); - foldNameSuffix = `: ${ - groupssrc && groupssrc.label ? groupssrc.label : tr.groupssrc - }`; + dataSourceOptions && dataSourceOptions.find(d => d.value === tr.groupssrc); + foldNameSuffix = `: ${groupssrc && groupssrc.label ? groupssrc.label : tr.groupssrc}`; } else if (tr.targetsrc) { const targetsrc = - dataSourceOptions && - dataSourceOptions.find(d => d.value === tr.targetsrc); - foldNameSuffix = `: ${ - targetsrc && targetsrc.label ? targetsrc.label : tr.targetsrc - }`; + dataSourceOptions && dataSourceOptions.find(d => d.value === tr.targetsrc); + foldNameSuffix = `: ${targetsrc && targetsrc.label ? targetsrc.label : tr.targetsrc}`; } return foldNameSuffix; }); @@ -52,9 +46,8 @@ class TransformAccordion extends Component { type === tr.type)[0].label - }${transformBy && transformBy[i]}`} + name={`${transformTypes.filter(({type}) => type === tr.type)[0].label}${transformBy && + transformBy[i]}`} canDelete={true} > {children} @@ -64,8 +57,7 @@ class TransformAccordion extends Component { // cannot have 2 Split transforms on one trace: // https://github.com/plotly/plotly.js/issues/1742 const addActionOptions = - container.transforms && - container.transforms.some(t => t.type === 'groupby') + container.transforms && container.transforms.some(t => t.type === 'groupby') ? transformTypes.filter(t => t.type !== 'groupby') : transformTypes; @@ -102,11 +94,7 @@ class TransformAccordion extends Component { }), }; - return ( - - {content ? content : null} - - ); + return {content ? content : null}; } } diff --git a/src/components/containers/__tests__/ConnectedContainersVisibility-test.js b/src/components/containers/__tests__/ConnectedContainersVisibility-test.js index 18006e997..d306aefb9 100644 --- a/src/components/containers/__tests__/ConnectedContainersVisibility-test.js +++ b/src/components/containers/__tests__/ConnectedContainersVisibility-test.js @@ -70,8 +70,7 @@ describe('Basic PlotlySection rules', () => { ); - it('HIDES PlotlySection', () => - expect(wrapper.find('div.section').length).toEqual(0)); + it('HIDES PlotlySection', () => expect(wrapper.find('div.section').length).toEqual(0)); it('HIDES Field', () => expect(wrapper.find('input').length).toEqual(0)); }); @@ -86,8 +85,7 @@ describe('Basic PlotlySection rules', () => { ); - it('HIDES PlotlySection', () => - expect(wrapper.find('div.section').length).toEqual(0)); + it('HIDES PlotlySection', () => expect(wrapper.find('div.section').length).toEqual(0)); it('HIDES Field', () => expect(wrapper.find('input').length).toEqual(0)); }); }); @@ -104,8 +102,7 @@ describe('Basic PlotlySection rules', () => { ); - it('SHOWS PlotlySection', () => - expect(wrapper.find('div.section').length).toEqual(1)); + it('SHOWS PlotlySection', () => expect(wrapper.find('div.section').length).toEqual(1)); it('SHOWS Field', () => expect(wrapper.find('input').length).toEqual(1)); }); @@ -121,8 +118,7 @@ describe('Basic PlotlySection rules', () => { ); - it('SHOWS PlotlySection', () => - expect(wrapper.find('div.section').length).toEqual(1)); + it('SHOWS PlotlySection', () => expect(wrapper.find('div.section').length).toEqual(1)); it('HIDES Field', () => expect(wrapper.find('input').length).toEqual(0)); it('SHOWS div', () => expect(wrapper.find('#thediv').length).toEqual(1)); }); @@ -141,8 +137,7 @@ describe('Basic PlotlyFold rules', () => { ); - it('SHOWS PlotlyFold', () => - expect(wrapper.find('div.fold').length).toEqual(1)); + it('SHOWS PlotlyFold', () => expect(wrapper.find('div.fold').length).toEqual(1)); it('SHOWS Field', () => expect(wrapper.find('input').length).toEqual(1)); }); @@ -157,8 +152,7 @@ describe('Basic PlotlyFold rules', () => { ); - it('HIDES PlotlyFold', () => - expect(wrapper.find('div.fold').length).toEqual(0)); + it('HIDES PlotlyFold', () => expect(wrapper.find('div.fold').length).toEqual(0)); it('HIDES Field', () => expect(wrapper.find('input').length).toEqual(0)); }); }); @@ -175,8 +169,7 @@ describe('Basic PlotlyFold rules', () => { ); - it('SHOWS PlotlyFold', () => - expect(wrapper.find('div.fold').length).toEqual(1)); + it('SHOWS PlotlyFold', () => expect(wrapper.find('div.fold').length).toEqual(1)); it('SHOWS div', () => expect(wrapper.find('#thediv').length).toEqual(1)); }); @@ -194,12 +187,9 @@ describe('Basic PlotlyFold rules', () => { ); - it('HIDES PlotlyFold', () => - expect(wrapper.find('div.fold').length).toEqual(0)); - it('HIDES PlotlySection', () => - expect(wrapper.find('div.section').length).toEqual(0)); - it('HIDES div', () => - expect(wrapper.find('#thediv').length).toEqual(0)); + it('HIDES PlotlyFold', () => expect(wrapper.find('div.fold').length).toEqual(0)); + it('HIDES PlotlySection', () => expect(wrapper.find('div.section').length).toEqual(0)); + it('HIDES div', () => expect(wrapper.find('#thediv').length).toEqual(0)); }); describe('Field-with-visible-attr', () => { @@ -214,12 +204,9 @@ describe('Basic PlotlyFold rules', () => { ); - it('HIDES PlotlyFold', () => - expect(wrapper.find('div.fold').length).toEqual(0)); - it('HIDES PlotlySection', () => - expect(wrapper.find('div.section').length).toEqual(0)); - it('HIDES Field', () => - expect(wrapper.find('input').length).toEqual(0)); + it('HIDES PlotlyFold', () => expect(wrapper.find('div.fold').length).toEqual(0)); + it('HIDES PlotlySection', () => expect(wrapper.find('div.section').length).toEqual(0)); + it('HIDES Field', () => expect(wrapper.find('input').length).toEqual(0)); }); describe('Field-with-invisible-attr', () => { @@ -235,12 +222,9 @@ describe('Basic PlotlyFold rules', () => { ); - it('HIDES PlotlyFold', () => - expect(wrapper.find('div.fold').length).toEqual(0)); - it('HIDES PlotlySection', () => - expect(wrapper.find('div.section').length).toEqual(0)); - it('HIDES Field', () => - expect(wrapper.find('input').length).toEqual(0)); + it('HIDES PlotlyFold', () => expect(wrapper.find('div.fold').length).toEqual(0)); + it('HIDES PlotlySection', () => expect(wrapper.find('div.section').length).toEqual(0)); + it('HIDES Field', () => expect(wrapper.find('input').length).toEqual(0)); }); }); }); @@ -259,12 +243,9 @@ describe('Basic PlotlyFold rules', () => { ); - it('HIDES PlotlyFold', () => - expect(wrapper.find('div.fold').length).toEqual(0)); - it('HIDES inner PlotlyPanel', () => - expect(wrapper.find('div.panel').length).toEqual(1)); - it('HIDES Field', () => - expect(wrapper.find('input').length).toEqual(0)); + it('HIDES PlotlyFold', () => expect(wrapper.find('div.fold').length).toEqual(0)); + it('HIDES inner PlotlyPanel', () => expect(wrapper.find('div.panel').length).toEqual(1)); + it('HIDES Field', () => expect(wrapper.find('input').length).toEqual(0)); }); }); @@ -282,12 +263,9 @@ describe('Basic PlotlyFold rules', () => { ); - it('HIDES PlotlyFold', () => - expect(wrapper.find('div.fold').length).toEqual(0)); - it('HIDES Info', () => - expect(wrapper.find('.js-test-info').length).toEqual(0)); - it('HIDES Field', () => - expect(wrapper.find('input').length).toEqual(0)); + it('HIDES PlotlyFold', () => expect(wrapper.find('div.fold').length).toEqual(0)); + it('HIDES Info', () => expect(wrapper.find('.js-test-info').length).toEqual(0)); + it('HIDES Field', () => expect(wrapper.find('input').length).toEqual(0)); }); }); @@ -305,12 +283,9 @@ describe('Basic PlotlyFold rules', () => { ); - it('SHOWS PlotlyFold', () => - expect(wrapper.find('div.fold').length).toEqual(1)); - it('SHOWS PlotlySection', () => - expect(wrapper.find('div.section').length).toEqual(1)); - it('HIDES Field', () => - expect(wrapper.find('input').length).toEqual(0)); + it('SHOWS PlotlyFold', () => expect(wrapper.find('div.fold').length).toEqual(1)); + it('SHOWS PlotlySection', () => expect(wrapper.find('div.section').length).toEqual(1)); + it('HIDES Field', () => expect(wrapper.find('input').length).toEqual(0)); }); describe('PlotlySection-with-invisible-attr', () => { @@ -326,12 +301,9 @@ describe('Basic PlotlyFold rules', () => { ); - it('HIDES PlotlyFold', () => - expect(wrapper.find('div.fold').length).toEqual(0)); - it('HIDES PlotlySection', () => - expect(wrapper.find('div.section').length).toEqual(0)); - it('HIDES Field', () => - expect(wrapper.find('input').length).toEqual(0)); + it('HIDES PlotlyFold', () => expect(wrapper.find('div.fold').length).toEqual(0)); + it('HIDES PlotlySection', () => expect(wrapper.find('div.section').length).toEqual(0)); + it('HIDES Field', () => expect(wrapper.find('input').length).toEqual(0)); }); }); }); @@ -351,10 +323,8 @@ describe('Other ways to force PlotlyFold visibility', () => { ); - it('shows PlotlyFold', () => - expect(wrapper.find('div.fold').length).toEqual(1)); - it('shows PlotlySection', () => - expect(wrapper.find('div.section').length).toEqual(1)); + it('shows PlotlyFold', () => expect(wrapper.find('div.fold').length).toEqual(1)); + it('shows PlotlySection', () => expect(wrapper.find('div.section').length).toEqual(1)); it('shows div', () => expect(wrapper.find('#thediv').length).toEqual(1)); }); @@ -373,13 +343,10 @@ describe('Other ways to force PlotlyFold visibility', () => { ); - it('shows PlotlyFold', () => - expect(wrapper.find('div.fold').length).toEqual(1)); - it('shows PlotlySection', () => - expect(wrapper.find('div.section').length).toEqual(1)); + it('shows PlotlyFold', () => expect(wrapper.find('div.fold').length).toEqual(1)); + it('shows PlotlySection', () => expect(wrapper.find('div.section').length).toEqual(1)); it('shows div', () => expect(wrapper.find('#thediv').length).toEqual(1)); - it('shows Field in PlotlySection', () => - expect(wrapper.find('input').length).toEqual(2)); + it('shows Field in PlotlySection', () => expect(wrapper.find('input').length).toEqual(2)); }); describe('adding a Field with invisible attr will hide PlotlyFold', () => { @@ -396,12 +363,9 @@ describe('Other ways to force PlotlyFold visibility', () => { ); - it('HIDES PlotlyFold', () => - expect(wrapper.find('div.fold').length).toEqual(0)); - it('HIDES PlotlySection', () => - expect(wrapper.find('div.section').length).toEqual(0)); - it('HIDES Field in PlotlySection', () => - expect(wrapper.find('input').length).toEqual(0)); + it('HIDES PlotlyFold', () => expect(wrapper.find('div.fold').length).toEqual(0)); + it('HIDES PlotlySection', () => expect(wrapper.find('div.section').length).toEqual(0)); + it('HIDES Field in PlotlySection', () => expect(wrapper.find('input').length).toEqual(0)); }); }); @@ -423,8 +387,7 @@ describe('PlotlyPanel > PlotlyFold > PlotlyPanel > PlotlyFold', () => { ); - it('HIDES PlotlyFold', () => - expect(wrapper.find('div.fold').length).toEqual(0)); + it('HIDES PlotlyFold', () => expect(wrapper.find('div.fold').length).toEqual(0)); it('HIDES div', () => expect(wrapper.find('#thediv').length).toEqual(0)); }); @@ -442,8 +405,7 @@ describe('PlotlyPanel > PlotlyFold > PlotlyPanel > PlotlyFold', () => { ); - it('HIDES PlotlyFold', () => - expect(wrapper.find('div.fold').length).toEqual(0)); + it('HIDES PlotlyFold', () => expect(wrapper.find('div.fold').length).toEqual(0)); it('HIDES Field', () => expect(wrapper.find('input').length).toEqual(0)); }); @@ -462,8 +424,7 @@ describe('PlotlyPanel > PlotlyFold > PlotlyPanel > PlotlyFold', () => { ); - it('HIDES PlotlyFold', () => - expect(wrapper.find('div.fold').length).toEqual(0)); + it('HIDES PlotlyFold', () => expect(wrapper.find('div.fold').length).toEqual(0)); it('HIDES Field', () => expect(wrapper.find('input').length).toEqual(0)); }); }); @@ -486,10 +447,8 @@ describe('PlotlyPanel > PlotlyFold > PlotlyPanel > PlotlyFold > PlotlySection', ); - it('HIDES PlotlyFold', () => - expect(wrapper.find('div.fold').length).toEqual(0)); - it('HIDES PlotlySection', () => - expect(wrapper.find('div.section').length).toEqual(0)); + it('HIDES PlotlyFold', () => expect(wrapper.find('div.fold').length).toEqual(0)); + it('HIDES PlotlySection', () => expect(wrapper.find('div.section').length).toEqual(0)); it('HIDES div', () => expect(wrapper.find('#thediv').length).toEqual(0)); }); @@ -509,10 +468,8 @@ describe('PlotlyPanel > PlotlyFold > PlotlyPanel > PlotlyFold > PlotlySection', ); - it('HIDES PlotlyFold', () => - expect(wrapper.find('div.fold').length).toEqual(0)); - it('HIDES PlotlySection', () => - expect(wrapper.find('div.section').length).toEqual(0)); + it('HIDES PlotlyFold', () => expect(wrapper.find('div.fold').length).toEqual(0)); + it('HIDES PlotlySection', () => expect(wrapper.find('div.section').length).toEqual(0)); it('HIDES Field', () => expect(wrapper.find('input').length).toEqual(0)); }); @@ -533,10 +490,8 @@ describe('PlotlyPanel > PlotlyFold > PlotlyPanel > PlotlyFold > PlotlySection', ); - it('HIDES PlotlyFold', () => - expect(wrapper.find('div.fold').length).toEqual(0)); - it('HIDES PlotlySection', () => - expect(wrapper.find('div.section').length).toEqual(0)); + it('HIDES PlotlyFold', () => expect(wrapper.find('div.fold').length).toEqual(0)); + it('HIDES PlotlySection', () => expect(wrapper.find('div.section').length).toEqual(0)); it('HIDES Field', () => expect(wrapper.find('input').length).toEqual(0)); }); }); @@ -562,10 +517,8 @@ describe('PlotlyPanel > PlotlyFold > PlotlyPanel-with-visible-attr > PlotlyFold ); - it('shows 2 PlotlyFolds', () => - expect(wrapper.find('div.fold').length).toEqual(2)); - it('shows PlotlySection', () => - expect(wrapper.find('div.section').length).toEqual(1)); + it('shows 2 PlotlyFolds', () => expect(wrapper.find('div.fold').length).toEqual(2)); + it('shows PlotlySection', () => expect(wrapper.find('div.section').length).toEqual(1)); it('shows div', () => expect(wrapper.find('#thediv').length).toEqual(1)); }); @@ -585,10 +538,8 @@ describe('PlotlyPanel > PlotlyFold > PlotlyPanel-with-visible-attr > PlotlyFold ); - it('shows 2 PlotlyFolds', () => - expect(wrapper.find('div.fold').length).toEqual(2)); - it('shows PlotlySection', () => - expect(wrapper.find('div.section').length).toEqual(1)); + it('shows 2 PlotlyFolds', () => expect(wrapper.find('div.fold').length).toEqual(2)); + it('shows PlotlySection', () => expect(wrapper.find('div.section').length).toEqual(1)); it('shows Field', () => expect(wrapper.find('input').length).toEqual(1)); }); @@ -609,10 +560,8 @@ describe('PlotlyPanel > PlotlyFold > PlotlyPanel-with-visible-attr > PlotlyFold ); - it('shows 2 PlotlyFolds', () => - expect(wrapper.find('div.fold').length).toEqual(2)); - it('shows PlotlySection', () => - expect(wrapper.find('div.section').length).toEqual(1)); + it('shows 2 PlotlyFolds', () => expect(wrapper.find('div.fold').length).toEqual(2)); + it('shows PlotlySection', () => expect(wrapper.find('div.section').length).toEqual(1)); it('HIDES Field', () => expect(wrapper.find('input').length).toEqual(0)); }); }); diff --git a/src/components/containers/__tests__/Layout-test.js b/src/components/containers/__tests__/Layout-test.js index 611154cf9..6620b3a91 100644 --- a/src/components/containers/__tests__/Layout-test.js +++ b/src/components/containers/__tests__/Layout-test.js @@ -6,9 +6,7 @@ import {TestEditor, fixtures} from 'lib/test-utils'; import {connectLayoutToPlot} from 'lib'; import {mount} from 'enzyme'; -const Layouts = [PlotlyPanel, PlotlyFold, PlotlySection].map( - connectLayoutToPlot -); +const Layouts = [PlotlyPanel, PlotlyFold, PlotlySection].map(connectLayoutToPlot); const Editor = props => ; Layouts.forEach(Layout => { diff --git a/src/components/containers/__tests__/PlotlySection-test.js b/src/components/containers/__tests__/PlotlySection-test.js index 75f8dbf7a..f14e4b617 100644 --- a/src/components/containers/__tests__/PlotlySection-test.js +++ b/src/components/containers/__tests__/PlotlySection-test.js @@ -16,10 +16,7 @@ describe('PlotlySection', () => { @@ -76,17 +73,10 @@ describe('TraceTypeSection', () => { const TraceSection = connectTraceToPlot(TraceTypeSection); const wrapper = mount( - + @@ -99,17 +89,10 @@ describe('TraceTypeSection', () => { const TraceSection = connectTraceToPlot(TraceTypeSection); const wrapper = mount( - + diff --git a/src/components/containers/__tests__/UnconnectedContainersVisibility-test.js b/src/components/containers/__tests__/UnconnectedContainersVisibility-test.js index 186191eb1..fc172067d 100644 --- a/src/components/containers/__tests__/UnconnectedContainersVisibility-test.js +++ b/src/components/containers/__tests__/UnconnectedContainersVisibility-test.js @@ -132,8 +132,7 @@ describe('Basic Section rules', () => { ); - it('SHOWS PlotlySection', () => - expect(wrapper.find('div.section').length).toEqual(1)); + it('SHOWS PlotlySection', () => expect(wrapper.find('div.section').length).toEqual(1)); it('SHOWS div', () => expect(wrapper.find('#thediv').length).toEqual(1)); }); }); @@ -151,8 +150,7 @@ describe('Basic Fold rules', () => { ); - it('SHOWS Fold', () => - expect(wrapper.find('div.fold').length).toEqual(1)); + it('SHOWS Fold', () => expect(wrapper.find('div.fold').length).toEqual(1)); it('HIDES Field because it has no context', () => expect(wrapper.find('input').length).toEqual(0)); }); @@ -168,8 +166,7 @@ describe('Basic Fold rules', () => { ); - it('SHOWS Fold', () => - expect(wrapper.find('div.fold').length).toEqual(1)); + it('SHOWS Fold', () => expect(wrapper.find('div.fold').length).toEqual(1)); it('SHOWS Field', () => expect(wrapper.find('input').length).toEqual(1)); }); @@ -184,8 +181,7 @@ describe('Basic Fold rules', () => { ); - it('SHOWS Fold', () => - expect(wrapper.find('div.fold').length).toEqual(1)); + it('SHOWS Fold', () => expect(wrapper.find('div.fold').length).toEqual(1)); it('HIDES Field', () => expect(wrapper.find('input').length).toEqual(0)); }); @@ -200,8 +196,7 @@ describe('Basic Fold rules', () => { ); - it('SHOWS Fold', () => - expect(wrapper.find('div.fold').length).toEqual(1)); + it('SHOWS Fold', () => expect(wrapper.find('div.fold').length).toEqual(1)); it('SHOWS div', () => expect(wrapper.find('#thediv').length).toEqual(1)); }); @@ -219,12 +214,9 @@ describe('Basic Fold rules', () => { ); - it('SHOWS Fold', () => - expect(wrapper.find('div.fold').length).toEqual(1)); - it('SHOWS PlotlySection', () => - expect(wrapper.find('div.section').length).toEqual(1)); - it('SHOWS div', () => - expect(wrapper.find('#thediv').length).toEqual(1)); + it('SHOWS Fold', () => expect(wrapper.find('div.fold').length).toEqual(1)); + it('SHOWS PlotlySection', () => expect(wrapper.find('div.section').length).toEqual(1)); + it('SHOWS div', () => expect(wrapper.find('#thediv').length).toEqual(1)); }); describe('Field-with-visible-attr', () => { @@ -239,12 +231,9 @@ describe('Basic Fold rules', () => { ); - it('SHOWS Fold', () => - expect(wrapper.find('div.fold').length).toEqual(1)); - it('SHOWS PlotlySection', () => - expect(wrapper.find('div.section').length).toEqual(1)); - it('SHOWS Field', () => - expect(wrapper.find('input').length).toEqual(1)); + it('SHOWS Fold', () => expect(wrapper.find('div.fold').length).toEqual(1)); + it('SHOWS PlotlySection', () => expect(wrapper.find('div.section').length).toEqual(1)); + it('SHOWS Field', () => expect(wrapper.find('input').length).toEqual(1)); }); describe('Field-with-invisible-attr', () => { @@ -260,12 +249,10 @@ describe('Basic Fold rules', () => { ); - it('SHOWS Fold', () => - expect(wrapper.find('div.fold').length).toEqual(1)); + it('SHOWS Fold', () => expect(wrapper.find('div.fold').length).toEqual(1)); it('HIDES PlotlySection because Plotly Section visibility rules apply', () => expect(wrapper.find('div.section').length).toEqual(0)); - it('HIDES Field', () => - expect(wrapper.find('input').length).toEqual(0)); + it('HIDES Field', () => expect(wrapper.find('input').length).toEqual(0)); }); }); }); @@ -284,12 +271,9 @@ describe('Basic Fold rules', () => { ); - it('SHOWS Fold', () => - expect(wrapper.find('div.fold').length).toEqual(1)); - it('SHOWS PlotlyPanel', () => - expect(wrapper.find('div.panel').length).toEqual(2)); - it('SHOWS Field', () => - expect(wrapper.find('input').length).toEqual(1)); + it('SHOWS Fold', () => expect(wrapper.find('div.fold').length).toEqual(1)); + it('SHOWS PlotlyPanel', () => expect(wrapper.find('div.panel').length).toEqual(2)); + it('SHOWS Field', () => expect(wrapper.find('input').length).toEqual(1)); }); }); @@ -305,10 +289,8 @@ describe('Basic Fold rules', () => { ); - it('SHOWS Fold', () => - expect(wrapper.find('div.fold').length).toEqual(1)); - it('SHOWS Info', () => - expect(wrapper.find('.js-test-info').length).toEqual(1)); + it('SHOWS Fold', () => expect(wrapper.find('div.fold').length).toEqual(1)); + it('SHOWS Info', () => expect(wrapper.find('.js-test-info').length).toEqual(1)); }); }); }); diff --git a/src/components/containers/derived.js b/src/components/containers/derived.js index 14ced08d5..2a2608f28 100644 --- a/src/components/containers/derived.js +++ b/src/components/containers/derived.js @@ -13,14 +13,10 @@ const TraceTypeSection = (props, context) => { const {mode, traceTypes} = props; const ifConnectedToTrace = - mode === 'trace' && - fullContainer && - traceTypes.includes(fullContainer.type); + mode === 'trace' && fullContainer && traceTypes.includes(fullContainer.type); const ifConnectedToLayout = - mode === 'layout' && - fullData && - fullData.some(t => traceTypes.includes(t.type)); + mode === 'layout' && fullData && fullData.some(t => traceTypes.includes(t.type)); if (ifConnectedToTrace || ifConnectedToLayout) { return ; diff --git a/src/components/fields/AxesCreator.js b/src/components/fields/AxesCreator.js index 76b0eb37a..10958ed9a 100644 --- a/src/components/fields/AxesCreator.js +++ b/src/components/fields/AxesCreator.js @@ -5,12 +5,7 @@ import React, {Component} from 'react'; import {EDITOR_ACTIONS} from 'lib/constants'; import Button from '../widgets/Button'; import {PlusIcon} from 'plotly-icons'; -import { - connectToContainer, - traceTypeToAxisType, - getAxisTitle, - axisIdToAxisName, -} from 'lib'; +import {connectToContainer, traceTypeToAxisType, getAxisTitle, axisIdToAxisName} from 'lib'; import {PlotlySection} from 'components'; class UnconnectedAxisCreator extends Component { @@ -28,8 +23,7 @@ class UnconnectedAxisCreator extends Component { onUpdate, fullLayout: {_subplots: subplots}, } = this.context; - const lastAxisNumber = - Number(subplots[attr][subplots[attr].length - 1].charAt(1)) || 1; + const lastAxisNumber = Number(subplots[attr][subplots[attr].length - 1].charAt(1)) || 1; updateContainer({ [attr]: attr.charAt(0) + (lastAxisNumber + 1), @@ -47,9 +41,7 @@ class UnconnectedAxisCreator extends Component { payload: { update: { [`${attr + (lastAxisNumber + 1)}.side`]: side, - [`${attr + (lastAxisNumber + 1)}.overlaying`]: !( - attr === 'yaxis' || attr === 'xaxis' - ) + [`${attr + (lastAxisNumber + 1)}.overlaying`]: !(attr === 'yaxis' || attr === 'xaxis') ? null : subplots[attr][subplots[attr].length - 1], }, @@ -66,8 +58,7 @@ class UnconnectedAxisCreator extends Component { currentAxisId !== update && !this.context.fullData.some( trace => - trace[this.props.attr] === currentAxisId && - trace.index !== this.props.fullContainer.index + trace[this.props.attr] === currentAxisId && trace.index !== this.props.fullContainer.index ) ) { axesToBeGarbageCollected.push(currentAxisId); @@ -86,11 +77,7 @@ class UnconnectedAxisCreator extends Component { render() { const icon = ; const extraComponent = this.canAddAxis() ? ( -
- {!( - glAvailable(this.props.container.type) && this.state.showGlControls - ) ? ( + {!(glAvailable(this.props.container.type) && this.state.showGlControls) ? ( '' ) : ( diff --git a/src/components/fields/UpdateMenuButtons.js b/src/components/fields/UpdateMenuButtons.js index b08447edd..3edf503b5 100644 --- a/src/components/fields/UpdateMenuButtons.js +++ b/src/components/fields/UpdateMenuButtons.js @@ -33,10 +33,7 @@ class UpdateMenuButtons extends Component { return ( {this.renderDropdown()} - + ); } diff --git a/src/components/fields/VisibilitySelect.js b/src/components/fields/VisibilitySelect.js index dac047d64..12513928a 100644 --- a/src/components/fields/VisibilitySelect.js +++ b/src/components/fields/VisibilitySelect.js @@ -22,8 +22,7 @@ class UnconnectedVisibilitySelect extends Component { setLocals(props) { this.mode = - props.fullValue === undefined || // eslint-disable-line no-undefined - props.fullValue === MULTI_VALUED_PLACEHOLDER + props.fullValue === undefined || props.fullValue === MULTI_VALUED_PLACEHOLDER // eslint-disable-line no-undefined ? this.props.defaultOpt : props.fullValue; } @@ -55,8 +54,7 @@ class UnconnectedVisibilitySelect extends Component { updatePlot={this.setMode} /> )} - {(Array.isArray(showOn) && showOn.includes(this.mode)) || - this.mode === showOn + {(Array.isArray(showOn) && showOn.includes(this.mode)) || this.mode === showOn ? this.props.children : null} @@ -75,11 +73,7 @@ UnconnectedVisibilitySelect.propTypes = { PropTypes.string, PropTypes.array, ]), - defaultOpt: PropTypes.oneOfType([ - PropTypes.number, - PropTypes.bool, - PropTypes.string, - ]), + defaultOpt: PropTypes.oneOfType([PropTypes.number, PropTypes.bool, PropTypes.string]), label: PropTypes.string, attr: PropTypes.string, ...Field.propTypes, diff --git a/src/components/fields/__tests__/AnnotationRef-test.js b/src/components/fields/__tests__/AnnotationRef-test.js index 2308dadf1..40f016858 100644 --- a/src/components/fields/__tests__/AnnotationRef-test.js +++ b/src/components/fields/__tests__/AnnotationRef-test.js @@ -5,9 +5,7 @@ import {PlotlyPanel} from '../../'; import {TestEditor, fixtures, plotly, mount} from 'lib/test-utils'; import {connectAnnotationToLayout, connectLayoutToPlot} from 'lib'; -const LayoutAnnoPanel = connectLayoutToPlot( - connectAnnotationToLayout(PlotlyPanel) -); +const LayoutAnnoPanel = connectLayoutToPlot(connectAnnotationToLayout(PlotlyPanel)); describe('', () => { function render(props) { @@ -38,9 +36,7 @@ describe('', () => { const fixtureProps = fixtures.scatter({ layout: {annotations: [{text: 'thor', ayref: 'y'}]}, }); - const drop = render({beforeUpdateLayout, ...fixtureProps}).find( - DropdownWidget - ); + const drop = render({beforeUpdateLayout, ...fixtureProps}).find(DropdownWidget); drop.prop('onChange')('y2'); @@ -56,9 +52,7 @@ describe('', () => { const fixtureProps = fixtures.scatter({ layout: {annotations: [{text: 'thor', ayref: 'y'}]}, }); - const drop = render({beforeUpdateLayout, ...fixtureProps}).find( - DropdownWidget - ); + const drop = render({beforeUpdateLayout, ...fixtureProps}).find(DropdownWidget); drop.prop('onChange')('paper'); const {update} = beforeUpdateLayout.mock.calls[0][0]; @@ -72,9 +66,7 @@ describe('', () => { const fixtureProps = fixtures.scatter({ layout: {annotations: [{text: 'thor', yref: 'y', ayref: 'pixel'}]}, }); - const drop = render({beforeUpdateLayout, ...fixtureProps}).find( - DropdownWidget - ); + const drop = render({beforeUpdateLayout, ...fixtureProps}).find(DropdownWidget); drop.prop('onChange')('y2'); const {update} = beforeUpdateLayout.mock.calls[0][0]; diff --git a/src/components/fields/__tests__/DataSelector-test.js b/src/components/fields/__tests__/DataSelector-test.js index 805a293d6..1c0c2fc3e 100644 --- a/src/components/fields/__tests__/DataSelector-test.js +++ b/src/components/fields/__tests__/DataSelector-test.js @@ -62,11 +62,7 @@ describe('DataSelector', () => { const TraceDataSelector = connectTraceToPlot(DataSelector); const wrapper = render( {}, - + ); expect(wrapper.find('.field__title-text').text()).toContain('rodoh'); }); diff --git a/src/components/fields/__tests__/Radio-test.js b/src/components/fields/__tests__/Radio-test.js index 005d01c54..16bff8544 100644 --- a/src/components/fields/__tests__/Radio-test.js +++ b/src/components/fields/__tests__/Radio-test.js @@ -16,10 +16,7 @@ describe('', () => { @@ -36,10 +33,7 @@ describe('', () => { center={false} label="Connect Gaps" attr="connectgaps" - options={[ - {label: 'Connect', value: true}, - {label: 'Blank', value: false}, - ]} + options={[{label: 'Connect', value: true}, {label: 'Blank', value: false}]} /> diff --git a/src/components/fields/derived.js b/src/components/fields/derived.js index e02f39cd9..332062afe 100644 --- a/src/components/fields/derived.js +++ b/src/components/fields/derived.js @@ -5,12 +5,7 @@ import {UnconnectedNumeric} from './Numeric'; import {UnconnectedAxisRangeValue} from './AxisRangeValue'; import {UnconnectedRadio} from './Radio'; import Info from './Info'; -import { - connectToContainer, - getAllAxes, - getAxisTitle, - axisIdToAxisName, -} from 'lib'; +import {connectToContainer, getAllAxes, getAxisTitle, axisIdToAxisName} from 'lib'; export const AxisAnchorDropdown = connectToContainer(UnconnectedDropdown, { modifyPlotProps: (props, context, plotProps) => { @@ -90,25 +85,16 @@ export const AxisSide = connectToContainer(UnconnectedRadio, { const _ = context.localize; if (plotProps.fullValue === 'left' || plotProps.fullValue === 'right') { - plotProps.options = [ - {label: _('Left'), value: 'left'}, - {label: _('Right'), value: 'right'}, - ]; + plotProps.options = [{label: _('Left'), value: 'left'}, {label: _('Right'), value: 'right'}]; return; } if (plotProps.fullValue === 'top' || plotProps.fullValue === 'bottom') { - plotProps.options = [ - {label: _('Top'), value: 'top'}, - {label: _('Bottom'), value: 'bottom'}, - ]; + plotProps.options = [{label: _('Top'), value: 'top'}, {label: _('Bottom'), value: 'bottom'}]; return; } - if ( - plotProps.fullValue === 'clockwise' || - plotProps.fullValue === 'counterclockwise' - ) { + if (plotProps.fullValue === 'clockwise' || plotProps.fullValue === 'counterclockwise') { plotProps.options = [ {label: _('Clockwise'), value: 'clockwise'}, {label: _('Counterclockwise'), value: 'counterclockwise'}, @@ -132,11 +118,7 @@ export const ContourNumeric = connectToContainer(UnconnectedNumeric, { export const BinningNumeric = connectToContainer(UnconnectedNumeric, { modifyPlotProps: (props, context, plotProps) => { const {fullContainer} = plotProps; - if ( - plotProps.isVisible && - fullContainer && - fullContainer[`autobin${props.axis}`] - ) { + if (plotProps.isVisible && fullContainer && fullContainer[`autobin${props.axis}`]) { plotProps.isVisible = false; } }, @@ -174,8 +156,7 @@ export const ShowInLegend = connectToContainer(UnconnectedRadio, { export const HistogramInfoVertical = connectToContainer(Info, { modifyPlotProps: (props, context, plotProps) => { plotProps.isVisible = - context.fullContainer.type === 'histogram' && - context.fullContainer.orientation === 'v'; + context.fullContainer.type === 'histogram' && context.fullContainer.orientation === 'v'; return plotProps; }, }); @@ -183,8 +164,7 @@ export const HistogramInfoVertical = connectToContainer(Info, { export const HistogramInfoHorizontal = connectToContainer(Info, { modifyPlotProps: (props, context, plotProps) => { plotProps.isVisible = - context.fullContainer.type === 'histogram' && - context.fullContainer.orientation === 'h'; + context.fullContainer.type === 'histogram' && context.fullContainer.orientation === 'h'; return plotProps; }, }); @@ -202,11 +182,7 @@ export const AxesRange = connectToContainer(UnconnectedAxisRangeValue, { export const NTicks = connectToContainer(UnconnectedNumeric, { modifyPlotProps: (props, context, plotProps) => { const {fullContainer} = plotProps; - if ( - plotProps.isVisible && - fullContainer && - fullContainer.tickmode !== 'auto' - ) { + if (plotProps.isVisible && fullContainer && fullContainer.tickmode !== 'auto') { plotProps.isVisible = false; } return plotProps; @@ -219,17 +195,12 @@ export const DTicks = connectToContainer(UnconnectedAxisRangeValue, { if ( fullContainer && fullContainer._name && - (fullContainer._name.startsWith('lat') || - fullContainer._name.startsWith('lon')) + (fullContainer._name.startsWith('lat') || fullContainer._name.startsWith('lon')) ) { // don't mess with visibility on geo axes return plotProps; } - if ( - plotProps.isVisible && - fullContainer && - fullContainer.tickmode !== 'linear' - ) { + if (plotProps.isVisible && fullContainer && fullContainer.tickmode !== 'linear') { plotProps.isVisible = false; } return plotProps; @@ -266,48 +237,42 @@ export const NumericFraction = connectToContainer(UnconnectedNumericFraction, { modifyPlotProps: numericFractionModifyPlotProps, }); -export const NumericFractionDomain = connectToContainer( - UnconnectedNumericFraction, - { - modifyPlotProps: (props, context, plotProps) => { - numericFractionModifyPlotProps(props, context, plotProps); - if (context.container && context.container.overlaying) { - plotProps.isVisible = null; - } - }, - } -); +export const NumericFractionDomain = connectToContainer(UnconnectedNumericFraction, { + modifyPlotProps: (props, context, plotProps) => { + numericFractionModifyPlotProps(props, context, plotProps); + if (context.container && context.container.overlaying) { + plotProps.isVisible = null; + } + }, +}); -export const NumericFractionInverse = connectToContainer( - UnconnectedNumericFraction, - { - modifyPlotProps: (props, context, plotProps) => { - const {attrMeta, fullValue, updatePlot} = plotProps; - if (isNumeric(fullValue)) { - plotProps.fullValue = Math.round((1 - fullValue) * 100); - } +export const NumericFractionInverse = connectToContainer(UnconnectedNumericFraction, { + modifyPlotProps: (props, context, plotProps) => { + const {attrMeta, fullValue, updatePlot} = plotProps; + if (isNumeric(fullValue)) { + plotProps.fullValue = Math.round((1 - fullValue) * 100); + } - plotProps.updatePlot = v => { - if (isNumeric(v)) { - updatePlot(1 - v / 100); - } else { - updatePlot(v); - } - }; + plotProps.updatePlot = v => { + if (isNumeric(v)) { + updatePlot(1 - v / 100); + } else { + updatePlot(v); + } + }; - // Also take the inverse of max and min. - if (attrMeta) { - if (isNumeric(attrMeta.min)) { - plotProps.max = (1 - attrMeta.min) * 100; - } + // Also take the inverse of max and min. + if (attrMeta) { + if (isNumeric(attrMeta.min)) { + plotProps.max = (1 - attrMeta.min) * 100; + } - if (isNumeric(attrMeta.max)) { - plotProps.min = (1 - attrMeta.max) * 100; - } + if (isNumeric(attrMeta.max)) { + plotProps.min = (1 - attrMeta.max) * 100; } - }, - } -); + } + }, +}); export const NumericReciprocal = connectToContainer(UnconnectedNumeric, { modifyPlotProps: (props, context, plotProps) => { @@ -394,9 +359,7 @@ export const AnnotationRef = connectToContainer(UnconnectedDropdown, { currentOffsetRef = ayref; } else { throw new Error( - _( - 'AnnotationRef must be given either "xref" or "yref" as attrs. Instead was given' - ) + + _('AnnotationRef must be given either "xref" or "yref" as attrs. Instead was given') + props.attr + '.' ); @@ -484,10 +447,7 @@ function computeAxesRefOptions(axes, propsAttr) { const options = []; for (let i = 0; i < axes.length; i++) { const ax = axes[i]; - if ( - ax._id.charAt(0) === propsAttr.charAt(0) || - ax._id.charAt(0) === propsAttr.charAt(1) - ) { + if (ax._id.charAt(0) === propsAttr.charAt(0) || ax._id.charAt(0) === propsAttr.charAt(1)) { const label = getAxisTitle(ax); options.push({label, value: ax._id}); } @@ -560,24 +520,15 @@ export const HoverInfo = connectToContainer(UnconnectedFlaglist, { ) { options.push({label: _('Z'), value: 'z'}); } else if (container.type === 'choropleth') { - options = [ - {label: _('Location'), value: 'location'}, - {label: _('Values'), value: 'z'}, - ]; + options = [{label: _('Location'), value: 'location'}, {label: _('Values'), value: 'z'}]; } else if (container.type === 'scattergeo') { if (container.locations) { options = [{label: _('Location'), value: 'location'}]; } else if (container.lat || container.lon) { - options = [ - {label: _('Longitude'), value: 'lon'}, - {label: _('Latitude'), value: 'lat'}, - ]; + options = [{label: _('Longitude'), value: 'lon'}, {label: _('Latitude'), value: 'lat'}]; } } else if (container.type === 'scattermapbox') { - options = [ - {label: _('Longitude'), value: 'loc'}, - {label: _('Latitude'), value: 'lat'}, - ]; + options = [{label: _('Longitude'), value: 'loc'}, {label: _('Latitude'), value: 'lat'}]; } else if (container.type === 'scatterternary') { options = [ {label: _('A'), value: 'a'}, @@ -585,10 +536,7 @@ export const HoverInfo = connectToContainer(UnconnectedFlaglist, { {label: _('C'), value: 'c'}, ]; } else if (['scatterpolar', 'scatterpolargl'].includes(container.type)) { - options = [ - {label: _('R'), value: 'r'}, - {label: _('Theta'), value: 'theta'}, - ]; + options = [{label: _('R'), value: 'r'}, {label: _('Theta'), value: 'theta'}]; } else if (container.type === 'pie') { options = [ {label: _('Label'), value: 'label'}, @@ -646,10 +594,7 @@ export const FillDropdown = connectToContainer(UnconnectedDropdown, { context.container.type === 'scattergeo' || context.container.type === 'scattermapbox' ) { - options = [ - {label: _('None'), value: 'none'}, - {label: _('To Self'), value: 'toself'}, - ]; + options = [{label: _('None'), value: 'none'}, {label: _('To Self'), value: 'toself'}]; } plotProps.options = options; @@ -701,10 +646,7 @@ export const HovermodeDropdown = connectToContainer(UnconnectedDropdown, { {label: _('Y Axis'), value: 'y'}, {label: _('Disable'), value: false}, ] - : [ - {label: _('Closest'), value: 'closest'}, - {label: _('Disable'), value: false}, - ]; + : [{label: _('Closest'), value: 'closest'}, {label: _('Disable'), value: false}]; plotProps.clearable = false; }, }); diff --git a/src/components/sidebar/SidebarGroup.js b/src/components/sidebar/SidebarGroup.js index 93897cddd..86ebac99a 100644 --- a/src/components/sidebar/SidebarGroup.js +++ b/src/components/sidebar/SidebarGroup.js @@ -27,8 +27,7 @@ export default class SidebarGroup extends Component { renderSubItem(panel, i) { const isActive = - this.props.selectedPanel === panel && - this.props.group === this.props.selectedGroup; + this.props.selectedPanel === panel && this.props.group === this.props.selectedGroup; return ( -
+
diff --git a/src/components/sidebar/SidebarItem.js b/src/components/sidebar/SidebarItem.js index fa31d97a1..847e19aa4 100644 --- a/src/components/sidebar/SidebarItem.js +++ b/src/components/sidebar/SidebarItem.js @@ -6,10 +6,7 @@ export default class SidebarItem extends Component { render() { const {onClick, label, active} = this.props; return ( -
+
{label}
diff --git a/src/components/widgets/Button.js b/src/components/widgets/Button.js index cebe64a63..d4d882708 100644 --- a/src/components/widgets/Button.js +++ b/src/components/widgets/Button.js @@ -22,9 +22,7 @@ class Button extends Component { classes += ` ${className}`; } - const Icon = icon ? ( -
{icon}
- ) : null; + const Icon = icon ?
{icon}
: null; return (