Skip to content

Commit 2ce8c8a

Browse files
Moving aggregation-only transforms out of dev (#459)
* various adjustments for aggregation transforms * move transforms out of dev
1 parent c11be32 commit 2ce8c8a

File tree

9 files changed

+45
-32
lines changed

9 files changed

+45
-32
lines changed

dev/App.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import 'react-select/dist/react-select.css';
66
import brace from 'brace'; // eslint-disable-line no-unused-vars
77
import AceEditor from 'react-ace';
88
import Select from 'react-select';
9-
import PlotlyEditor, {DefaultEditor, Panel, GraphTransformsPanel} from '../src';
9+
import PlotlyEditor, {DefaultEditor, Panel} from '../src';
1010
import Inspector from 'react-inspector';
1111
import 'brace/mode/json';
1212
import 'brace/theme/textmate';
@@ -119,7 +119,6 @@ class App extends Component {
119119
showFieldTooltips
120120
>
121121
<DefaultEditor>
122-
<GraphTransformsPanel group="Dev" name="Transforms" />
123122
<Panel group="Dev" name="JSON">
124123
<div className="mocks">
125124
<Select

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"fast-isnumeric": "^1.1.1",
1616
"immutability-helper": "^2.6.4",
1717
"plotly-icons": "latest",
18-
"plotly.js": "^1.36.1",
18+
"plotly.js": "1.37.1",
1919
"prop-types": "^15.5.10",
2020
"raf": "^3.4.0",
2121
"react-color": "^2.13.8",

src/DefaultEditor.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
33
import {PanelMenuWrapper} from './components';
44
import {
55
GraphCreatePanel,
6+
GraphTransformsPanel,
67
StyleLayoutPanel,
78
StyleAxesPanel,
89
StyleLegendPanel,
@@ -21,6 +22,7 @@ class DefaultEditor extends Component {
2122
return (
2223
<PanelMenuWrapper>
2324
<GraphCreatePanel group={_('Graph')} name={_('Create')} />
25+
<GraphTransformsPanel group={_('Graph')} name={_('Transforms')} />
2426
<StyleTracesPanel group={_('Style')} name={_('Traces')} />
2527
<StyleLayoutPanel group={_('Style')} name={_('Layout')} />
2628
<StyleNotesPanel group={_('Style')} name={_('Notes')} />

src/components/containers/TransformAccordion.js

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,25 @@ class TransformAccordion extends Component {
3131
</TransformFold>
3232
));
3333

34+
const handlers = transformTypes.map(({label, type}) => {
35+
return {
36+
label,
37+
handler: context => {
38+
const {fullContainer, updateContainer} = context;
39+
if (updateContainer) {
40+
const transformIndex = Array.isArray(fullContainer.transforms)
41+
? fullContainer.transforms.length
42+
: 0;
43+
const key = `transforms[${transformIndex}]`;
44+
updateContainer({[key]: {type}});
45+
}
46+
},
47+
};
48+
});
49+
3450
const addAction = {
35-
label: _('Transform'),
36-
handler: transformTypes.map(({label, type}) => {
37-
return {
38-
label,
39-
handler: context => {
40-
const {fullContainer, updateContainer} = context;
41-
if (updateContainer) {
42-
const transformIndex = Array.isArray(fullContainer.transforms)
43-
? fullContainer.transforms.length
44-
: 0;
45-
const key = `transforms[${transformIndex}]`;
46-
updateContainer({[key]: {type}});
47-
}
48-
},
49-
};
50-
}),
51+
label: _('Aggregation'),
52+
handler: handlers[2].handler,
5153
};
5254

5355
return (

src/components/fields/DataSelector.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,15 @@ export class UnconnectedDataSelector extends Component {
2929
this.srcProperty = nestedProperty(props.container, this.srcAttr);
3030
this.fullValue = this.srcProperty.get();
3131

32-
this.is2D =
33-
(props.attr === 'z' &&
34-
['contour', 'heatmap', 'surface', 'heatmapgl'].includes(
35-
props.container.type
36-
)) ||
37-
(props.container.type === 'table' && props.attr !== 'columnorder');
32+
this.is2D = false;
33+
if (props.container) {
34+
this.is2D =
35+
(props.attr === 'z' &&
36+
['contour', 'heatmap', 'surface', 'heatmapgl'].includes(
37+
props.container.type
38+
)) ||
39+
(props.container.type === 'table' && props.attr !== 'columnorder');
40+
}
3841
}
3942

4043
updatePlot(value) {

src/default_panels/GraphTransformsPanel.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,7 @@ const GraphTransformsPanel = (props, {localize: _}) => {
6464

6565
<DataSelector label={_('By')} attr="groups" />
6666

67-
<PlotlySection name={_('Aggregations')} attr="aggregations">
68-
<Aggregations />
69-
</PlotlySection>
67+
<Aggregations />
7068
</TransformAccordion>
7169
</TraceAccordion>
7270
);

src/lib/connectAggregationToTransform.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default function connectAggregationToTransform(WrappedComponent) {
1919
const {aggregationIndex} = props;
2020
const {container, fullContainer} = context;
2121

22-
const aggregations = container.aggregations || [];
22+
const aggregations = (container && container.aggregations) || [];
2323
const fullAggregations = fullContainer.aggregations || [];
2424
this.container = aggregations[aggregationIndex];
2525
this.fullContainer = fullAggregations[aggregationIndex];

src/styles/components/containers/_panel.scss

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,10 @@
9292
padding: 0;
9393
}
9494
}
95+
96+
.fold {
97+
.panel {
98+
overflow-y: initial;
99+
overflow-x: initial;
100+
}
101+
}

src/styles/components/widgets/_microtip.scss

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
transform: translate3d(0, 0, 0);
2727
-webkit-backface-visibility: hidden;
2828
backface-visibility: hidden;
29+
display: none;
2930
will-change: transform;
3031
opacity: 0;
3132
pointer-events: none;
@@ -62,6 +63,7 @@
6263
[aria-label][role~='tooltip']:focus::after {
6364
opacity: 1;
6465
pointer-events: auto;
66+
display: block;
6567
}
6668

6769
/* ------------------------------------------------
@@ -143,7 +145,7 @@
143145
[role~='tooltip'][data-microtip-position|='bottom']::before {
144146
transform: translate3d(-50%, -10px, 0);
145147
bottom: auto;
146-
left: 50%;
148+
left: 10px;
147149
top: 100%;
148150
}
149151

@@ -153,8 +155,8 @@
153155

154156
[role~='tooltip'][data-microtip-position|='bottom']::after {
155157
transform: translate3d(-50%, -10px, 0);
158+
left: 10px;
156159
top: 100%;
157-
left: 50%;
158160
}
159161

160162
[role~='tooltip'][data-microtip-position='bottom']:hover::after {
@@ -254,7 +256,7 @@
254256

255257
[role~='tooltip'][data-microtip-size='medium']::after {
256258
white-space: initial;
257-
width: 150px;
259+
width: 140px;
258260
}
259261

260262
[role~='tooltip'][data-microtip-size='large']::after {

0 commit comments

Comments
 (0)