@oliasoft-open-source/charts-library 4.8.3-beta-5 → 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.
- package/dist/index.js +401 -522
- package/dist/index.js.map +1 -1
- package/dist/src/components/common/helpers/chart-utils.d.ts +1 -0
- package/dist/src/components/line-chart/controls/axes-options/axes-options-interfaces.d.ts +2 -2
- package/dist/src/components/line-chart/controls/axes-options/axes-validation.d.ts +8 -0
- package/dist/src/components/line-chart/controls/controls-interfaces.d.ts +1 -1
- package/dist/src/components/line-chart/controls/controls.d.ts +1 -4
- package/dist/src/components/line-chart/line-chart.interface.d.ts +4 -0
- package/dist/src/components/line-chart/state/action-types.d.ts +0 -1
- package/dist/src/components/line-chart/state/helpers.d.ts +13 -0
- package/dist/src/components/line-chart/state/state.interfaces.d.ts +3 -12
- package/package.json +2 -2
- package/dist/src/components/line-chart/controls/axes-options/action-types.d.ts +0 -5
- package/dist/src/components/line-chart/controls/axes-options/axes-options-form-state.d.ts +0 -12
- package/dist/src/components/line-chart/controls/axes-options/axes-options-form-state.test.d.ts +0 -1
package/dist/index.js
CHANGED
|
@@ -5,11 +5,11 @@ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
|
|
|
5
5
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
6
6
|
import * as React from "react";
|
|
7
7
|
import React__default, { forwardRef, useRef, useEffect, createContext as createContext$2, memo, useLayoutEffect, useState, useCallback, useMemo, isValidElement, cloneElement, useContext, useReducer } from "react";
|
|
8
|
-
import { produce } from "immer";
|
|
9
8
|
import { round as round$2, displayNumber, isCloseTo, roundByMagnitude } from "@oliasoft-open-source/units";
|
|
10
9
|
import cx from "classnames";
|
|
10
|
+
import { produce } from "immer";
|
|
11
11
|
import { Portal, Icon, Menu, Tooltip as Tooltip$2, Button, Popover, Field, InputGroup, NumberInput, InputGroupAddon, Select, ButtonGroup, Spacer, Flex, Text } from "@oliasoft-open-source/react-ui-library";
|
|
12
|
-
import { isEmpty, isArray as isArray$2, some, has, isNil, cloneDeep, defaultTo, findIndex, set as set$2, debounce as debounce$3, map as map$3, find, get as get$1, noop as noop$2 } from "lodash";
|
|
12
|
+
import { startCase, isEmpty, isArray as isArray$2, some, has, isNil, cloneDeep, defaultTo, findIndex, set as set$2, debounce as debounce$3, map as map$3, find, get as get$1, noop as noop$2 } from "lodash";
|
|
13
13
|
/*!
|
|
14
14
|
* @kurkle/color v0.3.4
|
|
15
15
|
* https://github.com/kurkle/color#readme
|
|
@@ -22511,218 +22511,6 @@ class HTML5BackendImpl {
|
|
|
22511
22511
|
const HTML5Backend = function createBackend(manager, context, options) {
|
|
22512
22512
|
return new HTML5BackendImpl(manager, context, options);
|
|
22513
22513
|
};
|
|
22514
|
-
const chart$3 = "_chart_e3qdd_1";
|
|
22515
|
-
const canvas$2 = "_canvas_e3qdd_11";
|
|
22516
|
-
const fixedHeight$3 = "_fixedHeight_e3qdd_20";
|
|
22517
|
-
const stretchHeight$3 = "_stretchHeight_e3qdd_26";
|
|
22518
|
-
const squareAspectRatio$1 = "_squareAspectRatio_e3qdd_32";
|
|
22519
|
-
const table = "_table_e3qdd_62";
|
|
22520
|
-
const styles$5 = {
|
|
22521
|
-
chart: chart$3,
|
|
22522
|
-
canvas: canvas$2,
|
|
22523
|
-
fixedHeight: fixedHeight$3,
|
|
22524
|
-
stretchHeight: stretchHeight$3,
|
|
22525
|
-
squareAspectRatio: squareAspectRatio$1,
|
|
22526
|
-
table
|
|
22527
|
-
};
|
|
22528
|
-
const TOGGLE_ZOOM = "TOGGLE_ZOOM";
|
|
22529
|
-
const TOGGLE_PAN = "TOGGLE_PAN";
|
|
22530
|
-
const TOGGLE_POINTS = "TOGGLE_POINTS";
|
|
22531
|
-
const TOGGLE_LINE = "TOGGLE_LINE";
|
|
22532
|
-
const TOGGLE_LEGEND = "TOGGLE_LEGEND";
|
|
22533
|
-
const TOGGLE_TABLE = "TOGGLE_TABLE";
|
|
22534
|
-
const SAVE_INITIAL_AXES_RANGES = "SAVE_INITIAL_AXES_RANGES";
|
|
22535
|
-
const RESET_AXES_RANGES = "RESET_AXES_RANGES";
|
|
22536
|
-
const UPDATE_AXES_RANGES = "UPDATE_AXES_RANGES";
|
|
22537
|
-
const TOGGLE_DRAG_POINTS = "TOGGLE_DRAG_POINTS";
|
|
22538
|
-
const TOGGLE_DRAG_ANNOTATION = "TOGGLE_DRAG_ANNOTATION";
|
|
22539
|
-
const DISABLE_DRAG_OPTIONS = "DISABLE_DRAG_OPTIONS";
|
|
22540
|
-
const reducer$1 = (state, action) => {
|
|
22541
|
-
return produce(state, (draft) => {
|
|
22542
|
-
switch (action.type) {
|
|
22543
|
-
case TOGGLE_ZOOM: {
|
|
22544
|
-
draft.zoomEnabled = !draft.zoomEnabled;
|
|
22545
|
-
if (draft.panEnabled) {
|
|
22546
|
-
draft.panEnabled = false;
|
|
22547
|
-
}
|
|
22548
|
-
if (draft.enableDragPoints) {
|
|
22549
|
-
draft.enableDragPoints = false;
|
|
22550
|
-
}
|
|
22551
|
-
if (draft.enableDragAnnotation) {
|
|
22552
|
-
draft.enableDragAnnotation = false;
|
|
22553
|
-
}
|
|
22554
|
-
break;
|
|
22555
|
-
}
|
|
22556
|
-
case TOGGLE_PAN: {
|
|
22557
|
-
draft.panEnabled = !draft.panEnabled;
|
|
22558
|
-
if (draft.zoomEnabled) {
|
|
22559
|
-
draft.zoomEnabled = false;
|
|
22560
|
-
}
|
|
22561
|
-
if (draft.enableDragPoints) {
|
|
22562
|
-
draft.enableDragPoints = false;
|
|
22563
|
-
}
|
|
22564
|
-
if (draft.enableDragAnnotation) {
|
|
22565
|
-
draft.enableDragAnnotation = false;
|
|
22566
|
-
}
|
|
22567
|
-
break;
|
|
22568
|
-
}
|
|
22569
|
-
case TOGGLE_POINTS: {
|
|
22570
|
-
draft.pointsEnabled = !draft.pointsEnabled;
|
|
22571
|
-
break;
|
|
22572
|
-
}
|
|
22573
|
-
case TOGGLE_LINE: {
|
|
22574
|
-
draft.lineEnabled = !draft.lineEnabled;
|
|
22575
|
-
break;
|
|
22576
|
-
}
|
|
22577
|
-
case TOGGLE_LEGEND: {
|
|
22578
|
-
draft.legendEnabled = !draft.legendEnabled;
|
|
22579
|
-
break;
|
|
22580
|
-
}
|
|
22581
|
-
case TOGGLE_TABLE: {
|
|
22582
|
-
draft.showTable = !draft.showTable;
|
|
22583
|
-
break;
|
|
22584
|
-
}
|
|
22585
|
-
case SAVE_INITIAL_AXES_RANGES: {
|
|
22586
|
-
const { initialAxesRanges } = action.payload;
|
|
22587
|
-
draft.initialAxesRanges = initialAxesRanges;
|
|
22588
|
-
break;
|
|
22589
|
-
}
|
|
22590
|
-
case UPDATE_AXES_RANGES: {
|
|
22591
|
-
const { axes } = action.payload;
|
|
22592
|
-
draft.axes = axes;
|
|
22593
|
-
break;
|
|
22594
|
-
}
|
|
22595
|
-
case RESET_AXES_RANGES: {
|
|
22596
|
-
const { initialAxesRanges } = draft;
|
|
22597
|
-
draft.axes = [...initialAxesRanges];
|
|
22598
|
-
break;
|
|
22599
|
-
}
|
|
22600
|
-
case TOGGLE_DRAG_POINTS: {
|
|
22601
|
-
draft.enableDragPoints = !draft.enableDragPoints;
|
|
22602
|
-
if (draft.panEnabled) {
|
|
22603
|
-
draft.panEnabled = false;
|
|
22604
|
-
}
|
|
22605
|
-
if (draft.zoomEnabled) {
|
|
22606
|
-
draft.zoomEnabled = false;
|
|
22607
|
-
}
|
|
22608
|
-
if (draft.enableDragAnnotation) {
|
|
22609
|
-
draft.enableDragAnnotation = false;
|
|
22610
|
-
}
|
|
22611
|
-
break;
|
|
22612
|
-
}
|
|
22613
|
-
case TOGGLE_DRAG_ANNOTATION: {
|
|
22614
|
-
draft.enableDragAnnotation = !draft.enableDragAnnotation;
|
|
22615
|
-
if (draft.panEnabled) {
|
|
22616
|
-
draft.panEnabled = false;
|
|
22617
|
-
}
|
|
22618
|
-
if (draft.zoomEnabled) {
|
|
22619
|
-
draft.zoomEnabled = false;
|
|
22620
|
-
}
|
|
22621
|
-
break;
|
|
22622
|
-
}
|
|
22623
|
-
case DISABLE_DRAG_OPTIONS: {
|
|
22624
|
-
if (draft.enableDragAnnotation || draft.enableDragPoints || draft.panEnabled || draft.zoomEnabled) {
|
|
22625
|
-
draft.enableDragAnnotation = false;
|
|
22626
|
-
draft.enableDragPoints = false;
|
|
22627
|
-
draft.panEnabled = false;
|
|
22628
|
-
draft.zoomEnabled = false;
|
|
22629
|
-
}
|
|
22630
|
-
break;
|
|
22631
|
-
}
|
|
22632
|
-
}
|
|
22633
|
-
});
|
|
22634
|
-
};
|
|
22635
|
-
var AxisType = /* @__PURE__ */ ((AxisType2) => {
|
|
22636
|
-
AxisType2["X"] = "x";
|
|
22637
|
-
AxisType2["Y"] = "y";
|
|
22638
|
-
return AxisType2;
|
|
22639
|
-
})(AxisType || {});
|
|
22640
|
-
var Position = /* @__PURE__ */ ((Position2) => {
|
|
22641
|
-
Position2["Bottom"] = "bottom";
|
|
22642
|
-
Position2["Top"] = "top";
|
|
22643
|
-
Position2["Left"] = "left";
|
|
22644
|
-
Position2["Right"] = "right";
|
|
22645
|
-
Position2["TopRight"] = "top-right";
|
|
22646
|
-
Position2["TopLeft"] = "top-left";
|
|
22647
|
-
Position2["BottomLeft"] = "bottom-left";
|
|
22648
|
-
Position2["BottomRight"] = "bottom-right";
|
|
22649
|
-
return Position2;
|
|
22650
|
-
})(Position || {});
|
|
22651
|
-
var ChartType$1 = /* @__PURE__ */ ((ChartType2) => {
|
|
22652
|
-
ChartType2["Line"] = "line";
|
|
22653
|
-
ChartType2["Bar"] = "bar";
|
|
22654
|
-
return ChartType2;
|
|
22655
|
-
})(ChartType$1 || {});
|
|
22656
|
-
var CursorStyle = /* @__PURE__ */ ((CursorStyle2) => {
|
|
22657
|
-
CursorStyle2["Pointer"] = "pointer";
|
|
22658
|
-
CursorStyle2["Initial"] = "initial";
|
|
22659
|
-
CursorStyle2["Grab"] = "grab";
|
|
22660
|
-
CursorStyle2["Grabbing"] = "grabbing";
|
|
22661
|
-
CursorStyle2["Crosshair"] = "crosshair";
|
|
22662
|
-
CursorStyle2["Move"] = "move";
|
|
22663
|
-
return CursorStyle2;
|
|
22664
|
-
})(CursorStyle || {});
|
|
22665
|
-
var ScaleType = /* @__PURE__ */ ((ScaleType2) => {
|
|
22666
|
-
ScaleType2["Category"] = "category";
|
|
22667
|
-
ScaleType2["Linear"] = "linear";
|
|
22668
|
-
ScaleType2["Logarithmic"] = "logarithmic";
|
|
22669
|
-
return ScaleType2;
|
|
22670
|
-
})(ScaleType || {});
|
|
22671
|
-
var ChartDirection$1 = /* @__PURE__ */ ((ChartDirection2) => {
|
|
22672
|
-
ChartDirection2["Vertical"] = "vertical";
|
|
22673
|
-
return ChartDirection2;
|
|
22674
|
-
})(ChartDirection$1 || {});
|
|
22675
|
-
var TooltipLabel = /* @__PURE__ */ ((TooltipLabel2) => {
|
|
22676
|
-
TooltipLabel2["Y"] = "yLabel";
|
|
22677
|
-
TooltipLabel2["X"] = "xLabel";
|
|
22678
|
-
return TooltipLabel2;
|
|
22679
|
-
})(TooltipLabel || {});
|
|
22680
|
-
var AlignOptions = /* @__PURE__ */ ((AlignOptions2) => {
|
|
22681
|
-
AlignOptions2["End"] = "end";
|
|
22682
|
-
AlignOptions2["Start"] = "start";
|
|
22683
|
-
AlignOptions2["Center"] = "center";
|
|
22684
|
-
AlignOptions2["Right"] = "right";
|
|
22685
|
-
AlignOptions2["Left"] = "left";
|
|
22686
|
-
return AlignOptions2;
|
|
22687
|
-
})(AlignOptions || {});
|
|
22688
|
-
var AnnotationType$1 = /* @__PURE__ */ ((AnnotationType2) => {
|
|
22689
|
-
AnnotationType2["Box"] = "box";
|
|
22690
|
-
AnnotationType2["Ellipse"] = "ellipse";
|
|
22691
|
-
AnnotationType2["Line"] = "line";
|
|
22692
|
-
AnnotationType2["Text"] = "text";
|
|
22693
|
-
return AnnotationType2;
|
|
22694
|
-
})(AnnotationType$1 || {});
|
|
22695
|
-
var PointStyle = /* @__PURE__ */ ((PointStyle2) => {
|
|
22696
|
-
PointStyle2["Circle"] = "circle";
|
|
22697
|
-
PointStyle2["Square"] = "rect";
|
|
22698
|
-
PointStyle2["Diamond"] = "rectRot";
|
|
22699
|
-
PointStyle2["Triangle"] = "triangle";
|
|
22700
|
-
return PointStyle2;
|
|
22701
|
-
})(PointStyle || {});
|
|
22702
|
-
var ChartHoverMode = /* @__PURE__ */ ((ChartHoverMode2) => {
|
|
22703
|
-
ChartHoverMode2["Nearest"] = "nearest";
|
|
22704
|
-
return ChartHoverMode2;
|
|
22705
|
-
})(ChartHoverMode || {});
|
|
22706
|
-
var PanZoomMode = /* @__PURE__ */ ((PanZoomMode2) => {
|
|
22707
|
-
PanZoomMode2["X"] = "x";
|
|
22708
|
-
PanZoomMode2["Y"] = "y";
|
|
22709
|
-
PanZoomMode2["XY"] = "xy";
|
|
22710
|
-
PanZoomMode2["Z"] = "z";
|
|
22711
|
-
return PanZoomMode2;
|
|
22712
|
-
})(PanZoomMode || {});
|
|
22713
|
-
var Key = /* @__PURE__ */ ((Key2) => {
|
|
22714
|
-
Key2["Shift"] = "Shift";
|
|
22715
|
-
return Key2;
|
|
22716
|
-
})(Key || {});
|
|
22717
|
-
var Events = /* @__PURE__ */ ((Events2) => {
|
|
22718
|
-
Events2["Mousemove"] = "mousemove";
|
|
22719
|
-
Events2["Mouseout"] = "mouseout";
|
|
22720
|
-
Events2["Click"] = "click";
|
|
22721
|
-
Events2["Touchstart"] = "touchstart";
|
|
22722
|
-
Events2["Touchmove"] = "touchmove";
|
|
22723
|
-
Events2["Dblclick"] = "dblclick";
|
|
22724
|
-
return Events2;
|
|
22725
|
-
})(Events || {});
|
|
22726
22514
|
const MINOR_TICKS_PER_MAJOR = 10;
|
|
22727
22515
|
const getLargestMajorTickWidth = (majorTickPositions) => {
|
|
22728
22516
|
return majorTickPositions.reduce(
|
|
@@ -22854,55 +22642,146 @@ const GRADIENT_COLORS = [
|
|
|
22854
22642
|
{ offset: 0.99, color: "rgba(255,182,193,0.8)" }
|
|
22855
22643
|
// Light red
|
|
22856
22644
|
];
|
|
22857
|
-
|
|
22858
|
-
|
|
22859
|
-
|
|
22860
|
-
|
|
22861
|
-
|
|
22862
|
-
|
|
22863
|
-
|
|
22864
|
-
|
|
22865
|
-
|
|
22866
|
-
|
|
22867
|
-
|
|
22868
|
-
|
|
22869
|
-
|
|
22870
|
-
|
|
22871
|
-
|
|
22872
|
-
};
|
|
22873
|
-
|
|
22874
|
-
|
|
22875
|
-
|
|
22876
|
-
|
|
22877
|
-
|
|
22878
|
-
|
|
22879
|
-
|
|
22880
|
-
|
|
22881
|
-
|
|
22882
|
-
|
|
22883
|
-
|
|
22884
|
-
|
|
22885
|
-
|
|
22886
|
-
|
|
22887
|
-
|
|
22888
|
-
|
|
22889
|
-
|
|
22890
|
-
|
|
22891
|
-
|
|
22892
|
-
|
|
22893
|
-
|
|
22894
|
-
|
|
22895
|
-
|
|
22896
|
-
|
|
22897
|
-
|
|
22898
|
-
|
|
22899
|
-
|
|
22900
|
-
|
|
22901
|
-
|
|
22902
|
-
|
|
22903
|
-
|
|
22904
|
-
|
|
22905
|
-
|
|
22645
|
+
var AxisType = /* @__PURE__ */ ((AxisType2) => {
|
|
22646
|
+
AxisType2["X"] = "x";
|
|
22647
|
+
AxisType2["Y"] = "y";
|
|
22648
|
+
return AxisType2;
|
|
22649
|
+
})(AxisType || {});
|
|
22650
|
+
var Position = /* @__PURE__ */ ((Position2) => {
|
|
22651
|
+
Position2["Bottom"] = "bottom";
|
|
22652
|
+
Position2["Top"] = "top";
|
|
22653
|
+
Position2["Left"] = "left";
|
|
22654
|
+
Position2["Right"] = "right";
|
|
22655
|
+
Position2["TopRight"] = "top-right";
|
|
22656
|
+
Position2["TopLeft"] = "top-left";
|
|
22657
|
+
Position2["BottomLeft"] = "bottom-left";
|
|
22658
|
+
Position2["BottomRight"] = "bottom-right";
|
|
22659
|
+
return Position2;
|
|
22660
|
+
})(Position || {});
|
|
22661
|
+
var ChartType$1 = /* @__PURE__ */ ((ChartType2) => {
|
|
22662
|
+
ChartType2["Line"] = "line";
|
|
22663
|
+
ChartType2["Bar"] = "bar";
|
|
22664
|
+
return ChartType2;
|
|
22665
|
+
})(ChartType$1 || {});
|
|
22666
|
+
var CursorStyle = /* @__PURE__ */ ((CursorStyle2) => {
|
|
22667
|
+
CursorStyle2["Pointer"] = "pointer";
|
|
22668
|
+
CursorStyle2["Initial"] = "initial";
|
|
22669
|
+
CursorStyle2["Grab"] = "grab";
|
|
22670
|
+
CursorStyle2["Grabbing"] = "grabbing";
|
|
22671
|
+
CursorStyle2["Crosshair"] = "crosshair";
|
|
22672
|
+
CursorStyle2["Move"] = "move";
|
|
22673
|
+
return CursorStyle2;
|
|
22674
|
+
})(CursorStyle || {});
|
|
22675
|
+
var ScaleType = /* @__PURE__ */ ((ScaleType2) => {
|
|
22676
|
+
ScaleType2["Category"] = "category";
|
|
22677
|
+
ScaleType2["Linear"] = "linear";
|
|
22678
|
+
ScaleType2["Logarithmic"] = "logarithmic";
|
|
22679
|
+
return ScaleType2;
|
|
22680
|
+
})(ScaleType || {});
|
|
22681
|
+
var ChartDirection$1 = /* @__PURE__ */ ((ChartDirection2) => {
|
|
22682
|
+
ChartDirection2["Vertical"] = "vertical";
|
|
22683
|
+
return ChartDirection2;
|
|
22684
|
+
})(ChartDirection$1 || {});
|
|
22685
|
+
var TooltipLabel = /* @__PURE__ */ ((TooltipLabel2) => {
|
|
22686
|
+
TooltipLabel2["Y"] = "yLabel";
|
|
22687
|
+
TooltipLabel2["X"] = "xLabel";
|
|
22688
|
+
return TooltipLabel2;
|
|
22689
|
+
})(TooltipLabel || {});
|
|
22690
|
+
var AlignOptions = /* @__PURE__ */ ((AlignOptions2) => {
|
|
22691
|
+
AlignOptions2["End"] = "end";
|
|
22692
|
+
AlignOptions2["Start"] = "start";
|
|
22693
|
+
AlignOptions2["Center"] = "center";
|
|
22694
|
+
AlignOptions2["Right"] = "right";
|
|
22695
|
+
AlignOptions2["Left"] = "left";
|
|
22696
|
+
return AlignOptions2;
|
|
22697
|
+
})(AlignOptions || {});
|
|
22698
|
+
var AnnotationType$1 = /* @__PURE__ */ ((AnnotationType2) => {
|
|
22699
|
+
AnnotationType2["Box"] = "box";
|
|
22700
|
+
AnnotationType2["Ellipse"] = "ellipse";
|
|
22701
|
+
AnnotationType2["Line"] = "line";
|
|
22702
|
+
AnnotationType2["Text"] = "text";
|
|
22703
|
+
return AnnotationType2;
|
|
22704
|
+
})(AnnotationType$1 || {});
|
|
22705
|
+
var PointStyle = /* @__PURE__ */ ((PointStyle2) => {
|
|
22706
|
+
PointStyle2["Circle"] = "circle";
|
|
22707
|
+
PointStyle2["Square"] = "rect";
|
|
22708
|
+
PointStyle2["Diamond"] = "rectRot";
|
|
22709
|
+
PointStyle2["Triangle"] = "triangle";
|
|
22710
|
+
return PointStyle2;
|
|
22711
|
+
})(PointStyle || {});
|
|
22712
|
+
var ChartHoverMode = /* @__PURE__ */ ((ChartHoverMode2) => {
|
|
22713
|
+
ChartHoverMode2["Nearest"] = "nearest";
|
|
22714
|
+
return ChartHoverMode2;
|
|
22715
|
+
})(ChartHoverMode || {});
|
|
22716
|
+
var PanZoomMode = /* @__PURE__ */ ((PanZoomMode2) => {
|
|
22717
|
+
PanZoomMode2["X"] = "x";
|
|
22718
|
+
PanZoomMode2["Y"] = "y";
|
|
22719
|
+
PanZoomMode2["XY"] = "xy";
|
|
22720
|
+
PanZoomMode2["Z"] = "z";
|
|
22721
|
+
return PanZoomMode2;
|
|
22722
|
+
})(PanZoomMode || {});
|
|
22723
|
+
var Key = /* @__PURE__ */ ((Key2) => {
|
|
22724
|
+
Key2["Shift"] = "Shift";
|
|
22725
|
+
return Key2;
|
|
22726
|
+
})(Key || {});
|
|
22727
|
+
var Events = /* @__PURE__ */ ((Events2) => {
|
|
22728
|
+
Events2["Mousemove"] = "mousemove";
|
|
22729
|
+
Events2["Mouseout"] = "mouseout";
|
|
22730
|
+
Events2["Click"] = "click";
|
|
22731
|
+
Events2["Touchstart"] = "touchstart";
|
|
22732
|
+
Events2["Touchmove"] = "touchmove";
|
|
22733
|
+
Events2["Dblclick"] = "dblclick";
|
|
22734
|
+
return Events2;
|
|
22735
|
+
})(Events || {});
|
|
22736
|
+
const chartAreaBorderPlugin = {
|
|
22737
|
+
id: "chartAreaBorder",
|
|
22738
|
+
beforeDraw(chart2, _2, options) {
|
|
22739
|
+
const {
|
|
22740
|
+
ctx,
|
|
22741
|
+
chartArea: { left: left2, top: top2, width, height }
|
|
22742
|
+
} = chart2;
|
|
22743
|
+
ctx.save();
|
|
22744
|
+
ctx.strokeStyle = options.borderColor;
|
|
22745
|
+
ctx.lineWidth = options.borderWidth;
|
|
22746
|
+
ctx.setLineDash(options.borderDash || []);
|
|
22747
|
+
ctx.lineDashOffset = options.borderDashOffset ?? 0;
|
|
22748
|
+
ctx.strokeRect(left2, top2, width, height);
|
|
22749
|
+
ctx.restore();
|
|
22750
|
+
}
|
|
22751
|
+
};
|
|
22752
|
+
const getPlugins = (graph, legend2) => {
|
|
22753
|
+
var _a2;
|
|
22754
|
+
let plugins = [];
|
|
22755
|
+
if (graph.showMinorGridlines) {
|
|
22756
|
+
plugins.push(chartMinorGridlinesPlugin);
|
|
22757
|
+
}
|
|
22758
|
+
const customLegend = legend2 == null ? void 0 : legend2.customLegend;
|
|
22759
|
+
if ((customLegend == null ? void 0 : customLegend.customLegendPlugin) && (customLegend == null ? void 0 : customLegend.customLegendContainerID)) {
|
|
22760
|
+
plugins.push({
|
|
22761
|
+
id: CUSTOM_LEGEND_PLUGIN_NAME,
|
|
22762
|
+
...(_a2 = legend2 == null ? void 0 : legend2.customLegend) == null ? void 0 : _a2.customLegendPlugin
|
|
22763
|
+
});
|
|
22764
|
+
}
|
|
22765
|
+
plugins.push(chartAreaBorderPlugin);
|
|
22766
|
+
return plugins;
|
|
22767
|
+
};
|
|
22768
|
+
const generateRandomColor = (colors2) => {
|
|
22769
|
+
const color2 = `#${Math.floor(Math.random() * WHITE_COLOR_AS_DECIMAL).toString(
|
|
22770
|
+
16
|
|
22771
|
+
)}`;
|
|
22772
|
+
if (colors2.includes(color2)) {
|
|
22773
|
+
return generateRandomColor(colors2);
|
|
22774
|
+
} else {
|
|
22775
|
+
colors2.push(color2);
|
|
22776
|
+
return colors2;
|
|
22777
|
+
}
|
|
22778
|
+
};
|
|
22779
|
+
const getTitle = (options) => {
|
|
22780
|
+
return options.title !== "" ? {
|
|
22781
|
+
display: true,
|
|
22782
|
+
text: options.title
|
|
22783
|
+
} : {};
|
|
22784
|
+
};
|
|
22906
22785
|
const isVertical = (direction) => {
|
|
22907
22786
|
return direction === ChartDirection$1.Vertical;
|
|
22908
22787
|
};
|
|
@@ -22985,28 +22864,121 @@ const isNilOrEmpty = (value) => {
|
|
|
22985
22864
|
}
|
|
22986
22865
|
return false;
|
|
22987
22866
|
};
|
|
22988
|
-
const
|
|
22989
|
-
|
|
22990
|
-
|
|
22991
|
-
const
|
|
22992
|
-
|
|
22993
|
-
|
|
22994
|
-
const
|
|
22995
|
-
|
|
22996
|
-
|
|
22997
|
-
|
|
22998
|
-
|
|
22999
|
-
|
|
23000
|
-
|
|
23001
|
-
|
|
23002
|
-
const generateKey = (values) => {
|
|
23003
|
-
const key = values.join("");
|
|
23004
|
-
return key;
|
|
22867
|
+
const isEmptyString = (value) => value === "";
|
|
22868
|
+
const chart$3 = "_chart_e3qdd_1";
|
|
22869
|
+
const canvas$2 = "_canvas_e3qdd_11";
|
|
22870
|
+
const fixedHeight$3 = "_fixedHeight_e3qdd_20";
|
|
22871
|
+
const stretchHeight$3 = "_stretchHeight_e3qdd_26";
|
|
22872
|
+
const squareAspectRatio$1 = "_squareAspectRatio_e3qdd_32";
|
|
22873
|
+
const table = "_table_e3qdd_62";
|
|
22874
|
+
const styles$5 = {
|
|
22875
|
+
chart: chart$3,
|
|
22876
|
+
canvas: canvas$2,
|
|
22877
|
+
fixedHeight: fixedHeight$3,
|
|
22878
|
+
stretchHeight: stretchHeight$3,
|
|
22879
|
+
squareAspectRatio: squareAspectRatio$1,
|
|
22880
|
+
table
|
|
23005
22881
|
};
|
|
23006
|
-
const
|
|
23007
|
-
const
|
|
23008
|
-
|
|
23009
|
-
|
|
22882
|
+
const TOGGLE_ZOOM = "TOGGLE_ZOOM";
|
|
22883
|
+
const TOGGLE_PAN = "TOGGLE_PAN";
|
|
22884
|
+
const TOGGLE_POINTS = "TOGGLE_POINTS";
|
|
22885
|
+
const TOGGLE_LINE = "TOGGLE_LINE";
|
|
22886
|
+
const TOGGLE_LEGEND = "TOGGLE_LEGEND";
|
|
22887
|
+
const TOGGLE_TABLE = "TOGGLE_TABLE";
|
|
22888
|
+
const RESET_AXES_RANGES = "RESET_AXES_RANGES";
|
|
22889
|
+
const UPDATE_AXES_RANGES = "UPDATE_AXES_RANGES";
|
|
22890
|
+
const TOGGLE_DRAG_POINTS = "TOGGLE_DRAG_POINTS";
|
|
22891
|
+
const TOGGLE_DRAG_ANNOTATION = "TOGGLE_DRAG_ANNOTATION";
|
|
22892
|
+
const DISABLE_DRAG_OPTIONS = "DISABLE_DRAG_OPTIONS";
|
|
22893
|
+
const reducer = (state, action) => {
|
|
22894
|
+
return produce(state, (draft) => {
|
|
22895
|
+
switch (action.type) {
|
|
22896
|
+
case TOGGLE_ZOOM: {
|
|
22897
|
+
draft.zoomEnabled = !draft.zoomEnabled;
|
|
22898
|
+
if (draft.panEnabled) {
|
|
22899
|
+
draft.panEnabled = false;
|
|
22900
|
+
}
|
|
22901
|
+
if (draft.enableDragPoints) {
|
|
22902
|
+
draft.enableDragPoints = false;
|
|
22903
|
+
}
|
|
22904
|
+
if (draft.enableDragAnnotation) {
|
|
22905
|
+
draft.enableDragAnnotation = false;
|
|
22906
|
+
}
|
|
22907
|
+
break;
|
|
22908
|
+
}
|
|
22909
|
+
case TOGGLE_PAN: {
|
|
22910
|
+
draft.panEnabled = !draft.panEnabled;
|
|
22911
|
+
if (draft.zoomEnabled) {
|
|
22912
|
+
draft.zoomEnabled = false;
|
|
22913
|
+
}
|
|
22914
|
+
if (draft.enableDragPoints) {
|
|
22915
|
+
draft.enableDragPoints = false;
|
|
22916
|
+
}
|
|
22917
|
+
if (draft.enableDragAnnotation) {
|
|
22918
|
+
draft.enableDragAnnotation = false;
|
|
22919
|
+
}
|
|
22920
|
+
break;
|
|
22921
|
+
}
|
|
22922
|
+
case TOGGLE_POINTS: {
|
|
22923
|
+
draft.pointsEnabled = !draft.pointsEnabled;
|
|
22924
|
+
break;
|
|
22925
|
+
}
|
|
22926
|
+
case TOGGLE_LINE: {
|
|
22927
|
+
draft.lineEnabled = !draft.lineEnabled;
|
|
22928
|
+
break;
|
|
22929
|
+
}
|
|
22930
|
+
case TOGGLE_LEGEND: {
|
|
22931
|
+
draft.legendEnabled = !draft.legendEnabled;
|
|
22932
|
+
break;
|
|
22933
|
+
}
|
|
22934
|
+
case TOGGLE_TABLE: {
|
|
22935
|
+
draft.showTable = !draft.showTable;
|
|
22936
|
+
break;
|
|
22937
|
+
}
|
|
22938
|
+
case UPDATE_AXES_RANGES: {
|
|
22939
|
+
const { axes } = action.payload;
|
|
22940
|
+
draft.axes = axes;
|
|
22941
|
+
break;
|
|
22942
|
+
}
|
|
22943
|
+
case RESET_AXES_RANGES: {
|
|
22944
|
+
const { axes } = action.payload;
|
|
22945
|
+
draft.axes = axes;
|
|
22946
|
+
break;
|
|
22947
|
+
}
|
|
22948
|
+
case TOGGLE_DRAG_POINTS: {
|
|
22949
|
+
draft.enableDragPoints = !draft.enableDragPoints;
|
|
22950
|
+
if (draft.panEnabled) {
|
|
22951
|
+
draft.panEnabled = false;
|
|
22952
|
+
}
|
|
22953
|
+
if (draft.zoomEnabled) {
|
|
22954
|
+
draft.zoomEnabled = false;
|
|
22955
|
+
}
|
|
22956
|
+
if (draft.enableDragAnnotation) {
|
|
22957
|
+
draft.enableDragAnnotation = false;
|
|
22958
|
+
}
|
|
22959
|
+
break;
|
|
22960
|
+
}
|
|
22961
|
+
case TOGGLE_DRAG_ANNOTATION: {
|
|
22962
|
+
draft.enableDragAnnotation = !draft.enableDragAnnotation;
|
|
22963
|
+
if (draft.panEnabled) {
|
|
22964
|
+
draft.panEnabled = false;
|
|
22965
|
+
}
|
|
22966
|
+
if (draft.zoomEnabled) {
|
|
22967
|
+
draft.zoomEnabled = false;
|
|
22968
|
+
}
|
|
22969
|
+
break;
|
|
22970
|
+
}
|
|
22971
|
+
case DISABLE_DRAG_OPTIONS: {
|
|
22972
|
+
if (draft.enableDragAnnotation || draft.enableDragPoints || draft.panEnabled || draft.zoomEnabled) {
|
|
22973
|
+
draft.enableDragAnnotation = false;
|
|
22974
|
+
draft.enableDragPoints = false;
|
|
22975
|
+
draft.panEnabled = false;
|
|
22976
|
+
draft.zoomEnabled = false;
|
|
22977
|
+
}
|
|
22978
|
+
break;
|
|
22979
|
+
}
|
|
22980
|
+
}
|
|
22981
|
+
});
|
|
23010
22982
|
};
|
|
23011
22983
|
const getChartStateFromStorage = (persistenceId) => {
|
|
23012
22984
|
if (!persistenceId) return null;
|
|
@@ -23051,8 +23023,6 @@ const storeChartStateInStorage = (state, persistenceId) => {
|
|
|
23051
23023
|
};
|
|
23052
23024
|
const initialState = ({ options, persistenceId }) => {
|
|
23053
23025
|
const {
|
|
23054
|
-
additionalAxesOptions: { range: customAxesRange = {} },
|
|
23055
|
-
axes,
|
|
23056
23026
|
chartOptions: {
|
|
23057
23027
|
enableZoom,
|
|
23058
23028
|
enablePan,
|
|
@@ -23063,45 +23033,6 @@ const initialState = ({ options, persistenceId }) => {
|
|
|
23063
23033
|
legend: { display },
|
|
23064
23034
|
dragData
|
|
23065
23035
|
} = options;
|
|
23066
|
-
const getStateAxesByType = (axisType, customAxesRange2) => {
|
|
23067
|
-
var _a2, _b2, _c2, _d2, _e2;
|
|
23068
|
-
if (!axes[axisType]) {
|
|
23069
|
-
return [];
|
|
23070
|
-
}
|
|
23071
|
-
if (((_a2 = axes[axisType]) == null ? void 0 : _a2.length) > 1) {
|
|
23072
|
-
return axes[axisType].map((axisObj, index2) => {
|
|
23073
|
-
var _a3, _b3;
|
|
23074
|
-
const id = generateAxisId(axisType, index2, axes[axisType].length > 1);
|
|
23075
|
-
const customMin = (_a3 = customAxesRange2 == null ? void 0 : customAxesRange2[id]) == null ? void 0 : _a3.min;
|
|
23076
|
-
const customMax = (_b3 = customAxesRange2 == null ? void 0 : customAxesRange2[id]) == null ? void 0 : _b3.max;
|
|
23077
|
-
const { unit } = axisObj;
|
|
23078
|
-
return {
|
|
23079
|
-
id,
|
|
23080
|
-
//only add custom axis ranges if defined:
|
|
23081
|
-
...customMin ? { min: customMin } : {},
|
|
23082
|
-
...customMax ? { max: customMax } : {},
|
|
23083
|
-
...unit ? { unit } : {}
|
|
23084
|
-
};
|
|
23085
|
-
});
|
|
23086
|
-
} else {
|
|
23087
|
-
const id = generateAxisId(axisType);
|
|
23088
|
-
const customMin = (_b2 = customAxesRange2 == null ? void 0 : customAxesRange2[id]) == null ? void 0 : _b2.min;
|
|
23089
|
-
const customMax = (_c2 = customAxesRange2 == null ? void 0 : customAxesRange2[id]) == null ? void 0 : _c2.max;
|
|
23090
|
-
const unit = (_e2 = (_d2 = axes == null ? void 0 : axes[id]) == null ? void 0 : _d2[0]) == null ? void 0 : _e2.unit;
|
|
23091
|
-
return [
|
|
23092
|
-
{
|
|
23093
|
-
id,
|
|
23094
|
-
//only add custom axis ranges if defined:
|
|
23095
|
-
...customMin ? { min: customMin } : {},
|
|
23096
|
-
...customMax ? { max: customMax } : {},
|
|
23097
|
-
...unit ? { unit } : {}
|
|
23098
|
-
}
|
|
23099
|
-
];
|
|
23100
|
-
}
|
|
23101
|
-
};
|
|
23102
|
-
const xStateAxes = getStateAxesByType(AxisType.X, customAxesRange);
|
|
23103
|
-
const yStateAxes = getStateAxesByType(AxisType.Y, customAxesRange);
|
|
23104
|
-
const stateAxes = [...xStateAxes, ...yStateAxes];
|
|
23105
23036
|
const {
|
|
23106
23037
|
zoomEnabled,
|
|
23107
23038
|
panEnabled,
|
|
@@ -23117,11 +23048,10 @@ const initialState = ({ options, persistenceId }) => {
|
|
|
23117
23048
|
pointsEnabled: pointsEnabled ?? showPoints,
|
|
23118
23049
|
lineEnabled: lineEnabled ?? showLine,
|
|
23119
23050
|
legendEnabled: legendEnabled ?? display,
|
|
23120
|
-
axes:
|
|
23051
|
+
axes: [],
|
|
23121
23052
|
showTable: false,
|
|
23122
23053
|
enableDragPoints: (dragData == null ? void 0 : dragData.enableDragData) && enableDragPoints,
|
|
23123
|
-
enableDragAnnotation: enableDragAnnotation ?? enableDragAnnotationStorage
|
|
23124
|
-
initialAxesRanges: []
|
|
23054
|
+
enableDragAnnotation: enableDragAnnotation ?? enableDragAnnotationStorage
|
|
23125
23055
|
};
|
|
23126
23056
|
};
|
|
23127
23057
|
const ControlsPortal = ({
|
|
@@ -24437,6 +24367,29 @@ const downloadPgn = (chartRef, state) => {
|
|
|
24437
24367
|
distExports.triggerBase64Download(dataUrl, fileName);
|
|
24438
24368
|
});
|
|
24439
24369
|
};
|
|
24370
|
+
const isLessThanMax = (value, max) => {
|
|
24371
|
+
return value === void 0 || max === void 0 || Number(value) < Number(max);
|
|
24372
|
+
};
|
|
24373
|
+
const isGreaterThanMin = (value, min) => {
|
|
24374
|
+
return value === void 0 || min === void 0 || Number(value) > Number(min);
|
|
24375
|
+
};
|
|
24376
|
+
const generateAxisId = (axisType, index2 = 0, hasMultiAxes = false) => {
|
|
24377
|
+
const i2 = hasMultiAxes && index2 !== 0 ? index2 + 1 : "";
|
|
24378
|
+
return `${axisType}${i2}`;
|
|
24379
|
+
};
|
|
24380
|
+
const getAxisTypeFromKey = (string) => {
|
|
24381
|
+
var _a2;
|
|
24382
|
+
return ((_a2 = string == null ? void 0 : string.match(/[^0-9/]+/gi)) == null ? void 0 : _a2[0]) ?? "";
|
|
24383
|
+
};
|
|
24384
|
+
const generateKey = (values) => {
|
|
24385
|
+
const key = values.join("");
|
|
24386
|
+
return key;
|
|
24387
|
+
};
|
|
24388
|
+
const isPrimitiveValue = (value) => typeof value === "string" || typeof value === "number" || typeof value === "boolean" || value === null;
|
|
24389
|
+
const isRangeValid = (r2) => {
|
|
24390
|
+
if (!r2) return false;
|
|
24391
|
+
return Object.values(r2).some((value) => !isNilOrEmpty(value));
|
|
24392
|
+
};
|
|
24440
24393
|
const useChartFunctions = ({
|
|
24441
24394
|
chartRef,
|
|
24442
24395
|
state,
|
|
@@ -24449,14 +24402,11 @@ const useChartFunctions = ({
|
|
|
24449
24402
|
axes
|
|
24450
24403
|
} = options;
|
|
24451
24404
|
const resetZoom2 = useCallback(() => {
|
|
24452
|
-
var _a2;
|
|
24453
24405
|
const chartInstance = chartRef == null ? void 0 : chartRef.current;
|
|
24454
|
-
|
|
24455
|
-
|
|
24456
|
-
|
|
24457
|
-
|
|
24458
|
-
}
|
|
24459
|
-
}, [chartRef]);
|
|
24406
|
+
chartInstance == null ? void 0 : chartInstance.resetZoom();
|
|
24407
|
+
chartInstance == null ? void 0 : chartInstance.reset();
|
|
24408
|
+
dispatch({ type: "RESET_AXES_RANGES", payload: { axes: state.axes } });
|
|
24409
|
+
}, [chartRef == null ? void 0 : chartRef.current, dispatch]);
|
|
24460
24410
|
const onHover = useCallback(
|
|
24461
24411
|
(hoveredPoint, setHoveredPoint) => {
|
|
24462
24412
|
return (evt, hoveredItems) => {
|
|
@@ -24479,7 +24429,7 @@ const useChartFunctions = ({
|
|
|
24479
24429
|
);
|
|
24480
24430
|
const handleDownload = useCallback(
|
|
24481
24431
|
() => downloadPgn(chartRef, state),
|
|
24482
|
-
[chartRef, state.axes]
|
|
24432
|
+
[chartRef == null ? void 0 : chartRef.current, state.axes]
|
|
24483
24433
|
);
|
|
24484
24434
|
const handleKeyDown = useCallback(
|
|
24485
24435
|
(event) => {
|
|
@@ -24494,7 +24444,7 @@ const useChartFunctions = ({
|
|
|
24494
24444
|
}
|
|
24495
24445
|
}
|
|
24496
24446
|
},
|
|
24497
|
-
[chartRef]
|
|
24447
|
+
[chartRef == null ? void 0 : chartRef.current]
|
|
24498
24448
|
);
|
|
24499
24449
|
const handleKeyUp = useCallback(
|
|
24500
24450
|
(event) => {
|
|
@@ -24509,7 +24459,7 @@ const useChartFunctions = ({
|
|
|
24509
24459
|
}
|
|
24510
24460
|
}
|
|
24511
24461
|
},
|
|
24512
|
-
[chartRef]
|
|
24462
|
+
[chartRef == null ? void 0 : chartRef.current]
|
|
24513
24463
|
);
|
|
24514
24464
|
const getControlsAxesLabels = useCallback(
|
|
24515
24465
|
(propsAxes) => {
|
|
@@ -24530,11 +24480,10 @@ const useChartFunctions = ({
|
|
|
24530
24480
|
});
|
|
24531
24481
|
}
|
|
24532
24482
|
};
|
|
24533
|
-
|
|
24483
|
+
return [
|
|
24534
24484
|
...getAxesLabels(propsAxes, AxisType.X),
|
|
24535
24485
|
...getAxesLabels(propsAxes, AxisType.Y)
|
|
24536
24486
|
];
|
|
24537
|
-
return axesLabels;
|
|
24538
24487
|
},
|
|
24539
24488
|
[axes]
|
|
24540
24489
|
);
|
|
@@ -24554,8 +24503,11 @@ const useChartFunctions = ({
|
|
|
24554
24503
|
});
|
|
24555
24504
|
}, [axes]);
|
|
24556
24505
|
const onResetAxes = useCallback(() => {
|
|
24557
|
-
|
|
24558
|
-
|
|
24506
|
+
const chartInstance = chartRef == null ? void 0 : chartRef.current;
|
|
24507
|
+
chartInstance == null ? void 0 : chartInstance.resetZoom();
|
|
24508
|
+
chartInstance == null ? void 0 : chartInstance.reset();
|
|
24509
|
+
dispatch({ type: RESET_AXES_RANGES, payload: { axes: state.axes } });
|
|
24510
|
+
}, [chartRef == null ? void 0 : chartRef.current]);
|
|
24559
24511
|
const onUpdateAxes = useCallback(({ axes: axes2 }) => {
|
|
24560
24512
|
dispatch({ type: UPDATE_AXES_RANGES, payload: { axes: axes2 } });
|
|
24561
24513
|
}, []);
|
|
@@ -24571,30 +24523,6 @@ const useChartFunctions = ({
|
|
|
24571
24523
|
onUpdateAxes
|
|
24572
24524
|
};
|
|
24573
24525
|
};
|
|
24574
|
-
var actionTypes = /* @__PURE__ */ ((actionTypes2) => {
|
|
24575
|
-
actionTypes2["Reset"] = "reset";
|
|
24576
|
-
actionTypes2["ValueUpdated"] = "valueUpdated";
|
|
24577
|
-
actionTypes2["UnitUpdated"] = "unitUpdated";
|
|
24578
|
-
return actionTypes2;
|
|
24579
|
-
})(actionTypes || {});
|
|
24580
|
-
const initializeFormState = ({
|
|
24581
|
-
chartRef,
|
|
24582
|
-
axes = []
|
|
24583
|
-
}) => {
|
|
24584
|
-
const chart2 = chartRef == null ? void 0 : chartRef.current;
|
|
24585
|
-
if (!chart2) return [];
|
|
24586
|
-
const initScales = (chart2 == null ? void 0 : chart2.getInitialScaleBounds()) ?? {};
|
|
24587
|
-
return Object.entries(initScales).map(([id, { min = "", max = "" }]) => {
|
|
24588
|
-
const { unit } = (axes == null ? void 0 : axes.find((axis) => axis.id === id)) ?? {};
|
|
24589
|
-
return {
|
|
24590
|
-
id,
|
|
24591
|
-
min,
|
|
24592
|
-
max,
|
|
24593
|
-
unit
|
|
24594
|
-
};
|
|
24595
|
-
}) || [];
|
|
24596
|
-
};
|
|
24597
|
-
const isEmptyString = (value) => value === "";
|
|
24598
24526
|
const createErrorMessages = (value, compareTo, type) => {
|
|
24599
24527
|
const errors = [];
|
|
24600
24528
|
if (isEmptyString(value)) errors.push("mustHaveAValue");
|
|
@@ -24605,144 +24533,114 @@ const createErrorMessages = (value, compareTo, type) => {
|
|
|
24605
24533
|
}
|
|
24606
24534
|
return errors;
|
|
24607
24535
|
};
|
|
24608
|
-
const validateAxes = (
|
|
24609
|
-
|
|
24610
|
-
|
|
24611
|
-
|
|
24612
|
-
|
|
24613
|
-
|
|
24614
|
-
|
|
24615
|
-
|
|
24616
|
-
};
|
|
24617
|
-
(_a2 = draft == null ? void 0 : draft.errors) == null ? void 0 : _a2.push({
|
|
24618
|
-
id,
|
|
24619
|
-
...errors
|
|
24620
|
-
});
|
|
24621
|
-
draft.valid = !(!acc.valid || !!errors.min.length || !!errors.max.length);
|
|
24622
|
-
});
|
|
24623
|
-
},
|
|
24624
|
-
{ errors: [], valid: true }
|
|
24536
|
+
const validateAxes = (axes) => {
|
|
24537
|
+
const errors = axes.map(({ id, min, max }) => ({
|
|
24538
|
+
id,
|
|
24539
|
+
min: createErrorMessages(String(min), String(max), "min"),
|
|
24540
|
+
max: createErrorMessages(String(max), String(min), "max")
|
|
24541
|
+
}));
|
|
24542
|
+
const valid = errors.every(
|
|
24543
|
+
(error) => error.min.length === 0 && error.max.length === 0
|
|
24625
24544
|
);
|
|
24545
|
+
return { errors, valid };
|
|
24626
24546
|
};
|
|
24627
|
-
const
|
|
24628
|
-
|
|
24629
|
-
|
|
24630
|
-
|
|
24631
|
-
|
|
24632
|
-
|
|
24633
|
-
|
|
24634
|
-
|
|
24635
|
-
|
|
24636
|
-
|
|
24637
|
-
|
|
24638
|
-
|
|
24639
|
-
|
|
24640
|
-
|
|
24641
|
-
|
|
24642
|
-
|
|
24643
|
-
|
|
24644
|
-
|
|
24645
|
-
|
|
24646
|
-
|
|
24647
|
-
|
|
24648
|
-
|
|
24649
|
-
});
|
|
24650
|
-
default:
|
|
24651
|
-
return state;
|
|
24652
|
-
}
|
|
24547
|
+
const RANGE_GAP$1 = 1;
|
|
24548
|
+
const getInitAxes = ({ chartRef, state }) => {
|
|
24549
|
+
const chart2 = chartRef == null ? void 0 : chartRef.current;
|
|
24550
|
+
if (!chart2) return [];
|
|
24551
|
+
const initScales = (chart2 == null ? void 0 : chart2.getInitialScaleBounds()) ?? {};
|
|
24552
|
+
return Object.entries(initScales).map(([id, { min = "", max = "" }]) => {
|
|
24553
|
+
var _a2;
|
|
24554
|
+
let adjustedMin = Number(min);
|
|
24555
|
+
let adjustedMax = Number(max);
|
|
24556
|
+
if (isNaN(adjustedMin)) adjustedMin = 0;
|
|
24557
|
+
if (isNaN(adjustedMax)) adjustedMax = adjustedMin + RANGE_GAP$1;
|
|
24558
|
+
if (adjustedMin === adjustedMax) {
|
|
24559
|
+
adjustedMax += RANGE_GAP$1;
|
|
24560
|
+
}
|
|
24561
|
+
const { unit } = ((_a2 = state == null ? void 0 : state.axes) == null ? void 0 : _a2.find((axis) => axis.id === id)) ?? {};
|
|
24562
|
+
return {
|
|
24563
|
+
id,
|
|
24564
|
+
min: adjustedMin,
|
|
24565
|
+
max: adjustedMax,
|
|
24566
|
+
unit
|
|
24567
|
+
};
|
|
24568
|
+
});
|
|
24653
24569
|
};
|
|
24654
24570
|
const AxesOptionsPopover = (optionsPopover) => {
|
|
24655
24571
|
var _a2;
|
|
24656
24572
|
const {
|
|
24657
|
-
|
|
24658
|
-
axes,
|
|
24573
|
+
state,
|
|
24659
24574
|
controlsAxesLabels,
|
|
24660
24575
|
onUpdateAxes,
|
|
24661
24576
|
onResetAxes,
|
|
24662
24577
|
depthType,
|
|
24663
24578
|
translations,
|
|
24664
|
-
close
|
|
24665
|
-
|
|
24666
|
-
|
|
24667
|
-
|
|
24668
|
-
|
|
24669
|
-
|
|
24670
|
-
|
|
24671
|
-
|
|
24672
|
-
|
|
24673
|
-
axes
|
|
24674
|
-
},
|
|
24675
|
-
initializeFormState
|
|
24676
|
-
);
|
|
24677
|
-
const { errors, valid } = validateAxes(formState);
|
|
24579
|
+
close,
|
|
24580
|
+
chartRef
|
|
24581
|
+
} = optionsPopover ?? {};
|
|
24582
|
+
const [formState, setFormState] = useState({
|
|
24583
|
+
localAxes: getInitAxes({ chartRef, state }),
|
|
24584
|
+
depthType: depthType == null ? void 0 : depthType.selectedDepthType,
|
|
24585
|
+
edited: false
|
|
24586
|
+
});
|
|
24587
|
+
const { errors, valid } = validateAxes(formState.localAxes);
|
|
24678
24588
|
const onEditValue = ({ name, value, id }) => {
|
|
24679
|
-
|
|
24680
|
-
|
|
24681
|
-
|
|
24682
|
-
|
|
24589
|
+
setFormState((prevState) => ({
|
|
24590
|
+
...prevState,
|
|
24591
|
+
localAxes: prevState.localAxes.map(
|
|
24592
|
+
(axis) => axis.id === id ? { ...axis, [name]: value } : axis
|
|
24593
|
+
),
|
|
24594
|
+
edited: true
|
|
24595
|
+
}));
|
|
24683
24596
|
};
|
|
24684
24597
|
const onEditUnit = ({ name, value, id }) => {
|
|
24685
|
-
|
|
24686
|
-
|
|
24687
|
-
|
|
24688
|
-
|
|
24598
|
+
setFormState((prevState) => ({
|
|
24599
|
+
...prevState,
|
|
24600
|
+
localAxes: prevState.localAxes.map(
|
|
24601
|
+
(axis) => axis.id === id && typeof axis.unit === "object" ? {
|
|
24602
|
+
...axis,
|
|
24603
|
+
unit: {
|
|
24604
|
+
...axis.unit,
|
|
24605
|
+
[name]: value
|
|
24606
|
+
}
|
|
24607
|
+
} : axis
|
|
24608
|
+
),
|
|
24609
|
+
edited: true
|
|
24610
|
+
}));
|
|
24689
24611
|
};
|
|
24690
24612
|
const onDone = (e2) => {
|
|
24691
24613
|
e2.preventDefault();
|
|
24692
24614
|
if (valid) {
|
|
24693
|
-
|
|
24694
|
-
|
|
24695
|
-
min: typeof axis.min === "string" ? Number(axis.min) : axis.min,
|
|
24696
|
-
max: typeof axis.max === "string" ? Number(axis.max) : axis.max
|
|
24697
|
-
}));
|
|
24698
|
-
onUpdateAxes({
|
|
24699
|
-
axes: sanitizedFormState
|
|
24700
|
-
});
|
|
24701
|
-
sanitizedFormState.map((el, i2) => {
|
|
24702
|
-
var _a3, _b2, _c2;
|
|
24703
|
-
const selectedUnit = (_a3 = el.unit) == null ? void 0 : _a3.selectedUnit;
|
|
24704
|
-
if (selectedUnit) {
|
|
24705
|
-
(_c2 = (_b2 = axes == null ? void 0 : axes[i2]) == null ? void 0 : _b2.unit) == null ? void 0 : _c2.setSelectedUnit(selectedUnit);
|
|
24706
|
-
}
|
|
24707
|
-
});
|
|
24708
|
-
if (depthType && (depthType == null ? void 0 : depthType.setSelectedDepthType)) {
|
|
24709
|
-
depthType == null ? void 0 : depthType.setSelectedDepthType(depthTypeState);
|
|
24710
|
-
}
|
|
24615
|
+
onUpdateAxes({ axes: formState.localAxes });
|
|
24616
|
+
close == null ? void 0 : close();
|
|
24711
24617
|
}
|
|
24712
|
-
close == null ? void 0 : close();
|
|
24713
24618
|
};
|
|
24714
24619
|
const onReset = () => {
|
|
24715
|
-
|
|
24716
|
-
|
|
24717
|
-
|
|
24620
|
+
setFormState({
|
|
24621
|
+
localAxes: getInitAxes({ chartRef, state }),
|
|
24622
|
+
depthType: depthType == null ? void 0 : depthType.selectedDepthType,
|
|
24623
|
+
edited: false
|
|
24718
24624
|
});
|
|
24719
24625
|
onResetAxes();
|
|
24720
24626
|
close == null ? void 0 : close();
|
|
24721
24627
|
};
|
|
24722
|
-
const isCustomValue = axes.filter((axis) => axis.max || axis.min).length > 0;
|
|
24723
24628
|
const handleInputFocus = (e2) => e2.target.select();
|
|
24724
24629
|
return /* @__PURE__ */ jsxs("form", { onSubmit: onDone, children: [
|
|
24725
|
-
formState.map((axis
|
|
24726
|
-
var _a3, _b2
|
|
24727
|
-
const shouldRenderUnit = (axis == null ? void 0 : axis.unit) && ((_a3 = axis == null ? void 0 : axis.options) == null ? void 0 : _a3.length);
|
|
24630
|
+
formState.localAxes.map((axis) => {
|
|
24631
|
+
var _a3, _b2;
|
|
24728
24632
|
const axisControl = controlsAxesLabels.find(
|
|
24729
24633
|
(el) => el.id === axis.id
|
|
24730
24634
|
);
|
|
24731
|
-
const axisLabel = axisControl == null ? void 0 : axisControl.label;
|
|
24732
|
-
const
|
|
24733
|
-
|
|
24734
|
-
);
|
|
24735
|
-
const axisErrors = errors == null ? void 0 : errors.find((a2) => a2.id === axis.id);
|
|
24736
|
-
const { min, max, unit } = axisState || {};
|
|
24737
|
-
const minErrorMsg = ((_b2 = axisErrors == null ? void 0 : axisErrors.min) == null ? void 0 : _b2[0]) ? translations[axisErrors.min[0]] : null;
|
|
24738
|
-
const maxErrorMsg = ((_c2 = axisErrors == null ? void 0 : axisErrors.max) == null ? void 0 : _c2[0]) ? translations[axisErrors.max[0]] : null;
|
|
24739
|
-
return /* @__PURE__ */ jsx(Field, { label: axisLabel || axis.id || "", children: /* @__PURE__ */ jsxs(InputGroup, { small: true, width: "300px", children: [
|
|
24635
|
+
const axisLabel = (axisControl == null ? void 0 : axisControl.label) || startCase(axis.id);
|
|
24636
|
+
const axisErrors = errors.find((err) => err.id === axis.id);
|
|
24637
|
+
return /* @__PURE__ */ jsx(Field, { label: axisLabel, children: /* @__PURE__ */ jsxs(InputGroup, { small: true, width: "300px", children: [
|
|
24740
24638
|
/* @__PURE__ */ jsx(
|
|
24741
24639
|
NumberInput,
|
|
24742
24640
|
{
|
|
24743
24641
|
name: "min",
|
|
24744
|
-
value: min,
|
|
24745
|
-
error:
|
|
24642
|
+
value: axis.min,
|
|
24643
|
+
error: ((_a3 = axisErrors == null ? void 0 : axisErrors.min) == null ? void 0 : _a3[0]) ? translations[axisErrors.min[0]] : null,
|
|
24746
24644
|
width: "100%",
|
|
24747
24645
|
onChange: (evt) => onEditValue({
|
|
24748
24646
|
name: evt.target.name,
|
|
@@ -24757,8 +24655,8 @@ const AxesOptionsPopover = (optionsPopover) => {
|
|
|
24757
24655
|
NumberInput,
|
|
24758
24656
|
{
|
|
24759
24657
|
name: "max",
|
|
24760
|
-
value: max,
|
|
24761
|
-
error:
|
|
24658
|
+
value: axis.max,
|
|
24659
|
+
error: ((_b2 = axisErrors == null ? void 0 : axisErrors.max) == null ? void 0 : _b2[0]) ? translations[axisErrors.max[0]] : null,
|
|
24762
24660
|
width: "100%",
|
|
24763
24661
|
onChange: (evt) => onEditValue({
|
|
24764
24662
|
name: evt.target.name,
|
|
@@ -24768,26 +24666,24 @@ const AxesOptionsPopover = (optionsPopover) => {
|
|
|
24768
24666
|
onFocus: handleInputFocus
|
|
24769
24667
|
}
|
|
24770
24668
|
),
|
|
24771
|
-
|
|
24669
|
+
axis.unit ? /* @__PURE__ */ jsx(
|
|
24772
24670
|
Select,
|
|
24773
24671
|
{
|
|
24774
24672
|
name: "selectedUnit",
|
|
24775
|
-
options:
|
|
24776
|
-
value: typeof unit !== "string" ? unit
|
|
24777
|
-
onChange: (e2) => {
|
|
24778
|
-
|
|
24779
|
-
|
|
24780
|
-
|
|
24781
|
-
|
|
24782
|
-
});
|
|
24783
|
-
},
|
|
24673
|
+
options: typeof axis.unit !== "string" ? axis.unit.options : [],
|
|
24674
|
+
value: typeof axis.unit !== "string" ? axis.unit.selectedUnit : void 0,
|
|
24675
|
+
onChange: (e2) => onEditUnit({
|
|
24676
|
+
name: e2.target.name,
|
|
24677
|
+
value: e2.target.value,
|
|
24678
|
+
id: axis.id
|
|
24679
|
+
}),
|
|
24784
24680
|
autoLayerWidth: true,
|
|
24785
24681
|
width: "15%"
|
|
24786
24682
|
}
|
|
24787
24683
|
) : null
|
|
24788
|
-
] }) },
|
|
24684
|
+
] }) }, axis.id);
|
|
24789
24685
|
}),
|
|
24790
|
-
((_a2 = depthType == null ? void 0 : depthType.options) == null ? void 0 : _a2.length) > 0
|
|
24686
|
+
((_a2 = depthType == null ? void 0 : depthType.options) == null ? void 0 : _a2.length) > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
24791
24687
|
/* @__PURE__ */ jsx(
|
|
24792
24688
|
ButtonGroup,
|
|
24793
24689
|
{
|
|
@@ -24795,15 +24691,16 @@ const AxesOptionsPopover = (optionsPopover) => {
|
|
|
24795
24691
|
key: i2,
|
|
24796
24692
|
label: depth
|
|
24797
24693
|
})),
|
|
24798
|
-
onSelected: (key) => {
|
|
24799
|
-
|
|
24800
|
-
|
|
24694
|
+
onSelected: (key) => setFormState((prevState) => ({
|
|
24695
|
+
...prevState,
|
|
24696
|
+
depthType: depthType.options[key]
|
|
24697
|
+
})),
|
|
24801
24698
|
small: true,
|
|
24802
|
-
value: depthType.options.indexOf(
|
|
24699
|
+
value: depthType.options.indexOf(formState.depthType)
|
|
24803
24700
|
}
|
|
24804
24701
|
),
|
|
24805
24702
|
/* @__PURE__ */ jsx(Spacer, {})
|
|
24806
|
-
] })
|
|
24703
|
+
] }),
|
|
24807
24704
|
/* @__PURE__ */ jsxs(Flex, { gap: "8px", alignItems: "center", children: [
|
|
24808
24705
|
/* @__PURE__ */ jsx(
|
|
24809
24706
|
Button,
|
|
@@ -24812,7 +24709,7 @@ const AxesOptionsPopover = (optionsPopover) => {
|
|
|
24812
24709
|
small: true,
|
|
24813
24710
|
colored: true,
|
|
24814
24711
|
label: translations.done,
|
|
24815
|
-
disabled: !valid
|
|
24712
|
+
disabled: !valid || !formState.edited
|
|
24816
24713
|
}
|
|
24817
24714
|
),
|
|
24818
24715
|
/* @__PURE__ */ jsx(
|
|
@@ -24821,8 +24718,7 @@ const AxesOptionsPopover = (optionsPopover) => {
|
|
|
24821
24718
|
small: true,
|
|
24822
24719
|
name: "resetAxes",
|
|
24823
24720
|
label: translations.resetAxes,
|
|
24824
|
-
onClick: onReset
|
|
24825
|
-
disabled: !isCustomValue
|
|
24721
|
+
onClick: onReset
|
|
24826
24722
|
}
|
|
24827
24723
|
),
|
|
24828
24724
|
/* @__PURE__ */ jsx(Text, { small: true, muted: true, children: translations.orDoubleClickToCanvas })
|
|
@@ -24830,36 +24726,16 @@ const AxesOptionsPopover = (optionsPopover) => {
|
|
|
24830
24726
|
] });
|
|
24831
24727
|
};
|
|
24832
24728
|
const AxesOptions = (optionsPopover) => {
|
|
24833
|
-
const {
|
|
24834
|
-
chartRef,
|
|
24835
|
-
axes,
|
|
24836
|
-
controlsAxesLabels,
|
|
24837
|
-
onUpdateAxes,
|
|
24838
|
-
onResetAxes,
|
|
24839
|
-
depthType,
|
|
24840
|
-
translations
|
|
24841
|
-
} = optionsPopover;
|
|
24842
24729
|
return /* @__PURE__ */ jsx(
|
|
24843
24730
|
Popover,
|
|
24844
24731
|
{
|
|
24845
24732
|
placement: "bottom-start",
|
|
24846
24733
|
overflowContainer: true,
|
|
24847
|
-
content: /* @__PURE__ */ jsx(
|
|
24848
|
-
AxesOptionsPopover,
|
|
24849
|
-
{
|
|
24850
|
-
chartRef,
|
|
24851
|
-
axes,
|
|
24852
|
-
controlsAxesLabels,
|
|
24853
|
-
onUpdateAxes,
|
|
24854
|
-
onResetAxes,
|
|
24855
|
-
depthType,
|
|
24856
|
-
translations
|
|
24857
|
-
}
|
|
24858
|
-
),
|
|
24734
|
+
content: /* @__PURE__ */ jsx(AxesOptionsPopover, { ...optionsPopover }),
|
|
24859
24735
|
children: /* @__PURE__ */ jsx(
|
|
24860
24736
|
Tooltip$2,
|
|
24861
24737
|
{
|
|
24862
|
-
text: translations.axesOptions,
|
|
24738
|
+
text: optionsPopover.translations.axesOptions,
|
|
24863
24739
|
placement: "bottom-start",
|
|
24864
24740
|
display: "inline-flex",
|
|
24865
24741
|
children: /* @__PURE__ */ jsx(Button, { small: true, basic: true, colored: "muted", round: true, icon: /* @__PURE__ */ jsx(TbRuler, {}) })
|
|
@@ -24869,9 +24745,9 @@ const AxesOptions = (optionsPopover) => {
|
|
|
24869
24745
|
);
|
|
24870
24746
|
};
|
|
24871
24747
|
const Controls = ({
|
|
24748
|
+
table: table2,
|
|
24872
24749
|
headerComponent,
|
|
24873
24750
|
subheaderComponent,
|
|
24874
|
-
table: table2,
|
|
24875
24751
|
chartRef,
|
|
24876
24752
|
state,
|
|
24877
24753
|
options,
|
|
@@ -24957,7 +24833,7 @@ const Controls = ({
|
|
|
24957
24833
|
AxesOptions,
|
|
24958
24834
|
{
|
|
24959
24835
|
chartRef,
|
|
24960
|
-
|
|
24836
|
+
state,
|
|
24961
24837
|
controlsAxesLabels,
|
|
24962
24838
|
onUpdateAxes,
|
|
24963
24839
|
onResetAxes,
|
|
@@ -25271,8 +25147,8 @@ const generateLineChartDatasets = (datasets, state, options, { label }) => {
|
|
|
25271
25147
|
const { lineEnabled, pointsEnabled, axes = [] } = state ?? {};
|
|
25272
25148
|
const { lineTension, spanGaps } = graph ?? {};
|
|
25273
25149
|
if (formation) {
|
|
25274
|
-
const axesMin = (_a2 = axes[0]) == null ? void 0 : _a2.min;
|
|
25275
|
-
const axesMax = (_b2 = axes[0]) == null ? void 0 : _b2.max;
|
|
25150
|
+
const axesMin = Number((_a2 = axes[0]) == null ? void 0 : _a2.min);
|
|
25151
|
+
const axesMax = Number((_b2 = axes[0]) == null ? void 0 : _b2.max);
|
|
25276
25152
|
const [startPoint, endPoint] = data;
|
|
25277
25153
|
if (axesMin && (startPoint == null ? void 0 : startPoint.x)) {
|
|
25278
25154
|
data[0].x = Math.max(axesMin, startPoint.x);
|
|
@@ -27404,7 +27280,7 @@ const LineChart = (props) => {
|
|
|
27404
27280
|
var _a2, _b2;
|
|
27405
27281
|
setDefaultTheme();
|
|
27406
27282
|
const chartRef = useRef(null);
|
|
27407
|
-
const { table: table2 } = props ?? {};
|
|
27283
|
+
const { table: table2, headerComponent, subheaderComponent } = props ?? {};
|
|
27408
27284
|
const { translations, languageKey } = getConfig();
|
|
27409
27285
|
const chart2 = getDefaultProps$3(props);
|
|
27410
27286
|
const {
|
|
@@ -27417,10 +27293,11 @@ const LineChart = (props) => {
|
|
|
27417
27293
|
const { annotations, axes, chartStyling, graph } = options ?? {};
|
|
27418
27294
|
const showCustomLegend = !((_b2 = (_a2 = options == null ? void 0 : options.legend) == null ? void 0 : _a2.customLegend) == null ? void 0 : _b2.customLegendContainerID);
|
|
27419
27295
|
const [state, dispatch] = useReducer(
|
|
27420
|
-
reducer
|
|
27296
|
+
reducer,
|
|
27421
27297
|
{
|
|
27422
27298
|
options,
|
|
27423
|
-
persistenceId
|
|
27299
|
+
persistenceId,
|
|
27300
|
+
chartRef
|
|
27424
27301
|
},
|
|
27425
27302
|
initialState
|
|
27426
27303
|
);
|
|
@@ -27472,7 +27349,9 @@ const LineChart = (props) => {
|
|
|
27472
27349
|
/* @__PURE__ */ jsx(
|
|
27473
27350
|
Controls,
|
|
27474
27351
|
{
|
|
27475
|
-
|
|
27352
|
+
table: table2,
|
|
27353
|
+
headerComponent,
|
|
27354
|
+
subheaderComponent,
|
|
27476
27355
|
chartRef,
|
|
27477
27356
|
state,
|
|
27478
27357
|
options,
|