@oliasoft-open-source/charts-library 2.17.3 → 2.17.5

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.17.3",
3
+ "version": "2.17.5",
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": {
@@ -49,8 +49,8 @@
49
49
  "@babel/eslint-parser": "^7.18.9",
50
50
  "@babel/preset-env": "^7.18.10",
51
51
  "@babel/preset-react": "^7.18.6",
52
- "@oliasoft-open-source/react-ui-library": "3.3.12",
53
- "@oliasoft-open-source/units": "2.6.1",
52
+ "@oliasoft-open-source/react-ui-library": "^3.4.2",
53
+ "@oliasoft-open-source/units": "^2.6.1",
54
54
  "@storybook/addon-actions": "^6.5.10",
55
55
  "@storybook/addon-docs": "^6.5.10",
56
56
  "@storybook/addon-links": "^6.5.10",
@@ -95,7 +95,7 @@
95
95
  "webpack-merge": "^5.8.0"
96
96
  },
97
97
  "peerDependencies": {
98
- "@oliasoft-open-source/react-ui-library": "^3",
98
+ "@oliasoft-open-source/react-ui-library": "^3.4.2",
99
99
  "@oliasoft-open-source/units": "^2.6.1",
100
100
  "immer": "^9",
101
101
  "prop-types": "^15",
package/release-notes.md CHANGED
@@ -1,8 +1,16 @@
1
1
  # Charts Library Release Notes
2
2
 
3
+ ## 2.17.5
4
+
5
+ - Support disabling `usePointStyle` to show dashed lines in legend ([OW-11786](https://oliasoft.atlassian.net/browse/OW-11786))
6
+
7
+ ## 2.17.4
8
+
9
+ - Use new `<NumberInput>` component from GUI Library in charts controls, to simplify validation ([OW-11773](https://oliasoft.atlassian.net/browse/OW-11773))
10
+
3
11
  ## 2.17.3
4
12
 
5
- - Replace legacy internal implementation of `isEqualWithTolerance` with `isCloseTo` from units package [OW-11767](https://oliasoft.atlassian.net/browse/OW-11767)
13
+ - Replace legacy internal implementation of `isEqualWithTolerance` with `isCloseTo` from units package ([OW-11767](https://oliasoft.atlassian.net/browse/OW-11767))
6
14
 
7
15
  ## 2.17.2
8
16
 
@@ -4,7 +4,7 @@ import {
4
4
  ButtonGroup,
5
5
  Field,
6
6
  Flex,
7
- Input,
7
+ NumberInput,
8
8
  InputGroup,
9
9
  InputGroupAddon,
10
10
  Popover,
@@ -122,7 +122,7 @@ const AxesOptionsPopover = ({
122
122
  return (
123
123
  <Field key={i} label={axisLabel || axis.id || ''}>
124
124
  <InputGroup small>
125
- <Input
125
+ <NumberInput
126
126
  name="min"
127
127
  value={min}
128
128
  error={translations[minError]}
@@ -138,7 +138,7 @@ const AxesOptionsPopover = ({
138
138
  onFocus={handleInputFocus}
139
139
  />
140
140
  <InputGroupAddon>to</InputGroupAddon>
141
- <Input
141
+ <NumberInput
142
142
  name="max"
143
143
  value={max}
144
144
  error={translations[maxError]}
@@ -1,9 +1,5 @@
1
1
  import { produce } from 'immer';
2
- import {
3
- isGreaterThanMin,
4
- isLessThanMax,
5
- validNumber,
6
- } from '../../utils/line-chart-utils';
2
+ import { isGreaterThanMin, isLessThanMax } from '../../utils/line-chart-utils';
7
3
  import { actionTypes } from './action-types';
8
4
 
9
5
  /**
@@ -37,7 +33,6 @@ const isEmptyString = (value) => value === '';
37
33
  const createErrorMessages = (value, compareTo, type) => {
38
34
  const errors = [];
39
35
  if (isEmptyString(value)) errors.push('mustHaveAValue');
40
- if (!validNumber(value)) errors.push('mustBeANumber');
41
36
 
42
37
  if (type === 'min' && !isLessThanMax(value, compareTo)) {
43
38
  errors.push('mustBeLessThanMax');
@@ -258,6 +258,7 @@ export const getDefaultProps = (props) => {
258
258
  position: props.chart.options.legend.position || 'bottom',
259
259
  align: props.chart.options.legend.align || 'center',
260
260
  customLegend: props.chart.options.legend.customLegend,
261
+ usePointStyle: props.chart.options.legend.usePointStyle ?? true,
261
262
  },
262
263
  chartOptions: {
263
264
  showPoints: props.chart.options.chartOptions.showPoints ?? true,
@@ -1,8 +1,4 @@
1
- import { toNum as toNumber, isValidNum } from '@oliasoft-open-source/units';
2
-
3
- const isOnlyNumbers = (str) => /^-?\d*\.?\d+$/.test(str);
4
-
5
- export const validNumber = (input) => isValidNum(input) && isOnlyNumbers(input);
1
+ import { toNum as toNumber } from '@oliasoft-open-source/units';
6
2
 
7
3
  export const toNum = (value) => {
8
4
  const asNumber = toNumber(value);
@@ -63,6 +63,7 @@ export interface IChartLegend {
63
63
  position: 'top' | 'bottom' | 'right';
64
64
  align: 'start' | 'center' | 'end';
65
65
  customLegend?: ICustomLegend;
66
+ usePointStyle: boolean;
66
67
  }
67
68
 
68
69
  export interface IChartInteractions {
@@ -141,8 +141,8 @@ export const getLegend = (options, clickHandler, state = null) => {
141
141
  align: legend.align,
142
142
  labels: {
143
143
  boxHeight: LEGEND_LABEL_BOX_SIZE,
144
- boxWidth: LEGEND_LABEL_BOX_SIZE,
145
- usePointStyle: true,
144
+ boxWidth: legend.usePointStyle ? LEGEND_LABEL_BOX_SIZE : undefined,
145
+ usePointStyle: legend.usePointStyle,
146
146
  },
147
147
  onClick: clickHandler,
148
148
  };