@headless-adminapp/fluent 0.0.17-alpha.52 → 0.0.17-alpha.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/App/App.js +7 -11
- package/App/AppHeaderContianer.js +38 -42
- package/App/AppLogo.js +8 -12
- package/App/AppStringContext.js +9 -13
- package/App/AppUI.js +11 -15
- package/App/LayoutProvider.js +11 -15
- package/App/NavigationContainer.js +25 -29
- package/App/QuickActionItem.js +5 -9
- package/App/index.js +1 -5
- package/App/utils.js +1 -4
- package/CommandBar/Button.js +14 -17
- package/CommandBar/Divider.js +6 -9
- package/CommandBar/IconButton.js +13 -16
- package/CommandBar/Label.js +8 -11
- package/CommandBar/MenuButton.js +17 -20
- package/CommandBar/MenuItem.js +15 -18
- package/CommandBar/MenuItems.js +8 -11
- package/CommandBar/MenuList.js +9 -12
- package/CommandBar/Wrapper.js +7 -10
- package/CommandBar/index.js +13 -15
- package/DataForm/SectionControl.js +4 -7
- package/DataGrid/ActionCell.js +11 -14
- package/DataGrid/CommandContainer.js +6 -10
- package/DataGrid/CustomizeColumns/AddColumns.js +34 -37
- package/DataGrid/CustomizeColumns/ColumnItem.js +19 -23
- package/DataGrid/CustomizeColumns/CustomizeColumns.js +36 -42
- package/DataGrid/CustomizeColumns/index.js +1 -5
- package/DataGrid/FormSubgridCommandContainer.js +13 -17
- package/DataGrid/FormSubgridViewSelector.js +18 -22
- package/DataGrid/GridColumnHeader/ConditionValueControl.js +14 -20
- package/DataGrid/GridColumnHeader/FilterForm.js +23 -27
- package/DataGrid/GridColumnHeader/OperatorSelect.js +13 -19
- package/DataGrid/GridColumnHeader/TableHeaderFilterCell.js +28 -32
- package/DataGrid/GridColumnHeader/index.js +1 -5
- package/DataGrid/GridColumnHeader/utils.js +2 -6
- package/DataGrid/GridHeaderContainer.js +4 -8
- package/DataGrid/GridHeaderDesktop.js +26 -30
- package/DataGrid/GridHeaderMobile.js +17 -21
- package/DataGrid/GridListContainer.js +39 -43
- package/DataGrid/GridPaginationContainer.js +12 -16
- package/DataGrid/GridTableContainer.js +74 -78
- package/DataGrid/TableCell/TableCellAction.js +11 -15
- package/DataGrid/TableCell/TableCellBase.js +4 -8
- package/DataGrid/TableCell/TableCellCheckbox.js +7 -10
- package/DataGrid/TableCell/TableCellChoice.js +11 -14
- package/DataGrid/TableCell/TableCellLink.d.ts +1 -1
- package/DataGrid/TableCell/TableCellLink.js +13 -12
- package/DataGrid/TableCell/TableCellText.js +7 -10
- package/DataGrid/TableCell/index.js +4 -20
- package/DataGrid/index.js +4 -11
- package/DataGrid/types.js +1 -2
- package/DataGrid/useTableColumns.js +139 -90
- package/DataGrid/utils.js +1 -5
- package/DialogContainer/AlertDialog.js +5 -8
- package/DialogContainer/ConfirmDialog.js +6 -9
- package/DialogContainer/DialogContainer.js +14 -18
- package/DialogContainer/ErrorDialog.js +9 -12
- package/DialogContainer/PromptDialog.js +30 -57
- package/DialogContainer/index.js +1 -5
- package/Insights/CommandBarContainer.js +11 -14
- package/Insights/FilterBarContainer.js +17 -20
- package/Insights/Grid.js +9 -13
- package/Insights/InsightsContainer.js +19 -22
- package/Insights/WidgetChartContainer.js +30 -34
- package/Insights/WidgetDataGridContainer.js +32 -35
- package/Insights/WidgetTableContainer.js +24 -28
- package/Insights/WidgetTileContainer.js +12 -16
- package/Insights/WidgetTitleBar.js +9 -15
- package/Insights/Widgets.js +25 -28
- package/Insights/charts/AreaChart.js +12 -15
- package/Insights/charts/BarChart.js +12 -15
- package/Insights/charts/ComposedChart.js +12 -15
- package/Insights/charts/CustomTooltipContent.js +8 -12
- package/Insights/charts/GaugeChart.js +3 -6
- package/Insights/charts/LineChart.js +12 -15
- package/Insights/charts/OhlcChart.js +36 -41
- package/Insights/charts/PieChart.js +23 -26
- package/Insights/charts/RadarChart.js +16 -19
- package/Insights/charts/ScatterChart.js +23 -26
- package/Insights/charts/constants.js +1 -4
- package/Insights/charts/formatters.js +17 -29
- package/Insights/charts/index.js +1 -2
- package/Insights/charts/renderers.js +25 -36
- package/Insights/hooks/useQueriesData.js +19 -25
- package/Insights/hooks/useWidgetDetail.js +13 -16
- package/OverflowCommandBar/OverflowCommandBar.js +12 -19
- package/OverflowCommandBar/OverflowMenu.js +16 -20
- package/OverflowCommandBar/OverflowMenuDivider.js +6 -10
- package/OverflowCommandBar/index.js +3 -9
- package/OverflowCommandBar/render.js +9 -15
- package/OverflowCommandBar/utils.js +1 -4
- package/PageBoard/BoardColumn.js +5 -8
- package/PageBoard/BoardColumnCard.js +12 -15
- package/PageBoard/BoardColumnUI.js +34 -38
- package/PageBoard/BoardingColumnCardLoading.js +10 -13
- package/PageBoard/Header.js +16 -20
- package/PageBoard/PageBoard.d.ts +1 -1
- package/PageBoard/PageBoard.js +26 -29
- package/PageBoard/index.js +1 -5
- package/PageEntityForm/CommandContainer.js +21 -25
- package/PageEntityForm/FormTabRelated.js +17 -20
- package/PageEntityForm/PageEntityForm.js +16 -20
- package/PageEntityForm/PageEntityFormDesktopContainer.js +68 -72
- package/PageEntityForm/PageEntityFormStringContext.js +5 -9
- package/PageEntityForm/ProcessFlow.js +21 -24
- package/PageEntityForm/RecordCard.js +21 -24
- package/PageEntityForm/RecordCardLoading.js +10 -13
- package/PageEntityForm/RecordSetNavigatorContainer.js +30 -34
- package/PageEntityForm/RelatedViewSelector.js +28 -31
- package/PageEntityForm/SectionContainer.js +25 -28
- package/PageEntityForm/StandardControl.d.ts +3 -3
- package/PageEntityForm/StandardControl.js +74 -81
- package/PageEntityForm/SubgridControl.js +20 -23
- package/PageEntityForm/index.js +1 -5
- package/PageEntityView/FormSubgridContainer.js +22 -26
- package/PageEntityView/PageEntityView.js +15 -19
- package/PageEntityView/PageEntityViewDesktopContainer.js +9 -13
- package/PageEntityView/PageEntityViewDesktopFrame.js +17 -21
- package/PageEntityView/PageEntityViewMobileContainer.js +9 -13
- package/PageEntityView/PageEntityViewStringContext.js +5 -9
- package/PageEntityView/index.js +1 -5
- package/PageInsights/PageInsights.js +9 -13
- package/PageInsights/index.js +1 -6
- package/ProgressIndicatorContainer/index.js +10 -14
- package/ToastNotificationContainer/index.js +14 -18
- package/componentStore.js +2 -5
- package/components/BodyLoading.js +7 -11
- package/components/DialogLogin.js +5 -8
- package/components/LoginForm.js +21 -47
- package/components/PageBroken.js +5 -8
- package/components/PageLoading.js +5 -8
- package/components/PageLogin.js +14 -17
- package/form/FormControl.js +39 -44
- package/form/FormControlLoading.js +4 -8
- package/form/controls/AttachmentControl.js +56 -60
- package/form/controls/AttachmentsControl.js +15 -19
- package/form/controls/CurrencyControl.js +10 -13
- package/form/controls/DateControl.js +18 -24
- package/form/controls/DateRangeControl.js +14 -20
- package/form/controls/DateTimeControl.js +39 -45
- package/form/controls/DecimalControl.js +8 -11
- package/form/controls/DurationControl.js +11 -15
- package/form/controls/EmailControl.js +7 -10
- package/form/controls/IntegerControl.js +4 -7
- package/form/controls/LookupControl.d.ts +1 -0
- package/form/controls/LookupControl.js +75 -38
- package/form/controls/MultiSelectControl.js +8 -11
- package/form/controls/MultiSelectLookupControl.js +40 -43
- package/form/controls/PasswordControl.js +8 -11
- package/form/controls/RichTextControl.js +5 -32
- package/form/controls/SelectControl.js +8 -11
- package/form/controls/SwitchControl.js +4 -7
- package/form/controls/TelephoneControl.js +7 -10
- package/form/controls/TextAreaControl.js +4 -7
- package/form/controls/TextControl.js +5 -8
- package/form/controls/UrlControl.js +7 -10
- package/form/controls/types.js +1 -2
- package/form/controls/useLookupData.js +14 -18
- package/form/layout/FormBody/FormBody.js +6 -10
- package/form/layout/FormBody/index.js +1 -17
- package/form/layout/FormSection/FormSection.js +18 -22
- package/form/layout/FormSection/FormSectionColumn.js +3 -7
- package/form/layout/FormSection/FormSectionLoading.js +1 -5
- package/form/layout/FormSection/index.js +1 -5
- package/form/layout/FormTab/FormTab.js +16 -20
- package/form/layout/FormTab/FormTabColumn.js +5 -9
- package/form/layout/FormTab/index.js +1 -5
- package/form/layout/TabContext.js +2 -5
- package/form/layout/index.js +3 -9
- package/form/types.js +1 -2
- package/package.json +3 -2
- package/types/index.js +1 -2
- package/utils/avatar.d.ts +2 -0
- package/utils/avatar.js +42 -0
|
@@ -1,27 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
const useTableColumns_1 = require("./useTableColumns");
|
|
20
|
-
const utils_1 = require("./utils");
|
|
21
|
-
const useStyles = (0, react_components_1.makeStyles)({
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Body1, makeStyles, mergeClasses, SkeletonItem, Table, TableBody, TableCell, TableHeader, TableRow, tokens, } from '@fluentui/react-components';
|
|
3
|
+
import { ScrollbarWithMoreDataRequest } from '@headless-adminapp/app/components/ScrollbarWithMoreDataRequest';
|
|
4
|
+
import { GridContext } from '@headless-adminapp/app/datagrid';
|
|
5
|
+
import { useDataGridSchema, useGridColumns, useGridData, useGridDataState, useGridSelection, useGridSorting, } from '@headless-adminapp/app/datagrid/hooks';
|
|
6
|
+
import { useLocale } from '@headless-adminapp/app/locale';
|
|
7
|
+
import { useContextSelector } from '@headless-adminapp/app/mutable';
|
|
8
|
+
import { useOpenForm } from '@headless-adminapp/app/navigation';
|
|
9
|
+
import { useRecordSetSetter } from '@headless-adminapp/app/recordset/hooks';
|
|
10
|
+
import { Icons } from '@headless-adminapp/icons';
|
|
11
|
+
import { flexRender, getCoreRowModel, useReactTable, } from '@tanstack/react-table';
|
|
12
|
+
import { useVirtualizer } from '@tanstack/react-virtual';
|
|
13
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
14
|
+
import { v4 as uuid } from 'uuid';
|
|
15
|
+
import { usePageEntityViewStrings } from '../PageEntityView/PageEntityViewStringContext';
|
|
16
|
+
import { useTableColumns } from './useTableColumns';
|
|
17
|
+
import { adjustTableHeight } from './utils';
|
|
18
|
+
const useStyles = makeStyles({
|
|
22
19
|
root: {
|
|
23
20
|
'[aria-selected="true"]': {
|
|
24
|
-
background:
|
|
21
|
+
background: tokens.colorBrandBackground2,
|
|
25
22
|
'& .fui-TableSelectionCell': {
|
|
26
23
|
background: 'inherit',
|
|
27
24
|
},
|
|
@@ -39,9 +36,9 @@ const useStyles = (0, react_components_1.makeStyles)({
|
|
|
39
36
|
},
|
|
40
37
|
},
|
|
41
38
|
'& .tableCellAction': {
|
|
42
|
-
background:
|
|
39
|
+
background: tokens.colorNeutralBackground1,
|
|
43
40
|
},
|
|
44
|
-
borderBottom: `${
|
|
41
|
+
borderBottom: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStroke3}`,
|
|
45
42
|
'& .fui-TableCell': {
|
|
46
43
|
// borderBottom: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStroke3}`,
|
|
47
44
|
// borderBottom: 'none !important',
|
|
@@ -50,7 +47,7 @@ const useStyles = (0, react_components_1.makeStyles)({
|
|
|
50
47
|
selectionCell: {
|
|
51
48
|
position: 'sticky',
|
|
52
49
|
left: 0,
|
|
53
|
-
background:
|
|
50
|
+
background: tokens.colorNeutralBackground1,
|
|
54
51
|
zIndex: 1,
|
|
55
52
|
display: 'flex',
|
|
56
53
|
alignItems: 'center',
|
|
@@ -65,28 +62,28 @@ const useStyles = (0, react_components_1.makeStyles)({
|
|
|
65
62
|
},
|
|
66
63
|
});
|
|
67
64
|
const fallbackData = [];
|
|
68
|
-
const GridTableContainer = ({ noPadding, disableColumnFilter, disableColumnSort, disableColumnResize, disableContextMenu, disableSelection, }) => {
|
|
65
|
+
export const GridTableContainer = ({ noPadding, disableColumnFilter, disableColumnSort, disableColumnResize, disableContextMenu, disableSelection, }) => {
|
|
69
66
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
70
67
|
const styles = useStyles();
|
|
71
|
-
const data =
|
|
72
|
-
const dataState =
|
|
73
|
-
const fetchNextPage =
|
|
74
|
-
const columns =
|
|
75
|
-
const [sorting] =
|
|
76
|
-
const schema =
|
|
77
|
-
const [selectedIds, setSelectedIds] =
|
|
78
|
-
const setSelectedIdsRef =
|
|
68
|
+
const data = useGridData();
|
|
69
|
+
const dataState = useGridDataState();
|
|
70
|
+
const fetchNextPage = useContextSelector(GridContext, (state) => state.fetchNextPage);
|
|
71
|
+
const columns = useGridColumns();
|
|
72
|
+
const [sorting] = useGridSorting();
|
|
73
|
+
const schema = useDataGridSchema();
|
|
74
|
+
const [selectedIds, setSelectedIds] = useGridSelection();
|
|
75
|
+
const setSelectedIdsRef = useRef(setSelectedIds);
|
|
79
76
|
setSelectedIdsRef.current = setSelectedIds;
|
|
80
|
-
const sortingState =
|
|
77
|
+
const sortingState = useMemo(() => {
|
|
81
78
|
return sorting.map((sort) => ({
|
|
82
79
|
id: sort.field,
|
|
83
80
|
desc: sort.order === 'desc',
|
|
84
81
|
}));
|
|
85
82
|
}, [sorting]);
|
|
86
|
-
const tableWrapperRef =
|
|
87
|
-
const recordSetSetter =
|
|
88
|
-
const openFormInternal =
|
|
89
|
-
const openRecord =
|
|
83
|
+
const tableWrapperRef = useRef(null);
|
|
84
|
+
const recordSetSetter = useRecordSetSetter();
|
|
85
|
+
const openFormInternal = useOpenForm();
|
|
86
|
+
const openRecord = useCallback((id) => {
|
|
90
87
|
var _a, _b;
|
|
91
88
|
recordSetSetter(schema.logicalName, (_b = (_a = dataRef.current) === null || _a === void 0 ? void 0 : _a.records.map((x) => x[schema.idAttribute])) !== null && _b !== void 0 ? _b : []);
|
|
92
89
|
openFormInternal({
|
|
@@ -94,11 +91,11 @@ const GridTableContainer = ({ noPadding, disableColumnFilter, disableColumnSort,
|
|
|
94
91
|
id,
|
|
95
92
|
});
|
|
96
93
|
}, [openFormInternal, recordSetSetter, schema.idAttribute, schema.logicalName]);
|
|
97
|
-
const { direction } =
|
|
98
|
-
const strings =
|
|
99
|
-
const dataRef =
|
|
94
|
+
const { direction } = useLocale();
|
|
95
|
+
const strings = usePageEntityViewStrings();
|
|
96
|
+
const dataRef = useRef(data);
|
|
100
97
|
dataRef.current = data;
|
|
101
|
-
const tableColumns =
|
|
98
|
+
const tableColumns = useTableColumns({
|
|
102
99
|
disableColumnFilter,
|
|
103
100
|
disableColumnResize,
|
|
104
101
|
disableColumnSort,
|
|
@@ -106,26 +103,26 @@ const GridTableContainer = ({ noPadding, disableColumnFilter, disableColumnSort,
|
|
|
106
103
|
disableSelection,
|
|
107
104
|
tableWrapperRef,
|
|
108
105
|
});
|
|
109
|
-
const uniqueRecords =
|
|
106
|
+
const uniqueRecords = useMemo(() => {
|
|
110
107
|
var _a;
|
|
111
|
-
return ((_a = data === null || data === void 0 ? void 0 : data.records.map((record) => (Object.assign(Object.assign({}, record), { __uuid: (
|
|
108
|
+
return ((_a = data === null || data === void 0 ? void 0 : data.records.map((record) => (Object.assign(Object.assign({}, record), { __uuid: uuid() })))) !== null && _a !== void 0 ? _a : fallbackData);
|
|
112
109
|
}, [data === null || data === void 0 ? void 0 : data.records]);
|
|
113
|
-
const idMapping =
|
|
110
|
+
const idMapping = useMemo(() => uniqueRecords.reduce((acc, record) => {
|
|
114
111
|
acc[record[schema.idAttribute]] = record.__uuid;
|
|
115
112
|
return acc;
|
|
116
113
|
}, {}), [uniqueRecords, schema.idAttribute]);
|
|
117
|
-
const rowSelection =
|
|
114
|
+
const rowSelection = useMemo(() => {
|
|
118
115
|
return selectedIds.reduce((acc, id) => {
|
|
119
116
|
acc[idMapping[id]] = true;
|
|
120
117
|
return acc;
|
|
121
118
|
}, {});
|
|
122
119
|
}, [selectedIds, idMapping]);
|
|
123
|
-
const table =
|
|
120
|
+
const table = useReactTable({
|
|
124
121
|
data: uniqueRecords,
|
|
125
122
|
columns: tableColumns,
|
|
126
123
|
getRowId: (row) => row.__uuid,
|
|
127
124
|
enableRowSelection: true,
|
|
128
|
-
getCoreRowModel:
|
|
125
|
+
getCoreRowModel: getCoreRowModel(),
|
|
129
126
|
columnResizeMode: 'onChange',
|
|
130
127
|
columnResizeDirection: 'ltr',
|
|
131
128
|
onRowSelectionChange: () => {
|
|
@@ -136,29 +133,29 @@ const GridTableContainer = ({ noPadding, disableColumnFilter, disableColumnSort,
|
|
|
136
133
|
sorting: sortingState,
|
|
137
134
|
},
|
|
138
135
|
});
|
|
139
|
-
const tableRef =
|
|
136
|
+
const tableRef = useRef(table);
|
|
140
137
|
tableRef.current = table;
|
|
141
|
-
|
|
138
|
+
useEffect(() => {
|
|
142
139
|
tableRef.current.resetColumnSizing();
|
|
143
140
|
}, [columns]);
|
|
144
141
|
const rows = table.getRowModel().rows;
|
|
145
|
-
const virtualizer =
|
|
142
|
+
const virtualizer = useVirtualizer({
|
|
146
143
|
count: rows.length,
|
|
147
144
|
getScrollElement: () => { var _a, _b; return (_b = (_a = tableWrapperRef.current) === null || _a === void 0 ? void 0 : _a.parentElement) === null || _b === void 0 ? void 0 : _b.parentElement; },
|
|
148
145
|
estimateSize: () => 44,
|
|
149
146
|
overscan: 30,
|
|
150
147
|
paddingStart: 33,
|
|
151
148
|
});
|
|
152
|
-
const tableElementRef =
|
|
149
|
+
const tableElementRef = useRef(null);
|
|
153
150
|
const virtualItems = virtualizer.getVirtualItems();
|
|
154
151
|
const virtualSize = virtualizer.getTotalSize();
|
|
155
|
-
const [isScrollNearBottom, setIsScrollNearBottom] =
|
|
152
|
+
const [isScrollNearBottom, setIsScrollNearBottom] = useState(false);
|
|
156
153
|
// callback to adjust the height of the pseudo element
|
|
157
|
-
const handlePseudoResize =
|
|
158
|
-
return
|
|
154
|
+
const handlePseudoResize = useCallback(() => {
|
|
155
|
+
return adjustTableHeight(tableElementRef, virtualSize);
|
|
159
156
|
}, [virtualSize]);
|
|
160
157
|
// callback to handle scrolling, checking if we are near the bottom
|
|
161
|
-
const handleScroll =
|
|
158
|
+
const handleScroll = useCallback(() => {
|
|
162
159
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
163
160
|
if ((_b = (_a = tableWrapperRef.current) === null || _a === void 0 ? void 0 : _a.parentElement) === null || _b === void 0 ? void 0 : _b.parentElement) {
|
|
164
161
|
const scrollPosition = (_e = (_d = (_c = tableWrapperRef.current) === null || _c === void 0 ? void 0 : _c.parentElement) === null || _d === void 0 ? void 0 : _d.parentElement) === null || _e === void 0 ? void 0 : _e.scrollTop;
|
|
@@ -168,7 +165,7 @@ const GridTableContainer = ({ noPadding, disableColumnFilter, disableColumnSort,
|
|
|
168
165
|
}, [virtualSize]);
|
|
169
166
|
// add an event listener on the scrollable parent container and resize the
|
|
170
167
|
// pseudo element whenever the table renders with new data
|
|
171
|
-
|
|
168
|
+
useEffect(() => {
|
|
172
169
|
var _a, _b;
|
|
173
170
|
const scrollable = (_b = (_a = tableWrapperRef.current) === null || _a === void 0 ? void 0 : _a.parentElement) === null || _b === void 0 ? void 0 : _b.parentElement;
|
|
174
171
|
if (scrollable)
|
|
@@ -182,19 +179,19 @@ const GridTableContainer = ({ noPadding, disableColumnFilter, disableColumnSort,
|
|
|
182
179
|
// if we are near the bottom of the table, resize the pseudo element each time
|
|
183
180
|
// the length of virtual items changes (which is effectively the number of table
|
|
184
181
|
// rows rendered to the DOM). This ensures we don't scroll too far or too short.
|
|
185
|
-
|
|
182
|
+
useEffect(() => {
|
|
186
183
|
if (isScrollNearBottom)
|
|
187
184
|
handlePseudoResize();
|
|
188
185
|
}, [isScrollNearBottom, virtualItems.length, handlePseudoResize]);
|
|
189
186
|
const isScrolledToRight = ((_c = (_b = (_a = tableWrapperRef.current) === null || _a === void 0 ? void 0 : _a.parentElement) === null || _b === void 0 ? void 0 : _b.parentElement) === null || _c === void 0 ? void 0 : _c.scrollLeft) ===
|
|
190
187
|
((_g = (_f = (_e = (_d = tableWrapperRef.current) === null || _d === void 0 ? void 0 : _d.parentElement) === null || _e === void 0 ? void 0 : _e.parentElement) === null || _f === void 0 ? void 0 : _f.scrollWidth) !== null && _g !== void 0 ? _g : 0) -
|
|
191
188
|
((_l = (_k = (_j = (_h = tableWrapperRef.current) === null || _h === void 0 ? void 0 : _h.parentElement) === null || _j === void 0 ? void 0 : _j.parentElement) === null || _k === void 0 ? void 0 : _k.clientWidth) !== null && _l !== void 0 ? _l : 0);
|
|
192
|
-
return ((
|
|
189
|
+
return (_jsx("div", { style: { display: 'flex', flex: 1, flexDirection: 'column' }, children: _jsxs(ScrollbarWithMoreDataRequest, { data: data === null || data === void 0 ? void 0 : data.records, hasMore: dataState === null || dataState === void 0 ? void 0 : dataState.hasNextPage, rtl: direction === 'rtl', onRequestMore: () => {
|
|
193
190
|
fetchNextPage();
|
|
194
|
-
}, children: [(
|
|
191
|
+
}, children: [_jsx("div", { style: {
|
|
195
192
|
paddingInline: noPadding ? 0 : 8,
|
|
196
193
|
position: 'relative',
|
|
197
|
-
}, ref: tableWrapperRef, children: (
|
|
194
|
+
}, ref: tableWrapperRef, children: _jsxs(Table, { style: {
|
|
198
195
|
display: 'flex',
|
|
199
196
|
flexDirection: 'column',
|
|
200
197
|
borderCollapse: 'collapse',
|
|
@@ -203,27 +200,27 @@ const GridTableContainer = ({ noPadding, disableColumnFilter, disableColumnSort,
|
|
|
203
200
|
['--action-shadow']: !isScrolledToRight
|
|
204
201
|
? '-2px 0px 6px rgba(0, 0, 0, 0.12)'
|
|
205
202
|
: 'none',
|
|
206
|
-
}, ref: tableElementRef, className: "table-pseduo", children: [(
|
|
203
|
+
}, ref: tableElementRef, className: "table-pseduo", children: [_jsx(TableHeader, { style: {
|
|
207
204
|
display: 'flex',
|
|
208
205
|
position: 'sticky',
|
|
209
206
|
top: 0,
|
|
210
|
-
background:
|
|
207
|
+
background: tokens.colorNeutralBackground1,
|
|
211
208
|
zIndex: 2,
|
|
212
|
-
}, children: table.getHeaderGroups().map((headerGroup) => ((
|
|
209
|
+
}, children: table.getHeaderGroups().map((headerGroup) => (_jsx(TableRow, { style: {
|
|
213
210
|
position: 'sticky',
|
|
214
211
|
top: 0,
|
|
215
212
|
display: 'flex',
|
|
216
213
|
minWidth: 'calc(100% - 16px)',
|
|
217
|
-
borderBottom: `${
|
|
214
|
+
borderBottom: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStroke3}`,
|
|
218
215
|
}, children: headerGroup.headers.map((header) => header.isPlaceholder
|
|
219
216
|
? null
|
|
220
|
-
:
|
|
217
|
+
: flexRender(header.column.columnDef.header, Object.assign(Object.assign({}, header.getContext()), { key: header.id }))) }, headerGroup.id))) }), _jsx(TableBody, { style: {
|
|
221
218
|
display: 'flex',
|
|
222
219
|
flexDirection: 'column',
|
|
223
220
|
transform: 'translateY(-33px)',
|
|
224
221
|
}, children: virtualItems.map((virtualRow) => {
|
|
225
222
|
const row = rows[virtualRow.index];
|
|
226
|
-
return ((
|
|
223
|
+
return (_jsx(TableRow, { "aria-selected": row.getIsSelected(), className: mergeClasses(styles.root), style: {
|
|
227
224
|
display: 'flex',
|
|
228
225
|
height: `${virtualRow.size}px`,
|
|
229
226
|
minWidth: 'calc(100% - 16px)',
|
|
@@ -237,33 +234,32 @@ const GridTableContainer = ({ noPadding, disableColumnFilter, disableColumnSort,
|
|
|
237
234
|
}, onDoubleClick: () => {
|
|
238
235
|
const id = row.original[schema.idAttribute];
|
|
239
236
|
openRecord(id);
|
|
240
|
-
}, children: row.getVisibleCells().map((cell) =>
|
|
241
|
-
}) }), dataState.isFetching && ((
|
|
237
|
+
}, children: row.getVisibleCells().map((cell) => flexRender(cell.column.columnDef.cell, Object.assign(Object.assign({}, cell.getContext()), { key: cell.column.id }))) }, row.id));
|
|
238
|
+
}) }), dataState.isFetching && (_jsx(TableBody, { style: {
|
|
242
239
|
display: 'flex',
|
|
243
240
|
flexDirection: 'column',
|
|
244
241
|
position: 'absolute',
|
|
245
242
|
transform: `translateY(${virtualSize}px)`,
|
|
246
|
-
}, children: Array.from({ length: 10 }).map((_, index) => ((
|
|
243
|
+
}, children: Array.from({ length: 10 }).map((_, index) => (_jsx(TableRow, { style: {
|
|
247
244
|
display: 'flex',
|
|
248
245
|
height: 44,
|
|
249
246
|
alignItems: 'center',
|
|
250
247
|
}, children: table.getAllColumns().map((column) => {
|
|
251
248
|
if (!column.getIsVisible())
|
|
252
249
|
return null;
|
|
253
|
-
return ((
|
|
250
|
+
return (_jsx(TableCell, { style: {
|
|
254
251
|
display: 'flex',
|
|
255
252
|
alignItems: 'center',
|
|
256
253
|
width: column.getSize(),
|
|
257
|
-
}, children: (
|
|
258
|
-
}) }, index))) }))] }) }), (data === null || data === void 0 ? void 0 : data.records.length) === 0 && !dataState.isFetching && ((
|
|
254
|
+
}, children: _jsx(SkeletonItem, { size: 16 }) }, column.id));
|
|
255
|
+
}) }, index))) }))] }) }), (data === null || data === void 0 ? void 0 : data.records.length) === 0 && !dataState.isFetching && (_jsxs("div", { style: {
|
|
259
256
|
display: 'flex',
|
|
260
257
|
flexDirection: 'column',
|
|
261
258
|
alignItems: 'center',
|
|
262
259
|
justifyContent: 'center',
|
|
263
260
|
position: 'absolute',
|
|
264
261
|
inset: 0,
|
|
265
|
-
gap:
|
|
266
|
-
color:
|
|
267
|
-
}, children: [(
|
|
262
|
+
gap: tokens.spacingVerticalL,
|
|
263
|
+
color: tokens.colorNeutralForeground3,
|
|
264
|
+
}, children: [_jsx("div", { children: _jsx(Icons.Search, { size: 64 }) }), _jsx(Body1, { children: strings.noRecordsFound })] }))] }) }));
|
|
268
265
|
};
|
|
269
|
-
exports.GridTableContainer = GridTableContainer;
|
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const icons_1 = require("@headless-adminapp/icons");
|
|
7
|
-
const MenuList_1 = require("../../CommandBar/MenuList");
|
|
8
|
-
const useStyles = (0, react_components_1.makeStyles)({
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Button, makeStyles, Menu, MenuPopover, MenuTrigger, TableCell, tokens, } from '@fluentui/react-components';
|
|
3
|
+
import { Icons } from '@headless-adminapp/icons';
|
|
4
|
+
import { MenuList } from '../../CommandBar/MenuList';
|
|
5
|
+
const useStyles = makeStyles({
|
|
9
6
|
button: {
|
|
10
7
|
'&:hover': {
|
|
11
|
-
background:
|
|
8
|
+
background: tokens.colorNeutralBackground5,
|
|
12
9
|
},
|
|
13
10
|
},
|
|
14
11
|
});
|
|
15
|
-
const TableCellAction = ({ items, onOpen, }) => {
|
|
12
|
+
export const TableCellAction = ({ items, onOpen, }) => {
|
|
16
13
|
const styles = useStyles();
|
|
17
|
-
return ((
|
|
14
|
+
return (_jsx(TableCell, { className: "tableCellAction", style: {
|
|
18
15
|
display: 'flex',
|
|
19
16
|
padding: 0,
|
|
20
17
|
// width: 32,
|
|
@@ -29,13 +26,12 @@ const TableCellAction = ({ items, onOpen, }) => {
|
|
|
29
26
|
justifyContent: 'right',
|
|
30
27
|
// background: 'white',
|
|
31
28
|
// boxShadow: '0 0 10px rgba(0, 0, 0, 0.1)',
|
|
32
|
-
borderBottom: `${
|
|
33
|
-
}, children: (
|
|
29
|
+
borderBottom: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStroke3}`,
|
|
30
|
+
}, children: _jsxs(Menu, { positioning: "before-top", children: [_jsx(MenuTrigger, { children: _jsx(Button, { appearance: "transparent", icon: _jsx(Icons.MoreVertical, {}), onClick: onOpen, className: styles.button, style: {
|
|
34
31
|
// background: 'white',
|
|
35
32
|
// boxShadow: '0 0 10px rgba(0, 0, 0, 0.1)',
|
|
36
33
|
boxShadow: 'var(--action-shadow)',
|
|
37
34
|
borderRadius: 0,
|
|
38
35
|
// background: tokens.colorNeutralBackground1,
|
|
39
|
-
} }) }), (
|
|
36
|
+
} }) }), _jsx(MenuPopover, { children: _jsx(MenuList, { items: items }) })] }) }));
|
|
40
37
|
};
|
|
41
|
-
exports.TableCellAction = TableCellAction;
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
-
const TableCellBase = ({ children, onClick, style, }) => {
|
|
7
|
-
return ((0, jsx_runtime_1.jsx)(react_components_1.TableCell, { onClick: onClick, style: Object.assign({ display: 'flex', alignItems: 'center' }, style), children: children }));
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { TableCell as TableCellInternal } from '@fluentui/react-components';
|
|
3
|
+
export const TableCellBase = ({ children, onClick, style, }) => {
|
|
4
|
+
return (_jsx(TableCellInternal, { onClick: onClick, style: Object.assign({ display: 'flex', alignItems: 'center' }, style), children: children }));
|
|
8
5
|
};
|
|
9
|
-
exports.TableCellBase = TableCellBase;
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
const react_1 = require("react");
|
|
7
|
-
exports.TableCellCheckbox = (0, react_1.memo)(({ checked, onChange }) => {
|
|
8
|
-
return ((0, jsx_runtime_1.jsx)(react_components_1.TableCell, { style: { display: 'flex', alignItems: 'center' }, onClick: (event) => {
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Checkbox, TableCell } from '@fluentui/react-components';
|
|
3
|
+
import { memo } from 'react';
|
|
4
|
+
export const TableCellCheckbox = memo(({ checked, onChange }) => {
|
|
5
|
+
return (_jsx(TableCell, { style: { display: 'flex', alignItems: 'center' }, onClick: (event) => {
|
|
9
6
|
event.stopPropagation();
|
|
10
|
-
}, children: (
|
|
7
|
+
}, children: _jsx(Checkbox, { checked: checked !== null && checked !== void 0 ? checked : false, onChange: (event) => {
|
|
11
8
|
event.stopPropagation();
|
|
12
9
|
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
|
13
10
|
} }) }));
|
|
14
11
|
});
|
|
15
|
-
|
|
12
|
+
TableCellCheckbox.displayName = 'TableCellCheckbox';
|
|
@@ -1,31 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
const TableCellBase_1 = require("./TableCellBase");
|
|
9
|
-
function TableCellChoice(props) {
|
|
10
|
-
const bgColor = (0, react_1.useMemo)(() => {
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Tag } from '@fluentui/react-components';
|
|
3
|
+
import { isColorDark } from '@headless-adminapp/app/utils/color';
|
|
4
|
+
import { useMemo } from 'react';
|
|
5
|
+
import { TableCellBase } from './TableCellBase';
|
|
6
|
+
export function TableCellChoice(props) {
|
|
7
|
+
const bgColor = useMemo(() => {
|
|
11
8
|
var _a;
|
|
12
9
|
if (!props.value || !props.attribute.options) {
|
|
13
10
|
return;
|
|
14
11
|
}
|
|
15
12
|
return (_a = props.attribute.options.find((option) => option.value === props.value)) === null || _a === void 0 ? void 0 : _a.color;
|
|
16
13
|
}, [props.attribute.options, props.value]);
|
|
17
|
-
const color =
|
|
14
|
+
const color = useMemo(() => {
|
|
18
15
|
if (!bgColor) {
|
|
19
16
|
return;
|
|
20
17
|
}
|
|
21
|
-
return
|
|
18
|
+
return isColorDark(bgColor) ? '#FFFFFF' : '#000000';
|
|
22
19
|
}, [bgColor]);
|
|
23
|
-
return ((
|
|
20
|
+
return (_jsx(TableCellBase, { style: {
|
|
24
21
|
textOverflow: 'ellipsis',
|
|
25
22
|
overflow: 'hidden',
|
|
26
23
|
whiteSpace: 'nowrap',
|
|
27
24
|
width: props.width,
|
|
28
25
|
minWidth: props.width,
|
|
29
26
|
maxWidth: props.width,
|
|
30
|
-
}, children: (
|
|
27
|
+
}, children: _jsx(Tag, { size: "small", style: { backgroundColor: bgColor, color }, children: props.formattedValue }) }));
|
|
31
28
|
}
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
exports.TableCellLink = (0, react_1.memo)(({ value, href, onClick, width, target }) => {
|
|
9
|
-
const router = (0, hooks_1.useRouter)();
|
|
10
|
-
return ((0, jsx_runtime_1.jsx)(react_components_1.TableCell, { style: {
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Link, TableCell, tokens } from '@fluentui/react-components';
|
|
3
|
+
import { useRouter } from '@headless-adminapp/app/route/hooks';
|
|
4
|
+
import { memo } from 'react';
|
|
5
|
+
export const TableCellLink = memo(({ value, href, onClick, width, target }) => {
|
|
6
|
+
const router = useRouter();
|
|
7
|
+
return (_jsx(TableCell, { style: {
|
|
11
8
|
textOverflow: 'ellipsis',
|
|
12
9
|
overflow: 'hidden',
|
|
13
10
|
whiteSpace: 'nowrap',
|
|
@@ -16,7 +13,7 @@ exports.TableCellLink = (0, react_1.memo)(({ value, href, onClick, width, target
|
|
|
16
13
|
maxWidth: width,
|
|
17
14
|
display: 'flex',
|
|
18
15
|
alignItems: 'center',
|
|
19
|
-
}, children: (
|
|
16
|
+
}, children: _jsx(Link, { as: "a", href: href, target: target, onClick: (event) => {
|
|
20
17
|
if (target === '_blank') {
|
|
21
18
|
return;
|
|
22
19
|
}
|
|
@@ -32,6 +29,10 @@ exports.TableCellLink = (0, react_1.memo)(({ value, href, onClick, width, target
|
|
|
32
29
|
router.push(href);
|
|
33
30
|
event.preventDefault();
|
|
34
31
|
}
|
|
32
|
+
}, style: {
|
|
33
|
+
display: 'flex',
|
|
34
|
+
alignItems: 'center',
|
|
35
|
+
gap: tokens.spacingHorizontalXS,
|
|
35
36
|
}, children: value }) }));
|
|
36
37
|
});
|
|
37
|
-
|
|
38
|
+
TableCellLink.displayName = 'TableCellLink';
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
const TableCellBase_1 = require("./TableCellBase");
|
|
7
|
-
exports.TableCellText = (0, react_1.memo)(({ value, width, textAlignment }) => {
|
|
8
|
-
return ((0, jsx_runtime_1.jsx)(TableCellBase_1.TableCellBase, { style: {
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo } from 'react';
|
|
3
|
+
import { TableCellBase } from './TableCellBase';
|
|
4
|
+
export const TableCellText = memo(({ value, width, textAlignment }) => {
|
|
5
|
+
return (_jsx(TableCellBase, { style: {
|
|
9
6
|
textAlign: textAlignment || 'left',
|
|
10
7
|
textOverflow: 'ellipsis',
|
|
11
8
|
overflow: 'hidden',
|
|
@@ -20,10 +17,10 @@ exports.TableCellText = (0, react_1.memo)(({ value, width, textAlignment }) => {
|
|
|
20
17
|
// display: 'flex',
|
|
21
18
|
// alignItems: 'center',
|
|
22
19
|
// borderBottom: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStroke3}`,
|
|
23
|
-
}, children: (
|
|
20
|
+
}, children: _jsx("div", { style: {
|
|
24
21
|
overflow: 'hidden',
|
|
25
22
|
textOverflow: 'ellipsis',
|
|
26
23
|
width: '100%',
|
|
27
24
|
}, children: value }) }));
|
|
28
25
|
});
|
|
29
|
-
|
|
26
|
+
TableCellText.displayName = 'TableCellText';
|
|
@@ -1,20 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./TableCellBase"), exports);
|
|
18
|
-
__exportStar(require("./TableCellText"), exports);
|
|
19
|
-
__exportStar(require("./TableCellAction"), exports);
|
|
20
|
-
__exportStar(require("./TableCellCheckbox"), exports);
|
|
1
|
+
export * from './TableCellBase';
|
|
2
|
+
export * from './TableCellText';
|
|
3
|
+
export * from './TableCellAction';
|
|
4
|
+
export * from './TableCellCheckbox';
|
package/DataGrid/index.js
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "CommandContainer", { enumerable: true, get: function () { return CommandContainer_1.CommandContainer; } });
|
|
6
|
-
var GridHeaderContainer_1 = require("./GridHeaderContainer");
|
|
7
|
-
Object.defineProperty(exports, "GridHeaderContainer", { enumerable: true, get: function () { return GridHeaderContainer_1.GridHeaderContainer; } });
|
|
8
|
-
var GridPaginationContainer_1 = require("./GridPaginationContainer");
|
|
9
|
-
Object.defineProperty(exports, "GridPaginationContainer", { enumerable: true, get: function () { return GridPaginationContainer_1.GridPaginationContainer; } });
|
|
10
|
-
var GridTableContainer_1 = require("./GridTableContainer");
|
|
11
|
-
Object.defineProperty(exports, "GridTableContainer", { enumerable: true, get: function () { return GridTableContainer_1.GridTableContainer; } });
|
|
1
|
+
export { CommandContainer } from './CommandContainer';
|
|
2
|
+
export { GridHeaderContainer } from './GridHeaderContainer';
|
|
3
|
+
export { GridPaginationContainer } from './GridPaginationContainer';
|
|
4
|
+
export { GridTableContainer } from './GridTableContainer';
|
package/DataGrid/types.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|