datastake-daf 0.6.382 → 0.6.384

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 (33) hide show
  1. package/dist/components/index.js +222 -345
  2. package/dist/style/datastake/mapbox-gl.css +330 -0
  3. package/dist/utils/index.js +0 -24
  4. package/package.json +2 -2
  5. package/src/@daf/core/components/Charts/AreaChart/AreaChart.stories.jsx +1 -444
  6. package/src/@daf/core/components/Charts/AreaChart/index.jsx +12 -27
  7. package/src/@daf/core/components/Charts/BarChart/BarChart.stories.jsx +0 -88
  8. package/src/@daf/core/components/Charts/BarChart/index.jsx +12 -27
  9. package/src/@daf/core/components/Charts/ColumnChart/ColumnChart.stories.jsx +28 -23
  10. package/src/@daf/core/components/Charts/ColumnChart/index.jsx +20 -42
  11. package/src/@daf/core/components/Charts/DonutPie/DonutPie.stories.jsx +0 -55
  12. package/src/@daf/core/components/Charts/DonutPie/index.js +11 -21
  13. package/src/@daf/core/components/Charts/DualAxes/DualAxes.stories.js +0 -33
  14. package/src/@daf/core/components/Charts/DualAxes/index.js +0 -21
  15. package/src/@daf/core/components/Charts/LineChart/LineChart.stories.jsx +0 -81
  16. package/src/@daf/core/components/Charts/LineChart/index.jsx +12 -21
  17. package/src/@daf/core/components/Charts/PieChart/PieChart.stories.js +0 -52
  18. package/src/@daf/core/components/Charts/PieChart/chart.jsx +90 -20
  19. package/src/@daf/core/components/Charts/RadarChart/RadarChart.stories.jsx +0 -52
  20. package/src/@daf/core/components/Charts/RadarChart/index.jsx +0 -21
  21. package/src/@daf/core/components/Charts/RadialBarChart/RadialBarChart.stories.jsx +0 -56
  22. package/src/@daf/core/components/Charts/RadialBarChart/index.jsx +0 -22
  23. package/src/@daf/core/components/Charts/StackChart/StackChart.stories.jsx +0 -22
  24. package/src/@daf/core/components/Charts/StackChart/index.jsx +14 -22
  25. package/src/@daf/core/components/Screens/Admin/AdminModals/AddUser/index.jsx +4 -2
  26. package/src/@daf/core/components/Screens/Admin/AdminModals/NewUser/index.jsx +23 -5
  27. package/src/@daf/core/components/Screens/Admin/AdminViews/components/Edit/index.jsx +12 -1
  28. package/src/@daf/core/components/Screens/Admin/AdminViews/components/Users/helper.js +2 -0
  29. package/src/@daf/core/components/Screens/Admin/AdminViews/components/Users/index.jsx +2 -0
  30. package/src/helpers/StringHelper.js +0 -29
  31. package/src/utils.js +1 -1
  32. package/src/@daf/core/components/Charts/components/CustomLegend/index.js +0 -80
  33. package/src/@daf/core/components/Charts/helper.js +0 -25
@@ -45763,7 +45763,7 @@ dt.div`
45763
45763
  }
45764
45764
 
45765
45765
  `;
45766
- dt.ul`
45766
+ const LegendStyle = dt.ul`
45767
45767
  list-style: none;
45768
45768
  margin: var(--size-lg) 0 0;
45769
45769
  padding: 0;
@@ -45788,98 +45788,6 @@ dt.ul`
45788
45788
  }
45789
45789
  `;
45790
45790
 
45791
- const useLegendConfig = ({
45792
- legendConfig,
45793
- isPdf
45794
- }) => {
45795
- const {
45796
- enabled,
45797
- position: legendPosition = 'bottom',
45798
- items: _legendItems = null,
45799
- layout: legendLayout = 'horizontal',
45800
- interactive: legendInteractive = true,
45801
- style: legendStyle = {}
45802
- } = legendConfig;
45803
- const legendEnabled = enabled !== undefined ? isPdf || enabled : isPdf;
45804
- const [legendItems, setLegendItems] = React__default["default"].useState(_legendItems);
45805
- return {
45806
- legendEnabled,
45807
- legendItems,
45808
- legendPosition,
45809
- legendLayout,
45810
- legendInteractive,
45811
- legendStyle
45812
- };
45813
- };
45814
-
45815
- const CustomLegend = ({
45816
- items = [],
45817
- onToggle,
45818
- layout = 'horizontal',
45819
- interactive = true,
45820
- style = {}
45821
- }) => {
45822
- const isVertical = layout === 'vertical';
45823
- return /*#__PURE__*/jsxRuntime.jsx("div", {
45824
- style: {
45825
- display: "flex",
45826
- justifyContent: "center",
45827
- alignItems: isVertical ? "flex-start" : "center",
45828
- flexDirection: isVertical ? "column" : "row",
45829
- flexWrap: isVertical ? "nowrap" : "wrap",
45830
- gap: isVertical ? "12px" : "20px",
45831
- paddingTop: "16px",
45832
- ...style
45833
- },
45834
- children: items?.map((item, index) => /*#__PURE__*/jsxRuntime.jsxs("div", {
45835
- onClick: () => interactive && onToggle && onToggle(item.id),
45836
- style: {
45837
- display: "flex",
45838
- alignItems: "flex-start",
45839
- opacity: item.hidden ? 0.4 : 1,
45840
- transition: "opacity 0.2s ease",
45841
- userSelect: "none",
45842
- maxWidth: isVertical ? "300px" : "auto"
45843
- },
45844
- children: [/*#__PURE__*/jsxRuntime.jsx("div", {
45845
- style: {
45846
- width: 16,
45847
- height: 16,
45848
- backgroundColor: item.color,
45849
- marginRight: 8,
45850
- borderRadius: 3,
45851
- flexShrink: 0,
45852
- marginTop: 2,
45853
- border: item.hidden ? "2px solid #d9d9d9" : "none",
45854
- boxSizing: "border-box"
45855
- }
45856
- }), /*#__PURE__*/jsxRuntime.jsxs("div", {
45857
- style: {
45858
- display: "flex",
45859
- flexDirection: "column",
45860
- gap: "4px"
45861
- },
45862
- children: [/*#__PURE__*/jsxRuntime.jsx("span", {
45863
- style: {
45864
- fontSize: 14,
45865
- fontWeight: 500,
45866
- color: item.hidden ? "#999" : "#262626",
45867
- lineHeight: "20px"
45868
- },
45869
- children: item.label
45870
- }), item.description && /*#__PURE__*/jsxRuntime.jsx("span", {
45871
- style: {
45872
- fontSize: 12,
45873
- color: item.hidden ? "#bfbfbf" : "#8c8c8c",
45874
- lineHeight: "18px"
45875
- },
45876
- children: item.description
45877
- })]
45878
- })]
45879
- }, index))
45880
- });
45881
- };
45882
-
45883
45791
  const Chart = _ref => {
45884
45792
  let {
45885
45793
  data = [],
@@ -45896,7 +45804,6 @@ const Chart = _ref => {
45896
45804
  children = null,
45897
45805
  legend,
45898
45806
  isPdf = false,
45899
- legendConfig = {},
45900
45807
  isPercentage = false
45901
45808
  } = _ref;
45902
45809
  const [hoveredGroup, setHoveredGroup] = React.useState(null);
@@ -45905,17 +45812,6 @@ const Chart = _ref => {
45905
45812
  const [mouseY, setMouseY] = React.useState(0);
45906
45813
  const [mouseX, setMouseX] = React.useState(0);
45907
45814
  const [mouseLocked, setMouseLocked] = React.useState(false);
45908
- const {
45909
- legendEnabled,
45910
- legendItems,
45911
- legendPosition,
45912
- legendLayout,
45913
- legendInteractive,
45914
- legendStyle
45915
- } = useLegendConfig({
45916
- legendConfig,
45917
- isPdf
45918
- });
45919
45815
  const getCoordinatesForPercent = React.useCallback(percent => [Math.cos(2 * Math.PI * percent), Math.sin(2 * Math.PI * percent)], []);
45920
45816
  const onMouseLeaveHandler = React.useCallback((e, hG, id) => {
45921
45817
  if (mouseLocked) {
@@ -45939,6 +45835,31 @@ const Chart = _ref => {
45939
45835
  }));
45940
45836
  }
45941
45837
  }, [svgRef, containerRef, hoveredGroup, mouseLocked]);
45838
+ const legendConfig = React.useMemo(() => {
45839
+ if (legend === false || legend === null) {
45840
+ return isPdf ? {} : null;
45841
+ }
45842
+ if (typeof legend === 'object') {
45843
+ return legend;
45844
+ }
45845
+ if (legend === true || isPdf) {
45846
+ return {};
45847
+ }
45848
+ return null;
45849
+ }, [legend, isPdf]);
45850
+ const legendItems = React.useMemo(() => {
45851
+ const items = Array.isArray(data) ? data : [];
45852
+ if (!legendConfig) {
45853
+ return [];
45854
+ }
45855
+ const {
45856
+ itemName
45857
+ } = legendConfig;
45858
+ const getName = typeof (itemName === null || itemName === void 0 ? void 0 : itemName.formatter) === 'function' ? (item, index) => itemName.formatter(item.name || item.label || "Item ".concat(index + 1), item, index) : (item, index) => item.name || item.label || "Item ".concat(index + 1);
45859
+ return items.map((item, index) => _objectSpread2(_objectSpread2({}, item), {}, {
45860
+ label: getName(item, index)
45861
+ }));
45862
+ }, [data, legendConfig]);
45942
45863
  const dataToShow = React.useMemo(() => {
45943
45864
  let cumulativePercent = 0;
45944
45865
  function getRotationAngle(percent) {
@@ -46038,11 +45959,59 @@ const Chart = _ref => {
46038
45959
  onMouseMove: e => onMouseLeaveHandler(e, {}, 0)
46039
45960
  } : {}), {}, {
46040
45961
  children: dataToShow
46041
- })), tooltip, legendEnabled && legendPosition === 'bottom' && /*#__PURE__*/jsxRuntime.jsx(CustomLegend, {
46042
- items: legendItems,
46043
- layout: legendLayout,
46044
- interactive: legendInteractive,
46045
- style: legendStyle
45962
+ })), tooltip, !!legendConfig && legendItems.length > 0 && /*#__PURE__*/jsxRuntime.jsx(LegendStyle, {
45963
+ className: legendConfig === null || legendConfig === void 0 ? void 0 : legendConfig.className,
45964
+ "data-position": (legendConfig === null || legendConfig === void 0 ? void 0 : legendConfig.position) || 'bottom',
45965
+ children: legendItems.map((item, index) => {
45966
+ var _item$id;
45967
+ const markerStyle = (legendConfig === null || legendConfig === void 0 ? void 0 : legendConfig.marker) || {};
45968
+ return /*#__PURE__*/jsxRuntime.jsxs("li", {
45969
+ className: item.className,
45970
+ onMouseEnter: () => {
45971
+ if (mouseLocked) {
45972
+ return;
45973
+ }
45974
+ setHoveredGroup(_objectSpread2(_objectSpread2({}, item), {}, {
45975
+ id: index,
45976
+ fromLegend: true
45977
+ }));
45978
+ },
45979
+ onMouseLeave: () => {
45980
+ if (mouseLocked) {
45981
+ return;
45982
+ }
45983
+ setHoveredGroup(null);
45984
+ },
45985
+ onClick: () => {
45986
+ if (!changeOpacityOnHover) {
45987
+ return;
45988
+ }
45989
+ if ((hoveredGroup === null || hoveredGroup === void 0 ? void 0 : hoveredGroup.id) === index && hoveredGroup !== null && hoveredGroup !== void 0 && hoveredGroup.fromLegend) {
45990
+ setHoveredGroup(null);
45991
+ setMouseLocked(false);
45992
+ return;
45993
+ }
45994
+ setHoveredGroup(_objectSpread2(_objectSpread2({}, item), {}, {
45995
+ id: index,
45996
+ fromLegend: true
45997
+ }));
45998
+ setMouseLocked(prev => !prev);
45999
+ },
46000
+ children: [/*#__PURE__*/jsxRuntime.jsx("span", {
46001
+ className: "legend-marker",
46002
+ style: {
46003
+ backgroundColor: item.color,
46004
+ width: (markerStyle === null || markerStyle === void 0 ? void 0 : markerStyle.size) || 12,
46005
+ height: (markerStyle === null || markerStyle === void 0 ? void 0 : markerStyle.size) || 12,
46006
+ borderRadius: (markerStyle === null || markerStyle === void 0 ? void 0 : markerStyle.shape) === 'square' ? 2 : '50%',
46007
+ border: (markerStyle === null || markerStyle === void 0 ? void 0 : markerStyle.style) === 'line' ? "2px solid ".concat(item.color) : undefined,
46008
+ background: (markerStyle === null || markerStyle === void 0 ? void 0 : markerStyle.style) === 'line' ? 'transparent' : item.color
46009
+ }
46010
+ }), /*#__PURE__*/jsxRuntime.jsx("span", {
46011
+ children: item.label
46012
+ })]
46013
+ }, (_item$id = item.id) !== null && _item$id !== void 0 ? _item$id : index);
46014
+ })
46046
46015
  }), children]
46047
46016
  });
46048
46017
  };
@@ -49412,7 +49381,7 @@ const Container$1 = dt.div`
49412
49381
  width: ${props => props.isPdf ? props.width ? props.width : '1000px' : 'calc(100% - 48px)'};
49413
49382
  `;
49414
49383
 
49415
- const _excluded$7 = ["data", "xFieldKey", "yFieldKey", "renderTooltipContent", "tooltipConfig", "animated", "isStack", "isGroup", "isPercentage", "seriesField", "formattedYAxis", "formattedXAxis", "color", "height", "t", "isPdf", "legendConfig", "width"];
49384
+ const _excluded$7 = ["data", "xFieldKey", "yFieldKey", "renderTooltipContent", "tooltipConfig", "animated", "isStack", "isGroup", "isPercentage", "seriesField", "formattedYAxis", "formattedXAxis", "color", "height", "t", "isPdf", "extraLegendConfig", "width"];
49416
49385
  const {
49417
49386
  useToken: useToken$g
49418
49387
  } = antd.theme;
@@ -49498,7 +49467,7 @@ function BarChart(_ref) {
49498
49467
  height,
49499
49468
  t = s => s,
49500
49469
  isPdf = false,
49501
- legendConfig = {},
49470
+ extraLegendConfig = {},
49502
49471
  width
49503
49472
  } = _ref;
49504
49473
  _objectWithoutProperties(_ref, _excluded$7);
@@ -49507,17 +49476,7 @@ function BarChart(_ref) {
49507
49476
  const {
49508
49477
  token
49509
49478
  } = useToken$g();
49510
- const {
49511
- legendEnabled,
49512
- legendItems,
49513
- legendPosition,
49514
- legendLayout,
49515
- legendInteractive,
49516
- legendStyle
49517
- } = useLegendConfig({
49518
- legendConfig,
49519
- isPdf
49520
- });
49479
+ const hasLegendConfig = Object.keys(extraLegendConfig).length > 0;
49521
49480
  React__default["default"].useEffect(() => {
49522
49481
  if (!containerRef.current) {
49523
49482
  return;
@@ -49548,7 +49507,12 @@ function BarChart(_ref) {
49548
49507
  isStack,
49549
49508
  color: color || token.colorPrimary7,
49550
49509
  seriesField,
49551
- legend: false,
49510
+ legend: isPdf ? _objectSpread2({
49511
+ itemName: {
49512
+ formatter: text => t(text)
49513
+ },
49514
+ position: 'bottom'
49515
+ }, extraLegendConfig) : hasLegendConfig || false,
49552
49516
  animation: animated
49553
49517
  };
49554
49518
  if (!chartRef.current) {
@@ -49566,26 +49530,21 @@ function BarChart(_ref) {
49566
49530
  }
49567
49531
  };
49568
49532
  }, []);
49569
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
49533
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
49570
49534
  className: "flex flex-1 flex-column justify-content-center",
49571
- children: [/*#__PURE__*/jsxRuntime.jsx("div", {
49535
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
49572
49536
  className: "flex justify-content-center",
49573
49537
  children: /*#__PURE__*/jsxRuntime.jsx(Container$1, {
49574
49538
  ref: containerRef,
49575
49539
  height: height,
49576
- isPdf: false,
49540
+ isPdf: isPdf,
49577
49541
  width: width
49578
49542
  })
49579
- }), legendEnabled && legendPosition === 'bottom' && /*#__PURE__*/jsxRuntime.jsx(CustomLegend, {
49580
- items: legendItems,
49581
- layout: legendLayout,
49582
- interactive: legendInteractive,
49583
- style: legendStyle
49584
- })]
49543
+ })
49585
49544
  });
49586
49545
  }
49587
49546
 
49588
- const _excluded$6 = ["data", "xFieldKey", "yFieldKey", "renderTooltipContent", "tooltipConfig", "animated", "isSmooth", "seriesField", "isArea", "formattedYAxis", "formattedXAxis", "color", "isPercentage", "height", "autoHideXLabel", "t", "isPdf", "legendConfig", "width"];
49547
+ const _excluded$6 = ["data", "xFieldKey", "yFieldKey", "renderTooltipContent", "tooltipConfig", "animated", "isSmooth", "seriesField", "isArea", "formattedYAxis", "formattedXAxis", "color", "isPercentage", "height", "autoHideXLabel", "t", "isPdf", "extraLegendConfig", "width"];
49589
49548
  const {
49590
49549
  useToken: useToken$f
49591
49550
  } = antd.theme;
@@ -49669,7 +49628,7 @@ function LineChart(_ref) {
49669
49628
  autoHideXLabel = true,
49670
49629
  t = s => s,
49671
49630
  isPdf = false,
49672
- legendConfig = {},
49631
+ extraLegendConfig = {},
49673
49632
  width
49674
49633
  } = _ref;
49675
49634
  _objectWithoutProperties(_ref, _excluded$6);
@@ -49678,17 +49637,7 @@ function LineChart(_ref) {
49678
49637
  const {
49679
49638
  token
49680
49639
  } = useToken$f();
49681
- const {
49682
- legendEnabled,
49683
- legendItems,
49684
- legendPosition,
49685
- legendLayout,
49686
- legendInteractive,
49687
- legendStyle
49688
- } = useLegendConfig({
49689
- legendConfig,
49690
- isPdf
49691
- });
49640
+ const hasLegendConfig = Object.keys(extraLegendConfig).length > 0;
49692
49641
  React__default["default"].useEffect(() => {
49693
49642
  if (!containerRef.current) {
49694
49643
  return;
@@ -49732,7 +49681,12 @@ function LineChart(_ref) {
49732
49681
  fillOpacity: isArea ? 0.15 : 0
49733
49682
  }
49734
49683
  },
49735
- legend: false
49684
+ legend: isPdf ? _objectSpread2({
49685
+ itemName: {
49686
+ formatter: text => t(text)
49687
+ },
49688
+ position: 'bottom'
49689
+ }, extraLegendConfig) : hasLegendConfig || false
49736
49690
  };
49737
49691
  if (!chartRef.current) {
49738
49692
  chartRef.current = new g2plot.Line(containerRef.current, config);
@@ -49740,7 +49694,7 @@ function LineChart(_ref) {
49740
49694
  } else {
49741
49695
  chartRef.current.update(config);
49742
49696
  }
49743
- }, [data, containerRef.current, isSmooth, animated, xFieldKey, yFieldKey, seriesField, isArea, color, token.colorPrimary7, formattedXAxis, formattedYAxis, isPercentage, renderTooltipContent, tooltipConfig, isPdf, t]);
49697
+ }, [data, containerRef.current, isSmooth, animated, xFieldKey, yFieldKey, seriesField, isArea, color, token.colorPrimary7, formattedXAxis, formattedYAxis, isPercentage, renderTooltipContent, tooltipConfig, isPdf, extraLegendConfig, t]);
49744
49698
  React__default["default"].useEffect(() => {
49745
49699
  return () => {
49746
49700
  if (chartRef.current) {
@@ -49749,9 +49703,9 @@ function LineChart(_ref) {
49749
49703
  }
49750
49704
  };
49751
49705
  }, []);
49752
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
49706
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
49753
49707
  className: "flex flex-1 flex-column justify-content-center",
49754
- children: [/*#__PURE__*/jsxRuntime.jsx("div", {
49708
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
49755
49709
  className: "flex justify-content-center",
49756
49710
  children: /*#__PURE__*/jsxRuntime.jsx(Container$1, {
49757
49711
  ref: containerRef,
@@ -49759,16 +49713,11 @@ function LineChart(_ref) {
49759
49713
  isPdf: isPdf,
49760
49714
  width: width
49761
49715
  })
49762
- }), legendEnabled && legendPosition === 'bottom' && /*#__PURE__*/jsxRuntime.jsx(CustomLegend, {
49763
- items: legendItems,
49764
- layout: legendLayout,
49765
- interactive: legendInteractive,
49766
- style: legendStyle
49767
- })]
49716
+ })
49768
49717
  });
49769
49718
  }
49770
49719
 
49771
- const _excluded$5 = ["data", "xFieldKey", "yFieldKey", "renderTooltipContent", "tooltipConfig", "animated", "isStack", "isGroup", "seriesField", "isPercentage", "showBackground", "formattedYAxis", "formattedXAxis", "color", "height", "groupField", "width", "legendConfig", "isPdf"];
49720
+ const _excluded$5 = ["data", "xFieldKey", "yFieldKey", "renderTooltipContent", "tooltipConfig", "animated", "isStack", "isGroup", "seriesField", "isPercentage", "showBackground", "formattedYAxis", "formattedXAxis", "color", "height", "groupField", "t", "isPdf", "extraLegendConfig", "shouldSeperateLegendName", "width"];
49772
49721
  const {
49773
49722
  useToken: useToken$e
49774
49723
  } = antd.theme;
@@ -49833,20 +49782,6 @@ const {
49833
49782
  * - `color` (string | string[] | function):
49834
49783
  * Custom color or color function for bars. If not provided, falls back to Ant Design's theme primary color.
49835
49784
  *
49836
- * - `legendConfig` (object):
49837
- * Configuration for the custom legend:
49838
- * {
49839
- * enabled: boolean, // Show/hide the legend (default: false)
49840
- * position: 'top' | 'bottom', // Legend position (default: 'bottom')
49841
- * items: Array<{ // Manual legend items (optional, auto-generated from data if not provided)
49842
- * label: string, // Display label
49843
- * color: string, // Color for this item
49844
- * description?: string // Optional description/explanation
49845
- * }>,
49846
- * layout: 'horizontal' | 'vertical', // Legend layout (default: 'horizontal')
49847
- * interactive: boolean, // Allow clicking to filter data (default: true)
49848
- * style: object // Custom CSS styles for legend container
49849
- * }
49850
49785
  */
49851
49786
 
49852
49787
  function ColumnChart(_ref) {
@@ -49867,9 +49802,11 @@ function ColumnChart(_ref) {
49867
49802
  color,
49868
49803
  height,
49869
49804
  groupField,
49870
- width,
49871
- legendConfig = {},
49872
- isPdf = false
49805
+ t = s => s,
49806
+ isPdf = false,
49807
+ extraLegendConfig = {},
49808
+ shouldSeperateLegendName = false,
49809
+ width
49873
49810
  } = _ref;
49874
49811
  _objectWithoutProperties(_ref, _excluded$5);
49875
49812
  const containerRef = React__default["default"].useRef(null);
@@ -49877,17 +49814,7 @@ function ColumnChart(_ref) {
49877
49814
  const {
49878
49815
  token
49879
49816
  } = useToken$e();
49880
- const {
49881
- legendEnabled,
49882
- legendItems,
49883
- legendPosition,
49884
- legendLayout,
49885
- legendInteractive,
49886
- legendStyle
49887
- } = useLegendConfig({
49888
- legendConfig,
49889
- isPdf
49890
- });
49817
+ const hasLegendConfig = Object.keys(extraLegendConfig).length > 0;
49891
49818
  React__default["default"].useEffect(() => {
49892
49819
  if (!containerRef.current) {
49893
49820
  return;
@@ -49922,7 +49849,15 @@ function ColumnChart(_ref) {
49922
49849
  formatter: isPercentage ? v => "".concat(v).replace(/\d{1,3}(?=(\d{3})+$)/g, s => "".concat(s, ",")) + " %" : formattedYAxis
49923
49850
  }
49924
49851
  }),
49925
- legend: false
49852
+ legend: isPdf ? _objectSpread2({
49853
+ itemName: {
49854
+ formatter: text => {
49855
+ const textToTranslate = shouldSeperateLegendName ? text.split("-")[1].toLowerCase() : text;
49856
+ return t(textToTranslate);
49857
+ }
49858
+ },
49859
+ position: 'bottom'
49860
+ }, extraLegendConfig) : hasLegendConfig || false
49926
49861
  }, showBackground && isPercentage && {
49927
49862
  columnBackground: {
49928
49863
  style: {}
@@ -49943,22 +49878,17 @@ function ColumnChart(_ref) {
49943
49878
  }
49944
49879
  };
49945
49880
  }, []);
49946
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
49881
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
49947
49882
  className: "flex flex-1 flex-column justify-content-center",
49948
- children: [/*#__PURE__*/jsxRuntime.jsx("div", {
49883
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
49949
49884
  className: "flex justify-content-center",
49950
49885
  children: /*#__PURE__*/jsxRuntime.jsx(Container$1, {
49951
49886
  ref: containerRef,
49952
49887
  height: height,
49953
- isPdf: false,
49888
+ isPdf: isPdf,
49954
49889
  width: width
49955
49890
  })
49956
- }), legendEnabled && legendPosition === 'bottom' && /*#__PURE__*/jsxRuntime.jsx(CustomLegend, {
49957
- items: legendItems,
49958
- layout: legendLayout,
49959
- interactive: legendInteractive,
49960
- style: legendStyle
49961
- })]
49891
+ })
49962
49892
  });
49963
49893
  }
49964
49894
 
@@ -50017,26 +49947,13 @@ function RadialBarChart(_ref) {
50017
49947
  colorKey,
50018
49948
  animation = false,
50019
49949
  isPercentage = true,
50020
- color,
50021
- isPdf = false,
50022
- legendConfig = {}
49950
+ color
50023
49951
  } = _ref;
50024
49952
  const containerRef = React__default["default"].useRef(null);
50025
49953
  const chartRef = React__default["default"].useRef(null);
50026
49954
  const {
50027
49955
  token
50028
49956
  } = useToken$d();
50029
- const {
50030
- legendEnabled,
50031
- legendItems,
50032
- legendPosition,
50033
- legendLayout,
50034
- legendInteractive,
50035
- legendStyle
50036
- } = useLegendConfig({
50037
- legendConfig,
50038
- isPdf
50039
- });
50040
49957
  const formattedData = React.useMemo(() => {
50041
49958
  return data.map(item => _objectSpread2(_objectSpread2({}, item), {}, {
50042
49959
  originalValue: item[yFieldKey],
@@ -50119,23 +50036,18 @@ function RadialBarChart(_ref) {
50119
50036
  }
50120
50037
  };
50121
50038
  }, []);
50122
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
50039
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
50123
50040
  className: "flex flex-1 flex-column justify-content-center",
50124
- children: [/*#__PURE__*/jsxRuntime.jsx("div", {
50041
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
50125
50042
  className: "flex justify-content-center",
50126
50043
  children: /*#__PURE__*/jsxRuntime.jsx(Container$1, {
50127
50044
  ref: containerRef
50128
50045
  })
50129
- }), legendEnabled && legendPosition === 'bottom' && /*#__PURE__*/jsxRuntime.jsx(CustomLegend, {
50130
- items: legendItems,
50131
- layout: legendLayout,
50132
- interactive: legendInteractive,
50133
- style: legendStyle
50134
- })]
50046
+ })
50135
50047
  });
50136
50048
  }
50137
50049
 
50138
- const _excluded$4 = ["data", "angleField", "colorField", "color", "height", "innerRadius", "radius", "legend", "label", "statistic", "tooltip", "renderTooltipContent", "tooltipConfig", "meta", "animation", "t", "isPdf", "legendConfig"];
50050
+ const _excluded$4 = ["data", "angleField", "colorField", "color", "height", "innerRadius", "radius", "legend", "label", "statistic", "tooltip", "renderTooltipContent", "tooltipConfig", "meta", "animation", "t", "isPdf", "extraLegendConfig"];
50139
50051
  const {
50140
50052
  useToken: useToken$c
50141
50053
  } = antd.theme;
@@ -50208,7 +50120,7 @@ function DonutPie(_ref) {
50208
50120
  animation = false,
50209
50121
  t = s => s,
50210
50122
  isPdf = false,
50211
- legendConfig = {}
50123
+ extraLegendConfig = {}
50212
50124
  } = _ref,
50213
50125
  rest = _objectWithoutProperties(_ref, _excluded$4);
50214
50126
  const containerRef = React.useRef(null);
@@ -50216,17 +50128,7 @@ function DonutPie(_ref) {
50216
50128
  const {
50217
50129
  token
50218
50130
  } = useToken$c();
50219
- const {
50220
- legendEnabled,
50221
- legendItems,
50222
- legendPosition,
50223
- legendLayout,
50224
- legendInteractive,
50225
- legendStyle
50226
- } = useLegendConfig({
50227
- legendConfig,
50228
- isPdf
50229
- });
50131
+ const hasLegendConfig = Object.keys(extraLegendConfig).length > 0;
50230
50132
 
50231
50133
  // Memoize processed data for progress mode
50232
50134
  const processedData = React.useMemo(() => {
@@ -50252,7 +50154,12 @@ function DonutPie(_ref) {
50252
50154
  color: color || [token.colorPrimary7, "#E8EDF3"],
50253
50155
  radius,
50254
50156
  innerRadius,
50255
- legend: false,
50157
+ legend: isPdf ? _objectSpread2({
50158
+ itemName: {
50159
+ formatter: text => t(text)
50160
+ },
50161
+ position: 'bottom'
50162
+ }, extraLegendConfig) : hasLegendConfig || false,
50256
50163
  label,
50257
50164
  statistic,
50258
50165
  tooltip: tooltipOption,
@@ -50274,9 +50181,9 @@ function DonutPie(_ref) {
50274
50181
  }
50275
50182
  };
50276
50183
  }, []);
50277
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
50184
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
50278
50185
  className: "flex flex-1 flex-column justify-content-center",
50279
- children: [/*#__PURE__*/jsxRuntime.jsx("div", {
50186
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
50280
50187
  className: "flex justify-content-center",
50281
50188
  children: /*#__PURE__*/jsxRuntime.jsx(Container$1, {
50282
50189
  ref: containerRef,
@@ -50285,12 +50192,7 @@ function DonutPie(_ref) {
50285
50192
  },
50286
50193
  isPdf: isPdf
50287
50194
  })
50288
- }), legendEnabled && legendPosition === 'bottom' && /*#__PURE__*/jsxRuntime.jsx(CustomLegend, {
50289
- items: legendItems,
50290
- layout: legendLayout,
50291
- interactive: legendInteractive,
50292
- style: legendStyle
50293
- })]
50195
+ })
50294
50196
  });
50295
50197
  }
50296
50198
 
@@ -50344,7 +50246,7 @@ const Style$g = dt.div`
50344
50246
  }
50345
50247
  }
50346
50248
  `;
50347
- dt.div`
50249
+ const StyleWrapper = dt.div`
50348
50250
  .legend {
50349
50251
  display: flex;
50350
50252
  flex-wrap: wrap;
@@ -50553,8 +50455,7 @@ function StackChart(_ref) {
50553
50455
  valueField = "value",
50554
50456
  height = 300,
50555
50457
  isPdf = false,
50556
- t = s => s,
50557
- legendConfig = {}
50458
+ t = s => s
50558
50459
  } = _ref;
50559
50460
  const ref = React__default["default"].useRef();
50560
50461
  const {
@@ -50573,17 +50474,6 @@ function StackChart(_ref) {
50573
50474
  });
50574
50475
  return Array.from(uniqueLabels);
50575
50476
  }, [data, xFieldKey]);
50576
- const {
50577
- legendEnabled,
50578
- legendItems,
50579
- legendPosition,
50580
- legendLayout,
50581
- legendInteractive,
50582
- legendStyle
50583
- } = useLegendConfig({
50584
- legendConfig,
50585
- isPdf
50586
- });
50587
50477
  const groupedByLabel = React__default["default"].useMemo(() => {
50588
50478
  return data.reduce((acc, item) => {
50589
50479
  const label = item[xFieldKey];
@@ -50693,7 +50583,7 @@ function StackChart(_ref) {
50693
50583
  }));
50694
50584
  }
50695
50585
  }, [hoveredGroup]);
50696
- return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
50586
+ return /*#__PURE__*/jsxRuntime.jsxs(StyleWrapper, {
50697
50587
  children: [/*#__PURE__*/jsxRuntime.jsxs(Style$g, _objectSpread2(_objectSpread2({}, isEmpty ? {
50698
50588
  onMouseEnter: () => {
50699
50589
  setHoveredGroup({
@@ -50721,16 +50611,28 @@ function StackChart(_ref) {
50721
50611
  },
50722
50612
  children: content()
50723
50613
  })]
50724
- })), legendEnabled && legendPosition === 'bottom' && /*#__PURE__*/jsxRuntime.jsx(CustomLegend, {
50725
- items: legendItems,
50726
- layout: legendLayout,
50727
- interactive: legendInteractive,
50728
- style: legendStyle
50614
+ })), isPdf && /*#__PURE__*/jsxRuntime.jsx("div", {
50615
+ className: "legend",
50616
+ children: Object.entries(seriesColors).map(_ref4 => {
50617
+ let [series, color] = _ref4;
50618
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
50619
+ className: "legend-item",
50620
+ children: [/*#__PURE__*/jsxRuntime.jsx("span", {
50621
+ className: "legend-color",
50622
+ style: {
50623
+ backgroundColor: color || token.colorPrimary7
50624
+ }
50625
+ }), /*#__PURE__*/jsxRuntime.jsx("span", {
50626
+ className: "legend-label",
50627
+ children: t(series)
50628
+ })]
50629
+ }, series);
50630
+ })
50729
50631
  })]
50730
50632
  });
50731
50633
  }
50732
50634
 
50733
- const _excluded$3 = ["data", "xFieldKey", "yFieldKey", "seriesField", "renderTooltipContent", "tooltipConfig", "animated", "color", "formattedYAxis", "formattedXAxis", "fillOpacity", "height", "t", "isPdf", "legendConfig", "width"];
50635
+ const _excluded$3 = ["data", "xFieldKey", "yFieldKey", "seriesField", "renderTooltipContent", "tooltipConfig", "animated", "color", "formattedYAxis", "formattedXAxis", "fillOpacity", "height", "t", "isPdf", "extraLegendConfig", "width"];
50734
50636
  const {
50735
50637
  useToken: useToken$a
50736
50638
  } = antd.theme;
@@ -50804,7 +50706,7 @@ const AreaChart = _ref => {
50804
50706
  height,
50805
50707
  t = s => s,
50806
50708
  isPdf = false,
50807
- legendConfig = {},
50709
+ extraLegendConfig = {},
50808
50710
  width
50809
50711
  } = _ref,
50810
50712
  rest = _objectWithoutProperties(_ref, _excluded$3);
@@ -50813,17 +50715,7 @@ const AreaChart = _ref => {
50813
50715
  const {
50814
50716
  token
50815
50717
  } = useToken$a();
50816
- const {
50817
- legendEnabled,
50818
- legendItems,
50819
- legendPosition,
50820
- legendLayout,
50821
- legendInteractive,
50822
- legendStyle
50823
- } = useLegendConfig({
50824
- legendConfig,
50825
- isPdf
50826
- });
50718
+ const hasLegendConfig = Object.keys(extraLegendConfig).length > 0;
50827
50719
  React.useEffect(() => {
50828
50720
  if (!containerRef.current) {
50829
50721
  return;
@@ -50858,7 +50750,12 @@ const AreaChart = _ref => {
50858
50750
  areaStyle: {
50859
50751
  fillOpacity
50860
50752
  },
50861
- legend: false,
50753
+ legend: isPdf ? _objectSpread2({
50754
+ itemName: {
50755
+ formatter: text => t(text)
50756
+ },
50757
+ position: 'bottom'
50758
+ }, extraLegendConfig) : hasLegendConfig || false,
50862
50759
  line: false
50863
50760
  }, rest);
50864
50761
  if (!chartRef.current) {
@@ -50876,26 +50773,21 @@ const AreaChart = _ref => {
50876
50773
  }
50877
50774
  };
50878
50775
  }, []);
50879
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
50776
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
50880
50777
  className: "flex flex-1 flex-column justify-content-center",
50881
- children: [/*#__PURE__*/jsxRuntime.jsx("div", {
50778
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
50882
50779
  className: "flex justify-content-center",
50883
50780
  children: /*#__PURE__*/jsxRuntime.jsx(Container$1, {
50884
50781
  ref: containerRef,
50885
50782
  height: height,
50886
- isPdf: false,
50783
+ isPdf: isPdf,
50887
50784
  width: width
50888
50785
  })
50889
- }), legendEnabled && legendPosition === 'bottom' && /*#__PURE__*/jsxRuntime.jsx(CustomLegend, {
50890
- items: legendItems,
50891
- layout: legendLayout,
50892
- interactive: legendInteractive,
50893
- style: legendStyle
50894
- })]
50786
+ })
50895
50787
  });
50896
50788
  };
50897
50789
 
50898
- const _excluded$2 = ["data", "xFieldKey", "yFieldKey", "seriesField", "renderTooltipContent", "tooltipConfig", "animated", "color", "formattedYAxis", "formattedXAxis", "score", "height", "isPdf", "legendConfig"];
50790
+ const _excluded$2 = ["data", "xFieldKey", "yFieldKey", "seriesField", "renderTooltipContent", "tooltipConfig", "animated", "color", "formattedYAxis", "formattedXAxis", "score", "height"];
50899
50791
  const {
50900
50792
  useToken: useToken$9
50901
50793
  } = antd.theme;
@@ -50916,9 +50808,7 @@ const RadarChart = _ref => {
50916
50808
  min: 0,
50917
50809
  max: 100
50918
50810
  },
50919
- height,
50920
- isPdf = false,
50921
- legendConfig = {}
50811
+ height
50922
50812
  } = _ref,
50923
50813
  rest = _objectWithoutProperties(_ref, _excluded$2);
50924
50814
  const containerRef = React.useRef(null);
@@ -50926,17 +50816,6 @@ const RadarChart = _ref => {
50926
50816
  const {
50927
50817
  token
50928
50818
  } = useToken$9();
50929
- const {
50930
- legendEnabled,
50931
- legendItems,
50932
- legendPosition,
50933
- legendLayout,
50934
- legendInteractive,
50935
- legendStyle
50936
- } = useLegendConfig({
50937
- legendConfig,
50938
- isPdf
50939
- });
50940
50819
  React.useEffect(() => {
50941
50820
  if (!containerRef.current) {
50942
50821
  return;
@@ -51021,20 +50900,15 @@ const RadarChart = _ref => {
51021
50900
  }
51022
50901
  };
51023
50902
  }, []);
51024
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
50903
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
51025
50904
  className: "flex flex-1 flex-column justify-content-center",
51026
- children: [/*#__PURE__*/jsxRuntime.jsx("div", {
50905
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
51027
50906
  className: "flex justify-content-center",
51028
50907
  children: /*#__PURE__*/jsxRuntime.jsx(Container$1, {
51029
50908
  ref: containerRef,
51030
50909
  height: height
51031
50910
  })
51032
- }), legendEnabled && legendPosition === 'bottom' && /*#__PURE__*/jsxRuntime.jsx(CustomLegend, {
51033
- items: legendItems,
51034
- layout: legendLayout,
51035
- interactive: legendInteractive,
51036
- style: legendStyle
51037
- })]
50911
+ })
51038
50912
  });
51039
50913
  };
51040
50914
 
@@ -51053,26 +50927,13 @@ function DualAxesChart(_ref) {
51053
50927
  formattedLeftAxis = s => s,
51054
50928
  formattedRightAxis = s => s,
51055
50929
  formattedXAxis = s => s,
51056
- color,
51057
- legendConfig = {},
51058
- isPdf = false
50930
+ color
51059
50931
  } = _ref;
51060
50932
  const containerRef = React__default["default"].useRef(null);
51061
50933
  const chartRef = React__default["default"].useRef(null);
51062
50934
  const {
51063
50935
  token
51064
50936
  } = useToken$8();
51065
- const {
51066
- legendEnabled,
51067
- legendItems,
51068
- legendPosition,
51069
- legendLayout,
51070
- legendInteractive,
51071
- legendStyle
51072
- } = useLegendConfig({
51073
- legendConfig,
51074
- isPdf
51075
- });
51076
50937
  const _colours = React.useMemo(() => {
51077
50938
  const defaultColours = [token.colorPrimary7, token.colorPrimary6, token.colorPrimary8];
51078
50939
  if (color) {
@@ -51140,20 +51001,15 @@ function DualAxesChart(_ref) {
51140
51001
  }
51141
51002
  };
51142
51003
  }, []);
51143
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
51004
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
51144
51005
  className: "flex flex-1 flex-column justify-content-center",
51145
- children: [/*#__PURE__*/jsxRuntime.jsx("div", {
51006
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
51146
51007
  className: "flex justify-content-center",
51147
51008
  children: /*#__PURE__*/jsxRuntime.jsx(Container$1, {
51148
51009
  ref: containerRef,
51149
51010
  "data-testid": "dual-axes-chart"
51150
51011
  })
51151
- }), legendEnabled && legendPosition === 'bottom' && /*#__PURE__*/jsxRuntime.jsx(CustomLegend, {
51152
- items: legendItems,
51153
- layout: legendLayout,
51154
- interactive: legendInteractive,
51155
- style: legendStyle
51156
- })]
51012
+ })
51157
51013
  });
51158
51014
  }
51159
51015
 
@@ -54194,6 +54050,7 @@ function AddUserModal({
54194
54050
  setAccountUsed(true);
54195
54051
  }).catch(() => {});
54196
54052
  };
54053
+ console.log("hellooooooooooooooooooooooooo");
54197
54054
  return /*#__PURE__*/jsxRuntime.jsx(Modal, {
54198
54055
  open: isOpen,
54199
54056
  title: "admin::edit-user",
@@ -54237,13 +54094,6 @@ function AddUserModal({
54237
54094
  }
54238
54095
  }
54239
54096
  })
54240
- }), accountUsed && /*#__PURE__*/jsxRuntime.jsx(antd.Alert, {
54241
- message: t("FB00001"),
54242
- type: "error",
54243
- className: "mb-2",
54244
- showIcon: true,
54245
- closable: true,
54246
- onClose: () => setAccountUsed(false)
54247
54097
  }), /*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
54248
54098
  name: "role",
54249
54099
  label: t("Role"),
@@ -57054,7 +56904,8 @@ function NewUser({
57054
56904
  isOpen,
57055
56905
  onClose,
57056
56906
  defaultData,
57057
- userRoles = []
56907
+ userRoles = [],
56908
+ addUser = () => {}
57058
56909
  }) {
57059
56910
  const [MainForm] = antd.Form.useForm();
57060
56911
  const [accountUsed, setAccountUsed] = React.useState(false);
@@ -57068,8 +56919,26 @@ function NewUser({
57068
56919
  }, [defaultData]);
57069
56920
  const onSubmit = () => {
57070
56921
  MainForm.validateFields().then(val => {
57071
- console.log(val);
57072
- setAccountUsed(true);
56922
+ // Create user object with the form data
56923
+ const userData = {
56924
+ firstName: val.firstName,
56925
+ lastName: val.lastName,
56926
+ email: val.email,
56927
+ role: val.role,
56928
+ apps: {
56929
+ straatos: {
56930
+ role: val.role,
56931
+ access: true
56932
+ }
56933
+ }
56934
+ };
56935
+
56936
+ // Add user to local state
56937
+ addUser(userData);
56938
+
56939
+ // Close modal and reset form
56940
+ onClose();
56941
+ MainForm.resetFields();
57073
56942
  }).catch(() => {});
57074
56943
  };
57075
56944
  return /*#__PURE__*/jsxRuntime.jsx(Modal, {
@@ -57115,13 +56984,6 @@ function NewUser({
57115
56984
  }
57116
56985
  }
57117
56986
  })
57118
- }), accountUsed && /*#__PURE__*/jsxRuntime.jsx(antd.Alert, {
57119
- message: t("FB00001"),
57120
- type: "error",
57121
- className: "mb-2",
57122
- showIcon: true,
57123
- closable: true,
57124
- onClose: () => setAccountUsed(false)
57125
56987
  }), /*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
57126
56988
  name: "role",
57127
56989
  label: t("Role"),
@@ -57260,6 +57122,8 @@ const getColumns = ({
57260
57122
  const role = all?.apps?.[module]?.role;
57261
57123
  const options = (selectOptions?.userRole || []).filter(o => all.isAdmin || o.canBeAssignedToSubUsers);
57262
57124
  if (isView) {
57125
+ console.log("role--------------", role);
57126
+ console.log("options--------------", options);
57263
57127
  const title = findOptions(role, options);
57264
57128
  return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
57265
57129
  title: title,
@@ -57392,6 +57256,7 @@ function Users({
57392
57256
  accountStatuses,
57393
57257
  deleteUser = () => {},
57394
57258
  updateUser = () => {},
57259
+ addUser = () => {},
57395
57260
  transferAdmin = () => {}
57396
57261
  }) {
57397
57262
  const [hasError, setHasError] = React.useState(false);
@@ -57514,7 +57379,8 @@ function Users({
57514
57379
  t: t,
57515
57380
  isOpen: newUserModalVisible,
57516
57381
  onClose: () => setNewUserModalVisible(false),
57517
- userRoles: userRoles
57382
+ userRoles: userRoles,
57383
+ addUser: addUser
57518
57384
  })]
57519
57385
  });
57520
57386
  }
@@ -57750,6 +57616,15 @@ function Edit({
57750
57616
  })
57751
57617
  }));
57752
57618
  }, []);
57619
+ const addUser = React.useCallback(userData => {
57620
+ setIsChanged(true);
57621
+ setData(prev => ({
57622
+ ...prev,
57623
+ users: [...(prev.users || []), {
57624
+ ...userData
57625
+ }]
57626
+ }));
57627
+ }, []);
57753
57628
  const onSuspend = () => {
57754
57629
  antd.Modal.confirm({
57755
57630
  title: t("sbg-admin::suspend-title"),
@@ -57796,6 +57671,7 @@ function Edit({
57796
57671
  onCancel: () => {}
57797
57672
  });
57798
57673
  };
57674
+ console.log("good morning", module);
57799
57675
  const renderItem = item => {
57800
57676
  if (item.type === "users") {
57801
57677
  return /*#__PURE__*/jsxRuntime.jsx(Users, {
@@ -57807,6 +57683,7 @@ function Edit({
57807
57683
  userRoles: userRoles,
57808
57684
  deleteUser: deleteUser,
57809
57685
  updateUser: updateUser,
57686
+ addUser: addUser,
57810
57687
  goTo: goTo,
57811
57688
  accountStatuses: accountStatuses,
57812
57689
  transferAdmin: transferAdmin