@mui/x-data-grid 7.24.0 → 7.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +148 -0
- package/DataGrid/DataGrid.js +1 -7
- package/DataGrid/useDataGridComponent.d.ts +2 -1
- package/components/GridRow.d.ts +0 -1
- package/components/GridRow.js +25 -19
- package/components/cell/GridCell.d.ts +9 -6
- package/components/cell/GridCell.js +29 -52
- package/components/columnHeaders/GridColumnHeaderFilterIconButton.d.ts +3 -3
- package/components/columnHeaders/GridColumnHeaderFilterIconButton.js +21 -7
- package/components/containers/GridRootStyles.js +135 -37
- package/components/panel/GridPanel.js +2 -1
- package/components/panel/filterPanel/GridFilterInputValueProps.d.ts +2 -1
- package/components/toolbar/GridToolbarColumnsButton.js +8 -2
- package/components/toolbar/GridToolbarDensitySelector.js +2 -2
- package/components/toolbar/GridToolbarExportContainer.js +2 -2
- package/components/toolbar/GridToolbarFilterButton.js +8 -2
- package/components/virtualization/GridMainContainer.d.ts +10 -0
- package/components/virtualization/GridMainContainer.js +10 -2
- package/components/virtualization/GridVirtualScrollbar.d.ts +4 -0
- package/components/virtualization/GridVirtualScrollbar.js +5 -5
- package/components/virtualization/GridVirtualScroller.js +18 -5
- package/components/virtualization/GridVirtualScrollerContent.js +11 -2
- package/context/GridContextProvider.d.ts +2 -1
- package/hooks/core/pipeProcessing/useGridPipeProcessing.d.ts +2 -2
- package/hooks/core/pipeProcessing/useGridRegisterPipeApplier.d.ts +2 -2
- package/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.d.ts +2 -2
- package/hooks/core/strategyProcessing/useGridRegisterStrategyProcessor.d.ts +2 -2
- package/hooks/core/strategyProcessing/useGridStrategyProcessing.d.ts +2 -2
- package/hooks/core/useGridApiInitialization.d.ts +2 -2
- package/hooks/core/useGridInitialization.d.ts +2 -2
- package/hooks/core/useGridIsRtl.d.ts +2 -2
- package/hooks/core/useGridLocaleText.d.ts +2 -2
- package/hooks/core/useGridLoggerFactory.d.ts +2 -2
- package/hooks/core/useGridRefs.d.ts +2 -2
- package/hooks/core/useGridStateInitialization.d.ts +2 -2
- package/hooks/features/clipboard/useGridClipboard.d.ts +2 -2
- package/hooks/features/columnGrouping/useGridColumnGrouping.d.ts +2 -2
- package/hooks/features/columnMenu/useGridColumnMenu.d.ts +2 -2
- package/hooks/features/columnMenu/useGridColumnMenu.js +0 -2
- package/hooks/features/columnResize/useGridColumnResize.d.ts +2 -2
- package/hooks/features/columnResize/useGridColumnResize.js +2 -1
- package/hooks/features/columns/gridColumnsUtils.d.ts +4 -4
- package/hooks/features/columns/useGridColumnSpanning.d.ts +2 -2
- package/hooks/features/columns/useGridColumns.d.ts +2 -2
- package/hooks/features/columns/useGridColumns.js +7 -3
- package/hooks/features/density/useGridDensity.d.ts +2 -2
- package/hooks/features/dimensions/useGridDimensions.d.ts +2 -2
- package/hooks/features/dimensions/useGridDimensions.js +7 -11
- package/hooks/features/editing/gridEditingSelectors.d.ts +6 -0
- package/hooks/features/editing/gridEditingSelectors.js +7 -1
- package/hooks/features/editing/index.d.ts +1 -1
- package/hooks/features/editing/index.js +1 -1
- package/hooks/features/editing/useGridCellEditing.d.ts +2 -2
- package/hooks/features/editing/useGridCellEditing.js +3 -3
- package/hooks/features/editing/useGridEditing.d.ts +2 -2
- package/hooks/features/editing/useGridRowEditing.d.ts +2 -2
- package/hooks/features/editing/useGridRowEditing.js +5 -6
- package/hooks/features/events/useGridEvents.d.ts +2 -2
- package/hooks/features/export/serializers/csvSerializer.d.ts +2 -1
- package/hooks/features/export/useGridCsvExport.d.ts +2 -2
- package/hooks/features/export/useGridPrintExport.d.ts +2 -2
- package/hooks/features/export/utils.d.ts +2 -2
- package/hooks/features/filter/gridFilterUtils.d.ts +7 -7
- package/hooks/features/filter/gridFilterUtils.js +3 -3
- package/hooks/features/filter/useGridFilter.d.ts +2 -2
- package/hooks/features/focus/useGridFocus.d.ts +2 -2
- package/hooks/features/focus/useGridFocus.js +3 -2
- package/hooks/features/headerFiltering/useGridHeaderFiltering.d.ts +2 -2
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +2 -2
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +24 -16
- package/hooks/features/keyboardNavigation/utils.d.ts +3 -4
- package/hooks/features/keyboardNavigation/utils.js +0 -5
- package/hooks/features/listView/useGridListView.d.ts +2 -2
- package/hooks/features/listView/useGridListView.js +2 -1
- package/hooks/features/pagination/useGridPagination.d.ts +2 -2
- package/hooks/features/pagination/useGridPaginationMeta.d.ts +2 -2
- package/hooks/features/pagination/useGridPaginationModel.d.ts +2 -2
- package/hooks/features/pagination/useGridRowCount.d.ts +2 -2
- package/hooks/features/preferencesPanel/gridPreferencePanelSelector.d.ts +1 -0
- package/hooks/features/preferencesPanel/gridPreferencePanelSelector.js +8 -1
- package/hooks/features/preferencesPanel/index.d.ts +1 -1
- package/hooks/features/preferencesPanel/index.js +1 -1
- package/hooks/features/preferencesPanel/useGridPreferencesPanel.d.ts +2 -2
- package/hooks/features/preferencesPanel/useGridPreferencesPanel.js +14 -38
- package/hooks/features/rowSelection/useGridRowSelection.d.ts +2 -2
- package/hooks/features/rowSelection/useGridRowSelection.js +3 -3
- package/hooks/features/rowSelection/useGridRowSelectionPreProcessors.d.ts +2 -2
- package/hooks/features/rowSelection/utils.d.ts +3 -2
- package/hooks/features/rows/gridRowSpanningUtils.d.ts +2 -2
- package/hooks/features/rows/gridRowsUtils.d.ts +4 -4
- package/hooks/features/rows/useGridParamsApi.d.ts +2 -2
- package/hooks/features/rows/useGridParamsApi.js +33 -14
- package/hooks/features/rows/useGridRowSpanning.d.ts +2 -2
- package/hooks/features/rows/useGridRowSpanning.js +94 -91
- package/hooks/features/rows/useGridRows.d.ts +2 -2
- package/hooks/features/rows/useGridRows.js +7 -8
- package/hooks/features/rows/useGridRowsMeta.d.ts +2 -2
- package/hooks/features/rows/useGridRowsMeta.js +3 -2
- package/hooks/features/rows/useGridRowsPreProcessors.d.ts +2 -2
- package/hooks/features/scroll/useGridScroll.d.ts +2 -2
- package/hooks/features/sorting/gridSortingUtils.d.ts +3 -3
- package/hooks/features/sorting/gridSortingUtils.js +2 -2
- package/hooks/features/sorting/useGridSorting.d.ts +2 -2
- package/hooks/features/statePersistence/useGridStatePersistence.d.ts +2 -2
- package/hooks/features/virtualization/gridFocusedVirtualCellSelector.js +2 -2
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +9 -1
- package/hooks/features/virtualization/useGridVirtualScroller.js +32 -53
- package/hooks/features/virtualization/useGridVirtualization.d.ts +2 -2
- package/hooks/utils/useGridApiContext.d.ts +2 -2
- package/hooks/utils/useGridApiEventHandler.d.ts +4 -4
- package/hooks/utils/useGridApiMethod.d.ts +2 -2
- package/hooks/utils/useGridApiRef.d.ts +2 -2
- package/hooks/utils/useGridApiRef.js +3 -1
- package/hooks/utils/useGridInitializeState.d.ts +3 -3
- package/hooks/utils/useGridLogger.d.ts +2 -2
- package/hooks/utils/useGridNativeEventListener.d.ts +2 -1
- package/hooks/utils/useGridPrivateApiContext.d.ts +2 -1
- package/hooks/utils/useGridSelector.d.ts +3 -3
- package/hooks/utils/useGridVisibleRows.d.ts +3 -3
- package/index.js +1 -1
- package/locales/faIR.js +5 -6
- package/models/api/gridApiCommon.d.ts +2 -2
- package/models/api/gridParamsApi.d.ts +29 -2
- package/models/api/index.d.ts +1 -1
- package/models/api/index.js +0 -1
- package/models/colDef/gridColDef.d.ts +9 -8
- package/models/gridExport.d.ts +2 -2
- package/models/gridFilterOperator.d.ts +2 -1
- package/models/props/DataGridProps.d.ts +2 -1
- package/modern/DataGrid/DataGrid.js +1 -7
- package/modern/components/GridRow.js +25 -19
- package/modern/components/cell/GridCell.js +29 -52
- package/modern/components/columnHeaders/GridColumnHeaderFilterIconButton.js +21 -7
- package/modern/components/containers/GridRootStyles.js +135 -37
- package/modern/components/panel/GridPanel.js +2 -1
- package/modern/components/toolbar/GridToolbarColumnsButton.js +8 -2
- package/modern/components/toolbar/GridToolbarDensitySelector.js +2 -2
- package/modern/components/toolbar/GridToolbarExportContainer.js +2 -2
- package/modern/components/toolbar/GridToolbarFilterButton.js +8 -2
- package/modern/components/virtualization/GridMainContainer.js +10 -2
- package/modern/components/virtualization/GridVirtualScrollbar.js +5 -5
- package/modern/components/virtualization/GridVirtualScroller.js +18 -5
- package/modern/components/virtualization/GridVirtualScrollerContent.js +11 -2
- package/modern/hooks/features/columnMenu/useGridColumnMenu.js +0 -2
- package/modern/hooks/features/columnResize/useGridColumnResize.js +2 -1
- package/modern/hooks/features/columns/useGridColumns.js +7 -3
- package/modern/hooks/features/dimensions/useGridDimensions.js +7 -11
- package/modern/hooks/features/editing/gridEditingSelectors.js +7 -1
- package/modern/hooks/features/editing/index.js +1 -1
- package/modern/hooks/features/editing/useGridCellEditing.js +3 -3
- package/modern/hooks/features/editing/useGridRowEditing.js +5 -6
- package/modern/hooks/features/filter/gridFilterUtils.js +3 -3
- package/modern/hooks/features/focus/useGridFocus.js +3 -2
- package/modern/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +24 -16
- package/modern/hooks/features/keyboardNavigation/utils.js +0 -5
- package/modern/hooks/features/listView/useGridListView.js +2 -1
- package/modern/hooks/features/preferencesPanel/gridPreferencePanelSelector.js +8 -1
- package/modern/hooks/features/preferencesPanel/index.js +1 -1
- package/modern/hooks/features/preferencesPanel/useGridPreferencesPanel.js +14 -38
- package/modern/hooks/features/rowSelection/useGridRowSelection.js +3 -3
- package/modern/hooks/features/rows/useGridParamsApi.js +33 -14
- package/modern/hooks/features/rows/useGridRowSpanning.js +94 -91
- package/modern/hooks/features/rows/useGridRows.js +7 -8
- package/modern/hooks/features/rows/useGridRowsMeta.js +3 -2
- package/modern/hooks/features/sorting/gridSortingUtils.js +2 -2
- package/modern/hooks/features/virtualization/gridFocusedVirtualCellSelector.js +2 -2
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +32 -53
- package/modern/hooks/utils/useGridApiRef.js +3 -1
- package/modern/index.js +1 -1
- package/modern/locales/faIR.js +5 -6
- package/modern/models/api/index.js +0 -1
- package/modern/utils/isJSDOM.js +1 -0
- package/modern/utils/roundToDecimalPlaces.js +3 -0
- package/modern/utils/utils.js +6 -1
- package/node/DataGrid/DataGrid.js +1 -7
- package/node/components/GridRow.js +22 -16
- package/node/components/cell/GridCell.js +27 -50
- package/node/components/columnHeaders/GridColumnHeaderFilterIconButton.js +20 -6
- package/node/components/containers/GridRootStyles.js +135 -37
- package/node/components/panel/GridPanel.js +2 -1
- package/node/components/toolbar/GridToolbarColumnsButton.js +8 -2
- package/node/components/toolbar/GridToolbarDensitySelector.js +2 -2
- package/node/components/toolbar/GridToolbarExportContainer.js +2 -2
- package/node/components/toolbar/GridToolbarFilterButton.js +8 -2
- package/node/components/virtualization/GridMainContainer.js +10 -2
- package/node/components/virtualization/GridVirtualScrollbar.js +5 -5
- package/node/components/virtualization/GridVirtualScroller.js +18 -5
- package/node/components/virtualization/GridVirtualScrollerContent.js +11 -2
- package/node/hooks/features/columnMenu/useGridColumnMenu.js +0 -2
- package/node/hooks/features/columnResize/useGridColumnResize.js +2 -1
- package/node/hooks/features/columns/useGridColumns.js +7 -3
- package/node/hooks/features/dimensions/useGridDimensions.js +9 -13
- package/node/hooks/features/editing/gridEditingSelectors.js +8 -2
- package/node/hooks/features/editing/index.js +7 -11
- package/node/hooks/features/editing/useGridCellEditing.js +2 -2
- package/node/hooks/features/editing/useGridRowEditing.js +3 -4
- package/node/hooks/features/filter/gridFilterUtils.js +3 -3
- package/node/hooks/features/focus/useGridFocus.js +3 -2
- package/node/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +24 -15
- package/node/hooks/features/keyboardNavigation/utils.js +0 -6
- package/node/hooks/features/listView/useGridListView.js +2 -1
- package/node/hooks/features/preferencesPanel/gridPreferencePanelSelector.js +9 -2
- package/node/hooks/features/preferencesPanel/index.js +11 -10
- package/node/hooks/features/preferencesPanel/useGridPreferencesPanel.js +14 -38
- package/node/hooks/features/rowSelection/useGridRowSelection.js +2 -2
- package/node/hooks/features/rows/useGridParamsApi.js +33 -14
- package/node/hooks/features/rows/useGridRowSpanning.js +92 -89
- package/node/hooks/features/rows/useGridRows.js +7 -8
- package/node/hooks/features/rows/useGridRowsMeta.js +5 -4
- package/node/hooks/features/sorting/gridSortingUtils.js +2 -2
- package/node/hooks/features/virtualization/gridFocusedVirtualCellSelector.js +2 -2
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +34 -55
- package/node/hooks/utils/useGridApiRef.js +3 -1
- package/node/index.js +1 -1
- package/node/locales/faIR.js +5 -6
- package/node/models/api/index.js +0 -11
- package/node/utils/isJSDOM.js +7 -0
- package/node/utils/roundToDecimalPlaces.js +9 -0
- package/node/utils/utils.js +8 -1
- package/package.json +2 -2
- package/utils/createSelector.d.ts +3 -3
- package/utils/getPublicApiRef.d.ts +2 -1
- package/utils/isJSDOM.d.ts +1 -0
- package/utils/isJSDOM.js +1 -0
- package/utils/roundToDecimalPlaces.d.ts +1 -0
- package/utils/roundToDecimalPlaces.js +3 -0
- package/utils/utils.d.ts +1 -0
- package/utils/utils.js +6 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { RefObject } from '@mui/x-internals/types';
|
|
2
2
|
import { GridApiCommon } from '../../models/api/gridApiCommon';
|
|
3
3
|
import { GridApiCommunity } from '../../models/api/gridApiCommunity';
|
|
4
|
-
export declare function useGridApiContext<Api extends GridApiCommon = GridApiCommunity>():
|
|
4
|
+
export declare function useGridApiContext<Api extends GridApiCommon = GridApiCommunity>(): RefObject<Api>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { RefObject } from '@mui/x-internals/types';
|
|
2
2
|
import { EventListenerOptions } from '@mui/x-internals/EventManager';
|
|
3
3
|
import { GridEventListener, GridEvents } from '../../models/events';
|
|
4
4
|
import { CleanupTracking } from '../../utils/cleanupTracking/CleanupTracking';
|
|
@@ -15,8 +15,8 @@ declare enum GridSignature {
|
|
|
15
15
|
interface RegistryContainer {
|
|
16
16
|
registry: CleanupTracking | null;
|
|
17
17
|
}
|
|
18
|
-
export declare function createUseGridApiEventHandler(registryContainer: RegistryContainer): <Api extends GridApiCommon, E extends GridEvents>(apiRef:
|
|
18
|
+
export declare function createUseGridApiEventHandler(registryContainer: RegistryContainer): <Api extends GridApiCommon, E extends GridEvents>(apiRef: RefObject<Api>, eventName: E, handler?: GridEventListener<E>, options?: EventListenerOptions) => void;
|
|
19
19
|
export declare const unstable_resetCleanupTracking: () => void;
|
|
20
|
-
export declare const useGridApiEventHandler: <Api extends GridApiCommon, E extends GridEvents>(apiRef:
|
|
21
|
-
export declare function useGridApiOptionHandler<Api extends GridApiCommon, E extends GridEvents>(apiRef:
|
|
20
|
+
export declare const useGridApiEventHandler: <Api extends GridApiCommon, E extends GridEvents>(apiRef: RefObject<Api>, eventName: E, handler?: GridEventListener<E>, options?: EventListenerOptions) => void;
|
|
21
|
+
export declare function useGridApiOptionHandler<Api extends GridApiCommon, E extends GridEvents>(apiRef: RefObject<Api>, eventName: E, handler?: GridEventListener<E>): void;
|
|
22
22
|
export { GridSignature };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { RefObject } from '@mui/x-internals/types';
|
|
2
2
|
import { GridPrivateApiCommon } from '../../models/api/gridApiCommon';
|
|
3
3
|
type GetPublicApiType<PrivateApi> = PrivateApi extends {
|
|
4
4
|
getPublicApi: () => infer PublicApi;
|
|
5
5
|
} ? PublicApi : never;
|
|
6
|
-
export declare function useGridApiMethod<PrivateApi extends GridPrivateApiCommon, PublicApi extends GetPublicApiType<PrivateApi>, PrivateOnlyApi extends Omit<PrivateApi, keyof PublicApi>, V extends 'public' | 'private', T extends V extends 'public' ? Partial<PublicApi> : Partial<PrivateOnlyApi>>(privateApiRef:
|
|
6
|
+
export declare function useGridApiMethod<PrivateApi extends GridPrivateApiCommon, PublicApi extends GetPublicApiType<PrivateApi>, PrivateOnlyApi extends Omit<PrivateApi, keyof PublicApi>, V extends 'public' | 'private', T extends V extends 'public' ? Partial<PublicApi> : Partial<PrivateOnlyApi>>(privateApiRef: RefObject<PrivateApi>, apiMethods: T, visibility: V): void;
|
|
7
7
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { RefObject } from '@mui/x-internals/types';
|
|
2
2
|
import { GridApiCommon } from '../../models';
|
|
3
3
|
import { GridApiCommunity } from '../../models/api/gridApiCommunity';
|
|
4
4
|
/**
|
|
5
5
|
* Hook that instantiate a [[GridApiRef]].
|
|
6
6
|
*/
|
|
7
|
-
export declare const useGridApiRef: <Api extends GridApiCommon = GridApiCommunity>() =>
|
|
7
|
+
export declare const useGridApiRef: <Api extends GridApiCommon = GridApiCommunity>() => RefObject<Api>;
|
|
@@ -2,4 +2,6 @@ import * as React from 'react';
|
|
|
2
2
|
/**
|
|
3
3
|
* Hook that instantiate a [[GridApiRef]].
|
|
4
4
|
*/
|
|
5
|
-
export const useGridApiRef = () =>
|
|
5
|
+
export const useGridApiRef = () =>
|
|
6
|
+
// TODO v8: initialize with null (see https://github.com/mui/mui-x/issues/16135#issuecomment-2589395230 and https://github.com/mui/mui-x/issues/16000#issuecomment-2567820735)
|
|
7
|
+
React.useRef({});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { RefObject } from '@mui/x-internals/types';
|
|
2
2
|
import { GridPrivateApiCommon } from '../../models/api/gridApiCommon';
|
|
3
3
|
import { GridPrivateApiCommunity } from '../../models/api/gridApiCommunity';
|
|
4
4
|
import { DataGridProcessedProps } from '../../models/props/DataGridProps';
|
|
5
5
|
type DeepPartial<T> = {
|
|
6
6
|
[P in keyof T]?: DeepPartial<T[P]>;
|
|
7
7
|
};
|
|
8
|
-
export type GridStateInitializer<P extends Partial<DataGridProcessedProps> = DataGridProcessedProps, PrivateApi extends GridPrivateApiCommon = GridPrivateApiCommunity> = (state: DeepPartial<PrivateApi['state']>, props: P, privateApiRef:
|
|
9
|
-
export declare const useGridInitializeState: <P extends Partial<DataGridProcessedProps>, PrivateApi extends GridPrivateApiCommon = GridPrivateApiCommunity>(initializer: GridStateInitializer<P, PrivateApi>, privateApiRef:
|
|
8
|
+
export type GridStateInitializer<P extends Partial<DataGridProcessedProps> = DataGridProcessedProps, PrivateApi extends GridPrivateApiCommon = GridPrivateApiCommunity> = (state: DeepPartial<PrivateApi['state']>, props: P, privateApiRef: RefObject<PrivateApi>) => DeepPartial<PrivateApi['state']>;
|
|
9
|
+
export declare const useGridInitializeState: <P extends Partial<DataGridProcessedProps>, PrivateApi extends GridPrivateApiCommon = GridPrivateApiCommunity>(initializer: GridStateInitializer<P, PrivateApi>, privateApiRef: RefObject<PrivateApi>, props: P) => void;
|
|
10
10
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { RefObject } from '@mui/x-internals/types';
|
|
2
2
|
import { Logger } from '../../models/logger';
|
|
3
3
|
import { GridPrivateApiCommon } from '../../models/api/gridApiCommon';
|
|
4
|
-
export declare function useGridLogger<PrivateApi extends GridPrivateApiCommon>(privateApiRef:
|
|
4
|
+
export declare function useGridLogger<PrivateApi extends GridPrivateApiCommon>(privateApiRef: RefObject<PrivateApi>, name: string): Logger;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { RefObject } from '@mui/x-internals/types';
|
|
2
3
|
import { GridPrivateApiCommon } from '../../models/api/gridApiCommon';
|
|
3
|
-
export declare const useGridNativeEventListener: <PrivateApi extends GridPrivateApiCommon, K extends keyof HTMLElementEventMap>(apiRef:
|
|
4
|
+
export declare const useGridNativeEventListener: <PrivateApi extends GridPrivateApiCommon, K extends keyof HTMLElementEventMap>(apiRef: RefObject<PrivateApi>, ref: React.RefObject<HTMLDivElement | null> | (() => HTMLElement | undefined | null), eventName: K, handler?: (event: HTMLElementEventMap[K]) => any, options?: AddEventListenerOptions) => void;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { RefObject } from '@mui/x-internals/types';
|
|
2
3
|
import { GridPrivateApiCommon } from '../../models/api/gridApiCommon';
|
|
3
4
|
import { GridPrivateApiCommunity } from '../../models/api/gridApiCommunity';
|
|
4
5
|
export declare const GridPrivateApiContext: React.Context<unknown>;
|
|
5
|
-
export declare function useGridPrivateApiContext<PrivateApi extends GridPrivateApiCommon = GridPrivateApiCommunity>():
|
|
6
|
+
export declare function useGridPrivateApiContext<PrivateApi extends GridPrivateApiCommon = GridPrivateApiCommunity>(): RefObject<PrivateApi>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { RefObject } from '@mui/x-internals/types';
|
|
2
2
|
import { fastObjectShallowCompare } from '@mui/x-internals/fastObjectShallowCompare';
|
|
3
3
|
import type { GridApiCommon } from '../../models/api/gridApiCommon';
|
|
4
4
|
import type { OutputSelector, OutputSelectorV8 } from '../../utils/createSelector';
|
|
5
5
|
type Selector<Api extends GridApiCommon, Args, T> = ((state: Api['state']) => T) | OutputSelectorV8<Api['state'], Args, T>;
|
|
6
6
|
export declare const objectShallowCompare: typeof fastObjectShallowCompare;
|
|
7
7
|
export declare const argsEqual: (prev: any, curr: any) => boolean;
|
|
8
|
-
export declare const useGridSelector: <Api extends GridApiCommon, T>(apiRef:
|
|
9
|
-
export declare const useGridSelectorV8: <Api extends GridApiCommon, Args, T>(apiRef:
|
|
8
|
+
export declare const useGridSelector: <Api extends GridApiCommon, T>(apiRef: RefObject<Api>, selector: ((state: Api["state"]) => T) | OutputSelector<Api["state"], T>, equals?: (a: T, b: T) => boolean) => T;
|
|
9
|
+
export declare const useGridSelectorV8: <Api extends GridApiCommon, Args, T>(apiRef: RefObject<Api>, selector: Selector<Api, Args, T>, args?: Args, equals?: <U = T>(a: U, b: U) => boolean) => T;
|
|
10
10
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { RefObject } from '@mui/x-internals/types';
|
|
2
2
|
import { DataGridProcessedProps } from '../../models/props/DataGridProps';
|
|
3
3
|
import type { GridApiCommon } from '../../models';
|
|
4
|
-
export declare const getVisibleRows: <Api extends GridApiCommon>(apiRef:
|
|
4
|
+
export declare const getVisibleRows: <Api extends GridApiCommon>(apiRef: RefObject<Api>, props?: Pick<DataGridProcessedProps, "pagination" | "paginationMode">) => {
|
|
5
5
|
rows: import("../..").GridRowEntry<import("../..").GridValidRowModel>[];
|
|
6
6
|
range: {
|
|
7
7
|
firstRowIndex: number;
|
|
@@ -16,7 +16,7 @@ export declare const getVisibleRows: <Api extends GridApiCommon>(apiRef: React.R
|
|
|
16
16
|
* - If the row tree has several layers, it contains up to `state.pageSize` top level rows and all their descendants.
|
|
17
17
|
* - If the row tree is flat, it only contains up to `state.pageSize` rows.
|
|
18
18
|
*/
|
|
19
|
-
export declare const useGridVisibleRows: <Api extends GridApiCommon>(apiRef:
|
|
19
|
+
export declare const useGridVisibleRows: <Api extends GridApiCommon>(apiRef: RefObject<Api>, props?: Pick<DataGridProcessedProps, "pagination" | "paginationMode">) => {
|
|
20
20
|
rows: import("../..").GridRowEntry<import("../..").GridValidRowModel>[];
|
|
21
21
|
range: {
|
|
22
22
|
firstRowIndex: number;
|
package/index.js
CHANGED
package/locales/faIR.js
CHANGED
|
@@ -34,8 +34,7 @@ const faIRGrid = {
|
|
|
34
34
|
columnsManagementNoColumns: 'بدون سطر',
|
|
35
35
|
columnsManagementShowHideAllText: 'نمایش/مخفی کردن همه',
|
|
36
36
|
columnsManagementReset: 'بازنشانی',
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
columnsManagementDeleteIconLabel: 'پاک کردن',
|
|
39
38
|
// Filter panel text
|
|
40
39
|
filterPanelAddFilter: 'افزودن فیلتر',
|
|
41
40
|
filterPanelRemoveAll: 'حذف همه',
|
|
@@ -49,9 +48,9 @@ const faIRGrid = {
|
|
|
49
48
|
filterPanelInputPlaceholder: 'فیلتر مقدار',
|
|
50
49
|
// Filter operators text
|
|
51
50
|
filterOperatorContains: 'شامل',
|
|
52
|
-
|
|
51
|
+
filterOperatorDoesNotContain: 'شامل نمیشود',
|
|
53
52
|
filterOperatorEquals: 'مساوی',
|
|
54
|
-
|
|
53
|
+
filterOperatorDoesNotEqual: 'برابر نیست',
|
|
55
54
|
filterOperatorStartsWith: 'شروع با',
|
|
56
55
|
filterOperatorEndsWith: 'پایان با',
|
|
57
56
|
filterOperatorIs: 'هست',
|
|
@@ -71,9 +70,9 @@ const faIRGrid = {
|
|
|
71
70
|
'filterOperator<=': '<=',
|
|
72
71
|
// Header filter operators text
|
|
73
72
|
headerFilterOperatorContains: 'شامل',
|
|
74
|
-
|
|
73
|
+
headerFilterOperatorDoesNotContain: 'شامل نمیشود',
|
|
75
74
|
headerFilterOperatorEquals: 'مساوی',
|
|
76
|
-
|
|
75
|
+
headerFilterOperatorDoesNotEqual: 'برابر نیست',
|
|
77
76
|
headerFilterOperatorStartsWith: 'شروع با',
|
|
78
77
|
headerFilterOperatorEndsWith: 'پایان با',
|
|
79
78
|
headerFilterOperatorIs: 'هست',
|
|
@@ -7,7 +7,7 @@ import { GridEditingApi, GridEditingPrivateApi } from './gridEditingApi';
|
|
|
7
7
|
import type { GridFilterApi } from './gridFilterApi';
|
|
8
8
|
import { GridFocusApi, GridFocusPrivateApi } from './gridFocusApi';
|
|
9
9
|
import type { GridLocaleTextApi } from './gridLocaleTextApi';
|
|
10
|
-
import type { GridParamsApi } from './gridParamsApi';
|
|
10
|
+
import type { GridParamsApi, GridParamsPrivateApi } from './gridParamsApi';
|
|
11
11
|
import { GridPreferencesPanelApi } from './gridPreferencesPanelApi';
|
|
12
12
|
import { GridPrintExportApi } from './gridPrintExportApi';
|
|
13
13
|
import { GridRowApi, GridRowProPrivateApi } from './gridRowApi';
|
|
@@ -31,7 +31,7 @@ import type { DataGridProcessedProps } from '../props/DataGridProps';
|
|
|
31
31
|
import type { GridColumnResizeApi } from '../../hooks/features/columnResize';
|
|
32
32
|
export interface GridApiCommon<GridState extends GridStateCommunity = any, GridInitialState extends GridInitialStateCommunity = any> extends GridCoreApi, GridPipeProcessingApi, GridDensityApi, GridDimensionsApi, GridRowApi, GridRowsMetaApi, GridEditingApi, GridParamsApi, GridColumnApi, GridRowSelectionApi, GridSortApi, GridPaginationApi, GridCsvExportApi, GridFocusApi, GridFilterApi, GridColumnMenuApi, GridPreferencesPanelApi, GridPrintExportApi, GridVirtualizationApi, GridLocaleTextApi, GridScrollApi, GridColumnSpanningApi, GridStateApi<GridState>, GridStatePersistenceApi<GridInitialState>, GridColumnGroupingApi, GridHeaderFilteringApi, GridColumnResizeApi {
|
|
33
33
|
}
|
|
34
|
-
export interface GridPrivateOnlyApiCommon<Api extends GridApiCommon, PrivateApi extends GridPrivateApiCommon, Props extends DataGridProcessedProps> extends GridCorePrivateApi<Api, PrivateApi, Props>, GridStatePrivateApi<PrivateApi['state']>, GridPipeProcessingPrivateApi, GridStrategyProcessingApi, GridColumnSpanningPrivateApi, GridRowsMetaPrivateApi, GridDimensionsPrivateApi, GridEditingPrivateApi, GridLoggerApi, GridFocusPrivateApi, GridHeaderFilteringPrivateApi, GridVirtualizationPrivateApi, GridRowProPrivateApi {
|
|
34
|
+
export interface GridPrivateOnlyApiCommon<Api extends GridApiCommon, PrivateApi extends GridPrivateApiCommon, Props extends DataGridProcessedProps> extends GridCorePrivateApi<Api, PrivateApi, Props>, GridStatePrivateApi<PrivateApi['state']>, GridPipeProcessingPrivateApi, GridStrategyProcessingApi, GridColumnSpanningPrivateApi, GridRowsMetaPrivateApi, GridDimensionsPrivateApi, GridEditingPrivateApi, GridLoggerApi, GridFocusPrivateApi, GridHeaderFilteringPrivateApi, GridVirtualizationPrivateApi, GridRowProPrivateApi, GridParamsPrivateApi {
|
|
35
35
|
}
|
|
36
36
|
export interface GridPrivateApiCommon extends GridApiCommon, GridPrivateOnlyApiCommon<GridApiCommon, GridPrivateApiCommon, DataGridProcessedProps> {
|
|
37
37
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { GridColDef } from '../colDef';
|
|
2
|
+
import { GridStateColDef } from '../colDef/gridColDef';
|
|
3
|
+
import { GridCellMode } from '../gridCell';
|
|
2
4
|
import { GridValidRowModel, GridRowId, GridTreeNode, GridRowModel } from '../gridRows';
|
|
3
5
|
import { GridCellParams } from '../params/gridCellParams';
|
|
4
6
|
import { GridColumnHeaderParams } from '../params/gridColumnHeaderParams';
|
|
@@ -33,10 +35,10 @@ export interface GridParamsApi {
|
|
|
33
35
|
*/
|
|
34
36
|
getRowFormattedValue: <V extends any = any>(row: GridRowModel, colDef: GridColDef) => V;
|
|
35
37
|
/**
|
|
36
|
-
* Gets the
|
|
38
|
+
* Gets the [[GridCellParams]] object that is passed as argument in events.
|
|
37
39
|
* @param {GridRowId} id The id of the row.
|
|
38
40
|
* @param {string} field The column field.
|
|
39
|
-
* @returns {
|
|
41
|
+
* @returns {GridCellParams} The cell params.
|
|
40
42
|
*/
|
|
41
43
|
getCellElement: (id: GridRowId, field: string) => HTMLDivElement | null;
|
|
42
44
|
/**
|
|
@@ -72,3 +74,28 @@ export interface GridParamsApi {
|
|
|
72
74
|
*/
|
|
73
75
|
getColumnHeaderParams: (field: string) => GridColumnHeaderParams;
|
|
74
76
|
}
|
|
77
|
+
export interface GridParamsPrivateApi {
|
|
78
|
+
/**
|
|
79
|
+
* @typedef {Object} CellParamsOverrides
|
|
80
|
+
* @property {GridCellMode} cellMode - The mode of the cell.
|
|
81
|
+
* @property {GridStateColDef} colDef - The column definition.
|
|
82
|
+
* @property {boolean} hasFocus - Indicates if the cell is in focus.
|
|
83
|
+
* @property {GridTreeNode} rowNode - The node of the row that the current cell belongs to.
|
|
84
|
+
* @property {0|-1} tabIndex - The tabIndex value.
|
|
85
|
+
*/
|
|
86
|
+
/**
|
|
87
|
+
* Used internally to render the cell based on existing row data provided by the GridRow.
|
|
88
|
+
* @param {GridRowId} id The id of the row.
|
|
89
|
+
* @param {string} field The column field.
|
|
90
|
+
* @param {GridValidRowModel} row The row model.
|
|
91
|
+
* @param {CellParamsOverrides} cellParams The cell params.
|
|
92
|
+
* @returns {GridCellParams} The cell params.
|
|
93
|
+
*/
|
|
94
|
+
getCellParamsForRow: <R extends GridValidRowModel = any, V = unknown, F = V, N extends GridTreeNode = GridTreeNode>(id: GridRowId, field: string, row: R, { cellMode, colDef, hasFocus, rowNode, tabIndex, }: {
|
|
95
|
+
cellMode: GridCellMode;
|
|
96
|
+
colDef: GridStateColDef;
|
|
97
|
+
hasFocus: boolean;
|
|
98
|
+
rowNode: N;
|
|
99
|
+
tabIndex: 0 | -1;
|
|
100
|
+
}) => GridCellParams<R, V, F, N>;
|
|
101
|
+
}
|
package/models/api/index.d.ts
CHANGED
package/models/api/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { RefObject } from '@mui/x-internals/types';
|
|
2
3
|
import { GridCellClassNamePropType } from '../gridCellClass';
|
|
3
4
|
import { GridColumnHeaderClassNamePropType } from '../gridColumnHeaderClass';
|
|
4
5
|
import type { GridFilterOperator } from '../gridFilterOperator';
|
|
@@ -24,13 +25,13 @@ export type ValueOptions = string | number | {
|
|
|
24
25
|
* Value that can be used as a key for grouping rows
|
|
25
26
|
*/
|
|
26
27
|
export type GridKeyValue = string | number | boolean;
|
|
27
|
-
export type GridApplyQuickFilter<R extends GridValidRowModel = GridValidRowModel, V = any> = (value: V, row: R, column: GridColDef, apiRef:
|
|
28
|
-
export type GetApplyQuickFilterFn<R extends GridValidRowModel = GridValidRowModel, V = any> = (value: any, colDef: GridStateColDef<R, V>, apiRef:
|
|
29
|
-
export type GridValueGetter<R extends GridValidRowModel = GridValidRowModel, V = any, F = V, TValue = never> = (value: TValue, row: R, column: GridColDef<R, V, F>, apiRef:
|
|
30
|
-
export type GridValueFormatter<R extends GridValidRowModel = GridValidRowModel, V = any, F = V, TValue = never> = (value: TValue, row: R, column: GridColDef<R, V, F>, apiRef:
|
|
31
|
-
export type GridValueSetter<R extends GridValidRowModel = GridValidRowModel, V = any, F = V> = (value: V, row: R, column: GridColDef<R, V, F>, apiRef:
|
|
32
|
-
export type GridValueParser<R extends GridValidRowModel = GridValidRowModel, V = any, F = V> = (value: F | undefined, row: R | undefined, column: GridColDef<R, V, F>, apiRef:
|
|
33
|
-
export type GridColSpanFn<R extends GridValidRowModel = GridValidRowModel, V = any, F = V> = (value: V, row: R, column: GridColDef<R, V, F>, apiRef:
|
|
28
|
+
export type GridApplyQuickFilter<R extends GridValidRowModel = GridValidRowModel, V = any> = (value: V, row: R, column: GridColDef, apiRef: RefObject<GridApiCommunity>) => boolean;
|
|
29
|
+
export type GetApplyQuickFilterFn<R extends GridValidRowModel = GridValidRowModel, V = any> = (value: any, colDef: GridStateColDef<R, V>, apiRef: RefObject<GridApiCommunity>) => null | GridApplyQuickFilter<R, V>;
|
|
30
|
+
export type GridValueGetter<R extends GridValidRowModel = GridValidRowModel, V = any, F = V, TValue = never> = (value: TValue, row: R, column: GridColDef<R, V, F>, apiRef: RefObject<GridApiCommunity>) => V;
|
|
31
|
+
export type GridValueFormatter<R extends GridValidRowModel = GridValidRowModel, V = any, F = V, TValue = never> = (value: TValue, row: R, column: GridColDef<R, V, F>, apiRef: RefObject<GridApiCommunity>) => F;
|
|
32
|
+
export type GridValueSetter<R extends GridValidRowModel = GridValidRowModel, V = any, F = V> = (value: V, row: R, column: GridColDef<R, V, F>, apiRef: RefObject<GridApiCommunity>) => R;
|
|
33
|
+
export type GridValueParser<R extends GridValidRowModel = GridValidRowModel, V = any, F = V> = (value: F | undefined, row: R | undefined, column: GridColDef<R, V, F>, apiRef: RefObject<GridApiCommunity>) => V;
|
|
34
|
+
export type GridColSpanFn<R extends GridValidRowModel = GridValidRowModel, V = any, F = V> = (value: V, row: R, column: GridColDef<R, V, F>, apiRef: RefObject<GridApiCommunity>) => number | undefined;
|
|
34
35
|
/**
|
|
35
36
|
* Column Definition base interface.
|
|
36
37
|
*/
|
|
@@ -217,7 +218,7 @@ export interface GridBaseColDef<R extends GridValidRowModel = GridValidRowModel,
|
|
|
217
218
|
* This function can return `null` to skip filtering for this value and column.
|
|
218
219
|
* @param {any} value The value with which we want to filter the column.
|
|
219
220
|
* @param {GridStateColDef} colDef The column from which we want to filter the rows.
|
|
220
|
-
* @param {
|
|
221
|
+
* @param {RefObject<GridApiCommunity>} apiRef Deprecated: The API of the grid.
|
|
221
222
|
* @returns {null | GridApplyQuickFilter} The function to call to check if a row pass this filter value or not.
|
|
222
223
|
*/
|
|
223
224
|
getApplyQuickFilterFn?: GetApplyQuickFilterFn<R, V>;
|
package/models/gridExport.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { RefObject } from '@mui/x-internals/types';
|
|
2
2
|
import { GridRowId } from './gridRows';
|
|
3
3
|
import type { GridApiCommon } from './api';
|
|
4
4
|
import type { GridApiCommunity } from './api/gridApiCommunity';
|
|
@@ -49,7 +49,7 @@ export interface GridGetRowsToExportParams<Api extends GridApiCommon = GridApiCo
|
|
|
49
49
|
/**
|
|
50
50
|
* The API of the grid.
|
|
51
51
|
*/
|
|
52
|
-
apiRef:
|
|
52
|
+
apiRef: RefObject<Api>;
|
|
53
53
|
}
|
|
54
54
|
export interface GridCsvGetRowsToExportParams<Api extends GridApiCommon = GridApiCommunity> extends GridGetRowsToExportParams<Api> {
|
|
55
55
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { RefObject } from '@mui/x-internals/types';
|
|
2
3
|
import { GridFilterItem } from './gridFilterItem';
|
|
3
4
|
import type { GridColDef } from './colDef/gridColDef';
|
|
4
5
|
import type { GridValidRowModel } from './gridRows';
|
|
5
6
|
import type { GridApiCommunity } from './api/gridApiCommunity';
|
|
6
|
-
type ApplyFilterFn<R extends GridValidRowModel = any, V = any, F = V> = (value: V, row: R, column: GridColDef<R, V, F>, apiRef:
|
|
7
|
+
type ApplyFilterFn<R extends GridValidRowModel = any, V = any, F = V> = (value: V, row: R, column: GridColDef<R, V, F>, apiRef: RefObject<GridApiCommunity>) => boolean;
|
|
7
8
|
export type GetApplyFilterFn<R extends GridValidRowModel = any, V = any, F = V> = (filterItem: GridFilterItem, column: GridColDef<R, V, F>) => null | ApplyFilterFn<R, V, F>;
|
|
8
9
|
/**
|
|
9
10
|
* Filter operator definition interface.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { RefObject } from '@mui/x-internals/types';
|
|
2
3
|
import { SxProps } from '@mui/system';
|
|
3
4
|
import { Theme } from '@mui/material/styles';
|
|
4
5
|
import { CommonProps } from '@mui/material/OverridableComponent';
|
|
@@ -386,7 +387,7 @@ export interface DataGridPropsWithoutDefaultValue<R extends GridValidRowModel =
|
|
|
386
387
|
/**
|
|
387
388
|
* The ref object that allows Data Grid manipulation. Can be instantiated with `useGridApiRef()`.
|
|
388
389
|
*/
|
|
389
|
-
apiRef?:
|
|
390
|
+
apiRef?: RefObject<GridApiCommunity>;
|
|
390
391
|
/**
|
|
391
392
|
* Forwarded props for the Data Grid root element.
|
|
392
393
|
* @ignore - do not document.
|
|
@@ -18,17 +18,11 @@ const configuration = {
|
|
|
18
18
|
useGridRowAriaAttributes
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
|
-
let propValidators;
|
|
22
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
23
|
-
propValidators = [...propValidatorsDataGrid,
|
|
24
|
-
// Only validate in MIT version
|
|
25
|
-
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];
|
|
26
|
-
}
|
|
27
21
|
const DataGridRaw = forwardRef(function DataGrid(inProps, ref) {
|
|
28
22
|
const props = useDataGridProps(inProps);
|
|
29
23
|
const privateApiRef = useDataGridComponent(props.apiRef, props);
|
|
30
24
|
if (process.env.NODE_ENV !== 'production') {
|
|
31
|
-
validateProps(props,
|
|
25
|
+
validateProps(props, propValidatorsDataGrid);
|
|
32
26
|
}
|
|
33
27
|
return /*#__PURE__*/_jsx(GridContextProvider, {
|
|
34
28
|
privateApiRef: privateApiRef,
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["selected", "rowId", "row", "index", "style", "rowHeight", "className", "visibleColumns", "pinnedColumns", "
|
|
3
|
+
const _excluded = ["selected", "rowId", "row", "index", "style", "rowHeight", "className", "visibleColumns", "pinnedColumns", "offsetLeft", "columnsTotalWidth", "firstColumnIndex", "lastColumnIndex", "focusedColumnIndex", "isFirstVisible", "isLastVisible", "isNotVisible", "showBottomBorder", "scrollbarWidth", "gridHasFiller", "onClick", "onDoubleClick", "onMouseEnter", "onMouseLeave", "onMouseOut", "onMouseOver"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import clsx from 'clsx';
|
|
7
7
|
import { unstable_useForkRef as useForkRef } from '@mui/utils';
|
|
8
8
|
import { fastMemo } from '@mui/x-internals/fastMemo';
|
|
9
9
|
import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
10
|
-
import {
|
|
10
|
+
import { isObjectEmpty } from '@mui/x-internals/isObjectEmpty';
|
|
11
|
+
import { GridEditModes, GridCellModes } from "../models/gridEditRowModel.js";
|
|
11
12
|
import { gridClasses } from "../constants/gridClasses.js";
|
|
12
13
|
import { composeGridClasses } from "../utils/composeGridClasses.js";
|
|
13
14
|
import { useGridRootProps } from "../hooks/utils/useGridRootProps.js";
|
|
14
15
|
import { shouldCellShowLeftBorder, shouldCellShowRightBorder } from "../utils/cellBorderUtils.js";
|
|
15
16
|
import { gridColumnPositionsSelector } from "../hooks/features/columns/gridColumnsSelector.js";
|
|
16
|
-
import { useGridSelector, objectShallowCompare } from "../hooks/utils/useGridSelector.js";
|
|
17
|
+
import { useGridSelector, objectShallowCompare, useGridSelectorV8 } from "../hooks/utils/useGridSelector.js";
|
|
17
18
|
import { useGridVisibleRows } from "../hooks/utils/useGridVisibleRows.js";
|
|
18
19
|
import { findParentElementFromClassName, isEventTargetInPortal } from "../utils/domUtils.js";
|
|
19
20
|
import { GRID_CHECKBOX_SELECTION_COL_DEF } from "../colDef/gridCheckboxSelectionColDef.js";
|
|
@@ -21,12 +22,20 @@ import { GRID_ACTIONS_COLUMN_TYPE } from "../colDef/gridActionsColDef.js";
|
|
|
21
22
|
import { GRID_DETAIL_PANEL_TOGGLE_FIELD, PinnedColumnPosition } from "../internals/constants.js";
|
|
22
23
|
import { gridSortModelSelector } from "../hooks/features/sorting/gridSortingSelector.js";
|
|
23
24
|
import { gridRowMaximumTreeDepthSelector } from "../hooks/features/rows/gridRowsSelector.js";
|
|
24
|
-
import { gridEditRowsStateSelector } from "../hooks/features/editing/gridEditingSelectors.js";
|
|
25
|
+
import { gridEditRowsStateSelector, gridRowIsEditingSelector } from "../hooks/features/editing/gridEditingSelectors.js";
|
|
25
26
|
import { GridScrollbarFillerCell as ScrollbarFiller } from "./GridScrollbarFillerCell.js";
|
|
26
27
|
import { getPinnedCellOffset } from "../internals/utils/getPinnedCellOffset.js";
|
|
27
28
|
import { useGridConfiguration } from "../hooks/utils/useGridConfiguration.js";
|
|
28
29
|
import { useGridPrivateApiContext } from "../hooks/utils/useGridPrivateApiContext.js";
|
|
30
|
+
import { createSelectorV8 } from "../utils/createSelector.js";
|
|
29
31
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
32
|
+
const isRowReorderingEnabledSelector = createSelectorV8(gridEditRowsStateSelector, (editRows, rowReordering) => {
|
|
33
|
+
if (!rowReordering) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
const isEditingRows = !isObjectEmpty(editRows);
|
|
37
|
+
return !isEditingRows;
|
|
38
|
+
});
|
|
30
39
|
const GridRow = forwardRef(function GridRow(props, refProp) {
|
|
31
40
|
const {
|
|
32
41
|
selected,
|
|
@@ -65,10 +74,11 @@ const GridRow = forwardRef(function GridRow(props, refProp) {
|
|
|
65
74
|
const sortModel = useGridSelector(apiRef, gridSortModelSelector);
|
|
66
75
|
const treeDepth = useGridSelector(apiRef, gridRowMaximumTreeDepthSelector);
|
|
67
76
|
const columnPositions = useGridSelector(apiRef, gridColumnPositionsSelector);
|
|
68
|
-
const
|
|
77
|
+
const rowReordering = rootProps.rowReordering;
|
|
78
|
+
const isRowReorderingEnabled = useGridSelectorV8(apiRef, isRowReorderingEnabledSelector, rowReordering);
|
|
69
79
|
const handleRef = useForkRef(ref, refProp);
|
|
70
80
|
const rowNode = apiRef.current.getRowNode(rowId);
|
|
71
|
-
const editing = apiRef
|
|
81
|
+
const editing = useGridSelectorV8(apiRef, gridRowIsEditingSelector, rowId);
|
|
72
82
|
const editable = rootProps.editMode === GridEditModes.Row;
|
|
73
83
|
const hasFocusCell = focusedColumnIndex !== undefined;
|
|
74
84
|
const hasVirtualFocusCellLeft = hasFocusCell && focusedColumnIndex >= pinnedColumns.left.length && focusedColumnIndex < firstColumnIndex;
|
|
@@ -145,7 +155,6 @@ const GridRow = forwardRef(function GridRow(props, refProp) {
|
|
|
145
155
|
slotProps,
|
|
146
156
|
disableColumnReorder
|
|
147
157
|
} = rootProps;
|
|
148
|
-
const rowReordering = rootProps.rowReordering;
|
|
149
158
|
const heightEntry = useGridSelector(apiRef, () => _extends({}, apiRef.current.getRowHeightEntry(rowId)), objectShallowCompare);
|
|
150
159
|
const style = React.useMemo(() => {
|
|
151
160
|
if (isNotVisible) {
|
|
@@ -188,6 +197,11 @@ const GridRow = forwardRef(function GridRow(props, refProp) {
|
|
|
188
197
|
});
|
|
189
198
|
rowClassNames.push(rootProps.getRowClassName(rowParams));
|
|
190
199
|
}
|
|
200
|
+
|
|
201
|
+
/* Start of rendering */
|
|
202
|
+
if (!rowNode) {
|
|
203
|
+
return null;
|
|
204
|
+
}
|
|
191
205
|
const getCell = (column, indexInSection, indexRelativeToAllColumns, sectionLength, pinnedPosition = PinnedColumnPosition.NONE) => {
|
|
192
206
|
const cellColSpanInfo = apiRef.current.unstable_getCellColSpanInfo(rowId, indexRelativeToAllColumns);
|
|
193
207
|
if (cellColSpanInfo?.spannedByColSpan) {
|
|
@@ -205,14 +219,12 @@ const GridRow = forwardRef(function GridRow(props, refProp) {
|
|
|
205
219
|
align: column.align
|
|
206
220
|
}, column.field);
|
|
207
221
|
}
|
|
208
|
-
const editCellState = editRowsState[rowId]?.[column.field] ?? null;
|
|
209
222
|
|
|
210
223
|
// when the cell is a reorder cell we are not allowing to reorder the col
|
|
211
224
|
// fixes https://github.com/mui/mui-x/issues/11126
|
|
212
225
|
const isReorderCell = column.field === '__reorder__';
|
|
213
|
-
const isEditingRows = Object.keys(editRowsState).length > 0;
|
|
214
226
|
const canReorderColumn = !(disableColumnReorder || column.disableReorder);
|
|
215
|
-
const canReorderRow =
|
|
227
|
+
const canReorderRow = isRowReorderingEnabled && !sortModel.length && treeDepth <= 1;
|
|
216
228
|
const disableDragEvents = !(canReorderColumn || isReorderCell && canReorderRow);
|
|
217
229
|
const cellIsNotVisible = pinnedPosition === PinnedColumnPosition.VIRTUAL;
|
|
218
230
|
const showLeftBorder = shouldCellShowLeftBorder(pinnedPosition, indexInSection);
|
|
@@ -225,20 +237,15 @@ const GridRow = forwardRef(function GridRow(props, refProp) {
|
|
|
225
237
|
colIndex: indexRelativeToAllColumns,
|
|
226
238
|
colSpan: colSpan,
|
|
227
239
|
disableDragEvents: disableDragEvents,
|
|
228
|
-
editCellState: editCellState,
|
|
229
240
|
isNotVisible: cellIsNotVisible,
|
|
230
241
|
pinnedOffset: pinnedOffset,
|
|
231
242
|
pinnedPosition: pinnedPosition,
|
|
232
243
|
showLeftBorder: showLeftBorder,
|
|
233
|
-
showRightBorder: showRightBorder
|
|
244
|
+
showRightBorder: showRightBorder,
|
|
245
|
+
row: row,
|
|
246
|
+
rowNode: rowNode
|
|
234
247
|
}, slotProps?.cell), column.field);
|
|
235
248
|
};
|
|
236
|
-
|
|
237
|
-
/* Start of rendering */
|
|
238
|
-
|
|
239
|
-
if (!rowNode) {
|
|
240
|
-
return null;
|
|
241
|
-
}
|
|
242
249
|
const leftCells = pinnedColumns.left.map((column, i) => {
|
|
243
250
|
const indexRelativeToAllColumns = i;
|
|
244
251
|
return getCell(column, i, indexRelativeToAllColumns, pinnedColumns.left.length, PinnedColumnPosition.LEFT);
|
|
@@ -316,7 +323,6 @@ process.env.NODE_ENV !== "production" ? GridRow.propTypes = {
|
|
|
316
323
|
isNotVisible: PropTypes.bool.isRequired,
|
|
317
324
|
lastColumnIndex: PropTypes.number.isRequired,
|
|
318
325
|
offsetLeft: PropTypes.number.isRequired,
|
|
319
|
-
offsetTop: PropTypes.number,
|
|
320
326
|
onClick: PropTypes.func,
|
|
321
327
|
onDoubleClick: PropTypes.func,
|
|
322
328
|
onMouseEnter: PropTypes.func,
|