Skip to content

Commit c0f4968

Browse files
committed
refactor: remove ChartMeasures component from commons package and update block imports.
1 parent aa32ec0 commit c0f4968

5 files changed

Lines changed: 138 additions & 370 deletions

File tree

packages/commons/README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ This package is used internally by DevGateway projects and is designed to be com
3434

3535
- **ChartColors**: Provides color schemes (categorical, sequential, diverging) for charts.
3636
- **ChartLegends**: Customizable legend components for charts.
37-
- **ChartMeasures**: Components for configuring chart measures.
3837
- **Measures**: Utilities for handling data measures.
3938
- **Tooltip**: Customizable tooltip component for charts.
4039

@@ -104,7 +103,6 @@ This package is used internally by DevGateway projects and is designed to be com
104103

105104
- **ChartColorsProps**: Props for chart colors component.
106105
- **ChartLegendsProps**: Props for chart legends component.
107-
- **ChartMeasuresProps**: Props for chart measures component.
108106
- **FormatProps**: Props for format component.
109107
- **MeasuresProps**: Props for measures component.
110108
- **DataFiltersProps**: Props for data filters component.

packages/commons/src/ChartMeasures.jsx

Lines changed: 0 additions & 230 deletions
This file was deleted.

packages/commons/src/index.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ export {
88
BlockEditWithAPIMetadata, BlockEditWithFilters, ComponentWithSettings, SizeConfig
99
} from './Blocks';
1010

11-
export {categorical, sequential, diverging, ChartColors} from './ChartColors';
11+
export { categorical, sequential, diverging, ChartColors } from './ChartColors';
1212

1313

14-
export {DEFAULT_FORMAT_SETTINGS, BLOCKS_CATEGORY, BLOCKS_NS} from './Constants';
14+
export { DEFAULT_FORMAT_SETTINGS, BLOCKS_CATEGORY, BLOCKS_NS } from './Constants';
1515

16-
export {CSVConfig} from './CSVSourceConfig';
16+
export { CSVConfig } from './CSVSourceConfig';
1717
export {
1818
DataFilters,
1919
} from './DataFilters';
@@ -42,7 +42,7 @@ export {
4242
panelFocus, togglePanel
4343
} from './Util';
4444

45-
export {ChartLegends} from './ChartLegends';
46-
export {ChartMeasures} from './ChartMeasures';
47-
export {GenericIcon, ChartIcon} from './icons/index';
48-
export {CSVConfig as CSVSourceConfig} from './CSVSourceConfig';
45+
export { ChartLegends } from './ChartLegends';
46+
47+
export { GenericIcon, ChartIcon } from './icons/index';
48+
export { CSVConfig as CSVSourceConfig } from './CSVSourceConfig';

plugins/wp-react-blocks-plugin/blocks/charts/LineOverlayConfig.jsx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ import {
77
TextareaControl,
88
TextControl
99
} from '@wordpress/components';
10-
import {PanelColorSettings} from '@wordpress/block-editor';
11-
import {__} from '@wordpress/i18n';
12-
import {togglePanel, ChartMeasures} from '@devgateway/dvz-wp-commons';
10+
import { PanelColorSettings } from '@wordpress/block-editor';
11+
import { __ } from '@wordpress/i18n';
12+
import { togglePanel, Measures } from '@devgateway/dvz-wp-commons';
1313

1414
const overLayPrototype = (preFillCsv) => {
1515
return {
@@ -29,7 +29,7 @@ const LineOverlay = (props) => {
2929
allMeasures,
3030
allCategories,
3131
apps,
32-
attributes: {panelStatus, overlays, dimension1, app}
32+
attributes: { panelStatus, overlays, dimension1, app }
3333
} = props;
3434

3535

@@ -42,30 +42,30 @@ const LineOverlay = (props) => {
4242
preFillCsv = cat ? cat.items.sort((s1, s2) => s1.position - s2.position).map(i => i.value).join(",\r\n") + "," : ""
4343
}
4444
const newOverlay = [...overlays, overLayPrototype(preFillCsv)];
45-
setAttributes({overlays: newOverlay});
45+
setAttributes({ overlays: newOverlay });
4646
};
4747

4848

4949
const remove = () => {
5050
const newOverlay = [...overlays]
5151
newOverlay.pop()
52-
setAttributes({overlays: newOverlay})
52+
setAttributes({ overlays: newOverlay })
5353

5454
}
5555

5656
const onChange = (idx, attribute, value) => {
5757
const newOverlay = [...overlays]
5858
newOverlay[idx][attribute] = value
5959

60-
setAttributes({overlays: newOverlay})
60+
setAttributes({ overlays: newOverlay })
6161
}
6262

6363
return <>{overlays && overlays.map((o, idx) => {
6464
const overlayMeasures = {}
6565
overlayMeasures[o.app] = {}
66-
overlayMeasures[o.app][o.measure] = {selected: true}
66+
overlayMeasures[o.app][o.measure] = { selected: true }
6767
return <PanelBody title={o.title} panelStatus={panelStatus['series_'] + idx}
68-
onToggle={e => togglePanel(panelStatus['series_'] + idx, panelStatus, setAttributes)}>
68+
onToggle={e => togglePanel(panelStatus['series_'] + idx, panelStatus, setAttributes)}>
6969

7070
<PanelRow>
7171
<SelectControl
@@ -94,7 +94,7 @@ const LineOverlay = (props) => {
9494
</PanelRow>}
9595

9696
{o.app != "csv" &&
97-
<ChartMeasures
97+
<Measures
9898
title={"Select Measure"}
9999
onMeasuresChange={e => null}
100100
onFormatChange={a => alert("format")}
@@ -146,11 +146,11 @@ const LineOverlay = (props) => {
146146
<PanelRow>
147147
<ButtonGroup>
148148
<Button isSecondary={true}
149-
onClick={add}>
149+
onClick={add}>
150150
{__("Add Series")}
151151
</Button>
152152
<Button isSecondary={true}
153-
onClick={remove}>
153+
onClick={remove}>
154154
{__("Remove Series")}
155155
</Button>
156156
</ButtonGroup>

0 commit comments

Comments
 (0)