@oliasoft-open-source/charts-library 2.13.0 → 2.13.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oliasoft-open-source/charts-library",
3
- "version": "2.13.0",
3
+ "version": "2.13.2",
4
4
  "description": "React Chart Library (based on Chart.js and react-chart-js-2)",
5
5
  "homepage": "https://gitlab.com/oliasoft-open-source/charts-library",
6
6
  "bugs": {
package/release-notes.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Charts Library Release Notes
2
2
 
3
+ ## 2.13.2
4
+
5
+ - Changed default value for zoom to true
6
+
7
+ ## 2.13.1
8
+
9
+ - Text label for drag options trigger, to make current behaviour more obvious ([OW-11102](https://oliasoft.atlassian.net/browse/OW-11102))
10
+
3
11
  ## 2.13.0
4
12
 
5
13
  - Added feature to save state to localStorage and clean when expired, fixed panEnable(state) bug.
@@ -66,16 +66,6 @@ const Controls = ({
66
66
  legendEnabled={legendEnabled}
67
67
  onToggleLegend={onToggleLegend}
68
68
  />
69
- <DragOptions
70
- panEnabled={panEnabled}
71
- zoomEnabled={zoomEnabled}
72
- onTogglePan={onTogglePan}
73
- onToggleZoom={onToggleZoom}
74
- enableDragPoints={enableDragPoints}
75
- isDragDataAllowed={isDragDataAllowed}
76
- onToggleDragPoints={onToggleDragPoints}
77
- onDisableDragOptions={onDisableDragOptions}
78
- />
79
69
  <Tooltip text="Download as PNG" placement="bottom-end">
80
70
  <Button
81
71
  small
@@ -86,6 +76,16 @@ const Controls = ({
86
76
  onClick={onDownload}
87
77
  />
88
78
  </Tooltip>
79
+ <DragOptions
80
+ panEnabled={panEnabled}
81
+ zoomEnabled={zoomEnabled}
82
+ onTogglePan={onTogglePan}
83
+ onToggleZoom={onToggleZoom}
84
+ enableDragPoints={enableDragPoints}
85
+ isDragDataAllowed={isDragDataAllowed}
86
+ onToggleDragPoints={onToggleDragPoints}
87
+ onDisableDragOptions={onDisableDragOptions}
88
+ />
89
89
  </>
90
90
  )}
91
91
 
@@ -19,25 +19,10 @@ export const DragOptions = ({
19
19
  onToggleDragPoints,
20
20
  onDisableDragOptions,
21
21
  }) => {
22
- const handleToggleZoom = () => {
23
- if (isDragDataAllowed) {
24
- onToggleZoom();
25
- } else {
26
- onToggleZoom();
27
- onTogglePan();
28
- }
29
- };
30
-
31
- const handleToggleDragPoints = () => {
32
- if (isDragDataAllowed) {
33
- onDisableDragOptions();
34
- } else {
35
- onToggleZoom();
36
- }
37
- };
38
22
  // TODO: Translate strings
39
23
  const options = [
40
24
  {
25
+ buttonLabel: 'Drag to zoom',
41
26
  label: (
42
27
  <Flex direction="column">
43
28
  <Text>Drag to zoom</Text>
@@ -51,9 +36,10 @@ export const DragOptions = ({
51
36
  ),
52
37
  icon: <RiZoomInLine />,
53
38
  selected: zoomEnabled,
54
- onClick: handleToggleZoom,
39
+ onClick: onToggleZoom,
55
40
  },
56
41
  {
42
+ buttonLabel: 'Drag to pan',
57
43
  label: (
58
44
  <Flex direction="column">
59
45
  <Text>Drag to pan</Text>
@@ -84,7 +70,7 @@ export const DragOptions = ({
84
70
  label: 'Drag disabled',
85
71
  icon: <RiForbidLine />,
86
72
  selected: !zoomEnabled && !panEnabled && !enableDragPoints,
87
- onClick: handleToggleDragPoints,
73
+ onClick: onDisableDragOptions,
88
74
  },
89
75
  ];
90
76
 
@@ -100,34 +86,13 @@ export const DragOptions = ({
100
86
  );
101
87
 
102
88
  return (
103
- <Tooltip text={selectedOption.label} placement="bottom-end">
104
- {!isDragDataAllowed ? (
105
- <Button
106
- small
107
- basic
108
- colored="muted"
109
- round
110
- icon={selectedOption.icon}
111
- onClick={selectedOption.onClick}
112
- />
113
- ) : (
114
- <Menu
115
- menu={{
116
- component: (
117
- <Button
118
- small
119
- basic
120
- colored="muted"
121
- round
122
- icon={selectedOption.icon}
123
- />
124
- ),
125
- label: 'Select',
126
- sections: optionsWithDragPoints,
127
- trigger: 'Component',
128
- }}
129
- />
130
- )}
131
- </Tooltip>
89
+ <Menu
90
+ menu={{
91
+ label: selectedOption.buttonLabel || selectedOption.label,
92
+ sections: optionsWithDragPoints,
93
+ trigger: 'DropDownButton',
94
+ small: true,
95
+ }}
96
+ />
132
97
  );
133
98
  };
@@ -216,7 +216,7 @@ export const getDefaultProps = (props) => {
216
216
  },
217
217
  chartOptions: {
218
218
  showPoints: props.chart.options.chartOptions.showPoints ?? true,
219
- enableZoom: props.chart.options.chartOptions.enableZoom || false,
219
+ enableZoom: props.chart.options.chartOptions.enableZoom || true,
220
220
  enablePan: props.chart.options.chartOptions.enablePan || false,
221
221
  showLine: props.chart.options.chartOptions.showLine ?? true,
222
222
  closeOnOutsideClick: