@mui/x-data-grid 7.3.0 → 7.3.1
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 +79 -2
- package/DataGrid/DataGrid.js +1 -2
- package/colDef/gridDateOperators.js +7 -0
- package/components/GridFooter.js +1 -2
- package/components/GridHeader.js +1 -2
- package/components/GridHeaders.js +3 -2
- package/components/GridRow.js +1 -2
- package/components/cell/GridActionsCell.js +1 -2
- package/components/cell/GridActionsCellItem.js +1 -2
- package/components/columnHeaders/GridColumnHeaderFilterIconButton.js +1 -2
- package/components/columnHeaders/GridColumnHeaderItem.js +1 -2
- package/components/columnHeaders/GridColumnHeaderSortIcon.js +1 -2
- package/components/columnHeaders/GridGenericColumnHeaderItem.js +1 -2
- package/components/columnsManagement/GridColumnsManagement.js +1 -2
- package/components/containers/GridRoot.js +1 -2
- package/components/menu/columnMenu/menuItems/GridColumnMenuColumnsItem.js +1 -2
- package/components/menu/columnMenu/menuItems/GridColumnMenuFilterItem.js +1 -2
- package/components/menu/columnMenu/menuItems/GridColumnMenuHideItem.js +1 -2
- package/components/menu/columnMenu/menuItems/GridColumnMenuManageItem.js +1 -2
- package/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +1 -2
- package/components/panel/GridPanel.d.ts +1 -1
- package/components/panel/filterPanel/GridFilterForm.js +1 -2
- package/components/panel/filterPanel/GridFilterInputBoolean.js +1 -2
- package/components/panel/filterPanel/GridFilterInputDate.js +4 -4
- package/components/panel/filterPanel/GridFilterInputSingleSelect.js +1 -2
- package/components/panel/filterPanel/GridFilterPanel.js +1 -2
- package/components/toolbar/GridToolbar.js +1 -2
- package/components/toolbar/GridToolbarDensitySelector.js +1 -2
- package/components/toolbar/GridToolbarExportContainer.js +1 -2
- package/components/toolbar/GridToolbarFilterButton.js +1 -2
- package/components/virtualization/GridVirtualScroller.js +1 -2
- package/components/virtualization/GridVirtualScrollerFiller.js +1 -2
- package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +1 -1
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +1 -2
- package/hooks/features/columnResize/useGridColumnResize.js +16 -1
- package/hooks/features/columns/gridColumnsUtils.d.ts +3 -2
- package/hooks/features/columns/gridColumnsUtils.js +5 -4
- package/hooks/features/columns/useGridColumns.js +5 -4
- package/hooks/features/rows/gridRowsUtils.d.ts +1 -1
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +3 -3
- package/hooks/utils/useGridApiEventHandler.d.ts +2 -2
- package/hooks/utils/useGridNativeEventListener.d.ts +1 -1
- package/hooks/utils/useGridSelector.d.ts +1 -1
- package/index.js +1 -1
- package/joy/icons.js +1 -2
- package/joy/joySlots.js +1 -2
- package/modern/DataGrid/DataGrid.js +1 -2
- package/modern/colDef/gridDateOperators.js +7 -0
- package/modern/components/GridFooter.js +1 -2
- package/modern/components/GridHeader.js +1 -2
- package/modern/components/GridHeaders.js +3 -2
- package/modern/components/GridRow.js +1 -2
- package/modern/components/cell/GridActionsCell.js +1 -2
- package/modern/components/cell/GridActionsCellItem.js +1 -2
- package/modern/components/columnHeaders/GridColumnHeaderFilterIconButton.js +1 -2
- package/modern/components/columnHeaders/GridColumnHeaderItem.js +1 -2
- package/modern/components/columnHeaders/GridColumnHeaderSortIcon.js +1 -2
- package/modern/components/columnHeaders/GridGenericColumnHeaderItem.js +1 -2
- package/modern/components/columnsManagement/GridColumnsManagement.js +1 -2
- package/modern/components/containers/GridRoot.js +1 -2
- package/modern/components/menu/columnMenu/menuItems/GridColumnMenuColumnsItem.js +1 -2
- package/modern/components/menu/columnMenu/menuItems/GridColumnMenuFilterItem.js +1 -2
- package/modern/components/menu/columnMenu/menuItems/GridColumnMenuHideItem.js +1 -2
- package/modern/components/menu/columnMenu/menuItems/GridColumnMenuManageItem.js +1 -2
- package/modern/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +1 -2
- package/modern/components/panel/filterPanel/GridFilterForm.js +1 -2
- package/modern/components/panel/filterPanel/GridFilterInputBoolean.js +1 -2
- package/modern/components/panel/filterPanel/GridFilterInputDate.js +4 -4
- package/modern/components/panel/filterPanel/GridFilterInputSingleSelect.js +1 -2
- package/modern/components/panel/filterPanel/GridFilterPanel.js +1 -2
- package/modern/components/toolbar/GridToolbar.js +1 -2
- package/modern/components/toolbar/GridToolbarDensitySelector.js +1 -2
- package/modern/components/toolbar/GridToolbarExportContainer.js +1 -2
- package/modern/components/toolbar/GridToolbarFilterButton.js +1 -2
- package/modern/components/virtualization/GridVirtualScroller.js +1 -2
- package/modern/components/virtualization/GridVirtualScrollerFiller.js +1 -2
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +1 -2
- package/modern/hooks/features/columnResize/useGridColumnResize.js +16 -1
- package/modern/hooks/features/columns/gridColumnsUtils.js +5 -4
- package/modern/hooks/features/columns/useGridColumns.js +5 -4
- package/modern/index.js +1 -1
- package/modern/joy/icons.js +1 -2
- package/modern/joy/joySlots.js +1 -2
- package/modern/utils/domUtils.js +4 -0
- package/node/DataGrid/DataGrid.js +1 -1
- package/node/DataGrid/useDataGridProps.js +1 -1
- package/node/colDef/gridCheckboxSelectionColDef.js +1 -1
- package/node/colDef/gridDateOperators.js +7 -0
- package/node/components/GridApiContext.js +1 -1
- package/node/components/GridColumnHeaders.js +1 -1
- package/node/components/GridFooter.js +1 -1
- package/node/components/GridHeader.js +1 -1
- package/node/components/GridHeaders.js +5 -3
- package/node/components/GridLoadingOverlay.js +1 -1
- package/node/components/GridNoResultsOverlay.js +1 -1
- package/node/components/GridNoRowsOverlay.js +1 -1
- package/node/components/GridPagination.js +1 -1
- package/node/components/GridRow.js +1 -1
- package/node/components/GridRowCount.js +1 -1
- package/node/components/GridScrollArea.js +1 -1
- package/node/components/GridScrollbarFillerCell.js +1 -1
- package/node/components/GridSelectedRowCount.js +1 -1
- package/node/components/base/GridFooterPlaceholder.js +1 -1
- package/node/components/base/GridOverlays.js +1 -1
- package/node/components/cell/GridActionsCell.js +1 -1
- package/node/components/cell/GridActionsCellItem.js +1 -1
- package/node/components/cell/GridBooleanCell.js +1 -1
- package/node/components/cell/GridCell.js +1 -1
- package/node/components/cell/GridEditBooleanCell.js +1 -1
- package/node/components/cell/GridEditDateCell.js +1 -1
- package/node/components/cell/GridEditInputCell.js +1 -1
- package/node/components/cell/GridEditSingleSelectCell.js +1 -1
- package/node/components/cell/GridSkeletonCell.js +1 -1
- package/node/components/columnHeaders/ColumnHeaderMenuIcon.js +1 -1
- package/node/components/columnHeaders/GridBaseColumnHeaders.js +1 -1
- package/node/components/columnHeaders/GridColumnGroupHeader.js +1 -1
- package/node/components/columnHeaders/GridColumnHeaderFilterIconButton.js +1 -1
- package/node/components/columnHeaders/GridColumnHeaderItem.js +1 -1
- package/node/components/columnHeaders/GridColumnHeaderSeparator.js +1 -1
- package/node/components/columnHeaders/GridColumnHeaderSortIcon.js +1 -1
- package/node/components/columnHeaders/GridColumnHeaderTitle.js +1 -1
- package/node/components/columnHeaders/GridGenericColumnHeaderItem.js +1 -1
- package/node/components/columnHeaders/GridIconButtonContainer.js +1 -1
- package/node/components/columnSelection/GridCellCheckboxRenderer.js +1 -1
- package/node/components/columnSelection/GridHeaderCheckbox.js +1 -1
- package/node/components/columnsManagement/GridColumnsManagement.js +1 -1
- package/node/components/containers/GridFooterContainer.js +1 -1
- package/node/components/containers/GridOverlay.js +1 -1
- package/node/components/containers/GridRoot.js +1 -1
- package/node/components/containers/GridToolbarContainer.js +1 -1
- package/node/components/menu/GridMenu.js +1 -1
- package/node/components/menu/columnMenu/GridColumnHeaderMenu.js +1 -1
- package/node/components/menu/columnMenu/GridColumnMenu.js +1 -1
- package/node/components/menu/columnMenu/GridColumnMenuContainer.js +1 -1
- package/node/components/menu/columnMenu/menuItems/GridColumnMenuColumnsItem.js +1 -1
- package/node/components/menu/columnMenu/menuItems/GridColumnMenuFilterItem.js +1 -1
- package/node/components/menu/columnMenu/menuItems/GridColumnMenuHideItem.js +1 -1
- package/node/components/menu/columnMenu/menuItems/GridColumnMenuManageItem.js +1 -1
- package/node/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +1 -1
- package/node/components/panel/GridColumnsPanel.js +1 -1
- package/node/components/panel/GridPanel.js +1 -1
- package/node/components/panel/GridPanelContent.js +1 -1
- package/node/components/panel/GridPanelFooter.js +1 -1
- package/node/components/panel/GridPanelHeader.js +1 -1
- package/node/components/panel/GridPanelWrapper.js +1 -1
- package/node/components/panel/GridPreferencesPanel.js +1 -1
- package/node/components/panel/filterPanel/GridFilterForm.js +1 -1
- package/node/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
- package/node/components/panel/filterPanel/GridFilterInputDate.js +5 -5
- package/node/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +1 -1
- package/node/components/panel/filterPanel/GridFilterInputMultipleValue.js +1 -1
- package/node/components/panel/filterPanel/GridFilterInputSingleSelect.js +1 -1
- package/node/components/panel/filterPanel/GridFilterInputValue.js +1 -1
- package/node/components/panel/filterPanel/GridFilterPanel.js +1 -1
- package/node/components/toolbar/GridToolbar.js +1 -1
- package/node/components/toolbar/GridToolbarColumnsButton.js +1 -1
- package/node/components/toolbar/GridToolbarDensitySelector.js +1 -1
- package/node/components/toolbar/GridToolbarExport.js +1 -1
- package/node/components/toolbar/GridToolbarExportContainer.js +1 -1
- package/node/components/toolbar/GridToolbarFilterButton.js +1 -1
- package/node/components/toolbar/GridToolbarQuickFilter.js +1 -1
- package/node/components/virtualization/GridBottomContainer.js +1 -1
- package/node/components/virtualization/GridMainContainer.js +1 -1
- package/node/components/virtualization/GridTopContainer.js +1 -1
- package/node/components/virtualization/GridVirtualScrollbar.js +1 -1
- package/node/components/virtualization/GridVirtualScroller.js +1 -1
- package/node/components/virtualization/GridVirtualScrollerContent.js +1 -1
- package/node/components/virtualization/GridVirtualScrollerFiller.js +1 -1
- package/node/components/virtualization/GridVirtualScrollerRenderZone.js +1 -1
- package/node/context/GridContextProvider.js +1 -1
- package/node/context/GridRootPropsContext.js +1 -1
- package/node/hooks/core/pipeProcessing/useGridPipeProcessing.js +1 -1
- package/node/hooks/core/pipeProcessing/useGridRegisterPipeApplier.js +1 -1
- package/node/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.js +1 -1
- package/node/hooks/core/strategyProcessing/useGridRegisterStrategyProcessor.js +1 -1
- package/node/hooks/core/strategyProcessing/useGridStrategyProcessing.js +1 -1
- package/node/hooks/core/useGridApiInitialization.js +1 -1
- package/node/hooks/core/useGridLocaleText.js +1 -1
- package/node/hooks/core/useGridLoggerFactory.js +1 -1
- package/node/hooks/core/useGridRefs.js +1 -1
- package/node/hooks/core/useGridStateInitialization.js +1 -1
- package/node/hooks/core/useGridTheme.js +1 -1
- package/node/hooks/features/clipboard/useGridClipboard.js +1 -1
- package/node/hooks/features/columnGrouping/useGridColumnGrouping.js +1 -1
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +1 -1
- package/node/hooks/features/columnMenu/useGridColumnMenu.js +1 -1
- package/node/hooks/features/columnMenu/useGridColumnMenuSlots.js +1 -1
- package/node/hooks/features/columnResize/useGridColumnResize.js +16 -1
- package/node/hooks/features/columns/gridColumnsUtils.js +5 -4
- package/node/hooks/features/columns/useGridColumnSpanning.js +1 -1
- package/node/hooks/features/columns/useGridColumns.js +6 -5
- package/node/hooks/features/density/useGridDensity.js +1 -1
- package/node/hooks/features/dimensions/useGridDimensions.js +1 -1
- package/node/hooks/features/editing/useGridCellEditing.js +1 -1
- package/node/hooks/features/editing/useGridEditing.js +1 -1
- package/node/hooks/features/editing/useGridRowEditing.js +1 -1
- package/node/hooks/features/export/useGridCsvExport.js +1 -1
- package/node/hooks/features/export/useGridPrintExport.js +1 -1
- package/node/hooks/features/filter/useGridFilter.js +1 -1
- package/node/hooks/features/focus/useGridFocus.js +1 -1
- package/node/hooks/features/headerFiltering/useGridHeaderFiltering.js +1 -1
- package/node/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +1 -1
- package/node/hooks/features/pagination/useGridPaginationMeta.js +1 -1
- package/node/hooks/features/pagination/useGridPaginationModel.js +1 -1
- package/node/hooks/features/pagination/useGridRowCount.js +1 -1
- package/node/hooks/features/preferencesPanel/useGridPreferencesPanel.js +1 -1
- package/node/hooks/features/rowSelection/useGridRowSelection.js +1 -1
- package/node/hooks/features/rowSelection/useGridRowSelectionPreProcessors.js +1 -1
- package/node/hooks/features/rows/useGridParamsApi.js +1 -1
- package/node/hooks/features/rows/useGridRows.js +1 -1
- package/node/hooks/features/rows/useGridRowsMeta.js +1 -1
- package/node/hooks/features/scroll/useGridScroll.js +1 -1
- package/node/hooks/features/sorting/useGridSorting.js +1 -1
- package/node/hooks/features/statePersistence/useGridStatePersistence.js +1 -1
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +1 -1
- package/node/hooks/features/virtualization/useGridVirtualization.js +1 -1
- package/node/hooks/utils/useFirstRender.js +1 -1
- package/node/hooks/utils/useGridApiContext.js +1 -1
- package/node/hooks/utils/useGridApiEventHandler.js +1 -1
- package/node/hooks/utils/useGridApiMethod.js +1 -1
- package/node/hooks/utils/useGridApiRef.js +1 -1
- package/node/hooks/utils/useGridInitializeState.js +1 -1
- package/node/hooks/utils/useGridLogger.js +1 -1
- package/node/hooks/utils/useGridNativeEventListener.js +1 -1
- package/node/hooks/utils/useGridPrivateApiContext.js +1 -1
- package/node/hooks/utils/useGridRootProps.js +1 -1
- package/node/hooks/utils/useGridSelector.js +1 -1
- package/node/hooks/utils/useGridVisibleRows.js +1 -1
- package/node/hooks/utils/useResizeObserver.js +1 -1
- package/node/hooks/utils/useRunOnce.js +1 -1
- package/node/index.js +1 -1
- package/node/internals/utils/useProps.js +1 -1
- package/node/joy/icons.js +1 -1
- package/node/joy/joySlots.js +1 -1
- package/node/material/components/MUISelectOption.js +1 -1
- package/node/material/icons/GridColumnUnsortedIcon.js +1 -1
- package/node/material/icons/index.js +1 -1
- package/node/utils/domUtils.js +5 -0
- package/node/utils/fastMemo.js +1 -1
- package/package.json +3 -5
- package/utils/domUtils.d.ts +1 -0
- package/utils/domUtils.js +4 -0
|
@@ -110,7 +110,7 @@ export function computeFlexColumnsWidth({
|
|
|
110
110
|
* TODO: Unit test this function in depth and only keep basic cases for the whole grid testing.
|
|
111
111
|
* TODO: Improve the `GridColDef` typing to reflect the fact that `minWidth` / `maxWidth` and `width` can't be null after the merge with the `type` default values.
|
|
112
112
|
*/
|
|
113
|
-
export const hydrateColumnsWidth = (rawState,
|
|
113
|
+
export const hydrateColumnsWidth = (rawState, dimensions) => {
|
|
114
114
|
const columnsLookup = {};
|
|
115
115
|
let totalFlexUnits = 0;
|
|
116
116
|
let widthAllocatedBeforeFlex = 0;
|
|
@@ -136,10 +136,11 @@ export const hydrateColumnsWidth = (rawState, viewportInnerWidth) => {
|
|
|
136
136
|
}
|
|
137
137
|
columnsLookup[columnField] = newColumn;
|
|
138
138
|
});
|
|
139
|
-
const
|
|
139
|
+
const availableWidth = dimensions === undefined ? 0 : dimensions.viewportOuterSize.width - (dimensions.hasScrollY ? dimensions.scrollbarSize : 0);
|
|
140
|
+
const initialFreeSpace = Math.max(availableWidth - widthAllocatedBeforeFlex, 0);
|
|
140
141
|
|
|
141
142
|
// Allocate the remaining space to the flex columns
|
|
142
|
-
if (totalFlexUnits > 0 &&
|
|
143
|
+
if (totalFlexUnits > 0 && availableWidth > 0) {
|
|
143
144
|
const computedColumnWidths = computeFlexColumnsWidth({
|
|
144
145
|
initialFreeSpace,
|
|
145
146
|
totalFlexUnits,
|
|
@@ -282,7 +283,7 @@ export const createColumnsState = ({
|
|
|
282
283
|
}
|
|
283
284
|
const columnsStateWithPreProcessing = apiRef.current.unstable_applyPipeProcessors('hydrateColumns', columnsState);
|
|
284
285
|
const columnsStateWithPortableColumns = applyInitialState(columnsStateWithPreProcessing, initialState);
|
|
285
|
-
return hydrateColumnsWidth(columnsStateWithPortableColumns, apiRef.current.getRootDimensions?.()
|
|
286
|
+
return hydrateColumnsWidth(columnsStateWithPortableColumns, apiRef.current.getRootDimensions?.() ?? undefined);
|
|
286
287
|
};
|
|
287
288
|
export function getFirstNonSpannedColumnToRender({
|
|
288
289
|
firstColumnToRender,
|
|
@@ -133,7 +133,7 @@ export function useGridColumns(apiRef, props) {
|
|
|
133
133
|
lookup: _extends({}, columnsState.lookup, {
|
|
134
134
|
[field]: newColumn
|
|
135
135
|
})
|
|
136
|
-
}), apiRef.current.getRootDimensions()
|
|
136
|
+
}), apiRef.current.getRootDimensions()));
|
|
137
137
|
apiRef.current.publishEvent('columnWidthChange', {
|
|
138
138
|
element: apiRef.current.getColumnHeaderElement(field),
|
|
139
139
|
colDef: newColumn,
|
|
@@ -237,14 +237,15 @@ export function useGridColumns(apiRef, props) {
|
|
|
237
237
|
useGridRegisterPipeProcessor(apiRef, 'restoreState', stateRestorePreProcessing);
|
|
238
238
|
useGridRegisterPipeProcessor(apiRef, 'preferencePanel', preferencePanelPreProcessing);
|
|
239
239
|
|
|
240
|
-
|
|
240
|
+
/*
|
|
241
241
|
* EVENTS
|
|
242
242
|
*/
|
|
243
|
+
|
|
243
244
|
const prevInnerWidth = React.useRef(null);
|
|
244
245
|
const handleGridSizeChange = viewportInnerSize => {
|
|
245
246
|
if (prevInnerWidth.current !== viewportInnerSize.width) {
|
|
246
247
|
prevInnerWidth.current = viewportInnerSize.width;
|
|
247
|
-
setGridColumnsState(hydrateColumnsWidth(gridColumnsStateSelector(apiRef.current.state),
|
|
248
|
+
setGridColumnsState(hydrateColumnsWidth(gridColumnsStateSelector(apiRef.current.state), apiRef.current.getRootDimensions()));
|
|
248
249
|
}
|
|
249
250
|
};
|
|
250
251
|
useGridApiEventHandler(apiRef, 'viewportInnerSizeChange', handleGridSizeChange);
|
|
@@ -264,7 +265,7 @@ export function useGridColumns(apiRef, props) {
|
|
|
264
265
|
}, [apiRef, logger, setGridColumnsState]);
|
|
265
266
|
useGridRegisterPipeApplier(apiRef, 'hydrateColumns', hydrateColumns);
|
|
266
267
|
|
|
267
|
-
|
|
268
|
+
/*
|
|
268
269
|
* EFFECTS
|
|
269
270
|
*/
|
|
270
271
|
// The effect do not track any value defined synchronously during the 1st render by hooks called after `useGridColumns`
|
|
@@ -19,7 +19,7 @@ export declare const getTopLevelRowCount: ({ tree, rowCountProp, }: {
|
|
|
19
19
|
tree: GridRowTreeConfig;
|
|
20
20
|
rowCountProp: DataGridProcessedProps['rowCount'];
|
|
21
21
|
}) => number;
|
|
22
|
-
export declare const getRowsStateFromCache: ({ apiRef, rowCountProp, loadingProp, previousTree, previousTreeDepths, }: Pick<GridRowTreeCreationParams,
|
|
22
|
+
export declare const getRowsStateFromCache: ({ apiRef, rowCountProp, loadingProp, previousTree, previousTreeDepths, }: Pick<GridRowTreeCreationParams, 'previousTree' | 'previousTreeDepths'> & {
|
|
23
23
|
apiRef: React.MutableRefObject<GridPrivateApiCommunity>;
|
|
24
24
|
rowCountProp: number | undefined;
|
|
25
25
|
loadingProp: boolean | undefined;
|
|
@@ -8,9 +8,9 @@ export declare const useGridVirtualScroller: () => {
|
|
|
8
8
|
renderContext: GridRenderContext;
|
|
9
9
|
setPanels: React.Dispatch<React.SetStateAction<Readonly<Map<GridRowId, React.ReactNode>>>>;
|
|
10
10
|
getRows: (params?: {
|
|
11
|
-
rows?: GridRowEntry
|
|
12
|
-
position?:
|
|
13
|
-
renderContext?: GridRenderContext
|
|
11
|
+
rows?: GridRowEntry[];
|
|
12
|
+
position?: GridPinnedRowsPosition;
|
|
13
|
+
renderContext?: GridRenderContext;
|
|
14
14
|
}) => React.ReactNode[];
|
|
15
15
|
getContainerProps: () => {
|
|
16
16
|
ref: React.RefObject<HTMLDivElement>;
|
|
@@ -14,8 +14,8 @@ declare enum GridSignature {
|
|
|
14
14
|
interface RegistryContainer {
|
|
15
15
|
registry: CleanupTracking | null;
|
|
16
16
|
}
|
|
17
|
-
export declare function createUseGridApiEventHandler(registryContainer: RegistryContainer): <Api extends GridApiCommon<any, any>, E extends keyof import("../../models").GridEventLookup>(apiRef: React.MutableRefObject<Api>, eventName: E, handler?: GridEventListener<E
|
|
17
|
+
export declare function createUseGridApiEventHandler(registryContainer: RegistryContainer): <Api extends GridApiCommon<any, any>, E extends keyof import("../../models").GridEventLookup>(apiRef: React.MutableRefObject<Api>, eventName: E, handler?: GridEventListener<E>, options?: EventListenerOptions) => void;
|
|
18
18
|
export declare const unstable_resetCleanupTracking: () => void;
|
|
19
|
-
export declare const useGridApiEventHandler: <Api extends GridApiCommon<any, any>, E extends keyof import("../../models").GridEventLookup>(apiRef: React.MutableRefObject<Api>, eventName: E, handler?: GridEventListener<E
|
|
19
|
+
export declare const useGridApiEventHandler: <Api extends GridApiCommon<any, any>, E extends keyof import("../../models").GridEventLookup>(apiRef: React.MutableRefObject<Api>, eventName: E, handler?: GridEventListener<E>, options?: EventListenerOptions) => void;
|
|
20
20
|
export declare function useGridApiOptionHandler<Api extends GridApiCommon, E extends GridEvents>(apiRef: React.MutableRefObject<Api>, eventName: E, handler?: GridEventListener<E>): void;
|
|
21
21
|
export { GridSignature };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { GridPrivateApiCommon } from '../../models/api/gridApiCommon';
|
|
3
|
-
export declare const useGridNativeEventListener: <PrivateApi extends GridPrivateApiCommon, K extends keyof HTMLElementEventMap>(apiRef: React.MutableRefObject<PrivateApi>, ref: React.MutableRefObject<HTMLDivElement | null> | (() => HTMLElement | undefined | null), eventName: K, handler?: (
|
|
3
|
+
export declare const useGridNativeEventListener: <PrivateApi extends GridPrivateApiCommon, K extends keyof HTMLElementEventMap>(apiRef: React.MutableRefObject<PrivateApi>, ref: React.MutableRefObject<HTMLDivElement | null> | (() => HTMLElement | undefined | null), eventName: K, handler?: (event: HTMLElementEventMap[K]) => any, options?: AddEventListenerOptions) => void;
|
|
@@ -3,4 +3,4 @@ import type { GridApiCommon } from '../../models/api/gridApiCommon';
|
|
|
3
3
|
import { OutputSelector } from '../../utils/createSelector';
|
|
4
4
|
import { fastObjectShallowCompare } from '../../utils/fastObjectShallowCompare';
|
|
5
5
|
export declare const objectShallowCompare: typeof fastObjectShallowCompare;
|
|
6
|
-
export declare const useGridSelector: <Api extends GridApiCommon<any, any>, T>(apiRef: React.MutableRefObject<Api>, selector:
|
|
6
|
+
export declare const useGridSelector: <Api extends GridApiCommon<any, any>, T>(apiRef: React.MutableRefObject<Api>, selector: ((state: Api['state']) => T) | OutputSelector<Api['state'], T>, equals?: (a: T, b: T) => boolean) => T;
|
package/index.js
CHANGED
package/joy/icons.js
CHANGED
|
@@ -18,8 +18,7 @@ const _excluded = ["sx", "fontSize"],
|
|
|
18
18
|
import * as React from 'react';
|
|
19
19
|
import SvgIcon from '@mui/joy/SvgIcon';
|
|
20
20
|
import { useGridRootProps } from '../hooks/utils/useGridRootProps';
|
|
21
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
21
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
23
22
|
function createSvgIcon(path, displayName) {
|
|
24
23
|
const fontSizeMap = {
|
|
25
24
|
small: 'lg',
|
package/joy/joySlots.js
CHANGED
|
@@ -26,8 +26,7 @@ import { useGridApiContext } from '../hooks/utils/useGridApiContext';
|
|
|
26
26
|
import { useGridRootProps } from '../hooks/utils/useGridRootProps';
|
|
27
27
|
import { gridFilteredTopLevelRowCountSelector, gridPaginationModelSelector } from '../hooks';
|
|
28
28
|
import { GridOverlay } from '../components/containers/GridOverlay';
|
|
29
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
30
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
29
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
31
30
|
function convertColor(color) {
|
|
32
31
|
if (color === 'secondary') {
|
|
33
32
|
return 'primary';
|
|
@@ -8,8 +8,7 @@ import { GridContextProvider } from '../context/GridContextProvider';
|
|
|
8
8
|
import { useDataGridComponent } from './useDataGridComponent';
|
|
9
9
|
import { useDataGridProps } from './useDataGridProps';
|
|
10
10
|
import { propValidatorsDataGrid, validateProps } from '../internals/utils/propValidation';
|
|
11
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
12
|
const propValidators = [...propValidatorsDataGrid,
|
|
14
13
|
// Only validate in MIT version
|
|
15
14
|
props => props.columns && props.columns.some(column => column.resizable) && [`MUI X: \`column.resizable = true\` is not a valid prop.`, 'Column resizing is not available in the MIT version.', '', 'You need to upgrade to DataGridPro or DataGridPremium component to unlock this feature.'].join('\n') || undefined];
|
|
@@ -7,6 +7,13 @@ function buildApplyFilterFn(filterItem, compareFn, showTime, keepHours) {
|
|
|
7
7
|
if (showTime) {
|
|
8
8
|
date.setSeconds(0, 0);
|
|
9
9
|
} else {
|
|
10
|
+
// In GMT-X timezone, the date will be one day behind.
|
|
11
|
+
// For 2022-08-16:
|
|
12
|
+
// GMT+2: Tue Aug 16 2022 02:00:00 GMT+0200
|
|
13
|
+
// GMT-4: Mon Aug 15 2022 20:00:00 GMT-0400
|
|
14
|
+
//
|
|
15
|
+
// We need to add the offset before resetting the hours.
|
|
16
|
+
date.setMinutes(date.getMinutes() + date.getTimezoneOffset());
|
|
10
17
|
date.setHours(0, 0, 0, 0);
|
|
11
18
|
}
|
|
12
19
|
const time = date.getTime();
|
|
@@ -9,8 +9,7 @@ import { useGridApiContext } from '../hooks/utils/useGridApiContext';
|
|
|
9
9
|
import { GridSelectedRowCount } from './GridSelectedRowCount';
|
|
10
10
|
import { GridFooterContainer } from './containers/GridFooterContainer';
|
|
11
11
|
import { useGridRootProps } from '../hooks/utils/useGridRootProps';
|
|
12
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
13
|
const GridFooter = /*#__PURE__*/React.forwardRef(function GridFooter(props, ref) {
|
|
15
14
|
const apiRef = useGridApiContext();
|
|
16
15
|
const rootProps = useGridRootProps();
|
|
@@ -2,8 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { useGridRootProps } from '../hooks/utils/useGridRootProps';
|
|
4
4
|
import { GridPreferencesPanel } from './panel/GridPreferencesPanel';
|
|
5
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
6
|
export function GridHeader() {
|
|
8
7
|
const rootProps = useGridRootProps();
|
|
9
8
|
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
1
2
|
import * as React from 'react';
|
|
2
3
|
import { fastMemo } from '../utils/fastMemo';
|
|
3
4
|
import { useGridPrivateApiContext } from '../hooks/utils/useGridPrivateApiContext';
|
|
@@ -30,7 +31,7 @@ function GridHeaders() {
|
|
|
30
31
|
apiRef.current.register('private', {
|
|
31
32
|
columnHeadersContainerRef: columnsContainerRef
|
|
32
33
|
});
|
|
33
|
-
return /*#__PURE__*/_jsx(rootProps.slots.columnHeaders, {
|
|
34
|
+
return /*#__PURE__*/_jsx(rootProps.slots.columnHeaders, _extends({
|
|
34
35
|
ref: columnsContainerRef,
|
|
35
36
|
visibleColumns: visibleColumns,
|
|
36
37
|
filterColumnLookup: filterColumnLookup,
|
|
@@ -44,7 +45,7 @@ function GridHeaders() {
|
|
|
44
45
|
columnVisibility: columnVisibility,
|
|
45
46
|
columnGroupsHeaderStructure: columnGroupsHeaderStructure,
|
|
46
47
|
hasOtherElementInTabSequence: hasOtherElementInTabSequence
|
|
47
|
-
});
|
|
48
|
+
}, rootProps.slotProps?.columnHeaders));
|
|
48
49
|
}
|
|
49
50
|
const MemoizedGridHeaders = fastMemo(GridHeaders);
|
|
50
51
|
export { MemoizedGridHeaders as GridHeaders };
|
|
@@ -24,8 +24,7 @@ import { gridEditRowsStateSelector } from '../hooks/features/editing/gridEditing
|
|
|
24
24
|
import { PinnedPosition, gridPinnedColumnPositionLookup } from './cell/GridCell';
|
|
25
25
|
import { GridScrollbarFillerCell as ScrollbarFiller } from './GridScrollbarFillerCell';
|
|
26
26
|
import { getPinnedCellOffset } from '../internals/utils/getPinnedCellOffset';
|
|
27
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
28
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
27
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
29
28
|
const useUtilityClasses = ownerState => {
|
|
30
29
|
const {
|
|
31
30
|
editable,
|
|
@@ -10,8 +10,7 @@ import { gridClasses } from '../../constants/gridClasses';
|
|
|
10
10
|
import { GridMenu } from '../menu/GridMenu';
|
|
11
11
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
12
12
|
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
13
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
14
|
const hasActions = colDef => typeof colDef.getActions === 'function';
|
|
16
15
|
function GridActionsCell(props) {
|
|
17
16
|
const {
|
|
@@ -7,8 +7,7 @@ import PropTypes from 'prop-types';
|
|
|
7
7
|
import MenuItem from '@mui/material/MenuItem';
|
|
8
8
|
import ListItemIcon from '@mui/material/ListItemIcon';
|
|
9
9
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
10
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
11
|
const GridActionsCellItem = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
13
12
|
const rootProps = useGridRootProps();
|
|
14
13
|
if (!props.showInMenu) {
|
|
@@ -10,8 +10,7 @@ import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
|
10
10
|
import { getDataGridUtilityClass } from '../../constants/gridClasses';
|
|
11
11
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
12
12
|
import { GridIconButtonContainer } from './GridIconButtonContainer';
|
|
13
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
14
|
const useUtilityClasses = ownerState => {
|
|
16
15
|
const {
|
|
17
16
|
classes
|
|
@@ -13,8 +13,7 @@ import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
|
13
13
|
import { GridGenericColumnHeaderItem } from './GridGenericColumnHeaderItem';
|
|
14
14
|
import { isEventTargetInPortal } from '../../utils/domUtils';
|
|
15
15
|
import { shouldCellShowLeftBorder, shouldCellShowRightBorder } from '../../utils/cellBorderUtils';
|
|
16
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
17
|
const useUtilityClasses = ownerState => {
|
|
19
18
|
const {
|
|
20
19
|
colDef,
|
|
@@ -7,8 +7,7 @@ import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
|
7
7
|
import { getDataGridUtilityClass } from '../../constants/gridClasses';
|
|
8
8
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
9
9
|
import { GridIconButtonContainer } from './GridIconButtonContainer';
|
|
10
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
11
|
const useUtilityClasses = ownerState => {
|
|
13
12
|
const {
|
|
14
13
|
classes
|
|
@@ -8,8 +8,7 @@ import { useGridPrivateApiContext } from '../../hooks/utils/useGridPrivateApiCon
|
|
|
8
8
|
import { GridColumnHeaderTitle } from './GridColumnHeaderTitle';
|
|
9
9
|
import { GridColumnHeaderSeparator } from './GridColumnHeaderSeparator';
|
|
10
10
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
11
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
12
|
const GridGenericColumnHeaderItem = /*#__PURE__*/React.forwardRef(function GridGenericColumnHeaderItem(props, ref) {
|
|
14
13
|
const {
|
|
15
14
|
classes,
|
|
@@ -12,8 +12,7 @@ import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
|
12
12
|
import { getDataGridUtilityClass } from '../../constants/gridClasses';
|
|
13
13
|
import { useLazyRef } from '../../hooks/utils/useLazyRef';
|
|
14
14
|
import { checkColumnVisibilityModelsSame, defaultSearchPredicate } from './utils';
|
|
15
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
16
|
const useUtilityClasses = ownerState => {
|
|
18
17
|
const {
|
|
19
18
|
classes
|
|
@@ -12,8 +12,7 @@ import { useGridPrivateApiContext } from '../../hooks/utils/useGridPrivateApiCon
|
|
|
12
12
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
13
13
|
import { getDataGridUtilityClass } from '../../constants/gridClasses';
|
|
14
14
|
import { gridDensitySelector } from '../../hooks/features/density/densitySelector';
|
|
15
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
16
|
const useUtilityClasses = ownerState => {
|
|
18
17
|
const {
|
|
19
18
|
autoHeight,
|
|
@@ -3,8 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import { GridColumnMenuHideItem } from './GridColumnMenuHideItem';
|
|
5
5
|
import { GridColumnMenuManageItem } from './GridColumnMenuManageItem';
|
|
6
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
7
|
function GridColumnMenuColumnsItem(props) {
|
|
9
8
|
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
10
9
|
children: [/*#__PURE__*/_jsx(GridColumnMenuHideItem, _extends({}, props)), /*#__PURE__*/_jsx(GridColumnMenuManageItem, _extends({}, props))]
|
|
@@ -5,8 +5,7 @@ import ListItemIcon from '@mui/material/ListItemIcon';
|
|
|
5
5
|
import ListItemText from '@mui/material/ListItemText';
|
|
6
6
|
import { useGridApiContext } from '../../../../hooks/utils/useGridApiContext';
|
|
7
7
|
import { useGridRootProps } from '../../../../hooks/utils/useGridRootProps';
|
|
8
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
9
|
function GridColumnMenuFilterItem(props) {
|
|
11
10
|
const {
|
|
12
11
|
colDef,
|
|
@@ -6,8 +6,7 @@ import ListItemText from '@mui/material/ListItemText';
|
|
|
6
6
|
import { useGridApiContext } from '../../../../hooks/utils/useGridApiContext';
|
|
7
7
|
import { useGridRootProps } from '../../../../hooks/utils/useGridRootProps';
|
|
8
8
|
import { gridVisibleColumnDefinitionsSelector } from '../../../../hooks/features/columns';
|
|
9
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
10
|
function GridColumnMenuHideItem(props) {
|
|
12
11
|
const {
|
|
13
12
|
colDef,
|
|
@@ -6,8 +6,7 @@ import ListItemText from '@mui/material/ListItemText';
|
|
|
6
6
|
import { GridPreferencePanelsValue } from '../../../../hooks/features/preferencesPanel/gridPreferencePanelsValue';
|
|
7
7
|
import { useGridApiContext } from '../../../../hooks/utils/useGridApiContext';
|
|
8
8
|
import { useGridRootProps } from '../../../../hooks/utils/useGridRootProps';
|
|
9
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
10
|
function GridColumnMenuManageItem(props) {
|
|
12
11
|
const {
|
|
13
12
|
onClick
|
|
@@ -7,8 +7,7 @@ import { useGridSelector } from '../../../../hooks/utils/useGridSelector';
|
|
|
7
7
|
import { gridSortModelSelector } from '../../../../hooks/features/sorting/gridSortingSelector';
|
|
8
8
|
import { useGridApiContext } from '../../../../hooks/utils/useGridApiContext';
|
|
9
9
|
import { useGridRootProps } from '../../../../hooks/utils/useGridRootProps';
|
|
10
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
11
|
function GridColumnMenuSortItem(props) {
|
|
13
12
|
const {
|
|
14
13
|
colDef,
|
|
@@ -15,9 +15,8 @@ import { useGridApiContext } from '../../../hooks/utils/useGridApiContext';
|
|
|
15
15
|
import { useGridRootProps } from '../../../hooks/utils/useGridRootProps';
|
|
16
16
|
import { getDataGridUtilityClass } from '../../../constants/gridClasses';
|
|
17
17
|
import { getValueFromValueOptions, getValueOptions } from './filterPanelUtils';
|
|
18
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
19
|
import { createElement as _createElement } from "react";
|
|
20
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
21
20
|
const useUtilityClasses = ownerState => {
|
|
22
21
|
const {
|
|
23
22
|
classes
|
|
@@ -6,8 +6,7 @@ import PropTypes from 'prop-types';
|
|
|
6
6
|
import { refType, unstable_useId as useId } from '@mui/utils';
|
|
7
7
|
import { styled } from '@mui/material/styles';
|
|
8
8
|
import { useGridRootProps } from '../../../hooks/utils/useGridRootProps';
|
|
9
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
10
|
const BooleanOperatorContainer = styled('div')({
|
|
12
11
|
display: 'flex',
|
|
13
12
|
alignItems: 'center',
|
|
@@ -15,14 +15,14 @@ function convertFilterItemValueToInputValue(itemValue, inputType) {
|
|
|
15
15
|
if (Number.isNaN(dateCopy.getTime())) {
|
|
16
16
|
return '';
|
|
17
17
|
}
|
|
18
|
-
// The date picker expects the date to be in the local timezone.
|
|
19
|
-
// But .toISOString() converts it to UTC with zero offset.
|
|
20
|
-
// So we need to subtract the timezone offset.
|
|
21
|
-
dateCopy.setMinutes(dateCopy.getMinutes() - dateCopy.getTimezoneOffset());
|
|
22
18
|
if (inputType === 'date') {
|
|
23
19
|
return dateCopy.toISOString().substring(0, 10);
|
|
24
20
|
}
|
|
25
21
|
if (inputType === 'datetime-local') {
|
|
22
|
+
// The date picker expects the date to be in the local timezone.
|
|
23
|
+
// But .toISOString() converts it to UTC with zero offset.
|
|
24
|
+
// So we need to subtract the timezone offset.
|
|
25
|
+
dateCopy.setMinutes(dateCopy.getMinutes() - dateCopy.getTimezoneOffset());
|
|
26
26
|
return dateCopy.toISOString().substring(0, 19);
|
|
27
27
|
}
|
|
28
28
|
return dateCopy.toISOString().substring(0, 10);
|
|
@@ -8,8 +8,7 @@ import { styled } from '@mui/material/styles';
|
|
|
8
8
|
import { useGridRootProps } from '../../../hooks/utils/useGridRootProps';
|
|
9
9
|
import { getValueFromValueOptions, getValueOptions, isSingleSelectColDef } from './filterPanelUtils';
|
|
10
10
|
import { createElement as _createElement } from "react";
|
|
11
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
12
|
const renderSingleSelectOptions = ({
|
|
14
13
|
column,
|
|
15
14
|
OptionComponent,
|
|
@@ -13,8 +13,7 @@ import { useGridRootProps } from '../../../hooks/utils/useGridRootProps';
|
|
|
13
13
|
import { useGridSelector } from '../../../hooks/utils/useGridSelector';
|
|
14
14
|
import { gridFilterModelSelector } from '../../../hooks/features/filter/gridFilterSelector';
|
|
15
15
|
import { gridFilterableColumnDefinitionsSelector, gridFilterableColumnLookupSelector } from '../../../hooks/features/columns/gridColumnsSelector';
|
|
16
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
17
|
const getGridFilter = col => ({
|
|
19
18
|
field: col.field,
|
|
20
19
|
operator: col.filterOperators[0].value,
|
|
@@ -11,8 +11,7 @@ import { GridToolbarFilterButton } from './GridToolbarFilterButton';
|
|
|
11
11
|
import { GridToolbarExport } from './GridToolbarExport';
|
|
12
12
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
13
13
|
import { GridToolbarQuickFilter } from './GridToolbarQuickFilter';
|
|
14
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
15
|
const GridToolbar = /*#__PURE__*/React.forwardRef(function GridToolbar(props, ref) {
|
|
17
16
|
// TODO v7: think about where export option should be passed.
|
|
18
17
|
// from slotProps={{ toolbarExport: { ...exportOption } }} seems to be more appropriate
|
|
@@ -12,8 +12,7 @@ import { useGridSelector } from '../../hooks/utils/useGridSelector';
|
|
|
12
12
|
import { GridMenu } from '../menu/GridMenu';
|
|
13
13
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
14
14
|
import { gridClasses } from '../../constants/gridClasses';
|
|
15
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
16
|
const GridToolbarDensitySelector = /*#__PURE__*/React.forwardRef(function GridToolbarDensitySelector(props, ref) {
|
|
18
17
|
const {
|
|
19
18
|
slotProps = {}
|
|
@@ -8,8 +8,7 @@ import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
|
8
8
|
import { GridMenu } from '../menu/GridMenu';
|
|
9
9
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
10
10
|
import { gridClasses } from '../../constants/gridClasses';
|
|
11
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
12
|
const GridToolbarExportContainer = /*#__PURE__*/React.forwardRef(function GridToolbarExportContainer(props, ref) {
|
|
14
13
|
const {
|
|
15
14
|
children,
|
|
@@ -12,8 +12,7 @@ import { GridPreferencePanelsValue } from '../../hooks/features/preferencesPanel
|
|
|
12
12
|
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
13
13
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
14
14
|
import { getDataGridUtilityClass } from '../../constants/gridClasses';
|
|
15
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
16
|
const useUtilityClasses = ownerState => {
|
|
18
17
|
const {
|
|
19
18
|
classes
|
|
@@ -18,8 +18,7 @@ import { GridVirtualScrollerContent as Content } from './GridVirtualScrollerCont
|
|
|
18
18
|
import { GridVirtualScrollerFiller as SpaceFiller } from './GridVirtualScrollerFiller';
|
|
19
19
|
import { GridVirtualScrollerRenderZone as RenderZone } from './GridVirtualScrollerRenderZone';
|
|
20
20
|
import { GridVirtualScrollbar as Scrollbar } from './GridVirtualScrollbar';
|
|
21
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
21
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
23
22
|
const useUtilityClasses = (ownerState, dimensions) => {
|
|
24
23
|
const {
|
|
25
24
|
classes
|
|
@@ -5,8 +5,7 @@ import { useGridSelector } from '../../hooks/utils/useGridSelector';
|
|
|
5
5
|
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
6
6
|
import { gridDimensionsSelector } from '../../hooks/features/dimensions';
|
|
7
7
|
import { gridClasses } from '../../constants';
|
|
8
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
9
|
const Filler = styled('div')({
|
|
11
10
|
display: 'flex',
|
|
12
11
|
flexDirection: 'row',
|
|
@@ -16,8 +16,7 @@ import { GridScrollbarFillerCell as ScrollbarFiller } from '../../../components/
|
|
|
16
16
|
import { getPinnedCellOffset } from '../../../internals/utils/getPinnedCellOffset';
|
|
17
17
|
import { GridColumnHeaderSeparatorSides } from '../../../components/columnHeaders/GridColumnHeaderSeparator';
|
|
18
18
|
import { gridClasses } from '../../../constants/gridClasses';
|
|
19
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
20
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
21
20
|
export const GridColumnHeaderRow = styled('div', {
|
|
22
21
|
name: 'MuiDataGrid',
|
|
23
22
|
slot: 'ColumnHeaderRow',
|
|
@@ -3,7 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import { unstable_ownerDocument as ownerDocument, unstable_useEventCallback as useEventCallback } from '@mui/utils';
|
|
4
4
|
import useLazyRef from '@mui/utils/useLazyRef';
|
|
5
5
|
import { useTheme } from '@mui/material/styles';
|
|
6
|
-
import { findGridCellElementsFromCol, findGridElement, findLeftPinnedCellsAfterCol, findRightPinnedCellsBeforeCol, getFieldFromHeaderElem, findHeaderElementFromField, findGroupHeaderElementsFromField, findGridHeader, findGridCells, findParentElementFromClassName, findLeftPinnedHeadersAfterCol, findRightPinnedHeadersBeforeCol } from '../../../utils/domUtils';
|
|
6
|
+
import { findGridCellElementsFromCol, findGridElement, findLeftPinnedCellsAfterCol, findRightPinnedCellsBeforeCol, getFieldFromHeaderElem, findHeaderElementFromField, getFieldsFromGroupHeaderElem, findGroupHeaderElementsFromField, findGridHeader, findGridCells, findParentElementFromClassName, findLeftPinnedHeadersAfterCol, findRightPinnedHeadersBeforeCol } from '../../../utils/domUtils';
|
|
7
7
|
import { DEFAULT_GRID_AUTOSIZE_OPTIONS } from './gridColumnResizeApi';
|
|
8
8
|
import { gridClasses } from '../../../constants/gridClasses';
|
|
9
9
|
import { useGridApiEventHandler, useGridApiMethod, useGridApiOptionHandler, useGridLogger, useGridNativeEventListener, useGridSelector, useOnMount } from '../../utils';
|
|
@@ -294,6 +294,21 @@ export const useGridColumnResize = (apiRef, props) => {
|
|
|
294
294
|
if (refs.colDef) {
|
|
295
295
|
apiRef.current.setColumnWidth(refs.colDef.field, refs.colDef.width);
|
|
296
296
|
logger.debug(`Updating col ${refs.colDef.field} with new width: ${refs.colDef.width}`);
|
|
297
|
+
const columnsState = gridColumnsStateSelector(apiRef.current.state);
|
|
298
|
+
refs.groupHeaderElements.forEach(element => {
|
|
299
|
+
const fields = getFieldsFromGroupHeaderElem(element);
|
|
300
|
+
const div = element;
|
|
301
|
+
const newWidth = fields.reduce((acc, field) => {
|
|
302
|
+
if (columnsState.columnVisibilityModel[field] !== false) {
|
|
303
|
+
return acc + columnsState.lookup[field].computedWidth;
|
|
304
|
+
}
|
|
305
|
+
return acc;
|
|
306
|
+
}, 0);
|
|
307
|
+
const finalWidth = `${newWidth}px`;
|
|
308
|
+
div.style.width = finalWidth;
|
|
309
|
+
div.style.minWidth = finalWidth;
|
|
310
|
+
div.style.maxWidth = finalWidth;
|
|
311
|
+
});
|
|
297
312
|
}
|
|
298
313
|
stopResizeEventTimeout.start(0, () => {
|
|
299
314
|
apiRef.current.publishEvent('columnResizeStop', null, nativeEvent);
|
|
@@ -110,7 +110,7 @@ export function computeFlexColumnsWidth({
|
|
|
110
110
|
* TODO: Unit test this function in depth and only keep basic cases for the whole grid testing.
|
|
111
111
|
* TODO: Improve the `GridColDef` typing to reflect the fact that `minWidth` / `maxWidth` and `width` can't be null after the merge with the `type` default values.
|
|
112
112
|
*/
|
|
113
|
-
export const hydrateColumnsWidth = (rawState,
|
|
113
|
+
export const hydrateColumnsWidth = (rawState, dimensions) => {
|
|
114
114
|
const columnsLookup = {};
|
|
115
115
|
let totalFlexUnits = 0;
|
|
116
116
|
let widthAllocatedBeforeFlex = 0;
|
|
@@ -136,10 +136,11 @@ export const hydrateColumnsWidth = (rawState, viewportInnerWidth) => {
|
|
|
136
136
|
}
|
|
137
137
|
columnsLookup[columnField] = newColumn;
|
|
138
138
|
});
|
|
139
|
-
const
|
|
139
|
+
const availableWidth = dimensions === undefined ? 0 : dimensions.viewportOuterSize.width - (dimensions.hasScrollY ? dimensions.scrollbarSize : 0);
|
|
140
|
+
const initialFreeSpace = Math.max(availableWidth - widthAllocatedBeforeFlex, 0);
|
|
140
141
|
|
|
141
142
|
// Allocate the remaining space to the flex columns
|
|
142
|
-
if (totalFlexUnits > 0 &&
|
|
143
|
+
if (totalFlexUnits > 0 && availableWidth > 0) {
|
|
143
144
|
const computedColumnWidths = computeFlexColumnsWidth({
|
|
144
145
|
initialFreeSpace,
|
|
145
146
|
totalFlexUnits,
|
|
@@ -282,7 +283,7 @@ export const createColumnsState = ({
|
|
|
282
283
|
}
|
|
283
284
|
const columnsStateWithPreProcessing = apiRef.current.unstable_applyPipeProcessors('hydrateColumns', columnsState);
|
|
284
285
|
const columnsStateWithPortableColumns = applyInitialState(columnsStateWithPreProcessing, initialState);
|
|
285
|
-
return hydrateColumnsWidth(columnsStateWithPortableColumns, apiRef.current.getRootDimensions?.()
|
|
286
|
+
return hydrateColumnsWidth(columnsStateWithPortableColumns, apiRef.current.getRootDimensions?.() ?? undefined);
|
|
286
287
|
};
|
|
287
288
|
export function getFirstNonSpannedColumnToRender({
|
|
288
289
|
firstColumnToRender,
|