@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.
- package/App/App.js +11 -7
- package/App/AppHeaderContianer.js +50 -44
- package/App/AppLogo.js +12 -9
- package/App/AppStringContext.js +13 -9
- package/App/AppUI.js +15 -11
- package/App/LayoutProvider.js +16 -24
- package/App/NavigationContainer.js +28 -28
- package/App/QuickActionItem.js +10 -6
- package/App/index.js +5 -1
- package/App/utils.d.ts +1 -1
- package/App/utils.js +7 -5
- package/CommandBar/Button.js +17 -14
- package/CommandBar/Divider.js +9 -6
- package/CommandBar/IconButton.js +16 -13
- package/CommandBar/Label.js +11 -8
- package/CommandBar/MenuButton.js +20 -17
- package/CommandBar/MenuItem.js +19 -16
- package/CommandBar/MenuItems.js +10 -10
- package/CommandBar/MenuList.js +12 -9
- package/CommandBar/Wrapper.js +10 -7
- package/CommandBar/index.js +15 -13
- package/DataForm/SectionControl.js +7 -4
- package/DataGrid/ActionCell.js +14 -11
- package/DataGrid/CommandContainer.js +10 -6
- package/DataGrid/CustomizeColumns/AddColumns.js +61 -59
- package/DataGrid/CustomizeColumns/ColumnItem.js +23 -19
- package/DataGrid/CustomizeColumns/CustomizeColumns.js +41 -36
- package/DataGrid/CustomizeColumns/index.js +5 -1
- package/DataGrid/FormSubgridCommandContainer.js +17 -13
- package/DataGrid/FormSubgridViewSelector.js +21 -21
- package/DataGrid/GridColumnHeader/ConditionValueControl.js +33 -33
- package/DataGrid/GridColumnHeader/FilterForm.js +28 -27
- package/DataGrid/GridColumnHeader/OperatorSelect.js +19 -13
- package/DataGrid/GridColumnHeader/TableHeaderFilterCell.js +35 -31
- package/DataGrid/GridColumnHeader/index.js +5 -1
- package/DataGrid/GridColumnHeader/utils.js +6 -2
- package/DataGrid/GridHeaderContainer.js +8 -4
- package/DataGrid/GridHeaderDesktop.js +28 -28
- package/DataGrid/GridHeaderMobile.js +20 -19
- package/DataGrid/GridListContainer.js +50 -44
- package/DataGrid/GridPaginationContainer.js +16 -13
- package/DataGrid/GridTableContainer.js +98 -89
- package/DataGrid/TableCell/TableCellAction.js +15 -11
- package/DataGrid/TableCell/TableCellBase.js +13 -4
- package/DataGrid/TableCell/TableCellCheckbox.js +11 -8
- package/DataGrid/TableCell/TableCellChoice.js +15 -13
- package/DataGrid/TableCell/TableCellLink.js +14 -11
- package/DataGrid/TableCell/TableCellText.js +10 -7
- package/DataGrid/TableCell/index.js +20 -4
- package/DataGrid/index.js +11 -4
- package/DataGrid/types.js +2 -1
- package/DataGrid/useTableColumns.js +98 -103
- package/DataGrid/utils.js +5 -1
- package/DialogContainer/AlertDialog.js +11 -11
- package/DialogContainer/ConfirmDialog.js +13 -14
- package/DialogContainer/DialogContainer.js +19 -26
- package/DialogContainer/ErrorDialog.js +15 -15
- package/DialogContainer/PromptDialog.js +76 -58
- package/DialogContainer/index.js +5 -1
- package/Insights/CommandBarContainer.js +17 -11
- package/Insights/FilterBarContainer.js +32 -37
- package/Insights/Grid.js +13 -9
- package/Insights/InsightsContainer.js +22 -19
- package/Insights/WidgetChartContainer.js +34 -30
- package/Insights/WidgetDataGridContainer.js +45 -33
- package/Insights/WidgetTableContainer.js +29 -26
- package/Insights/WidgetTileContainer.js +16 -12
- package/Insights/WidgetTitleBar.js +15 -10
- package/Insights/Widgets.js +28 -25
- package/Insights/charts/AreaChart.js +15 -12
- package/Insights/charts/BarChart.js +15 -12
- package/Insights/charts/ComposedChart.js +15 -13
- package/Insights/charts/CustomTooltipContent.js +13 -9
- package/Insights/charts/GaugeChart.js +6 -3
- package/Insights/charts/LineChart.js +15 -12
- package/Insights/charts/OhlcChart.js +46 -40
- package/Insights/charts/PieChart.js +25 -26
- package/Insights/charts/RadarChart.js +19 -17
- package/Insights/charts/ScatterChart.js +26 -28
- package/Insights/charts/constants.js +4 -1
- package/Insights/charts/formatters.js +33 -23
- package/Insights/charts/index.js +2 -1
- package/Insights/charts/renderers.js +36 -26
- package/Insights/hooks/useQueriesData.js +27 -30
- package/Insights/hooks/useWidgetDetail.js +24 -15
- package/OverflowCommandBar/OverflowCommandBar.js +19 -12
- package/OverflowCommandBar/OverflowMenu.js +22 -30
- package/OverflowCommandBar/OverflowMenuDivider.js +10 -6
- package/OverflowCommandBar/index.js +9 -3
- package/OverflowCommandBar/render.js +15 -10
- package/OverflowCommandBar/utils.js +6 -4
- package/PageBoard/BoardColumn.js +8 -5
- package/PageBoard/BoardColumnCard.d.ts +1 -1
- package/PageBoard/BoardColumnCard.js +15 -11
- package/PageBoard/BoardColumnUI.js +45 -46
- package/PageBoard/BoardingColumnCardLoading.js +13 -10
- package/PageBoard/Header.js +23 -28
- package/PageBoard/PageBoard.js +28 -26
- package/PageBoard/index.js +5 -1
- package/PageEntityForm/CommandContainer.js +25 -21
- package/PageEntityForm/FormTabRelated.js +20 -17
- package/PageEntityForm/PageEntityForm.js +20 -16
- package/PageEntityForm/PageEntityFormDesktopContainer.js +77 -70
- package/PageEntityForm/PageEntityFormStringContext.js +9 -5
- package/PageEntityForm/ProcessFlow.js +24 -21
- package/PageEntityForm/RecordCard.js +31 -24
- package/PageEntityForm/RecordCardLoading.js +13 -11
- package/PageEntityForm/RecordSetNavigatorContainer.js +34 -31
- package/PageEntityForm/RelatedViewSelector.js +34 -36
- package/PageEntityForm/SectionContainer.js +35 -31
- package/PageEntityForm/StandardControl.js +84 -76
- package/PageEntityForm/SubgridControl.js +23 -21
- package/PageEntityForm/index.js +5 -1
- package/PageEntityView/FormSubgridContainer.js +26 -22
- package/PageEntityView/PageEntityView.js +19 -15
- package/PageEntityView/PageEntityViewDesktopContainer.js +13 -9
- package/PageEntityView/PageEntityViewDesktopFrame.js +21 -17
- package/PageEntityView/PageEntityViewMobileContainer.js +13 -9
- package/PageEntityView/PageEntityViewStringContext.js +9 -5
- package/PageEntityView/index.js +5 -1
- package/PageInsights/PageInsights.js +13 -9
- package/PageInsights/index.js +6 -1
- package/ProgressIndicatorContainer/index.js +14 -10
- package/ToastNotificationContainer/index.js +18 -15
- package/componentStore.js +5 -2
- package/components/BodyLoading.js +11 -7
- package/components/DialogLogin.js +8 -5
- package/components/DndProvider.d.ts +12 -0
- package/components/DndProvider.js +68 -0
- package/components/LoginForm.js +46 -36
- package/components/PageBroken.js +8 -5
- package/components/PageLoading.js +8 -5
- package/components/PageLogin.js +17 -14
- package/form/FormControl.js +44 -50
- package/form/FormControlLoading.js +8 -4
- package/form/controls/AttachmentControl.js +72 -77
- package/form/controls/AttachmentsControl.js +24 -30
- package/form/controls/CurrencyControl.js +16 -13
- package/form/controls/DateControl.js +24 -18
- package/form/controls/DateRangeControl.js +22 -18
- package/form/controls/DateTimeControl.js +49 -43
- package/form/controls/DecimalControl.js +14 -11
- package/form/controls/DurationControl.js +18 -14
- package/form/controls/EmailControl.js +14 -11
- package/form/controls/IntegerControl.js +11 -8
- package/form/controls/LookupControl.js +58 -56
- package/form/controls/MultiSelectControl.js +12 -9
- package/form/controls/MultiSelectLookupControl.js +55 -53
- package/form/controls/PasswordControl.js +11 -8
- package/form/controls/RichTextControl.js +32 -5
- package/form/controls/SelectControl.js +15 -13
- package/form/controls/SwitchControl.js +7 -4
- package/form/controls/TelephoneControl.js +10 -7
- package/form/controls/TextAreaControl.js +11 -8
- package/form/controls/TextControl.js +12 -9
- package/form/controls/UrlControl.js +10 -7
- package/form/controls/types.js +2 -1
- package/form/controls/useLookupData.js +43 -54
- package/form/layout/FormBody/FormBody.js +10 -6
- package/form/layout/FormBody/index.js +17 -1
- package/form/layout/FormSection/FormSection.js +31 -20
- package/form/layout/FormSection/FormSectionColumn.js +7 -3
- package/form/layout/FormSection/FormSectionLoading.js +5 -1
- package/form/layout/FormSection/index.js +5 -1
- package/form/layout/FormTab/FormTab.js +21 -17
- package/form/layout/FormTab/FormTabColumn.js +9 -5
- package/form/layout/FormTab/index.js +5 -1
- package/form/layout/TabContext.js +5 -2
- package/form/layout/index.js +9 -3
- package/form/types.js +2 -1
- package/package.json +4 -12
- package/types/index.js +2 -1
- package/utils/avatar.js +4 -1
- package/DataGrid/ScrollbarWithMoreDataRequest.d.ts +0 -9
- package/DataGrid/ScrollbarWithMoreDataRequest.js +0 -33
- package/form/controls/NumberControl.d.ts +0 -4
- package/form/controls/NumberControl.js +0 -16
- package/form/controls/utils.d.ts +0 -4
- package/form/controls/utils.js +0 -42
|
@@ -1,34 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
|
|
27
|
-
|
|
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[
|
|
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 (
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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 }),
|
|
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
|
-
}) }),
|
|
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 || !
|
|
61
|
-
return
|
|
67
|
+
if (!active || !payload?.length) {
|
|
68
|
+
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
|
|
62
69
|
}
|
|
63
|
-
return (
|
|
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 (
|
|
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:
|
|
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
|
-
?
|
|
104
|
-
:
|
|
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 (
|
|
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
|
-
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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 (
|
|
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 (
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
} })),
|
|
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 (
|
|
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:
|
|
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) }),
|
|
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
|
-
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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 (
|
|
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 (
|
|
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:
|
|
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]) }),
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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 (
|
|
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 =
|
|
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:
|
|
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 (
|
|
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:
|
|
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
|
-
} }),
|
|
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,12 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
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
|
-
|
|
46
|
+
exports.formatCurrencyWithSuffix = formatCurrencyWithSuffix;
|
|
47
|
+
const formatDate = (input, format) => {
|
|
39
48
|
if (!input) {
|
|
40
49
|
return '';
|
|
41
50
|
}
|
|
42
|
-
return
|
|
51
|
+
return (0, dayjs_1.default)(new Date(input)).format(format);
|
|
43
52
|
};
|
|
44
|
-
|
|
45
|
-
|
|
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' ?
|
|
50
|
-
const maxDigit = typeof digit === 'object' ?
|
|
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
|
-
|
|
60
|
-
|
|
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' ?
|
|
65
|
-
const maxDigit = typeof digit === 'object' ?
|
|
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
|
-
|
|
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) =>
|
|
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
|
-
|
|
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) =>
|
|
182
|
+
return ((value) => (0, dayjs_1.default)().day(value).format('dddd'));
|
|
173
183
|
default:
|
|
174
184
|
return (value) => String(value);
|
|
175
185
|
}
|
package/Insights/charts/index.js
CHANGED
|
@@ -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
|
-
|
|
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)
|