@headless-adminapp/fluent 0.0.17-alpha.53 → 0.0.17-alpha.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/App/App.js +11 -7
- package/App/AppHeaderContianer.js +50 -44
- package/App/AppLogo.js +12 -9
- package/App/AppStringContext.js +13 -9
- package/App/AppUI.js +15 -11
- package/App/LayoutProvider.js +16 -24
- package/App/NavigationContainer.js +28 -28
- package/App/QuickActionItem.js +10 -6
- package/App/index.js +5 -1
- package/App/utils.d.ts +1 -1
- package/App/utils.js +7 -5
- package/CommandBar/Button.js +17 -14
- package/CommandBar/Divider.js +9 -6
- package/CommandBar/IconButton.js +16 -13
- package/CommandBar/Label.js +11 -8
- package/CommandBar/MenuButton.js +20 -17
- package/CommandBar/MenuItem.js +19 -16
- package/CommandBar/MenuItems.js +10 -10
- package/CommandBar/MenuList.js +12 -9
- package/CommandBar/Wrapper.js +10 -7
- package/CommandBar/index.js +15 -13
- package/DataForm/SectionControl.js +7 -4
- package/DataGrid/ActionCell.js +14 -11
- package/DataGrid/CommandContainer.js +10 -6
- package/DataGrid/CustomizeColumns/AddColumns.js +61 -59
- package/DataGrid/CustomizeColumns/ColumnItem.js +23 -19
- package/DataGrid/CustomizeColumns/CustomizeColumns.js +41 -36
- package/DataGrid/CustomizeColumns/index.js +5 -1
- package/DataGrid/FormSubgridCommandContainer.js +17 -13
- package/DataGrid/FormSubgridViewSelector.js +21 -21
- package/DataGrid/GridColumnHeader/ConditionValueControl.js +33 -33
- package/DataGrid/GridColumnHeader/FilterForm.js +28 -27
- package/DataGrid/GridColumnHeader/OperatorSelect.js +19 -13
- package/DataGrid/GridColumnHeader/TableHeaderFilterCell.js +35 -31
- package/DataGrid/GridColumnHeader/index.js +5 -1
- package/DataGrid/GridColumnHeader/utils.js +6 -2
- package/DataGrid/GridHeaderContainer.js +8 -4
- package/DataGrid/GridHeaderDesktop.js +28 -28
- package/DataGrid/GridHeaderMobile.js +20 -19
- package/DataGrid/GridListContainer.js +50 -44
- package/DataGrid/GridPaginationContainer.js +16 -13
- package/DataGrid/GridTableContainer.js +98 -89
- package/DataGrid/TableCell/TableCellAction.js +15 -11
- package/DataGrid/TableCell/TableCellBase.js +13 -4
- package/DataGrid/TableCell/TableCellCheckbox.js +11 -8
- package/DataGrid/TableCell/TableCellChoice.js +15 -13
- package/DataGrid/TableCell/TableCellLink.js +14 -11
- package/DataGrid/TableCell/TableCellText.js +10 -7
- package/DataGrid/TableCell/index.js +20 -4
- package/DataGrid/index.js +11 -4
- package/DataGrid/types.js +2 -1
- package/DataGrid/useTableColumns.js +98 -103
- package/DataGrid/utils.js +5 -1
- package/DialogContainer/AlertDialog.js +11 -11
- package/DialogContainer/ConfirmDialog.js +13 -14
- package/DialogContainer/DialogContainer.js +19 -26
- package/DialogContainer/ErrorDialog.js +15 -15
- package/DialogContainer/PromptDialog.js +76 -58
- package/DialogContainer/index.js +5 -1
- package/Insights/CommandBarContainer.js +17 -11
- package/Insights/FilterBarContainer.js +32 -37
- package/Insights/Grid.js +13 -9
- package/Insights/InsightsContainer.js +22 -19
- package/Insights/WidgetChartContainer.js +34 -30
- package/Insights/WidgetDataGridContainer.js +45 -33
- package/Insights/WidgetTableContainer.js +29 -26
- package/Insights/WidgetTileContainer.js +16 -12
- package/Insights/WidgetTitleBar.js +15 -10
- package/Insights/Widgets.js +28 -25
- package/Insights/charts/AreaChart.js +15 -12
- package/Insights/charts/BarChart.js +15 -12
- package/Insights/charts/ComposedChart.js +15 -13
- package/Insights/charts/CustomTooltipContent.js +13 -9
- package/Insights/charts/GaugeChart.js +6 -3
- package/Insights/charts/LineChart.js +15 -12
- package/Insights/charts/OhlcChart.js +46 -40
- package/Insights/charts/PieChart.js +25 -26
- package/Insights/charts/RadarChart.js +19 -17
- package/Insights/charts/ScatterChart.js +26 -28
- package/Insights/charts/constants.js +4 -1
- package/Insights/charts/formatters.js +33 -23
- package/Insights/charts/index.js +2 -1
- package/Insights/charts/renderers.js +36 -26
- package/Insights/hooks/useQueriesData.js +27 -30
- package/Insights/hooks/useWidgetDetail.js +24 -15
- package/OverflowCommandBar/OverflowCommandBar.js +19 -12
- package/OverflowCommandBar/OverflowMenu.js +22 -30
- package/OverflowCommandBar/OverflowMenuDivider.js +10 -6
- package/OverflowCommandBar/index.js +9 -3
- package/OverflowCommandBar/render.js +15 -10
- package/OverflowCommandBar/utils.js +6 -4
- package/PageBoard/BoardColumn.js +8 -5
- package/PageBoard/BoardColumnCard.d.ts +1 -1
- package/PageBoard/BoardColumnCard.js +15 -11
- package/PageBoard/BoardColumnUI.js +45 -46
- package/PageBoard/BoardingColumnCardLoading.js +13 -10
- package/PageBoard/Header.js +23 -28
- package/PageBoard/PageBoard.js +28 -26
- package/PageBoard/index.js +5 -1
- package/PageEntityForm/CommandContainer.js +25 -21
- package/PageEntityForm/FormTabRelated.js +20 -17
- package/PageEntityForm/PageEntityForm.js +20 -16
- package/PageEntityForm/PageEntityFormDesktopContainer.js +77 -70
- package/PageEntityForm/PageEntityFormStringContext.js +9 -5
- package/PageEntityForm/ProcessFlow.js +24 -21
- package/PageEntityForm/RecordCard.js +31 -24
- package/PageEntityForm/RecordCardLoading.js +13 -11
- package/PageEntityForm/RecordSetNavigatorContainer.js +34 -31
- package/PageEntityForm/RelatedViewSelector.js +34 -36
- package/PageEntityForm/SectionContainer.js +35 -31
- package/PageEntityForm/StandardControl.js +84 -76
- package/PageEntityForm/SubgridControl.js +23 -21
- package/PageEntityForm/index.js +5 -1
- package/PageEntityView/FormSubgridContainer.js +26 -22
- package/PageEntityView/PageEntityView.js +19 -15
- package/PageEntityView/PageEntityViewDesktopContainer.js +13 -9
- package/PageEntityView/PageEntityViewDesktopFrame.js +21 -17
- package/PageEntityView/PageEntityViewMobileContainer.js +13 -9
- package/PageEntityView/PageEntityViewStringContext.js +9 -5
- package/PageEntityView/index.js +5 -1
- package/PageInsights/PageInsights.js +13 -9
- package/PageInsights/index.js +6 -1
- package/ProgressIndicatorContainer/index.js +14 -10
- package/ToastNotificationContainer/index.js +18 -15
- package/componentStore.js +5 -2
- package/components/BodyLoading.js +11 -7
- package/components/DialogLogin.js +8 -5
- package/components/DndProvider.d.ts +12 -0
- package/components/DndProvider.js +68 -0
- package/components/LoginForm.js +46 -36
- package/components/PageBroken.js +8 -5
- package/components/PageLoading.js +8 -5
- package/components/PageLogin.js +17 -14
- package/form/FormControl.js +44 -50
- package/form/FormControlLoading.js +8 -4
- package/form/controls/AttachmentControl.js +72 -77
- package/form/controls/AttachmentsControl.js +24 -30
- package/form/controls/CurrencyControl.js +16 -13
- package/form/controls/DateControl.js +24 -18
- package/form/controls/DateRangeControl.js +22 -18
- package/form/controls/DateTimeControl.js +49 -43
- package/form/controls/DecimalControl.js +14 -11
- package/form/controls/DurationControl.js +18 -14
- package/form/controls/EmailControl.js +14 -11
- package/form/controls/IntegerControl.js +11 -8
- package/form/controls/LookupControl.js +58 -56
- package/form/controls/MultiSelectControl.js +12 -9
- package/form/controls/MultiSelectLookupControl.js +55 -53
- package/form/controls/PasswordControl.js +11 -8
- package/form/controls/RichTextControl.js +32 -5
- package/form/controls/SelectControl.js +15 -13
- package/form/controls/SwitchControl.js +7 -4
- package/form/controls/TelephoneControl.js +10 -7
- package/form/controls/TextAreaControl.js +11 -8
- package/form/controls/TextControl.js +12 -9
- package/form/controls/UrlControl.js +10 -7
- package/form/controls/types.js +2 -1
- package/form/controls/useLookupData.js +43 -54
- package/form/layout/FormBody/FormBody.js +10 -6
- package/form/layout/FormBody/index.js +17 -1
- package/form/layout/FormSection/FormSection.js +31 -20
- package/form/layout/FormSection/FormSectionColumn.js +7 -3
- package/form/layout/FormSection/FormSectionLoading.js +5 -1
- package/form/layout/FormSection/index.js +5 -1
- package/form/layout/FormTab/FormTab.js +21 -17
- package/form/layout/FormTab/FormTabColumn.js +9 -5
- package/form/layout/FormTab/index.js +5 -1
- package/form/layout/TabContext.js +5 -2
- package/form/layout/index.js +9 -3
- package/form/types.js +2 -1
- package/package.json +4 -12
- package/types/index.js +2 -1
- package/utils/avatar.js +4 -1
- package/DataGrid/ScrollbarWithMoreDataRequest.d.ts +0 -9
- package/DataGrid/ScrollbarWithMoreDataRequest.js +0 -33
- package/form/controls/NumberControl.d.ts +0 -4
- package/form/controls/NumberControl.js +0 -16
- package/form/controls/utils.d.ts +0 -4
- package/form/controls/utils.js +0 -42
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TableHeaderFilterCell = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
const hooks_1 = require("@headless-adminapp/app/datagrid/hooks");
|
|
7
|
+
const hooks_2 = require("@headless-adminapp/app/metadata/hooks");
|
|
8
|
+
const icons_1 = require("@headless-adminapp/icons");
|
|
9
|
+
const react_1 = require("react");
|
|
10
|
+
const PageEntityViewStringContext_1 = require("../../PageEntityView/PageEntityViewStringContext");
|
|
11
|
+
const FilterForm_1 = require("./FilterForm");
|
|
12
|
+
const useStyles = (0, react_components_1.makeStyles)({
|
|
10
13
|
root: {
|
|
11
14
|
cursor: 'pointer',
|
|
12
15
|
userSelect: 'none',
|
|
13
16
|
'&:active': {
|
|
14
|
-
backgroundColor: tokens.colorSubtleBackgroundPressed,
|
|
17
|
+
backgroundColor: react_components_1.tokens.colorSubtleBackgroundPressed,
|
|
15
18
|
},
|
|
16
19
|
'&:hover [data-id="resize-handle"]': {
|
|
17
20
|
opacity: 0.5,
|
|
@@ -38,7 +41,7 @@ const useStyles = makeStyles({
|
|
|
38
41
|
},
|
|
39
42
|
resizeHandleInner: {
|
|
40
43
|
width: '2px',
|
|
41
|
-
background: tokens.colorNeutralForeground1,
|
|
44
|
+
background: react_components_1.tokens.colorNeutralForeground1,
|
|
42
45
|
// borderLeft: `1px solid ${tokens.colorNeutralForeground1}`,
|
|
43
46
|
// borderRight: `1px solid ${tokens.colorNeutralForeground1}`,
|
|
44
47
|
},
|
|
@@ -48,7 +51,7 @@ const useStyles = makeStyles({
|
|
|
48
51
|
},
|
|
49
52
|
},
|
|
50
53
|
});
|
|
51
|
-
|
|
54
|
+
const TableHeaderFilterCell = ({ children, sortDirection,
|
|
52
55
|
// onChangeFilterCondition,
|
|
53
56
|
onChangeSortDirection,
|
|
54
57
|
// attribute,
|
|
@@ -56,11 +59,11 @@ onChangeSortDirection,
|
|
|
56
59
|
minWidth,
|
|
57
60
|
// onChangeWidth,
|
|
58
61
|
column, onResetSize, resizeHandler, resizable, disableFilter, disableSort, }) => {
|
|
59
|
-
const [visible, setVisible] = useState(false);
|
|
60
|
-
const schema = useDataGridSchema();
|
|
61
|
-
const { schemaStore } = useMetadata();
|
|
62
|
-
const strings = usePageEntityViewStrings();
|
|
63
|
-
const attribute = useMemo(() => {
|
|
62
|
+
const [visible, setVisible] = (0, react_1.useState)(false);
|
|
63
|
+
const schema = (0, hooks_1.useDataGridSchema)();
|
|
64
|
+
const { schemaStore } = (0, hooks_2.useMetadata)();
|
|
65
|
+
const strings = (0, PageEntityViewStringContext_1.usePageEntityViewStrings)();
|
|
66
|
+
const attribute = (0, react_1.useMemo)(() => {
|
|
64
67
|
const _attribute = schema.attributes[column.name];
|
|
65
68
|
if (!column.expandedKey) {
|
|
66
69
|
return _attribute;
|
|
@@ -71,7 +74,7 @@ column, onResetSize, resizeHandler, resizable, disableFilter, disableSort, }) =>
|
|
|
71
74
|
const lookupSchema = schemaStore.getSchema(_attribute.entity);
|
|
72
75
|
return lookupSchema.attributes[column.expandedKey];
|
|
73
76
|
}, [column.expandedKey, column.name, schemaStore, schema.attributes]);
|
|
74
|
-
const align = useMemo(() => {
|
|
77
|
+
const align = (0, react_1.useMemo)(() => {
|
|
75
78
|
switch (attribute.type) {
|
|
76
79
|
case 'money':
|
|
77
80
|
case 'number':
|
|
@@ -81,14 +84,14 @@ column, onResetSize, resizeHandler, resizable, disableFilter, disableSort, }) =>
|
|
|
81
84
|
}
|
|
82
85
|
}, [attribute.type]);
|
|
83
86
|
const styles = useStyles();
|
|
84
|
-
const isResizingRef = useRef(false);
|
|
85
|
-
const [columnFilters, setColumnFilters] = useGridColumnFilter();
|
|
87
|
+
const isResizingRef = (0, react_1.useRef)(false);
|
|
88
|
+
const [columnFilters, setColumnFilters] = (0, hooks_1.useGridColumnFilter)();
|
|
86
89
|
const filterCondition = columnFilters[column.id];
|
|
87
90
|
const onChangeFilterCondition = (condition) => {
|
|
88
91
|
setColumnFilters(column.id, condition);
|
|
89
92
|
};
|
|
90
|
-
const sortMenuItems = (
|
|
91
|
-
const filterMenuItems = (
|
|
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?.('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?.('desc'), children: strings.sortByDescending })] }));
|
|
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: () => {
|
|
92
95
|
onChangeFilterCondition(undefined);
|
|
93
96
|
}, children: strings.clearFilter }))] }));
|
|
94
97
|
const menuItems = [];
|
|
@@ -98,36 +101,36 @@ column, onResetSize, resizeHandler, resizable, disableFilter, disableSort, }) =>
|
|
|
98
101
|
if (!disableFilter) {
|
|
99
102
|
menuItems.push(filterMenuItems);
|
|
100
103
|
}
|
|
101
|
-
const headerCell = (
|
|
104
|
+
const headerCell = ((0, jsx_runtime_1.jsxs)(react_components_1.TableHeaderCell, { as: "div", className: (0, react_components_1.mergeClasses)(styles.root, align === 'right' && styles.right), style: {
|
|
102
105
|
textAlign: align,
|
|
103
106
|
width: minWidth,
|
|
104
107
|
minWidth: minWidth,
|
|
105
108
|
maxWidth: minWidth,
|
|
106
109
|
display: 'flex',
|
|
107
110
|
alignItems: 'center',
|
|
108
|
-
fontWeight: tokens.fontWeightMedium,
|
|
111
|
+
fontWeight: react_components_1.tokens.fontWeightMedium,
|
|
109
112
|
// pointerEvents: disableFilter && disableSort ? 'none' : 'auto',
|
|
110
113
|
}, onClick: (event) => {
|
|
111
114
|
event.preventDefault();
|
|
112
|
-
}, aside: resizable ? (
|
|
115
|
+
}, aside: resizable ? ((0, jsx_runtime_1.jsx)("div", { className: (0, react_components_1.mergeClasses)(styles.resizeHandle), "data-id": "resize-handle", onClick: (event) => {
|
|
113
116
|
event.stopPropagation();
|
|
114
117
|
event.preventDefault();
|
|
115
118
|
}, onDoubleClick: (event) => {
|
|
116
119
|
event.stopPropagation();
|
|
117
120
|
event.preventDefault();
|
|
118
|
-
onResetSize
|
|
121
|
+
onResetSize?.();
|
|
119
122
|
}, onMouseDown: (event) => {
|
|
120
123
|
event.stopPropagation();
|
|
121
124
|
event.preventDefault();
|
|
122
|
-
resizeHandler
|
|
125
|
+
resizeHandler?.(event);
|
|
123
126
|
}, onMouseUp: (event) => {
|
|
124
127
|
event.stopPropagation();
|
|
125
128
|
event.preventDefault();
|
|
126
129
|
}, onTouchStart: (event) => {
|
|
127
130
|
event.stopPropagation();
|
|
128
131
|
event.preventDefault();
|
|
129
|
-
resizeHandler
|
|
130
|
-
}, children:
|
|
132
|
+
resizeHandler?.(event);
|
|
133
|
+
}, children: (0, jsx_runtime_1.jsx)("div", { className: (0, react_components_1.mergeClasses)(styles.resizeHandleInner) }) })) : null, onMouseUp: (event) => {
|
|
131
134
|
event.preventDefault();
|
|
132
135
|
if (isResizingRef.current) {
|
|
133
136
|
return;
|
|
@@ -135,15 +138,16 @@ column, onResetSize, resizeHandler, resizable, disableFilter, disableSort, }) =>
|
|
|
135
138
|
isResizingRef.current = false;
|
|
136
139
|
}, sortable: !disableSort,
|
|
137
140
|
// sortDirection="ascending"
|
|
138
|
-
sortDirection: getSortDirection(sortDirection), children: [children, !!filterCondition && (
|
|
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 }) }))] }));
|
|
139
142
|
if (disableFilter && disableSort) {
|
|
140
143
|
return headerCell;
|
|
141
144
|
}
|
|
142
|
-
return (
|
|
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) => {
|
|
143
146
|
onChangeFilterCondition(condition);
|
|
144
147
|
setVisible(false);
|
|
145
148
|
}, onCancel: () => setVisible(false) })] }) }) })] }));
|
|
146
149
|
};
|
|
150
|
+
exports.TableHeaderFilterCell = TableHeaderFilterCell;
|
|
147
151
|
const getSortDirection = (direction) => {
|
|
148
152
|
if (direction === 'asc') {
|
|
149
153
|
return 'ascending';
|
|
@@ -1 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TableHeaderFilterCell = void 0;
|
|
4
|
+
var TableHeaderFilterCell_1 = require("./TableHeaderFilterCell");
|
|
5
|
+
Object.defineProperty(exports, "TableHeaderFilterCell", { enumerable: true, get: function () { return TableHeaderFilterCell_1.TableHeaderFilterCell; } });
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDefaultOperator = getDefaultOperator;
|
|
4
|
+
exports.getDefaultValues = getDefaultValues;
|
|
5
|
+
function getDefaultOperator(operator, attributeType) {
|
|
2
6
|
if (operator) {
|
|
3
7
|
return operator;
|
|
4
8
|
}
|
|
@@ -10,7 +14,7 @@ export function getDefaultOperator(operator, attributeType) {
|
|
|
10
14
|
}
|
|
11
15
|
return 'eq';
|
|
12
16
|
}
|
|
13
|
-
|
|
17
|
+
function getDefaultValues(operator, value, _attributeType) {
|
|
14
18
|
if (!value)
|
|
15
19
|
return [];
|
|
16
20
|
return Array.isArray(value) ? value : [value];
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GridHeaderContainer = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const GridHeaderDesktop_1 = require("./GridHeaderDesktop");
|
|
6
|
+
const GridHeaderContainer = () => {
|
|
7
|
+
return (0, jsx_runtime_1.jsx)(GridHeaderDesktop_1.GridHeaderDesktop, {});
|
|
5
8
|
};
|
|
9
|
+
exports.GridHeaderContainer = GridHeaderContainer;
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GridHeaderDesktop = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
const hooks_1 = require("@headless-adminapp/app/datagrid/hooks");
|
|
7
|
+
const locale_1 = require("@headless-adminapp/app/locale");
|
|
8
|
+
const icons_1 = require("@headless-adminapp/icons");
|
|
9
|
+
const react_1 = require("react");
|
|
10
|
+
const AppStringContext_1 = require("../App/AppStringContext");
|
|
11
|
+
const PageEntityViewStringContext_1 = require("../PageEntityView/PageEntityViewStringContext");
|
|
12
|
+
const CustomizeColumns_1 = require("./CustomizeColumns");
|
|
13
|
+
const GridHeaderDesktop = (props) => {
|
|
14
|
+
const viewLookup = (0, hooks_1.useGridViewLookupData)();
|
|
15
|
+
const selectedView = (0, hooks_1.useSelectedView)();
|
|
16
|
+
const changeView = (0, hooks_1.useChangeView)();
|
|
17
|
+
const [searchText, setSearchText] = (0, hooks_1.useSearchText)();
|
|
18
|
+
const [isColumnCustomizationOpen, setIsColumnCustomizationOpen] = (0, react_1.useState)(false);
|
|
19
|
+
const { language } = (0, locale_1.useLocale)();
|
|
20
|
+
const strings = (0, PageEntityViewStringContext_1.usePageEntityViewStrings)();
|
|
21
|
+
const appStrings = (0, AppStringContext_1.useAppStrings)();
|
|
22
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
21
23
|
alignItems: 'center',
|
|
22
24
|
paddingInline: 8,
|
|
23
25
|
gap: 16,
|
|
24
26
|
display: 'flex',
|
|
25
|
-
}, children: [
|
|
27
|
+
}, children: [(0, jsx_runtime_1.jsx)(CustomizeColumns_1.CustomizeColumns, { opened: isColumnCustomizationOpen, onClose: () => setIsColumnCustomizationOpen(false) }), (0, jsx_runtime_1.jsx)("div", { style: {
|
|
26
28
|
flex: 1,
|
|
27
29
|
alignItems: 'center',
|
|
28
30
|
gap: 16,
|
|
29
31
|
justifyContent: 'space-between',
|
|
30
32
|
display: 'flex',
|
|
31
|
-
}, children:
|
|
32
|
-
fontSize: tokens.fontSizeBase400,
|
|
33
|
-
fontWeight: tokens.fontWeightMedium,
|
|
34
|
-
}, children:
|
|
35
|
-
var _a, _b;
|
|
36
|
-
return (_jsx(MenuItem, { onClick: () => changeView(view.id), children: (_b = (_a = view.localizedNames) === null || _a === void 0 ? void 0 : _a[language]) !== null && _b !== void 0 ? _b : view.name }, view.id));
|
|
37
|
-
}) }) })] }) }), _jsxs("div", { style: { alignItems: 'center', display: 'flex', gap: 16 }, children: [props.headingRight, _jsx(Button, { appearance: "subtle", icon: _jsx(Icons.EditColumns, { size: 24 }), onClick: () => setIsColumnCustomizationOpen(true), children: strings.editColumns }), _jsx(Input, { contentBefore: _jsx(Icons.Search, { size: 16 }), placeholder: appStrings.searchPlaceholder, value: searchText, onChange: (e) => setSearchText(e.target.value), appearance: "filled-darker" })] })] }));
|
|
33
|
+
}, children: (0, jsx_runtime_1.jsxs)(react_components_1.Menu, { children: [(0, jsx_runtime_1.jsx)(react_components_1.MenuTrigger, { children: (0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "subtle", icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.ChevronDown, {}), iconPosition: "after", style: {
|
|
34
|
+
fontSize: react_components_1.tokens.fontSizeBase400,
|
|
35
|
+
fontWeight: react_components_1.tokens.fontWeightMedium,
|
|
36
|
+
}, children: selectedView.localizedNames?.[language] ?? selectedView.name }) }), (0, jsx_runtime_1.jsx)(react_components_1.MenuPopover, { children: (0, jsx_runtime_1.jsx)(react_components_1.MenuList, { children: viewLookup.map((view) => ((0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { onClick: () => changeView(view.id), children: view.localizedNames?.[language] ?? view.name }, view.id))) }) })] }) }), (0, jsx_runtime_1.jsxs)("div", { style: { alignItems: 'center', display: 'flex', gap: 16 }, children: [props.headingRight, (0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "subtle", icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.EditColumns, { size: 24 }), onClick: () => setIsColumnCustomizationOpen(true), children: strings.editColumns }), (0, jsx_runtime_1.jsx)(react_components_1.Input, { contentBefore: (0, jsx_runtime_1.jsx)(icons_1.Icons.Search, { size: 16 }), placeholder: appStrings.searchPlaceholder, value: searchText, onChange: (e) => setSearchText(e.target.value), appearance: "filled-darker" })] })] }));
|
|
38
37
|
};
|
|
38
|
+
exports.GridHeaderDesktop = GridHeaderDesktop;
|
|
@@ -1,28 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GridHeaderMobile = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
const hooks_1 = require("@headless-adminapp/app/datagrid/hooks");
|
|
7
|
+
const locale_1 = require("@headless-adminapp/app/locale");
|
|
8
|
+
const icons_1 = require("@headless-adminapp/icons");
|
|
9
|
+
const AppStringContext_1 = require("../App/AppStringContext");
|
|
10
|
+
const GridHeaderMobile = () => {
|
|
11
|
+
const viewLookup = (0, hooks_1.useGridViewLookupData)();
|
|
12
|
+
const selectedView = (0, hooks_1.useSelectedView)();
|
|
13
|
+
const changeView = (0, hooks_1.useChangeView)();
|
|
14
|
+
const [searchText, setSearchText] = (0, hooks_1.useSearchText)();
|
|
15
|
+
const { language } = (0, locale_1.useLocale)();
|
|
16
|
+
const appStrings = (0, AppStringContext_1.useAppStrings)();
|
|
17
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
15
18
|
alignItems: 'center',
|
|
16
19
|
paddingInline: 8,
|
|
17
20
|
gap: 8,
|
|
18
21
|
display: 'flex',
|
|
19
|
-
}, children: [
|
|
22
|
+
}, children: [(0, jsx_runtime_1.jsx)("div", { style: { alignItems: 'center', display: 'flex', gap: 16, flex: 1 }, children: (0, jsx_runtime_1.jsx)(react_components_1.Input, { contentBefore: (0, jsx_runtime_1.jsx)(icons_1.Icons.Search, { size: 16 }), placeholder: appStrings.searchPlaceholder, value: searchText, onChange: (e) => setSearchText(e.target.value), style: { flex: 1 } }) }), (0, jsx_runtime_1.jsx)("div", { style: {
|
|
20
23
|
alignItems: 'center',
|
|
21
24
|
gap: 16,
|
|
22
25
|
justifyContent: 'space-between',
|
|
23
26
|
display: 'flex',
|
|
24
|
-
}, children:
|
|
25
|
-
var _a, _b;
|
|
26
|
-
return (_jsx(MenuItem, { onClick: () => changeView(view.id), icon: selectedView.id === view.id ? (_jsx(Icons.Checkmark, {})) : undefined, children: (_b = (_a = view.localizedNames) === null || _a === void 0 ? void 0 : _a[language]) !== null && _b !== void 0 ? _b : view.name }, view.id));
|
|
27
|
-
}) }) })] }) })] }));
|
|
27
|
+
}, children: (0, jsx_runtime_1.jsxs)(react_components_1.Menu, { hasIcons: true, children: [(0, jsx_runtime_1.jsx)(react_components_1.MenuTrigger, { children: (0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "subtle", icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.Filter, {}), iconPosition: "after" }) }), (0, jsx_runtime_1.jsx)(react_components_1.MenuPopover, { children: (0, jsx_runtime_1.jsx)(react_components_1.MenuList, { children: viewLookup.map((view) => ((0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { onClick: () => changeView(view.id), icon: selectedView.id === view.id ? ((0, jsx_runtime_1.jsx)(icons_1.Icons.Checkmark, {})) : undefined, children: view.localizedNames?.[language] ?? view.name }, view.id))) }) })] }) })] }));
|
|
28
28
|
};
|
|
29
|
+
exports.GridHeaderMobile = GridHeaderMobile;
|
|
@@ -1,87 +1,93 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GridListContainer = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
const ScrollbarWithMoreDataRequest_1 = require("@headless-adminapp/app/components/ScrollbarWithMoreDataRequest");
|
|
7
|
+
const datagrid_1 = require("@headless-adminapp/app/datagrid");
|
|
8
|
+
const hooks_1 = require("@headless-adminapp/app/datagrid/hooks");
|
|
9
|
+
const locale_1 = require("@headless-adminapp/app/locale");
|
|
10
|
+
const mutable_1 = require("@headless-adminapp/app/mutable");
|
|
11
|
+
const navigation_1 = require("@headless-adminapp/app/navigation");
|
|
12
|
+
const hooks_2 = require("@headless-adminapp/app/recordset/hooks");
|
|
13
|
+
const react_virtual_1 = require("@tanstack/react-virtual");
|
|
14
|
+
const react_1 = require("react");
|
|
15
|
+
const uuid_1 = require("uuid");
|
|
16
|
+
const RecordCard_1 = require("../PageEntityForm/RecordCard");
|
|
17
|
+
const RecordCardLoading_1 = require("../PageEntityForm/RecordCardLoading");
|
|
18
|
+
const useStyles = (0, react_components_1.makeStyles)({
|
|
16
19
|
root: {
|
|
17
20
|
'&:hover': {
|
|
18
|
-
background: tokens.colorNeutralBackground1Hover,
|
|
21
|
+
background: react_components_1.tokens.colorNeutralBackground1Hover,
|
|
19
22
|
},
|
|
20
23
|
},
|
|
21
24
|
});
|
|
22
25
|
const fallbackData = [];
|
|
23
|
-
|
|
26
|
+
const GridListContainer = () => {
|
|
24
27
|
const styles = useStyles();
|
|
25
|
-
const data = useGridData();
|
|
26
|
-
const dataState = useGridDataState();
|
|
27
|
-
const fetchNextPage = useContextSelector(GridContext, (state) => state.fetchNextPage);
|
|
28
|
-
const schema = useDataGridSchema();
|
|
29
|
-
const view = useSelectedView();
|
|
30
|
-
const tableWrapperRef = useRef(null);
|
|
31
|
-
const { direction } = useLocale();
|
|
32
|
-
const dataRef = useRef(data);
|
|
28
|
+
const data = (0, hooks_1.useGridData)();
|
|
29
|
+
const dataState = (0, hooks_1.useGridDataState)();
|
|
30
|
+
const fetchNextPage = (0, mutable_1.useContextSelector)(datagrid_1.GridContext, (state) => state.fetchNextPage);
|
|
31
|
+
const schema = (0, hooks_1.useDataGridSchema)();
|
|
32
|
+
const view = (0, hooks_1.useSelectedView)();
|
|
33
|
+
const tableWrapperRef = (0, react_1.useRef)(null);
|
|
34
|
+
const { direction } = (0, locale_1.useLocale)();
|
|
35
|
+
const dataRef = (0, react_1.useRef)(data);
|
|
33
36
|
dataRef.current = data;
|
|
34
|
-
const uniqueRecords = useMemo(() => {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
const uniqueRecords = (0, react_1.useMemo)(() => {
|
|
38
|
+
return (data?.records.map((record) => ({
|
|
39
|
+
...record,
|
|
40
|
+
__uuid: (0, uuid_1.v4)(),
|
|
41
|
+
})) ?? fallbackData);
|
|
42
|
+
}, [data?.records]);
|
|
38
43
|
const rows = uniqueRecords;
|
|
39
|
-
const virtualizer = useVirtualizer({
|
|
44
|
+
const virtualizer = (0, react_virtual_1.useVirtualizer)({
|
|
40
45
|
count: rows.length,
|
|
41
|
-
getScrollElement: () =>
|
|
46
|
+
getScrollElement: () => tableWrapperRef.current?.parentElement?.parentElement,
|
|
42
47
|
estimateSize: () => 40,
|
|
43
48
|
overscan: 5,
|
|
44
49
|
enabled: true,
|
|
45
50
|
});
|
|
46
51
|
const virtualItems = virtualizer.getVirtualItems();
|
|
47
52
|
const virtualSize = virtualizer.getTotalSize();
|
|
48
|
-
const recordSetSetter = useRecordSetSetter();
|
|
49
|
-
const openFormInternal = useOpenForm();
|
|
50
|
-
const openRecord = useCallback((id) => {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
+
const recordSetSetter = (0, hooks_2.useRecordSetSetter)();
|
|
54
|
+
const openFormInternal = (0, navigation_1.useOpenForm)();
|
|
55
|
+
const openRecord = (0, react_1.useCallback)((id) => {
|
|
56
|
+
recordSetSetter(schema.logicalName, dataRef.current?.records.map((x) => x[schema.idAttribute]) ??
|
|
57
|
+
[]);
|
|
53
58
|
openFormInternal({
|
|
54
59
|
logicalName: schema.logicalName,
|
|
55
60
|
id,
|
|
56
61
|
});
|
|
57
62
|
}, [openFormInternal, recordSetSetter, schema.idAttribute, schema.logicalName]);
|
|
58
|
-
return (
|
|
63
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', flex: 1, flexDirection: 'column' }, children: (0, jsx_runtime_1.jsx)(ScrollbarWithMoreDataRequest_1.ScrollbarWithMoreDataRequest, { data: data?.records, hasMore: dataState?.hasNextPage, rtl: direction === 'rtl', onRequestMore: () => {
|
|
59
64
|
fetchNextPage();
|
|
60
|
-
}, children:
|
|
65
|
+
}, children: (0, jsx_runtime_1.jsx)("div", { style: {
|
|
61
66
|
position: 'relative',
|
|
62
|
-
}, ref: tableWrapperRef, children:
|
|
67
|
+
}, ref: tableWrapperRef, children: (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
63
68
|
display: 'flex',
|
|
64
69
|
flexDirection: 'column',
|
|
65
70
|
width: '100%',
|
|
66
71
|
height: virtualizer.getTotalSize(),
|
|
67
|
-
}, children: [
|
|
72
|
+
}, children: [(0, jsx_runtime_1.jsx)("div", { style: {
|
|
68
73
|
display: 'flex',
|
|
69
74
|
flexDirection: 'column',
|
|
70
75
|
}, children: virtualItems.map((virtualRow) => {
|
|
71
76
|
const row = rows[virtualRow.index];
|
|
72
|
-
return (
|
|
77
|
+
return ((0, jsx_runtime_1.jsx)("div", { ref: virtualizer.measureElement, "data-index": virtualRow.index, className: (0, react_components_1.mergeClasses)(styles.root), style: {
|
|
73
78
|
width: '100%',
|
|
74
79
|
position: 'absolute',
|
|
75
80
|
transform: `translateY(${virtualRow.start}px)`,
|
|
76
81
|
}, onClick: () => {
|
|
77
82
|
const id = row[schema.idAttribute];
|
|
78
83
|
openRecord(id);
|
|
79
|
-
}, children:
|
|
80
|
-
}) }), dataState.isFetching && (
|
|
84
|
+
}, children: (0, jsx_runtime_1.jsx)(RecordCard_1.RecordCard, { cardView: view.experience.card, record: row, schema: schema, selected: false }) }, virtualRow.key));
|
|
85
|
+
}) }), dataState.isFetching && ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
81
86
|
display: 'flex',
|
|
82
87
|
flexDirection: 'column',
|
|
83
88
|
width: '100%',
|
|
84
89
|
position: 'absolute',
|
|
85
90
|
transform: `translateY(${virtualSize}px)`,
|
|
86
|
-
}, children: Array.from({ length: 10 }).map((_, index) => (
|
|
91
|
+
}, children: Array.from({ length: 10 }).map((_, index) => ((0, jsx_runtime_1.jsx)(RecordCardLoading_1.RecordCardLoading, { cardView: view.experience.card, schema: schema }, index))) }))] }) }) }) }));
|
|
87
92
|
};
|
|
93
|
+
exports.GridListContainer = GridListContainer;
|
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GridPaginationContainer = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
const hooks_1 = require("@headless-adminapp/app/datagrid/hooks");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const PageEntityViewStringContext_1 = require("../PageEntityView/PageEntityViewStringContext");
|
|
9
|
+
const GridPaginationContainer = () => {
|
|
10
|
+
const data = (0, hooks_1.useGridData)();
|
|
11
|
+
const [selectedIds] = (0, hooks_1.useGridSelection)();
|
|
12
|
+
const strings = (0, PageEntityViewStringContext_1.usePageEntityViewStrings)();
|
|
13
|
+
return ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsxs)(react_components_1.Body1, { style: {
|
|
14
|
+
color: react_components_1.tokens.colorNeutralForeground3,
|
|
13
15
|
display: 'flex',
|
|
14
16
|
gap: 8,
|
|
15
|
-
}, children: [
|
|
17
|
+
}, children: [(0, jsx_runtime_1.jsxs)("span", { children: [strings.records, ": ", data?.count ?? '-'] }), (0, jsx_runtime_1.jsx)("span", { children: "|" }), (0, jsx_runtime_1.jsxs)("span", { children: [strings.loaded, ": ", data?.records.length ?? '-'] }), (selectedIds.length > 0 || (data?.count ?? 0) > 0) && ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("span", { children: "|" }), (0, jsx_runtime_1.jsxs)("span", { children: [strings.selected, ": ", selectedIds.length] })] }))] }) }));
|
|
16
18
|
};
|
|
19
|
+
exports.GridPaginationContainer = GridPaginationContainer;
|