@mui/x-data-grid 8.0.0-alpha.6 → 8.0.0-alpha.7
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 +127 -1
- package/DataGrid/useDataGridComponent.d.ts +1 -1
- package/components/cell/GridActionsCellItem.d.ts +16 -9
- package/components/cell/GridActionsCellItem.js +2 -0
- package/components/cell/GridEditDateCell.js +1 -1
- package/components/cell/GridEditInputCell.js +1 -1
- package/components/cell/GridEditSingleSelectCell.js +2 -2
- package/components/columnHeaders/ColumnHeaderMenuIcon.d.ts +1 -1
- package/components/columnHeaders/GridColumnHeaderFilterIconButton.js +0 -1
- package/components/columnSelection/GridCellCheckboxRenderer.js +2 -1
- package/components/columnSelection/GridHeaderCheckbox.js +6 -2
- package/components/columnsManagement/GridColumnsManagement.js +2 -2
- package/components/panel/GridPanel.d.ts +1 -1
- package/components/panel/filterPanel/GridFilterInputValue.js +7 -10
- package/components/toolbar/GridToolbarQuickFilter.js +2 -2
- package/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +9 -2
- package/hooks/core/pipeProcessing/useGridPipeProcessing.d.ts +1 -1
- package/hooks/core/pipeProcessing/useGridRegisterPipeApplier.d.ts +1 -1
- package/hooks/core/pipeProcessing/useGridRegisterPipeApplier.js +1 -1
- package/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.d.ts +1 -1
- package/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.js +1 -1
- package/hooks/core/strategyProcessing/useGridRegisterStrategyProcessor.d.ts +1 -1
- package/hooks/core/strategyProcessing/useGridStrategyProcessing.d.ts +1 -1
- package/hooks/core/useGridApiInitialization.d.ts +1 -1
- package/hooks/core/useGridApiInitialization.js +2 -2
- package/hooks/core/useGridInitialization.d.ts +1 -1
- package/hooks/core/useGridIsRtl.d.ts +1 -1
- package/hooks/core/useGridLocaleText.d.ts +1 -1
- package/hooks/core/useGridLoggerFactory.d.ts +1 -1
- package/hooks/core/useGridRefs.d.ts +1 -1
- package/hooks/core/useGridStateInitialization.d.ts +1 -1
- package/hooks/features/columnResize/useGridColumnResize.d.ts +1 -1
- package/hooks/features/columnResize/useGridColumnResize.js +4 -4
- package/hooks/features/editing/useGridRowEditing.js +1 -1
- package/hooks/features/export/useGridPrintExport.js +1 -1
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +1 -1
- package/hooks/features/preferencesPanel/useGridPreferencesPanel.js +2 -2
- package/hooks/features/rowSelection/useGridRowSelectionPreProcessors.d.ts +1 -1
- package/hooks/features/rows/useGridRowsPreProcessors.d.ts +1 -1
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +3 -3
- package/hooks/features/virtualization/useGridVirtualScroller.js +5 -1
- package/hooks/utils/useGridApiEventHandler.js +1 -1
- package/hooks/utils/useGridApiMethod.d.ts +1 -1
- package/hooks/utils/useGridApiRef.d.ts +1 -1
- package/hooks/utils/useGridInitializeState.d.ts +2 -2
- package/hooks/utils/useGridLogger.d.ts +1 -1
- package/hooks/utils/useGridVisibleRows.d.ts +2 -2
- package/index.js +1 -1
- package/internals/index.d.ts +1 -1
- package/models/api/gridCoreApi.d.ts +7 -7
- package/models/api/gridDensityApi.d.ts +1 -1
- package/models/gridBaseSlots.d.ts +32 -2
- package/models/gridSlotsComponentsProps.d.ts +12 -8
- package/models/props/DataGridProps.d.ts +1 -1
- package/modern/components/cell/GridActionsCellItem.js +2 -0
- package/modern/components/cell/GridEditDateCell.js +1 -1
- package/modern/components/cell/GridEditInputCell.js +1 -1
- package/modern/components/cell/GridEditSingleSelectCell.js +2 -2
- package/modern/components/columnHeaders/GridColumnHeaderFilterIconButton.js +0 -1
- package/modern/components/columnSelection/GridCellCheckboxRenderer.js +2 -1
- package/modern/components/columnSelection/GridHeaderCheckbox.js +6 -2
- package/modern/components/columnsManagement/GridColumnsManagement.js +2 -2
- package/modern/components/panel/filterPanel/GridFilterInputValue.js +7 -10
- package/modern/components/toolbar/GridToolbarQuickFilter.js +2 -2
- package/modern/hooks/core/pipeProcessing/useGridRegisterPipeApplier.js +1 -1
- package/modern/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.js +1 -1
- package/modern/hooks/core/useGridApiInitialization.js +2 -2
- package/modern/hooks/features/columnResize/useGridColumnResize.js +4 -4
- package/modern/hooks/features/editing/useGridRowEditing.js +1 -1
- package/modern/hooks/features/export/useGridPrintExport.js +1 -1
- package/modern/hooks/features/preferencesPanel/useGridPreferencesPanel.js +2 -2
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +5 -1
- package/modern/hooks/utils/useGridApiEventHandler.js +1 -1
- package/modern/index.js +1 -1
- package/node/components/cell/GridActionsCellItem.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 +2 -2
- package/node/components/columnHeaders/GridColumnHeaderFilterIconButton.js +0 -1
- package/node/components/columnSelection/GridCellCheckboxRenderer.js +2 -1
- package/node/components/columnSelection/GridHeaderCheckbox.js +6 -2
- package/node/components/columnsManagement/GridColumnsManagement.js +2 -2
- package/node/components/panel/filterPanel/GridFilterInputValue.js +7 -10
- package/node/components/toolbar/GridToolbarQuickFilter.js +2 -2
- package/node/hooks/core/pipeProcessing/useGridRegisterPipeApplier.js +1 -1
- package/node/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.js +1 -1
- package/node/hooks/core/useGridApiInitialization.js +2 -2
- package/node/hooks/features/columnResize/useGridColumnResize.js +4 -4
- package/node/hooks/features/editing/useGridRowEditing.js +1 -1
- package/node/hooks/features/export/useGridPrintExport.js +1 -1
- package/node/hooks/features/preferencesPanel/useGridPreferencesPanel.js +2 -2
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +5 -1
- package/node/hooks/utils/useGridApiEventHandler.js +1 -1
- package/node/index.js +1 -1
- package/package.json +2 -2
|
@@ -21,7 +21,7 @@ export const useGridRowEditing = (apiRef, props) => {
|
|
|
21
21
|
const [rowModesModel, setRowModesModel] = React.useState({});
|
|
22
22
|
const rowModesModelRef = React.useRef(rowModesModel);
|
|
23
23
|
const prevRowModesModel = React.useRef({});
|
|
24
|
-
const focusTimeout = React.useRef();
|
|
24
|
+
const focusTimeout = React.useRef(undefined);
|
|
25
25
|
const nextFocusedCell = React.useRef(null);
|
|
26
26
|
const {
|
|
27
27
|
processRowUpdate,
|
|
@@ -44,7 +44,7 @@ export const useGridPrintExport = (apiRef, props) => {
|
|
|
44
44
|
const previousGridState = React.useRef(null);
|
|
45
45
|
const previousColumnVisibility = React.useRef({});
|
|
46
46
|
const previousRows = React.useRef([]);
|
|
47
|
-
const previousVirtualizationState = React.useRef();
|
|
47
|
+
const previousVirtualizationState = React.useRef(null);
|
|
48
48
|
React.useEffect(() => {
|
|
49
49
|
doc.current = ownerDocument(apiRef.current.rootElementRef.current);
|
|
50
50
|
}, [apiRef, hasRootReference]);
|
|
@@ -10,4 +10,4 @@ import { DataGridProcessedProps } from '../../../models/props/DataGridProps';
|
|
|
10
10
|
* @requires useGridScroll (method) - can be after
|
|
11
11
|
* @requires useGridColumnSpanning (method) - can be after
|
|
12
12
|
*/
|
|
13
|
-
export declare const useGridKeyboardNavigation: (apiRef: React.
|
|
13
|
+
export declare const useGridKeyboardNavigation: (apiRef: React.RefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "pagination" | "paginationMode" | "getRowId" | "experimentalFeatures" | "signature" | "headerFilters" | "unstable_listView">) => void;
|
|
@@ -15,8 +15,8 @@ export const preferencePanelStateInitializer = (state, props) => _extends({}, st
|
|
|
15
15
|
*/
|
|
16
16
|
export const useGridPreferencesPanel = (apiRef, props) => {
|
|
17
17
|
const logger = useGridLogger(apiRef, 'useGridPreferencesPanel');
|
|
18
|
-
const hideTimeout = React.useRef();
|
|
19
|
-
const immediateTimeout = React.useRef();
|
|
18
|
+
const hideTimeout = React.useRef(undefined);
|
|
19
|
+
const immediateTimeout = React.useRef(undefined);
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* API METHODS
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { DataGridProcessedProps } from '../../../models/props/DataGridProps';
|
|
3
3
|
import { GridPrivateApiCommunity } from '../../../models/api/gridApiCommunity';
|
|
4
|
-
export declare const useGridRowSelectionPreProcessors: (apiRef: React.
|
|
4
|
+
export declare const useGridRowSelectionPreProcessors: (apiRef: React.RefObject<GridPrivateApiCommunity>, props: DataGridProcessedProps) => void;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { GridPrivateApiCommunity } from '../../../models/api/gridApiCommunity';
|
|
3
|
-
export declare const useGridRowsPreProcessors: (apiRef: React.
|
|
3
|
+
export declare const useGridRowsPreProcessors: (apiRef: React.RefObject<GridPrivateApiCommunity>) => void;
|
|
@@ -15,7 +15,7 @@ export declare const useGridVirtualScroller: () => {
|
|
|
15
15
|
ref: (node: HTMLDivElement | null) => (() => void) | undefined;
|
|
16
16
|
};
|
|
17
17
|
getScrollerProps: () => {
|
|
18
|
-
ref: React.RefObject<HTMLDivElement>;
|
|
18
|
+
ref: React.RefObject<HTMLDivElement | null>;
|
|
19
19
|
onScroll: (event: React.UIEvent) => void;
|
|
20
20
|
onWheel: (event: React.WheelEvent) => void;
|
|
21
21
|
onTouchMove: (event: React.TouchEvent) => void;
|
|
@@ -31,11 +31,11 @@ export declare const useGridVirtualScroller: () => {
|
|
|
31
31
|
role: string;
|
|
32
32
|
};
|
|
33
33
|
getScrollbarVerticalProps: () => {
|
|
34
|
-
ref: React.RefObject<HTMLDivElement>;
|
|
34
|
+
ref: React.RefObject<HTMLDivElement | null>;
|
|
35
35
|
role: string;
|
|
36
36
|
};
|
|
37
37
|
getScrollbarHorizontalProps: () => {
|
|
38
|
-
ref: React.RefObject<HTMLDivElement>;
|
|
38
|
+
ref: React.RefObject<HTMLDivElement | null>;
|
|
39
39
|
role: string;
|
|
40
40
|
};
|
|
41
41
|
};
|
|
@@ -86,6 +86,7 @@ export const useGridVirtualScroller = () => {
|
|
|
86
86
|
const contentHeight = dimensions.contentSize.height;
|
|
87
87
|
const columnsTotalWidth = dimensions.columnsTotalWidth;
|
|
88
88
|
const hasColSpan = useGridSelector(apiRef, gridHasColSpanSelector);
|
|
89
|
+
const previousSize = React.useRef(null);
|
|
89
90
|
const mainRefCallback = React.useCallback(node => {
|
|
90
91
|
mainRef.current = node;
|
|
91
92
|
if (!node) {
|
|
@@ -93,7 +94,10 @@ export const useGridVirtualScroller = () => {
|
|
|
93
94
|
}
|
|
94
95
|
const initialRect = node.getBoundingClientRect();
|
|
95
96
|
let lastSize = roundDimensions(initialRect);
|
|
96
|
-
|
|
97
|
+
if (!previousSize.current || lastSize.width !== previousSize.current.width && lastSize.height !== previousSize.current.height) {
|
|
98
|
+
previousSize.current = lastSize;
|
|
99
|
+
apiRef.current.publishEvent('resize', lastSize);
|
|
100
|
+
}
|
|
97
101
|
if (typeof ResizeObserver === 'undefined') {
|
|
98
102
|
return undefined;
|
|
99
103
|
}
|
|
@@ -24,7 +24,7 @@ export function createUseGridApiEventHandler(registryContainer) {
|
|
|
24
24
|
}
|
|
25
25
|
const [objectRetainedByReact] = React.useState(new ObjectToBeRetainedByReact());
|
|
26
26
|
const subscription = React.useRef(null);
|
|
27
|
-
const handlerRef = React.useRef();
|
|
27
|
+
const handlerRef = React.useRef(null);
|
|
28
28
|
handlerRef.current = handler;
|
|
29
29
|
const cleanupTokenRef = React.useRef(null);
|
|
30
30
|
if (!subscription.current && handlerRef.current) {
|
|
@@ -3,5 +3,5 @@ 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: React.
|
|
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: React.RefObject<PrivateApi>, apiMethods: T, visibility: V): void;
|
|
7
7
|
export {};
|
|
@@ -4,4 +4,4 @@ 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>() => React.
|
|
7
|
+
export declare const useGridApiRef: <Api extends GridApiCommon = GridApiCommunity>() => React.RefObject<Api>;
|
|
@@ -5,6 +5,6 @@ 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: React.
|
|
9
|
-
export declare const useGridInitializeState: <P extends Partial<DataGridProcessedProps>, PrivateApi extends GridPrivateApiCommon = GridPrivateApiCommunity>(initializer: GridStateInitializer<P, PrivateApi>, privateApiRef: React.
|
|
8
|
+
export type GridStateInitializer<P extends Partial<DataGridProcessedProps> = DataGridProcessedProps, PrivateApi extends GridPrivateApiCommon = GridPrivateApiCommunity> = (state: DeepPartial<PrivateApi['state']>, props: P, privateApiRef: React.RefObject<PrivateApi>) => DeepPartial<PrivateApi['state']>;
|
|
9
|
+
export declare const useGridInitializeState: <P extends Partial<DataGridProcessedProps>, PrivateApi extends GridPrivateApiCommon = GridPrivateApiCommunity>(initializer: GridStateInitializer<P, PrivateApi>, privateApiRef: React.RefObject<PrivateApi>, props: P) => void;
|
|
10
10
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { Logger } from '../../models/logger';
|
|
3
3
|
import { GridPrivateApiCommon } from '../../models/api/gridApiCommon';
|
|
4
|
-
export declare function useGridLogger<PrivateApi extends GridPrivateApiCommon>(privateApiRef: React.
|
|
4
|
+
export declare function useGridLogger<PrivateApi extends GridPrivateApiCommon>(privateApiRef: React.RefObject<PrivateApi>, name: string): Logger;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { DataGridProcessedProps } from '../../models/props/DataGridProps';
|
|
3
3
|
import type { GridApiCommon, GridRowEntry } from '../../models';
|
|
4
|
-
export declare const getVisibleRows: <Api extends GridApiCommon>(apiRef: React.
|
|
4
|
+
export declare const getVisibleRows: <Api extends GridApiCommon>(apiRef: React.RefObject<Api>, props: Pick<DataGridProcessedProps, "pagination" | "paginationMode">) => {
|
|
5
5
|
rows: GridRowEntry<import("../..").GridValidRowModel>[];
|
|
6
6
|
range: {
|
|
7
7
|
firstRowIndex: number;
|
|
@@ -15,7 +15,7 @@ export declare const getVisibleRows: <Api extends GridApiCommon>(apiRef: React.M
|
|
|
15
15
|
* - If the row tree has several layers, it contains up to `state.pageSize` top level rows and all their descendants.
|
|
16
16
|
* - If the row tree is flat, it only contains up to `state.pageSize` rows.
|
|
17
17
|
*/
|
|
18
|
-
export declare const useGridVisibleRows: <Api extends GridApiCommon>(apiRef: React.
|
|
18
|
+
export declare const useGridVisibleRows: <Api extends GridApiCommon>(apiRef: React.RefObject<Api>, props: Pick<DataGridProcessedProps, "pagination" | "paginationMode">) => {
|
|
19
19
|
rows: GridRowEntry<import("../..").GridValidRowModel>[];
|
|
20
20
|
range: {
|
|
21
21
|
firstRowIndex: number;
|
package/index.js
CHANGED
package/internals/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export { getValueOptions } from '../components/panel/filterPanel/filterPanelUtil
|
|
|
12
12
|
export { useGridRegisterPipeProcessor } from '../hooks/core/pipeProcessing';
|
|
13
13
|
export type { GridPipeProcessor } from '../hooks/core/pipeProcessing';
|
|
14
14
|
export { GridStrategyGroup, useGridRegisterStrategyProcessor, GRID_DEFAULT_STRATEGY, } from '../hooks/core/strategyProcessing';
|
|
15
|
-
export type { GridStrategyProcessor } from '../hooks/core/strategyProcessing';
|
|
15
|
+
export type { GridStrategyProcessor, GridStrategyProcessorName, } from '../hooks/core/strategyProcessing';
|
|
16
16
|
export { useGridInitialization } from '../hooks/core/useGridInitialization';
|
|
17
17
|
export { unwrapPrivateAPI } from '../hooks/core/useGridApiInitialization';
|
|
18
18
|
export { useGridClipboard } from '../hooks/features/clipboard/useGridClipboard';
|
|
@@ -13,7 +13,7 @@ export interface GridCoreApi {
|
|
|
13
13
|
* The React ref of the grid root container div element.
|
|
14
14
|
* @ignore - do not document.
|
|
15
15
|
*/
|
|
16
|
-
rootElementRef: React.RefObject<HTMLDivElement>;
|
|
16
|
+
rootElementRef: React.RefObject<HTMLDivElement | null>;
|
|
17
17
|
/**
|
|
18
18
|
* Registers a handler for an event.
|
|
19
19
|
* @param {string} event The name of the event.
|
|
@@ -59,27 +59,27 @@ export interface GridCorePrivateApi<GridPublicApi extends GridApiCommon, GridPri
|
|
|
59
59
|
/**
|
|
60
60
|
* The React ref of the grid main container div element.
|
|
61
61
|
*/
|
|
62
|
-
mainElementRef: React.
|
|
62
|
+
mainElementRef: React.RefObject<HTMLDivElement | null>;
|
|
63
63
|
/**
|
|
64
64
|
* The React ref of the grid's virtual scroller container element.
|
|
65
65
|
*/
|
|
66
|
-
virtualScrollerRef: React.RefObject<HTMLDivElement>;
|
|
66
|
+
virtualScrollerRef: React.RefObject<HTMLDivElement | null>;
|
|
67
67
|
/**
|
|
68
68
|
* The React ref of the grid's vertical virtual scrollbar container element.
|
|
69
69
|
*/
|
|
70
|
-
virtualScrollbarVerticalRef: React.RefObject<HTMLDivElement>;
|
|
70
|
+
virtualScrollbarVerticalRef: React.RefObject<HTMLDivElement | null>;
|
|
71
71
|
/**
|
|
72
72
|
* The React ref of the grid's horizontal virtual scrollbar container element.
|
|
73
73
|
*/
|
|
74
|
-
virtualScrollbarHorizontalRef: React.RefObject<HTMLDivElement>;
|
|
74
|
+
virtualScrollbarHorizontalRef: React.RefObject<HTMLDivElement | null>;
|
|
75
75
|
/**
|
|
76
76
|
* The React ref of the grid column container virtualized div element.
|
|
77
77
|
*/
|
|
78
|
-
columnHeadersContainerRef: React.RefObject<HTMLDivElement>;
|
|
78
|
+
columnHeadersContainerRef: React.RefObject<HTMLDivElement | null>;
|
|
79
79
|
/**
|
|
80
80
|
* The React ref of the grid header filter row element.
|
|
81
81
|
*/
|
|
82
|
-
headerFiltersElementRef?: React.RefObject<HTMLDivElement>;
|
|
82
|
+
headerFiltersElementRef?: React.RefObject<HTMLDivElement | null>;
|
|
83
83
|
register: <V extends 'public' | 'private', T extends V extends 'public' ? Partial<GridPublicApi> : Partial<Omit<GridPrivateApi, keyof GridPublicApi>>>(visibility: V, methods: T) => void;
|
|
84
84
|
/**
|
|
85
85
|
* Returns the public API.
|
|
@@ -1,15 +1,38 @@
|
|
|
1
|
+
type Ref<T = HTMLElement> = React.RefCallback<T | null> | React.RefObject<T | null> | null;
|
|
1
2
|
export type BadgeProps = {
|
|
2
3
|
badgeContent?: React.ReactNode;
|
|
3
4
|
children: React.ReactNode;
|
|
4
5
|
color?: 'primary' | 'default' | 'error';
|
|
6
|
+
invisible?: boolean;
|
|
5
7
|
overlap?: 'circular';
|
|
6
8
|
variant?: 'dot';
|
|
7
|
-
|
|
9
|
+
style?: React.CSSProperties;
|
|
10
|
+
};
|
|
11
|
+
export type ButtonProps = {
|
|
12
|
+
ref?: Ref;
|
|
13
|
+
children?: React.ReactNode;
|
|
14
|
+
className?: string;
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
id?: string;
|
|
17
|
+
onClick?: React.MouseEventHandler<HTMLElement>;
|
|
18
|
+
onKeyDown?: React.KeyboardEventHandler<HTMLElement>;
|
|
19
|
+
role?: string;
|
|
20
|
+
size?: 'small' | 'medium' | 'large';
|
|
21
|
+
startIcon?: React.ReactNode;
|
|
22
|
+
style?: React.CSSProperties;
|
|
23
|
+
tabIndex?: number;
|
|
24
|
+
title?: string;
|
|
25
|
+
touchRippleRef?: any;
|
|
26
|
+
};
|
|
27
|
+
export type IconButtonProps = Omit<ButtonProps, 'startIcon'> & {
|
|
28
|
+
label?: string;
|
|
29
|
+
color?: 'default' | 'inherit' | 'primary';
|
|
30
|
+
edge?: 'start' | 'end' | false;
|
|
8
31
|
};
|
|
9
32
|
export type DividerProps = {};
|
|
10
33
|
export type MenuItemProps = {
|
|
11
34
|
autoFocus?: boolean;
|
|
12
|
-
children
|
|
35
|
+
children?: React.ReactNode;
|
|
13
36
|
/** For items that aren't interactive themselves (but may contain an interactive widget) */
|
|
14
37
|
inert?: boolean;
|
|
15
38
|
disabled?: boolean;
|
|
@@ -18,6 +41,7 @@ export type MenuItemProps = {
|
|
|
18
41
|
iconEnd?: React.ReactNode;
|
|
19
42
|
selected?: boolean;
|
|
20
43
|
value?: number | string | readonly string[];
|
|
44
|
+
style?: React.CSSProperties;
|
|
21
45
|
};
|
|
22
46
|
export type CircularProgressProps = {
|
|
23
47
|
/**
|
|
@@ -34,3 +58,9 @@ export type SkeletonProps = {
|
|
|
34
58
|
width?: number | string;
|
|
35
59
|
height?: number | string;
|
|
36
60
|
};
|
|
61
|
+
export type TooltipProps = {
|
|
62
|
+
children: React.ReactElement<any, any>;
|
|
63
|
+
enterDelay?: number;
|
|
64
|
+
title: React.ReactNode;
|
|
65
|
+
};
|
|
66
|
+
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { BadgeProps as MUIBadgeProps } from '@mui/material/Badge';
|
|
3
|
+
import type { ButtonProps as MUIButtonProps } from '@mui/material/Button';
|
|
3
4
|
import type { CheckboxProps } from '@mui/material/Checkbox';
|
|
4
5
|
import type { CircularProgressProps as MUICircularProgressProps } from '@mui/material/CircularProgress';
|
|
5
6
|
import type { LinearProgressProps as MUILinearProgressProps } from '@mui/material/LinearProgress';
|
|
@@ -9,10 +10,9 @@ import type { TextFieldProps } from '@mui/material/TextField';
|
|
|
9
10
|
import type { FormControlProps } from '@mui/material/FormControl';
|
|
10
11
|
import type { SelectProps } from '@mui/material/Select';
|
|
11
12
|
import type { SwitchProps } from '@mui/material/Switch';
|
|
12
|
-
import type {
|
|
13
|
-
import type { IconButtonProps } from '@mui/material/IconButton';
|
|
13
|
+
import type { IconButtonProps as MUIIconButtonProps } from '@mui/material/IconButton';
|
|
14
14
|
import type { InputAdornmentProps } from '@mui/material/InputAdornment';
|
|
15
|
-
import type { TooltipProps } from '@mui/material/Tooltip';
|
|
15
|
+
import type { TooltipProps as MUITooltipProps } from '@mui/material/Tooltip';
|
|
16
16
|
import type { InputLabelProps } from '@mui/material/InputLabel';
|
|
17
17
|
import type { PopperProps } from '@mui/material/Popper';
|
|
18
18
|
import type { TablePaginationProps } from '@mui/material/TablePagination';
|
|
@@ -35,7 +35,7 @@ import type { GridColumnsManagementProps } from '../components/columnsManagement
|
|
|
35
35
|
import type { GridLoadingOverlayProps } from '../components/GridLoadingOverlay';
|
|
36
36
|
import type { GridRowCountProps } from '../components/GridRowCount';
|
|
37
37
|
import type { GridColumnHeaderSortIconProps } from '../components/columnHeaders/GridColumnHeaderSortIcon';
|
|
38
|
-
import type { BadgeProps, CircularProgressProps, DividerProps, LinearProgressProps, MenuItemProps, SkeletonProps } from './gridBaseSlots';
|
|
38
|
+
import type { BadgeProps, ButtonProps, CircularProgressProps, DividerProps, IconButtonProps, LinearProgressProps, MenuItemProps, SkeletonProps, TooltipProps } from './gridBaseSlots';
|
|
39
39
|
type RootProps = React.HTMLAttributes<HTMLDivElement> & Record<`data-${string}`, string>;
|
|
40
40
|
type MainProps = React.HTMLAttributes<HTMLDivElement> & Record<`data-${string}`, string>;
|
|
41
41
|
export interface BaseBadgePropsOverrides {
|
|
@@ -144,9 +144,12 @@ interface BaseSlotProps {
|
|
|
144
144
|
}
|
|
145
145
|
interface MaterialSlotProps {
|
|
146
146
|
baseBadge: MUIBadgeProps;
|
|
147
|
-
|
|
147
|
+
baseButton: MUIButtonProps;
|
|
148
|
+
baseIconButton: MUIIconButtonProps;
|
|
148
149
|
baseLinearProgress: MUILinearProgressProps;
|
|
150
|
+
baseCircularProgress: MUICircularProgressProps;
|
|
149
151
|
baseMenuItem: MUIMenuItemProps;
|
|
152
|
+
baseTooltip: MUITooltipProps;
|
|
150
153
|
}
|
|
151
154
|
interface ElementSlotProps {
|
|
152
155
|
cell: GridCellProps & CellPropsOverrides;
|
|
@@ -170,16 +173,17 @@ interface ElementSlotProps {
|
|
|
170
173
|
skeletonCell: GridSkeletonCellProps & SkeletonCellPropsOverrides;
|
|
171
174
|
toolbar: GridToolbarProps & ToolbarPropsOverrides;
|
|
172
175
|
/**
|
|
173
|
-
* Props passed to the `.main` (role="grid") element
|
|
176
|
+
* Props passed to the `.main` (role="grid") element.
|
|
174
177
|
*/
|
|
175
178
|
main: MainProps;
|
|
176
179
|
/**
|
|
177
|
-
* Props passed to the `.root` element
|
|
180
|
+
* Props passed to the `.root` element.
|
|
178
181
|
*/
|
|
179
182
|
root: RootProps;
|
|
180
183
|
}
|
|
184
|
+
type Select<A, B, K> = K extends keyof A ? A[K] : K extends keyof B ? B[K] : never;
|
|
181
185
|
type Merge<A, B> = {
|
|
182
|
-
[K in keyof A | keyof B]: K extends keyof A & keyof B ? A[K] & B[K] : K extends keyof B ? B[K] : K extends keyof A ? A[K] : never;
|
|
186
|
+
[K in keyof A | keyof B]: K extends 'ref' ? Select<A, B, 'ref'> : K extends keyof A & keyof B ? A[K] & B[K] : K extends keyof B ? B[K] : K extends keyof A ? A[K] : never;
|
|
183
187
|
};
|
|
184
188
|
export type GridSlotProps = Merge<BaseSlotProps, MaterialSlotProps> & ElementSlotProps;
|
|
185
189
|
/**
|
|
@@ -369,7 +369,7 @@ export interface DataGridPropsWithoutDefaultValue<R extends GridValidRowModel =
|
|
|
369
369
|
/**
|
|
370
370
|
* The ref object that allows Data Grid manipulation. Can be instantiated with `useGridApiRef()`.
|
|
371
371
|
*/
|
|
372
|
-
apiRef?: React.
|
|
372
|
+
apiRef?: React.RefObject<GridApiCommunity>;
|
|
373
373
|
/**
|
|
374
374
|
* Signal to the underlying logic what version of the public component API
|
|
375
375
|
* of the Data Grid is exposed [[GridSignature]].
|
|
@@ -6,6 +6,8 @@ import * as React from 'react';
|
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
8
8
|
import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
|
|
9
|
+
|
|
10
|
+
// FIXME(v8:romgrk): Make parametric
|
|
9
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
12
|
const GridActionsCellItem = forwardRef((props, ref) => {
|
|
11
13
|
const rootProps = useGridRootProps();
|
|
@@ -35,7 +35,7 @@ function GridEditDateCell(props) {
|
|
|
35
35
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
36
36
|
const isDateTime = colDef.type === 'dateTime';
|
|
37
37
|
const apiRef = useGridApiContext();
|
|
38
|
-
const inputRef = React.useRef();
|
|
38
|
+
const inputRef = React.useRef(null);
|
|
39
39
|
const valueTransformed = React.useMemo(() => {
|
|
40
40
|
let parsedDate;
|
|
41
41
|
if (valueProp == null) {
|
|
@@ -47,7 +47,7 @@ const GridEditInputCell = forwardRef((props, ref) => {
|
|
|
47
47
|
} = props,
|
|
48
48
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
49
49
|
const apiRef = useGridApiContext();
|
|
50
|
-
const inputRef = React.useRef();
|
|
50
|
+
const inputRef = React.useRef(null);
|
|
51
51
|
const [valueState, setValueState] = React.useState(value);
|
|
52
52
|
const classes = useUtilityClasses(rootProps);
|
|
53
53
|
const handleChange = React.useCallback(async event => {
|
|
@@ -30,8 +30,8 @@ function GridEditSingleSelectCell(props) {
|
|
|
30
30
|
} = props,
|
|
31
31
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
32
32
|
const apiRef = useGridApiContext();
|
|
33
|
-
const ref = React.useRef();
|
|
34
|
-
const inputRef = React.useRef();
|
|
33
|
+
const ref = React.useRef(null);
|
|
34
|
+
const inputRef = React.useRef(null);
|
|
35
35
|
const [open, setOpen] = React.useState(initialOpen);
|
|
36
36
|
const baseSelectProps = rootProps.slotProps?.baseSelect || {};
|
|
37
37
|
const isSelectNative = baseSelectProps.native ?? false;
|
|
@@ -57,7 +57,6 @@ function GridColumnHeaderFilterIconButton(props) {
|
|
|
57
57
|
const iconButton = /*#__PURE__*/_jsx(rootProps.slots.baseIconButton, _extends({
|
|
58
58
|
id: labelId,
|
|
59
59
|
onClick: toggleFilter,
|
|
60
|
-
color: "default",
|
|
61
60
|
"aria-label": apiRef.current.getLocaleText('columnHeaderFiltersLabel'),
|
|
62
61
|
size: "small",
|
|
63
62
|
tabIndex: -1,
|
|
@@ -87,7 +87,8 @@ const GridCellCheckboxForwardRef = forwardRef(function GridCellCheckboxRenderer(
|
|
|
87
87
|
onChange: handleChange,
|
|
88
88
|
className: classes.root,
|
|
89
89
|
inputProps: {
|
|
90
|
-
'aria-label': label
|
|
90
|
+
'aria-label': label,
|
|
91
|
+
name: 'select_row'
|
|
91
92
|
},
|
|
92
93
|
onKeyDown: handleKeyDown,
|
|
93
94
|
indeterminate: isIndeterminate,
|
|
@@ -42,13 +42,16 @@ const GridHeaderCheckbox = forwardRef(function GridHeaderCheckbox(props, ref) {
|
|
|
42
42
|
return selection;
|
|
43
43
|
}
|
|
44
44
|
return selection.filter(id => {
|
|
45
|
+
if (rootProps.keepNonExistentRowsSelected) {
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
45
48
|
// The row might have been deleted
|
|
46
49
|
if (!apiRef.current.getRow(id)) {
|
|
47
50
|
return false;
|
|
48
51
|
}
|
|
49
52
|
return rootProps.isRowSelectable(apiRef.current.getRowParams(id));
|
|
50
53
|
});
|
|
51
|
-
}, [apiRef, rootProps.isRowSelectable, selection]);
|
|
54
|
+
}, [apiRef, rootProps.isRowSelectable, selection, rootProps.keepNonExistentRowsSelected]);
|
|
52
55
|
|
|
53
56
|
// All the rows that could be selected / unselected by toggling this checkbox
|
|
54
57
|
const selectionCandidates = React.useMemo(() => {
|
|
@@ -103,7 +106,8 @@ const GridHeaderCheckbox = forwardRef(function GridHeaderCheckbox(props, ref) {
|
|
|
103
106
|
onChange: handleChange,
|
|
104
107
|
className: classes.root,
|
|
105
108
|
inputProps: {
|
|
106
|
-
'aria-label': label
|
|
109
|
+
'aria-label': label,
|
|
110
|
+
name: 'select_all_rows'
|
|
107
111
|
},
|
|
108
112
|
tabIndex: tabIndex,
|
|
109
113
|
onKeyDown: handleKeyDown,
|
|
@@ -140,11 +140,11 @@ function GridColumnsManagement(props) {
|
|
|
140
140
|
endAdornment: /*#__PURE__*/_jsx(rootProps.slots.baseIconButton, _extends({
|
|
141
141
|
"aria-label": apiRef.current.getLocaleText('columnsManagementDeleteIconLabel'),
|
|
142
142
|
size: "small",
|
|
143
|
-
|
|
143
|
+
style: searchValue ? {
|
|
144
144
|
visibility: 'visible'
|
|
145
145
|
} : {
|
|
146
146
|
visibility: 'hidden'
|
|
147
|
-
}
|
|
147
|
+
},
|
|
148
148
|
tabIndex: -1,
|
|
149
149
|
onClick: handleSearchReset
|
|
150
150
|
}, rootProps.slotProps?.baseIconButton, {
|
|
@@ -22,17 +22,17 @@ function GridFilterInputValue(props) {
|
|
|
22
22
|
} = props,
|
|
23
23
|
others = _objectWithoutPropertiesLoose(props, _excluded);
|
|
24
24
|
const filterTimeout = useTimeout();
|
|
25
|
-
const [filterValueState, setFilterValueState] = React.useState(sanitizeFilterItemValue(item.value
|
|
25
|
+
const [filterValueState, setFilterValueState] = React.useState(sanitizeFilterItemValue(item.value));
|
|
26
26
|
const [applying, setIsApplying] = React.useState(false);
|
|
27
27
|
const id = useId();
|
|
28
28
|
const rootProps = useGridRootProps();
|
|
29
29
|
const onFilterChange = React.useCallback(event => {
|
|
30
|
-
const value = sanitizeFilterItemValue(event.target.value
|
|
30
|
+
const value = sanitizeFilterItemValue(event.target.value);
|
|
31
31
|
setFilterValueState(value);
|
|
32
32
|
setIsApplying(true);
|
|
33
33
|
filterTimeout.start(rootProps.filterDebounceMs, () => {
|
|
34
34
|
const newItem = _extends({}, item, {
|
|
35
|
-
value,
|
|
35
|
+
value: type === 'number' && !Number.isNaN(Number(value)) ? Number(value) : value,
|
|
36
36
|
fromInput: id
|
|
37
37
|
});
|
|
38
38
|
applyValue(newItem);
|
|
@@ -42,14 +42,14 @@ function GridFilterInputValue(props) {
|
|
|
42
42
|
React.useEffect(() => {
|
|
43
43
|
const itemPlusTag = item;
|
|
44
44
|
if (itemPlusTag.fromInput !== id || item.value == null) {
|
|
45
|
-
setFilterValueState(sanitizeFilterItemValue(item.value
|
|
45
|
+
setFilterValueState(sanitizeFilterItemValue(item.value));
|
|
46
46
|
}
|
|
47
|
-
}, [id, item
|
|
47
|
+
}, [id, item]);
|
|
48
48
|
return /*#__PURE__*/_jsx(rootProps.slots.baseTextField, _extends({
|
|
49
49
|
id: id,
|
|
50
50
|
label: apiRef.current.getLocaleText('filterPanelInputLabel'),
|
|
51
51
|
placeholder: apiRef.current.getLocaleText('filterPanelInputPlaceholder'),
|
|
52
|
-
value: filterValueState
|
|
52
|
+
value: filterValueState ?? '',
|
|
53
53
|
onChange: onFilterChange,
|
|
54
54
|
variant: variant,
|
|
55
55
|
type: type || 'text',
|
|
@@ -71,13 +71,10 @@ function GridFilterInputValue(props) {
|
|
|
71
71
|
inputRef: focusElementRef
|
|
72
72
|
}, others, rootProps.slotProps?.baseTextField));
|
|
73
73
|
}
|
|
74
|
-
function sanitizeFilterItemValue(value
|
|
74
|
+
function sanitizeFilterItemValue(value) {
|
|
75
75
|
if (value == null || value === '') {
|
|
76
76
|
return undefined;
|
|
77
77
|
}
|
|
78
|
-
if (type === 'number') {
|
|
79
|
-
return Number(value);
|
|
80
|
-
}
|
|
81
78
|
return String(value);
|
|
82
79
|
}
|
|
83
80
|
process.env.NODE_ENV !== "production" ? GridFilterInputValue.propTypes = {
|
|
@@ -109,11 +109,11 @@ function GridToolbarQuickFilter(props) {
|
|
|
109
109
|
"aria-label": apiRef.current.getLocaleText('toolbarQuickFilterDeleteIconLabel'),
|
|
110
110
|
size: "small",
|
|
111
111
|
edge: "end",
|
|
112
|
-
|
|
112
|
+
style: searchValue ? {
|
|
113
113
|
visibility: 'visible'
|
|
114
114
|
} : {
|
|
115
115
|
visibility: 'hidden'
|
|
116
|
-
}
|
|
116
|
+
},
|
|
117
117
|
onClick: handleSearchReset
|
|
118
118
|
}, rootProps.slotProps?.baseIconButton, {
|
|
119
119
|
children: /*#__PURE__*/_jsx(rootProps.slots.quickFilterClearIcon, {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useFirstRender } from "../../utils/useFirstRender.js";
|
|
3
3
|
export const useGridRegisterPipeApplier = (apiRef, group, callback) => {
|
|
4
|
-
const cleanup = React.useRef();
|
|
4
|
+
const cleanup = React.useRef(null);
|
|
5
5
|
const id = React.useRef(`mui-${Math.round(Math.random() * 1e9)}`);
|
|
6
6
|
const registerPreProcessor = React.useCallback(() => {
|
|
7
7
|
cleanup.current = apiRef.current.registerPipeApplier(group, id.current, callback);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useFirstRender } from "../../utils/useFirstRender.js";
|
|
3
3
|
export const useGridRegisterPipeProcessor = (apiRef, group, callback) => {
|
|
4
|
-
const cleanup = React.useRef();
|
|
4
|
+
const cleanup = React.useRef(null);
|
|
5
5
|
const id = React.useRef(`mui-${Math.round(Math.random() * 1e9)}`);
|
|
6
6
|
const registerPreProcessor = React.useCallback(() => {
|
|
7
7
|
cleanup.current = apiRef.current.registerPipeProcessor(group, id.current, callback);
|
|
@@ -68,8 +68,8 @@ function createPublicAPI(privateApiRef) {
|
|
|
68
68
|
return publicApi;
|
|
69
69
|
}
|
|
70
70
|
export function useGridApiInitialization(inputApiRef, props) {
|
|
71
|
-
const publicApiRef = React.useRef();
|
|
72
|
-
const privateApiRef = React.useRef();
|
|
71
|
+
const publicApiRef = React.useRef(null);
|
|
72
|
+
const privateApiRef = React.useRef(null);
|
|
73
73
|
if (!privateApiRef.current) {
|
|
74
74
|
privateApiRef.current = createPrivateAPI(publicApiRef);
|
|
75
75
|
}
|
|
@@ -70,7 +70,7 @@ function preventClick(event) {
|
|
|
70
70
|
* is disabled.
|
|
71
71
|
*/
|
|
72
72
|
function useColumnVirtualizationDisabled(apiRef) {
|
|
73
|
-
const promise = React.useRef();
|
|
73
|
+
const promise = React.useRef(undefined);
|
|
74
74
|
const selector = () => gridVirtualizationColumnEnabledSelector(apiRef);
|
|
75
75
|
const value = useGridSelector(apiRef, selector);
|
|
76
76
|
React.useEffect(() => {
|
|
@@ -184,10 +184,10 @@ export const useGridColumnResize = (apiRef, props) => {
|
|
|
184
184
|
// To improve accessibility, the separator has padding on both sides.
|
|
185
185
|
// Clicking inside the padding area should be treated as a click in the separator.
|
|
186
186
|
// This ref stores the offset between the click and the separator.
|
|
187
|
-
const initialOffsetToSeparator = React.useRef();
|
|
188
|
-
const resizeDirection = React.useRef();
|
|
187
|
+
const initialOffsetToSeparator = React.useRef(null);
|
|
188
|
+
const resizeDirection = React.useRef(null);
|
|
189
189
|
const stopResizeEventTimeout = useTimeout();
|
|
190
|
-
const touchId = React.useRef();
|
|
190
|
+
const touchId = React.useRef(undefined);
|
|
191
191
|
const updateWidth = newWidth => {
|
|
192
192
|
logger.debug(`Updating width to ${newWidth} for col ${refs.colDef.field}`);
|
|
193
193
|
const prevWidth = refs.columnHeaderElement.offsetWidth;
|
|
@@ -21,7 +21,7 @@ export const useGridRowEditing = (apiRef, props) => {
|
|
|
21
21
|
const [rowModesModel, setRowModesModel] = React.useState({});
|
|
22
22
|
const rowModesModelRef = React.useRef(rowModesModel);
|
|
23
23
|
const prevRowModesModel = React.useRef({});
|
|
24
|
-
const focusTimeout = React.useRef();
|
|
24
|
+
const focusTimeout = React.useRef(undefined);
|
|
25
25
|
const nextFocusedCell = React.useRef(null);
|
|
26
26
|
const {
|
|
27
27
|
processRowUpdate,
|
|
@@ -44,7 +44,7 @@ export const useGridPrintExport = (apiRef, props) => {
|
|
|
44
44
|
const previousGridState = React.useRef(null);
|
|
45
45
|
const previousColumnVisibility = React.useRef({});
|
|
46
46
|
const previousRows = React.useRef([]);
|
|
47
|
-
const previousVirtualizationState = React.useRef();
|
|
47
|
+
const previousVirtualizationState = React.useRef(null);
|
|
48
48
|
React.useEffect(() => {
|
|
49
49
|
doc.current = ownerDocument(apiRef.current.rootElementRef.current);
|
|
50
50
|
}, [apiRef, hasRootReference]);
|
|
@@ -15,8 +15,8 @@ export const preferencePanelStateInitializer = (state, props) => _extends({}, st
|
|
|
15
15
|
*/
|
|
16
16
|
export const useGridPreferencesPanel = (apiRef, props) => {
|
|
17
17
|
const logger = useGridLogger(apiRef, 'useGridPreferencesPanel');
|
|
18
|
-
const hideTimeout = React.useRef();
|
|
19
|
-
const immediateTimeout = React.useRef();
|
|
18
|
+
const hideTimeout = React.useRef(undefined);
|
|
19
|
+
const immediateTimeout = React.useRef(undefined);
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* API METHODS
|