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

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
@@ -22985,10 +22985,6 @@ const isNilOrEmpty = (value) => {
22985
22985
  }
22986
22986
  return false;
22987
22987
  };
22988
- const generateRandomKey = () => {
22989
- var _a2, _b2;
22990
- return (_b2 = (_a2 = Math.random()) == null ? void 0 : _a2.toString(36)) == null ? void 0 : _b2.substring(2, 10);
22991
- };
22992
22988
  const isLessThanMax = (value, max) => {
22993
22989
  return value === void 0 || max === void 0 || Number(value) < Number(max);
22994
22990
  };
@@ -24453,10 +24449,13 @@ const useChartFunctions = ({
24453
24449
  axes
24454
24450
  } = options;
24455
24451
  const resetZoom2 = useCallback(() => {
24452
+ var _a2;
24456
24453
  const chartInstance = chartRef == null ? void 0 : chartRef.current;
24457
- chartInstance == null ? void 0 : chartInstance.resetZoom();
24458
- chartInstance == null ? void 0 : chartInstance.reset();
24459
- dispatch({ type: "RESET_AXES_RANGES" });
24454
+ if ((chartInstance == null ? void 0 : chartInstance.isZoomedOrPanned()) || ((_a2 = state == null ? void 0 : state.axes) == null ? void 0 : _a2.length)) {
24455
+ chartInstance == null ? void 0 : chartInstance.resetZoom();
24456
+ chartInstance == null ? void 0 : chartInstance.reset();
24457
+ dispatch({ type: "RESET_AXES_RANGES" });
24458
+ }
24460
24459
  }, [chartRef]);
24461
24460
  const onHover = useCallback(
24462
24461
  (hoveredPoint, setHoveredPoint) => {
@@ -24723,9 +24722,9 @@ const AxesOptionsPopover = (optionsPopover) => {
24723
24722
  const isCustomValue = axes.filter((axis) => axis.max || axis.min).length > 0;
24724
24723
  const handleInputFocus = (e2) => e2.target.select();
24725
24724
  return /* @__PURE__ */ jsxs("form", { onSubmit: onDone, children: [
24726
- formState.map((axis) => {
24727
- var _a3, _b2, _c2;
24728
- const key = generateRandomKey();
24725
+ formState.map((axis, i2) => {
24726
+ var _a3, _b2, _c2, _d2;
24727
+ const shouldRenderUnit = (axis == null ? void 0 : axis.unit) && ((_a3 = axis == null ? void 0 : axis.options) == null ? void 0 : _a3.length);
24729
24728
  const axisControl = controlsAxesLabels.find(
24730
24729
  (el) => el.id === axis.id
24731
24730
  );
@@ -24735,8 +24734,8 @@ const AxesOptionsPopover = (optionsPopover) => {
24735
24734
  );
24736
24735
  const axisErrors = errors == null ? void 0 : errors.find((a2) => a2.id === axis.id);
24737
24736
  const { min, max, unit } = axisState || {};
24738
- const minErrorMsg = ((_a3 = axisErrors == null ? void 0 : axisErrors.min) == null ? void 0 : _a3[0]) ? translations[axisErrors.min[0]] : null;
24739
- const maxErrorMsg = ((_b2 = axisErrors == null ? void 0 : axisErrors.max) == null ? void 0 : _b2[0]) ? translations[axisErrors.max[0]] : null;
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;
24740
24739
  return /* @__PURE__ */ jsx(Field, { label: axisLabel || axis.id || "", children: /* @__PURE__ */ jsxs(InputGroup, { small: true, width: "300px", children: [
24741
24740
  /* @__PURE__ */ jsx(
24742
24741
  NumberInput,
@@ -24769,11 +24768,11 @@ const AxesOptionsPopover = (optionsPopover) => {
24769
24768
  onFocus: handleInputFocus
24770
24769
  }
24771
24770
  ),
24772
- axis.unit ? /* @__PURE__ */ jsx(
24771
+ shouldRenderUnit ? /* @__PURE__ */ jsx(
24773
24772
  Select,
24774
24773
  {
24775
24774
  name: "selectedUnit",
24776
- options: (_c2 = axis == null ? void 0 : axis.unit) == null ? void 0 : _c2.options,
24775
+ options: (_d2 = axis == null ? void 0 : axis.unit) == null ? void 0 : _d2.options,
24777
24776
  value: typeof unit !== "string" ? unit == null ? void 0 : unit.selectedUnit : void 0,
24778
24777
  onChange: (e2) => {
24779
24778
  onEditUnit({
@@ -24786,7 +24785,7 @@ const AxesOptionsPopover = (optionsPopover) => {
24786
24785
  width: "15%"
24787
24786
  }
24788
24787
  ) : null
24789
- ] }) }, key);
24788
+ ] }) }, i2);
24790
24789
  }),
24791
24790
  ((_a2 = depthType == null ? void 0 : depthType.options) == null ? void 0 : _a2.length) > 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
24792
24791
  /* @__PURE__ */ jsx(