@headless-adminapp/fluent 0.0.17-alpha.52 → 0.0.17-alpha.53
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 +7 -11
- package/App/AppHeaderContianer.js +38 -42
- package/App/AppLogo.js +8 -12
- package/App/AppStringContext.js +9 -13
- package/App/AppUI.js +11 -15
- package/App/LayoutProvider.js +11 -15
- package/App/NavigationContainer.js +25 -29
- package/App/QuickActionItem.js +5 -9
- package/App/index.js +1 -5
- package/App/utils.js +1 -4
- package/CommandBar/Button.js +14 -17
- package/CommandBar/Divider.js +6 -9
- package/CommandBar/IconButton.js +13 -16
- package/CommandBar/Label.js +8 -11
- package/CommandBar/MenuButton.js +17 -20
- package/CommandBar/MenuItem.js +15 -18
- package/CommandBar/MenuItems.js +8 -11
- package/CommandBar/MenuList.js +9 -12
- package/CommandBar/Wrapper.js +7 -10
- package/CommandBar/index.js +13 -15
- package/DataForm/SectionControl.js +4 -7
- package/DataGrid/ActionCell.js +11 -14
- package/DataGrid/CommandContainer.js +6 -10
- package/DataGrid/CustomizeColumns/AddColumns.js +34 -37
- package/DataGrid/CustomizeColumns/ColumnItem.js +19 -23
- package/DataGrid/CustomizeColumns/CustomizeColumns.js +36 -42
- package/DataGrid/CustomizeColumns/index.js +1 -5
- package/DataGrid/FormSubgridCommandContainer.js +13 -17
- package/DataGrid/FormSubgridViewSelector.js +18 -22
- package/DataGrid/GridColumnHeader/ConditionValueControl.js +14 -20
- package/DataGrid/GridColumnHeader/FilterForm.js +23 -27
- package/DataGrid/GridColumnHeader/OperatorSelect.js +13 -19
- package/DataGrid/GridColumnHeader/TableHeaderFilterCell.js +28 -32
- package/DataGrid/GridColumnHeader/index.js +1 -5
- package/DataGrid/GridColumnHeader/utils.js +2 -6
- package/DataGrid/GridHeaderContainer.js +4 -8
- package/DataGrid/GridHeaderDesktop.js +26 -30
- package/DataGrid/GridHeaderMobile.js +17 -21
- package/DataGrid/GridListContainer.js +39 -43
- package/DataGrid/GridPaginationContainer.js +12 -16
- package/DataGrid/GridTableContainer.js +74 -78
- package/DataGrid/TableCell/TableCellAction.js +11 -15
- package/DataGrid/TableCell/TableCellBase.js +4 -8
- package/DataGrid/TableCell/TableCellCheckbox.js +7 -10
- package/DataGrid/TableCell/TableCellChoice.js +11 -14
- package/DataGrid/TableCell/TableCellLink.d.ts +1 -1
- package/DataGrid/TableCell/TableCellLink.js +13 -12
- package/DataGrid/TableCell/TableCellText.js +7 -10
- package/DataGrid/TableCell/index.js +4 -20
- package/DataGrid/index.js +4 -11
- package/DataGrid/types.js +1 -2
- package/DataGrid/useTableColumns.js +139 -90
- package/DataGrid/utils.js +1 -5
- package/DialogContainer/AlertDialog.js +5 -8
- package/DialogContainer/ConfirmDialog.js +6 -9
- package/DialogContainer/DialogContainer.js +14 -18
- package/DialogContainer/ErrorDialog.js +9 -12
- package/DialogContainer/PromptDialog.js +30 -57
- package/DialogContainer/index.js +1 -5
- package/Insights/CommandBarContainer.js +11 -14
- package/Insights/FilterBarContainer.js +17 -20
- package/Insights/Grid.js +9 -13
- package/Insights/InsightsContainer.js +19 -22
- package/Insights/WidgetChartContainer.js +30 -34
- package/Insights/WidgetDataGridContainer.js +32 -35
- package/Insights/WidgetTableContainer.js +24 -28
- package/Insights/WidgetTileContainer.js +12 -16
- package/Insights/WidgetTitleBar.js +9 -15
- package/Insights/Widgets.js +25 -28
- package/Insights/charts/AreaChart.js +12 -15
- package/Insights/charts/BarChart.js +12 -15
- package/Insights/charts/ComposedChart.js +12 -15
- package/Insights/charts/CustomTooltipContent.js +8 -12
- package/Insights/charts/GaugeChart.js +3 -6
- package/Insights/charts/LineChart.js +12 -15
- package/Insights/charts/OhlcChart.js +36 -41
- package/Insights/charts/PieChart.js +23 -26
- package/Insights/charts/RadarChart.js +16 -19
- package/Insights/charts/ScatterChart.js +23 -26
- package/Insights/charts/constants.js +1 -4
- package/Insights/charts/formatters.js +17 -29
- package/Insights/charts/index.js +1 -2
- package/Insights/charts/renderers.js +25 -36
- package/Insights/hooks/useQueriesData.js +19 -25
- package/Insights/hooks/useWidgetDetail.js +13 -16
- package/OverflowCommandBar/OverflowCommandBar.js +12 -19
- package/OverflowCommandBar/OverflowMenu.js +16 -20
- package/OverflowCommandBar/OverflowMenuDivider.js +6 -10
- package/OverflowCommandBar/index.js +3 -9
- package/OverflowCommandBar/render.js +9 -15
- package/OverflowCommandBar/utils.js +1 -4
- package/PageBoard/BoardColumn.js +5 -8
- package/PageBoard/BoardColumnCard.js +12 -15
- package/PageBoard/BoardColumnUI.js +34 -38
- package/PageBoard/BoardingColumnCardLoading.js +10 -13
- package/PageBoard/Header.js +16 -20
- package/PageBoard/PageBoard.d.ts +1 -1
- package/PageBoard/PageBoard.js +26 -29
- package/PageBoard/index.js +1 -5
- package/PageEntityForm/CommandContainer.js +21 -25
- package/PageEntityForm/FormTabRelated.js +17 -20
- package/PageEntityForm/PageEntityForm.js +16 -20
- package/PageEntityForm/PageEntityFormDesktopContainer.js +68 -72
- package/PageEntityForm/PageEntityFormStringContext.js +5 -9
- package/PageEntityForm/ProcessFlow.js +21 -24
- package/PageEntityForm/RecordCard.js +21 -24
- package/PageEntityForm/RecordCardLoading.js +10 -13
- package/PageEntityForm/RecordSetNavigatorContainer.js +30 -34
- package/PageEntityForm/RelatedViewSelector.js +28 -31
- package/PageEntityForm/SectionContainer.js +25 -28
- package/PageEntityForm/StandardControl.d.ts +3 -3
- package/PageEntityForm/StandardControl.js +74 -81
- package/PageEntityForm/SubgridControl.js +20 -23
- package/PageEntityForm/index.js +1 -5
- package/PageEntityView/FormSubgridContainer.js +22 -26
- package/PageEntityView/PageEntityView.js +15 -19
- package/PageEntityView/PageEntityViewDesktopContainer.js +9 -13
- package/PageEntityView/PageEntityViewDesktopFrame.js +17 -21
- package/PageEntityView/PageEntityViewMobileContainer.js +9 -13
- package/PageEntityView/PageEntityViewStringContext.js +5 -9
- package/PageEntityView/index.js +1 -5
- package/PageInsights/PageInsights.js +9 -13
- package/PageInsights/index.js +1 -6
- package/ProgressIndicatorContainer/index.js +10 -14
- package/ToastNotificationContainer/index.js +14 -18
- package/componentStore.js +2 -5
- package/components/BodyLoading.js +7 -11
- package/components/DialogLogin.js +5 -8
- package/components/LoginForm.js +21 -47
- package/components/PageBroken.js +5 -8
- package/components/PageLoading.js +5 -8
- package/components/PageLogin.js +14 -17
- package/form/FormControl.js +39 -44
- package/form/FormControlLoading.js +4 -8
- package/form/controls/AttachmentControl.js +56 -60
- package/form/controls/AttachmentsControl.js +15 -19
- package/form/controls/CurrencyControl.js +10 -13
- package/form/controls/DateControl.js +18 -24
- package/form/controls/DateRangeControl.js +14 -20
- package/form/controls/DateTimeControl.js +39 -45
- package/form/controls/DecimalControl.js +8 -11
- package/form/controls/DurationControl.js +11 -15
- package/form/controls/EmailControl.js +7 -10
- package/form/controls/IntegerControl.js +4 -7
- package/form/controls/LookupControl.d.ts +1 -0
- package/form/controls/LookupControl.js +75 -38
- package/form/controls/MultiSelectControl.js +8 -11
- package/form/controls/MultiSelectLookupControl.js +40 -43
- package/form/controls/PasswordControl.js +8 -11
- package/form/controls/RichTextControl.js +5 -32
- package/form/controls/SelectControl.js +8 -11
- package/form/controls/SwitchControl.js +4 -7
- package/form/controls/TelephoneControl.js +7 -10
- package/form/controls/TextAreaControl.js +4 -7
- package/form/controls/TextControl.js +5 -8
- package/form/controls/UrlControl.js +7 -10
- package/form/controls/types.js +1 -2
- package/form/controls/useLookupData.js +14 -18
- package/form/layout/FormBody/FormBody.js +6 -10
- package/form/layout/FormBody/index.js +1 -17
- package/form/layout/FormSection/FormSection.js +18 -22
- package/form/layout/FormSection/FormSectionColumn.js +3 -7
- package/form/layout/FormSection/FormSectionLoading.js +1 -5
- package/form/layout/FormSection/index.js +1 -5
- package/form/layout/FormTab/FormTab.js +16 -20
- package/form/layout/FormTab/FormTabColumn.js +5 -9
- package/form/layout/FormTab/index.js +1 -5
- package/form/layout/TabContext.js +2 -5
- package/form/layout/index.js +3 -9
- package/form/types.js +1 -2
- package/package.json +3 -2
- package/types/index.js +1 -2
- package/utils/avatar.d.ts +2 -0
- package/utils/avatar.js +42 -0
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PieChart = PieChart;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
2
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
function PieChart({ dataset, chartInfo, }) {
|
|
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, }) {
|
|
11
8
|
var _a, _b;
|
|
12
9
|
const RADIAN = Math.PI / 180;
|
|
13
10
|
const renderCustomizedLabel = ({ cx, cy, midAngle, innerRadius, outerRadius, percent, }) => {
|
|
@@ -17,24 +14,24 @@ function PieChart({ dataset, chartInfo, }) {
|
|
|
17
14
|
if (percent < 0.05) {
|
|
18
15
|
return null;
|
|
19
16
|
}
|
|
20
|
-
return ((
|
|
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)}%` }));
|
|
21
18
|
};
|
|
22
19
|
const item = chartInfo.pie[0];
|
|
23
|
-
const nameFormatter =
|
|
24
|
-
const valueFormatter =
|
|
25
|
-
return ((
|
|
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) => {
|
|
26
23
|
var _a, _b;
|
|
27
|
-
return ((
|
|
24
|
+
return (_jsx(Cell, { fill: item.colorKey && entry[item.colorKey]
|
|
28
25
|
? entry[item.colorKey]
|
|
29
|
-
: ((_a = item.colors) !== null && _a !== void 0 ? _a :
|
|
30
|
-
}) }), chartInfo.showLegend && ((
|
|
31
|
-
fontSize:
|
|
32
|
-
fontFamily:
|
|
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,
|
|
33
30
|
overflow: 'auto',
|
|
34
31
|
top: 5,
|
|
35
32
|
bottom: 5,
|
|
36
|
-
} })), (
|
|
37
|
-
stroke:
|
|
33
|
+
} })), _jsx(Tooltip, { cursor: {
|
|
34
|
+
stroke: tokens.colorNeutralBackground6,
|
|
38
35
|
opacity: 0.5,
|
|
39
36
|
}, content: ({ payload }) => renderTooltipContent({
|
|
40
37
|
payload,
|
|
@@ -43,16 +40,16 @@ function PieChart({ dataset, chartInfo, }) {
|
|
|
43
40
|
}) })] }) }));
|
|
44
41
|
}
|
|
45
42
|
function renderTooltipContent({ payload, nameFormatter, valueFormatter, }) {
|
|
46
|
-
return ((
|
|
43
|
+
return (_jsx("div", { style: {
|
|
47
44
|
display: 'flex',
|
|
48
45
|
flexDirection: 'column',
|
|
49
|
-
boxShadow:
|
|
50
|
-
backgroundColor:
|
|
46
|
+
boxShadow: tokens.shadow16,
|
|
47
|
+
backgroundColor: tokens.colorNeutralBackground1,
|
|
51
48
|
padding: 8,
|
|
52
49
|
borderRadius: 4,
|
|
53
50
|
gap: 4,
|
|
54
|
-
}, children: (
|
|
55
|
-
color:
|
|
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,
|
|
56
53
|
marginLeft: 8,
|
|
57
|
-
}, children: nameFormatter(item.name) }), (
|
|
54
|
+
}, children: nameFormatter(item.name) }), _jsx("div", { style: { flex: 1, minWidth: 50 } }), _jsx(Caption1, { style: { color: tokens.colorNeutralForeground4 }, children: valueFormatter(item.value) })] }, index))) }) }));
|
|
58
55
|
}
|
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RadarChart = RadarChart;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
2
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
function RadarChart({ dataset, chartInfo, }) {
|
|
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, }) {
|
|
10
7
|
var _a, _b;
|
|
11
8
|
const data = dataset[0];
|
|
12
9
|
const radar = chartInfo.radar[0];
|
|
13
|
-
const nameFormatter =
|
|
14
|
-
const valueFormatter =
|
|
15
|
-
const tickFormatter =
|
|
16
|
-
return ((
|
|
17
|
-
stroke:
|
|
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,
|
|
18
15
|
opacity: 0.5,
|
|
19
16
|
}, content: ({ payload }) => renderTooltipContent({
|
|
20
17
|
payload,
|
|
@@ -24,16 +21,16 @@ function RadarChart({ dataset, chartInfo, }) {
|
|
|
24
21
|
}) })] }) }));
|
|
25
22
|
}
|
|
26
23
|
function renderTooltipContent({ payload, nameFormatter, valueFormatter, radar, }) {
|
|
27
|
-
return ((
|
|
24
|
+
return (_jsx("div", { style: {
|
|
28
25
|
display: 'flex',
|
|
29
26
|
flexDirection: 'column',
|
|
30
|
-
boxShadow:
|
|
31
|
-
backgroundColor:
|
|
27
|
+
boxShadow: tokens.shadow16,
|
|
28
|
+
backgroundColor: tokens.colorNeutralBackground1,
|
|
32
29
|
padding: 8,
|
|
33
30
|
borderRadius: 4,
|
|
34
31
|
gap: 4,
|
|
35
|
-
}, children: (
|
|
36
|
-
color:
|
|
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,
|
|
37
34
|
marginLeft: 8,
|
|
38
|
-
}, children: nameFormatter(item.payload[radar.nameKey]) }), (
|
|
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))) }) }));
|
|
39
36
|
}
|
|
@@ -1,23 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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) => {
|
|
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) => {
|
|
13
10
|
var _a, _b;
|
|
14
|
-
return ((
|
|
15
|
-
}), (
|
|
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) => {
|
|
16
13
|
var _a;
|
|
17
14
|
if (!props.active || !((_a = props.payload) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
18
|
-
return (
|
|
15
|
+
return _jsx(_Fragment, {});
|
|
19
16
|
}
|
|
20
|
-
return ((
|
|
17
|
+
return (_jsx(ScatterTooltipContent, { active: props.active, payload: props.payload, chartInfo: chartInfo, dataset: dataset }));
|
|
21
18
|
} })] }) }));
|
|
22
19
|
}
|
|
23
20
|
const ScatterTooltipContent = (props) => {
|
|
@@ -31,7 +28,7 @@ const ScatterTooltipContent = (props) => {
|
|
|
31
28
|
const xValue = xPayload.value;
|
|
32
29
|
const yValue = yPayload.value;
|
|
33
30
|
const findKey = xValue + ':' + yValue;
|
|
34
|
-
const items =
|
|
31
|
+
const items = useMemo(() => {
|
|
35
32
|
var _a, _b, _c, _d;
|
|
36
33
|
const _items = [];
|
|
37
34
|
if (!xAxis.dataKey || !yAxis.dataKey || !zAxis.dataKey) {
|
|
@@ -54,7 +51,7 @@ const ScatterTooltipContent = (props) => {
|
|
|
54
51
|
_items.push({
|
|
55
52
|
name: scatter.dataLabel,
|
|
56
53
|
value: zValue,
|
|
57
|
-
color: (_d = scatter.color) !== null && _d !== void 0 ? _d :
|
|
54
|
+
color: (_d = scatter.color) !== null && _d !== void 0 ? _d : defaultColors[i],
|
|
58
55
|
});
|
|
59
56
|
}
|
|
60
57
|
return _items;
|
|
@@ -66,21 +63,21 @@ const ScatterTooltipContent = (props) => {
|
|
|
66
63
|
yAxis.dataKey,
|
|
67
64
|
zAxis.dataKey,
|
|
68
65
|
]);
|
|
69
|
-
const xAxisFormatter =
|
|
70
|
-
const yAxisFormatter =
|
|
71
|
-
const zAxisFormatter =
|
|
72
|
-
return ((
|
|
66
|
+
const xAxisFormatter = createLongAxisFormatter(xAxis.tick);
|
|
67
|
+
const yAxisFormatter = createLongAxisFormatter(yAxis.tick);
|
|
68
|
+
const zAxisFormatter = createLongAxisFormatter(zAxis.tick);
|
|
69
|
+
return (_jsx("div", { style: {
|
|
73
70
|
display: 'flex',
|
|
74
71
|
flexDirection: 'column',
|
|
75
|
-
boxShadow:
|
|
76
|
-
backgroundColor:
|
|
72
|
+
boxShadow: tokens.shadow16,
|
|
73
|
+
backgroundColor: tokens.colorNeutralBackground1,
|
|
77
74
|
padding: 8,
|
|
78
75
|
borderRadius: 4,
|
|
79
76
|
gap: 4,
|
|
80
|
-
}, children: (
|
|
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: {
|
|
81
78
|
width: 8,
|
|
82
79
|
height: 8,
|
|
83
80
|
background: item.color,
|
|
84
81
|
borderRadius: 4,
|
|
85
|
-
} }), (
|
|
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)))] }) }));
|
|
86
83
|
};
|
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
|
|
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"));
|
|
1
|
+
import dayjs from 'dayjs';
|
|
10
2
|
function extractNumberInfo(value) {
|
|
11
3
|
const suffix = ['K', 'M', 'B', 'T'];
|
|
12
4
|
if (value === null || value === undefined) {
|
|
@@ -28,7 +20,7 @@ function extractNumberInfo(value) {
|
|
|
28
20
|
};
|
|
29
21
|
}
|
|
30
22
|
}
|
|
31
|
-
const formatCurrencyWithSuffix = (input, digit = 2) => {
|
|
23
|
+
export const formatCurrencyWithSuffix = (input, digit = 2) => {
|
|
32
24
|
const suffix = ['K', 'M', 'B', 'T'];
|
|
33
25
|
if (input === null || input === undefined) {
|
|
34
26
|
return '';
|
|
@@ -37,21 +29,19 @@ const formatCurrencyWithSuffix = (input, digit = 2) => {
|
|
|
37
29
|
const sign = Math.sign(input);
|
|
38
30
|
if (abs >= 1000) {
|
|
39
31
|
const i = Math.floor(Math.log(abs) / Math.log(1000));
|
|
40
|
-
return (
|
|
32
|
+
return (formatCurrency(sign * (abs / Math.pow(1000, i)), digit) + suffix[i - 1]);
|
|
41
33
|
}
|
|
42
34
|
else {
|
|
43
|
-
return
|
|
35
|
+
return formatCurrency(input, digit);
|
|
44
36
|
}
|
|
45
37
|
};
|
|
46
|
-
|
|
47
|
-
const formatDate = (input, format) => {
|
|
38
|
+
export const formatDate = (input, format) => {
|
|
48
39
|
if (!input) {
|
|
49
40
|
return '';
|
|
50
41
|
}
|
|
51
|
-
return (
|
|
42
|
+
return dayjs(new Date(input)).format(format);
|
|
52
43
|
};
|
|
53
|
-
|
|
54
|
-
const formatCurrency = (input, digit = 2) => {
|
|
44
|
+
export const formatCurrency = (input, digit = 2) => {
|
|
55
45
|
var _a, _b;
|
|
56
46
|
if (input === null || input === undefined) {
|
|
57
47
|
return '';
|
|
@@ -66,8 +56,7 @@ const formatCurrency = (input, digit = 2) => {
|
|
|
66
56
|
});
|
|
67
57
|
return formatter.format(input || 0);
|
|
68
58
|
};
|
|
69
|
-
|
|
70
|
-
const formatNumber = (input, digit = 2) => {
|
|
59
|
+
export const formatNumber = (input, digit = 2) => {
|
|
71
60
|
var _a, _b;
|
|
72
61
|
if (input === null || input === undefined) {
|
|
73
62
|
return '';
|
|
@@ -80,7 +69,6 @@ const formatNumber = (input, digit = 2) => {
|
|
|
80
69
|
});
|
|
81
70
|
return formatter.format(input || 0);
|
|
82
71
|
};
|
|
83
|
-
exports.formatNumber = formatNumber;
|
|
84
72
|
const timeAxisFormats = {
|
|
85
73
|
minute: 'mm',
|
|
86
74
|
hour: 'HH',
|
|
@@ -114,11 +102,11 @@ const timeLongAxisFormats = {
|
|
|
114
102
|
// };
|
|
115
103
|
function createTimeAxisFormatter(format) {
|
|
116
104
|
const formatString = timeAxisFormats[format];
|
|
117
|
-
return (value) =>
|
|
105
|
+
return (value) => formatDate(new Date(value), formatString);
|
|
118
106
|
}
|
|
119
107
|
function createFullTimeAxisFormatter(format) {
|
|
120
108
|
const formatString = timeLongAxisFormats[format];
|
|
121
|
-
return (value) =>
|
|
109
|
+
return (value) => formatDate(new Date(value), formatString);
|
|
122
110
|
}
|
|
123
111
|
function createNumberAxisFormatter(options) {
|
|
124
112
|
return (value) => {
|
|
@@ -126,12 +114,12 @@ function createNumberAxisFormatter(options) {
|
|
|
126
114
|
if (!info) {
|
|
127
115
|
return '';
|
|
128
116
|
}
|
|
129
|
-
return
|
|
117
|
+
return formatNumber(info.value, options) + info.symbol;
|
|
130
118
|
};
|
|
131
119
|
}
|
|
132
120
|
function createLongNumberAxisFormatter(options) {
|
|
133
121
|
return (value) => {
|
|
134
|
-
return
|
|
122
|
+
return formatNumber(value, options);
|
|
135
123
|
};
|
|
136
124
|
}
|
|
137
125
|
function createCurrencyAxisFormatter() {
|
|
@@ -140,7 +128,7 @@ function createCurrencyAxisFormatter() {
|
|
|
140
128
|
if (!info) {
|
|
141
129
|
return '';
|
|
142
130
|
}
|
|
143
|
-
return
|
|
131
|
+
return formatCurrency(info.value, 0) + info.symbol;
|
|
144
132
|
};
|
|
145
133
|
}
|
|
146
134
|
function createCategoryAxisFormatter(options) {
|
|
@@ -154,7 +142,7 @@ function createCategoryAxisFormatter(options) {
|
|
|
154
142
|
return typeof value === 'string' ? value : String(value);
|
|
155
143
|
};
|
|
156
144
|
}
|
|
157
|
-
function createAxisFormatter(tick) {
|
|
145
|
+
export function createAxisFormatter(tick) {
|
|
158
146
|
switch (tick.type) {
|
|
159
147
|
case 'time':
|
|
160
148
|
return createTimeAxisFormatter(tick.format);
|
|
@@ -165,12 +153,12 @@ function createAxisFormatter(tick) {
|
|
|
165
153
|
case 'category':
|
|
166
154
|
return createCategoryAxisFormatter(tick.options);
|
|
167
155
|
case 'weekday':
|
|
168
|
-
return (value) => (
|
|
156
|
+
return (value) => dayjs().day(value).format('ddd');
|
|
169
157
|
default:
|
|
170
158
|
return (value) => String(value);
|
|
171
159
|
}
|
|
172
160
|
}
|
|
173
|
-
function createLongAxisFormatter(tick) {
|
|
161
|
+
export function createLongAxisFormatter(tick) {
|
|
174
162
|
switch (tick.type) {
|
|
175
163
|
case 'time':
|
|
176
164
|
return createFullTimeAxisFormatter(tick.format);
|
|
@@ -181,7 +169,7 @@ function createLongAxisFormatter(tick) {
|
|
|
181
169
|
case 'category':
|
|
182
170
|
return createCategoryAxisFormatter(tick.options);
|
|
183
171
|
case 'weekday':
|
|
184
|
-
return ((value) => (
|
|
172
|
+
return ((value) => dayjs().day(value).format('dddd'));
|
|
185
173
|
default:
|
|
186
174
|
return (value) => String(value);
|
|
187
175
|
}
|
package/Insights/charts/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/* eslint-disable unused-imports/no-unused-vars */
|
|
3
2
|
// TODO: Remove eslint disable condition after finishing the implementation
|
|
4
|
-
|
|
3
|
+
export {};
|
|
5
4
|
// number format - decimal or currency
|
|
6
5
|
// number format - number of decimals
|
|
7
6
|
// number format - group it (K, M, B, T)
|
|
@@ -1,65 +1,54 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
exports.renderArea = renderArea;
|
|
9
|
-
exports.renderAreas = renderAreas;
|
|
10
|
-
exports.renderBar = renderBar;
|
|
11
|
-
exports.renderBars = renderBars;
|
|
12
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
13
|
-
const react_components_1 = require("@fluentui/react-components");
|
|
14
|
-
const recharts_1 = require("recharts");
|
|
15
|
-
const formatters_1 = require("./formatters");
|
|
16
|
-
function renderXAxis(axis, forceCategory = false) {
|
|
17
|
-
const xAxisFormatter = (0, formatters_1.createAxisFormatter)(axis.tick);
|
|
18
|
-
return ((0, jsx_runtime_1.jsx)(recharts_1.XAxis, { dataKey: axis.dataKey, name: axis.name, tickFormatter: xAxisFormatter, tickLine: false, minTickGap: 10,
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { tokens } from '@fluentui/react-components';
|
|
3
|
+
import { Area, Bar, CartesianGrid, Line, XAxis as XAxisInternal, YAxis as YAxisInternal, } from 'recharts';
|
|
4
|
+
import { createAxisFormatter } from './formatters';
|
|
5
|
+
export function renderXAxis(axis, forceCategory = false) {
|
|
6
|
+
const xAxisFormatter = createAxisFormatter(axis.tick);
|
|
7
|
+
return (_jsx(XAxisInternal, { dataKey: axis.dataKey, name: axis.name, tickFormatter: xAxisFormatter, tickLine: false, minTickGap: 10,
|
|
19
8
|
// padding={{ left: 10, right: 10 }}
|
|
20
9
|
padding: "gap", axisLine: {
|
|
21
|
-
stroke:
|
|
22
|
-
}, fontSize:
|
|
23
|
-
fill:
|
|
10
|
+
stroke: tokens.colorNeutralBackground6,
|
|
11
|
+
}, fontSize: tokens.fontSizeBase100, tick: {
|
|
12
|
+
fill: tokens.colorNeutralForeground1,
|
|
24
13
|
opacity: 0.5,
|
|
25
14
|
}, scale: !forceCategory && axis.tick.type === 'time' ? 'time' : 'auto', type: forceCategory || axis.tick.type === 'category' ? 'category' : 'number', domain: axis.domain, height: 16 }));
|
|
26
15
|
}
|
|
27
|
-
function renderYAxis(axis) {
|
|
28
|
-
const yAxisFormatter =
|
|
29
|
-
return ((
|
|
30
|
-
fill:
|
|
16
|
+
export function renderYAxis(axis) {
|
|
17
|
+
const yAxisFormatter = createAxisFormatter(axis.tick);
|
|
18
|
+
return (_jsx(YAxisInternal, { yAxisId: "left", dataKey: axis.dataKey, tickFormatter: yAxisFormatter, name: axis.name, tickLine: false, fontSize: tokens.fontSizeBase100, axisLine: false, tickMargin: 0, minTickGap: 0, accentHeight: 0, width: 40, scale: "auto", type: "number", domain: axis.domain, tick: {
|
|
19
|
+
fill: tokens.colorNeutralForeground1,
|
|
31
20
|
opacity: 0.5,
|
|
32
21
|
} }));
|
|
33
22
|
}
|
|
34
|
-
function renderGrid() {
|
|
35
|
-
return ((
|
|
23
|
+
export function renderGrid() {
|
|
24
|
+
return (_jsx(CartesianGrid, { strokeDasharray: "8 4", vertical: false, strokeWidth: 0.2, stroke: tokens.colorNeutralBackground6 }));
|
|
36
25
|
}
|
|
37
26
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
38
|
-
function renderLine(line, dataset) {
|
|
27
|
+
export function renderLine(line, dataset) {
|
|
39
28
|
var _a;
|
|
40
|
-
return ((
|
|
29
|
+
return (_jsx(Line, { yAxisId: 'left', type: line.curveType, data: dataset[(_a = line.dataIndex) !== null && _a !== void 0 ? _a : 0], dataKey: line.dataKey, name: line.dataLabel, stroke: line.color, strokeWidth: 2, dot: false, activeDot: {
|
|
41
30
|
stroke: line.color,
|
|
42
31
|
} }, line.dataKey));
|
|
43
32
|
}
|
|
44
33
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
45
|
-
function renderLines(lines, dataset) {
|
|
34
|
+
export function renderLines(lines, dataset) {
|
|
46
35
|
return lines.map((line) => renderLine(line, dataset));
|
|
47
36
|
}
|
|
48
37
|
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
49
|
-
function renderArea(area, dataset) {
|
|
50
|
-
return ((
|
|
38
|
+
export function renderArea(area, dataset) {
|
|
39
|
+
return (_jsx(Area, { yAxisId: 'left', type: area.curveType, dataKey: area.dataKey, name: area.dataLabel, stroke: area.color, fill: area.color, strokeWidth: 1, dot: false, activeDot: {
|
|
51
40
|
stroke: area.color,
|
|
52
41
|
} }, area.dataKey));
|
|
53
42
|
}
|
|
54
43
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
55
|
-
function renderAreas(areas, dataset) {
|
|
44
|
+
export function renderAreas(areas, dataset) {
|
|
56
45
|
return areas.map((area) => renderArea(area, dataset));
|
|
57
46
|
}
|
|
58
47
|
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
59
|
-
function renderBar(bar, dataset) {
|
|
60
|
-
return ((
|
|
48
|
+
export function renderBar(bar, dataset) {
|
|
49
|
+
return (_jsx(Bar, { yAxisId: 'left', type: bar.curveType, dataKey: bar.dataKey, name: bar.dataLabel, stroke: bar.color, fill: bar.color, strokeWidth: 1, stackId: bar.stackId }, bar.dataKey));
|
|
61
50
|
}
|
|
62
51
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
63
|
-
function renderBars(bars, dataset) {
|
|
52
|
+
export function renderBars(bars, dataset) {
|
|
64
53
|
return bars.map((bar) => renderBar(bar, dataset));
|
|
65
54
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -8,24 +7,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
8
|
});
|
|
10
9
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
function useQueriesData(queries) {
|
|
25
|
-
const dataService = (0, transport_1.useDataService)();
|
|
26
|
-
const insightsState = (0, mutable_1.useContextSelector)(insights_1.InsightsContext, (state) => state);
|
|
27
|
-
const widgetState = (0, mutable_1.useContextSelector)(widget_1.WidgetContext, (state) => state);
|
|
28
|
-
const resolvedQueries = (0, react_1.useMemo)(() => {
|
|
10
|
+
import { InsightsContext } from '@headless-adminapp/app/insights';
|
|
11
|
+
import { useContextSelector } from '@headless-adminapp/app/mutable';
|
|
12
|
+
import { useDataService } from '@headless-adminapp/app/transport';
|
|
13
|
+
import { WidgetContext } from '@headless-adminapp/app/widget';
|
|
14
|
+
import { AggregateAttributeFunction, } from '@headless-adminapp/core/transport';
|
|
15
|
+
import { useQueries } from '@tanstack/react-query';
|
|
16
|
+
import dayjs from 'dayjs';
|
|
17
|
+
import { useMemo } from 'react';
|
|
18
|
+
export function useQueriesData(queries) {
|
|
19
|
+
const dataService = useDataService();
|
|
20
|
+
const insightsState = useContextSelector(InsightsContext, (state) => state);
|
|
21
|
+
const widgetState = useContextSelector(WidgetContext, (state) => state);
|
|
22
|
+
const resolvedQueries = useMemo(() => {
|
|
29
23
|
return queries.map((item) => {
|
|
30
24
|
if (typeof item === 'function') {
|
|
31
25
|
console.log('temp.item', item, item(insightsState, widgetState));
|
|
@@ -34,7 +28,7 @@ function useQueriesData(queries) {
|
|
|
34
28
|
return item;
|
|
35
29
|
});
|
|
36
30
|
}, [queries, insightsState, widgetState]);
|
|
37
|
-
const result =
|
|
31
|
+
const result = useQueries({
|
|
38
32
|
queries: resolvedQueries.map((item) => ({
|
|
39
33
|
queryKey: ['insights', 'aggregate', item],
|
|
40
34
|
queryFn: () => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -57,7 +51,7 @@ function useQueriesData(queries) {
|
|
|
57
51
|
const isPending = result.some((r) => r.isPending);
|
|
58
52
|
const isFetching = result.some((r) => r.isFetching);
|
|
59
53
|
const refetch = () => result.map((r) => r.refetch());
|
|
60
|
-
const data =
|
|
54
|
+
const data = useMemo(() => {
|
|
61
55
|
return result.map((r) => r.data);
|
|
62
56
|
}, [result]);
|
|
63
57
|
return { isPending, isFetching, dataset: data, refetch };
|
|
@@ -78,19 +72,19 @@ function getAttributeValueTransformer(attribute) {
|
|
|
78
72
|
let transformer = undefined;
|
|
79
73
|
if (attribute.type === 'date') {
|
|
80
74
|
if (attribute.format) {
|
|
81
|
-
transformer = (value) => (
|
|
75
|
+
transformer = (value) => dayjs(value, attribute.format)
|
|
82
76
|
.toDate()
|
|
83
77
|
.getTime();
|
|
84
78
|
}
|
|
85
79
|
else if (attribute.value.type === 'function') {
|
|
86
|
-
if (attribute.value.value ===
|
|
87
|
-
transformer = (value) => (
|
|
80
|
+
if (attribute.value.value === AggregateAttributeFunction.YearMonth) {
|
|
81
|
+
transformer = (value) => dayjs(value, 'YYYY-MM')
|
|
88
82
|
.toDate()
|
|
89
83
|
.getTime();
|
|
90
84
|
}
|
|
91
85
|
}
|
|
92
86
|
else {
|
|
93
|
-
transformer = (value) => (
|
|
87
|
+
transformer = (value) => dayjs(value)
|
|
94
88
|
.toDate()
|
|
95
89
|
.getTime();
|
|
96
90
|
}
|
|
@@ -1,24 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
const useQueriesData_1 = require("./useQueriesData");
|
|
10
|
-
function useWidgetDetail(widgetContent) {
|
|
11
|
-
const widgetState = (0, mutable_1.useContextSelector)(widget_1.WidgetContext, (state) => state);
|
|
1
|
+
import { useCommands } from '@headless-adminapp/app/command';
|
|
2
|
+
import { useBaseCommandHandlerContext } from '@headless-adminapp/app/command/hooks';
|
|
3
|
+
import { useContextSelector, useContextSetValue, } from '@headless-adminapp/app/mutable';
|
|
4
|
+
import { WidgetContext } from '@headless-adminapp/app/widget';
|
|
5
|
+
import { useCallback } from 'react';
|
|
6
|
+
import { useQueriesData } from './useQueriesData';
|
|
7
|
+
export function useWidgetDetail(widgetContent) {
|
|
8
|
+
const widgetState = useContextSelector(WidgetContext, (state) => state);
|
|
12
9
|
const widget = widgetState.widget;
|
|
13
|
-
const widgetSetValue =
|
|
14
|
-
const { dataset, isPending, isFetching, refetch } =
|
|
15
|
-
const baseCommandHandleContext =
|
|
16
|
-
const updateStateValue =
|
|
10
|
+
const widgetSetValue = useContextSetValue(WidgetContext);
|
|
11
|
+
const { dataset, isPending, isFetching, refetch } = useQueriesData(widget.dataset);
|
|
12
|
+
const baseCommandHandleContext = useBaseCommandHandlerContext();
|
|
13
|
+
const updateStateValue = useCallback(
|
|
17
14
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
18
15
|
(value) => {
|
|
19
16
|
widgetSetValue((state) => (Object.assign(Object.assign({}, state), { data: Object.assign(Object.assign({}, state.data), value) })));
|
|
20
17
|
}, [widgetSetValue]);
|
|
21
|
-
const transformedCommands =
|
|
18
|
+
const transformedCommands = useCommands([widgetContent.commands], Object.assign(Object.assign({}, baseCommandHandleContext), { primaryControl: {
|
|
22
19
|
refresh: refetch,
|
|
23
20
|
updateStateValue,
|
|
24
21
|
} }));
|