@headless-adminapp/fluent 0.0.17-alpha.50 → 0.0.17-alpha.52
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/AppHeaderContianer.js +7 -6
- package/App/NavigationContainer.js +4 -1
- package/CommandBar/MenuItems.js +4 -1
- package/DataGrid/GridColumnHeader/FilterForm.js +1 -1
- package/DataGrid/GridColumnHeader/TableHeaderFilterCell.js +18 -10
- package/DataGrid/GridColumnHeader/utils.js +10 -7
- package/DataGrid/GridListContainer.js +1 -1
- package/DataGrid/GridTableContainer.js +2 -2
- package/DataGrid/TableCell/TableCellBase.d.ts +2 -2
- package/Insights/WidgetTableContainer.js +1 -1
- package/Insights/Widgets.d.ts +2 -2
- package/Insights/Widgets.js +1 -1
- package/Insights/charts/BarChart.d.ts +2 -2
- package/Insights/charts/BarChart.js +0 -1
- package/Insights/charts/CustomTooltipContent.js +2 -2
- package/Insights/charts/LineChart.d.ts +2 -2
- package/Insights/charts/OhlcChart.d.ts +2 -2
- package/Insights/charts/OhlcChart.js +26 -22
- package/Insights/charts/PieChart.d.ts +2 -2
- package/Insights/charts/PieChart.js +20 -15
- package/Insights/charts/RadarChart.d.ts +2 -2
- package/Insights/charts/RadarChart.js +20 -14
- package/Insights/charts/ScatterChart.d.ts +2 -2
- package/Insights/charts/ScatterChart.js +2 -1
- package/Insights/charts/formatters.d.ts +1 -1
- package/OverflowCommandBar/OverflowCommandBar.js +1 -1
- package/OverflowCommandBar/OverflowMenu.js +1 -1
- package/PageEntityForm/RecordCard.js +21 -25
- package/form/FormControl.js +2 -13
- package/package.json +2 -2
|
@@ -15,7 +15,6 @@ const AppLogo_1 = require("./AppLogo");
|
|
|
15
15
|
const AppStringContext_1 = require("./AppStringContext");
|
|
16
16
|
const QuickActionItem_1 = require("./QuickActionItem");
|
|
17
17
|
const AppHeaderContainer = ({ onNavToggle, }) => {
|
|
18
|
-
var _a, _b, _c;
|
|
19
18
|
const { app } = (0, app_1.useAppContext)();
|
|
20
19
|
const authSession = (0, hooks_1.useAuthSession)();
|
|
21
20
|
const isSkipAuthCheck = (0, useIsSkipAuthCheck_1.useIsSkipAuthCheck)();
|
|
@@ -26,6 +25,8 @@ const AppHeaderContainer = ({ onNavToggle, }) => {
|
|
|
26
25
|
const initials = (0, react_1.useMemo)(() => {
|
|
27
26
|
return authSession === null || authSession === void 0 ? void 0 : authSession.fullName.split(' ').map((item) => item[0]).slice(0, 2).join('');
|
|
28
27
|
}, [authSession === null || authSession === void 0 ? void 0 : authSession.fullName]);
|
|
28
|
+
const quickActionItems = (0, hooks_2.useItemsWithKey)(app.quickActionItems);
|
|
29
|
+
const accountMenuItems = (0, hooks_2.useItemsWithKey)(app.accountMenuItems);
|
|
29
30
|
return ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
30
31
|
display: 'flex',
|
|
31
32
|
alignItems: 'center',
|
|
@@ -45,10 +46,10 @@ const AppHeaderContainer = ({ onNavToggle, }) => {
|
|
|
45
46
|
paddingLeft: 8,
|
|
46
47
|
display: 'flex',
|
|
47
48
|
gap: 16,
|
|
48
|
-
}, children: [(0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', gap: 8 }, children:
|
|
49
|
+
}, children: [(0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', gap: 8 }, children: quickActionItems === null || quickActionItems === void 0 ? void 0 : quickActionItems.map((item) => {
|
|
49
50
|
var _a, _b;
|
|
50
|
-
return ((0, jsx_runtime_1.jsx)(QuickActionItem_1.QuickActionItem, { Icon: item.icon, label: (_b = (_a = item.localizedLabel) === null || _a === void 0 ? void 0 : _a[language]) !== null && _b !== void 0 ? _b : item.label, onClick: () => { var _a; return (_a = item.onClick) === null || _a === void 0 ? void 0 : _a.call(item); }, link: item.link },
|
|
51
|
-
}) }), (!isSkipAuthCheck || !!(
|
|
51
|
+
return ((0, jsx_runtime_1.jsx)(QuickActionItem_1.QuickActionItem, { Icon: item.icon, label: (_b = (_a = item.localizedLabel) === null || _a === void 0 ? void 0 : _a[language]) !== null && _b !== void 0 ? _b : item.label, onClick: () => { var _a; return (_a = item.onClick) === null || _a === void 0 ? void 0 : _a.call(item); }, link: item.link }, item.__key));
|
|
52
|
+
}) }), (!isSkipAuthCheck || !!(accountMenuItems === null || accountMenuItems === void 0 ? void 0 : accountMenuItems.length)) && ((0, jsx_runtime_1.jsxs)(react_components_1.Popover, { children: [(0, jsx_runtime_1.jsx)(react_components_1.PopoverTrigger, { disableButtonEnhancement: true, children: (0, jsx_runtime_1.jsx)(react_components_1.Avatar, { initials: initials, color: "neutral", style: { cursor: 'pointer' }, image: {
|
|
52
53
|
src: authSession === null || authSession === void 0 ? void 0 : authSession.profilePicture,
|
|
53
54
|
} }) }), (0, jsx_runtime_1.jsxs)(react_components_1.PopoverSurface, { tabIndex: -1, style: { padding: 0 }, children: [!isSkipAuthCheck && ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
54
55
|
display: 'flex',
|
|
@@ -63,10 +64,10 @@ const AppHeaderContainer = ({ onNavToggle, }) => {
|
|
|
63
64
|
flexDirection: 'column',
|
|
64
65
|
overflow: 'hidden',
|
|
65
66
|
flex: 1,
|
|
66
|
-
}, children: [(0, jsx_runtime_1.jsx)(react_components_1.Caption1Strong, { children: authSession === null || authSession === void 0 ? void 0 : authSession.fullName }), (0, jsx_runtime_1.jsx)(react_components_1.Caption1, { style: { textOverflow: 'ellipsis', overflow: 'hidden' }, children: authSession === null || authSession === void 0 ? void 0 : authSession.email })] })] })), !isSkipAuthCheck && (0, jsx_runtime_1.jsx)(react_components_1.MenuDivider, { style: { marginInline: 0 } }), (0, jsx_runtime_1.jsxs)(react_components_1.MenuList, { style: { width: 200, marginBottom: 4 }, children: [
|
|
67
|
+
}, children: [(0, jsx_runtime_1.jsx)(react_components_1.Caption1Strong, { children: authSession === null || authSession === void 0 ? void 0 : authSession.fullName }), (0, jsx_runtime_1.jsx)(react_components_1.Caption1, { style: { textOverflow: 'ellipsis', overflow: 'hidden' }, children: authSession === null || authSession === void 0 ? void 0 : authSession.email })] })] })), !isSkipAuthCheck && (0, jsx_runtime_1.jsx)(react_components_1.MenuDivider, { style: { marginInline: 0 } }), (0, jsx_runtime_1.jsxs)(react_components_1.MenuList, { style: { width: 200, marginBottom: 4 }, children: [accountMenuItems === null || accountMenuItems === void 0 ? void 0 : accountMenuItems.map((item) => {
|
|
67
68
|
var _a, _b;
|
|
68
69
|
const Icon = item.icon;
|
|
69
|
-
return ((0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { icon: (0, jsx_runtime_1.jsx)(Icon, { size: "inherit" }), onClick: () => { var _a; return (_a = item.onClick) === null || _a === void 0 ? void 0 : _a.call(item); }, children: (_b = (_a = item.localizedLabel) === null || _a === void 0 ? void 0 : _a[language]) !== null && _b !== void 0 ? _b : item.label },
|
|
70
|
+
return ((0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { icon: (0, jsx_runtime_1.jsx)(Icon, { size: "inherit" }), onClick: () => { var _a; return (_a = item.onClick) === null || _a === void 0 ? void 0 : _a.call(item); }, children: (_b = (_a = item.localizedLabel) === null || _a === void 0 ? void 0 : _a[language]) !== null && _b !== void 0 ? _b : item.label }, item.__key));
|
|
70
71
|
}), !isSkipAuthCheck && ((0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.SignOut, {}), onClick: () => logout(), children: strings.logout }))] })] })] }))] })] }));
|
|
71
72
|
};
|
|
72
73
|
exports.AppHeaderContainer = AppHeaderContainer;
|
|
@@ -34,7 +34,10 @@ const useStyles = (0, react_components_1.makeStyles)({
|
|
|
34
34
|
const NavigationContainer = ({ open, type, onOpenChange, }) => {
|
|
35
35
|
const styles = useStyles();
|
|
36
36
|
const { app } = (0, app_1.useAppContext)();
|
|
37
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: styles.root, children: (0, jsx_runtime_1.jsx)(react_nav_preview_1.NavDrawer, { selectedValue: "active", open: open, type: type, onOpenChange: (value, data) => onOpenChange(data.open), children: (0, jsx_runtime_1.jsx)(react_nav_preview_1.NavDrawerBody, { style: { paddingTop: 8 }, children: app.navItems.map((area) => ((0, jsx_runtime_1.jsx)(react_1.Fragment, { children: area.groups.map((group) => ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [!group.hideLabel && ((0, jsx_runtime_1.jsx)(react_nav_preview_1.NavSectionHeader, { children: group.label })), group.items.map((item, index) =>
|
|
37
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: styles.root, children: (0, jsx_runtime_1.jsx)(react_nav_preview_1.NavDrawer, { selectedValue: "active", open: open, type: type, onOpenChange: (value, data) => onOpenChange(data.open), children: (0, jsx_runtime_1.jsx)(react_nav_preview_1.NavDrawerBody, { style: { paddingTop: 8 }, children: app.navItems.map((area) => ((0, jsx_runtime_1.jsx)(react_1.Fragment, { children: area.groups.map((group) => ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [!group.hideLabel && ((0, jsx_runtime_1.jsx)(react_nav_preview_1.NavSectionHeader, { children: group.label })), group.items.map((item, index) => {
|
|
38
|
+
var _a;
|
|
39
|
+
return ((0, jsx_runtime_1.jsx)(Test, { item: item, drawerType: type, onOpenChange: onOpenChange }, ((_a = item.label) !== null && _a !== void 0 ? _a : '') + String(index)));
|
|
40
|
+
})] }, group.label))) }, area.label))) }) }) }));
|
|
38
41
|
};
|
|
39
42
|
exports.NavigationContainer = NavigationContainer;
|
|
40
43
|
const Test = ({ item, onOpenChange, drawerType }) => {
|
package/CommandBar/MenuItems.js
CHANGED
|
@@ -6,6 +6,9 @@ const react_components_1 = require("@fluentui/react-components");
|
|
|
6
6
|
const react_1 = require("react");
|
|
7
7
|
const MenuItem_1 = require("./MenuItem");
|
|
8
8
|
exports.MenuItems = (0, react_1.memo)(({ items }) => {
|
|
9
|
-
return ((0, jsx_runtime_1.jsx)(react_1.Fragment, { children: items === null || items === void 0 ? void 0 : items.map((group, index) => ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [index > 0 && (0, jsx_runtime_1.jsx)(react_components_1.MenuDivider, {}), group.map((item, index) =>
|
|
9
|
+
return ((0, jsx_runtime_1.jsx)(react_1.Fragment, { children: items === null || items === void 0 ? void 0 : items.map((group, index) => ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [index > 0 && (0, jsx_runtime_1.jsx)(react_components_1.MenuDivider, {}), group.map((item, index) => {
|
|
10
|
+
var _a;
|
|
11
|
+
return ((0, jsx_runtime_1.jsx)(MenuItem_1.MenuItem, { Icon: item.Icon, onClick: item.onClick, text: item.text, danger: item.danger, disabled: item.disabled, items: item.items }, ((_a = item.text) !== null && _a !== void 0 ? _a : '') + index));
|
|
12
|
+
})] }, index))) }));
|
|
10
13
|
});
|
|
11
14
|
exports.MenuItems.displayName = 'MenuItems';
|
|
@@ -46,7 +46,7 @@ const FilterForm = ({ defaultValue, attribute, onApply, onCancel, }) => {
|
|
|
46
46
|
var _a;
|
|
47
47
|
return ((0, jsx_runtime_1.jsx)(ConditionValueControl_1.ConditionValueControl, { type: x, attribute: attribute, value: (_a = values[i]) !== null && _a !== void 0 ? _a : null, onChange: (value) => {
|
|
48
48
|
handleChangeValue(value, i);
|
|
49
|
-
} }, i));
|
|
49
|
+
} }, x + String(i)));
|
|
50
50
|
})] }) }), (0, jsx_runtime_1.jsxs)(react_components_1.DialogActions, { children: [(0, jsx_runtime_1.jsx)(react_components_1.DialogTrigger, { disableButtonEnhancement: true, children: (0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "secondary", onClick: onCancel, children: strings.cancel }) }), (0, jsx_runtime_1.jsx)(react_components_1.Button, { type: "submit", appearance: "primary", disabled: !isValid, onClick: () => {
|
|
51
51
|
onApply === null || onApply === void 0 ? void 0 : onApply({
|
|
52
52
|
operator,
|
|
@@ -77,6 +77,7 @@ column, onResetSize, resizeHandler, resizable, disableFilter, disableSort, }) =>
|
|
|
77
77
|
const align = (0, react_1.useMemo)(() => {
|
|
78
78
|
switch (attribute.type) {
|
|
79
79
|
case 'money':
|
|
80
|
+
case 'number':
|
|
80
81
|
return 'right';
|
|
81
82
|
default:
|
|
82
83
|
return 'left';
|
|
@@ -91,7 +92,7 @@ column, onResetSize, resizeHandler, resizable, disableFilter, disableSort, }) =>
|
|
|
91
92
|
};
|
|
92
93
|
const sortMenuItems = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.ArrowUp, { size: 16 }), onClick: () => onChangeSortDirection === null || onChangeSortDirection === void 0 ? void 0 : onChangeSortDirection('asc'), children: strings.sortByAscending }), (0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.ArrowDown, { size: 16 }), onClick: () => onChangeSortDirection === null || onChangeSortDirection === void 0 ? void 0 : onChangeSortDirection('desc'), children: strings.sortByDescending })] }));
|
|
93
94
|
const filterMenuItems = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.Filter, { size: 16 }), onClick: () => setVisible(!visible), children: strings.filter }), !!filterCondition && ((0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.FilterDismiss, { size: 16 }), onClick: () => {
|
|
94
|
-
onChangeFilterCondition
|
|
95
|
+
onChangeFilterCondition(undefined);
|
|
95
96
|
}, children: strings.clearFilter }))] }));
|
|
96
97
|
const menuItems = [];
|
|
97
98
|
if (!disableSort) {
|
|
@@ -137,17 +138,24 @@ column, onResetSize, resizeHandler, resizable, disableFilter, disableSort, }) =>
|
|
|
137
138
|
isResizingRef.current = false;
|
|
138
139
|
}, sortable: !disableSort,
|
|
139
140
|
// sortDirection="ascending"
|
|
140
|
-
sortDirection: sortDirection
|
|
141
|
-
? 'ascending'
|
|
142
|
-
: sortDirection === 'desc'
|
|
143
|
-
? 'descending'
|
|
144
|
-
: undefined, children: [children, !!filterCondition && ((0, jsx_runtime_1.jsx)("div", { style: { marginTop: 2, color: react_components_1.tokens.colorNeutralForeground1 }, children: (0, jsx_runtime_1.jsx)(icons_1.Icons.Filter, { size: 16 }) }))] }));
|
|
141
|
+
sortDirection: getSortDirection(sortDirection), children: [children, !!filterCondition && ((0, jsx_runtime_1.jsx)("div", { style: { marginTop: 2, color: react_components_1.tokens.colorNeutralForeground1 }, children: (0, jsx_runtime_1.jsx)(icons_1.Icons.Filter, { size: 16 }) }))] }));
|
|
145
142
|
if (disableFilter && disableSort) {
|
|
146
143
|
return headerCell;
|
|
147
144
|
}
|
|
148
|
-
return ((0, jsx_runtime_1.
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
145
|
+
return ((0, jsx_runtime_1.jsxs)("th", { children: [(0, jsx_runtime_1.jsxs)(react_components_1.Menu, { positioning: "below-start", children: [(0, jsx_runtime_1.jsx)(react_components_1.MenuTrigger, { children: headerCell }), (0, jsx_runtime_1.jsx)(react_components_1.MenuPopover, { children: (0, jsx_runtime_1.jsx)(react_components_1.MenuList, { children: menuItems.map((x, i) => ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [i > 0 && (0, jsx_runtime_1.jsx)(react_components_1.MenuDivider, {}), x] }, i))) }) })] }), (0, jsx_runtime_1.jsx)(react_components_1.Dialog, { open: visible, onOpenChange: () => setVisible(false), children: (0, jsx_runtime_1.jsx)(react_components_1.DialogSurface, { style: { maxWidth: 400 }, children: (0, jsx_runtime_1.jsxs)(react_components_1.DialogBody, { children: [(0, jsx_runtime_1.jsx)(react_components_1.DialogTitle, { children: strings.filterBy }), (0, jsx_runtime_1.jsx)(FilterForm_1.FilterForm, { attribute: attribute, defaultValue: filterCondition, onApply: (condition) => {
|
|
146
|
+
onChangeFilterCondition(condition);
|
|
147
|
+
setVisible(false);
|
|
148
|
+
}, onCancel: () => setVisible(false) })] }) }) })] }));
|
|
152
149
|
};
|
|
153
150
|
exports.TableHeaderFilterCell = TableHeaderFilterCell;
|
|
151
|
+
const getSortDirection = (direction) => {
|
|
152
|
+
if (direction === 'asc') {
|
|
153
|
+
return 'ascending';
|
|
154
|
+
}
|
|
155
|
+
else if (direction === 'desc') {
|
|
156
|
+
return 'descending';
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
return undefined;
|
|
160
|
+
}
|
|
161
|
+
};
|
|
@@ -3,13 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getDefaultOperator = getDefaultOperator;
|
|
4
4
|
exports.getDefaultValues = getDefaultValues;
|
|
5
5
|
function getDefaultOperator(operator, attributeType) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
if (operator) {
|
|
7
|
+
return operator;
|
|
8
|
+
}
|
|
9
|
+
if (attributeType === 'date') {
|
|
10
|
+
return 'on';
|
|
11
|
+
}
|
|
12
|
+
if (attributeType === 'choice' || attributeType === 'lookup') {
|
|
13
|
+
return 'in';
|
|
14
|
+
}
|
|
15
|
+
return 'eq';
|
|
13
16
|
}
|
|
14
17
|
function getDefaultValues(operator, value, _attributeType) {
|
|
15
18
|
if (!value)
|
|
@@ -23,7 +23,7 @@ const useStyles = (0, react_components_1.makeStyles)({
|
|
|
23
23
|
},
|
|
24
24
|
});
|
|
25
25
|
const fallbackData = [];
|
|
26
|
-
const GridListContainer = (
|
|
26
|
+
const GridListContainer = () => {
|
|
27
27
|
const styles = useStyles();
|
|
28
28
|
const data = (0, hooks_1.useGridData)();
|
|
29
29
|
const dataState = (0, hooks_1.useGridDataState)();
|
|
@@ -247,14 +247,14 @@ const GridTableContainer = ({ noPadding, disableColumnFilter, disableColumnSort,
|
|
|
247
247
|
display: 'flex',
|
|
248
248
|
height: 44,
|
|
249
249
|
alignItems: 'center',
|
|
250
|
-
}, children: table.getAllColumns().map((column
|
|
250
|
+
}, children: table.getAllColumns().map((column) => {
|
|
251
251
|
if (!column.getIsVisible())
|
|
252
252
|
return null;
|
|
253
253
|
return ((0, jsx_runtime_1.jsx)(react_components_1.TableCell, { style: {
|
|
254
254
|
display: 'flex',
|
|
255
255
|
alignItems: 'center',
|
|
256
256
|
width: column.getSize(),
|
|
257
|
-
}, children: (0, jsx_runtime_1.jsx)(react_components_1.SkeletonItem, { size: 16 }) },
|
|
257
|
+
}, children: (0, jsx_runtime_1.jsx)(react_components_1.SkeletonItem, { size: 16 }) }, column.id));
|
|
258
258
|
}) }, index))) }))] }) }), (data === null || data === void 0 ? void 0 : data.records.length) === 0 && !dataState.isFetching && ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
259
259
|
display: 'flex',
|
|
260
260
|
flexDirection: 'column',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CSSProperties, FC, MouseEventHandler, ReactNode } from 'react';
|
|
2
2
|
export interface TableCellBaseProps {
|
|
3
3
|
children?: ReactNode;
|
|
4
|
-
onClick?: MouseEventHandler
|
|
5
|
-
style?: CSSProperties
|
|
4
|
+
onClick?: MouseEventHandler;
|
|
5
|
+
style?: CSSProperties;
|
|
6
6
|
}
|
|
7
7
|
export declare const TableCellBase: FC<TableCellBaseProps>;
|
|
@@ -40,7 +40,7 @@ const WidgetTableContainer = ({ content, }) => {
|
|
|
40
40
|
position: 'sticky',
|
|
41
41
|
background: react_components_1.tokens.colorNeutralBackground3,
|
|
42
42
|
borderBottom: `${react_components_1.tokens.strokeWidthThin} solid ${react_components_1.tokens.colorNeutralStroke3}`,
|
|
43
|
-
}, children: attribute.label }, index));
|
|
43
|
+
}, children: attribute.label }, column + String(index)));
|
|
44
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) => {
|
|
45
45
|
var _a;
|
|
46
46
|
const attribute = info.attributes[column];
|
package/Insights/Widgets.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { InsightExpereince } from '@headless-adminapp/core/experience/insights';
|
|
2
|
-
export declare function Widgets({ widgets, }: {
|
|
2
|
+
export declare function Widgets({ widgets, }: Readonly<{
|
|
3
3
|
widgets: InsightExpereince['widgets'];
|
|
4
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
}>): import("react/jsx-runtime").JSX.Element;
|
package/Insights/Widgets.js
CHANGED
|
@@ -28,7 +28,7 @@ const WidgetProvider = ({ children, widget, }) => {
|
|
|
28
28
|
function Widgets({ widgets, }) {
|
|
29
29
|
const isMobile = (0, hooks_1.useIsMobile)();
|
|
30
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, {}) }) }, 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)));
|
|
32
32
|
}) }));
|
|
33
33
|
}
|
|
34
34
|
function WidgetItem() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BarChartInfo } from '@headless-adminapp/core/experience/insights';
|
|
2
|
-
export declare function BarChart({ dataset, chartInfo, }: {
|
|
2
|
+
export declare function BarChart({ dataset, chartInfo, }: Readonly<{
|
|
3
3
|
dataset: any[];
|
|
4
4
|
chartInfo: BarChartInfo;
|
|
5
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
}>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -13,7 +13,6 @@ function BarChart({ dataset, chartInfo, }) {
|
|
|
13
13
|
const bars = chartInfo.bars;
|
|
14
14
|
const xAxisFullFormatter = (0, formatters_1.createLongAxisFormatter)(xAxis.tick);
|
|
15
15
|
const yAxisFullFormatter = (0, formatters_1.createLongAxisFormatter)(yAxis.tick);
|
|
16
|
-
console.log('temp.dataset', dataset);
|
|
17
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: {
|
|
18
17
|
stroke: react_components_1.tokens.colorNeutralBackground6,
|
|
19
18
|
opacity: 0.5,
|
|
@@ -4,7 +4,7 @@ exports.CustomTooltipContent = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_components_1 = require("@fluentui/react-components");
|
|
6
6
|
const CustomTooltipContent = ({ active, payload, label, xAxisFormatter, yAxisFormatter, }) => {
|
|
7
|
-
if (!active || !payload ||
|
|
7
|
+
if (!active || !(payload === null || payload === void 0 ? void 0 : payload.length)) {
|
|
8
8
|
return null;
|
|
9
9
|
}
|
|
10
10
|
return ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
@@ -20,6 +20,6 @@ const CustomTooltipContent = ({ active, payload, label, xAxisFormatter, yAxisFor
|
|
|
20
20
|
height: 8,
|
|
21
21
|
background: item.color,
|
|
22
22
|
borderRadius: 4,
|
|
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) })] }, index))) })] }));
|
|
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)))) })] }));
|
|
24
24
|
};
|
|
25
25
|
exports.CustomTooltipContent = CustomTooltipContent;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LineChartInfo } from '@headless-adminapp/core/experience/insights';
|
|
2
|
-
export declare function LineChart({ dataset, chartInfo, }: {
|
|
2
|
+
export declare function LineChart({ dataset, chartInfo, }: Readonly<{
|
|
3
3
|
dataset: any[];
|
|
4
4
|
chartInfo: LineChartInfo;
|
|
5
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
}>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DateAxisTickInterval, OhlcChartInfo } from '@headless-adminapp/core/experience/insights';
|
|
2
2
|
export declare const barSizeInTime: (interval: DateAxisTickInterval) => number;
|
|
3
|
-
export declare function OhlcChart({ dataset, chartInfo, }: {
|
|
3
|
+
export declare function OhlcChart({ dataset, chartInfo, }: Readonly<{
|
|
4
4
|
dataset: any[];
|
|
5
5
|
chartInfo: OhlcChartInfo;
|
|
6
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
}>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -55,30 +55,14 @@ function OhlcChart({ dataset, chartInfo, }) {
|
|
|
55
55
|
opacity: 0.5,
|
|
56
56
|
}, 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,
|
|
57
57
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
58
|
-
shape: (props) => {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
const open = payload[bar.open.dataKey];
|
|
63
|
-
const close = payload[bar.close.dataKey];
|
|
64
|
-
const high = payload[bar.high.dataKey];
|
|
65
|
-
const low = payload[bar.low.dataKey];
|
|
66
|
-
const color = open < close
|
|
67
|
-
? (_b = (_a = bar.colors) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : react_components_1.tokens.colorPaletteGreenForeground1
|
|
68
|
-
: (_d = (_c = bar.colors) === null || _c === void 0 ? void 0 : _c[1]) !== null && _d !== void 0 ? _d : react_components_1.tokens.colorPaletteRedForeground1;
|
|
69
|
-
const xPosition = xAxis.scale(xValue);
|
|
70
|
-
let xWidth = 30;
|
|
71
|
-
if (chartInfo.xAxis.tick.type === 'time' &&
|
|
72
|
-
chartInfo.xAxis.tick.interval) {
|
|
73
|
-
xWidth =
|
|
74
|
-
xAxis.scale(xValue + (0, exports.barSizeInTime)(chartInfo.xAxis.tick.interval)) - xPosition;
|
|
75
|
-
}
|
|
76
|
-
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 })] }));
|
|
77
|
-
} }), (0, jsx_runtime_1.jsx)(recharts_1.Tooltip, { cursor: {
|
|
58
|
+
shape: (props) => renderShape(props, {
|
|
59
|
+
bar,
|
|
60
|
+
chartInfo,
|
|
61
|
+
}) }), (0, jsx_runtime_1.jsx)(recharts_1.Tooltip, { cursor: {
|
|
78
62
|
stroke: react_components_1.tokens.colorNeutralBackground6,
|
|
79
63
|
opacity: 0.5,
|
|
80
64
|
}, content: ({ active, payload }) => {
|
|
81
|
-
if (!active || !payload ||
|
|
65
|
+
if (!active || !(payload === null || payload === void 0 ? void 0 : payload.length)) {
|
|
82
66
|
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
|
|
83
67
|
}
|
|
84
68
|
return ((0, jsx_runtime_1.jsx)(OhclTooltipContent, { payload: payload[0], bar: bar, xAxisFormatter: xAxisLongFormatter, yAxisFormatter: yAxisLongFormatter }));
|
|
@@ -110,5 +94,25 @@ function OhclTooltipContent({ payload, bar, xAxisFormatter, yAxisFormatter, }) {
|
|
|
110
94
|
padding: 8,
|
|
111
95
|
borderRadius: 4,
|
|
112
96
|
gap: 4,
|
|
113
|
-
}, 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) })] }, index)))] }) }));
|
|
97
|
+
}, 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))))] }) }));
|
|
98
|
+
}
|
|
99
|
+
function renderShape(props, { chartInfo, bar, }) {
|
|
100
|
+
var _a, _b, _c, _d;
|
|
101
|
+
const { x, width, payload, yAxis, xAxis } = props;
|
|
102
|
+
const xValue = payload[xAxis.dataKey];
|
|
103
|
+
const open = payload[bar.open.dataKey];
|
|
104
|
+
const close = payload[bar.close.dataKey];
|
|
105
|
+
const high = payload[bar.high.dataKey];
|
|
106
|
+
const low = payload[bar.low.dataKey];
|
|
107
|
+
const color = open < close
|
|
108
|
+
? (_b = (_a = bar.colors) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : react_components_1.tokens.colorPaletteGreenForeground1
|
|
109
|
+
: (_d = (_c = bar.colors) === null || _c === void 0 ? void 0 : _c[1]) !== null && _d !== void 0 ? _d : react_components_1.tokens.colorPaletteRedForeground1;
|
|
110
|
+
const xPosition = xAxis.scale(xValue);
|
|
111
|
+
let xWidth = 30;
|
|
112
|
+
if (chartInfo.xAxis.tick.type === 'time' && chartInfo.xAxis.tick.interval) {
|
|
113
|
+
xWidth =
|
|
114
|
+
xAxis.scale(xValue + (0, exports.barSizeInTime)(chartInfo.xAxis.tick.interval)) -
|
|
115
|
+
xPosition;
|
|
116
|
+
}
|
|
117
|
+
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 })] }));
|
|
114
118
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PieChartInfo } from '@headless-adminapp/core/experience/insights';
|
|
2
|
-
export declare function PieChart({ dataset, chartInfo, }: {
|
|
2
|
+
export declare function PieChart({ dataset, chartInfo, }: Readonly<{
|
|
3
3
|
dataset: any[];
|
|
4
4
|
chartInfo: PieChartInfo;
|
|
5
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
}>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -26,7 +26,7 @@ function PieChart({ dataset, chartInfo, }) {
|
|
|
26
26
|
var _a, _b;
|
|
27
27
|
return ((0, jsx_runtime_1.jsx)(recharts_1.Cell, { fill: item.colorKey && entry[item.colorKey]
|
|
28
28
|
? entry[item.colorKey]
|
|
29
|
-
: ((_a = item.colors) !== null && _a !== void 0 ? _a : constants_1.defaultColors)[index % ((_b = item.colors) !== null && _b !== void 0 ? _b : constants_1.defaultColors).length] },
|
|
29
|
+
: ((_a = item.colors) !== null && _a !== void 0 ? _a : constants_1.defaultColors)[index % ((_b = item.colors) !== null && _b !== void 0 ? _b : constants_1.defaultColors).length] }, 'cell-' + String(index)));
|
|
30
30
|
}) }), chartInfo.showLegend && ((0, jsx_runtime_1.jsx)(recharts_1.Legend, { align: "right", layout: "vertical", verticalAlign: "top", wrapperStyle: {
|
|
31
31
|
fontSize: react_components_1.tokens.fontSizeBase100,
|
|
32
32
|
fontFamily: react_components_1.tokens.fontFamilyBase,
|
|
@@ -36,18 +36,23 @@ function PieChart({ dataset, chartInfo, }) {
|
|
|
36
36
|
} })), (0, jsx_runtime_1.jsx)(recharts_1.Tooltip, { cursor: {
|
|
37
37
|
stroke: react_components_1.tokens.colorNeutralBackground6,
|
|
38
38
|
opacity: 0.5,
|
|
39
|
-
}, content: ({ payload }) => {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
39
|
+
}, content: ({ payload }) => renderTooltipContent({
|
|
40
|
+
payload,
|
|
41
|
+
nameFormatter,
|
|
42
|
+
valueFormatter,
|
|
43
|
+
}) })] }) }));
|
|
44
|
+
}
|
|
45
|
+
function renderTooltipContent({ payload, nameFormatter, valueFormatter, }) {
|
|
46
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
47
|
+
display: 'flex',
|
|
48
|
+
flexDirection: 'column',
|
|
49
|
+
boxShadow: react_components_1.tokens.shadow16,
|
|
50
|
+
backgroundColor: react_components_1.tokens.colorNeutralBackground1,
|
|
51
|
+
padding: 8,
|
|
52
|
+
borderRadius: 4,
|
|
53
|
+
gap: 4,
|
|
54
|
+
}, children: (0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', flexDirection: 'column', gap: 4 }, children: payload === null || payload === void 0 ? void 0 : 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: {
|
|
55
|
+
color: react_components_1.tokens.colorNeutralForeground4,
|
|
56
|
+
marginLeft: 8,
|
|
57
|
+
}, 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))) }) }));
|
|
53
58
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RadarChartInfo } from '@headless-adminapp/core/experience/insights';
|
|
2
|
-
export declare function RadarChart({ dataset, chartInfo, }: {
|
|
2
|
+
export declare function RadarChart({ dataset, chartInfo, }: Readonly<{
|
|
3
3
|
dataset: any[];
|
|
4
4
|
chartInfo: RadarChartInfo;
|
|
5
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
}>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -16,18 +16,24 @@ function RadarChart({ dataset, chartInfo, }) {
|
|
|
16
16
|
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: (_a = radar.color) !== null && _a !== void 0 ? _a : '#8884d8', fill: (_b = radar.color) !== null && _b !== void 0 ? _b : '#8884d8', fillOpacity: 0.6 }), (0, jsx_runtime_1.jsx)(recharts_1.Tooltip, { cursor: {
|
|
17
17
|
stroke: react_components_1.tokens.colorNeutralBackground6,
|
|
18
18
|
opacity: 0.5,
|
|
19
|
-
}, content: ({ payload }) => {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
19
|
+
}, content: ({ payload }) => renderTooltipContent({
|
|
20
|
+
payload,
|
|
21
|
+
nameFormatter,
|
|
22
|
+
valueFormatter,
|
|
23
|
+
radar,
|
|
24
|
+
}) })] }) }));
|
|
25
|
+
}
|
|
26
|
+
function renderTooltipContent({ payload, nameFormatter, valueFormatter, radar, }) {
|
|
27
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
28
|
+
display: 'flex',
|
|
29
|
+
flexDirection: 'column',
|
|
30
|
+
boxShadow: react_components_1.tokens.shadow16,
|
|
31
|
+
backgroundColor: react_components_1.tokens.colorNeutralBackground1,
|
|
32
|
+
padding: 8,
|
|
33
|
+
borderRadius: 4,
|
|
34
|
+
gap: 4,
|
|
35
|
+
}, children: (0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', flexDirection: 'column', gap: 4 }, children: payload === null || payload === void 0 ? void 0 : 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: {
|
|
36
|
+
color: react_components_1.tokens.colorNeutralForeground4,
|
|
37
|
+
marginLeft: 8,
|
|
38
|
+
}, 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))) }) }));
|
|
33
39
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ScatterChartInfo } from '@headless-adminapp/core/experience/insights';
|
|
2
|
-
export declare function ScatterChart({ dataset, chartInfo, }: {
|
|
2
|
+
export declare function ScatterChart({ dataset, chartInfo, }: Readonly<{
|
|
3
3
|
dataset: any[];
|
|
4
4
|
chartInfo: ScatterChartInfo;
|
|
5
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
}>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -13,7 +13,8 @@ function ScatterChart({ dataset, chartInfo, }) {
|
|
|
13
13
|
var _a, _b;
|
|
14
14
|
return ((0, jsx_runtime_1.jsx)(recharts_1.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 : constants_1.defaultColors[index] }, index));
|
|
15
15
|
}), (0, jsx_runtime_1.jsx)(recharts_1.Tooltip, { cursor: false, content: (props) => {
|
|
16
|
-
|
|
16
|
+
var _a;
|
|
17
|
+
if (!props.active || !((_a = props.payload) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
17
18
|
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
|
|
18
19
|
}
|
|
19
20
|
return ((0, jsx_runtime_1.jsx)(ScatterTooltipContent, { active: props.active, payload: props.payload, chartInfo: chartInfo, dataset: dataset }));
|
|
@@ -9,6 +9,6 @@ export declare const formatDate: (input: Date | string | number | undefined | nu
|
|
|
9
9
|
export declare const formatCurrency: (input: number | undefined | null, digit?: number | FormatNumberOptions) => string;
|
|
10
10
|
export declare const formatNumber: (input: number | undefined | null, digit?: number | FormatNumberOptions) => string;
|
|
11
11
|
export declare function createAxisFormatter(tick: AllAxisTick): (value: number) => string;
|
|
12
|
-
type Formatter = (value: unknown) => string;
|
|
12
|
+
export type Formatter = (value: unknown) => string;
|
|
13
13
|
export declare function createLongAxisFormatter(tick: AllAxisTick): Formatter;
|
|
14
14
|
export {};
|
|
@@ -20,7 +20,7 @@ const OverflowCommandBar = ({ commands, align = 'start', afterDivider, beforeDiv
|
|
|
20
20
|
case 'button':
|
|
21
21
|
case 'label':
|
|
22
22
|
case 'icon':
|
|
23
|
-
return ((0, jsx_runtime_1.jsx)(react_components_1.OverflowItem, { id: `${groupIndex}-${index}`, groupId: String(groupIndex), children: (0, render_1.renderCommandItem)(`${groupIndex}-${index}`, item, language) }, index));
|
|
23
|
+
return ((0, jsx_runtime_1.jsx)(react_components_1.OverflowItem, { id: `${groupIndex}-${index}`, groupId: String(groupIndex), children: (0, render_1.renderCommandItem)(`${groupIndex}-${index}`, item, language) }, `${groupIndex}-${index}`));
|
|
24
24
|
default:
|
|
25
25
|
throw new Error(`Unknown command type: ${commandType}`);
|
|
26
26
|
}
|
|
@@ -31,7 +31,7 @@ const OverflowMenu = ({ items, }) => {
|
|
|
31
31
|
const text = 'text' in item ? (_a = item.text) !== null && _a !== void 0 ? _a : '' : '';
|
|
32
32
|
return ((0, jsx_runtime_1.jsx)(OverflowMenuItem, { id: `${groupIndex}-${index}`, Icon: item.Icon, onClick: item.type !== 'label' ? item.onClick : undefined, text: text, danger: item.danger, disabled: item.type !== 'label' ? item.disabled : undefined, items: item.type === 'menu'
|
|
33
33
|
? (_b = item.items) === null || _b === void 0 ? void 0 : _b.map((x) => (0, utils_1.transformMenuItems)(x, language))
|
|
34
|
-
: undefined }, index));
|
|
34
|
+
: undefined }, `${groupIndex}-${index}`));
|
|
35
35
|
})] }, groupIndex))) }) })] }));
|
|
36
36
|
};
|
|
37
37
|
exports.OverflowMenu = OverflowMenu;
|
|
@@ -100,23 +100,7 @@ function SecondaryColumnContent({ record: _record, column, schema, }) {
|
|
|
100
100
|
}
|
|
101
101
|
if (column.variant === 'choice') {
|
|
102
102
|
if (attribute.type === 'choice') {
|
|
103
|
-
|
|
104
|
-
if (!choice) {
|
|
105
|
-
return null;
|
|
106
|
-
}
|
|
107
|
-
const bgColor = choice.color;
|
|
108
|
-
let color;
|
|
109
|
-
if (bgColor) {
|
|
110
|
-
color = (0, color_1.isColorDark)(bgColor) ? '#FFFFFF' : '#000000';
|
|
111
|
-
}
|
|
112
|
-
return ((0, jsx_runtime_1.jsx)(react_components_1.Tag, { size: "extra-small", appearance: "filled", style: {
|
|
113
|
-
background: bgColor,
|
|
114
|
-
color: color,
|
|
115
|
-
height: 16,
|
|
116
|
-
display: 'flex',
|
|
117
|
-
alignItems: 'center',
|
|
118
|
-
justifyContent: 'center',
|
|
119
|
-
}, children: choice.label }, column.name));
|
|
103
|
+
return (0, jsx_runtime_1.jsx)(ChoiceTag, { attribute: attribute, value: value });
|
|
120
104
|
}
|
|
121
105
|
if (attribute.type === 'choices') {
|
|
122
106
|
const choices = attribute.options.filter((option) => value.includes(option.value));
|
|
@@ -127,15 +111,27 @@ function SecondaryColumnContent({ record: _record, column, schema, }) {
|
|
|
127
111
|
display: 'flex',
|
|
128
112
|
flexDirection: 'row',
|
|
129
113
|
gap: 4,
|
|
130
|
-
}, children: choices.map((choice) => ((0, jsx_runtime_1.jsx)(
|
|
131
|
-
background: choice.color,
|
|
132
|
-
color: 'white',
|
|
133
|
-
height: 16,
|
|
134
|
-
display: 'flex',
|
|
135
|
-
alignItems: 'center',
|
|
136
|
-
justifyContent: 'center',
|
|
137
|
-
}, children: choice.label }, choice.value))) }, column.name));
|
|
114
|
+
}, children: choices.map((choice) => ((0, jsx_runtime_1.jsx)(ChoiceTag, { attribute: attribute, value: choice.value }, choice.value))) }, column.name));
|
|
138
115
|
}
|
|
139
116
|
}
|
|
140
117
|
return ((0, jsx_runtime_1.jsxs)(react_components_1.Caption1, { style: { color: react_components_1.tokens.colorNeutralForeground4 }, children: [!!label && `${label}: `, (0, utils_1.getAttributeFormattedValue)(attribute, value)] }, column.name));
|
|
141
118
|
}
|
|
119
|
+
const ChoiceTag = ({ attribute, value, }) => {
|
|
120
|
+
const choice = attribute.options.find((option) => option.value === value);
|
|
121
|
+
if (!choice) {
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
const bgColor = choice.color;
|
|
125
|
+
let color;
|
|
126
|
+
if (bgColor) {
|
|
127
|
+
color = (0, color_1.isColorDark)(bgColor) ? '#FFFFFF' : '#000000';
|
|
128
|
+
}
|
|
129
|
+
return ((0, jsx_runtime_1.jsx)(react_components_1.Tag, { size: "extra-small", appearance: "filled", style: {
|
|
130
|
+
background: bgColor,
|
|
131
|
+
color: color,
|
|
132
|
+
height: 16,
|
|
133
|
+
display: 'flex',
|
|
134
|
+
alignItems: 'center',
|
|
135
|
+
justifyContent: 'center',
|
|
136
|
+
}, children: choice.label }));
|
|
137
|
+
};
|
package/form/FormControl.js
CHANGED
|
@@ -17,7 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
18
18
|
const react_components_1 = require("@fluentui/react-components");
|
|
19
19
|
const react_1 = require("react");
|
|
20
|
-
|
|
20
|
+
const uuid_1 = require("uuid");
|
|
21
21
|
const CurrencyControl_1 = require("./controls/CurrencyControl");
|
|
22
22
|
const DateControl_1 = require("./controls/DateControl");
|
|
23
23
|
const DateTimeControl_1 = require("./controls/DateTimeControl");
|
|
@@ -70,24 +70,13 @@ function Control(props) {
|
|
|
70
70
|
return ((0, jsx_runtime_1.jsx)(MultiSelectLookupControl_1.MultiSelectLookupControl, Object.assign({ value: value, onChange: onChange }, rest)));
|
|
71
71
|
case 'switch':
|
|
72
72
|
return ((0, jsx_runtime_1.jsx)(SwitchControl_1.SwitchControl, Object.assign({ value: value, onChange: onChange }, rest)));
|
|
73
|
-
// case 'attachment':
|
|
74
|
-
// return (
|
|
75
|
-
// <AttachmentControl
|
|
76
|
-
// value={value}
|
|
77
|
-
// onChange={onChange}
|
|
78
|
-
// {...(rest as any)}
|
|
79
|
-
// />
|
|
80
|
-
// );
|
|
81
73
|
default:
|
|
82
74
|
return (0, jsx_runtime_1.jsx)("div", {});
|
|
83
75
|
}
|
|
84
76
|
}
|
|
85
|
-
function randomUUID() {
|
|
86
|
-
return Math.random().toString(36).substring(2, 15);
|
|
87
|
-
}
|
|
88
77
|
function FormControl(props) {
|
|
89
78
|
const { label, id, onChange } = props;
|
|
90
|
-
const _id = (0, react_1.useMemo)(() => id
|
|
79
|
+
const _id = (0, react_1.useMemo)(() => id !== null && id !== void 0 ? id : (0, uuid_1.v4)(), [id]);
|
|
91
80
|
const noop = (0, react_1.useCallback)(() => { }, []);
|
|
92
81
|
return ((0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'column' }, children: [(0, jsx_runtime_1.jsx)(react_components_1.Label, { style: { width: 160, marginTop: 4 }, children: label }), (0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', flex: 1, flexDirection: 'column' }, children: (0, jsx_runtime_1.jsx)(Control, Object.assign({ id: _id, onChange: onChange || noop }, props)) })] }));
|
|
93
82
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@headless-adminapp/fluent",
|
|
3
|
-
"version": "0.0.17-alpha.
|
|
3
|
+
"version": "0.0.17-alpha.52",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"uuid": "11.0.3",
|
|
50
50
|
"yup": "^1.4.0"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "d51866b6ef09087e30a44a6a63f099075c6aea89"
|
|
53
53
|
}
|