@oliasoft-open-source/charts-library 3.4.6 → 3.4.7-beta-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.
Files changed (60) hide show
  1. package/dist/declaration.d.ts +2 -0
  2. package/dist/index.js +658 -611
  3. package/dist/index.js.map +1 -1
  4. package/dist/src/components/bar-chart/bar-chart-default-props.d.ts +30 -26
  5. package/dist/src/components/bar-chart/bar-chart.interface.d.ts +37 -70
  6. package/dist/src/components/bar-chart/get-bar-chart-data-labels.d.ts +11 -14
  7. package/dist/src/components/bar-chart/get-bar-chart-scales.d.ts +3 -2
  8. package/dist/src/components/bar-chart/get-bar-chart-tooltips.d.ts +3 -16
  9. package/dist/src/components/common/common.interface.d.ts +139 -0
  10. package/dist/src/components/common/helpers/chart-border-plugin.d.ts +8 -0
  11. package/dist/src/{helpers → components/common/helpers}/enums.d.ts +2 -1
  12. package/dist/src/components/common/helpers/get-chart-annotation.d.ts +27 -0
  13. package/dist/src/components/common/helpers/get-draggableData.d.ts +18 -0
  14. package/dist/src/{helpers → components/common/helpers}/range/range.d.ts +6 -6
  15. package/dist/src/components/line-chart/controls/axes-options/axes-options-form-state.d.ts +8 -3
  16. package/dist/src/components/line-chart/controls/axes-options/axes-options-interfaces.d.ts +52 -0
  17. package/dist/src/components/{controls → line-chart/controls}/axes-options/axes-options.d.ts +1 -1
  18. package/dist/src/components/line-chart/controls/controls-interfaces.d.ts +18 -32
  19. package/dist/src/components/line-chart/controls/controls-portal.d.ts +6 -1
  20. package/dist/src/components/line-chart/controls/controls.d.ts +1 -1
  21. package/dist/src/components/line-chart/controls/drag-options-interfaces.d.ts +5 -5
  22. package/dist/src/components/line-chart/controls/line-options.d.ts +9 -1
  23. package/dist/src/components/line-chart/hooks/use-chart-functions.d.ts +28 -6
  24. package/dist/src/components/line-chart/{state → hooks}/use-chart-state.d.ts +13 -1
  25. package/dist/src/components/line-chart/hooks/use-toggle-handler.d.ts +2 -1
  26. package/dist/src/components/line-chart/initialize/config.d.ts +2 -2
  27. package/dist/src/components/line-chart/legend/legend-interface.d.ts +24 -18
  28. package/dist/src/components/line-chart/legend/legend-panel.d.ts +2 -2
  29. package/dist/src/components/line-chart/line-chart-get-default-props.d.ts +38 -30
  30. package/dist/src/components/line-chart/line-chart.interface.d.ts +48 -61
  31. package/dist/src/components/line-chart/plugins/chart-area-text-plugin.d.ts +14 -1
  32. package/dist/src/components/line-chart/plugins/line-chart.minor-gridlines-plugin.d.ts +5 -4
  33. package/dist/src/components/line-chart/plugins/plugins.interface.d.ts +2 -2
  34. package/dist/src/components/line-chart/state/initial-state.d.ts +20 -2
  35. package/dist/src/components/line-chart/state/line-chart-reducer.d.ts +2 -1
  36. package/dist/src/components/line-chart/state/manage-state-in-local-storage.d.ts +3 -2
  37. package/dist/src/components/line-chart/state/state.interfaces.d.ts +32 -7
  38. package/dist/src/components/line-chart/utils/datalabels-alignment/get-datalabels-position.d.ts +1 -1
  39. package/dist/src/components/line-chart/utils/generate-line-chart-datasets.d.ts +3 -1
  40. package/dist/src/components/line-chart/utils/get-axes-ranges-from-chart.d.ts +9 -2
  41. package/dist/src/components/line-chart/utils/get-line-chart-data-labels.d.ts +3 -2
  42. package/dist/src/components/line-chart/utils/get-line-chart-scales.d.ts +4 -4
  43. package/dist/src/components/line-chart/utils/get-line-chart-tooltips.d.ts +2 -2
  44. package/dist/src/components/line-chart/utils/translations/get-translations.d.ts +2 -1
  45. package/dist/src/components/pie-chart/pie-chart-get-default-props.d.ts +12 -8
  46. package/dist/src/components/pie-chart/pie-chart.d.ts +1 -2
  47. package/dist/src/components/pie-chart/pie-chart.interface.d.ts +52 -51
  48. package/dist/src/components/scatter-chart/scatter-chart.d.ts +1 -1
  49. package/dist/src/components/scatter-chart/scatter-chart.intefrace.d.ts +6 -16
  50. package/package.json +1 -1
  51. package/dist/src/components/controls/axes-options/axes-options-interfaces.d.ts +0 -19
  52. package/dist/src/components/line-chart/hooks/hooks.interface.d.ts +0 -13
  53. package/dist/src/components/line-chart/hooks/use-chart-options.d.ts +0 -37
  54. package/dist/src/components/pie-chart/pie-chart-utils.d.ts +0 -2
  55. package/dist/src/helpers/chart-border-plugin.d.ts +0 -7
  56. package/dist/src/helpers/chart-interface.d.ts +0 -85
  57. package/dist/src/helpers/get-chart-annotation.d.ts +0 -12
  58. package/dist/src/helpers/get-draggableData.d.ts +0 -18
  59. /package/dist/src/{helpers → components/common/helpers}/chart-consts.d.ts +0 -0
  60. /package/dist/src/{helpers → components/common/helpers}/range/estimate-data-series-have-close-values.d.ts +0 -0
@@ -1,28 +1,32 @@
1
1
  import { IBarChartProps } from './bar-chart.interface';
2
+ import { AlignOptions, Position } from '../common/helpers/enums';
2
3
  export declare const getDefaultProps: (props: IBarChartProps) => {
3
- testId: string | null;
4
- data: any;
4
+ testId: string;
5
+ data: {
6
+ labels: string[];
7
+ datasets: import("./bar-chart.interface").IBarChartDataset[];
8
+ };
5
9
  options: {
6
10
  title: string | string[];
7
11
  direction: "vertical" | "horizontal";
8
12
  axes: {
9
- x: import("./bar-chart.interface").IBarChartAxes<"top" | "bottom">[];
10
- y: import("./bar-chart.interface").IBarChartAxes<"left" | "right">[];
13
+ x: [{}] | import("../common/common.interface").ICommonAxis<"top" | "bottom">[];
14
+ y: [{}] | import("../common/common.interface").ICommonAxis<"left" | "right">[];
11
15
  };
12
16
  additionalAxesOptions: {
13
17
  chartScaleType: "linear" | "logarithmic";
14
18
  reverse: boolean;
15
19
  stacked: boolean;
16
20
  beginAtZero: boolean;
17
- stepSize: number;
18
- suggestedMin: number;
19
- suggestedMax: number;
20
- min: number;
21
- max: number;
21
+ stepSize: number | undefined;
22
+ suggestedMin: number | undefined;
23
+ suggestedMax: number | undefined;
24
+ min: number | undefined;
25
+ max: number | undefined;
22
26
  };
23
27
  chartStyling: {
24
- width: string | number;
25
- height: string | number;
28
+ width: string | number | undefined;
29
+ height: string | number | undefined;
26
30
  maintainAspectRatio: boolean;
27
31
  staticChartHeight: boolean;
28
32
  performanceMode: boolean;
@@ -38,32 +42,32 @@ export declare const getDefaultProps: (props: IBarChartProps) => {
38
42
  annotations: {
39
43
  showAnnotations: boolean;
40
44
  controlAnnotation: boolean;
41
- annotationsData: import("../../helpers/chart-interface").IChartAnnotationsData[];
45
+ annotationsData: import("../common/common.interface").ICommonAnnotationsData[];
42
46
  };
43
47
  legend: {
44
48
  display: boolean;
45
- position: "top" | "bottom" | "right";
46
- align: "start" | "center" | "end";
47
- customLegend: import("../../helpers/chart-interface").ICustomLegend;
49
+ position: Position;
50
+ align: AlignOptions;
51
+ customLegend: import("../common/common.interface").ICommonCustomLegend<any>;
48
52
  };
49
53
  chartOptions: {
50
54
  enableZoom: boolean;
51
55
  enablePan: boolean;
52
56
  };
53
57
  interactions: {
54
- onLegendClick: () => any;
55
- onBarHover: any;
56
- onBarUnhover: any;
58
+ onLegendClick: ((text: string, hidden: boolean) => void) | undefined;
59
+ onHover: ((event?: import("chart.js").ChartEvent | undefined, datasetIndex?: number | undefined, index?: number | undefined, generatedDataset?: any[] | undefined) => void) | undefined;
60
+ onUnhover: ((event?: import("chart.js").ChartEvent | undefined, datasetIndex?: number | undefined, index?: number | undefined, generatedDataset?: any[] | undefined) => void) | undefined;
57
61
  };
58
62
  dragData: {
59
- enableDragData: any;
60
- showTooltip: any;
61
- roundPoints: any;
62
- dragX: any;
63
- dragY: any;
64
- onDragStart: any;
65
- onDrag: any;
66
- onDragEnd: any;
63
+ enableDragData: boolean;
64
+ showTooltip: boolean;
65
+ roundPoints: boolean;
66
+ dragX: boolean;
67
+ dragY: boolean;
68
+ onDragStart: (() => void) | undefined;
69
+ onDrag: (() => void) | undefined;
70
+ onDragEnd: (() => void) | undefined;
67
71
  };
68
72
  };
69
73
  };
@@ -1,82 +1,49 @@
1
- import { LinearScaleOptions } from 'chart.js';
2
- import { IChartAnnotations, IChartDraggableData, IChartInteractions, IChartLegend, IChartStyling } from '../../helpers/chart-interface';
3
- export interface IChartOptions {
4
- enableZoom: boolean;
5
- enablePan: boolean;
6
- }
7
- export interface IBarChartGraph {
8
- showDataLabels: boolean;
9
- showMinorGridlines: boolean;
10
- }
11
- export interface IBarChartTooltip {
12
- tooltips: boolean;
13
- showLabelsInTooltips: boolean;
14
- }
15
- export interface IBarChartAdditionalAxesOptions {
16
- chartScaleType: 'linear' | 'logarithmic';
17
- reverse: boolean;
18
- beginAtZero: boolean;
19
- stepSize: number;
20
- stacked: boolean;
21
- suggestedMin: number;
22
- suggestedMax: number;
23
- min: number;
24
- max: number;
1
+ import { ICommonAdditionalAxesOptions, ICommonAnnotations, ICommonAxis, ICommonCustomLegend, ICommonData, ICommonDataset, ICommonDragData, ICommonGraph, ICommonLegend, ICommonOptions, ICommonScales, ICommonStyling } from '../common/common.interface';
2
+ export interface IBarStyling extends ICommonStyling {
3
+ squareAspectRatio?: boolean;
4
+ layoutPadding?: string | number | {
5
+ top: number;
6
+ bottom: number;
7
+ left: number;
8
+ right: number;
9
+ };
25
10
  }
26
- export interface IBarChartAxes<PositionType> {
27
- label: string;
28
- position: PositionType;
29
- color: string;
30
- unit: string;
11
+ export interface IBarLegend extends ICommonLegend {
12
+ customLegend?: ICommonCustomLegend<any>;
31
13
  }
32
- export interface IBarScales {
33
- x: LinearScaleOptions;
34
- y: LinearScaleOptions;
14
+ export interface IBarAxes {
15
+ x: ICommonAxis<'top' | 'bottom'>[] | [{}];
16
+ y: ICommonAxis<'left' | 'right'>[] | [{}];
17
+ [key: string]: ICommonAxis<any>[] | [{}];
35
18
  }
36
- export interface IBarChartOptions {
37
- title: string | string[];
19
+ export interface IBarOptions extends ICommonOptions {
38
20
  direction: 'vertical' | 'horizontal';
39
- axes: {
40
- x: IBarChartAxes<'top' | 'bottom'>[];
41
- y: IBarChartAxes<'left' | 'right'>[];
42
- };
43
- scales: IBarScales;
44
- additionalAxesOptions: IBarChartAdditionalAxesOptions;
45
- chartStyling: IChartStyling;
46
- tooltip: IBarChartTooltip;
47
- graph: IBarChartGraph;
48
- annotations: IChartAnnotations;
49
- legend: IChartLegend;
50
- chartOptions: IChartOptions;
51
- interactions: IChartInteractions;
52
- draggableData: IChartDraggableData;
53
- }
54
- export interface IBarDataPoint {
55
- x: number;
56
- y: number;
57
- label?: string;
58
- }
59
- export interface IBarChartDataset {
60
- label?: string;
61
- data: number[] | number[][] | IBarDataPoint[];
62
- borderSkipped?: string;
63
- backgroundColor?: string[];
64
- borderColor?: string[];
21
+ axes: IBarAxes;
22
+ scales?: ICommonScales;
23
+ additionalAxesOptions?: ICommonAdditionalAxesOptions;
24
+ chartStyling: IBarStyling;
25
+ graph?: ICommonGraph;
26
+ annotations?: ICommonAnnotations;
27
+ legend?: IBarLegend;
28
+ dragData?: ICommonDragData;
29
+ }
30
+ export interface IBarChartDataset extends ICommonDataset {
31
+ isAnnotation?: boolean;
32
+ annotationIndex?: number;
33
+ borderSkipped?: any;
65
34
  borderRadius?: number;
66
- borderWidth?: number;
35
+ xAxisID?: string;
67
36
  yAxisID?: string;
68
- stack?: number;
69
- isAnnotation: boolean;
70
- annotationIndex: number | string;
71
- type: 'bar' | 'line';
37
+ hidden?: boolean;
38
+ displayGroup?: any;
39
+ type?: 'bar';
72
40
  }
73
- export interface IBarChartData {
74
- testId: string | null;
41
+ export interface IBarChartData extends ICommonData {
75
42
  data: {
76
- labels?: string[];
43
+ labels: string[];
77
44
  datasets: IBarChartDataset[];
78
- } | any;
79
- options: IBarChartOptions;
45
+ };
46
+ options: IBarOptions;
80
47
  }
81
48
  export interface IBarChartProps {
82
49
  chart: IBarChartData;
@@ -1,17 +1,14 @@
1
- import { AlignOptions } from '../../helpers/enums';
2
- import { IBarChartOptions } from './bar-chart.interface';
1
+ import { Options } from 'chartjs-plugin-datalabels';
2
+ import { IBarOptions } from './bar-chart.interface';
3
+ type ExtendedDisplayOptions = 'auto' | boolean;
4
+ interface IExtendedDataLabelsOptions extends Options {
5
+ display: ExtendedDisplayOptions;
6
+ }
3
7
  /**
4
- * @param {import('./bar-chart.interface').IBarChartOptions} options - bar chart options object
8
+ * Returns the data labels configuration for a bar chart.
9
+ *
10
+ * @param {IBarChartOptions} options - The options for the bar chart.
11
+ * @returns {Object} The data labels configuration for the chart.
5
12
  */
6
- declare const getBarChartDataLabels: (options: IBarChartOptions) => {
7
- display: string;
8
- align: AlignOptions;
9
- anchor: AlignOptions;
10
- formatter: (value: any, context: any) => string | number;
11
- } | {
12
- display: boolean;
13
- align?: undefined;
14
- anchor?: undefined;
15
- formatter?: undefined;
16
- };
13
+ declare const getBarChartDataLabels: (options: IBarOptions) => IExtendedDataLabelsOptions;
17
14
  export default getBarChartDataLabels;
@@ -1,5 +1,6 @@
1
+ import { Chart } from 'chart.js';
1
2
  /**
2
- * @param {import('./bar-chart.interface').IBarChartData} chart - chart data
3
+ * @param {IBarChartData} chart - chart data
3
4
  */
4
- declare const getBarChartScales: (chart: any) => any;
5
+ declare const getBarChartScales: (chart: Chart) => any;
5
6
  export default getBarChartScales;
@@ -1,19 +1,6 @@
1
- import { ChartHoverMode } from '../../helpers/enums';
1
+ import { IBarOptions } from './bar-chart.interface';
2
2
  /**
3
- * @param {import('./bar-chart.interface').IBarChartOptions} options - bar chart options object
3
+ * @param {IBarOptions} options - bar chart options object
4
4
  */
5
- declare const getBarChartToolTips: (options: any) => {
6
- enabled: any;
7
- mode: ChartHoverMode;
8
- intersect: boolean;
9
- padding: number;
10
- boxWidth: number;
11
- boxHeight: number;
12
- boxPadding: number;
13
- callbacks: {
14
- title: (tooltipItem: any, data: any) => string;
15
- label: (tooltipItem: any) => string;
16
- afterLabel: (tooltipItem: any) => string;
17
- };
18
- };
5
+ declare const getBarChartToolTips: (options: IBarOptions) => Record<string, any>;
19
6
  export default getBarChartToolTips;
@@ -0,0 +1,139 @@
1
+ import { ChartEvent, ChartTypeRegistry, LinearScaleOptions, Plugin } from 'chart.js';
2
+ import { AlignOptions, Position } from './helpers/enums';
3
+ export interface ICommonDataValue {
4
+ x: number;
5
+ y: number;
6
+ label?: string;
7
+ }
8
+ export interface ICommonDataset {
9
+ label?: string;
10
+ borderColor?: string;
11
+ backgroundColor?: string | string[];
12
+ borderWidth?: number;
13
+ data: ICommonDataValue[];
14
+ }
15
+ export interface ICommonScales extends Partial<Record<string, LinearScaleOptions>> {
16
+ x: LinearScaleOptions;
17
+ y: LinearScaleOptions;
18
+ }
19
+ export interface ICommonAnnotationsData {
20
+ adjustScaleRange: boolean;
21
+ annotationAxis: 'x' | 'y';
22
+ color: string;
23
+ endValue: number;
24
+ label: string;
25
+ type: string;
26
+ value: number;
27
+ xMin: number;
28
+ xMax: number;
29
+ yMin: number;
30
+ yMax: number;
31
+ }
32
+ export interface ICommonStyling {
33
+ width?: number | string;
34
+ height?: number | string;
35
+ maintainAspectRatio?: boolean;
36
+ staticChartHeight?: boolean;
37
+ performanceMode?: boolean;
38
+ }
39
+ export interface ICommonLegend {
40
+ display: boolean;
41
+ position: Position;
42
+ align: AlignOptions;
43
+ }
44
+ export interface ICommonTooltip {
45
+ tooltips: boolean;
46
+ showLabelsInTooltips: boolean;
47
+ }
48
+ export interface ICommonAdditionalAxesOptions {
49
+ chartScaleType?: 'linear' | 'logarithmic';
50
+ reverse: boolean;
51
+ beginAtZero: boolean;
52
+ stepSize?: number;
53
+ stacked?: boolean;
54
+ suggestedMin?: number;
55
+ suggestedMax?: number;
56
+ min?: number;
57
+ max?: number;
58
+ }
59
+ export interface ICommonAnnotation {
60
+ showLabel: boolean;
61
+ text: string | string[];
62
+ position: string;
63
+ fontSize: number;
64
+ xOffset: number;
65
+ yOffset: number;
66
+ maxWidth: number;
67
+ lineHeight: number;
68
+ }
69
+ export interface ICommonAnnotations {
70
+ showAnnotations?: boolean;
71
+ controlAnnotation?: boolean;
72
+ annotationsData?: ICommonAnnotationsData[];
73
+ labelAnnotation?: ICommonAnnotation;
74
+ }
75
+ export interface ICommonGraph {
76
+ lineTension?: number;
77
+ spanGaps?: boolean;
78
+ showDataLabels?: boolean;
79
+ showMinorGridlines?: boolean;
80
+ }
81
+ export interface ICommonInteractions {
82
+ onLegendClick?: (text: string, hidden: boolean) => void;
83
+ onHover?: (event?: ChartEvent, datasetIndex?: number, index?: number, generatedDataset?: any[]) => void;
84
+ onUnhover?: (event?: ChartEvent, datasetIndex?: number, index?: number, generatedDataset?: any[]) => void;
85
+ }
86
+ export interface ICommonCustomLegend<T extends keyof ChartTypeRegistry> {
87
+ customLegendPlugin: Plugin<T> | null;
88
+ customLegendContainerID: string;
89
+ }
90
+ export interface ICommonChartOptions {
91
+ enableZoom: boolean;
92
+ enablePan: boolean;
93
+ }
94
+ export interface ICommonDragData {
95
+ enableDragData?: boolean;
96
+ showTooltip?: boolean;
97
+ roundPoints?: boolean;
98
+ dragX?: boolean;
99
+ dragY?: boolean;
100
+ onDragStart?: () => void;
101
+ onDrag?: () => void;
102
+ onDragEnd?: () => void;
103
+ }
104
+ export interface ICommonOptions {
105
+ title?: string | string[];
106
+ chartStyling?: ICommonStyling;
107
+ tooltip?: ICommonTooltip;
108
+ legend?: ICommonLegend;
109
+ chartOptions?: ICommonChartOptions;
110
+ interactions?: ICommonInteractions;
111
+ dragData?: ICommonDragData;
112
+ }
113
+ export interface ICommonData {
114
+ testId?: string;
115
+ data?: {
116
+ labels?: string[];
117
+ datasets?: ICommonDataset[];
118
+ };
119
+ options: ICommonOptions;
120
+ }
121
+ export interface ICommonHoveredItems {
122
+ index: number;
123
+ datasetIndex: number;
124
+ }
125
+ export interface ICommonChartPlugins {
126
+ legend: {
127
+ position: 'top' | 'right' | 'bottom' | 'left';
128
+ };
129
+ title: {
130
+ display: boolean;
131
+ text: string;
132
+ };
133
+ }
134
+ export interface ICommonAxis<PositionType> {
135
+ label: string;
136
+ position: PositionType;
137
+ color: string | string[];
138
+ unit: string;
139
+ }
@@ -0,0 +1,8 @@
1
+ import { Chart, ChartConfiguration, Plugin } from 'chart.js';
2
+ /**
3
+ * Chart border plugin config
4
+ */
5
+ export declare const chartAreaBorderPlugin: {
6
+ id: string;
7
+ beforeDraw(chart: Chart, _args: Plugin, options: ChartConfiguration): void;
8
+ };
@@ -57,7 +57,8 @@ export declare enum ChartHoverMode {
57
57
  export declare enum PanZoomMode {
58
58
  X = "x",
59
59
  Y = "y",
60
- XY = "xy"
60
+ XY = "xy",
61
+ Z = "z"
61
62
  }
62
63
  export declare enum Key {
63
64
  Shift = "Shift"
@@ -0,0 +1,27 @@
1
+ interface IAnnotationData {
2
+ annotationAxis?: string;
3
+ color?: string;
4
+ type?: string;
5
+ adjustScaleRange?: boolean;
6
+ label?: string;
7
+ value?: number;
8
+ }
9
+ interface IAnnotations {
10
+ annotationsData?: IAnnotationData[];
11
+ showAnnotations?: boolean;
12
+ }
13
+ interface IOptions {
14
+ annotations?: IAnnotations;
15
+ }
16
+ interface IState {
17
+ showAnnotationLineIndex?: number[];
18
+ }
19
+ /**
20
+ * @param {ICommonChartOptions} options - chart options object
21
+ * @param {IInitialState} state - chart state object controlled by useReducer or similar
22
+ * @return {{annotations: []}}
23
+ */
24
+ declare const getAnnotation: (options: IOptions, state: IState) => {
25
+ annotations: IAnnotationData | undefined;
26
+ };
27
+ export default getAnnotation;
@@ -0,0 +1,18 @@
1
+ import { ICommonOptions } from '../common.interface';
2
+ /**
3
+ * @param {ICommonChartOptions} options - line chart options object
4
+ */
5
+ declare const getDraggableData: (options: ICommonOptions) => {
6
+ dragData: {
7
+ dragX: boolean | undefined;
8
+ dragY: boolean | undefined;
9
+ round: boolean | undefined;
10
+ showTooltip: boolean | undefined;
11
+ onDragStart: () => void;
12
+ onDrag: () => void;
13
+ onDragEnd: () => void;
14
+ };
15
+ } | {
16
+ dragData?: undefined;
17
+ };
18
+ export default getDraggableData;
@@ -1,3 +1,8 @@
1
+ interface IGetSuggestedAxisRange {
2
+ data: number[];
3
+ beginAtZero: boolean;
4
+ autoAxisPadding: boolean;
5
+ }
1
6
  /**
2
7
  * Overrides the default chart.js axis range for some edge-cases:
3
8
  * - when no data -> default range
@@ -18,12 +23,7 @@
18
23
  * @param {boolean>} [args.autoAxisPadding]
19
24
  * @returns {object} returns {min, max} pair
20
25
  */
21
- interface IGetuggestedAxisRange {
22
- data: any;
23
- beginAtZero: boolean;
24
- autoAxisPadding: boolean;
25
- }
26
- export declare const getSuggestedAxisRange: ({ data, beginAtZero, autoAxisPadding, }: IGetuggestedAxisRange) => {
26
+ export declare const getSuggestedAxisRange: ({ data, beginAtZero, autoAxisPadding, }: IGetSuggestedAxisRange) => {
27
27
  min: number;
28
28
  max: number;
29
29
  } | {
@@ -1,3 +1,5 @@
1
+ import { IState } from '../../state/state.interfaces';
2
+ import { IAction, IFormState, IInitializeAxisFormState } from './axes-options-interfaces.ts';
1
3
  /**
2
4
  * Initialize local component form state for a custom loads density table
3
5
  *
@@ -6,8 +8,11 @@
6
8
  * @param {Array} [args.axes]
7
9
  * @returns {Object} formState
8
10
  */
9
- export declare const initializeFormState: ({ initialAxesRanges, axes }: any) => any;
10
- export declare const validateAxes: (formState: any) => any;
11
+ export declare const initializeFormState: ({ initialAxesRanges, axes, }: Partial<IState>) => IInitializeAxisFormState;
12
+ export declare const validateAxes: (formState: IFormState) => {
13
+ errors: never[];
14
+ valid: boolean;
15
+ };
11
16
  /**
12
17
  * Local component form state reducer for a axes options form
13
18
  *
@@ -15,4 +20,4 @@ export declare const validateAxes: (formState: any) => any;
15
20
  * @param {Action} action Action with type and payload
16
21
  * @returns {Object} FormState
17
22
  */
18
- export declare const reducer: (state: any, action: any) => any;
23
+ export declare const reducer: (state: IFormState, action: IAction) => IInitializeAxisFormState;
@@ -0,0 +1,52 @@
1
+ import { IUnitOptions } from '../../line-chart.interface.ts';
2
+ import { IAxisState, IInitAxisRange } from '../../state/state.interfaces.ts';
3
+ export interface IDepthType {
4
+ selectedDepthType?: string;
5
+ setSelectedDepthType?: (type: string) => void;
6
+ options?: Array<string>;
7
+ }
8
+ export interface IAxisControlLabel {
9
+ id: string;
10
+ label: string;
11
+ }
12
+ export interface IAxesOptions {
13
+ initialAxesRanges: IInitAxisRange[];
14
+ axes: IAxisState[];
15
+ controlsAxesLabels: IAxisControlLabel[];
16
+ onUpdateAxes: (axes: IAxisState) => void;
17
+ onResetAxes: () => void;
18
+ depthType: IDepthType;
19
+ close?: () => void;
20
+ }
21
+ export interface IOnEdit {
22
+ name?: string;
23
+ value?: string;
24
+ id?: string;
25
+ }
26
+ export interface IAxisFormState {
27
+ id: string;
28
+ min: number | string;
29
+ max: number | string;
30
+ unit: string | IUnitOptions;
31
+ }
32
+ export type IInitializeAxisFormState = IAxisFormState[];
33
+ export interface IError {
34
+ id: string;
35
+ min: string[];
36
+ max: string[];
37
+ }
38
+ export interface IFormState extends IInitializeAxisFormState {
39
+ errors?: IError[];
40
+ valid?: boolean;
41
+ }
42
+ type ActionType = 'reset' | 'valueUpdated' | 'unitUpdated';
43
+ export type AxisKey = 'min' | 'max' | 'unit';
44
+ interface ActionPayload extends IOnEdit {
45
+ initialAxesRanges?: IInitAxisRange[];
46
+ axes?: IAxisState[];
47
+ }
48
+ export interface IAction {
49
+ type: ActionType;
50
+ payload: ActionPayload;
51
+ }
52
+ export {};
@@ -1,6 +1,6 @@
1
1
  import { IAxesOptions } from './axes-options-interfaces';
2
2
  interface IAxesOptionsWithTranslations extends IAxesOptions {
3
- translations: any;
3
+ translations: Record<string, string>;
4
4
  }
5
5
  export declare const AxesOptions: (optionsPopover: IAxesOptionsWithTranslations) => JSX.Element;
6
6
  export {};
@@ -1,34 +1,20 @@
1
- interface IControlsProps {
2
- headerComponent: Element;
3
- subheaderComponent: Element;
4
- table: Element;
5
- controlsPortalId: string;
6
- }
7
- interface IControlsState {
8
- enableDragPoints: boolean;
9
- initialAxesRanges: Array<object>;
10
- legendEnabled: boolean;
11
- lineEnabled: boolean;
12
- panEnabled: boolean;
13
- pointsEnabled: boolean;
14
- showTable: boolean;
15
- zoomEnabled: boolean;
16
- }
17
- interface IControlsOptions {
18
- dragData: {
19
- enableDragData: boolean;
20
- };
21
- title: string;
22
- depthType: any;
23
- }
1
+ import { Dispatch, RefObject } from 'react';
2
+ import { Chart } from 'chart.js';
3
+ import { ILineChartDataset, ILineChartOptions } from '../line-chart.interface';
4
+ import { IState } from '../state/state.interfaces';
24
5
  export interface IControls {
25
- props: IControlsProps;
26
- chartRef: any;
27
- state: IControlsState;
28
- options: IControlsOptions;
29
- dispatch: () => any;
30
- generatedDatasets: Array<object>;
31
- translations: any;
32
- controlsPortalId: any;
6
+ headerComponent?: Element;
7
+ subheaderComponent?: Element;
8
+ table?: Element;
9
+ chartRef: RefObject<Chart>;
10
+ state: IState;
11
+ options: ILineChartOptions;
12
+ dispatch: Dispatch<any>;
13
+ generatedDatasets: ILineChartDataset[];
14
+ translations: Record<string, string>;
15
+ controlsPortalId?: string;
16
+ }
17
+ export interface AxisControls {
18
+ id?: string;
19
+ label?: string;
33
20
  }
34
- export {};
@@ -1,2 +1,7 @@
1
- declare const ControlsPortal: ({ children, controlsPortalId }: any) => any;
1
+ import { ReactElement } from 'react';
2
+ interface ControlsPortalProps {
3
+ children: ReactElement;
4
+ controlsPortalId: string;
5
+ }
6
+ declare const ControlsPortal: ({ children, controlsPortalId, }: ControlsPortalProps) => JSX.Element;
2
7
  export default ControlsPortal;
@@ -2,5 +2,5 @@ import { IControls } from './controls-interfaces';
2
2
  /**
3
3
  * @param {import('./controls-interfaces').IControls} obj
4
4
  */
5
- declare const Controls: ({ props: { headerComponent, subheaderComponent, table }, chartRef, state, options, dispatch, generatedDatasets, translations, controlsPortalId, }: IControls) => JSX.Element;
5
+ declare const Controls: ({ headerComponent, subheaderComponent, table, chartRef, state, options, dispatch, generatedDatasets, translations, controlsPortalId, }: IControls) => JSX.Element;
6
6
  export default Controls;