@headless-adminapp/fluent 0.0.17-alpha.53 → 0.0.17-alpha.56
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.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,46 +1,58 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WidgetDataGridContainer = WidgetDataGridContainer;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
const command_1 = require("@headless-adminapp/app/command");
|
|
7
|
+
const hooks_1 = require("@headless-adminapp/app/command/hooks");
|
|
8
|
+
const DataGridProvider_1 = require("@headless-adminapp/app/datagrid/DataGridProvider");
|
|
9
|
+
const hooks_2 = require("@headless-adminapp/app/datagrid/hooks");
|
|
10
|
+
const hooks_3 = require("@headless-adminapp/app/metadata/hooks");
|
|
11
|
+
const mutable_1 = require("@headless-adminapp/app/mutable");
|
|
12
|
+
const widget_1 = require("@headless-adminapp/app/widget");
|
|
13
|
+
const react_1 = require("react");
|
|
14
|
+
const DataGrid_1 = require("../DataGrid");
|
|
15
|
+
const WidgetTitleBar_1 = require("./WidgetTitleBar");
|
|
16
|
+
function WidgetDataGridContainer({ content, }) {
|
|
14
17
|
const logicalName = content.logicalName;
|
|
15
|
-
const schema = useSchema(logicalName);
|
|
16
|
-
const { view } = useExperienceView(logicalName);
|
|
18
|
+
const schema = (0, hooks_3.useSchema)(logicalName);
|
|
19
|
+
const { view } = (0, hooks_3.useExperienceView)(logicalName);
|
|
17
20
|
if (!view) {
|
|
18
|
-
return
|
|
21
|
+
return (0, jsx_runtime_1.jsx)("div", { children: "Loading..." });
|
|
19
22
|
}
|
|
20
23
|
if (!schema) {
|
|
21
|
-
return
|
|
24
|
+
return (0, jsx_runtime_1.jsx)("div", { children: "Schema not found" });
|
|
22
25
|
}
|
|
23
|
-
return (
|
|
26
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
24
27
|
display: 'flex',
|
|
25
28
|
flex: 1,
|
|
26
|
-
background: tokens.colorNeutralBackground1,
|
|
27
|
-
boxShadow: tokens.shadow2,
|
|
28
|
-
borderRadius: tokens.borderRadiusMedium,
|
|
29
|
+
background: react_components_1.tokens.colorNeutralBackground1,
|
|
30
|
+
boxShadow: react_components_1.tokens.shadow2,
|
|
31
|
+
borderRadius: react_components_1.tokens.borderRadiusMedium,
|
|
29
32
|
// padding: tokens.spacingHorizontalM,
|
|
30
33
|
flexDirection: 'column',
|
|
31
|
-
}, children:
|
|
34
|
+
}, children: (0, jsx_runtime_1.jsx)(DataGridProvider_1.DataGridProvider, { schema: schema, view: view, views: [], onChangeView: () => { }, commands: [], allowViewSelection: false, maxRecords: content.maxRecords, extraFilter: content.filter, children: (0, jsx_runtime_1.jsx)(FormSubgridContainer, { content: content }) }) }));
|
|
32
35
|
}
|
|
33
36
|
const FormSubgridContainer = ({ content, }) => {
|
|
34
|
-
const baseCommandHandleContext = useBaseCommandHandlerContext();
|
|
35
|
-
const primaryControl = useGridControlContext();
|
|
36
|
-
const widgetSetValue = useContextSetValue(WidgetContext);
|
|
37
|
-
const updateStateValue = useCallback(
|
|
37
|
+
const baseCommandHandleContext = (0, hooks_1.useBaseCommandHandlerContext)();
|
|
38
|
+
const primaryControl = (0, hooks_2.useGridControlContext)();
|
|
39
|
+
const widgetSetValue = (0, mutable_1.useContextSetValue)(widget_1.WidgetContext);
|
|
40
|
+
const updateStateValue = (0, react_1.useCallback)(
|
|
38
41
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
39
42
|
(value) => {
|
|
40
|
-
widgetSetValue((state) => (
|
|
43
|
+
widgetSetValue((state) => ({
|
|
44
|
+
...state,
|
|
45
|
+
data: { ...state.data, ...value },
|
|
46
|
+
}));
|
|
41
47
|
}, [widgetSetValue]);
|
|
42
|
-
const transformedCommands = useCommands([content.commands],
|
|
43
|
-
|
|
48
|
+
const transformedCommands = (0, command_1.useCommands)([content.commands], {
|
|
49
|
+
...baseCommandHandleContext,
|
|
50
|
+
primaryControl: {
|
|
51
|
+
...primaryControl,
|
|
52
|
+
updateStateValue,
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
44
56
|
display: 'flex',
|
|
45
57
|
flex: 1,
|
|
46
58
|
flexDirection: 'column',
|
|
@@ -48,21 +60,21 @@ const FormSubgridContainer = ({ content, }) => {
|
|
|
48
60
|
// backgroundColor: tokens.colorNeutralBackground2,
|
|
49
61
|
// padding: 2,
|
|
50
62
|
overflow: 'hidden',
|
|
51
|
-
}, children: [
|
|
63
|
+
}, children: [(0, jsx_runtime_1.jsx)(WidgetTitleBar_1.WidgetTitleBar, { title: "Recent transactions", commands: transformedCommands }), (0, jsx_runtime_1.jsx)("div", { style: {
|
|
52
64
|
// gap: 12,
|
|
53
65
|
flex: 1,
|
|
54
66
|
display: 'flex',
|
|
55
67
|
flexDirection: 'column',
|
|
56
68
|
// overflow: 'hidden',
|
|
57
|
-
}, children:
|
|
69
|
+
}, children: (0, jsx_runtime_1.jsx)("div", { style: {
|
|
58
70
|
flex: 1,
|
|
59
71
|
display: 'flex',
|
|
60
72
|
flexDirection: 'column',
|
|
61
73
|
marginTop: 8,
|
|
62
|
-
}, children:
|
|
74
|
+
}, children: (0, jsx_runtime_1.jsx)("div", { style: {
|
|
63
75
|
gap: 16,
|
|
64
76
|
display: 'flex',
|
|
65
77
|
flexDirection: 'column',
|
|
66
78
|
flex: 1,
|
|
67
|
-
}, children:
|
|
79
|
+
}, children: (0, jsx_runtime_1.jsx)("div", { style: { flex: 1, display: 'flex', minHeight: 300 }, children: (0, jsx_runtime_1.jsx)(DataGrid_1.GridTableContainer, { disableColumnSort: true, disableColumnFilter: true, disableSelection: true, disableContextMenu: true }) }) }) }) })] }));
|
|
68
80
|
};
|
|
@@ -1,54 +1,57 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WidgetTableContainer = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
const utils_1 = require("@headless-adminapp/app/utils");
|
|
7
|
+
const BodyLoading_1 = require("../components/BodyLoading");
|
|
8
|
+
const useWidgetDetail_1 = require("./hooks/useWidgetDetail");
|
|
9
|
+
const WidgetTitleBar_1 = require("./WidgetTitleBar");
|
|
10
|
+
const WidgetTableContainer = ({ content, }) => {
|
|
11
|
+
const { transformedCommands, dataset, isPending, isFetching, widget } = (0, useWidgetDetail_1.useWidgetDetail)(content);
|
|
9
12
|
const info = content.table;
|
|
10
13
|
const data = dataset[0];
|
|
11
|
-
return (
|
|
14
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
12
15
|
display: 'flex',
|
|
13
16
|
flex: 1,
|
|
14
|
-
background: tokens.colorNeutralBackground1,
|
|
15
|
-
boxShadow: tokens.shadow2,
|
|
16
|
-
borderRadius: tokens.borderRadiusMedium,
|
|
17
|
+
background: react_components_1.tokens.colorNeutralBackground1,
|
|
18
|
+
boxShadow: react_components_1.tokens.shadow2,
|
|
19
|
+
borderRadius: react_components_1.tokens.borderRadiusMedium,
|
|
17
20
|
flexDirection: 'column',
|
|
18
21
|
overflow: 'hidden',
|
|
19
|
-
}, children: [
|
|
22
|
+
}, children: [(0, jsx_runtime_1.jsx)(WidgetTitleBar_1.WidgetTitleBar, { title: widget.title, commands: transformedCommands }), (0, jsx_runtime_1.jsxs)("div", { style: { flex: 1, position: 'relative', overflow: 'auto' }, children: [!isPending && ((0, jsx_runtime_1.jsxs)(react_components_1.Table, { style: {
|
|
20
23
|
borderCollapse: 'collapse',
|
|
21
24
|
width: '100%',
|
|
22
|
-
}, children: [
|
|
25
|
+
}, children: [(0, jsx_runtime_1.jsx)(react_components_1.TableHeader, { style: {
|
|
23
26
|
position: 'sticky',
|
|
24
27
|
top: 0,
|
|
25
|
-
background: tokens.colorNeutralBackground3,
|
|
28
|
+
background: react_components_1.tokens.colorNeutralBackground3,
|
|
26
29
|
zIndex: 2,
|
|
27
|
-
}, children:
|
|
30
|
+
}, children: (0, jsx_runtime_1.jsx)(react_components_1.TableRow, { style: {
|
|
28
31
|
position: 'sticky',
|
|
29
32
|
top: 0,
|
|
30
33
|
minWidth: 'calc(100% - 16px)',
|
|
31
34
|
}, children: info.columns.map((column, index) => {
|
|
32
35
|
const attribute = info.attributes[column];
|
|
33
|
-
return (
|
|
36
|
+
return ((0, jsx_runtime_1.jsx)(react_components_1.TableHeaderCell, { style: {
|
|
34
37
|
minWidth: 32,
|
|
35
38
|
flexShrink: 0,
|
|
36
39
|
flex: 1,
|
|
37
40
|
position: 'sticky',
|
|
38
|
-
background: tokens.colorNeutralBackground3,
|
|
39
|
-
borderBottom: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStroke3}`,
|
|
41
|
+
background: react_components_1.tokens.colorNeutralBackground3,
|
|
42
|
+
borderBottom: `${react_components_1.tokens.strokeWidthThin} solid ${react_components_1.tokens.colorNeutralStroke3}`,
|
|
40
43
|
}, children: attribute.label }, column + String(index)));
|
|
41
|
-
}) }) }),
|
|
42
|
-
var _a;
|
|
44
|
+
}) }) }), (0, jsx_runtime_1.jsx)(react_components_1.TableBody, { children: data.map((row, index) => ((0, jsx_runtime_1.jsx)(react_components_1.TableRow, { children: info.columns.map((column) => {
|
|
43
45
|
const attribute = info.attributes[column];
|
|
44
46
|
const value = row[column];
|
|
45
|
-
const formattedValue = (
|
|
46
|
-
switch (attribute
|
|
47
|
+
const formattedValue = (0, utils_1.getAttributeFormattedValue)(attribute, value) ?? '';
|
|
48
|
+
switch (attribute?.type) {
|
|
47
49
|
case 'money':
|
|
48
|
-
return (
|
|
50
|
+
return ((0, jsx_runtime_1.jsx)(react_components_1.TableCell, { children: formattedValue }, column));
|
|
49
51
|
case 'lookup':
|
|
50
52
|
return null;
|
|
51
53
|
}
|
|
52
|
-
return
|
|
53
|
-
}) }, index))) })] })),
|
|
54
|
+
return (0, jsx_runtime_1.jsx)(react_components_1.TableCell, { children: formattedValue }, column);
|
|
55
|
+
}) }, index))) })] })), (0, jsx_runtime_1.jsx)(BodyLoading_1.BodyLoading, { loading: isFetching })] })] }));
|
|
54
56
|
};
|
|
57
|
+
exports.WidgetTableContainer = WidgetTableContainer;
|
|
@@ -1,20 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WidgetTileContainer = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
const useWidgetDetail_1 = require("./hooks/useWidgetDetail");
|
|
7
|
+
const WidgetTitleBar_1 = require("./WidgetTitleBar");
|
|
8
|
+
const WidgetTileContainer = ({ content, }) => {
|
|
9
|
+
const { transformedCommands, widget } = (0, useWidgetDetail_1.useWidgetDetail)(content);
|
|
10
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
8
11
|
display: 'flex',
|
|
9
12
|
flex: 1,
|
|
10
|
-
background: tokens.colorNeutralBackground1,
|
|
11
|
-
boxShadow: tokens.shadow2,
|
|
12
|
-
borderRadius: tokens.borderRadiusMedium,
|
|
13
|
+
background: react_components_1.tokens.colorNeutralBackground1,
|
|
14
|
+
boxShadow: react_components_1.tokens.shadow2,
|
|
15
|
+
borderRadius: react_components_1.tokens.borderRadiusMedium,
|
|
13
16
|
flexDirection: 'column',
|
|
14
|
-
}, children: [
|
|
17
|
+
}, children: [(0, jsx_runtime_1.jsx)(WidgetTitleBar_1.WidgetTitleBar, { title: widget.title, commands: transformedCommands }), (0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', flex: 1 }, children: (0, jsx_runtime_1.jsx)("div", { style: {
|
|
15
18
|
flex: 1,
|
|
16
19
|
alignItems: 'center',
|
|
17
20
|
display: 'flex',
|
|
18
21
|
paddingInline: 16,
|
|
19
|
-
}, children:
|
|
22
|
+
}, children: (0, jsx_runtime_1.jsx)(react_components_1.Title2, { children: "Not supported yet" }) }) })] }));
|
|
20
23
|
};
|
|
24
|
+
exports.WidgetTileContainer = WidgetTileContainer;
|
|
@@ -1,16 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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.WidgetTitleBar = WidgetTitleBar;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
9
|
+
const locale_1 = require("@headless-adminapp/app/locale");
|
|
10
|
+
const CommandBar_1 = __importDefault(require("../CommandBar"));
|
|
11
|
+
const OverflowCommandBar_1 = require("../OverflowCommandBar");
|
|
12
|
+
function WidgetTitleBar({ title, commands }) {
|
|
13
|
+
const { language } = (0, locale_1.useLocale)();
|
|
14
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { style: {
|
|
10
15
|
display: 'flex',
|
|
11
16
|
paddingInline: 16,
|
|
12
17
|
paddingBlock: 8,
|
|
13
18
|
height: 40,
|
|
14
19
|
alignItems: 'center',
|
|
15
|
-
}, children:
|
|
20
|
+
}, children: (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', alignItems: 'center', width: '100%' }, children: [(0, jsx_runtime_1.jsx)(react_components_1.Body1Strong, { children: title }), (0, jsx_runtime_1.jsx)("div", { style: { flex: 1 } }), commands?.[0]?.length > 0 && ((0, jsx_runtime_1.jsx)("div", { style: { marginRight: -20 }, children: (0, jsx_runtime_1.jsx)(CommandBar_1.default.Wrapper, { children: commands[0].map((command, index) => (0, OverflowCommandBar_1.renderCommandItem)(index, command, language)) }) }))] }) }), (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(react_components_1.Divider, { style: { opacity: 0.2 } }) })] }));
|
|
16
21
|
}
|
package/Insights/Widgets.js
CHANGED
|
@@ -1,54 +1,57 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Widgets = Widgets;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const hooks_1 = require("@headless-adminapp/app/hooks");
|
|
6
|
+
const insights_1 = require("@headless-adminapp/app/insights");
|
|
7
|
+
const mutable_1 = require("@headless-adminapp/app/mutable");
|
|
8
|
+
const widget_1 = require("@headless-adminapp/app/widget");
|
|
9
|
+
const react_1 = require("react");
|
|
10
|
+
const Grid_1 = require("./Grid");
|
|
11
|
+
const WidgetChartContainer_1 = require("./WidgetChartContainer");
|
|
12
|
+
const WidgetDataGridContainer_1 = require("./WidgetDataGridContainer");
|
|
13
|
+
const WidgetTableContainer_1 = require("./WidgetTableContainer");
|
|
14
|
+
const WidgetTileContainer_1 = require("./WidgetTileContainer");
|
|
12
15
|
const WidgetProvider = ({ children, widget, }) => {
|
|
13
|
-
const contextValue = useCreateContextStore({
|
|
16
|
+
const contextValue = (0, mutable_1.useCreateContextStore)({
|
|
14
17
|
widget,
|
|
15
18
|
data: widget.defaultData,
|
|
16
19
|
});
|
|
17
|
-
useEffect(() => {
|
|
20
|
+
(0, react_1.useEffect)(() => {
|
|
18
21
|
contextValue.setValue({
|
|
19
22
|
widget,
|
|
20
23
|
data: widget.defaultData,
|
|
21
24
|
});
|
|
22
25
|
}, [contextValue, widget]);
|
|
23
|
-
return (
|
|
26
|
+
return ((0, jsx_runtime_1.jsx)(widget_1.WidgetContext.Provider, { value: contextValue, children: children }));
|
|
24
27
|
};
|
|
25
|
-
|
|
26
|
-
const isMobile = useIsMobile();
|
|
27
|
-
return (
|
|
28
|
-
return (
|
|
28
|
+
function Widgets({ widgets, }) {
|
|
29
|
+
const isMobile = (0, hooks_1.useIsMobile)();
|
|
30
|
+
return ((0, jsx_runtime_1.jsx)(Grid_1.WidgetGrid, { children: widgets.map((widget, index) => {
|
|
31
|
+
return ((0, jsx_runtime_1.jsx)(Grid_1.WidgetGridItem, { row: widget.rows, column: isMobile ? 12 : widget.columns, children: (0, jsx_runtime_1.jsx)(WidgetProvider, { widget: widget, children: (0, jsx_runtime_1.jsx)(WidgetItem, {}) }) }, widget.title + String(index)));
|
|
29
32
|
}) }));
|
|
30
33
|
}
|
|
31
34
|
function WidgetItem() {
|
|
32
|
-
const insightState = useContextSelector(InsightsContext, (state) => state);
|
|
33
|
-
const widgetState = useContextSelector(WidgetContext, (state) => state);
|
|
35
|
+
const insightState = (0, mutable_1.useContextSelector)(insights_1.InsightsContext, (state) => state);
|
|
36
|
+
const widgetState = (0, mutable_1.useContextSelector)(widget_1.WidgetContext, (state) => state);
|
|
34
37
|
const widget = widgetState.widget;
|
|
35
38
|
const content = typeof widget.content === 'function'
|
|
36
39
|
? widget.content(insightState, widgetState)
|
|
37
40
|
: widget.content;
|
|
38
41
|
if (content.type === 'tile') {
|
|
39
|
-
return
|
|
42
|
+
return (0, jsx_runtime_1.jsx)(WidgetTileContainer_1.WidgetTileContainer, { content: content });
|
|
40
43
|
}
|
|
41
44
|
if (content.type === 'chart') {
|
|
42
|
-
return
|
|
45
|
+
return (0, jsx_runtime_1.jsx)(WidgetChartContainer_1.WidgetChartContainer, { content: content });
|
|
43
46
|
}
|
|
44
47
|
if (content.type === 'grid') {
|
|
45
|
-
return
|
|
48
|
+
return (0, jsx_runtime_1.jsx)(WidgetDataGridContainer_1.WidgetDataGridContainer, { content: content });
|
|
46
49
|
}
|
|
47
50
|
if (content.type === 'table') {
|
|
48
|
-
return
|
|
51
|
+
return (0, jsx_runtime_1.jsx)(WidgetTableContainer_1.WidgetTableContainer, { content: content });
|
|
49
52
|
}
|
|
50
53
|
if (content.type === 'custom') {
|
|
51
|
-
return
|
|
54
|
+
return (0, jsx_runtime_1.jsx)(content.Component, {});
|
|
52
55
|
}
|
|
53
56
|
return null;
|
|
54
57
|
}
|
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AreaChart = AreaChart;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
const recharts_1 = require("recharts");
|
|
7
|
+
const CustomTooltipContent_1 = require("./CustomTooltipContent");
|
|
8
|
+
const formatters_1 = require("./formatters");
|
|
9
|
+
const renderers_1 = require("./renderers");
|
|
10
|
+
function AreaChart({ dataset, chartInfo, }) {
|
|
8
11
|
const xAxis = chartInfo.xAxis;
|
|
9
12
|
const yAxis = chartInfo.yAxis;
|
|
10
13
|
const areas = chartInfo.areas;
|
|
11
|
-
const xAxisFullFormatter = createLongAxisFormatter(xAxis.tick);
|
|
12
|
-
const yAxisFullFormatter = createLongAxisFormatter(yAxis.tick);
|
|
13
|
-
return (
|
|
14
|
-
stroke: tokens.colorNeutralBackground6,
|
|
14
|
+
const xAxisFullFormatter = (0, formatters_1.createLongAxisFormatter)(xAxis.tick);
|
|
15
|
+
const yAxisFullFormatter = (0, formatters_1.createLongAxisFormatter)(yAxis.tick);
|
|
16
|
+
return ((0, jsx_runtime_1.jsx)(recharts_1.ResponsiveContainer, { width: "100%", height: "100%", children: (0, jsx_runtime_1.jsxs)(recharts_1.AreaChart, { data: dataset[0], children: [(0, renderers_1.renderGrid)(), (0, renderers_1.renderXAxis)(xAxis), (0, renderers_1.renderYAxis)(yAxis), (0, renderers_1.renderAreas)(areas, dataset), (0, jsx_runtime_1.jsx)(recharts_1.Tooltip, { cursor: {
|
|
17
|
+
stroke: react_components_1.tokens.colorNeutralBackground6,
|
|
15
18
|
opacity: 0.5,
|
|
16
|
-
}, content: ({ active, payload, label }) => (
|
|
19
|
+
}, content: ({ active, payload, label }) => ((0, jsx_runtime_1.jsx)(CustomTooltipContent_1.CustomTooltipContent, { xAxisFormatter: xAxisFullFormatter, yAxisFormatter: yAxisFullFormatter, active: active, payload: payload, label: label })) })] }) }));
|
|
17
20
|
}
|
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BarChart = BarChart;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
const recharts_1 = require("recharts");
|
|
7
|
+
const CustomTooltipContent_1 = require("./CustomTooltipContent");
|
|
8
|
+
const formatters_1 = require("./formatters");
|
|
9
|
+
const renderers_1 = require("./renderers");
|
|
10
|
+
function BarChart({ dataset, chartInfo, }) {
|
|
8
11
|
const xAxis = chartInfo.xAxis;
|
|
9
12
|
const yAxis = chartInfo.yAxis;
|
|
10
13
|
const bars = chartInfo.bars;
|
|
11
|
-
const xAxisFullFormatter = createLongAxisFormatter(xAxis.tick);
|
|
12
|
-
const yAxisFullFormatter = createLongAxisFormatter(yAxis.tick);
|
|
13
|
-
return (
|
|
14
|
-
stroke: tokens.colorNeutralBackground6,
|
|
14
|
+
const xAxisFullFormatter = (0, formatters_1.createLongAxisFormatter)(xAxis.tick);
|
|
15
|
+
const yAxisFullFormatter = (0, formatters_1.createLongAxisFormatter)(yAxis.tick);
|
|
16
|
+
return ((0, jsx_runtime_1.jsx)(recharts_1.ResponsiveContainer, { width: "100%", height: "100%", children: (0, jsx_runtime_1.jsxs)(recharts_1.BarChart, { data: dataset[0], stackOffset: chartInfo.stackOffset, children: [(0, renderers_1.renderGrid)(), (0, renderers_1.renderYAxis)(yAxis), (0, renderers_1.renderXAxis)(xAxis), (0, renderers_1.renderBars)(bars, dataset), (0, jsx_runtime_1.jsx)(recharts_1.Tooltip, { cursor: {
|
|
17
|
+
stroke: react_components_1.tokens.colorNeutralBackground6,
|
|
15
18
|
opacity: 0.5,
|
|
16
|
-
}, content: ({ active, payload, label }) => (
|
|
19
|
+
}, content: ({ active, payload, label }) => ((0, jsx_runtime_1.jsx)(CustomTooltipContent_1.CustomTooltipContent, { xAxisFormatter: xAxisFullFormatter, yAxisFormatter: yAxisFullFormatter, active: active, payload: payload, label: label })) })] }) }));
|
|
17
20
|
}
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ComposedChart = ComposedChart;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
const recharts_1 = require("recharts");
|
|
7
|
+
const CustomTooltipContent_1 = require("./CustomTooltipContent");
|
|
8
|
+
const formatters_1 = require("./formatters");
|
|
9
|
+
const renderers_1 = require("./renderers");
|
|
10
|
+
function ComposedChart({ dataset, chartInfo, }) {
|
|
9
11
|
const xAxis = chartInfo.xAxis;
|
|
10
12
|
const yAxis = chartInfo.yAxis;
|
|
11
|
-
const xAxisFullFormatter = createLongAxisFormatter(xAxis.tick);
|
|
12
|
-
const yAxisFullFormatter = createLongAxisFormatter(yAxis.tick);
|
|
13
|
-
return (
|
|
14
|
-
stroke: tokens.colorNeutralBackground6,
|
|
13
|
+
const xAxisFullFormatter = (0, formatters_1.createLongAxisFormatter)(xAxis.tick);
|
|
14
|
+
const yAxisFullFormatter = (0, formatters_1.createLongAxisFormatter)(yAxis.tick);
|
|
15
|
+
return ((0, jsx_runtime_1.jsx)(recharts_1.ResponsiveContainer, { width: "100%", height: "100%", children: (0, jsx_runtime_1.jsxs)(recharts_1.ComposedChart, { data: dataset[0], children: [(0, renderers_1.renderGrid)(), (0, renderers_1.renderYAxis)(yAxis), (0, renderers_1.renderXAxis)(xAxis, !!chartInfo.bars?.length), (0, renderers_1.renderLines)(chartInfo.lines ?? [], dataset), (0, renderers_1.renderAreas)(chartInfo.areas ?? [], dataset), (0, renderers_1.renderBars)(chartInfo.bars ?? [], dataset), (0, jsx_runtime_1.jsx)(recharts_1.Tooltip, { cursor: {
|
|
16
|
+
stroke: react_components_1.tokens.colorNeutralBackground6,
|
|
15
17
|
opacity: 0.5,
|
|
16
|
-
}, content: ({ active, payload, label }) => (
|
|
18
|
+
}, content: ({ active, payload, label }) => ((0, jsx_runtime_1.jsx)(CustomTooltipContent_1.CustomTooltipContent, { xAxisFormatter: xAxisFullFormatter, yAxisFormatter: yAxisFullFormatter, active: active, payload: payload, label: label })) })] }) }));
|
|
17
19
|
}
|
|
@@ -1,21 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CustomTooltipContent = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
const CustomTooltipContent = ({ active, payload, label, xAxisFormatter, yAxisFormatter, }) => {
|
|
7
|
+
if (!active || !payload?.length) {
|
|
5
8
|
return null;
|
|
6
9
|
}
|
|
7
|
-
return (
|
|
10
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
8
11
|
display: 'flex',
|
|
9
12
|
flexDirection: 'column',
|
|
10
|
-
boxShadow: tokens.shadow16,
|
|
11
|
-
backgroundColor: tokens.colorNeutralBackground1,
|
|
13
|
+
boxShadow: react_components_1.tokens.shadow16,
|
|
14
|
+
backgroundColor: react_components_1.tokens.colorNeutralBackground1,
|
|
12
15
|
padding: 8,
|
|
13
16
|
borderRadius: 4,
|
|
14
17
|
gap: 4,
|
|
15
|
-
}, children: [
|
|
18
|
+
}, children: [(0, jsx_runtime_1.jsx)(react_components_1.Caption1, { style: { color: react_components_1.tokens.colorNeutralForeground4 }, children: xAxisFormatter(label) }), (0, jsx_runtime_1.jsx)(react_components_1.Divider, { style: { opacity: 0.2 } }), (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)("div", { style: {
|
|
16
19
|
width: 8,
|
|
17
20
|
height: 8,
|
|
18
21
|
background: item.color,
|
|
19
22
|
borderRadius: 4,
|
|
20
|
-
} }),
|
|
23
|
+
} }), (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: yAxisFormatter(item.value) })] }, item.name + String(index)))) })] }));
|
|
21
24
|
};
|
|
25
|
+
exports.CustomTooltipContent = CustomTooltipContent;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GaugeChart = GaugeChart;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
2
5
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3
|
-
|
|
4
|
-
return
|
|
6
|
+
function GaugeChart(_props) {
|
|
7
|
+
return (0, jsx_runtime_1.jsx)("div", { children: "Not supported yet" });
|
|
5
8
|
}
|
|
@@ -1,18 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LineChart = LineChart;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
const recharts_1 = require("recharts");
|
|
7
|
+
const CustomTooltipContent_1 = require("./CustomTooltipContent");
|
|
8
|
+
const formatters_1 = require("./formatters");
|
|
9
|
+
const renderers_1 = require("./renderers");
|
|
10
|
+
function LineChart({ dataset, chartInfo, }) {
|
|
8
11
|
const xAxis = chartInfo.xAxis;
|
|
9
12
|
const yAxis = chartInfo.yAxis;
|
|
10
13
|
const lines = chartInfo.lines;
|
|
11
|
-
const xAxisFullFormatter = createLongAxisFormatter(xAxis.tick);
|
|
12
|
-
const yAxisFullFormatter = createLongAxisFormatter(yAxis.tick);
|
|
14
|
+
const xAxisFullFormatter = (0, formatters_1.createLongAxisFormatter)(xAxis.tick);
|
|
15
|
+
const yAxisFullFormatter = (0, formatters_1.createLongAxisFormatter)(yAxis.tick);
|
|
13
16
|
console.log('dataset', dataset, chartInfo);
|
|
14
|
-
return (
|
|
15
|
-
stroke: tokens.colorNeutralBackground6,
|
|
17
|
+
return ((0, jsx_runtime_1.jsx)(recharts_1.ResponsiveContainer, { width: "100%", height: "100%", children: (0, jsx_runtime_1.jsxs)(recharts_1.LineChart, { children: [(0, renderers_1.renderGrid)(), (0, renderers_1.renderYAxis)(yAxis), (0, renderers_1.renderXAxis)(xAxis), (0, renderers_1.renderLines)(lines, dataset), (0, jsx_runtime_1.jsx)(recharts_1.Tooltip, { cursor: {
|
|
18
|
+
stroke: react_components_1.tokens.colorNeutralBackground6,
|
|
16
19
|
opacity: 0.5,
|
|
17
|
-
}, content: ({ active, payload, label }) => (
|
|
20
|
+
}, content: ({ active, payload, label }) => ((0, jsx_runtime_1.jsx)(CustomTooltipContent_1.CustomTooltipContent, { xAxisFormatter: xAxisFullFormatter, yAxisFormatter: yAxisFullFormatter, active: active, payload: payload, label: label })) })] }) }));
|
|
18
21
|
}
|