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

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,4 +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
85
  export {};
@@ -1,23 +1,12 @@
1
+ import { RefObject } from 'react';
2
+ import { Chart } from 'chart.js';
1
3
  import { IState } from '../../state/state.interfaces';
2
- import { IAction, IFormState, IInitializeAxisFormState } from './axes-options-interfaces.ts';
3
- /**
4
- * Initialize local component form state for a custom loads density table
5
- *
6
- * @param {Object} args
7
- * @param {Object} args.initialAxesRanges
8
- * @param {Array} [args.axes]
9
- * @returns {Object} formState
10
- */
11
- export declare const initializeFormState: ({ initialAxesRanges, axes, }: Partial<IState>) => IInitializeAxisFormState;
4
+ import { IAction, IFormState, IInitializeAxisFormState } from './axes-options-interfaces';
5
+ export declare const initializeFormState: ({ chartRef, axes, }: Partial<IState> & {
6
+ chartRef?: RefObject<Chart>;
7
+ }) => IInitializeAxisFormState;
12
8
  export declare const validateAxes: (formState: IFormState) => {
13
9
  errors: never[];
14
10
  valid: boolean;
15
11
  };
16
- /**
17
- * Local component form state reducer for a axes options form
18
- *
19
- * @param {Object} state Local component form state
20
- * @param {Action} action Action with type and payload
21
- * @returns {Object} FormState
22
- */
23
12
  export declare const reducer: (state: IFormState, action: IAction) => IInitializeAxisFormState;
@@ -1,5 +1,7 @@
1
- import { IUnitOptions } from '../../line-chart.interface.ts';
2
- import { IAxisState, IInitAxisRange } from '../../state/state.interfaces.ts';
1
+ import { RefObject } from 'react';
2
+ import { Chart } from 'chart.js';
3
+ import { IUnitOptions } from '../../line-chart.interface';
4
+ import { IAxisState } from '../../state/state.interfaces';
3
5
  export interface IDepthType {
4
6
  selectedDepthType?: string;
5
7
  setSelectedDepthType?: (type: string) => void;
@@ -10,7 +12,7 @@ export interface IAxisControlLabel {
10
12
  label: string;
11
13
  }
12
14
  export interface IAxesOptions {
13
- initialAxesRanges: IInitAxisRange[];
15
+ chartRef: RefObject<Chart>;
14
16
  axes: IAxisState[];
15
17
  controlsAxesLabels: IAxisControlLabel[];
16
18
  onUpdateAxes: ({ axes }: {
@@ -44,8 +46,8 @@ export interface IFormState extends IInitializeAxisFormState {
44
46
  type ActionType = 'reset' | 'valueUpdated' | 'unitUpdated';
45
47
  export type AxisKey = 'min' | 'max' | 'unit';
46
48
  interface ActionPayload extends IOnEdit {
47
- initialAxesRanges?: IInitAxisRange[];
48
49
  axes?: IAxisState[];
50
+ chartRef?: RefObject<Chart>;
49
51
  }
50
52
  export interface IAction {
51
53
  type: ActionType;
@@ -1,17 +1,16 @@
1
1
  import { Dispatch, RefObject } from 'react';
2
2
  import { Chart } from 'chart.js';
3
3
  import { IState } from '../state/state.interfaces';
4
- import { ILineChartDataset, ILineChartOptions } from '../line-chart.interface';
4
+ import { ILineChartOptions } from '../line-chart.interface';
5
5
  interface IUseChartState {
6
6
  chartRef: RefObject<Chart>;
7
7
  options: ILineChartOptions;
8
8
  state: IState;
9
9
  dispatch: Dispatch<any>;
10
10
  persistenceId?: string;
11
- generatedDatasets: ILineChartDataset[];
12
11
  }
13
12
  /**
14
13
  * Hook for managing the state of the chart.
15
14
  */
16
- export declare const useChartState: ({ chartRef, options, state, dispatch, persistenceId, generatedDatasets, }: IUseChartState) => void;
15
+ export declare const useChartState: ({ chartRef, options, state, dispatch, persistenceId, }: IUseChartState) => void;
17
16
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oliasoft-open-source/charts-library",
3
- "version": "4.8.3-beta-3",
3
+ "version": "4.8.3-beta-4",
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": {
@@ -26,9 +26,9 @@
26
26
  "build:package": "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
- "lint:check": "eslint .",
30
- "lint:fix": "eslint . --fix",
31
- "prepare": "husky",
29
+ "lint:check": "eslint \"**/*.{js,jsx,ts,tsx}\"",
30
+ "lint:fix": "eslint --fix \"**/*.{js,jsx,ts,tsx}\"",
31
+ "prepare": "husky install",
32
32
  "prettier:check": "prettier --check \"**/*.{ts,tsx,js,jsx,json,css,less}\"",
33
33
  "prettier:fix": "prettier --write \"**/*.{ts,tsx,js,jsx,json,css,less}\"",
34
34
  "preview:storybook": " http-server ./public -o -p 9002 -c-1",
@@ -43,15 +43,14 @@
43
43
  ]
44
44
  },
45
45
  "dependencies": {
46
- "@eslint/js": "^9.22.0",
47
- "@fontsource/noto-sans": "^5.2.5",
48
- "chart.js": "^4.4.8",
46
+ "@fontsource/noto-sans": "^5.0.18",
47
+ "chart.js": "^4.4.7",
49
48
  "chartjs-plugin-annotation": "^3.1.0",
50
49
  "chartjs-plugin-datalabels": "^2.2.0",
51
50
  "chartjs-plugin-dragdata": "2.2.5",
52
- "chartjs-plugin-zoom": "2.0.1",
51
+ "chartjs-plugin-zoom": "^2.0.1",
53
52
  "fast-deep-equal": "^3.1.3",
54
- "html-to-image": "^1.11.13",
53
+ "html-to-image": "^1.11.12",
55
54
  "react-base64-downloader": "^2.1.7",
56
55
  "react-chartjs-2": "^5.3.0",
57
56
  "react-dnd": "^16.0.1",
@@ -60,69 +59,67 @@
60
59
  "react-use": "^17.6.0"
61
60
  },
62
61
  "devDependencies": {
63
- "@oliasoft-open-source/react-ui-library": "^5.0.2",
64
- "@oliasoft-open-source/units": "^4.3.1",
65
- "@storybook/addon-actions": "^8.6.4",
66
- "@storybook/addon-docs": "^8.6.4",
67
- "@storybook/addon-mdx-gfm": "^8.6.4",
68
- "@storybook/react": "^8.6.4",
69
- "@storybook/react-vite": "^8.6.4",
62
+ "@oliasoft-open-source/react-ui-library": "^4.20.8",
63
+ "@oliasoft-open-source/units": "^4.2.4",
64
+ "@storybook/addon-actions": "^7.0.18",
65
+ "@storybook/addon-docs": "^7.0.18",
66
+ "@storybook/addon-mdx-gfm": "^7.0.23",
67
+ "@storybook/react": "^7.0.18",
68
+ "@storybook/react-vite": "^7.0.18",
70
69
  "@storybook/testing-library": "^0.2.2",
71
- "@types/jest": "^29.5.14",
72
- "@types/lodash": "^4.17.16",
70
+ "@types/jest": "^29.5.6",
73
71
  "@types/react": "^18.2.24",
74
72
  "@typescript-eslint/parser": "^6.7.4",
75
- "@vitejs/plugin-react-swc": "^3.8.0",
76
- "ajv": "^8.17.1",
73
+ "@vitejs/plugin-react-swc": "^3.3.2",
74
+ "ajv": "^8.12.0",
77
75
  "ajv-errors": "^3.0.0",
78
76
  "ajv-keywords": "^5.1.0",
79
- "classnames": "^2.5.1",
80
- "eslint": "^9.22.0",
77
+ "classnames": "^2.3.2",
78
+ "eslint": "^8.55.0",
81
79
  "eslint-config-airbnb": "^19.0.4",
82
- "eslint-config-prettier": "^10.1.1",
80
+ "eslint-config-prettier": "^9.0.0",
83
81
  "eslint-import-resolver-alias": "^1.1.2",
84
- "eslint-import-resolver-typescript": "^3.8.5",
85
- "eslint-plugin-import": "^2.31.0",
86
- "eslint-plugin-jsx-a11y": "^6.10.2",
87
- "eslint-plugin-react": "^7.37.4",
88
- "eslint-plugin-react-hooks": "^5.2.0",
89
- "eslint-plugin-storybook": "^0.11.4",
90
- "eslint-plugin-vitest": "^0.5.4",
91
- "eslint-plugin-vitest-globals": "^1.5.0",
82
+ "eslint-import-resolver-typescript": "^3.6.1",
83
+ "eslint-plugin-import": "^2.26.0",
84
+ "eslint-plugin-jsx-a11y": "^6.6.1",
85
+ "eslint-plugin-react": "^7.31.1",
86
+ "eslint-plugin-react-hooks": "^4.6.0",
87
+ "eslint-plugin-storybook": "^0.6.12",
88
+ "eslint-plugin-vitest": "^0.3.2",
89
+ "eslint-plugin-vitest-globals": "^1.3.1",
92
90
  "http-server": "^14.1.1",
93
- "husky": "^9.1.7",
91
+ "husky": "^8.0.1",
94
92
  "immer": "^10",
95
93
  "jsdom": "^22.1.0",
96
- "less": "^4.2.2",
94
+ "less": "^4.1.3",
97
95
  "lint-staged": "^15.4.3",
98
96
  "lodash": "^4.17.21",
99
97
  "micromatch": "^4",
100
- "prettier": "3.5.3",
98
+ "prettier": "3.0.3",
101
99
  "prop-types": "^15",
102
100
  "react": "^18.2.0",
103
101
  "react-dom": "^18.2.0",
104
102
  "rollup-plugin-peer-deps-external": "^2.2.4",
105
- "storybook": "^8.6.4",
106
- "storybook-dark-mode": "^4.0.2",
107
- "vite": "^6.2.1",
108
- "vite-plugin-css-injected-by-js": "^3.5.2",
109
- "vite-plugin-dts": "^4.5.3",
110
- "vite-plugin-optimize-persist": "^0.1.2",
111
- "vite-plugin-svgr": "^4.3.0",
112
- "vite-tsconfig-paths": "^5.1.4",
113
- "vitest": "^3.0.8"
103
+ "storybook": "^7.0.18",
104
+ "storybook-dark-mode": "^3.0.0",
105
+ "vite": "^5.4.11",
106
+ "vite-plugin-css-injected-by-js": "^3.1.1",
107
+ "vite-plugin-dts": "^4.5.0",
108
+ "vite-plugin-svgr": "^4.2.0",
109
+ "vite-tsconfig-paths": "^4.2.0",
110
+ "vitest": "^2.1.4"
114
111
  },
115
112
  "peerDependencies": {
116
- "@oliasoft-open-source/react-ui-library": ">=4.20.8 <6.0.0",
117
- "@oliasoft-open-source/units": "^4.3.1",
118
- "ajv": "^8.17.1",
113
+ "@oliasoft-open-source/react-ui-library": "^4.20.8",
114
+ "@oliasoft-open-source/units": "^4.2.4",
115
+ "ajv": "^8.12.0",
119
116
  "ajv-errors": "^3.0.0",
120
117
  "ajv-keywords": "^5.1.0",
121
- "classnames": "^2.5.1",
122
- "immer": "^9 || ^10",
118
+ "classnames": "^2.3.2",
119
+ "immer": "^9||^10",
123
120
  "lodash": "^4.17.21",
124
121
  "prop-types": "^15",
125
- "react": "^17 || ^18",
126
- "react-dom": "^17 || ^18"
122
+ "react": "^17",
123
+ "react-dom": "^17"
127
124
  }
128
125
  }