@headless-adminapp/fluent 1.0.3 → 1.1.0
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 +5 -1
- package/App/AppUI.js +7 -2
- package/App/Navigation/NavCategoryItemComponent.d.ts +8 -0
- package/App/Navigation/NavCategoryItemComponent.js +20 -0
- package/App/Navigation/NavItemComponent.d.ts +8 -0
- package/App/Navigation/NavItemComponent.js +19 -0
- package/App/Navigation/NavSubItemComponent.d.ts +8 -0
- package/App/Navigation/NavSubItemComponent.js +17 -0
- package/App/Navigation/NavigationContainer.d.ts +9 -0
- package/App/Navigation/NavigationContainer.js +85 -0
- package/App/Navigation/index.d.ts +1 -0
- package/App/Navigation/index.js +5 -0
- package/App/Navigation/types.d.ts +39 -0
- package/App/Navigation/types.js +2 -0
- package/App/Navigation/utils.d.ts +18 -0
- package/App/Navigation/utils.js +82 -0
- package/App/QuickActionItem.d.ts +3 -0
- package/App/QuickActionItem.js +12 -3
- package/CommandBar/Button.d.ts +1 -0
- package/CommandBar/Button.js +22 -2
- package/CommandBar/IconButton.d.ts +1 -0
- package/CommandBar/MenuButton.d.ts +1 -0
- package/CommandBar/MenuItem.d.ts +1 -0
- package/DataGrid/GridColumnHeader/TableHeaderFilterCell.js +3 -1
- package/DataGrid/GridHeaderContainer.d.ts +1 -0
- package/DataGrid/GridHeaderContainer.js +6 -1
- package/DataGrid/GridHeaderDesktopV2.d.ts +6 -0
- package/DataGrid/GridHeaderDesktopV2.js +54 -0
- package/DataGrid/GridListContainer.js +9 -5
- package/DataGrid/GridTableContainer.d.ts +2 -0
- package/DataGrid/GridTableContainer.js +37 -13
- package/DataGrid/TableCell/TableCellAction.js +2 -1
- package/DataGrid/TableCell/TableCellBase.js +1 -0
- package/DataGrid/TableCell/TableCellLink.js +1 -0
- package/DataGrid/constants.d.ts +2 -0
- package/DataGrid/constants.js +5 -0
- package/DataGrid/useTableColumns.js +23 -6
- package/Insights/CommandBarContainer.js +1 -1
- package/Insights/FilterBarContainer.js +8 -8
- package/Insights/Grid.d.ts +7 -1
- package/Insights/Grid.js +24 -8
- package/Insights/Header.d.ts +6 -0
- package/Insights/Header.js +50 -0
- package/Insights/InsightsContainer.js +19 -14
- package/Insights/WidgetChartContainer.d.ts +13 -3
- package/Insights/WidgetChartContainer.js +62 -38
- package/Insights/WidgetDataGridContainer.d.ts +11 -4
- package/Insights/WidgetDataGridContainer.js +7 -28
- package/Insights/WidgetSection.d.ts +2 -0
- package/Insights/WidgetSection.js +16 -0
- package/Insights/WidgetTableContainer.d.ts +9 -2
- package/Insights/WidgetTableContainer.js +7 -18
- package/Insights/WidgetTileContainer.d.ts +0 -2
- package/Insights/WidgetTileContainer.js +8 -11
- package/Insights/WidgetTitleBar.d.ts +1 -1
- package/Insights/WidgetTitleBar.js +1 -1
- package/Insights/Widgets.d.ts +2 -2
- package/Insights/Widgets.js +15 -48
- package/Insights/charts/AreaChart.d.ts +1 -0
- package/Insights/charts/AreaChart.js +4 -1
- package/Insights/charts/BarChart.d.ts +1 -0
- package/Insights/charts/BarChart.js +3 -2
- package/Insights/charts/ComposedChart.d.ts +1 -0
- package/Insights/charts/ComposedChart.js +4 -1
- package/Insights/charts/FunnelChart.d.ts +6 -0
- package/Insights/charts/FunnelChart.js +50 -0
- package/Insights/charts/FunnelCustomTooltipContent.d.ts +5 -0
- package/Insights/charts/FunnelCustomTooltipContent.js +27 -0
- package/Insights/charts/GaugeChart.d.ts +1 -0
- package/Insights/charts/GaugeChart.js +1 -0
- package/Insights/charts/LineChart.d.ts +1 -0
- package/Insights/charts/LineChart.js +2 -2
- package/Insights/charts/OhlcChart.d.ts +1 -0
- package/Insights/charts/OhlcChart.js +1 -1
- package/Insights/charts/PieChart.d.ts +1 -0
- package/Insights/charts/PieChart.js +2 -1
- package/Insights/charts/RadarChart.d.ts +1 -0
- package/Insights/charts/RadarChart.js +1 -0
- package/Insights/charts/ScatterChart.d.ts +1 -0
- package/Insights/charts/ScatterChart.js +2 -1
- package/Insights/charts/renderers.d.ts +6 -5
- package/Insights/charts/renderers.js +16 -13
- package/Insights/constants.d.ts +4 -0
- package/Insights/constants.js +7 -0
- package/Insights/hooks/useQueriesData.d.ts +2 -2
- package/Insights/hooks/useQueriesData.js +0 -1
- package/OverflowCommandBar/render.js +3 -3
- package/PageBoard/BoardColumnUI.js +36 -7
- package/PageBoard/Header.js +5 -3
- package/PageBoard/PageBoard.js +7 -1
- package/PageCalendar/CalendarSection.js +37 -8
- package/PageCalendar/EventDialog/AttributeController.d.ts +2 -1
- package/PageCalendar/EventDialog/AttributeController.js +2 -2
- package/PageCalendar/EventDialog/EventFormBody.js +17 -2
- package/PageCalendar/EventDialog/EventFormContent.d.ts +4 -1
- package/PageCalendar/EventDialog/EventFormContent.js +7 -7
- package/PageCalendar/Header.js +1 -1
- package/PageCalendar/PageCalendar.js +6 -1
- package/PageCalendar/TitleSelector.js +8 -4
- package/PageEntityForm/PageEntityFormDesktopContainer.js +4 -0
- package/PageEntityForm/RecordAvatar.js +1 -2
- package/PageEntityForm/RecordCard.js +17 -28
- package/PageEntityForm/RelatedViewSelector.js +1 -0
- package/PageEntityForm/SectionContainer.js +7 -1
- package/PageEntityView/PageEntityView.d.ts +1 -0
- package/PageEntityView/PageEntityView.js +12 -2
- package/PageEntityView/PageEntityViewDesktopContainer.d.ts +1 -0
- package/PageEntityView/PageEntityViewDesktopContainer.js +7 -3
- package/PageEntityView/PageEntityViewDesktopFrame.js +1 -1
- package/PageEntityView/PageEntityViewDesktopFrameV2.d.ts +8 -0
- package/PageEntityView/PageEntityViewDesktopFrameV2.js +48 -0
- package/PageEntityView/PageEntityViewMobileContainer.js +2 -3
- package/PageEntityView/PageEntityViewMobileFrame.d.ts +8 -0
- package/PageEntityView/PageEntityViewMobileFrame.js +38 -0
- package/PageInsight/PageInsight.d.ts +7 -0
- package/PageInsight/PageInsight.js +31 -0
- package/PageInsight/index.d.ts +1 -0
- package/PageInsight/index.js +5 -0
- package/PageInsights/PageInsights.d.ts +5 -7
- package/PageInsights/PageInsights.js +24 -18
- package/PageInsights/index.d.ts +1 -1
- package/PageInsights/index.js +1 -2
- package/components/ComponentBroken.d.ts +7 -0
- package/components/ComponentBroken.js +16 -0
- package/components/ComponentErrorBoundary.d.ts +15 -0
- package/components/ComponentErrorBoundary.js +26 -0
- package/form/controls/DateTimeControl.js +17 -3
- package/form/controls/DurationControl.js +0 -2
- package/form/controls/LookupControl.js +6 -3
- package/package.json +3 -3
|
@@ -74,14 +74,18 @@ const GridListContainer = () => {
|
|
|
74
74
|
flexDirection: 'column',
|
|
75
75
|
}, children: virtualItems.map((virtualRow) => {
|
|
76
76
|
const row = rows[virtualRow.index];
|
|
77
|
-
return ((0, jsx_runtime_1.
|
|
77
|
+
return ((0, jsx_runtime_1.jsxs)("div", { ref: virtualizer.measureElement, "data-index": virtualRow.index, style: {
|
|
78
78
|
width: '100%',
|
|
79
79
|
position: 'absolute',
|
|
80
80
|
transform: `translateY(${virtualRow.start}px)`,
|
|
81
|
-
},
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
81
|
+
}, children: [virtualRow.index > 0 && ((0, jsx_runtime_1.jsx)("div", { style: { paddingBlock: 0 }, children: (0, jsx_runtime_1.jsx)(react_components_1.Divider, { style: { opacity: 0.2 } }) })), (0, jsx_runtime_1.jsx)("div", { className: (0, react_components_1.mergeClasses)(styles.root), style: {
|
|
82
|
+
width: '100%',
|
|
83
|
+
cursor: 'pointer',
|
|
84
|
+
borderRadius: react_components_1.tokens.borderRadiusMedium,
|
|
85
|
+
}, onClick: () => {
|
|
86
|
+
const id = row[schema.idAttribute];
|
|
87
|
+
openRecord(id);
|
|
88
|
+
}, children: (0, jsx_runtime_1.jsx)(RecordCard_1.RecordCard, { cardView: view.experience.card, record: row, schema: schema, selected: false }) })] }, virtualRow.key));
|
|
85
89
|
}) }), dataState.isFetching && ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
86
90
|
display: 'flex',
|
|
87
91
|
flexDirection: 'column',
|
|
@@ -7,6 +7,8 @@ interface GridTableContainerProps {
|
|
|
7
7
|
disableColumnReorder?: boolean;
|
|
8
8
|
disableColumnFilter?: boolean;
|
|
9
9
|
noPadding?: boolean;
|
|
10
|
+
headerHeight?: number;
|
|
11
|
+
rowHeight?: number;
|
|
10
12
|
}
|
|
11
13
|
export declare const GridTableContainer: FC<GridTableContainerProps>;
|
|
12
14
|
export {};
|
|
@@ -16,17 +16,19 @@ const react_virtual_1 = require("@tanstack/react-virtual");
|
|
|
16
16
|
const react_1 = require("react");
|
|
17
17
|
const uuid_1 = require("uuid");
|
|
18
18
|
const PageEntityViewStringContext_1 = require("../PageEntityView/PageEntityViewStringContext");
|
|
19
|
+
const constants_1 = require("./constants");
|
|
19
20
|
const useTableColumns_1 = require("./useTableColumns");
|
|
20
21
|
const utils_1 = require("./utils");
|
|
21
22
|
const useStyles = (0, react_components_1.makeStyles)({
|
|
22
23
|
root: {
|
|
23
24
|
'[aria-selected="true"]': {
|
|
24
|
-
background: react_components_1.tokens.
|
|
25
|
+
background: react_components_1.tokens.colorSubtleBackgroundHover,
|
|
25
26
|
'& .fui-TableSelectionCell': {
|
|
26
27
|
background: 'inherit',
|
|
27
28
|
},
|
|
28
29
|
'& .tableCellAction': {
|
|
29
30
|
background: 'inherit',
|
|
31
|
+
opacity: 1,
|
|
30
32
|
},
|
|
31
33
|
},
|
|
32
34
|
'&:hover': {
|
|
@@ -36,16 +38,30 @@ const useStyles = (0, react_components_1.makeStyles)({
|
|
|
36
38
|
},
|
|
37
39
|
'& .tableCellAction': {
|
|
38
40
|
background: 'inherit !important',
|
|
41
|
+
opacity: 1,
|
|
42
|
+
'& > button': {
|
|
43
|
+
opacity: 1,
|
|
44
|
+
},
|
|
39
45
|
},
|
|
40
46
|
},
|
|
41
47
|
'& .tableCellAction': {
|
|
42
48
|
background: react_components_1.tokens.colorNeutralBackground1,
|
|
49
|
+
opacity: 0,
|
|
50
|
+
'& > button': {
|
|
51
|
+
opacity: 0,
|
|
52
|
+
'[aria-expanded="true"],&:hover': {
|
|
53
|
+
opacity: 1,
|
|
54
|
+
},
|
|
55
|
+
},
|
|
43
56
|
},
|
|
44
57
|
borderBottom: `${react_components_1.tokens.strokeWidthThin} solid ${react_components_1.tokens.colorNeutralStroke3}`,
|
|
45
58
|
'& .fui-TableCell': {
|
|
46
59
|
// borderBottom: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStroke3}`,
|
|
47
60
|
// borderBottom: 'none !important',
|
|
48
61
|
},
|
|
62
|
+
'&:last-of-type': {
|
|
63
|
+
borderBottom: 'none',
|
|
64
|
+
},
|
|
49
65
|
},
|
|
50
66
|
selectionCell: {
|
|
51
67
|
position: 'sticky',
|
|
@@ -56,7 +72,6 @@ const useStyles = (0, react_components_1.makeStyles)({
|
|
|
56
72
|
alignItems: 'center',
|
|
57
73
|
},
|
|
58
74
|
table: {
|
|
59
|
-
color: 'yellow',
|
|
60
75
|
'&:after': {
|
|
61
76
|
content: ' ',
|
|
62
77
|
display: 'block',
|
|
@@ -65,7 +80,7 @@ const useStyles = (0, react_components_1.makeStyles)({
|
|
|
65
80
|
},
|
|
66
81
|
});
|
|
67
82
|
const fallbackData = [];
|
|
68
|
-
const GridTableContainer = ({ noPadding, disableColumnFilter, disableColumnSort, disableColumnResize, disableContextMenu, disableSelection, }) => {
|
|
83
|
+
const GridTableContainer = ({ noPadding, disableColumnFilter, disableColumnSort, disableColumnResize, disableContextMenu, disableSelection, headerHeight = constants_1.DEFAULT_TABLE_HEADER_HEIGHT, rowHeight = constants_1.DEFAULT_TABLE_ROW_HEIGHT, }) => {
|
|
69
84
|
const styles = useStyles();
|
|
70
85
|
const data = (0, hooks_1.useGridData)();
|
|
71
86
|
const dataState = (0, hooks_1.useGridDataState)();
|
|
@@ -76,6 +91,7 @@ const GridTableContainer = ({ noPadding, disableColumnFilter, disableColumnSort,
|
|
|
76
91
|
const [selectedIds, setSelectedIds] = (0, hooks_1.useGridSelection)();
|
|
77
92
|
const setSelectedIdsRef = (0, react_1.useRef)(setSelectedIds);
|
|
78
93
|
setSelectedIdsRef.current = setSelectedIds;
|
|
94
|
+
const [isScrolled, setIsScrolled] = (0, react_1.useState)(false);
|
|
79
95
|
const sortingState = (0, react_1.useMemo)(() => {
|
|
80
96
|
return sorting.map((sort) => ({
|
|
81
97
|
id: sort.field,
|
|
@@ -146,9 +162,9 @@ const GridTableContainer = ({ noPadding, disableColumnFilter, disableColumnSort,
|
|
|
146
162
|
const virtualizer = (0, react_virtual_1.useVirtualizer)({
|
|
147
163
|
count: rows.length,
|
|
148
164
|
getScrollElement: () => tableWrapperRef.current?.parentElement?.parentElement,
|
|
149
|
-
estimateSize: () =>
|
|
165
|
+
estimateSize: () => rowHeight,
|
|
150
166
|
overscan: 30,
|
|
151
|
-
paddingStart:
|
|
167
|
+
paddingStart: headerHeight,
|
|
152
168
|
});
|
|
153
169
|
const tableElementRef = (0, react_1.useRef)(null);
|
|
154
170
|
const virtualItems = virtualizer.getVirtualItems();
|
|
@@ -158,12 +174,13 @@ const GridTableContainer = ({ noPadding, disableColumnFilter, disableColumnSort,
|
|
|
158
174
|
const handlePseudoResize = (0, react_1.useCallback)(() => {
|
|
159
175
|
return (0, utils_1.adjustTableHeight)(tableElementRef, virtualSize);
|
|
160
176
|
}, [virtualSize]);
|
|
161
|
-
// callback to handle scrolling, checking if we are near the bottom
|
|
177
|
+
// callback to handle scrolling, checking if we are near the bottom or top
|
|
162
178
|
const handleScroll = (0, react_1.useCallback)(() => {
|
|
163
179
|
if (tableWrapperRef.current?.parentElement?.parentElement) {
|
|
164
180
|
const scrollPosition = tableWrapperRef.current?.parentElement?.parentElement?.scrollTop;
|
|
165
181
|
const visibleHeight = tableWrapperRef.current?.parentElement?.parentElement?.clientHeight;
|
|
166
182
|
setIsScrollNearBottom(scrollPosition > virtualSize * 0.95 - visibleHeight);
|
|
183
|
+
setIsScrolled(scrollPosition > 0);
|
|
167
184
|
}
|
|
168
185
|
}, [virtualSize]);
|
|
169
186
|
// add an event listener on the scrollable parent container and resize the
|
|
@@ -188,17 +205,18 @@ const GridTableContainer = ({ noPadding, disableColumnFilter, disableColumnSort,
|
|
|
188
205
|
const isScrolledToRight = tableWrapperRef.current?.parentElement?.parentElement?.scrollLeft ===
|
|
189
206
|
(tableWrapperRef.current?.parentElement?.parentElement?.scrollWidth ?? 0) -
|
|
190
207
|
(tableWrapperRef.current?.parentElement?.parentElement?.clientWidth ?? 0);
|
|
208
|
+
const hPadding = noPadding ? 0 : 8;
|
|
191
209
|
return ((0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', flex: 1, flexDirection: 'column' }, children: (0, jsx_runtime_1.jsxs)(ScrollbarWithMoreDataRequest_1.ScrollbarWithMoreDataRequest, { data: data?.records, hasMore: dataState?.hasNextPage, rtl: direction === 'rtl', onRequestMore: () => {
|
|
192
210
|
fetchNextPage();
|
|
193
211
|
}, children: [(0, jsx_runtime_1.jsx)("div", { style: {
|
|
194
|
-
paddingInline:
|
|
212
|
+
paddingInline: hPadding,
|
|
195
213
|
position: 'relative',
|
|
196
214
|
}, ref: tableWrapperRef, children: (0, jsx_runtime_1.jsxs)(react_components_1.Table, { style: {
|
|
197
215
|
display: 'flex',
|
|
198
216
|
flexDirection: 'column',
|
|
199
217
|
borderCollapse: 'collapse',
|
|
200
218
|
width: '100%',
|
|
201
|
-
height: virtualizer.getTotalSize() +
|
|
219
|
+
height: virtualizer.getTotalSize() + headerHeight,
|
|
202
220
|
['--action-shadow']: !isScrolledToRight
|
|
203
221
|
? '-2px 0px 6px rgba(0, 0, 0, 0.12)'
|
|
204
222
|
: 'none',
|
|
@@ -208,12 +226,18 @@ const GridTableContainer = ({ noPadding, disableColumnFilter, disableColumnSort,
|
|
|
208
226
|
top: 0,
|
|
209
227
|
background: react_components_1.tokens.colorNeutralBackground1,
|
|
210
228
|
zIndex: 2,
|
|
229
|
+
boxShadow: isScrolled && noPadding ? react_components_1.tokens.shadow2 : 'none',
|
|
211
230
|
}, children: table.getHeaderGroups().map((headerGroup) => ((0, jsx_runtime_1.jsx)(react_components_1.TableRow, { style: {
|
|
212
231
|
position: 'sticky',
|
|
213
232
|
top: 0,
|
|
214
233
|
display: 'flex',
|
|
215
|
-
minWidth: 'calc(100%
|
|
216
|
-
|
|
234
|
+
minWidth: 'calc(100%)',
|
|
235
|
+
borderBottomColor: isScrolled && noPadding
|
|
236
|
+
? 'transparent'
|
|
237
|
+
: react_components_1.tokens.colorNeutralStroke3,
|
|
238
|
+
borderBottomStyle: 'solid',
|
|
239
|
+
borderBottomWidth: react_components_1.tokens.strokeWidthThin,
|
|
240
|
+
height: headerHeight,
|
|
217
241
|
}, children: headerGroup.headers.map((header) => header.isPlaceholder
|
|
218
242
|
? null
|
|
219
243
|
: (0, react_table_1.flexRender)(header.column.columnDef.header, {
|
|
@@ -222,13 +246,13 @@ const GridTableContainer = ({ noPadding, disableColumnFilter, disableColumnSort,
|
|
|
222
246
|
})) }, headerGroup.id))) }), (0, jsx_runtime_1.jsx)(react_components_1.TableBody, { style: {
|
|
223
247
|
display: 'flex',
|
|
224
248
|
flexDirection: 'column',
|
|
225
|
-
transform:
|
|
249
|
+
transform: `translateY(-${headerHeight}px)`,
|
|
226
250
|
}, children: virtualItems.map((virtualRow) => {
|
|
227
251
|
const row = rows[virtualRow.index];
|
|
228
252
|
return ((0, jsx_runtime_1.jsx)(react_components_1.TableRow, { "aria-selected": row.getIsSelected(), className: (0, react_components_1.mergeClasses)(styles.root), style: {
|
|
229
253
|
display: 'flex',
|
|
230
254
|
height: `${virtualRow.size}px`,
|
|
231
|
-
minWidth:
|
|
255
|
+
minWidth: `calc(100% - ${hPadding * 2}px)`,
|
|
232
256
|
position: 'absolute',
|
|
233
257
|
transform: `translateY(${virtualRow.start}px)`,
|
|
234
258
|
}, onClick: () => {
|
|
@@ -250,7 +274,7 @@ const GridTableContainer = ({ noPadding, disableColumnFilter, disableColumnSort,
|
|
|
250
274
|
transform: `translateY(${virtualSize}px)`,
|
|
251
275
|
}, children: Array.from({ length: 10 }).map((_, index) => ((0, jsx_runtime_1.jsx)(react_components_1.TableRow, { style: {
|
|
252
276
|
display: 'flex',
|
|
253
|
-
height:
|
|
277
|
+
height: rowHeight,
|
|
254
278
|
alignItems: 'center',
|
|
255
279
|
}, children: table.getAllColumns().map((column) => {
|
|
256
280
|
if (!column.getIsVisible())
|
|
@@ -26,10 +26,11 @@ const TableCellAction = ({ items, onOpen, }) => {
|
|
|
26
26
|
right: 0,
|
|
27
27
|
// top: 0,
|
|
28
28
|
zIndex: 1,
|
|
29
|
+
height: '100%',
|
|
29
30
|
justifyContent: 'right',
|
|
30
31
|
// background: 'white',
|
|
31
32
|
// boxShadow: '0 0 10px rgba(0, 0, 0, 0.1)',
|
|
32
|
-
borderBottom: `${
|
|
33
|
+
// borderBottom: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStroke3}`,
|
|
33
34
|
}, children: (0, jsx_runtime_1.jsxs)(react_components_1.Menu, { positioning: "before-top", children: [(0, jsx_runtime_1.jsx)(react_components_1.MenuTrigger, { children: (0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "transparent", icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.MoreVertical, {}), onClick: onOpen, className: styles.button, style: {
|
|
34
35
|
// background: 'white',
|
|
35
36
|
// boxShadow: '0 0 10px rgba(0, 0, 0, 0.1)',
|
|
@@ -7,6 +7,7 @@ const TableCellBase = ({ children, onClick, style, }) => {
|
|
|
7
7
|
return ((0, jsx_runtime_1.jsx)(react_components_1.TableCell, { onClick: onClick, style: {
|
|
8
8
|
display: 'flex',
|
|
9
9
|
alignItems: 'center',
|
|
10
|
+
height: '100%',
|
|
10
11
|
// borderBottom: `var(--strokeWidthThin) solid var(--colorNeutralStroke2)`,
|
|
11
12
|
...style,
|
|
12
13
|
}, children: children }));
|
|
@@ -16,6 +16,7 @@ exports.TableCellLink = (0, react_1.memo)(({ value, href, onClick, width, target
|
|
|
16
16
|
maxWidth: width,
|
|
17
17
|
display: 'flex',
|
|
18
18
|
alignItems: 'center',
|
|
19
|
+
height: '100%',
|
|
19
20
|
}, children: (0, jsx_runtime_1.jsx)(react_components_1.Link, { as: "a", href: href, target: target, onClick: (event) => {
|
|
20
21
|
if (target === '_blank') {
|
|
21
22
|
return;
|
|
@@ -61,13 +61,28 @@ function useTableColumns({ disableSelection, disableContextMenu, disableColumnRe
|
|
|
61
61
|
const { columns: calculatedColumns } = (0, utils_1.calculateColumnWidths)({
|
|
62
62
|
availableWidth,
|
|
63
63
|
gapWidth: 0,
|
|
64
|
-
columns: columns.map((column) =>
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
64
|
+
columns: columns.map((column) => {
|
|
65
|
+
const attribute = schema.attributes[column.name];
|
|
66
|
+
let defaultMaxWidth = 1000;
|
|
67
|
+
if (attribute.type === 'date') {
|
|
68
|
+
if (attribute.format === 'datetime') {
|
|
69
|
+
defaultMaxWidth = 200;
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
defaultMaxWidth = 100;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
else if (attribute.type === 'money') {
|
|
76
|
+
defaultMaxWidth = 150;
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
width: column.width ?? 100,
|
|
80
|
+
maxWidth: column.maxWidth ?? defaultMaxWidth,
|
|
81
|
+
};
|
|
82
|
+
}),
|
|
68
83
|
});
|
|
69
84
|
return calculatedColumns;
|
|
70
|
-
}, [columns, tableWrapperSize.width]);
|
|
85
|
+
}, [columns, tableWrapperSize.width, schema.attributes]);
|
|
71
86
|
const gridColumns = (0, hooks_1.useGridColumns)();
|
|
72
87
|
const routeResolver = (0, hooks_5.useRouteResolver)();
|
|
73
88
|
const router = (0, hooks_5.useRouter)();
|
|
@@ -105,7 +120,7 @@ function useTableColumns({ disableSelection, disableContextMenu, disableColumnRe
|
|
|
105
120
|
top: 0,
|
|
106
121
|
// zIndex: 1,
|
|
107
122
|
background: react_components_1.tokens.colorNeutralBackground1,
|
|
108
|
-
borderBottom: `${
|
|
123
|
+
// borderBottom: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStroke3}`,
|
|
109
124
|
}, children: "\u00A0" })),
|
|
110
125
|
cell: (info) => ((0, jsx_runtime_1.jsx)(ActionCell_1.ActionCell, { onOpen: () => {
|
|
111
126
|
const id = info.row.original[schema.idAttribute];
|
|
@@ -157,6 +172,7 @@ function useTableColumns({ disableSelection, disableContextMenu, disableColumnRe
|
|
|
157
172
|
width: 32,
|
|
158
173
|
maxWidth: 32,
|
|
159
174
|
minWidth: 32,
|
|
175
|
+
alignItems: 'center',
|
|
160
176
|
}, onClick: toggleAllSelectedIds })),
|
|
161
177
|
cell: (info) => ((0, jsx_runtime_1.jsx)(react_components_1.TableSelectionCell, { className: (0, react_components_1.mergeClasses)(styles.selectionCell), checked: info.row.getIsSelected(), onClick: (event) => {
|
|
162
178
|
event.preventDefault();
|
|
@@ -289,6 +305,7 @@ function renderCellContent({ info, column, schema, schemaStore, locale, routeRes
|
|
|
289
305
|
}
|
|
290
306
|
switch (attribute?.type) {
|
|
291
307
|
case 'money':
|
|
308
|
+
case 'number':
|
|
292
309
|
return ((0, jsx_runtime_1.jsx)(TableCell_1.TableCellText, { value: formattedValue, width: info.column.getSize(), textAlignment: "right" }, column.id));
|
|
293
310
|
case 'lookup': {
|
|
294
311
|
return renderLookupAttribute({
|
|
@@ -9,7 +9,7 @@ const mutable_1 = require("@headless-adminapp/app/mutable");
|
|
|
9
9
|
const OverflowCommandBar_1 = require("../OverflowCommandBar");
|
|
10
10
|
function CommandBarContainer() {
|
|
11
11
|
const baseCommandHandleContext = (0, hooks_1.useBaseCommandHandlerContext)();
|
|
12
|
-
const insightExpereince = (0, mutable_1.useContextSelector)(insights_1.InsightsContext, (x) => x.
|
|
12
|
+
const insightExpereince = (0, mutable_1.useContextSelector)(insights_1.InsightsContext, (x) => x.config);
|
|
13
13
|
const transformedCommands = (0, command_1.useCommands)([insightExpereince.commands], {
|
|
14
14
|
...baseCommandHandleContext,
|
|
15
15
|
primaryControl: {},
|
|
@@ -12,16 +12,16 @@ const OverflowCommandBar_1 = require("../OverflowCommandBar");
|
|
|
12
12
|
function FilterBarContainer() {
|
|
13
13
|
const openPromptDialog = (0, hooks_1.useOpenPromptDialog)();
|
|
14
14
|
const insightsState = (0, mutable_1.useContextSelector)(insights_1.InsightsContext, (state) => state);
|
|
15
|
-
const insightExpereince = insightsState.
|
|
15
|
+
const insightExpereince = insightsState.config;
|
|
16
16
|
const setValue = (0, mutable_1.useContextSetValue)(insights_1.InsightsContext);
|
|
17
17
|
const handleOpenPromptDialog = async () => {
|
|
18
18
|
const attributes = insightExpereince.filters.reduce((acc, item) => {
|
|
19
19
|
acc[item.logicalName] =
|
|
20
|
-
insightsState.
|
|
20
|
+
insightsState.config.filterAttributes[item.logicalName];
|
|
21
21
|
return acc;
|
|
22
22
|
}, {});
|
|
23
23
|
const defaultValues = insightExpereince.filters.reduce((acc, item) => {
|
|
24
|
-
acc[item.logicalName] = insightsState.
|
|
24
|
+
acc[item.logicalName] = insightsState.filterValues[item.logicalName];
|
|
25
25
|
return acc;
|
|
26
26
|
}, {});
|
|
27
27
|
const result = await openPromptDialog({
|
|
@@ -34,14 +34,14 @@ function FilterBarContainer() {
|
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
36
36
|
setValue({
|
|
37
|
-
|
|
37
|
+
filterValues: result,
|
|
38
38
|
});
|
|
39
39
|
};
|
|
40
40
|
const filterCommandItems = insightExpereince.filters
|
|
41
41
|
.map((item) => {
|
|
42
42
|
const logicalName = item.logicalName;
|
|
43
|
-
const value = insightsState.
|
|
44
|
-
const attribute = insightsState.
|
|
43
|
+
const value = insightsState.filterValues[logicalName];
|
|
44
|
+
const attribute = insightsState.config.filterAttributes[logicalName];
|
|
45
45
|
if (!item.showInFilterBar) {
|
|
46
46
|
return null;
|
|
47
47
|
}
|
|
@@ -68,8 +68,8 @@ function FilterBarContainer() {
|
|
|
68
68
|
return;
|
|
69
69
|
}
|
|
70
70
|
setValue({
|
|
71
|
-
|
|
72
|
-
...insightsState.
|
|
71
|
+
filterValues: {
|
|
72
|
+
...insightsState.filterValues,
|
|
73
73
|
[logicalName]: result[logicalName],
|
|
74
74
|
},
|
|
75
75
|
});
|
package/Insights/Grid.d.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import { PropsWithChildren } from 'react';
|
|
1
|
+
import { FC, PropsWithChildren } from 'react';
|
|
2
2
|
export declare function WidgetGrid({ children }: PropsWithChildren): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
interface WidgetGridGroupProps {
|
|
4
|
+
column?: number;
|
|
5
|
+
row?: number;
|
|
6
|
+
}
|
|
7
|
+
export declare const WidgetGridGroup: FC<PropsWithChildren<WidgetGridGroupProps>>;
|
|
3
8
|
export declare function WidgetGridItem({ column, row, children, }: PropsWithChildren<{
|
|
4
9
|
column?: number;
|
|
5
10
|
row?: number;
|
|
6
11
|
}>): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
package/Insights/Grid.js
CHANGED
|
@@ -1,26 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WidgetGridGroup = void 0;
|
|
3
4
|
exports.WidgetGrid = WidgetGrid;
|
|
4
5
|
exports.WidgetGridItem = WidgetGridItem;
|
|
5
6
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
-
const
|
|
7
|
-
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const constants_1 = require("./constants");
|
|
9
|
+
const Grid = ({ children, column = 12, gap, }) => {
|
|
10
|
+
const gridTemplateColumns = (0, react_1.useMemo)(() => Array.from({ length: column }, () => '1fr').join(' '), [column]);
|
|
8
11
|
return ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
9
|
-
padding: react_components_1.tokens.spacingHorizontalM,
|
|
10
12
|
width: '100%',
|
|
11
|
-
// flex: 1,
|
|
12
13
|
display: 'grid',
|
|
13
|
-
gridTemplateColumns
|
|
14
|
-
rowGap:
|
|
15
|
-
columnGap:
|
|
14
|
+
gridTemplateColumns,
|
|
15
|
+
rowGap: gap,
|
|
16
|
+
columnGap: gap,
|
|
16
17
|
}, children: children }));
|
|
18
|
+
};
|
|
19
|
+
function WidgetGrid({ children }) {
|
|
20
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
21
|
+
padding: constants_1.GAP,
|
|
22
|
+
width: '100%',
|
|
23
|
+
}, children: (0, jsx_runtime_1.jsx)(Grid, { column: 12, gap: constants_1.GAP, children: children }) }));
|
|
17
24
|
}
|
|
25
|
+
const WidgetGridGroup = ({ children, column = 12, row = 1, }) => {
|
|
26
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
27
|
+
display: 'flex',
|
|
28
|
+
flexDirection: 'column',
|
|
29
|
+
gridColumn: column ? `span ${column}` : undefined,
|
|
30
|
+
gridRow: row ? `span ${row}` : undefined,
|
|
31
|
+
}, children: (0, jsx_runtime_1.jsx)(Grid, { column: column, gap: constants_1.GAP, children: children }) }));
|
|
32
|
+
};
|
|
33
|
+
exports.WidgetGridGroup = WidgetGridGroup;
|
|
18
34
|
function WidgetGridItem({ column, row, children, }) {
|
|
19
35
|
return ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
20
36
|
display: 'flex',
|
|
21
37
|
flexDirection: 'column',
|
|
22
38
|
gridColumn: column ? `span ${column}` : undefined,
|
|
23
39
|
gridRow: row ? `span ${row}` : undefined,
|
|
24
|
-
height: row ?
|
|
40
|
+
height: row ? constants_1.ROW_HEIGHT * row + constants_1.ROW_GAP * (row - 1) : constants_1.ROW_HEIGHT,
|
|
25
41
|
}, children: children }));
|
|
26
42
|
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Header = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
const insights_1 = require("@headless-adminapp/app/insights");
|
|
7
|
+
const mutable_1 = require("@headless-adminapp/app/mutable");
|
|
8
|
+
const icons_1 = require("@headless-adminapp/icons");
|
|
9
|
+
const react_1 = require("react");
|
|
10
|
+
const react_hook_form_1 = require("react-hook-form");
|
|
11
|
+
const StandardControl_1 = require("../PageEntityForm/StandardControl");
|
|
12
|
+
const Header = () => {
|
|
13
|
+
const config = (0, mutable_1.useContextSelector)(insights_1.InsightsContext, (state) => state.config);
|
|
14
|
+
const eventManager = (0, mutable_1.useContextSelector)(insights_1.InsightsContext, (state) => state.eventManager);
|
|
15
|
+
const filterForm = (0, react_hook_form_1.useFormContext)();
|
|
16
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
17
|
+
display: 'flex',
|
|
18
|
+
flexDirection: 'column',
|
|
19
|
+
// background: tokens.colorNeutralBackground1,
|
|
20
|
+
// borderRadius: tokens.borderRadiusLarge,
|
|
21
|
+
paddingBlock: react_components_1.tokens.spacingVerticalM,
|
|
22
|
+
paddingInline: react_components_1.tokens.spacingHorizontalXL, // spacingMapping[insightsState.style?.spacing ?? 'normal'],
|
|
23
|
+
gap: react_components_1.tokens.spacingVerticalS,
|
|
24
|
+
// borderRadius: radiusMapping[insightsState.style?.radius ?? 'normal'],
|
|
25
|
+
// boxShadow: tokens.shadow2,
|
|
26
|
+
// boxShadow: isScrolled ? tokens.shadow2 : 'none',
|
|
27
|
+
// backgroundColor: isScrolled
|
|
28
|
+
// ? tokens.colorNeutralBackground1
|
|
29
|
+
// : 'transparent',
|
|
30
|
+
// backdropFilter: isScrolled ? 'blur(15px)' : 'none',
|
|
31
|
+
boxShadow: react_components_1.tokens.shadow4,
|
|
32
|
+
backgroundColor: react_components_1.tokens.colorNeutralBackground1,
|
|
33
|
+
// backdropFilter: 'blur(20px)',
|
|
34
|
+
}, children: [(0, jsx_runtime_1.jsxs)("div", { style: {
|
|
35
|
+
display: 'flex',
|
|
36
|
+
alignItems: 'center',
|
|
37
|
+
gap: react_components_1.tokens.spacingHorizontalM,
|
|
38
|
+
}, children: [(0, jsx_runtime_1.jsx)("div", { style: { flex: 1 }, children: (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'column' }, children: [(0, jsx_runtime_1.jsx)(react_components_1.Subtitle2, { style: { color: react_components_1.tokens.colorNeutralForeground1 }, children: "Dashboard" }), (0, jsx_runtime_1.jsx)(react_components_1.Caption1, { style: { color: react_components_1.tokens.colorNeutralForeground2 }, children: "Dashboard for insights" })] }) }) }), (0, jsx_runtime_1.jsx)("div", { style: {
|
|
39
|
+
display: 'flex',
|
|
40
|
+
alignItems: 'center',
|
|
41
|
+
gap: react_components_1.tokens.spacingHorizontalS,
|
|
42
|
+
}, children: (0, jsx_runtime_1.jsx)(react_components_1.Button, { icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.Refresh, {}), appearance: "subtle", style: { fontWeight: react_components_1.tokens.fontWeightRegular }, onClick: () => {
|
|
43
|
+
eventManager.emit('INSIGHT_REFRESH_TRIGGER');
|
|
44
|
+
}, children: "Refresh" }) })] }), !!config.filterAttributes && ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_components_1.Divider, { style: { opacity: 0.2 } }), (0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', gap: react_components_1.tokens.spacingHorizontalS }, children: Object.entries(config.filterAttributes).map(([attributeName, attribute]) => {
|
|
45
|
+
return ((0, jsx_runtime_1.jsx)(react_hook_form_1.Controller, { control: filterForm.control, name: attributeName, render: ({ field }) => {
|
|
46
|
+
return ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(StandardControl_1.StandardControl, { attribute: attribute, name: attributeName, value: field.value, onChange: field.onChange, onBlur: field.onBlur }) }));
|
|
47
|
+
} }, attributeName));
|
|
48
|
+
}) })] }))] }));
|
|
49
|
+
};
|
|
50
|
+
exports.Header = Header;
|
|
@@ -6,30 +6,35 @@ const react_components_1 = require("@fluentui/react-components");
|
|
|
6
6
|
const ScrollView_1 = require("@headless-adminapp/app/components/ScrollView");
|
|
7
7
|
const insights_1 = require("@headless-adminapp/app/insights");
|
|
8
8
|
const mutable_1 = require("@headless-adminapp/app/mutable");
|
|
9
|
-
const
|
|
10
|
-
const
|
|
9
|
+
const react_1 = require("react");
|
|
10
|
+
const Header_1 = require("./Header");
|
|
11
11
|
const Widgets_1 = require("./Widgets");
|
|
12
12
|
function InsightsContainer() {
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const titleButton = ((0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "subtle", style: { pointerEvents: 'auto' }, children: (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'column' }, children: [(0, jsx_runtime_1.jsx)(react_components_1.Subtitle2, { style: { color: react_components_1.tokens.colorNeutralForeground1 }, children: insightExpereince.title }), (0, jsx_runtime_1.jsx)(react_components_1.Caption1, { style: { color: react_components_1.tokens.colorNeutralForeground2 }, children: insightExpereince.subtitle })] }) }));
|
|
13
|
+
const config = (0, mutable_1.useContextSelector)(insights_1.InsightsContext, (state) => state.config);
|
|
14
|
+
const [isScrolled, setIsScrolled] = (0, react_1.useState)(false);
|
|
16
15
|
return ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
17
16
|
display: 'flex',
|
|
18
17
|
flex: 1,
|
|
19
18
|
flexDirection: 'column',
|
|
20
19
|
backgroundColor: react_components_1.tokens.colorNeutralBackground2,
|
|
21
20
|
overflow: 'hidden',
|
|
22
|
-
}, children: [(0, jsx_runtime_1.jsx)("div", { style: {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
21
|
+
}, children: [(0, jsx_runtime_1.jsx)("div", { style: {
|
|
22
|
+
// padding: spacingMapping[insightExpereince.style?.spacing ?? 'normal'],
|
|
23
|
+
// paddingBottom: 0,
|
|
24
|
+
// boxShadow: isScrolled ? tokens.shadow2 : 'none',
|
|
25
|
+
// backgroundColor: isScrolled
|
|
26
|
+
// ? tokens.colorNeutralBackground1
|
|
27
|
+
// : 'transparent',
|
|
28
|
+
zIndex: 1,
|
|
29
|
+
position: 'sticky',
|
|
30
|
+
top: 0,
|
|
31
|
+
}, children: (0, jsx_runtime_1.jsx)(Header_1.Header, { isScrolled: isScrolled }) }), (0, jsx_runtime_1.jsx)("div", { style: {
|
|
30
32
|
display: 'flex',
|
|
31
33
|
flexDirection: 'column',
|
|
32
34
|
flex: 1,
|
|
33
35
|
overflow: 'hidden',
|
|
34
|
-
}, children: (0, jsx_runtime_1.jsx)(ScrollView_1.ScrollView, {
|
|
36
|
+
}, children: (0, jsx_runtime_1.jsx)(ScrollView_1.ScrollView, { onScroll: (event) => {
|
|
37
|
+
const div = event.target;
|
|
38
|
+
setIsScrolled(div.scrollTop > 0);
|
|
39
|
+
}, children: (0, jsx_runtime_1.jsx)(Widgets_1.Widgets, { widgets: config.widgets }) }) })] }));
|
|
35
40
|
}
|
|
@@ -1,7 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CommandItemState } from '@headless-adminapp/app/command';
|
|
2
|
+
import { ChartInfo } from '@headless-adminapp/core/experience/insights';
|
|
2
3
|
import { FC } from 'react';
|
|
4
|
+
export type ChartComponentProps = {
|
|
5
|
+
dataset: any[];
|
|
6
|
+
chartInfo: any;
|
|
7
|
+
};
|
|
3
8
|
interface WidgetChartContainerProps {
|
|
4
|
-
|
|
9
|
+
title: string;
|
|
10
|
+
commands?: CommandItemState[][];
|
|
11
|
+
dataset: any[];
|
|
12
|
+
chartInfo: ChartInfo;
|
|
13
|
+
isPending?: boolean;
|
|
14
|
+
isFetching?: boolean;
|
|
5
15
|
}
|
|
6
|
-
export declare const
|
|
16
|
+
export declare const WidgetChart: FC<WidgetChartContainerProps>;
|
|
7
17
|
export {};
|