@oliasoft-open-source/charts-library 3.4.0 → 3.4.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.
package/dist/index.js CHANGED
@@ -13197,76 +13197,89 @@ const DEFAULT_CHART_NAME = "new_chart";
13197
13197
  const CUSTOM_LEGEND_PLUGIN_NAME = "htmlLegend";
13198
13198
  const DECIMAL_POINT_TOLERANCE = 9;
13199
13199
  const MAX_DECIMAL_DIFF = 1 / 10 ** DECIMAL_POINT_TOLERANCE;
13200
- const AxisType = Object.freeze({
13201
- X: "x",
13202
- Y: "y"
13203
- });
13204
- const Position = Object.freeze({
13205
- Bottom: "bottom",
13206
- Top: "top",
13207
- Left: "left",
13208
- Right: "right",
13209
- TopRight: "top-right",
13210
- TopLeft: "top-left",
13211
- BottomLeft: "bottom-left",
13212
- BottomRight: "bottom-right"
13213
- });
13214
- const ChartType = Object.freeze({
13215
- Line: "line",
13216
- Bar: "bar"
13217
- });
13218
- const CursorStyle = Object.freeze({
13219
- Pointer: "pointer",
13220
- Initial: "initial"
13221
- });
13222
- const ScaleType = Object.freeze({
13223
- Category: "category",
13224
- //TODO: verify
13225
- Linear: "linear",
13226
- Logarithmic: "logarithmic"
13227
- });
13228
- const ChartDirection = Object.freeze({
13229
- Vertical: "vertical"
13230
- });
13231
- const TooltipLabel = Object.freeze({
13232
- Y: "yLabel",
13233
- X: "xLabel"
13234
- });
13235
- const AlignOptions = Object.freeze({
13236
- End: "end",
13237
- Start: "start",
13238
- Center: "center",
13239
- Right: "right",
13240
- Left: "left"
13241
- });
13242
- const AnnotationType = Object.freeze({
13243
- Box: "box",
13244
- Ellipse: "ellipse",
13245
- Line: "line",
13246
- Text: "text"
13247
- });
13248
- const PointStyle = Object.freeze({
13249
- Circle: "circle"
13250
- });
13251
- const ChartHoverMode = Object.freeze({
13252
- Nearest: "nearest"
13253
- });
13254
- const PanZoomMode = Object.freeze({
13255
- X: "x",
13256
- Y: "y",
13257
- XY: "xy"
13258
- });
13259
- const Key = Object.freeze({
13260
- Shift: "Shift"
13261
- });
13262
- const Events = Object.freeze([
13263
- "mousemove",
13264
- "mouseout",
13265
- "click",
13266
- "touchstart",
13267
- "touchmove",
13268
- "dblclick"
13269
- ]);
13200
+ var AxisType = /* @__PURE__ */ ((AxisType2) => {
13201
+ AxisType2["X"] = "x";
13202
+ AxisType2["Y"] = "y";
13203
+ return AxisType2;
13204
+ })(AxisType || {});
13205
+ var Position = /* @__PURE__ */ ((Position2) => {
13206
+ Position2["Bottom"] = "bottom";
13207
+ Position2["Top"] = "top";
13208
+ Position2["Left"] = "left";
13209
+ Position2["Right"] = "right";
13210
+ Position2["TopRight"] = "top-right";
13211
+ Position2["TopLeft"] = "top-left";
13212
+ Position2["BottomLeft"] = "bottom-left";
13213
+ Position2["BottomRight"] = "bottom-right";
13214
+ return Position2;
13215
+ })(Position || {});
13216
+ var ChartType = /* @__PURE__ */ ((ChartType2) => {
13217
+ ChartType2["Line"] = "line";
13218
+ ChartType2["Bar"] = "bar";
13219
+ return ChartType2;
13220
+ })(ChartType || {});
13221
+ var CursorStyle = /* @__PURE__ */ ((CursorStyle2) => {
13222
+ CursorStyle2["Pointer"] = "pointer";
13223
+ CursorStyle2["Initial"] = "initial";
13224
+ return CursorStyle2;
13225
+ })(CursorStyle || {});
13226
+ var ScaleType = /* @__PURE__ */ ((ScaleType2) => {
13227
+ ScaleType2["Category"] = "category";
13228
+ ScaleType2["Linear"] = "linear";
13229
+ ScaleType2["Logarithmic"] = "logarithmic";
13230
+ return ScaleType2;
13231
+ })(ScaleType || {});
13232
+ var ChartDirection = /* @__PURE__ */ ((ChartDirection2) => {
13233
+ ChartDirection2["Vertical"] = "vertical";
13234
+ return ChartDirection2;
13235
+ })(ChartDirection || {});
13236
+ var TooltipLabel = /* @__PURE__ */ ((TooltipLabel2) => {
13237
+ TooltipLabel2["Y"] = "yLabel";
13238
+ TooltipLabel2["X"] = "xLabel";
13239
+ return TooltipLabel2;
13240
+ })(TooltipLabel || {});
13241
+ var AlignOptions = /* @__PURE__ */ ((AlignOptions2) => {
13242
+ AlignOptions2["End"] = "end";
13243
+ AlignOptions2["Start"] = "start";
13244
+ AlignOptions2["Center"] = "center";
13245
+ AlignOptions2["Right"] = "right";
13246
+ AlignOptions2["Left"] = "left";
13247
+ return AlignOptions2;
13248
+ })(AlignOptions || {});
13249
+ var AnnotationType = /* @__PURE__ */ ((AnnotationType2) => {
13250
+ AnnotationType2["Box"] = "box";
13251
+ AnnotationType2["Ellipse"] = "ellipse";
13252
+ AnnotationType2["Line"] = "line";
13253
+ AnnotationType2["Text"] = "text";
13254
+ return AnnotationType2;
13255
+ })(AnnotationType || {});
13256
+ var PointStyle = /* @__PURE__ */ ((PointStyle2) => {
13257
+ PointStyle2["Circle"] = "circle";
13258
+ return PointStyle2;
13259
+ })(PointStyle || {});
13260
+ var ChartHoverMode = /* @__PURE__ */ ((ChartHoverMode2) => {
13261
+ ChartHoverMode2["Nearest"] = "nearest";
13262
+ return ChartHoverMode2;
13263
+ })(ChartHoverMode || {});
13264
+ var PanZoomMode = /* @__PURE__ */ ((PanZoomMode2) => {
13265
+ PanZoomMode2["X"] = "x";
13266
+ PanZoomMode2["Y"] = "y";
13267
+ PanZoomMode2["XY"] = "xy";
13268
+ return PanZoomMode2;
13269
+ })(PanZoomMode || {});
13270
+ var Key = /* @__PURE__ */ ((Key2) => {
13271
+ Key2["Shift"] = "Shift";
13272
+ return Key2;
13273
+ })(Key || {});
13274
+ var Events = /* @__PURE__ */ ((Events2) => {
13275
+ Events2["Mousemove"] = "mousemove";
13276
+ Events2["Mouseout"] = "mouseout";
13277
+ Events2["Click"] = "click";
13278
+ Events2["Touchstart"] = "touchstart";
13279
+ Events2["Touchmove"] = "touchmove";
13280
+ Events2["Dblclick"] = "dblclick";
13281
+ return Events2;
13282
+ })(Events || {});
13270
13283
  const chartAreaBorderPlugin = {
13271
13284
  id: "chartAreaBorder",
13272
13285
  beforeDraw(chart2, args, options) {
@@ -23649,11 +23662,12 @@ const useChartFunctions = ({
23649
23662
  onUpdateAxes
23650
23663
  };
23651
23664
  };
23652
- const actionTypes = Object.freeze({
23653
- reset: "reset",
23654
- valueUpdated: "valueUpdated",
23655
- unitUpdated: "unitUpdated"
23656
- });
23665
+ var actionTypes = /* @__PURE__ */ ((actionTypes2) => {
23666
+ actionTypes2["Reset"] = "reset";
23667
+ actionTypes2["ValueUpdated"] = "valueUpdated";
23668
+ actionTypes2["UnitUpdated"] = "unitUpdated";
23669
+ return actionTypes2;
23670
+ })(actionTypes || {});
23657
23671
  const initializeFormState = ({ initialAxesRanges, axes = [] }) => {
23658
23672
  return initialAxesRanges.map((initialAxisRange) => {
23659
23673
  const currentAxisRange = axes.find((a2) => a2.id === initialAxisRange.id);
@@ -23697,17 +23711,17 @@ const validateAxes = (formState) => {
23697
23711
  };
23698
23712
  const reducer = (state, action) => {
23699
23713
  switch (action.type) {
23700
- case actionTypes.reset: {
23714
+ case actionTypes.Reset: {
23701
23715
  const { initialAxesRanges, axes } = action.payload;
23702
23716
  return initializeFormState({ initialAxesRanges, axes });
23703
23717
  }
23704
- case actionTypes.valueUpdated:
23718
+ case actionTypes.ValueUpdated:
23705
23719
  return produce(state, (draft) => {
23706
23720
  const { name: name2, value, id } = action.payload;
23707
23721
  const axis = draft.find((a2) => a2.id === id);
23708
23722
  axis[name2] = value;
23709
23723
  });
23710
- case actionTypes.unitUpdated:
23724
+ case actionTypes.UnitUpdated:
23711
23725
  return produce(state, (draft) => {
23712
23726
  const { name: name2, value, id } = action.payload;
23713
23727
  const axis = draft.find((a2) => a2.id === id);
@@ -25262,7 +25276,7 @@ const useChartOptions = ({
25262
25276
  },
25263
25277
  scales,
25264
25278
  plugins,
25265
- events: Events
25279
+ events: Object.values(Events)
25266
25280
  }),
25267
25281
  [state, options]
25268
25282
  );
@@ -25538,30 +25552,31 @@ const chartAreaTextPlugin = {
25538
25552
  });
25539
25553
  }
25540
25554
  };
25541
- const defaultTranslations = Object.freeze({
25542
- label: "Label",
25543
- pointsLines: "Points & lines",
25544
- linesOnly: "Lines only",
25545
- pointsOnly: "Points only",
25546
- axesOptions: "Axes options",
25547
- resetAxes: "Reset Axes",
25548
- done: "Done",
25549
- downloadAsPNG: "Download as PNG",
25550
- showChart: "Show chart",
25551
- showTable: "Show table",
25552
- dragToZoom: "Drag to zoom",
25553
- dragToPan: "Drag to pan",
25554
- dragToMovePoints: "Drag to move points",
25555
- dragDisabled: "Drag disabled",
25556
- hideLegend: "Hide Legend",
25557
- showLegend: "Show Legend",
25558
- mustHaveAValue: "Must have a value",
25559
- mustBeANumber: "Must be a number",
25560
- mustBeLessThanMax: "Must be less than max",
25561
- mustBeGreaterThanMin: "Must be greater than min",
25562
- doubleClickToReset: "Double click on canvas to reset",
25563
- orDoubleClickToCanvas: "or double click on canvas"
25564
- });
25555
+ var defaultTranslations = /* @__PURE__ */ ((defaultTranslations2) => {
25556
+ defaultTranslations2["label"] = "Label";
25557
+ defaultTranslations2["pointsLines"] = "Points & lines";
25558
+ defaultTranslations2["linesOnly"] = "Lines only";
25559
+ defaultTranslations2["pointsOnly"] = "Points only";
25560
+ defaultTranslations2["axesOptions"] = "Axes options";
25561
+ defaultTranslations2["resetAxes"] = "Reset Axes";
25562
+ defaultTranslations2["done"] = "Done";
25563
+ defaultTranslations2["downloadAsPNG"] = "Download as PNG";
25564
+ defaultTranslations2["showChart"] = "Show chart";
25565
+ defaultTranslations2["showTable"] = "Show table";
25566
+ defaultTranslations2["dragToZoom"] = "Drag to zoom";
25567
+ defaultTranslations2["dragToPan"] = "Drag to pan";
25568
+ defaultTranslations2["dragToMovePoints"] = "Drag to move points";
25569
+ defaultTranslations2["dragDisabled"] = "Drag disabled";
25570
+ defaultTranslations2["hideLegend"] = "Hide Legend";
25571
+ defaultTranslations2["showLegend"] = "Show Legend";
25572
+ defaultTranslations2["mustHaveAValue"] = "Must have a value";
25573
+ defaultTranslations2["mustBeANumber"] = "Must be a number";
25574
+ defaultTranslations2["mustBeLessThanMax"] = "Must be less than max";
25575
+ defaultTranslations2["mustBeGreaterThanMin"] = "Must be greater than min";
25576
+ defaultTranslations2["doubleClickToReset"] = "Double click on canvas to reset";
25577
+ defaultTranslations2["orDoubleClickToCanvas"] = "or double click on canvas";
25578
+ return defaultTranslations2;
25579
+ })(defaultTranslations || {});
25565
25580
  const getTranslations = (translations = {}) => {
25566
25581
  return Object.keys(defaultTranslations).reduce(
25567
25582
  (acc, key) => ({