sag_components 1.0.526 → 1.0.528

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.
@@ -13,6 +13,7 @@ var _TotalDoughnutChart = require("./TotalDoughnutChart.style");
13
13
  var _Benchmark = require("./Benchmark");
14
14
  /* TotalDoughnutChart */
15
15
  const TotalDoughnutChart = props => {
16
+ var _DoughnutChartContain, _DoughnutChartContain2;
16
17
  const {
17
18
  title,
18
19
  value,
@@ -29,11 +30,26 @@ const TotalDoughnutChart = props => {
29
30
  textcolor,
30
31
  noDataText
31
32
  } = props;
32
- const DEFAULT_ROOT_FONT = 18;
33
- const DEFAULT_COMPONENT_WIDTH = 250;
34
33
  const [DoughnutChartRadius, setDoughnutChartRadius] = (0, _react.useState)(0);
34
+ const [zoomResolution, setZoomResolution] = (0, _react.useState)(1);
35
35
  const DoughnutChartContainerRef = (0, _react.useRef)();
36
36
  const dotCutTrenty = row => dotCut ? (0, _CommonFunctions.getFormattedValue)(row.value) : (0, _CommonFunctions.getNumberWithCommas)(row.value);
37
+ (0, _react.useEffect)(() => {
38
+ const handleResize = () => {
39
+ setZoomResolution(window.devicePixelRatio);
40
+ };
41
+
42
+ // Add event listener for window resize to update zoom resolution
43
+ window.addEventListener('resize', handleResize);
44
+
45
+ // Initial update of zoom resolution
46
+ setZoomResolution(window.devicePixelRatio);
47
+
48
+ // Clean up the event listener when component unmounts
49
+ return () => {
50
+ window.removeEventListener('resize', handleResize);
51
+ };
52
+ }, []);
37
53
  (0, _react.useEffect)(() => {
38
54
  if (!DoughnutChartContainerRef) {
39
55
  return;
@@ -44,11 +60,13 @@ const TotalDoughnutChart = props => {
44
60
  if (!current) {
45
61
  return;
46
62
  }
47
- const DoughnutChartContainerWidth = current === null || current === void 0 ? void 0 : current.offsetWidth;
48
- const DoughnutChartContainerHeight = current === null || current === void 0 ? void 0 : current.offsetHeight;
63
+ const DoughnutChartContainerWidth = current === null || current === void 0 ? void 0 : current.clientWidth;
64
+ const DoughnutChartContainerHeight = current === null || current === void 0 ? void 0 : current.clientHeight;
65
+ console.log("DoughnutChartContainerRef", DoughnutChartContainerRef);
66
+ console.log("DoughnutChartContainerRef zoomResolution: ", zoomResolution);
49
67
  const radius = DoughnutChartContainerWidth > DoughnutChartContainerHeight ? DoughnutChartContainerHeight / 2 : DoughnutChartContainerWidth / 2;
50
68
  setDoughnutChartRadius(radius);
51
- }, [height, width]);
69
+ }, [height, width, DoughnutChartContainerRef === null || DoughnutChartContainerRef === void 0 ? void 0 : (_DoughnutChartContain = DoughnutChartContainerRef.current) === null || _DoughnutChartContain === void 0 ? void 0 : _DoughnutChartContain.clientWidth, DoughnutChartContainerRef === null || DoughnutChartContainerRef === void 0 ? void 0 : (_DoughnutChartContain2 = DoughnutChartContainerRef.current) === null || _DoughnutChartContain2 === void 0 ? void 0 : _DoughnutChartContain2.clientHeight]);
52
70
  return /*#__PURE__*/_react.default.createElement(_TotalDoughnutChart.ControlsContainer, {
53
71
  id: "ControlsContainer",
54
72
  height: height,
@@ -19,7 +19,7 @@ const CurrencySignAndFormattedValueContainer = exports.CurrencySignAndFormattedV
19
19
  const CurrencySign = exports.CurrencySign = _styledComponents.default.span(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2.default)(["\n font-weight: 500;\n font-size: 16px;\n @media (max-width: 1536px) {\n font-size: 14px;\n }\n @media (max-width: 1366px) {\n font-size: 11px;\n }\n"])));
20
20
  const FormattedValue = exports.FormattedValue = _styledComponents.default.div(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2.default)(["\n font-weight: 500;\n font-size: 40px;\n @media (max-width: 1536px) {\n font-size: 24px;\n } \n @media (max-width: 1366px) {\n font-size: 20px;\n }\n"])));
21
21
  const DoughnutChartAndLegendContainer = exports.DoughnutChartAndLegendContainer = _styledComponents.default.div(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n justify-content: space-between;\n margin-top: auto;\n padding: 0 20px;\n"])));
22
- const DoughnutChartContainer = exports.DoughnutChartContainer = _styledComponents.default.div(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2.default)(["\n //display: flex;\n //align-items: center;\n //position: relative; \n min-width: 45%;\n flex-basis: 45%;\n min-height: 6rem;\n"])));
22
+ const DoughnutChartContainer = exports.DoughnutChartContainer = _styledComponents.default.div(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2.default)(["\n \n min-width: 45%;\n flex-basis: 45%;\n min-height: 6rem;\n \n"])));
23
23
  const LegendContainer = exports.LegendContainer = _styledComponents.default.div(_templateObject12 || (_templateObject12 = (0, _taggedTemplateLiteral2.default)(["\n padding-left: 10px;\n display: flex;\n flex-direction: column;\n justify-content: space-evenly;\n"])));
24
24
  const LegendControlsContainer = exports.LegendControlsContainer = _styledComponents.default.div(_templateObject13 || (_templateObject13 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n gap: 0.5rem;\n align-items: center;\n margin-bottom: 0.375rem;\n"])));
25
25
  const LegendTitleAndFormatedValueContainer = exports.LegendTitleAndFormatedValueContainer = _styledComponents.default.div(_templateObject14 || (_templateObject14 = (0, _taggedTemplateLiteral2.default)(["\n flex-grow: 1;\n"])));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sag_components",
3
- "version": "1.0.526",
3
+ "version": "1.0.528",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {