@mui/x-data-grid-pro 7.29.0 → 7.29.2
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/CHANGELOG.md +131 -0
- package/DataGridPro/DataGrid.js +2 -9
- package/DataGridPro/DataGridPro.js +231 -238
- package/DataGridPro/index.js +3 -39
- package/DataGridPro/package.json +2 -2
- package/DataGridPro/useDataGridProComponent.js +91 -99
- package/DataGridPro/useDataGridProProps.js +20 -28
- package/components/GridColumnHeaderCollapseIcon.js +0 -1
- package/components/GridColumnHeaders.js +39 -46
- package/components/GridColumnMenuPinningItem.js +39 -46
- package/components/GridDataSourceTreeDataGroupingCell.js +30 -38
- package/components/GridDetailPanel.js +14 -18
- package/components/GridDetailPanelToggleCell.js +35 -42
- package/components/GridDetailPanels.js +19 -25
- package/components/GridPinnedRows.js +12 -20
- package/components/GridProColumnMenu.js +11 -19
- package/components/GridRowReorderCell.js +36 -45
- package/components/GridTreeDataGroupingCell.js +37 -44
- package/components/headerFiltering/GridHeaderFilterCell.js +71 -78
- package/components/headerFiltering/GridHeaderFilterClearButton.js +9 -16
- package/components/headerFiltering/GridHeaderFilterMenu.js +36 -43
- package/components/headerFiltering/GridHeaderFilterMenuContainer.js +41 -48
- package/components/headerFiltering/index.js +3 -38
- package/components/index.js +7 -71
- package/components/package.json +2 -2
- package/components/reexports.js +1 -24
- package/constants/dataGridProDefaultSlotsComponents.js +16 -23
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +30 -39
- package/hooks/features/columnPinning/gridColumnPinningInterface.js +1 -5
- package/hooks/features/columnPinning/index.js +1 -16
- package/hooks/features/columnPinning/useGridColumnPinning.js +32 -42
- package/hooks/features/columnPinning/useGridColumnPinningPreProcessors.js +10 -19
- package/hooks/features/columnReorder/columnReorderInterfaces.js +1 -5
- package/hooks/features/columnReorder/columnReorderSelector.js +3 -10
- package/hooks/features/columnReorder/index.js +2 -16
- package/hooks/features/columnReorder/useGridColumnReorder.js +25 -35
- package/hooks/features/dataSource/cache.js +3 -11
- package/hooks/features/dataSource/gridDataSourceSelector.js +10 -18
- package/hooks/features/dataSource/interfaces.js +1 -5
- package/hooks/features/dataSource/useGridDataSource.js +34 -44
- package/hooks/features/dataSource/utils.js +9 -17
- package/hooks/features/detailPanel/gridDetailPanelInterface.js +1 -5
- package/hooks/features/detailPanel/gridDetailPanelSelector.js +5 -14
- package/hooks/features/detailPanel/gridDetailPanelToggleColDef.js +14 -27
- package/hooks/features/detailPanel/index.js +3 -53
- package/hooks/features/detailPanel/useGridDetailPanel.js +39 -48
- package/hooks/features/detailPanel/useGridDetailPanelPreProcessors.js +18 -27
- package/hooks/features/index.js +9 -99
- package/hooks/features/infiniteLoader/useGridInfiniteLoader.js +18 -27
- package/hooks/features/lazyLoader/useGridLazyLoader.js +14 -22
- package/hooks/features/lazyLoader/useGridLazyLoaderPreProcessors.js +13 -22
- package/hooks/features/rowPinning/gridRowPinningInterface.js +1 -5
- package/hooks/features/rowPinning/gridRowPinningSelector.js +1 -18
- package/hooks/features/rowPinning/index.js +1 -16
- package/hooks/features/rowPinning/useGridRowPinning.js +13 -23
- package/hooks/features/rowPinning/useGridRowPinningPreProcessors.d.ts +1 -1
- package/hooks/features/rowPinning/useGridRowPinningPreProcessors.js +24 -34
- package/hooks/features/rowReorder/gridRowReorderColDef.js +5 -12
- package/hooks/features/rowReorder/index.js +1 -16
- package/hooks/features/rowReorder/useGridRowReorder.js +20 -29
- package/hooks/features/rowReorder/useGridRowReorderPreProcessors.js +12 -21
- package/hooks/features/rows/index.js +1 -16
- package/hooks/features/rows/useGridRowAriaAttributes.js +14 -22
- package/hooks/features/serverSideTreeData/useGridDataSourceTreeDataPreProcessors.js +37 -46
- package/hooks/features/serverSideTreeData/utils.js +6 -13
- package/hooks/features/treeData/gridTreeDataGroupColDef.js +9 -20
- package/hooks/features/treeData/gridTreeDataUtils.js +6 -12
- package/hooks/features/treeData/index.js +1 -12
- package/hooks/features/treeData/useGridTreeData.js +7 -15
- package/hooks/features/treeData/useGridTreeDataPreProcessors.js +37 -46
- package/hooks/index.js +1 -16
- package/hooks/package.json +2 -2
- package/hooks/utils/useGridApiContext.js +2 -8
- package/hooks/utils/useGridApiRef.js +2 -8
- package/hooks/utils/useGridAriaAttributes.js +8 -16
- package/hooks/utils/useGridPrivateApiContext.js +2 -8
- package/hooks/utils/useGridRootProps.js +2 -8
- package/index.js +19 -210
- package/internals/index.js +34 -301
- package/internals/package.json +2 -2
- package/internals/propValidation.js +2 -8
- package/locales/package.json +6 -0
- package/material/icons.js +7 -14
- package/material/index.js +6 -13
- package/material/package.json +2 -2
- package/models/dataGridProProps.js +1 -5
- package/models/gridApiPro.js +1 -5
- package/models/gridFetchRowsParams.js +1 -5
- package/models/gridGroupingColDefOverride.js +1 -5
- package/models/gridProIconSlotsComponent.js +1 -5
- package/models/gridProSlotProps.js +1 -5
- package/models/gridProSlotsComponent.js +1 -5
- package/models/gridRowOrderChangeParams.js +1 -5
- package/models/gridRowScrollEndParams.js +1 -5
- package/models/gridStatePro.js +1 -5
- package/models/index.js +8 -82
- package/models/package.json +2 -2
- package/modern/DataGridPro/useDataGridProProps.js +6 -5
- package/modern/components/GridDetailPanel.js +2 -0
- package/modern/components/GridDetailPanels.js +2 -0
- package/modern/components/headerFiltering/GridHeaderFilterMenu.js +2 -2
- package/modern/hooks/features/detailPanel/useGridDetailPanel.js +3 -2
- package/modern/index.js +1 -1
- package/modern/utils/releaseInfo.js +1 -1
- package/{esm → node}/DataGridPro/DataGrid.js +9 -2
- package/{esm → node}/DataGridPro/DataGridPro.js +238 -231
- package/node/DataGridPro/index.js +39 -0
- package/node/DataGridPro/useDataGridProComponent.js +111 -0
- package/node/DataGridPro/useDataGridProProps.js +62 -0
- package/node/components/GridColumnHeaderCollapseIcon.js +1 -0
- package/node/components/GridColumnHeaders.js +99 -0
- package/node/components/GridColumnMenuPinningItem.js +97 -0
- package/node/components/GridDataSourceTreeDataGroupingCell.js +118 -0
- package/{esm → node}/components/GridDetailPanel.js +20 -13
- package/node/components/GridDetailPanelToggleCell.js +128 -0
- package/node/components/GridDetailPanels.js +69 -0
- package/node/components/GridPinnedRows.js +48 -0
- package/node/components/GridProColumnMenu.js +29 -0
- package/{esm → node}/components/GridRowReorderCell.js +45 -36
- package/{esm → node}/components/GridTreeDataGroupingCell.js +44 -37
- package/{esm → node}/components/headerFiltering/GridHeaderFilterCell.js +78 -71
- package/node/components/headerFiltering/GridHeaderFilterClearButton.js +28 -0
- package/node/components/headerFiltering/GridHeaderFilterMenu.js +95 -0
- package/node/components/headerFiltering/GridHeaderFilterMenuContainer.js +106 -0
- package/node/components/headerFiltering/index.js +38 -0
- package/node/components/index.js +71 -0
- package/node/components/reexports.js +24 -0
- package/node/constants/dataGridProDefaultSlotsComponents.js +24 -0
- package/{esm → node}/hooks/features/columnHeaders/useGridColumnHeaders.js +39 -30
- package/node/hooks/features/columnPinning/gridColumnPinningInterface.js +5 -0
- package/node/hooks/features/columnPinning/index.js +16 -0
- package/{esm → node}/hooks/features/columnPinning/useGridColumnPinning.js +42 -32
- package/{esm → node}/hooks/features/columnPinning/useGridColumnPinningPreProcessors.js +19 -10
- package/node/hooks/features/columnReorder/columnReorderInterfaces.js +5 -0
- package/node/hooks/features/columnReorder/columnReorderSelector.js +10 -0
- package/node/hooks/features/columnReorder/index.js +16 -0
- package/{esm → node}/hooks/features/columnReorder/useGridColumnReorder.js +35 -25
- package/{esm → node}/hooks/features/dataSource/cache.js +11 -3
- package/node/hooks/features/dataSource/gridDataSourceSelector.js +32 -0
- package/node/hooks/features/dataSource/interfaces.js +5 -0
- package/{esm → node}/hooks/features/dataSource/useGridDataSource.js +44 -34
- package/{esm → node}/hooks/features/dataSource/utils.js +17 -9
- package/node/hooks/features/detailPanel/gridDetailPanelInterface.js +5 -0
- package/node/hooks/features/detailPanel/gridDetailPanelSelector.js +21 -0
- package/node/hooks/features/detailPanel/gridDetailPanelToggleColDef.js +47 -0
- package/node/hooks/features/detailPanel/index.js +53 -0
- package/{esm → node}/hooks/features/detailPanel/useGridDetailPanel.js +49 -38
- package/node/hooks/features/detailPanel/useGridDetailPanelPreProcessors.js +52 -0
- package/node/hooks/features/index.js +99 -0
- package/{esm → node}/hooks/features/infiniteLoader/useGridInfiniteLoader.js +27 -18
- package/{esm → node}/hooks/features/lazyLoader/useGridLazyLoader.js +22 -14
- package/node/hooks/features/lazyLoader/useGridLazyLoaderPreProcessors.js +43 -0
- package/node/hooks/features/rowPinning/gridRowPinningInterface.js +5 -0
- package/node/hooks/features/rowPinning/gridRowPinningSelector.js +18 -0
- package/node/hooks/features/rowPinning/index.js +16 -0
- package/node/hooks/features/rowPinning/useGridRowPinning.js +62 -0
- package/{esm → node}/hooks/features/rowPinning/useGridRowPinningPreProcessors.js +34 -24
- package/node/hooks/features/rowReorder/gridRowReorderColDef.js +27 -0
- package/node/hooks/features/rowReorder/index.js +16 -0
- package/{esm → node}/hooks/features/rowReorder/useGridRowReorder.js +29 -20
- package/{esm → node}/hooks/features/rowReorder/useGridRowReorderPreProcessors.js +21 -12
- package/node/hooks/features/rows/index.js +16 -0
- package/node/hooks/features/rows/useGridRowAriaAttributes.js +45 -0
- package/{esm → node}/hooks/features/serverSideTreeData/useGridDataSourceTreeDataPreProcessors.js +46 -37
- package/node/hooks/features/serverSideTreeData/utils.js +27 -0
- package/node/hooks/features/treeData/gridTreeDataGroupColDef.js +38 -0
- package/{esm → node}/hooks/features/treeData/gridTreeDataUtils.js +12 -6
- package/node/hooks/features/treeData/index.js +12 -0
- package/node/hooks/features/treeData/useGridTreeData.js +30 -0
- package/{esm → node}/hooks/features/treeData/useGridTreeDataPreProcessors.js +46 -37
- package/node/hooks/index.js +16 -0
- package/node/hooks/utils/useGridApiContext.js +8 -0
- package/node/hooks/utils/useGridApiRef.js +8 -0
- package/node/hooks/utils/useGridAriaAttributes.js +19 -0
- package/node/hooks/utils/useGridPrivateApiContext.js +8 -0
- package/node/hooks/utils/useGridRootProps.js +8 -0
- package/node/index.js +220 -0
- package/node/internals/index.js +302 -0
- package/node/internals/propValidation.js +8 -0
- package/node/material/icons.js +24 -0
- package/node/material/index.js +15 -0
- package/node/models/dataGridProProps.js +5 -0
- package/node/models/gridApiPro.js +5 -0
- package/node/models/gridFetchRowsParams.js +5 -0
- package/node/models/gridGroupingColDefOverride.js +5 -0
- package/node/models/gridProIconSlotsComponent.js +5 -0
- package/node/models/gridProSlotProps.js +5 -0
- package/node/models/gridProSlotsComponent.js +5 -0
- package/node/models/gridRowOrderChangeParams.js +5 -0
- package/node/models/gridRowScrollEndParams.js +5 -0
- package/node/models/gridStatePro.js +5 -0
- package/node/models/index.js +82 -0
- package/node/themeAugmentation/index.js +27 -0
- package/node/themeAugmentation/overrides.js +5 -0
- package/node/themeAugmentation/props.js +5 -0
- package/node/typeOverloads/index.js +16 -0
- package/node/typeOverloads/modules.js +5 -0
- package/node/typeOverloads/reexports.js +26 -0
- package/node/utils/index.js +16 -0
- package/node/utils/releaseInfo.js +20 -0
- package/{esm → node}/utils/tree/createRowTree.js +14 -7
- package/node/utils/tree/index.js +12 -0
- package/{esm → node}/utils/tree/insertDataRowInTree.js +18 -11
- package/node/utils/tree/models.js +5 -0
- package/{esm → node}/utils/tree/removeDataRowFromTree.js +16 -9
- package/{esm → node}/utils/tree/sortRowTree.js +12 -5
- package/{esm → node}/utils/tree/updateRowTree.js +26 -18
- package/{esm → node}/utils/tree/utils.js +34 -18
- package/package.json +6 -6
- package/themeAugmentation/index.js +4 -27
- package/themeAugmentation/overrides.js +1 -5
- package/themeAugmentation/package.json +2 -2
- package/themeAugmentation/props.js +1 -5
- package/typeOverloads/index.js +1 -16
- package/typeOverloads/modules.js +1 -5
- package/typeOverloads/package.json +2 -2
- package/typeOverloads/reexports.js +14 -25
- package/utils/index.js +1 -16
- package/utils/package.json +2 -2
- package/utils/releaseInfo.js +5 -12
- package/utils/tree/createRowTree.js +7 -14
- package/utils/tree/index.js +1 -12
- package/utils/tree/insertDataRowInTree.js +11 -18
- package/utils/tree/models.js +1 -5
- package/utils/tree/removeDataRowFromTree.js +9 -16
- package/utils/tree/sortRowTree.js +5 -12
- package/utils/tree/updateRowTree.js +18 -26
- package/utils/tree/utils.js +18 -34
- package/esm/DataGridPro/index.js +0 -3
- package/esm/DataGridPro/useDataGridProComponent.js +0 -103
- package/esm/DataGridPro/useDataGridProProps.js +0 -52
- package/esm/components/GridColumnHeaderCollapseIcon.js +0 -0
- package/esm/components/GridColumnHeaders.js +0 -92
- package/esm/components/GridColumnMenuPinningItem.js +0 -90
- package/esm/components/GridDataSourceTreeDataGroupingCell.js +0 -110
- package/esm/components/GridDetailPanelToggleCell.js +0 -121
- package/esm/components/GridDetailPanels.js +0 -60
- package/esm/components/GridPinnedRows.js +0 -40
- package/esm/components/GridProColumnMenu.js +0 -21
- package/esm/components/headerFiltering/GridHeaderFilterClearButton.js +0 -21
- package/esm/components/headerFiltering/GridHeaderFilterMenu.js +0 -88
- package/esm/components/headerFiltering/GridHeaderFilterMenuContainer.js +0 -99
- package/esm/components/headerFiltering/index.js +0 -3
- package/esm/components/index.js +0 -7
- package/esm/components/reexports.js +0 -1
- package/esm/constants/dataGridProDefaultSlotsComponents.js +0 -17
- package/esm/hooks/features/columnPinning/gridColumnPinningInterface.js +0 -1
- package/esm/hooks/features/columnPinning/index.js +0 -1
- package/esm/hooks/features/columnReorder/columnReorderInterfaces.js +0 -1
- package/esm/hooks/features/columnReorder/columnReorderSelector.js +0 -3
- package/esm/hooks/features/columnReorder/index.js +0 -2
- package/esm/hooks/features/dataSource/gridDataSourceSelector.js +0 -24
- package/esm/hooks/features/dataSource/interfaces.js +0 -1
- package/esm/hooks/features/detailPanel/gridDetailPanelInterface.js +0 -1
- package/esm/hooks/features/detailPanel/gridDetailPanelSelector.js +0 -12
- package/esm/hooks/features/detailPanel/gridDetailPanelToggleColDef.js +0 -34
- package/esm/hooks/features/detailPanel/index.js +0 -3
- package/esm/hooks/features/detailPanel/useGridDetailPanelPreProcessors.js +0 -43
- package/esm/hooks/features/index.js +0 -9
- package/esm/hooks/features/lazyLoader/useGridLazyLoaderPreProcessors.js +0 -34
- package/esm/hooks/features/rowPinning/gridRowPinningInterface.js +0 -1
- package/esm/hooks/features/rowPinning/gridRowPinningSelector.js +0 -1
- package/esm/hooks/features/rowPinning/index.js +0 -1
- package/esm/hooks/features/rowPinning/useGridRowPinning.js +0 -52
- package/esm/hooks/features/rowReorder/gridRowReorderColDef.js +0 -20
- package/esm/hooks/features/rowReorder/index.js +0 -1
- package/esm/hooks/features/rows/index.js +0 -1
- package/esm/hooks/features/rows/useGridRowAriaAttributes.js +0 -37
- package/esm/hooks/features/serverSideTreeData/utils.js +0 -20
- package/esm/hooks/features/treeData/gridTreeDataGroupColDef.js +0 -27
- package/esm/hooks/features/treeData/index.js +0 -1
- package/esm/hooks/features/treeData/useGridTreeData.js +0 -22
- package/esm/hooks/index.js +0 -1
- package/esm/hooks/utils/useGridApiContext.js +0 -2
- package/esm/hooks/utils/useGridApiRef.js +0 -2
- package/esm/hooks/utils/useGridAriaAttributes.js +0 -11
- package/esm/hooks/utils/useGridPrivateApiContext.js +0 -2
- package/esm/hooks/utils/useGridRootProps.js +0 -2
- package/esm/index.js +0 -22
- package/esm/internals/index.js +0 -35
- package/esm/internals/propValidation.js +0 -2
- package/esm/material/icons.js +0 -17
- package/esm/material/index.js +0 -8
- package/esm/models/dataGridProProps.js +0 -1
- package/esm/models/gridApiPro.js +0 -1
- package/esm/models/gridFetchRowsParams.js +0 -1
- package/esm/models/gridGroupingColDefOverride.js +0 -1
- package/esm/models/gridProIconSlotsComponent.js +0 -1
- package/esm/models/gridProSlotProps.js +0 -1
- package/esm/models/gridProSlotsComponent.js +0 -1
- package/esm/models/gridRowOrderChangeParams.js +0 -1
- package/esm/models/gridRowScrollEndParams.js +0 -1
- package/esm/models/gridStatePro.js +0 -1
- package/esm/models/index.js +0 -8
- package/esm/themeAugmentation/index.js +0 -4
- package/esm/themeAugmentation/overrides.js +0 -1
- package/esm/themeAugmentation/props.js +0 -1
- package/esm/typeOverloads/index.js +0 -1
- package/esm/typeOverloads/modules.js +0 -1
- package/esm/typeOverloads/reexports.js +0 -15
- package/esm/utils/index.js +0 -1
- package/esm/utils/releaseInfo.js +0 -13
- package/esm/utils/tree/index.js +0 -1
- package/esm/utils/tree/models.js +0 -1
- /package/{locales.d.ts → locales/index.d.ts} +0 -0
- /package/{esm/locales.js → locales/index.js} +0 -0
- /package/modern/{locales.js → locales/index.js} +0 -0
- /package/{locales.js → node/locales/index.js} +0 -0
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import composeClasses from '@mui/utils/composeClasses';
|
|
4
|
-
import Box from '@mui/material/Box';
|
|
5
|
-
import { getDataGridUtilityClass, useGridSelector } from '@mui/x-data-grid';
|
|
6
|
-
import { useGridSelectorV8 } from '@mui/x-data-grid/internals';
|
|
7
|
-
import CircularProgress from '@mui/material/CircularProgress';
|
|
8
|
-
import { useGridRootProps } from "../hooks/utils/useGridRootProps.js";
|
|
9
|
-
import { useGridPrivateApiContext } from "../hooks/utils/useGridPrivateApiContext.js";
|
|
10
|
-
import { gridDataSourceErrorSelector, gridDataSourceLoadingIdSelector } from "../hooks/features/dataSource/gridDataSourceSelector.js";
|
|
11
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
-
const useUtilityClasses = ownerState => {
|
|
13
|
-
const {
|
|
14
|
-
classes
|
|
15
|
-
} = ownerState;
|
|
16
|
-
const slots = {
|
|
17
|
-
root: ['treeDataGroupingCell'],
|
|
18
|
-
toggle: ['treeDataGroupingCellToggle'],
|
|
19
|
-
loadingContainer: ['treeDataGroupingCellLoadingContainer']
|
|
20
|
-
};
|
|
21
|
-
return composeClasses(slots, getDataGridUtilityClass, classes);
|
|
22
|
-
};
|
|
23
|
-
function GridTreeDataGroupingCellIcon(props) {
|
|
24
|
-
const apiRef = useGridPrivateApiContext();
|
|
25
|
-
const rootProps = useGridRootProps();
|
|
26
|
-
const classes = useUtilityClasses(rootProps);
|
|
27
|
-
const {
|
|
28
|
-
rowNode,
|
|
29
|
-
id,
|
|
30
|
-
field,
|
|
31
|
-
descendantCount
|
|
32
|
-
} = props;
|
|
33
|
-
const isDataLoading = useGridSelectorV8(apiRef, gridDataSourceLoadingIdSelector, id);
|
|
34
|
-
const error = useGridSelectorV8(apiRef, gridDataSourceErrorSelector, id);
|
|
35
|
-
const handleClick = event => {
|
|
36
|
-
if (!rowNode.childrenExpanded) {
|
|
37
|
-
// always fetch/get from cache the children when the node is expanded
|
|
38
|
-
apiRef.current.unstable_dataSource.fetchRows(id);
|
|
39
|
-
} else {
|
|
40
|
-
apiRef.current.setRowChildrenExpansion(id, !rowNode.childrenExpanded);
|
|
41
|
-
}
|
|
42
|
-
apiRef.current.setCellFocus(id, field);
|
|
43
|
-
event.stopPropagation(); // TODO remove event.stopPropagation
|
|
44
|
-
};
|
|
45
|
-
const Icon = rowNode.childrenExpanded ? rootProps.slots.treeDataCollapseIcon : rootProps.slots.treeDataExpandIcon;
|
|
46
|
-
if (isDataLoading) {
|
|
47
|
-
return /*#__PURE__*/_jsx("div", {
|
|
48
|
-
className: classes.loadingContainer,
|
|
49
|
-
children: /*#__PURE__*/_jsx(CircularProgress, {
|
|
50
|
-
size: "1rem",
|
|
51
|
-
color: "inherit"
|
|
52
|
-
})
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
return descendantCount === -1 || descendantCount > 0 ? /*#__PURE__*/_jsx(rootProps.slots.baseIconButton, _extends({
|
|
56
|
-
size: "small",
|
|
57
|
-
onClick: handleClick,
|
|
58
|
-
tabIndex: -1,
|
|
59
|
-
"aria-label": rowNode.childrenExpanded ? apiRef.current.getLocaleText('treeDataCollapse') : apiRef.current.getLocaleText('treeDataExpand')
|
|
60
|
-
}, rootProps?.slotProps?.baseIconButton, {
|
|
61
|
-
children: /*#__PURE__*/_jsx(rootProps.slots.baseTooltip, {
|
|
62
|
-
title: error?.message ?? null,
|
|
63
|
-
children: /*#__PURE__*/_jsx(rootProps.slots.baseBadge, {
|
|
64
|
-
variant: "dot",
|
|
65
|
-
color: "error",
|
|
66
|
-
invisible: !error,
|
|
67
|
-
children: /*#__PURE__*/_jsx(Icon, {
|
|
68
|
-
fontSize: "inherit"
|
|
69
|
-
})
|
|
70
|
-
})
|
|
71
|
-
})
|
|
72
|
-
})) : null;
|
|
73
|
-
}
|
|
74
|
-
export function GridDataSourceTreeDataGroupingCell(props) {
|
|
75
|
-
const {
|
|
76
|
-
id,
|
|
77
|
-
field,
|
|
78
|
-
formattedValue,
|
|
79
|
-
rowNode,
|
|
80
|
-
hideDescendantCount,
|
|
81
|
-
offsetMultiplier = 2
|
|
82
|
-
} = props;
|
|
83
|
-
const rootProps = useGridRootProps();
|
|
84
|
-
const apiRef = useGridPrivateApiContext();
|
|
85
|
-
const rowSelector = state => state.rows.dataRowIdToModelLookup[id];
|
|
86
|
-
const row = useGridSelector(apiRef, rowSelector);
|
|
87
|
-
const classes = useUtilityClasses(rootProps);
|
|
88
|
-
let descendantCount = 0;
|
|
89
|
-
if (row) {
|
|
90
|
-
descendantCount = rootProps.unstable_dataSource?.getChildrenCount?.(row) ?? 0;
|
|
91
|
-
}
|
|
92
|
-
return /*#__PURE__*/_jsxs(Box, {
|
|
93
|
-
className: classes.root,
|
|
94
|
-
sx: {
|
|
95
|
-
ml: rowNode.depth * offsetMultiplier
|
|
96
|
-
},
|
|
97
|
-
children: [/*#__PURE__*/_jsx("div", {
|
|
98
|
-
className: classes.toggle,
|
|
99
|
-
children: /*#__PURE__*/_jsx(GridTreeDataGroupingCellIcon, {
|
|
100
|
-
id: id,
|
|
101
|
-
field: field,
|
|
102
|
-
rowNode: rowNode,
|
|
103
|
-
row: row,
|
|
104
|
-
descendantCount: descendantCount
|
|
105
|
-
})
|
|
106
|
-
}), /*#__PURE__*/_jsxs("span", {
|
|
107
|
-
children: [formattedValue === undefined ? rowNode.groupingKey : formattedValue, !hideDescendantCount && descendantCount > 0 ? ` (${descendantCount})` : '']
|
|
108
|
-
})]
|
|
109
|
-
});
|
|
110
|
-
}
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import composeClasses from '@mui/utils/composeClasses';
|
|
5
|
-
import { getDataGridUtilityClass, useGridSelector } from '@mui/x-data-grid';
|
|
6
|
-
import { createSelectorV8, useGridSelectorV8 } from '@mui/x-data-grid/internals';
|
|
7
|
-
import { useGridRootProps } from "../hooks/utils/useGridRootProps.js";
|
|
8
|
-
import { useGridApiContext } from "../hooks/utils/useGridApiContext.js";
|
|
9
|
-
import { gridDetailPanelExpandedRowIdsSelector, gridDetailPanelExpandedRowsContentCacheSelector } from "../hooks/features/detailPanel/gridDetailPanelSelector.js";
|
|
10
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
-
const useUtilityClasses = ownerState => {
|
|
12
|
-
const {
|
|
13
|
-
classes,
|
|
14
|
-
isExpanded
|
|
15
|
-
} = ownerState;
|
|
16
|
-
const slots = {
|
|
17
|
-
root: ['detailPanelToggleCell', isExpanded && 'detailPanelToggleCell--expanded']
|
|
18
|
-
};
|
|
19
|
-
return composeClasses(slots, getDataGridUtilityClass, classes);
|
|
20
|
-
};
|
|
21
|
-
const isExpandedSelector = createSelectorV8(gridDetailPanelExpandedRowIdsSelector, (expandedRowIds, rowId) => {
|
|
22
|
-
return expandedRowIds.includes(rowId);
|
|
23
|
-
});
|
|
24
|
-
function GridDetailPanelToggleCell(props) {
|
|
25
|
-
const {
|
|
26
|
-
id,
|
|
27
|
-
row,
|
|
28
|
-
api
|
|
29
|
-
} = props;
|
|
30
|
-
const rowId = api.getRowId(row);
|
|
31
|
-
const isExpanded = useGridSelectorV8({
|
|
32
|
-
current: api
|
|
33
|
-
}, isExpandedSelector, rowId);
|
|
34
|
-
const rootProps = useGridRootProps();
|
|
35
|
-
const apiRef = useGridApiContext();
|
|
36
|
-
const ownerState = {
|
|
37
|
-
classes: rootProps.classes,
|
|
38
|
-
isExpanded
|
|
39
|
-
};
|
|
40
|
-
const classes = useUtilityClasses(ownerState);
|
|
41
|
-
const contentCache = useGridSelector(apiRef, gridDetailPanelExpandedRowsContentCacheSelector);
|
|
42
|
-
const hasContent = /*#__PURE__*/React.isValidElement(contentCache[id]);
|
|
43
|
-
const Icon = isExpanded ? rootProps.slots.detailPanelCollapseIcon : rootProps.slots.detailPanelExpandIcon;
|
|
44
|
-
return /*#__PURE__*/_jsx(rootProps.slots.baseIconButton, _extends({
|
|
45
|
-
size: "small",
|
|
46
|
-
tabIndex: -1,
|
|
47
|
-
disabled: !hasContent,
|
|
48
|
-
className: classes.root,
|
|
49
|
-
"aria-label": isExpanded ? apiRef.current.getLocaleText('collapseDetailPanel') : apiRef.current.getLocaleText('expandDetailPanel')
|
|
50
|
-
}, rootProps.slotProps?.baseIconButton, {
|
|
51
|
-
children: /*#__PURE__*/_jsx(Icon, {
|
|
52
|
-
fontSize: "inherit"
|
|
53
|
-
})
|
|
54
|
-
}));
|
|
55
|
-
}
|
|
56
|
-
process.env.NODE_ENV !== "production" ? GridDetailPanelToggleCell.propTypes = {
|
|
57
|
-
// ----------------------------- Warning --------------------------------
|
|
58
|
-
// | These PropTypes are generated from the TypeScript type definitions |
|
|
59
|
-
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
60
|
-
// ----------------------------------------------------------------------
|
|
61
|
-
/**
|
|
62
|
-
* GridApi that let you manipulate the grid.
|
|
63
|
-
*/
|
|
64
|
-
api: PropTypes.object.isRequired,
|
|
65
|
-
/**
|
|
66
|
-
* The mode of the cell.
|
|
67
|
-
*/
|
|
68
|
-
cellMode: PropTypes.oneOf(['edit', 'view']).isRequired,
|
|
69
|
-
/**
|
|
70
|
-
* The column of the row that the current cell belongs to.
|
|
71
|
-
*/
|
|
72
|
-
colDef: PropTypes.object.isRequired,
|
|
73
|
-
/**
|
|
74
|
-
* The column field of the cell that triggered the event.
|
|
75
|
-
*/
|
|
76
|
-
field: PropTypes.string.isRequired,
|
|
77
|
-
/**
|
|
78
|
-
* A ref allowing to set imperative focus.
|
|
79
|
-
* It can be passed to the element that should receive focus.
|
|
80
|
-
* @ignore - do not document.
|
|
81
|
-
*/
|
|
82
|
-
focusElementRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
83
|
-
current: PropTypes.shape({
|
|
84
|
-
focus: PropTypes.func.isRequired
|
|
85
|
-
})
|
|
86
|
-
})]),
|
|
87
|
-
/**
|
|
88
|
-
* The cell value formatted with the column valueFormatter.
|
|
89
|
-
*/
|
|
90
|
-
formattedValue: PropTypes.any,
|
|
91
|
-
/**
|
|
92
|
-
* If true, the cell is the active element.
|
|
93
|
-
*/
|
|
94
|
-
hasFocus: PropTypes.bool.isRequired,
|
|
95
|
-
/**
|
|
96
|
-
* The grid row id.
|
|
97
|
-
*/
|
|
98
|
-
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
99
|
-
/**
|
|
100
|
-
* If true, the cell is editable.
|
|
101
|
-
*/
|
|
102
|
-
isEditable: PropTypes.bool,
|
|
103
|
-
/**
|
|
104
|
-
* The row model of the row that the current cell belongs to.
|
|
105
|
-
*/
|
|
106
|
-
row: PropTypes.any.isRequired,
|
|
107
|
-
/**
|
|
108
|
-
* The node of the row that the current cell belongs to.
|
|
109
|
-
*/
|
|
110
|
-
rowNode: PropTypes.object.isRequired,
|
|
111
|
-
/**
|
|
112
|
-
* the tabIndex value.
|
|
113
|
-
*/
|
|
114
|
-
tabIndex: PropTypes.oneOf([-1, 0]).isRequired,
|
|
115
|
-
/**
|
|
116
|
-
* The cell value.
|
|
117
|
-
* If the column has `valueGetter`, use `params.row` to directly access the fields.
|
|
118
|
-
*/
|
|
119
|
-
value: PropTypes.any
|
|
120
|
-
} : void 0;
|
|
121
|
-
export { GridDetailPanelToggleCell };
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import composeClasses from '@mui/utils/composeClasses';
|
|
3
|
-
import { getDataGridUtilityClass, useGridSelector } from '@mui/x-data-grid';
|
|
4
|
-
import { EMPTY_DETAIL_PANELS } from '@mui/x-data-grid/internals';
|
|
5
|
-
import { useGridPrivateApiContext } from "../hooks/utils/useGridPrivateApiContext.js";
|
|
6
|
-
import { useGridRootProps } from "../hooks/utils/useGridRootProps.js";
|
|
7
|
-
import { gridDetailPanelExpandedRowsContentCacheSelector, gridDetailPanelExpandedRowsHeightCacheSelector, gridDetailPanelExpandedRowIdsSelector } from "../hooks/features/detailPanel/index.js";
|
|
8
|
-
import { GridDetailPanel } from "./GridDetailPanel.js";
|
|
9
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
-
const useUtilityClasses = () => {
|
|
11
|
-
const slots = {
|
|
12
|
-
detailPanel: ['detailPanel']
|
|
13
|
-
};
|
|
14
|
-
return composeClasses(slots, getDataGridUtilityClass, {});
|
|
15
|
-
};
|
|
16
|
-
export function GridDetailPanels(props) {
|
|
17
|
-
const rootProps = useGridRootProps();
|
|
18
|
-
if (!rootProps.getDetailPanelContent) {
|
|
19
|
-
return null;
|
|
20
|
-
}
|
|
21
|
-
return /*#__PURE__*/React.createElement(GridDetailPanelsImpl, props);
|
|
22
|
-
}
|
|
23
|
-
function GridDetailPanelsImpl({
|
|
24
|
-
virtualScroller
|
|
25
|
-
}) {
|
|
26
|
-
const apiRef = useGridPrivateApiContext();
|
|
27
|
-
const classes = useUtilityClasses();
|
|
28
|
-
const {
|
|
29
|
-
setPanels
|
|
30
|
-
} = virtualScroller;
|
|
31
|
-
const expandedRowIds = useGridSelector(apiRef, gridDetailPanelExpandedRowIdsSelector);
|
|
32
|
-
const detailPanelsContent = useGridSelector(apiRef, gridDetailPanelExpandedRowsContentCacheSelector);
|
|
33
|
-
const detailPanelsHeights = useGridSelector(apiRef, gridDetailPanelExpandedRowsHeightCacheSelector);
|
|
34
|
-
const getDetailPanel = React.useCallback(rowId => {
|
|
35
|
-
const content = detailPanelsContent[rowId];
|
|
36
|
-
|
|
37
|
-
// Check if the id exists in the current page
|
|
38
|
-
const rowIndex = apiRef.current.getRowIndexRelativeToVisibleRows(rowId);
|
|
39
|
-
const exists = rowIndex !== undefined;
|
|
40
|
-
if (! /*#__PURE__*/React.isValidElement(content) || !exists) {
|
|
41
|
-
return null;
|
|
42
|
-
}
|
|
43
|
-
const hasAutoHeight = apiRef.current.detailPanelHasAutoHeight(rowId);
|
|
44
|
-
const height = hasAutoHeight ? 'auto' : detailPanelsHeights[rowId];
|
|
45
|
-
return /*#__PURE__*/_jsx(GridDetailPanel, {
|
|
46
|
-
rowId: rowId,
|
|
47
|
-
height: height,
|
|
48
|
-
className: classes.detailPanel,
|
|
49
|
-
children: content
|
|
50
|
-
}, `panel-${rowId}`);
|
|
51
|
-
}, [apiRef, classes.detailPanel, detailPanelsHeights, detailPanelsContent]);
|
|
52
|
-
React.useEffect(() => {
|
|
53
|
-
if (expandedRowIds.length === 0) {
|
|
54
|
-
setPanels(EMPTY_DETAIL_PANELS);
|
|
55
|
-
} else {
|
|
56
|
-
setPanels(new Map(expandedRowIds.map(rowId => [rowId, getDetailPanel(rowId)])));
|
|
57
|
-
}
|
|
58
|
-
}, [expandedRowIds, setPanels, getDetailPanel]);
|
|
59
|
-
return null;
|
|
60
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import clsx from 'clsx';
|
|
3
|
-
import composeClasses from '@mui/utils/composeClasses';
|
|
4
|
-
import { getDataGridUtilityClass, gridClasses, useGridSelector } from '@mui/x-data-grid';
|
|
5
|
-
import { gridPinnedRowsSelector, useGridPrivateApiContext } from '@mui/x-data-grid/internals';
|
|
6
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
-
const useUtilityClasses = () => {
|
|
8
|
-
const slots = {
|
|
9
|
-
root: ['pinnedRows']
|
|
10
|
-
};
|
|
11
|
-
return composeClasses(slots, getDataGridUtilityClass, {});
|
|
12
|
-
};
|
|
13
|
-
export function GridPinnedRows({
|
|
14
|
-
position,
|
|
15
|
-
virtualScroller
|
|
16
|
-
}) {
|
|
17
|
-
const classes = useUtilityClasses();
|
|
18
|
-
const apiRef = useGridPrivateApiContext();
|
|
19
|
-
const pinnedRowsData = useGridSelector(apiRef, gridPinnedRowsSelector);
|
|
20
|
-
const rows = pinnedRowsData[position];
|
|
21
|
-
const pinnedRenderContext = React.useMemo(() => ({
|
|
22
|
-
firstRowIndex: 0,
|
|
23
|
-
lastRowIndex: rows.length,
|
|
24
|
-
firstColumnIndex: -1,
|
|
25
|
-
lastColumnIndex: -1
|
|
26
|
-
}), [rows]);
|
|
27
|
-
if (rows.length === 0) {
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
30
|
-
const pinnedRows = virtualScroller.getRows({
|
|
31
|
-
position,
|
|
32
|
-
rows,
|
|
33
|
-
renderContext: pinnedRenderContext
|
|
34
|
-
});
|
|
35
|
-
return /*#__PURE__*/_jsx("div", {
|
|
36
|
-
className: clsx(classes.root, gridClasses[`pinnedRows--${position}`]),
|
|
37
|
-
role: "presentation",
|
|
38
|
-
children: pinnedRows
|
|
39
|
-
});
|
|
40
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { GridGenericColumnMenu, GRID_COLUMN_MENU_SLOTS, GRID_COLUMN_MENU_SLOT_PROPS } from '@mui/x-data-grid';
|
|
4
|
-
import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
5
|
-
import { GridColumnMenuPinningItem } from "./GridColumnMenuPinningItem.js";
|
|
6
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
-
export const GRID_COLUMN_MENU_SLOTS_PRO = _extends({}, GRID_COLUMN_MENU_SLOTS, {
|
|
8
|
-
columnMenuPinningItem: GridColumnMenuPinningItem
|
|
9
|
-
});
|
|
10
|
-
export const GRID_COLUMN_MENU_SLOT_PROPS_PRO = _extends({}, GRID_COLUMN_MENU_SLOT_PROPS, {
|
|
11
|
-
columnMenuPinningItem: {
|
|
12
|
-
displayOrder: 15
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
export const GridProColumnMenu = forwardRef(function GridProColumnMenu(props, ref) {
|
|
16
|
-
return /*#__PURE__*/_jsx(GridGenericColumnMenu, _extends({}, props, {
|
|
17
|
-
defaultSlots: GRID_COLUMN_MENU_SLOTS_PRO,
|
|
18
|
-
defaultSlotProps: GRID_COLUMN_MENU_SLOT_PROPS_PRO,
|
|
19
|
-
ref: ref
|
|
20
|
-
}));
|
|
21
|
-
});
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
|
|
4
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
-
const sx = {
|
|
6
|
-
padding: '2px'
|
|
7
|
-
};
|
|
8
|
-
function GridHeaderFilterClearButton(props) {
|
|
9
|
-
const rootProps = useGridRootProps();
|
|
10
|
-
return /*#__PURE__*/_jsx(rootProps.slots.baseIconButton, _extends({
|
|
11
|
-
tabIndex: -1,
|
|
12
|
-
"aria-label": "Clear filter",
|
|
13
|
-
size: "small",
|
|
14
|
-
sx: sx
|
|
15
|
-
}, props, rootProps.slotProps?.baseIconButton, {
|
|
16
|
-
children: /*#__PURE__*/_jsx(rootProps.slots.columnMenuClearIcon, {
|
|
17
|
-
fontSize: "inherit"
|
|
18
|
-
})
|
|
19
|
-
}));
|
|
20
|
-
}
|
|
21
|
-
export { GridHeaderFilterClearButton };
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import MenuList from '@mui/material/MenuList';
|
|
5
|
-
import MenuItem from '@mui/material/MenuItem';
|
|
6
|
-
import { unstable_capitalize as capitalize, HTMLElementType } from '@mui/utils';
|
|
7
|
-
import { useGridApiContext, GridMenu } from '@mui/x-data-grid';
|
|
8
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
-
function GridHeaderFilterMenu({
|
|
10
|
-
open,
|
|
11
|
-
field,
|
|
12
|
-
target,
|
|
13
|
-
applyFilterChanges,
|
|
14
|
-
operators,
|
|
15
|
-
item,
|
|
16
|
-
id,
|
|
17
|
-
labelledBy
|
|
18
|
-
}) {
|
|
19
|
-
const apiRef = useGridApiContext();
|
|
20
|
-
const hideMenu = React.useCallback(() => {
|
|
21
|
-
apiRef.current.hideHeaderFilterMenu();
|
|
22
|
-
}, [apiRef]);
|
|
23
|
-
const handleListKeyDown = React.useCallback(event => {
|
|
24
|
-
if (event.key === 'Tab') {
|
|
25
|
-
event.preventDefault();
|
|
26
|
-
}
|
|
27
|
-
if (event.key === 'Escape' || event.key === 'Tab') {
|
|
28
|
-
hideMenu();
|
|
29
|
-
}
|
|
30
|
-
}, [hideMenu]);
|
|
31
|
-
if (!target) {
|
|
32
|
-
return null;
|
|
33
|
-
}
|
|
34
|
-
return /*#__PURE__*/_jsx(GridMenu, {
|
|
35
|
-
placement: "bottom-end",
|
|
36
|
-
open: open,
|
|
37
|
-
target: target,
|
|
38
|
-
onClose: hideMenu,
|
|
39
|
-
children: /*#__PURE__*/_jsx(MenuList, {
|
|
40
|
-
"aria-labelledby": labelledBy,
|
|
41
|
-
id: id,
|
|
42
|
-
onKeyDown: handleListKeyDown,
|
|
43
|
-
children: operators.map((op, i) => {
|
|
44
|
-
const label = op?.headerLabel ?? apiRef.current.getLocaleText(`headerFilterOperator${capitalize(op.value)}`);
|
|
45
|
-
return /*#__PURE__*/_jsx(MenuItem, {
|
|
46
|
-
onClick: () => {
|
|
47
|
-
applyFilterChanges(_extends({}, item, {
|
|
48
|
-
operator: op.value
|
|
49
|
-
}));
|
|
50
|
-
hideMenu();
|
|
51
|
-
},
|
|
52
|
-
autoFocus: i === 0 ? open : false,
|
|
53
|
-
selected: op.value === item.operator,
|
|
54
|
-
children: label
|
|
55
|
-
}, `${field}-${op.value}`);
|
|
56
|
-
})
|
|
57
|
-
})
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
process.env.NODE_ENV !== "production" ? GridHeaderFilterMenu.propTypes = {
|
|
61
|
-
// ----------------------------- Warning --------------------------------
|
|
62
|
-
// | These PropTypes are generated from the TypeScript type definitions |
|
|
63
|
-
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
64
|
-
// ----------------------------------------------------------------------
|
|
65
|
-
applyFilterChanges: PropTypes.func.isRequired,
|
|
66
|
-
field: PropTypes.string.isRequired,
|
|
67
|
-
id: PropTypes.string.isRequired,
|
|
68
|
-
item: PropTypes.shape({
|
|
69
|
-
field: PropTypes.string.isRequired,
|
|
70
|
-
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
71
|
-
operator: PropTypes.string.isRequired,
|
|
72
|
-
value: PropTypes.any
|
|
73
|
-
}).isRequired,
|
|
74
|
-
labelledBy: PropTypes.string.isRequired,
|
|
75
|
-
open: PropTypes.bool.isRequired,
|
|
76
|
-
operators: PropTypes.arrayOf(PropTypes.shape({
|
|
77
|
-
getApplyFilterFn: PropTypes.func.isRequired,
|
|
78
|
-
getValueAsString: PropTypes.func,
|
|
79
|
-
headerLabel: PropTypes.string,
|
|
80
|
-
InputComponent: PropTypes.elementType,
|
|
81
|
-
InputComponentProps: PropTypes.object,
|
|
82
|
-
label: PropTypes.string,
|
|
83
|
-
requiresFilterValue: PropTypes.bool,
|
|
84
|
-
value: PropTypes.string.isRequired
|
|
85
|
-
})).isRequired,
|
|
86
|
-
target: HTMLElementType
|
|
87
|
-
} : void 0;
|
|
88
|
-
export { GridHeaderFilterMenu };
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["operators", "item", "field", "buttonRef", "headerFilterMenuRef", "disabled"];
|
|
4
|
-
import * as React from 'react';
|
|
5
|
-
import PropTypes from 'prop-types';
|
|
6
|
-
import { useGridApiContext, useGridSelector } from '@mui/x-data-grid';
|
|
7
|
-
import { refType, unstable_useId as useId } from '@mui/utils';
|
|
8
|
-
import { gridHeaderFilteringMenuSelector } from '@mui/x-data-grid/internals';
|
|
9
|
-
import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
|
|
10
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
-
const sx = {
|
|
12
|
-
width: 22,
|
|
13
|
-
height: 22,
|
|
14
|
-
margin: 'auto 0 10px 5px'
|
|
15
|
-
};
|
|
16
|
-
function GridHeaderFilterMenuContainer(props) {
|
|
17
|
-
const {
|
|
18
|
-
operators,
|
|
19
|
-
item,
|
|
20
|
-
field,
|
|
21
|
-
buttonRef,
|
|
22
|
-
headerFilterMenuRef,
|
|
23
|
-
disabled = false
|
|
24
|
-
} = props,
|
|
25
|
-
others = _objectWithoutPropertiesLoose(props, _excluded);
|
|
26
|
-
const buttonId = useId();
|
|
27
|
-
const menuId = useId();
|
|
28
|
-
const rootProps = useGridRootProps();
|
|
29
|
-
const apiRef = useGridApiContext();
|
|
30
|
-
const menuOpenField = useGridSelector(apiRef, gridHeaderFilteringMenuSelector);
|
|
31
|
-
const open = Boolean(menuOpenField === field && headerFilterMenuRef.current);
|
|
32
|
-
const handleClick = event => {
|
|
33
|
-
headerFilterMenuRef.current = event.currentTarget;
|
|
34
|
-
apiRef.current.showHeaderFilterMenu(field);
|
|
35
|
-
};
|
|
36
|
-
if (!rootProps.slots.headerFilterMenu) {
|
|
37
|
-
return null;
|
|
38
|
-
}
|
|
39
|
-
const label = apiRef.current.getLocaleText('filterPanelOperator');
|
|
40
|
-
const labelString = label ? String(label) : undefined;
|
|
41
|
-
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
42
|
-
children: [/*#__PURE__*/_jsx(rootProps.slots.baseIconButton, _extends({
|
|
43
|
-
id: buttonId,
|
|
44
|
-
ref: buttonRef,
|
|
45
|
-
"aria-label": labelString,
|
|
46
|
-
title: labelString,
|
|
47
|
-
"aria-controls": menuId,
|
|
48
|
-
"aria-expanded": open ? 'true' : undefined,
|
|
49
|
-
"aria-haspopup": "true",
|
|
50
|
-
tabIndex: -1,
|
|
51
|
-
size: "small",
|
|
52
|
-
onClick: handleClick,
|
|
53
|
-
sx: sx,
|
|
54
|
-
disabled: disabled
|
|
55
|
-
}, rootProps.slotProps?.baseIconButton, {
|
|
56
|
-
children: /*#__PURE__*/_jsx(rootProps.slots.openFilterButtonIcon, {
|
|
57
|
-
fontSize: "small"
|
|
58
|
-
})
|
|
59
|
-
})), /*#__PURE__*/_jsx(rootProps.slots.headerFilterMenu, _extends({
|
|
60
|
-
field: field,
|
|
61
|
-
open: open,
|
|
62
|
-
item: item,
|
|
63
|
-
target: headerFilterMenuRef.current,
|
|
64
|
-
operators: operators,
|
|
65
|
-
labelledBy: buttonId,
|
|
66
|
-
id: menuId
|
|
67
|
-
}, others))]
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
process.env.NODE_ENV !== "production" ? GridHeaderFilterMenuContainer.propTypes = {
|
|
71
|
-
// ----------------------------- Warning --------------------------------
|
|
72
|
-
// | These PropTypes are generated from the TypeScript type definitions |
|
|
73
|
-
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
74
|
-
// ----------------------------------------------------------------------
|
|
75
|
-
applyFilterChanges: PropTypes.func.isRequired,
|
|
76
|
-
buttonRef: refType,
|
|
77
|
-
disabled: PropTypes.bool,
|
|
78
|
-
field: PropTypes.string.isRequired,
|
|
79
|
-
headerFilterMenuRef: PropTypes.shape({
|
|
80
|
-
current: PropTypes.object
|
|
81
|
-
}).isRequired,
|
|
82
|
-
item: PropTypes.shape({
|
|
83
|
-
field: PropTypes.string.isRequired,
|
|
84
|
-
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
85
|
-
operator: PropTypes.string.isRequired,
|
|
86
|
-
value: PropTypes.any
|
|
87
|
-
}).isRequired,
|
|
88
|
-
operators: PropTypes.arrayOf(PropTypes.shape({
|
|
89
|
-
getApplyFilterFn: PropTypes.func.isRequired,
|
|
90
|
-
getValueAsString: PropTypes.func,
|
|
91
|
-
headerLabel: PropTypes.string,
|
|
92
|
-
InputComponent: PropTypes.elementType,
|
|
93
|
-
InputComponentProps: PropTypes.object,
|
|
94
|
-
label: PropTypes.string,
|
|
95
|
-
requiresFilterValue: PropTypes.bool,
|
|
96
|
-
value: PropTypes.string.isRequired
|
|
97
|
-
})).isRequired
|
|
98
|
-
} : void 0;
|
|
99
|
-
export { GridHeaderFilterMenuContainer };
|
package/esm/components/index.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
// Only export the variable and types that should be publicly exposed and re-exported from `@mui/x-data-grid-pro`
|
|
2
|
-
export * from "./GridTreeDataGroupingCell.js";
|
|
3
|
-
export * from "./GridColumnMenuPinningItem.js";
|
|
4
|
-
export * from "./GridDetailPanelToggleCell.js";
|
|
5
|
-
export * from "./GridRowReorderCell.js";
|
|
6
|
-
export * from "../material/icons.js";
|
|
7
|
-
export * from "./headerFiltering/index.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { GridProColumnMenu as GridColumnMenu, GRID_COLUMN_MENU_SLOTS_PRO as GRID_COLUMN_MENU_SLOTS, GRID_COLUMN_MENU_SLOT_PROPS_PRO as GRID_COLUMN_MENU_SLOT_PROPS } from "./GridProColumnMenu.js";
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import { DATA_GRID_DEFAULT_SLOTS_COMPONENTS } from '@mui/x-data-grid/internals';
|
|
3
|
-
import { GridProColumnMenu } from "../components/GridProColumnMenu.js";
|
|
4
|
-
import { GridColumnHeaders } from "../components/GridColumnHeaders.js";
|
|
5
|
-
import { GridHeaderFilterMenu } from "../components/headerFiltering/GridHeaderFilterMenu.js";
|
|
6
|
-
import { GridHeaderFilterCell } from "../components/headerFiltering/GridHeaderFilterCell.js";
|
|
7
|
-
import { GridDetailPanels } from "../components/GridDetailPanels.js";
|
|
8
|
-
import { GridPinnedRows } from "../components/GridPinnedRows.js";
|
|
9
|
-
import materialSlots from "../material/index.js";
|
|
10
|
-
export const DATA_GRID_PRO_DEFAULT_SLOTS_COMPONENTS = _extends({}, DATA_GRID_DEFAULT_SLOTS_COMPONENTS, materialSlots, {
|
|
11
|
-
columnMenu: GridProColumnMenu,
|
|
12
|
-
columnHeaders: GridColumnHeaders,
|
|
13
|
-
detailPanels: GridDetailPanels,
|
|
14
|
-
headerFilterCell: GridHeaderFilterCell,
|
|
15
|
-
headerFilterMenu: GridHeaderFilterMenu,
|
|
16
|
-
pinnedRows: GridPinnedRows
|
|
17
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./gridColumnPinningInterface.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import { gridFilterModelSelector, gridSortModelSelector, gridPaginationModelSelector } from '@mui/x-data-grid';
|
|
3
|
-
import { createSelector, createSelectorV8 } from '@mui/x-data-grid/internals';
|
|
4
|
-
const computeStartEnd = paginationModel => {
|
|
5
|
-
const start = paginationModel.page * paginationModel.pageSize;
|
|
6
|
-
const end = start + paginationModel.pageSize - 1;
|
|
7
|
-
return {
|
|
8
|
-
start,
|
|
9
|
-
end
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
export const gridGetRowsParamsSelector = createSelector(gridFilterModelSelector, gridSortModelSelector, gridPaginationModelSelector, (filterModel, sortModel, paginationModel) => {
|
|
13
|
-
return _extends({
|
|
14
|
-
groupKeys: [],
|
|
15
|
-
paginationModel,
|
|
16
|
-
sortModel,
|
|
17
|
-
filterModel
|
|
18
|
-
}, computeStartEnd(paginationModel));
|
|
19
|
-
});
|
|
20
|
-
export const gridDataSourceStateSelector = state => state.dataSource;
|
|
21
|
-
export const gridDataSourceLoadingSelector = createSelector(gridDataSourceStateSelector, dataSource => dataSource.loading);
|
|
22
|
-
export const gridDataSourceLoadingIdSelector = createSelectorV8(gridDataSourceStateSelector, (dataSource, id) => dataSource.loading[id] ?? false);
|
|
23
|
-
export const gridDataSourceErrorsSelector = createSelector(gridDataSourceStateSelector, dataSource => dataSource.errors);
|
|
24
|
-
export const gridDataSourceErrorSelector = createSelectorV8(gridDataSourceStateSelector, (dataSource, id) => dataSource.errors[id]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { createSelectorMemoized } from '@mui/x-data-grid/internals';
|
|
2
|
-
export const gridDetailPanelExpandedRowIdsSelector = state => state.detailPanel.expandedRowIds;
|
|
3
|
-
export const gridDetailPanelExpandedRowsContentCacheSelector = state => state.detailPanel.contentCache;
|
|
4
|
-
export const gridDetailPanelRawHeightCacheSelector = state => state.detailPanel.heightCache;
|
|
5
|
-
|
|
6
|
-
// TODO v6: Make this selector return the full object, including the autoHeight flag
|
|
7
|
-
export const gridDetailPanelExpandedRowsHeightCacheSelector = createSelectorMemoized(gridDetailPanelRawHeightCacheSelector, heightCache => Object.entries(heightCache).reduce((acc, [id, {
|
|
8
|
-
height
|
|
9
|
-
}]) => {
|
|
10
|
-
acc[id] = height || 0;
|
|
11
|
-
return acc;
|
|
12
|
-
}, {}));
|