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

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.1",
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,9 @@
1
1
  # Charts Library Release Notes
2
2
 
3
+ ## 2.13.1
4
+
5
+ - Text label for drag options trigger, to make current behaviour more obvious ([OW-11102](https://oliasoft.atlassian.net/browse/OW-11102))
6
+
3
7
  ## 2.13.0
4
8
 
5
9
  - 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
  };