@headless-adminapp/fluent 0.0.17-alpha.53 → 0.0.17-alpha.55

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 (179) hide show
  1. package/App/App.js +11 -7
  2. package/App/AppHeaderContianer.js +50 -44
  3. package/App/AppLogo.js +12 -9
  4. package/App/AppStringContext.js +13 -9
  5. package/App/AppUI.js +15 -11
  6. package/App/LayoutProvider.js +16 -24
  7. package/App/NavigationContainer.js +28 -28
  8. package/App/QuickActionItem.js +10 -6
  9. package/App/index.js +5 -1
  10. package/App/utils.d.ts +1 -1
  11. package/App/utils.js +7 -5
  12. package/CommandBar/Button.js +17 -14
  13. package/CommandBar/Divider.js +9 -6
  14. package/CommandBar/IconButton.js +16 -13
  15. package/CommandBar/Label.js +11 -8
  16. package/CommandBar/MenuButton.js +20 -17
  17. package/CommandBar/MenuItem.js +19 -16
  18. package/CommandBar/MenuItems.js +10 -10
  19. package/CommandBar/MenuList.js +12 -9
  20. package/CommandBar/Wrapper.js +10 -7
  21. package/CommandBar/index.js +15 -13
  22. package/DataForm/SectionControl.js +7 -4
  23. package/DataGrid/ActionCell.js +14 -11
  24. package/DataGrid/CommandContainer.js +10 -6
  25. package/DataGrid/CustomizeColumns/AddColumns.js +61 -59
  26. package/DataGrid/CustomizeColumns/ColumnItem.js +23 -19
  27. package/DataGrid/CustomizeColumns/CustomizeColumns.js +41 -36
  28. package/DataGrid/CustomizeColumns/index.js +5 -1
  29. package/DataGrid/FormSubgridCommandContainer.js +17 -13
  30. package/DataGrid/FormSubgridViewSelector.js +21 -21
  31. package/DataGrid/GridColumnHeader/ConditionValueControl.js +33 -33
  32. package/DataGrid/GridColumnHeader/FilterForm.js +28 -27
  33. package/DataGrid/GridColumnHeader/OperatorSelect.js +19 -13
  34. package/DataGrid/GridColumnHeader/TableHeaderFilterCell.js +35 -31
  35. package/DataGrid/GridColumnHeader/index.js +5 -1
  36. package/DataGrid/GridColumnHeader/utils.js +6 -2
  37. package/DataGrid/GridHeaderContainer.js +8 -4
  38. package/DataGrid/GridHeaderDesktop.js +28 -28
  39. package/DataGrid/GridHeaderMobile.js +20 -19
  40. package/DataGrid/GridListContainer.js +50 -44
  41. package/DataGrid/GridPaginationContainer.js +16 -13
  42. package/DataGrid/GridTableContainer.js +98 -89
  43. package/DataGrid/TableCell/TableCellAction.js +15 -11
  44. package/DataGrid/TableCell/TableCellBase.js +13 -4
  45. package/DataGrid/TableCell/TableCellCheckbox.js +11 -8
  46. package/DataGrid/TableCell/TableCellChoice.js +15 -13
  47. package/DataGrid/TableCell/TableCellLink.js +14 -11
  48. package/DataGrid/TableCell/TableCellText.js +10 -7
  49. package/DataGrid/TableCell/index.js +20 -4
  50. package/DataGrid/index.js +11 -4
  51. package/DataGrid/types.js +2 -1
  52. package/DataGrid/useTableColumns.js +98 -103
  53. package/DataGrid/utils.js +5 -1
  54. package/DialogContainer/AlertDialog.js +11 -11
  55. package/DialogContainer/ConfirmDialog.js +13 -14
  56. package/DialogContainer/DialogContainer.js +19 -26
  57. package/DialogContainer/ErrorDialog.js +15 -15
  58. package/DialogContainer/PromptDialog.js +76 -58
  59. package/DialogContainer/index.js +5 -1
  60. package/Insights/CommandBarContainer.js +17 -11
  61. package/Insights/FilterBarContainer.js +32 -37
  62. package/Insights/Grid.js +13 -9
  63. package/Insights/InsightsContainer.js +22 -19
  64. package/Insights/WidgetChartContainer.js +34 -30
  65. package/Insights/WidgetDataGridContainer.js +45 -33
  66. package/Insights/WidgetTableContainer.js +29 -26
  67. package/Insights/WidgetTileContainer.js +16 -12
  68. package/Insights/WidgetTitleBar.js +15 -10
  69. package/Insights/Widgets.js +28 -25
  70. package/Insights/charts/AreaChart.js +15 -12
  71. package/Insights/charts/BarChart.js +15 -12
  72. package/Insights/charts/ComposedChart.js +15 -13
  73. package/Insights/charts/CustomTooltipContent.js +13 -9
  74. package/Insights/charts/GaugeChart.js +6 -3
  75. package/Insights/charts/LineChart.js +15 -12
  76. package/Insights/charts/OhlcChart.js +46 -40
  77. package/Insights/charts/PieChart.js +25 -26
  78. package/Insights/charts/RadarChart.js +19 -17
  79. package/Insights/charts/ScatterChart.js +26 -28
  80. package/Insights/charts/constants.js +4 -1
  81. package/Insights/charts/formatters.js +33 -23
  82. package/Insights/charts/index.js +2 -1
  83. package/Insights/charts/renderers.js +36 -26
  84. package/Insights/hooks/useQueriesData.js +27 -30
  85. package/Insights/hooks/useWidgetDetail.js +24 -15
  86. package/OverflowCommandBar/OverflowCommandBar.js +19 -12
  87. package/OverflowCommandBar/OverflowMenu.js +22 -30
  88. package/OverflowCommandBar/OverflowMenuDivider.js +10 -6
  89. package/OverflowCommandBar/index.js +9 -3
  90. package/OverflowCommandBar/render.js +15 -10
  91. package/OverflowCommandBar/utils.js +6 -4
  92. package/PageBoard/BoardColumn.js +8 -5
  93. package/PageBoard/BoardColumnCard.d.ts +1 -1
  94. package/PageBoard/BoardColumnCard.js +15 -11
  95. package/PageBoard/BoardColumnUI.js +45 -46
  96. package/PageBoard/BoardingColumnCardLoading.js +13 -10
  97. package/PageBoard/Header.js +23 -28
  98. package/PageBoard/PageBoard.js +28 -26
  99. package/PageBoard/index.js +5 -1
  100. package/PageEntityForm/CommandContainer.js +25 -21
  101. package/PageEntityForm/FormTabRelated.js +20 -17
  102. package/PageEntityForm/PageEntityForm.js +20 -16
  103. package/PageEntityForm/PageEntityFormDesktopContainer.js +77 -70
  104. package/PageEntityForm/PageEntityFormStringContext.js +9 -5
  105. package/PageEntityForm/ProcessFlow.js +24 -21
  106. package/PageEntityForm/RecordCard.js +31 -24
  107. package/PageEntityForm/RecordCardLoading.js +13 -11
  108. package/PageEntityForm/RecordSetNavigatorContainer.js +34 -31
  109. package/PageEntityForm/RelatedViewSelector.js +34 -36
  110. package/PageEntityForm/SectionContainer.js +35 -31
  111. package/PageEntityForm/StandardControl.js +84 -76
  112. package/PageEntityForm/SubgridControl.js +23 -21
  113. package/PageEntityForm/index.js +5 -1
  114. package/PageEntityView/FormSubgridContainer.js +26 -22
  115. package/PageEntityView/PageEntityView.js +19 -15
  116. package/PageEntityView/PageEntityViewDesktopContainer.js +13 -9
  117. package/PageEntityView/PageEntityViewDesktopFrame.js +21 -17
  118. package/PageEntityView/PageEntityViewMobileContainer.js +13 -9
  119. package/PageEntityView/PageEntityViewStringContext.js +9 -5
  120. package/PageEntityView/index.js +5 -1
  121. package/PageInsights/PageInsights.js +13 -9
  122. package/PageInsights/index.js +6 -1
  123. package/ProgressIndicatorContainer/index.js +14 -10
  124. package/ToastNotificationContainer/index.js +18 -15
  125. package/componentStore.js +5 -2
  126. package/components/BodyLoading.js +11 -7
  127. package/components/DialogLogin.js +8 -5
  128. package/components/DndProvider.d.ts +12 -0
  129. package/components/DndProvider.js +68 -0
  130. package/components/LoginForm.js +46 -36
  131. package/components/PageBroken.js +8 -5
  132. package/components/PageLoading.js +8 -5
  133. package/components/PageLogin.js +17 -14
  134. package/form/FormControl.js +44 -50
  135. package/form/FormControlLoading.js +8 -4
  136. package/form/controls/AttachmentControl.js +72 -77
  137. package/form/controls/AttachmentsControl.js +24 -30
  138. package/form/controls/CurrencyControl.js +16 -13
  139. package/form/controls/DateControl.js +24 -18
  140. package/form/controls/DateRangeControl.js +22 -18
  141. package/form/controls/DateTimeControl.js +49 -43
  142. package/form/controls/DecimalControl.js +14 -11
  143. package/form/controls/DurationControl.js +18 -14
  144. package/form/controls/EmailControl.js +14 -11
  145. package/form/controls/IntegerControl.js +11 -8
  146. package/form/controls/LookupControl.js +58 -56
  147. package/form/controls/MultiSelectControl.js +12 -9
  148. package/form/controls/MultiSelectLookupControl.js +55 -53
  149. package/form/controls/PasswordControl.js +11 -8
  150. package/form/controls/RichTextControl.js +32 -5
  151. package/form/controls/SelectControl.js +15 -13
  152. package/form/controls/SwitchControl.js +7 -4
  153. package/form/controls/TelephoneControl.js +10 -7
  154. package/form/controls/TextAreaControl.js +11 -8
  155. package/form/controls/TextControl.js +12 -9
  156. package/form/controls/UrlControl.js +10 -7
  157. package/form/controls/types.js +2 -1
  158. package/form/controls/useLookupData.js +43 -54
  159. package/form/layout/FormBody/FormBody.js +10 -6
  160. package/form/layout/FormBody/index.js +17 -1
  161. package/form/layout/FormSection/FormSection.js +31 -20
  162. package/form/layout/FormSection/FormSectionColumn.js +7 -3
  163. package/form/layout/FormSection/FormSectionLoading.js +5 -1
  164. package/form/layout/FormSection/index.js +5 -1
  165. package/form/layout/FormTab/FormTab.js +21 -17
  166. package/form/layout/FormTab/FormTabColumn.js +9 -5
  167. package/form/layout/FormTab/index.js +5 -1
  168. package/form/layout/TabContext.js +5 -2
  169. package/form/layout/index.js +9 -3
  170. package/form/types.js +2 -1
  171. package/package.json +4 -12
  172. package/types/index.js +2 -1
  173. package/utils/avatar.js +4 -1
  174. package/DataGrid/ScrollbarWithMoreDataRequest.d.ts +0 -9
  175. package/DataGrid/ScrollbarWithMoreDataRequest.js +0 -33
  176. package/form/controls/NumberControl.d.ts +0 -4
  177. package/form/controls/NumberControl.js +0 -16
  178. package/form/controls/utils.d.ts +0 -4
  179. package/form/controls/utils.js +0 -42
@@ -1,34 +1,38 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Caption1, Divider, tokens } from '@fluentui/react-components';
3
- import { DateAxisTickInterval, } from '@headless-adminapp/core/experience/insights';
4
- import { useMemo } from 'react';
5
- import { Rectangle, ResponsiveContainer, Scatter, ScatterChart, Tooltip, XAxis as XAxisInternal, } from 'recharts';
6
- import { createAxisFormatter, createLongAxisFormatter } from './formatters';
7
- import { renderGrid, renderYAxis } from './renderers';
8
- export const barSizeInTime = (interval) => {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.barSizeInTime = void 0;
4
+ exports.OhlcChart = OhlcChart;
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const react_components_1 = require("@fluentui/react-components");
7
+ const insights_1 = require("@headless-adminapp/core/experience/insights");
8
+ const react_1 = require("react");
9
+ const recharts_1 = require("recharts");
10
+ const formatters_1 = require("./formatters");
11
+ const renderers_1 = require("./renderers");
12
+ const barSizeInTime = (interval) => {
9
13
  switch (interval) {
10
- case DateAxisTickInterval.Minute:
14
+ case insights_1.DateAxisTickInterval.Minute:
11
15
  return 60000 * 0.6;
12
- case DateAxisTickInterval.Hour:
16
+ case insights_1.DateAxisTickInterval.Hour:
13
17
  return 3600000 * 0.6;
14
- case DateAxisTickInterval.Day:
18
+ case insights_1.DateAxisTickInterval.Day:
15
19
  return 86400000 * 0.6;
16
- case DateAxisTickInterval.Week:
20
+ case insights_1.DateAxisTickInterval.Week:
17
21
  return 604800000 * 0.6;
18
- case DateAxisTickInterval.Month:
22
+ case insights_1.DateAxisTickInterval.Month:
19
23
  return 2628000000 * 0.6;
20
- case DateAxisTickInterval.Year:
24
+ case insights_1.DateAxisTickInterval.Year:
21
25
  return 31540000000 * 0.6;
22
26
  default:
23
27
  return 60000 * 0.6;
24
28
  }
25
29
  };
26
- export function OhlcChart({ dataset, chartInfo, }) {
27
- var _a;
30
+ exports.barSizeInTime = barSizeInTime;
31
+ function OhlcChart({ dataset, chartInfo, }) {
28
32
  const bar = chartInfo.bars[0];
29
33
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
30
- const data = dataset[(_a = bar.dataIndex) !== null && _a !== void 0 ? _a : 0];
31
- const domain = useMemo(() => {
34
+ const data = dataset[bar.dataIndex ?? 0];
35
+ const domain = (0, react_1.useMemo)(() => {
32
36
  if (chartInfo.yAxis.domain &&
33
37
  typeof chartInfo.yAxis.domain[0] === 'number' &&
34
38
  typeof chartInfo.yAxis.domain[1] === 'number') {
@@ -39,28 +43,31 @@ export function OhlcChart({ dataset, chartInfo, }) {
39
43
  return [dataMin, dataMax];
40
44
  }, [bar, chartInfo.yAxis.domain, data]);
41
45
  const xAxis = chartInfo.xAxis;
42
- const xAxisFormatter = createAxisFormatter(xAxis.tick);
43
- const xAxisLongFormatter = createLongAxisFormatter(chartInfo.xAxis.tick);
44
- const yAxisLongFormatter = createLongAxisFormatter(chartInfo.yAxis.tick);
46
+ const xAxisFormatter = (0, formatters_1.createAxisFormatter)(xAxis.tick);
47
+ const xAxisLongFormatter = (0, formatters_1.createLongAxisFormatter)(chartInfo.xAxis.tick);
48
+ const yAxisLongFormatter = (0, formatters_1.createLongAxisFormatter)(chartInfo.yAxis.tick);
45
49
  console.log('temp.data', dataset, chartInfo);
46
- return (_jsx(ResponsiveContainer, { width: "100%", height: "100%", children: _jsxs(ScatterChart, { data: data, children: [renderGrid(), renderYAxis(Object.assign(Object.assign({}, chartInfo.yAxis), { domain })), _jsx(XAxisInternal, { dataKey: xAxis.dataKey, name: xAxis.name, tickFormatter: xAxisFormatter, tickLine: false, minTickGap: 10, padding: "gap", axisLine: {
47
- stroke: tokens.colorNeutralBackground6,
48
- }, fontSize: tokens.fontSizeBase100, tick: {
49
- fill: tokens.colorNeutralForeground1,
50
+ return ((0, jsx_runtime_1.jsx)(recharts_1.ResponsiveContainer, { width: "100%", height: "100%", children: (0, jsx_runtime_1.jsxs)(recharts_1.ScatterChart, { data: data, children: [(0, renderers_1.renderGrid)(), (0, renderers_1.renderYAxis)({
51
+ ...chartInfo.yAxis,
52
+ domain,
53
+ }), (0, jsx_runtime_1.jsx)(recharts_1.XAxis, { dataKey: xAxis.dataKey, name: xAxis.name, tickFormatter: xAxisFormatter, tickLine: false, minTickGap: 10, padding: "gap", axisLine: {
54
+ stroke: react_components_1.tokens.colorNeutralBackground6,
55
+ }, fontSize: react_components_1.tokens.fontSizeBase100, tick: {
56
+ fill: react_components_1.tokens.colorNeutralForeground1,
50
57
  opacity: 0.5,
51
- }, scale: xAxis.tick.type === 'time' ? 'time' : 'auto', type: xAxis.tick.type === 'category' ? 'category' : 'number', domain: xAxis.domain, height: 16 }), _jsx(Scatter, { yAxisId: "left", data: data, markerWidth: 1, width: 1, strokeWidth: 1,
58
+ }, scale: xAxis.tick.type === 'time' ? 'time' : 'auto', type: xAxis.tick.type === 'category' ? 'category' : 'number', domain: xAxis.domain, height: 16 }), (0, jsx_runtime_1.jsx)(recharts_1.Scatter, { yAxisId: "left", data: data, markerWidth: 1, width: 1, strokeWidth: 1,
52
59
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
53
60
  shape: (props) => renderShape(props, {
54
61
  bar,
55
62
  chartInfo,
56
- }) }), _jsx(Tooltip, { cursor: {
57
- stroke: tokens.colorNeutralBackground6,
63
+ }) }), (0, jsx_runtime_1.jsx)(recharts_1.Tooltip, { cursor: {
64
+ stroke: react_components_1.tokens.colorNeutralBackground6,
58
65
  opacity: 0.5,
59
66
  }, content: ({ active, payload }) => {
60
- if (!active || !(payload === null || payload === void 0 ? void 0 : payload.length)) {
61
- return _jsx(_Fragment, {});
67
+ if (!active || !payload?.length) {
68
+ return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
62
69
  }
63
- return (_jsx(OhclTooltipContent, { payload: payload[0], bar: bar, xAxisFormatter: xAxisLongFormatter, yAxisFormatter: yAxisLongFormatter }));
70
+ return ((0, jsx_runtime_1.jsx)(OhclTooltipContent, { payload: payload[0], bar: bar, xAxisFormatter: xAxisLongFormatter, yAxisFormatter: yAxisLongFormatter }));
64
71
  } })] }) }));
65
72
  }
66
73
  function OhclTooltipContent({ payload, bar, xAxisFormatter, yAxisFormatter, }) {
@@ -81,18 +88,17 @@ function OhclTooltipContent({ payload, bar, xAxisFormatter, yAxisFormatter, }) {
81
88
  name: bar.close.dataLabel,
82
89
  value: payload.payload[bar.close.dataKey],
83
90
  });
84
- return (_jsx("div", { style: {
91
+ return ((0, jsx_runtime_1.jsx)("div", { style: {
85
92
  display: 'flex',
86
93
  flexDirection: 'column',
87
- boxShadow: tokens.shadow16,
88
- backgroundColor: tokens.colorNeutralBackground1,
94
+ boxShadow: react_components_1.tokens.shadow16,
95
+ backgroundColor: react_components_1.tokens.colorNeutralBackground1,
89
96
  padding: 8,
90
97
  borderRadius: 4,
91
98
  gap: 4,
92
- }, children: _jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: 4 }, children: [_jsx(Caption1, { style: { color: tokens.colorNeutralForeground4 }, children: xAxisFormatter(payload.value) }), _jsx(Divider, { style: { opacity: 0.2 } }), items.map((item, index) => (_jsxs("div", { style: { display: 'flex', alignItems: 'center' }, children: [_jsx(Caption1, { style: { color: tokens.colorNeutralForeground4 }, children: item.name }), _jsx("div", { style: { flex: 1, minWidth: 50 } }), _jsx(Caption1, { style: { color: tokens.colorNeutralForeground4 }, children: yAxisFormatter(item.value) })] }, item.name + String(index))))] }) }));
99
+ }, children: (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'column', gap: 4 }, children: [(0, jsx_runtime_1.jsx)(react_components_1.Caption1, { style: { color: react_components_1.tokens.colorNeutralForeground4 }, children: xAxisFormatter(payload.value) }), (0, jsx_runtime_1.jsx)(react_components_1.Divider, { style: { opacity: 0.2 } }), items.map((item, index) => ((0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', alignItems: 'center' }, children: [(0, jsx_runtime_1.jsx)(react_components_1.Caption1, { style: { color: react_components_1.tokens.colorNeutralForeground4 }, children: item.name }), (0, jsx_runtime_1.jsx)("div", { style: { flex: 1, minWidth: 50 } }), (0, jsx_runtime_1.jsx)(react_components_1.Caption1, { style: { color: react_components_1.tokens.colorNeutralForeground4 }, children: yAxisFormatter(item.value) })] }, item.name + String(index))))] }) }));
93
100
  }
94
101
  function renderShape(props, { chartInfo, bar, }) {
95
- var _a, _b, _c, _d;
96
102
  const { x, width, payload, yAxis, xAxis } = props;
97
103
  const xValue = payload[xAxis.dataKey];
98
104
  const open = payload[bar.open.dataKey];
@@ -100,14 +106,14 @@ function renderShape(props, { chartInfo, bar, }) {
100
106
  const high = payload[bar.high.dataKey];
101
107
  const low = payload[bar.low.dataKey];
102
108
  const color = open < close
103
- ? (_b = (_a = bar.colors) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : tokens.colorPaletteGreenForeground1
104
- : (_d = (_c = bar.colors) === null || _c === void 0 ? void 0 : _c[1]) !== null && _d !== void 0 ? _d : tokens.colorPaletteRedForeground1;
109
+ ? bar.colors?.[0] ?? react_components_1.tokens.colorPaletteGreenForeground1
110
+ : bar.colors?.[1] ?? react_components_1.tokens.colorPaletteRedForeground1;
105
111
  const xPosition = xAxis.scale(xValue);
106
112
  let xWidth = 30;
107
113
  if (chartInfo.xAxis.tick.type === 'time' && chartInfo.xAxis.tick.interval) {
108
114
  xWidth =
109
- xAxis.scale(xValue + barSizeInTime(chartInfo.xAxis.tick.interval)) -
115
+ xAxis.scale(xValue + (0, exports.barSizeInTime)(chartInfo.xAxis.tick.interval)) -
110
116
  xPosition;
111
117
  }
112
- return (_jsxs("g", { children: [_jsx(Rectangle, { x: x + width / 2, y: yAxis.scale(high), width: 1, height: yAxis.scale(low) - yAxis.scale(high), fill: color, stroke: color, strokeWidth: 1 }), _jsx(Rectangle, { x: xPosition - xWidth / 2, y: Math.min(yAxis.scale(open), yAxis.scale(close)), width: xWidth, height: Math.abs(yAxis.scale(close) - yAxis.scale(open)), fill: color, stroke: color, strokeWidth: 1 })] }));
118
+ return ((0, jsx_runtime_1.jsxs)("g", { children: [(0, jsx_runtime_1.jsx)(recharts_1.Rectangle, { x: x + width / 2, y: yAxis.scale(high), width: 1, height: yAxis.scale(low) - yAxis.scale(high), fill: color, stroke: color, strokeWidth: 1 }), (0, jsx_runtime_1.jsx)(recharts_1.Rectangle, { x: xPosition - xWidth / 2, y: Math.min(yAxis.scale(open), yAxis.scale(close)), width: xWidth, height: Math.abs(yAxis.scale(close) - yAxis.scale(open)), fill: color, stroke: color, strokeWidth: 1 })] }));
113
119
  }
@@ -1,11 +1,13 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PieChart = PieChart;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
2
5
  /* eslint-disable @typescript-eslint/no-explicit-any */
3
- import { Caption1, tokens } from '@fluentui/react-components';
4
- import { Cell, Legend, Pie, PieChart as PieChartInternal, ResponsiveContainer, Tooltip, } from 'recharts';
5
- import { defaultColors } from './constants';
6
- import { createLongAxisFormatter } from './formatters';
7
- export function PieChart({ dataset, chartInfo, }) {
8
- var _a, _b;
6
+ const react_components_1 = require("@fluentui/react-components");
7
+ const recharts_1 = require("recharts");
8
+ const constants_1 = require("./constants");
9
+ const formatters_1 = require("./formatters");
10
+ function PieChart({ dataset, chartInfo, }) {
9
11
  const RADIAN = Math.PI / 180;
10
12
  const renderCustomizedLabel = ({ cx, cy, midAngle, innerRadius, outerRadius, percent, }) => {
11
13
  const radius = innerRadius + (outerRadius - innerRadius) * 0.5;
@@ -14,24 +16,21 @@ export function PieChart({ dataset, chartInfo, }) {
14
16
  if (percent < 0.05) {
15
17
  return null;
16
18
  }
17
- return (_jsx("text", { x: x, y: y, fill: "white", textAnchor: x > cx ? 'start' : 'end', dominantBaseline: "central", fontSize: tokens.fontSizeBase100, children: `${(percent * 100).toFixed(0)}%` }));
19
+ return ((0, jsx_runtime_1.jsx)("text", { x: x, y: y, fill: "white", textAnchor: x > cx ? 'start' : 'end', dominantBaseline: "central", fontSize: react_components_1.tokens.fontSizeBase100, children: `${(percent * 100).toFixed(0)}%` }));
18
20
  };
19
21
  const item = chartInfo.pie[0];
20
- const nameFormatter = createLongAxisFormatter(item.nameTick);
21
- const valueFormatter = createLongAxisFormatter(item.dataTick);
22
- return (_jsx(ResponsiveContainer, { width: "100%", height: "100%", children: _jsxs(PieChartInternal, { children: [_jsx(Pie, { data: dataset[(_a = item.dataIndex) !== null && _a !== void 0 ? _a : 0], cx: "50%", cy: "50%", labelLine: false, label: renderCustomizedLabel, outerRadius: 80, dataKey: item.dataKey, nameKey: item.nameKey, children: dataset[(_b = item.dataIndex) !== null && _b !== void 0 ? _b : 0].map((entry, index) => {
23
- var _a, _b;
24
- return (_jsx(Cell, { fill: item.colorKey && entry[item.colorKey]
25
- ? entry[item.colorKey]
26
- : ((_a = item.colors) !== null && _a !== void 0 ? _a : defaultColors)[index % ((_b = item.colors) !== null && _b !== void 0 ? _b : defaultColors).length] }, 'cell-' + String(index)));
27
- }) }), chartInfo.showLegend && (_jsx(Legend, { align: "right", layout: "vertical", verticalAlign: "top", wrapperStyle: {
28
- fontSize: tokens.fontSizeBase100,
29
- fontFamily: tokens.fontFamilyBase,
22
+ const nameFormatter = (0, formatters_1.createLongAxisFormatter)(item.nameTick);
23
+ const valueFormatter = (0, formatters_1.createLongAxisFormatter)(item.dataTick);
24
+ return ((0, jsx_runtime_1.jsx)(recharts_1.ResponsiveContainer, { width: "100%", height: "100%", children: (0, jsx_runtime_1.jsxs)(recharts_1.PieChart, { children: [(0, jsx_runtime_1.jsx)(recharts_1.Pie, { data: dataset[item.dataIndex ?? 0], cx: "50%", cy: "50%", labelLine: false, label: renderCustomizedLabel, outerRadius: 80, dataKey: item.dataKey, nameKey: item.nameKey, children: dataset[item.dataIndex ?? 0].map((entry, index) => ((0, jsx_runtime_1.jsx)(recharts_1.Cell, { fill: item.colorKey && entry[item.colorKey]
25
+ ? entry[item.colorKey]
26
+ : (item.colors ?? constants_1.defaultColors)[index % (item.colors ?? constants_1.defaultColors).length] }, 'cell-' + String(index)))) }), chartInfo.showLegend && ((0, jsx_runtime_1.jsx)(recharts_1.Legend, { align: "right", layout: "vertical", verticalAlign: "top", wrapperStyle: {
27
+ fontSize: react_components_1.tokens.fontSizeBase100,
28
+ fontFamily: react_components_1.tokens.fontFamilyBase,
30
29
  overflow: 'auto',
31
30
  top: 5,
32
31
  bottom: 5,
33
- } })), _jsx(Tooltip, { cursor: {
34
- stroke: tokens.colorNeutralBackground6,
32
+ } })), (0, jsx_runtime_1.jsx)(recharts_1.Tooltip, { cursor: {
33
+ stroke: react_components_1.tokens.colorNeutralBackground6,
35
34
  opacity: 0.5,
36
35
  }, content: ({ payload }) => renderTooltipContent({
37
36
  payload,
@@ -40,16 +39,16 @@ export function PieChart({ dataset, chartInfo, }) {
40
39
  }) })] }) }));
41
40
  }
42
41
  function renderTooltipContent({ payload, nameFormatter, valueFormatter, }) {
43
- return (_jsx("div", { style: {
42
+ return ((0, jsx_runtime_1.jsx)("div", { style: {
44
43
  display: 'flex',
45
44
  flexDirection: 'column',
46
- boxShadow: tokens.shadow16,
47
- backgroundColor: tokens.colorNeutralBackground1,
45
+ boxShadow: react_components_1.tokens.shadow16,
46
+ backgroundColor: react_components_1.tokens.colorNeutralBackground1,
48
47
  padding: 8,
49
48
  borderRadius: 4,
50
49
  gap: 4,
51
- }, children: _jsx("div", { style: { display: 'flex', flexDirection: 'column', gap: 4 }, children: payload === null || payload === void 0 ? void 0 : payload.map((item, index) => (_jsxs("div", { style: { display: 'flex', alignItems: 'center' }, children: [_jsx(Caption1, { style: {
52
- color: tokens.colorNeutralForeground4,
50
+ }, children: (0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', flexDirection: 'column', gap: 4 }, children: payload?.map((item, index) => ((0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', alignItems: 'center' }, children: [(0, jsx_runtime_1.jsx)(react_components_1.Caption1, { style: {
51
+ color: react_components_1.tokens.colorNeutralForeground4,
53
52
  marginLeft: 8,
54
- }, children: nameFormatter(item.name) }), _jsx("div", { style: { flex: 1, minWidth: 50 } }), _jsx(Caption1, { style: { color: tokens.colorNeutralForeground4 }, children: valueFormatter(item.value) })] }, index))) }) }));
53
+ }, children: nameFormatter(item.name) }), (0, jsx_runtime_1.jsx)("div", { style: { flex: 1, minWidth: 50 } }), (0, jsx_runtime_1.jsx)(react_components_1.Caption1, { style: { color: react_components_1.tokens.colorNeutralForeground4 }, children: valueFormatter(item.value) })] }, index))) }) }));
55
54
  }
@@ -1,17 +1,19 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RadarChart = RadarChart;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
2
5
  /* eslint-disable @typescript-eslint/no-explicit-any */
3
- import { Caption1, tokens } from '@fluentui/react-components';
4
- import { PolarAngleAxis, PolarGrid, PolarRadiusAxis, Radar, RadarChart as RadarChartInternal, ResponsiveContainer, Tooltip, } from 'recharts';
5
- import { createAxisFormatter, createLongAxisFormatter, } from './formatters';
6
- export function RadarChart({ dataset, chartInfo, }) {
7
- var _a, _b;
6
+ const react_components_1 = require("@fluentui/react-components");
7
+ const recharts_1 = require("recharts");
8
+ const formatters_1 = require("./formatters");
9
+ function RadarChart({ dataset, chartInfo, }) {
8
10
  const data = dataset[0];
9
11
  const radar = chartInfo.radar[0];
10
- const nameFormatter = createLongAxisFormatter(radar.nameTick);
11
- const valueFormatter = createLongAxisFormatter(radar.dataTick);
12
- const tickFormatter = createAxisFormatter(radar.dataTick);
13
- return (_jsx(ResponsiveContainer, { width: "100%", height: "100%", children: _jsxs(RadarChartInternal, { cx: "50%", cy: "50%", outerRadius: "80%", data: data, children: [_jsx(PolarGrid, { stroke: tokens.colorNeutralBackground6, opacity: 0.5 }), _jsx(PolarAngleAxis, { dataKey: radar.nameKey, fontSize: tokens.fontSizeBase100, tickFormatter: nameFormatter }), _jsx(PolarRadiusAxis, { fontSize: tokens.fontSizeBase100, tickFormatter: tickFormatter }), _jsx(Radar, { dataKey: radar.dataKey, stroke: (_a = radar.color) !== null && _a !== void 0 ? _a : '#8884d8', fill: (_b = radar.color) !== null && _b !== void 0 ? _b : '#8884d8', fillOpacity: 0.6 }), _jsx(Tooltip, { cursor: {
14
- stroke: tokens.colorNeutralBackground6,
12
+ const nameFormatter = (0, formatters_1.createLongAxisFormatter)(radar.nameTick);
13
+ const valueFormatter = (0, formatters_1.createLongAxisFormatter)(radar.dataTick);
14
+ const tickFormatter = (0, formatters_1.createAxisFormatter)(radar.dataTick);
15
+ return ((0, jsx_runtime_1.jsx)(recharts_1.ResponsiveContainer, { width: "100%", height: "100%", children: (0, jsx_runtime_1.jsxs)(recharts_1.RadarChart, { cx: "50%", cy: "50%", outerRadius: "80%", data: data, children: [(0, jsx_runtime_1.jsx)(recharts_1.PolarGrid, { stroke: react_components_1.tokens.colorNeutralBackground6, opacity: 0.5 }), (0, jsx_runtime_1.jsx)(recharts_1.PolarAngleAxis, { dataKey: radar.nameKey, fontSize: react_components_1.tokens.fontSizeBase100, tickFormatter: nameFormatter }), (0, jsx_runtime_1.jsx)(recharts_1.PolarRadiusAxis, { fontSize: react_components_1.tokens.fontSizeBase100, tickFormatter: tickFormatter }), (0, jsx_runtime_1.jsx)(recharts_1.Radar, { dataKey: radar.dataKey, stroke: radar.color ?? '#8884d8', fill: radar.color ?? '#8884d8', fillOpacity: 0.6 }), (0, jsx_runtime_1.jsx)(recharts_1.Tooltip, { cursor: {
16
+ stroke: react_components_1.tokens.colorNeutralBackground6,
15
17
  opacity: 0.5,
16
18
  }, content: ({ payload }) => renderTooltipContent({
17
19
  payload,
@@ -21,16 +23,16 @@ export function RadarChart({ dataset, chartInfo, }) {
21
23
  }) })] }) }));
22
24
  }
23
25
  function renderTooltipContent({ payload, nameFormatter, valueFormatter, radar, }) {
24
- return (_jsx("div", { style: {
26
+ return ((0, jsx_runtime_1.jsx)("div", { style: {
25
27
  display: 'flex',
26
28
  flexDirection: 'column',
27
- boxShadow: tokens.shadow16,
28
- backgroundColor: tokens.colorNeutralBackground1,
29
+ boxShadow: react_components_1.tokens.shadow16,
30
+ backgroundColor: react_components_1.tokens.colorNeutralBackground1,
29
31
  padding: 8,
30
32
  borderRadius: 4,
31
33
  gap: 4,
32
- }, children: _jsx("div", { style: { display: 'flex', flexDirection: 'column', gap: 4 }, children: payload === null || payload === void 0 ? void 0 : payload.map((item, index) => (_jsxs("div", { style: { display: 'flex', alignItems: 'center' }, children: [_jsx(Caption1, { style: {
33
- color: tokens.colorNeutralForeground4,
34
+ }, children: (0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', flexDirection: 'column', gap: 4 }, children: payload?.map((item, index) => ((0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', alignItems: 'center' }, children: [(0, jsx_runtime_1.jsx)(react_components_1.Caption1, { style: {
35
+ color: react_components_1.tokens.colorNeutralForeground4,
34
36
  marginLeft: 8,
35
- }, children: nameFormatter(item.payload[radar.nameKey]) }), _jsx("div", { style: { flex: 1, minWidth: 50 } }), _jsx(Caption1, { style: { color: tokens.colorNeutralForeground4 }, children: valueFormatter(item.value) })] }, index))) }) }));
37
+ }, children: nameFormatter(item.payload[radar.nameKey]) }), (0, jsx_runtime_1.jsx)("div", { style: { flex: 1, minWidth: 50 } }), (0, jsx_runtime_1.jsx)(react_components_1.Caption1, { style: { color: react_components_1.tokens.colorNeutralForeground4 }, children: valueFormatter(item.value) })] }, index))) }) }));
36
38
  }
@@ -1,20 +1,19 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Caption1, Divider, tokens } from '@fluentui/react-components';
3
- import { useMemo } from 'react';
4
- import { ResponsiveContainer, Scatter, ScatterChart as ScatterChartInternal, Tooltip, ZAxis, } from 'recharts';
5
- import { defaultColors } from './constants';
6
- import { createLongAxisFormatter } from './formatters';
7
- import { renderGrid, renderXAxis, renderYAxis } from './renderers';
8
- export function ScatterChart({ dataset, chartInfo, }) {
9
- return (_jsx(ResponsiveContainer, { width: "100%", height: "100%", children: _jsxs(ScatterChartInternal, { children: [renderGrid(), renderXAxis(chartInfo.xAxis), renderYAxis(chartInfo.yAxis), _jsx(ZAxis, { type: "number", dataKey: chartInfo.zAxis.dataKey, range: chartInfo.zAxis.range, name: chartInfo.zAxis.name }), chartInfo.scatters.map((scatter, index) => {
10
- var _a, _b;
11
- return (_jsx(Scatter, { yAxisId: "left", name: scatter.dataLabel, data: dataset[(_a = scatter.dataIndex) !== null && _a !== void 0 ? _a : 0], dataKey: scatter.dataKey, fill: (_b = scatter.color) !== null && _b !== void 0 ? _b : defaultColors[index] }, index));
12
- }), _jsx(Tooltip, { cursor: false, content: (props) => {
13
- var _a;
14
- if (!props.active || !((_a = props.payload) === null || _a === void 0 ? void 0 : _a.length)) {
15
- return _jsx(_Fragment, {});
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ScatterChart = ScatterChart;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_components_1 = require("@fluentui/react-components");
6
+ const react_1 = require("react");
7
+ const recharts_1 = require("recharts");
8
+ const constants_1 = require("./constants");
9
+ const formatters_1 = require("./formatters");
10
+ const renderers_1 = require("./renderers");
11
+ function ScatterChart({ dataset, chartInfo, }) {
12
+ return ((0, jsx_runtime_1.jsx)(recharts_1.ResponsiveContainer, { width: "100%", height: "100%", children: (0, jsx_runtime_1.jsxs)(recharts_1.ScatterChart, { children: [(0, renderers_1.renderGrid)(), (0, renderers_1.renderXAxis)(chartInfo.xAxis), (0, renderers_1.renderYAxis)(chartInfo.yAxis), (0, jsx_runtime_1.jsx)(recharts_1.ZAxis, { type: "number", dataKey: chartInfo.zAxis.dataKey, range: chartInfo.zAxis.range, name: chartInfo.zAxis.name }), chartInfo.scatters.map((scatter, index) => ((0, jsx_runtime_1.jsx)(recharts_1.Scatter, { yAxisId: "left", name: scatter.dataLabel, data: dataset[scatter.dataIndex ?? 0], dataKey: scatter.dataKey, fill: scatter.color ?? constants_1.defaultColors[index] }, index))), (0, jsx_runtime_1.jsx)(recharts_1.Tooltip, { cursor: false, content: (props) => {
13
+ if (!props.active || !props.payload?.length) {
14
+ return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
16
15
  }
17
- return (_jsx(ScatterTooltipContent, { active: props.active, payload: props.payload, chartInfo: chartInfo, dataset: dataset }));
16
+ return ((0, jsx_runtime_1.jsx)(ScatterTooltipContent, { active: props.active, payload: props.payload, chartInfo: chartInfo, dataset: dataset }));
18
17
  } })] }) }));
19
18
  }
20
19
  const ScatterTooltipContent = (props) => {
@@ -28,8 +27,7 @@ const ScatterTooltipContent = (props) => {
28
27
  const xValue = xPayload.value;
29
28
  const yValue = yPayload.value;
30
29
  const findKey = xValue + ':' + yValue;
31
- const items = useMemo(() => {
32
- var _a, _b, _c, _d;
30
+ const items = (0, react_1.useMemo)(() => {
33
31
  const _items = [];
34
32
  if (!xAxis.dataKey || !yAxis.dataKey || !zAxis.dataKey) {
35
33
  return _items;
@@ -44,14 +42,14 @@ const ScatterTooltipContent = (props) => {
44
42
  });
45
43
  for (let i = 0; i < chartInfo.scatters.length; i++) {
46
44
  const scatter = chartInfo.scatters[i];
47
- const zValue = (_c = (_b = datasetDict[(_a = scatter.dataIndex) !== null && _a !== void 0 ? _a : 0]) === null || _b === void 0 ? void 0 : _b[findKey]) === null || _c === void 0 ? void 0 : _c[zAxis.dataKey];
45
+ const zValue = datasetDict[scatter.dataIndex ?? 0]?.[findKey]?.[zAxis.dataKey];
48
46
  if (zValue === undefined) {
49
47
  continue;
50
48
  }
51
49
  _items.push({
52
50
  name: scatter.dataLabel,
53
51
  value: zValue,
54
- color: (_d = scatter.color) !== null && _d !== void 0 ? _d : defaultColors[i],
52
+ color: scatter.color ?? constants_1.defaultColors[i],
55
53
  });
56
54
  }
57
55
  return _items;
@@ -63,21 +61,21 @@ const ScatterTooltipContent = (props) => {
63
61
  yAxis.dataKey,
64
62
  zAxis.dataKey,
65
63
  ]);
66
- const xAxisFormatter = createLongAxisFormatter(xAxis.tick);
67
- const yAxisFormatter = createLongAxisFormatter(yAxis.tick);
68
- const zAxisFormatter = createLongAxisFormatter(zAxis.tick);
69
- return (_jsx("div", { style: {
64
+ const xAxisFormatter = (0, formatters_1.createLongAxisFormatter)(xAxis.tick);
65
+ const yAxisFormatter = (0, formatters_1.createLongAxisFormatter)(yAxis.tick);
66
+ const zAxisFormatter = (0, formatters_1.createLongAxisFormatter)(zAxis.tick);
67
+ return ((0, jsx_runtime_1.jsx)("div", { style: {
70
68
  display: 'flex',
71
69
  flexDirection: 'column',
72
- boxShadow: tokens.shadow16,
73
- backgroundColor: tokens.colorNeutralBackground1,
70
+ boxShadow: react_components_1.tokens.shadow16,
71
+ backgroundColor: react_components_1.tokens.colorNeutralBackground1,
74
72
  padding: 8,
75
73
  borderRadius: 4,
76
74
  gap: 4,
77
- }, children: _jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: 4 }, children: [_jsxs("div", { style: { display: 'flex', alignItems: 'center' }, children: [_jsx(Caption1, { style: { color: tokens.colorNeutralForeground4 }, children: xAxis.name }), _jsx("div", { style: { flex: 1, minWidth: 50 } }), _jsx(Caption1, { style: { color: tokens.colorNeutralForeground4 }, children: xAxisFormatter(xValue) })] }), _jsxs("div", { style: { display: 'flex', alignItems: 'center' }, children: [_jsx(Caption1, { style: { color: tokens.colorNeutralForeground4 }, children: yAxis.name }), _jsx("div", { style: { flex: 1, minWidth: 50 } }), _jsx(Caption1, { style: { color: tokens.colorNeutralForeground4 }, children: yAxisFormatter(yValue) })] }), _jsx(Divider, { style: { opacity: 0.2 } }), items.map((item, index) => (_jsxs("div", { style: { display: 'flex', alignItems: 'center' }, children: [_jsx("div", { style: {
75
+ }, children: (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'column', gap: 4 }, children: [(0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', alignItems: 'center' }, children: [(0, jsx_runtime_1.jsx)(react_components_1.Caption1, { style: { color: react_components_1.tokens.colorNeutralForeground4 }, children: xAxis.name }), (0, jsx_runtime_1.jsx)("div", { style: { flex: 1, minWidth: 50 } }), (0, jsx_runtime_1.jsx)(react_components_1.Caption1, { style: { color: react_components_1.tokens.colorNeutralForeground4 }, children: xAxisFormatter(xValue) })] }), (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', alignItems: 'center' }, children: [(0, jsx_runtime_1.jsx)(react_components_1.Caption1, { style: { color: react_components_1.tokens.colorNeutralForeground4 }, children: yAxis.name }), (0, jsx_runtime_1.jsx)("div", { style: { flex: 1, minWidth: 50 } }), (0, jsx_runtime_1.jsx)(react_components_1.Caption1, { style: { color: react_components_1.tokens.colorNeutralForeground4 }, children: yAxisFormatter(yValue) })] }), (0, jsx_runtime_1.jsx)(react_components_1.Divider, { style: { opacity: 0.2 } }), items.map((item, index) => ((0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', alignItems: 'center' }, children: [(0, jsx_runtime_1.jsx)("div", { style: {
78
76
  width: 8,
79
77
  height: 8,
80
78
  background: item.color,
81
79
  borderRadius: 4,
82
- } }), _jsx(Caption1, { style: { color: tokens.colorNeutralForeground4, marginLeft: 8 }, children: item.name }), _jsx("div", { style: { flex: 1, minWidth: 50 } }), _jsx(Caption1, { style: { color: tokens.colorNeutralForeground4 }, children: zAxisFormatter(item.value) })] }, index)))] }) }));
80
+ } }), (0, jsx_runtime_1.jsx)(react_components_1.Caption1, { style: { color: react_components_1.tokens.colorNeutralForeground4, marginLeft: 8 }, children: item.name }), (0, jsx_runtime_1.jsx)("div", { style: { flex: 1, minWidth: 50 } }), (0, jsx_runtime_1.jsx)(react_components_1.Caption1, { style: { color: react_components_1.tokens.colorNeutralForeground4 }, children: zAxisFormatter(item.value) })] }, index)))] }) }));
83
81
  };
@@ -1,4 +1,7 @@
1
- export const defaultColors = [
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.defaultColors = void 0;
4
+ exports.defaultColors = [
2
5
  '#0088FE',
3
6
  '#00C49F',
4
7
  '#FFBB28',
@@ -1,4 +1,12 @@
1
- import dayjs from 'dayjs';
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.formatNumber = exports.formatCurrency = exports.formatDate = exports.formatCurrencyWithSuffix = void 0;
7
+ exports.createAxisFormatter = createAxisFormatter;
8
+ exports.createLongAxisFormatter = createLongAxisFormatter;
9
+ const dayjs_1 = __importDefault(require("dayjs"));
2
10
  function extractNumberInfo(value) {
3
11
  const suffix = ['K', 'M', 'B', 'T'];
4
12
  if (value === null || value === undefined) {
@@ -20,7 +28,7 @@ function extractNumberInfo(value) {
20
28
  };
21
29
  }
22
30
  }
23
- export const formatCurrencyWithSuffix = (input, digit = 2) => {
31
+ const formatCurrencyWithSuffix = (input, digit = 2) => {
24
32
  const suffix = ['K', 'M', 'B', 'T'];
25
33
  if (input === null || input === undefined) {
26
34
  return '';
@@ -29,25 +37,26 @@ export const formatCurrencyWithSuffix = (input, digit = 2) => {
29
37
  const sign = Math.sign(input);
30
38
  if (abs >= 1000) {
31
39
  const i = Math.floor(Math.log(abs) / Math.log(1000));
32
- return (formatCurrency(sign * (abs / Math.pow(1000, i)), digit) + suffix[i - 1]);
40
+ return ((0, exports.formatCurrency)(sign * (abs / Math.pow(1000, i)), digit) + suffix[i - 1]);
33
41
  }
34
42
  else {
35
- return formatCurrency(input, digit);
43
+ return (0, exports.formatCurrency)(input, digit);
36
44
  }
37
45
  };
38
- export const formatDate = (input, format) => {
46
+ exports.formatCurrencyWithSuffix = formatCurrencyWithSuffix;
47
+ const formatDate = (input, format) => {
39
48
  if (!input) {
40
49
  return '';
41
50
  }
42
- return dayjs(new Date(input)).format(format);
51
+ return (0, dayjs_1.default)(new Date(input)).format(format);
43
52
  };
44
- export const formatCurrency = (input, digit = 2) => {
45
- var _a, _b;
53
+ exports.formatDate = formatDate;
54
+ const formatCurrency = (input, digit = 2) => {
46
55
  if (input === null || input === undefined) {
47
56
  return '';
48
57
  }
49
- const minDigit = typeof digit === 'object' ? (_a = digit.minDigit) !== null && _a !== void 0 ? _a : digit.digit : digit;
50
- const maxDigit = typeof digit === 'object' ? (_b = digit.maxDigit) !== null && _b !== void 0 ? _b : digit.digit : digit;
58
+ const minDigit = typeof digit === 'object' ? digit.minDigit ?? digit.digit : digit;
59
+ const maxDigit = typeof digit === 'object' ? digit.maxDigit ?? digit.digit : digit;
51
60
  const formatter = new Intl.NumberFormat('en-IN', {
52
61
  currency: 'INR',
53
62
  style: 'currency',
@@ -56,19 +65,20 @@ export const formatCurrency = (input, digit = 2) => {
56
65
  });
57
66
  return formatter.format(input || 0);
58
67
  };
59
- export const formatNumber = (input, digit = 2) => {
60
- var _a, _b;
68
+ exports.formatCurrency = formatCurrency;
69
+ const formatNumber = (input, digit = 2) => {
61
70
  if (input === null || input === undefined) {
62
71
  return '';
63
72
  }
64
- const minDigit = typeof digit === 'object' ? (_a = digit.minDigit) !== null && _a !== void 0 ? _a : digit.digit : digit;
65
- const maxDigit = typeof digit === 'object' ? (_b = digit.maxDigit) !== null && _b !== void 0 ? _b : digit.digit : digit;
73
+ const minDigit = typeof digit === 'object' ? digit.minDigit ?? digit.digit : digit;
74
+ const maxDigit = typeof digit === 'object' ? digit.maxDigit ?? digit.digit : digit;
66
75
  const formatter = new Intl.NumberFormat('en-IN', {
67
76
  minimumFractionDigits: minDigit,
68
77
  maximumFractionDigits: maxDigit,
69
78
  });
70
79
  return formatter.format(input || 0);
71
80
  };
81
+ exports.formatNumber = formatNumber;
72
82
  const timeAxisFormats = {
73
83
  minute: 'mm',
74
84
  hour: 'HH',
@@ -102,11 +112,11 @@ const timeLongAxisFormats = {
102
112
  // };
103
113
  function createTimeAxisFormatter(format) {
104
114
  const formatString = timeAxisFormats[format];
105
- return (value) => formatDate(new Date(value), formatString);
115
+ return (value) => (0, exports.formatDate)(new Date(value), formatString);
106
116
  }
107
117
  function createFullTimeAxisFormatter(format) {
108
118
  const formatString = timeLongAxisFormats[format];
109
- return (value) => formatDate(new Date(value), formatString);
119
+ return (value) => (0, exports.formatDate)(new Date(value), formatString);
110
120
  }
111
121
  function createNumberAxisFormatter(options) {
112
122
  return (value) => {
@@ -114,12 +124,12 @@ function createNumberAxisFormatter(options) {
114
124
  if (!info) {
115
125
  return '';
116
126
  }
117
- return formatNumber(info.value, options) + info.symbol;
127
+ return (0, exports.formatNumber)(info.value, options) + info.symbol;
118
128
  };
119
129
  }
120
130
  function createLongNumberAxisFormatter(options) {
121
131
  return (value) => {
122
- return formatNumber(value, options);
132
+ return (0, exports.formatNumber)(value, options);
123
133
  };
124
134
  }
125
135
  function createCurrencyAxisFormatter() {
@@ -128,7 +138,7 @@ function createCurrencyAxisFormatter() {
128
138
  if (!info) {
129
139
  return '';
130
140
  }
131
- return formatCurrency(info.value, 0) + info.symbol;
141
+ return (0, exports.formatCurrency)(info.value, 0) + info.symbol;
132
142
  };
133
143
  }
134
144
  function createCategoryAxisFormatter(options) {
@@ -142,7 +152,7 @@ function createCategoryAxisFormatter(options) {
142
152
  return typeof value === 'string' ? value : String(value);
143
153
  };
144
154
  }
145
- export function createAxisFormatter(tick) {
155
+ function createAxisFormatter(tick) {
146
156
  switch (tick.type) {
147
157
  case 'time':
148
158
  return createTimeAxisFormatter(tick.format);
@@ -153,12 +163,12 @@ export function createAxisFormatter(tick) {
153
163
  case 'category':
154
164
  return createCategoryAxisFormatter(tick.options);
155
165
  case 'weekday':
156
- return (value) => dayjs().day(value).format('ddd');
166
+ return (value) => (0, dayjs_1.default)().day(value).format('ddd');
157
167
  default:
158
168
  return (value) => String(value);
159
169
  }
160
170
  }
161
- export function createLongAxisFormatter(tick) {
171
+ function createLongAxisFormatter(tick) {
162
172
  switch (tick.type) {
163
173
  case 'time':
164
174
  return createFullTimeAxisFormatter(tick.format);
@@ -169,7 +179,7 @@ export function createLongAxisFormatter(tick) {
169
179
  case 'category':
170
180
  return createCategoryAxisFormatter(tick.options);
171
181
  case 'weekday':
172
- return ((value) => dayjs().day(value).format('dddd'));
182
+ return ((value) => (0, dayjs_1.default)().day(value).format('dddd'));
173
183
  default:
174
184
  return (value) => String(value);
175
185
  }
@@ -1,6 +1,7 @@
1
+ "use strict";
1
2
  /* eslint-disable unused-imports/no-unused-vars */
2
3
  // TODO: Remove eslint disable condition after finishing the implementation
3
- export {};
4
+ Object.defineProperty(exports, "__esModule", { value: true });
4
5
  // number format - decimal or currency
5
6
  // number format - number of decimals
6
7
  // number format - group it (K, M, B, T)