@oliasoft-open-source/charts-library 4.8.3-beta-4 → 4.8.3-beta-6

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.
@@ -81,5 +81,5 @@ export declare const getTooltipLabel: (tooltipItem: Record<string, any>, showLab
81
81
  export declare const getChartFileName: (axes?: IAxis[]) => string;
82
82
  export declare const setDefaultTheme: () => void;
83
83
  export declare const isNilOrEmpty: <T>(value: T | null | undefined) => boolean;
84
- export declare const generateRandomKey: () => string;
84
+ export declare const isEmptyString: (value: string) => value is "";
85
85
  export {};
@@ -1,7 +1,7 @@
1
1
  import { RefObject } from 'react';
2
2
  import { Chart } from 'chart.js';
3
3
  import { IUnitOptions } from '../../line-chart.interface';
4
- import { IAxisState } from '../../state/state.interfaces';
4
+ import { IAxisState, IState } from '../../state/state.interfaces';
5
5
  export interface IDepthType {
6
6
  selectedDepthType?: string;
7
7
  setSelectedDepthType?: (type: string) => void;
@@ -13,7 +13,7 @@ export interface IAxisControlLabel {
13
13
  }
14
14
  export interface IAxesOptions {
15
15
  chartRef: RefObject<Chart>;
16
- axes: IAxisState[];
16
+ state: IState;
17
17
  controlsAxesLabels: IAxisControlLabel[];
18
18
  onUpdateAxes: ({ axes }: {
19
19
  axes: IAxisState;
@@ -0,0 +1,8 @@
1
+ import { IAxisFormState, IError } from './axes-options-interfaces';
2
+ /**
3
+ * Validate axes and return errors along with a validity flag.
4
+ */
5
+ export declare const validateAxes: (axes: IAxisFormState[]) => {
6
+ errors: IError[];
7
+ valid: boolean;
8
+ };
@@ -4,7 +4,7 @@ import { ILineChartOptions, TGeneratedLineChartDatasets } from '../line-chart.in
4
4
  import { IState } from '../state/state.interfaces';
5
5
  export interface IControls {
6
6
  headerComponent?: ReactNode;
7
- subheaderComponent?: Element;
7
+ subheaderComponent?: ReactNode;
8
8
  table?: ReactNode;
9
9
  chartRef: RefObject<Chart>;
10
10
  state: IState;
@@ -1,6 +1,3 @@
1
1
  import { IControls } from './controls-interfaces';
2
- /**
3
- * @param {import('./controls-interfaces').IControls} obj
4
- */
5
- declare const Controls: ({ headerComponent, subheaderComponent, table, chartRef, state, options, dispatch, generatedDatasets, translations, controlsPortalId, }: IControls) => import("react/jsx-runtime").JSX.Element;
2
+ declare const Controls: ({ table, headerComponent, subheaderComponent, chartRef, state, options, dispatch, generatedDatasets, translations, controlsPortalId, }: IControls) => import("react/jsx-runtime").JSX.Element;
6
3
  export default Controls;
@@ -46,6 +46,8 @@ export interface ILineChartAxis<PositionType = any> {
46
46
  unit?: IUnitOptions;
47
47
  stepSize?: number;
48
48
  gridLines?: ILineChartGraph;
49
+ min?: number | string;
50
+ max?: number | string;
49
51
  }
50
52
  export interface ILineChartAxes {
51
53
  x: ILineChartAxis<'top' | 'bottom'>[];
@@ -112,6 +114,8 @@ export interface ILineChartData extends ICommonData {
112
114
  export interface ILineChartProps {
113
115
  chart: ILineChartData;
114
116
  table?: ReactNode;
117
+ headerComponent?: ReactNode;
118
+ subheaderComponent?: ReactNode;
115
119
  }
116
120
  export interface IGeneratedLineChartDataset {
117
121
  label?: string;
@@ -4,7 +4,6 @@ export declare const TOGGLE_POINTS = "TOGGLE_POINTS";
4
4
  export declare const TOGGLE_LINE = "TOGGLE_LINE";
5
5
  export declare const TOGGLE_LEGEND = "TOGGLE_LEGEND";
6
6
  export declare const TOGGLE_TABLE = "TOGGLE_TABLE";
7
- export declare const SAVE_INITIAL_AXES_RANGES = "SAVE_INITIAL_AXES_RANGES";
8
7
  export declare const RESET_AXES_RANGES = "RESET_AXES_RANGES";
9
8
  export declare const UPDATE_AXES_RANGES = "UPDATE_AXES_RANGES";
10
9
  export declare const TOGGLE_DRAG_POINTS = "TOGGLE_DRAG_POINTS";
@@ -0,0 +1,13 @@
1
+ import { Chart } from 'chart.js';
2
+ import { RefObject } from 'react';
3
+ import { IState } from './state.interfaces';
4
+ export interface IGetInitAxes {
5
+ chartRef: RefObject<Chart>;
6
+ state: IState;
7
+ }
8
+ export declare const getInitAxes: ({ chartRef, state }: IGetInitAxes) => {
9
+ id: string;
10
+ min: number;
11
+ max: number;
12
+ unit: string | import('../line-chart.interface').IUnitOptions | undefined;
13
+ }[];
@@ -2,12 +2,12 @@ import { IUnitOptions } from '../line-chart.interface';
2
2
  export interface IAxisState {
3
3
  id?: string;
4
4
  label?: string;
5
- min?: number;
6
- max?: number;
5
+ min?: number | string;
6
+ max?: number | string;
7
7
  unit?: IUnitOptions | string;
8
8
  axisType?: string;
9
9
  }
10
- export interface InitialState {
10
+ export interface IState {
11
11
  zoomEnabled: boolean;
12
12
  panEnabled: boolean;
13
13
  pointsEnabled: boolean;
@@ -19,15 +19,6 @@ export interface InitialState {
19
19
  enableDragPoints: boolean;
20
20
  enableDragAnnotation: boolean;
21
21
  }
22
- export interface IInitAxisRange {
23
- id: string;
24
- min: number;
25
- max: number;
26
- unit?: string;
27
- }
28
- export interface IState extends InitialState {
29
- initialAxesRanges: IInitAxisRange[];
30
- }
31
22
  export interface IAction<T = string, P = any> {
32
23
  type: T;
33
24
  payload?: P;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oliasoft-open-source/charts-library",
3
- "version": "4.8.3-beta-4",
3
+ "version": "4.8.3-beta-6",
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
  "resolutions": {
@@ -23,7 +23,7 @@
23
23
  "dist"
24
24
  ],
25
25
  "scripts": {
26
- "build:package": "vite build --config vite.config.ts",
26
+ "build:package": "tsc && vite build --config vite.config.ts",
27
27
  "build": "yarn build:package && storybook build --quiet --output-dir ./public",
28
28
  "dev:storybook": "storybook dev -p 6006",
29
29
  "lint:check": "eslint \"**/*.{js,jsx,ts,tsx}\"",
@@ -1,5 +0,0 @@
1
- export declare enum actionTypes {
2
- Reset = "reset",
3
- ValueUpdated = "valueUpdated",
4
- UnitUpdated = "unitUpdated"
5
- }
@@ -1,12 +0,0 @@
1
- import { RefObject } from 'react';
2
- import { Chart } from 'chart.js';
3
- import { IState } from '../../state/state.interfaces';
4
- import { IAction, IFormState, IInitializeAxisFormState } from './axes-options-interfaces';
5
- export declare const initializeFormState: ({ chartRef, axes, }: Partial<IState> & {
6
- chartRef?: RefObject<Chart>;
7
- }) => IInitializeAxisFormState;
8
- export declare const validateAxes: (formState: IFormState) => {
9
- errors: never[];
10
- valid: boolean;
11
- };
12
- export declare const reducer: (state: IFormState, action: IAction) => IInitializeAxisFormState;