@mui/x-data-grid 8.5.1 → 8.5.3
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 +187 -10
- package/components/containers/GridRootStyles.d.ts +1 -1
- package/components/menu/columnMenu/GridColumnMenuContainer.js +8 -0
- package/components/toolbarV8/GridToolbar.js +1 -0
- package/components/toolbarV8/Toolbar.d.ts +1 -1
- package/esm/components/containers/GridRootStyles.d.ts +1 -1
- package/esm/components/menu/columnMenu/GridColumnMenuContainer.js +8 -0
- package/esm/components/toolbarV8/GridToolbar.js +1 -0
- package/esm/components/toolbarV8/Toolbar.d.ts +1 -1
- package/esm/hooks/core/useGridApiInitialization.js +1 -1
- package/esm/hooks/features/columnGrouping/gridColumnGroupsSelector.d.ts +13 -5
- package/esm/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +1 -1
- package/esm/hooks/features/columnResize/columnResizeSelector.d.ts +3 -1
- package/esm/hooks/features/columns/gridColumnsSelector.d.ts +41 -15
- package/esm/hooks/features/columns/gridColumnsUtils.js +3 -1
- package/esm/hooks/features/dataSource/gridDataSourceSelector.d.ts +4 -2
- package/esm/hooks/features/dataSource/useGridDataSourceBase.js +4 -0
- package/esm/hooks/features/dataSource/utils.js +1 -1
- package/esm/hooks/features/density/densitySelector.d.ts +3 -1
- package/esm/hooks/features/dimensions/gridDimensionsSelectors.d.ts +36 -12
- package/esm/hooks/features/editing/gridEditingSelectors.d.ts +8 -4
- package/esm/hooks/features/filter/gridFilterSelector.d.ts +51 -17
- package/esm/hooks/features/filter/gridFilterState.d.ts +2 -1
- package/esm/hooks/features/filter/gridFilterState.js +2 -1
- package/esm/hooks/features/filter/useGridFilter.js +1 -1
- package/esm/hooks/features/focus/gridFocusStateSelector.d.ts +24 -8
- package/esm/hooks/features/headerFiltering/gridHeaderFilteringSelectors.d.ts +9 -3
- package/esm/hooks/features/pagination/gridPaginationSelector.d.ts +35 -19
- package/esm/hooks/features/pivoting/gridPivotingSelectors.d.ts +9 -4
- package/esm/hooks/features/preferencesPanel/gridPreferencePanelSelector.d.ts +3 -1
- package/esm/hooks/features/rowSelection/gridRowSelectionSelector.d.ts +9 -3
- package/esm/hooks/features/rowSelection/utils.d.ts +5 -3
- package/esm/hooks/features/rows/gridRowSpanningSelectors.d.ts +9 -3
- package/esm/hooks/features/rows/gridRowsSelector.d.ts +50 -29
- package/esm/hooks/features/sorting/gridSortingSelector.d.ts +15 -5
- package/esm/hooks/features/virtualization/gridFocusedVirtualCellSelector.d.ts +4 -2
- package/esm/hooks/features/virtualization/gridVirtualizationSelectors.d.ts +15 -5
- package/esm/hooks/features/virtualization/gridVirtualizationSelectors.js +3 -1
- package/esm/hooks/utils/useGridSelector.d.ts +2 -4
- package/esm/hooks/utils/useGridSelector.js +2 -2
- package/esm/index.js +1 -1
- package/esm/internals/demo/TailwindDemoContainer.d.ts +1 -1
- package/esm/material/variables.js +1 -2
- package/esm/models/api/gridCoreApi.d.ts +1 -1
- package/esm/models/gridBaseSlots.d.ts +1 -0
- package/esm/models/gridCellClass.d.ts +2 -0
- package/esm/models/gridColumnGrouping.d.ts +2 -0
- package/esm/models/gridColumnGrouping.js +2 -0
- package/esm/models/gridColumnHeaderClass.d.ts +2 -0
- package/esm/models/gridRows.d.ts +2 -0
- package/esm/models/gridSortModel.d.ts +5 -0
- package/esm/models/params/gridRowParams.d.ts +1 -1
- package/esm/models/params/gridRowParams.js +1 -1
- package/esm/utils/createSelector.d.ts +3 -11
- package/esm/utils/createSelector.js +16 -86
- package/hooks/core/useGridApiInitialization.js +2 -2
- package/hooks/features/columnGrouping/gridColumnGroupsSelector.d.ts +13 -5
- package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +1 -1
- package/hooks/features/columnResize/columnResizeSelector.d.ts +3 -1
- package/hooks/features/columns/gridColumnsSelector.d.ts +41 -15
- package/hooks/features/columns/gridColumnsUtils.js +3 -1
- package/hooks/features/dataSource/gridDataSourceSelector.d.ts +4 -2
- package/hooks/features/dataSource/useGridDataSourceBase.js +4 -0
- package/hooks/features/dataSource/utils.js +1 -1
- package/hooks/features/density/densitySelector.d.ts +3 -1
- package/hooks/features/dimensions/gridDimensionsSelectors.d.ts +36 -12
- package/hooks/features/editing/gridEditingSelectors.d.ts +8 -4
- package/hooks/features/filter/gridFilterSelector.d.ts +51 -17
- package/hooks/features/filter/gridFilterState.d.ts +2 -1
- package/hooks/features/filter/gridFilterState.js +2 -1
- package/hooks/features/filter/useGridFilter.js +2 -2
- package/hooks/features/focus/gridFocusStateSelector.d.ts +24 -8
- package/hooks/features/headerFiltering/gridHeaderFilteringSelectors.d.ts +9 -3
- package/hooks/features/pagination/gridPaginationSelector.d.ts +35 -19
- package/hooks/features/pivoting/gridPivotingSelectors.d.ts +9 -4
- package/hooks/features/preferencesPanel/gridPreferencePanelSelector.d.ts +3 -1
- package/hooks/features/rowSelection/gridRowSelectionSelector.d.ts +9 -3
- package/hooks/features/rowSelection/utils.d.ts +5 -3
- package/hooks/features/rows/gridRowSpanningSelectors.d.ts +9 -3
- package/hooks/features/rows/gridRowsSelector.d.ts +50 -29
- package/hooks/features/sorting/gridSortingSelector.d.ts +15 -5
- package/hooks/features/virtualization/gridFocusedVirtualCellSelector.d.ts +4 -2
- package/hooks/features/virtualization/gridVirtualizationSelectors.d.ts +15 -5
- package/hooks/features/virtualization/gridVirtualizationSelectors.js +3 -1
- package/hooks/utils/useGridSelector.d.ts +2 -4
- package/hooks/utils/useGridSelector.js +4 -4
- package/index.js +1 -1
- package/internals/demo/TailwindDemoContainer.d.ts +1 -1
- package/material/variables.js +1 -2
- package/models/api/gridCoreApi.d.ts +1 -1
- package/models/gridBaseSlots.d.ts +1 -0
- package/models/gridCellClass.d.ts +2 -0
- package/models/gridColumnGrouping.d.ts +2 -0
- package/models/gridColumnGrouping.js +2 -0
- package/models/gridColumnHeaderClass.d.ts +2 -0
- package/models/gridRows.d.ts +2 -0
- package/models/gridSortModel.d.ts +5 -0
- package/models/params/gridRowParams.d.ts +1 -1
- package/models/params/gridRowParams.js +1 -1
- package/package.json +3 -4
- package/utils/createSelector.d.ts +3 -11
- package/utils/createSelector.js +18 -88
- package/esm/utils/Store.d.ts +0 -11
- package/esm/utils/Store.js +0 -24
- package/esm/utils/weakMapMemoize.d.ts +0 -20
- package/esm/utils/weakMapMemoize.js +0 -128
- package/utils/Store.d.ts +0 -11
- package/utils/Store.js +0 -31
- package/utils/weakMapMemoize.d.ts +0 -20
- package/utils/weakMapMemoize.js +0 -134
|
@@ -10,27 +10,37 @@ export declare const gridVirtualizationSelector: import("@mui/x-data-grid").Outp
|
|
|
10
10
|
* @category Virtualization
|
|
11
11
|
* @deprecated Use `gridVirtualizationColumnEnabledSelector` and `gridVirtualizationRowEnabledSelector`
|
|
12
12
|
*/
|
|
13
|
-
export declare const gridVirtualizationEnabledSelector:
|
|
13
|
+
export declare const gridVirtualizationEnabledSelector: (args_0: import("react").RefObject<{
|
|
14
|
+
state: GridStateCommunity;
|
|
15
|
+
} | null>) => boolean;
|
|
14
16
|
/**
|
|
15
17
|
* Get the enabled state for column virtualization
|
|
16
18
|
* @category Virtualization
|
|
17
19
|
*/
|
|
18
|
-
export declare const gridVirtualizationColumnEnabledSelector:
|
|
20
|
+
export declare const gridVirtualizationColumnEnabledSelector: (args_0: import("react").RefObject<{
|
|
21
|
+
state: GridStateCommunity;
|
|
22
|
+
} | null>) => boolean;
|
|
19
23
|
/**
|
|
20
24
|
* Get the enabled state for row virtualization
|
|
21
25
|
* @category Virtualization
|
|
22
26
|
*/
|
|
23
|
-
export declare const gridVirtualizationRowEnabledSelector:
|
|
27
|
+
export declare const gridVirtualizationRowEnabledSelector: (args_0: import("react").RefObject<{
|
|
28
|
+
state: GridStateCommunity;
|
|
29
|
+
} | null>) => boolean;
|
|
24
30
|
/**
|
|
25
31
|
* Get the render context
|
|
26
32
|
* @category Virtualization
|
|
27
33
|
* @ignore - do not document.
|
|
28
34
|
*/
|
|
29
|
-
export declare const gridRenderContextSelector:
|
|
35
|
+
export declare const gridRenderContextSelector: (args_0: import("react").RefObject<{
|
|
36
|
+
state: GridStateCommunity;
|
|
37
|
+
} | null>) => import("@mui/x-data-grid").GridRenderContext;
|
|
30
38
|
/**
|
|
31
39
|
* Get the render context, with only columns filled in.
|
|
32
40
|
* This is cached, so it can be used to only re-render when the column interval changes.
|
|
33
41
|
* @category Virtualization
|
|
34
42
|
* @ignore - do not document.
|
|
35
43
|
*/
|
|
36
|
-
export declare const gridRenderContextColumnsSelector: import("
|
|
44
|
+
export declare const gridRenderContextColumnsSelector: (args_0: import("react").RefObject<{
|
|
45
|
+
state: GridStateCommunity;
|
|
46
|
+
} | null>) => GridColumnsRenderContext;
|
|
@@ -30,6 +30,8 @@ export const gridVirtualizationRowEnabledSelector = createSelector(gridVirtualiz
|
|
|
30
30
|
* @ignore - do not document.
|
|
31
31
|
*/
|
|
32
32
|
export const gridRenderContextSelector = createSelector(gridVirtualizationSelector, state => state.renderContext);
|
|
33
|
+
const firstColumnIndexSelector = createRootSelector(state => state.virtualization.renderContext.firstColumnIndex);
|
|
34
|
+
const lastColumnIndexSelector = createRootSelector(state => state.virtualization.renderContext.lastColumnIndex);
|
|
33
35
|
|
|
34
36
|
/**
|
|
35
37
|
* Get the render context, with only columns filled in.
|
|
@@ -37,7 +39,7 @@ export const gridRenderContextSelector = createSelector(gridVirtualizationSelect
|
|
|
37
39
|
* @category Virtualization
|
|
38
40
|
* @ignore - do not document.
|
|
39
41
|
*/
|
|
40
|
-
export const gridRenderContextColumnsSelector = createSelectorMemoized(
|
|
42
|
+
export const gridRenderContextColumnsSelector = createSelectorMemoized(firstColumnIndexSelector, lastColumnIndexSelector, (firstColumnIndex, lastColumnIndex) => ({
|
|
41
43
|
firstColumnIndex,
|
|
42
44
|
lastColumnIndex
|
|
43
45
|
}));
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { RefObject } from '@mui/x-internals/types';
|
|
2
2
|
import type { GridApiCommon } from "../../models/api/gridApiCommon.js";
|
|
3
|
-
import type { OutputSelector } from "../../utils/createSelector.js";
|
|
4
|
-
type Selector<Api extends GridApiCommon, Args, T> = ((apiRef: RefObject<Api>) => T) | ((apiRef: RefObject<Api | null>) => T) | OutputSelector<Api['state'], Args, T>;
|
|
5
3
|
export declare const objectShallowCompare: (a: unknown, b: unknown) => boolean;
|
|
6
4
|
export declare const argsEqual: (prev: any, curr: any) => boolean;
|
|
7
|
-
export declare
|
|
8
|
-
export
|
|
5
|
+
export declare function useGridSelector<Api extends GridApiCommon, T>(apiRef: RefObject<Api>, selector: (apiRef: RefObject<Api>) => T, args?: undefined, equals?: <U = T>(a: U, b: U) => boolean): T;
|
|
6
|
+
export declare function useGridSelector<Api extends GridApiCommon, T, Args>(apiRef: RefObject<Api>, selector: (apiRef: RefObject<Api>, a1: Args) => T, args: Args, equals?: <U = T>(a: U, b: U) => boolean): T;
|
|
@@ -28,7 +28,7 @@ const createRefs = () => ({
|
|
|
28
28
|
});
|
|
29
29
|
const EMPTY = [];
|
|
30
30
|
const emptyGetSnapshot = () => null;
|
|
31
|
-
export
|
|
31
|
+
export function useGridSelector(apiRef, selector, args = undefined, equals = defaultCompare) {
|
|
32
32
|
if (process.env.NODE_ENV !== 'production') {
|
|
33
33
|
if (!apiRef.current.state) {
|
|
34
34
|
warnOnce(['MUI X: `useGridSelector` has been called before the initialization of the state.', 'This hook can only be used inside the context of the grid.']);
|
|
@@ -77,4 +77,4 @@ export const useGridSelector = (apiRef, selector, args = undefined, equals = def
|
|
|
77
77
|
}, EMPTY);
|
|
78
78
|
useSyncExternalStore(unsubscribe, subscribe, emptyGetSnapshot);
|
|
79
79
|
return state;
|
|
80
|
-
}
|
|
80
|
+
}
|
package/esm/index.js
CHANGED
|
@@ -7,5 +7,5 @@ interface TailwindDemoContainerProps {
|
|
|
7
7
|
* WARNING: This is an internal component used in documentation to inject the Tailwind script.
|
|
8
8
|
* Please do not use it in your application.
|
|
9
9
|
*/
|
|
10
|
-
export declare function TailwindDemoContainer(props: TailwindDemoContainerProps): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> |
|
|
10
|
+
export declare function TailwindDemoContainer(props: TailwindDemoContainerProps): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | React.JSX.Element | null | undefined;
|
|
11
11
|
export {};
|
|
@@ -16,8 +16,7 @@ export function useMaterialCSSVariables() {
|
|
|
16
16
|
}
|
|
17
17
|
function transformTheme(t) {
|
|
18
18
|
const borderColor = getBorderColor(t);
|
|
19
|
-
const dataGridPalette = t.palette.DataGrid;
|
|
20
|
-
|
|
19
|
+
const dataGridPalette = (t.vars || t).palette.DataGrid;
|
|
21
20
|
const backgroundBase = dataGridPalette?.bg ?? (t.vars || t).palette.background.default;
|
|
22
21
|
const backgroundHeader = dataGridPalette?.headerBg ?? backgroundBase;
|
|
23
22
|
const backgroundPinned = dataGridPalette?.pinnedBg ?? backgroundBase;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { EventManager, EventListenerOptions } from '@mui/x-internals/EventManager';
|
|
3
|
+
import type { Store } from '@mui/x-internals/store';
|
|
3
4
|
import type { GridEventPublisher, GridEventListener, GridEvents } from "../events/index.js";
|
|
4
|
-
import { Store } from "../../utils/Store.js";
|
|
5
5
|
import type { GridApiCaches } from "../gridApiCaches.js";
|
|
6
6
|
import type { GridApiCommon, GridPrivateApiCommon } from "./gridApiCommon.js";
|
|
7
7
|
import type { DataGridProcessedProps } from "../props/DataGridProps.js";
|
|
@@ -267,6 +267,7 @@ export type TooltipProps = CommonProps & {
|
|
|
267
267
|
children: React.ReactElement<any, any>;
|
|
268
268
|
enterDelay?: number;
|
|
269
269
|
title: React.ReactNode;
|
|
270
|
+
disableInteractive?: boolean;
|
|
270
271
|
};
|
|
271
272
|
export type IconProps = CommonProps<SVGSVGElement> & {
|
|
272
273
|
fontSize?: 'small' | 'medium' | 'large' | 'inherit';
|
|
@@ -2,6 +2,8 @@ import { GridValidRowModel } from "./gridRows.js";
|
|
|
2
2
|
import { GridCellParams } from "./params/gridCellParams.js";
|
|
3
3
|
/**
|
|
4
4
|
* A function used to process cellClassName params.
|
|
5
|
+
* @param {GridCellParams<R, V>} params The parameters of the cell.
|
|
6
|
+
* @returns {string} The class name to be added to the cell.
|
|
5
7
|
*/
|
|
6
8
|
export type GridCellClassFn<R extends GridValidRowModel = any, V = unknown> = (params: GridCellParams<R, V>) => string;
|
|
7
9
|
/**
|
|
@@ -7,6 +7,8 @@ export type GridColumnNode = GridColumnGroup | GridLeafColumn;
|
|
|
7
7
|
export declare function isLeaf(node: GridColumnNode): node is GridLeafColumn;
|
|
8
8
|
/**
|
|
9
9
|
* A function used to process headerClassName params.
|
|
10
|
+
* @param {GridColumnGroupHeaderParams} params The parameters of the column group header.
|
|
11
|
+
* @returns {string} The class name to be added to the column group header cell.
|
|
10
12
|
*/
|
|
11
13
|
export type GridColumnGroupHeaderClassFn = (params: GridColumnGroupHeaderParams) => string;
|
|
12
14
|
/**
|
|
@@ -4,6 +4,8 @@ export function isLeaf(node) {
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* A function used to process headerClassName params.
|
|
7
|
+
* @param {GridColumnGroupHeaderParams} params The parameters of the column group header.
|
|
8
|
+
* @returns {string} The class name to be added to the column group header cell.
|
|
7
9
|
*/
|
|
8
10
|
|
|
9
11
|
/**
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { GridColumnHeaderParams } from "./params/gridColumnHeaderParams.js";
|
|
2
2
|
/**
|
|
3
3
|
* A function used to process headerClassName params.
|
|
4
|
+
* @param {GridColumnHeaderParams} params The parameters of the column header.
|
|
5
|
+
* @returns {string} The class name to be added to the column header cell.
|
|
4
6
|
*/
|
|
5
7
|
export type GridColumnHeaderClassFn = (params: GridColumnHeaderParams) => string;
|
|
6
8
|
/**
|
package/esm/models/gridRows.d.ts
CHANGED
|
@@ -173,6 +173,8 @@ export interface GridRowEntry<R extends GridValidRowModel = GridValidRowModel> {
|
|
|
173
173
|
}
|
|
174
174
|
/**
|
|
175
175
|
* The function to retrieve the id of a [[GridRowModel]].
|
|
176
|
+
* @param {R} row The row model.
|
|
177
|
+
* @returns {GridRowId} The id of the row.
|
|
176
178
|
*/
|
|
177
179
|
export type GridRowIdGetter<R extends GridValidRowModel = GridValidRowModel> = (row: R) => GridRowId;
|
|
178
180
|
export {};
|
|
@@ -9,6 +9,11 @@ export interface GridSortCellParams<V = any> {
|
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
11
|
* The type of the sort comparison function.
|
|
12
|
+
* @param {V} v1 The first value to compare.
|
|
13
|
+
* @param {V} v2 The second value to compare.
|
|
14
|
+
* @param {GridSortCellParams<V>} cellParams1 The parameters of the first cell.
|
|
15
|
+
* @param {GridSortCellParams<V>} cellParams2 The parameters of the second cell.
|
|
16
|
+
* @returns {number} The result of the comparison.
|
|
12
17
|
*/
|
|
13
18
|
export type GridComparatorFn<V = any> = (v1: V, v2: V, cellParams1: GridSortCellParams<V>, cellParams2: GridSortCellParams<V>) => number;
|
|
14
19
|
/**
|
|
@@ -3,7 +3,7 @@ import type { GridColDef } from "../colDef/gridColDef.js";
|
|
|
3
3
|
/**
|
|
4
4
|
* Object passed as parameter in the row callbacks.
|
|
5
5
|
* @demos
|
|
6
|
-
* - [Master
|
|
6
|
+
* - [Master-detail row panels](/x/react-data-grid/master-detail/)
|
|
7
7
|
*/
|
|
8
8
|
export interface GridRowParams<R extends GridValidRowModel = any> {
|
|
9
9
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Object passed as parameter in the row callbacks.
|
|
3
3
|
* @demos
|
|
4
|
-
* - [Master
|
|
4
|
+
* - [Master-detail row panels](/x/react-data-grid/master-detail/)
|
|
5
5
|
*/
|
|
6
6
|
/**
|
|
7
7
|
* Object passed as parameter in the row `getRowClassName` callback prop.
|
|
@@ -1,23 +1,15 @@
|
|
|
1
1
|
import { RefObject } from '@mui/x-internals/types';
|
|
2
|
-
import {
|
|
2
|
+
import { CreateSelectorFunction } from '@mui/x-internals/store';
|
|
3
3
|
export interface OutputSelector<State, Args, Result> {
|
|
4
4
|
(apiRef: RefObject<{
|
|
5
5
|
state: State;
|
|
6
6
|
} | null>, args?: Args): Result;
|
|
7
7
|
}
|
|
8
|
-
type StateFromSelector<T> = T extends ((first: infer F, ...args: any[]) => any) ? F extends RefObject<{
|
|
9
|
-
state: infer F2;
|
|
10
|
-
} | null> ? F2 : F : never;
|
|
11
|
-
type StateFromSelectorList<Selectors extends readonly any[]> = Selectors extends [f: infer F, ...other: infer R] ? StateFromSelector<F> extends StateFromSelectorList<R> ? StateFromSelector<F> : StateFromSelectorList<R> : {};
|
|
12
|
-
type SelectorResultArrayWithArgs<Selectors extends ReadonlyArray<Selector<any>>, Args> = [...SelectorResultArray<Selectors>, Args];
|
|
13
|
-
type SelectorArgs<Selectors extends ReadonlyArray<Selector<any>>, Args, Result> = [selectors: [...Selectors], combiner: (...args: SelectorResultArrayWithArgs<Selectors, Args>) => Result] | [...Selectors, (...args: SelectorResultArrayWithArgs<Selectors, Args>) => Result];
|
|
14
|
-
type CreateSelectorFunction = <Selectors extends ReadonlyArray<Selector<any>>, Args, Result>(...items: SelectorArgs<Selectors, Args, Result>) => OutputSelector<StateFromSelectorList<Selectors>, Args, Result>;
|
|
15
8
|
export declare const createSelector: CreateSelectorFunction;
|
|
9
|
+
export declare const createSelectorMemoized: CreateSelectorFunction;
|
|
16
10
|
/**
|
|
17
11
|
* Used to create the root selector for a feature. It assumes that the state is already initialized
|
|
18
12
|
* and strips from the types the possibility of `apiRef` being `null`.
|
|
19
13
|
* Users are warned about this in our documentation https://mui.com/x/react-data-grid/state/#direct-selector-access
|
|
20
14
|
*/
|
|
21
|
-
export declare const createRootSelector: <State, Args, Result>(fn: (state: State, args: Args) => Result) => OutputSelector<State, Args, Result>;
|
|
22
|
-
export declare const createSelectorMemoized: CreateSelectorFunction;
|
|
23
|
-
export {};
|
|
15
|
+
export declare const createRootSelector: <State, Args, Result>(fn: (state: State, args: Args) => Result) => OutputSelector<State, Args, Result>;
|
|
@@ -1,61 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
argsMemoize: customWeakMapMemoize
|
|
11
|
-
});
|
|
12
|
-
const cache = new WeakMap();
|
|
13
|
-
export const createSelector = (a, b, c, d, e, f, ...other) => {
|
|
14
|
-
if (other.length > 0) {
|
|
15
|
-
throw new Error('Unsupported number of selectors');
|
|
16
|
-
}
|
|
17
|
-
let selector;
|
|
18
|
-
|
|
19
|
-
// eslint-disable-next-line id-denylist
|
|
20
|
-
if (a && b && c && d && e && f) {
|
|
21
|
-
selector = (apiRef, args) => {
|
|
22
|
-
const va = a(apiRef, args);
|
|
23
|
-
const vb = b(apiRef, args);
|
|
24
|
-
const vc = c(apiRef, args);
|
|
25
|
-
const vd = d(apiRef, args);
|
|
26
|
-
const ve = e(apiRef, args);
|
|
27
|
-
return f(va, vb, vc, vd, ve, args);
|
|
28
|
-
};
|
|
29
|
-
// eslint-disable-next-line id-denylist
|
|
30
|
-
} else if (a && b && c && d && e) {
|
|
31
|
-
selector = (apiRef, args) => {
|
|
32
|
-
const va = a(apiRef, args);
|
|
33
|
-
const vb = b(apiRef, args);
|
|
34
|
-
const vc = c(apiRef, args);
|
|
35
|
-
const vd = d(apiRef, args);
|
|
36
|
-
return e(va, vb, vc, vd, args);
|
|
37
|
-
};
|
|
38
|
-
} else if (a && b && c && d) {
|
|
39
|
-
selector = (apiRef, args) => {
|
|
40
|
-
const va = a(apiRef, args);
|
|
41
|
-
const vb = b(apiRef, args);
|
|
42
|
-
const vc = c(apiRef, args);
|
|
43
|
-
return d(va, vb, vc, args);
|
|
44
|
-
};
|
|
45
|
-
} else if (a && b && c) {
|
|
46
|
-
selector = (apiRef, args) => {
|
|
47
|
-
const va = a(apiRef, args);
|
|
48
|
-
const vb = b(apiRef, args);
|
|
49
|
-
return c(va, vb, args);
|
|
50
|
-
};
|
|
51
|
-
} else if (a && b) {
|
|
52
|
-
selector = (apiRef, args) => {
|
|
53
|
-
const va = a(apiRef, args);
|
|
54
|
-
return b(va, args);
|
|
55
|
-
};
|
|
56
|
-
} else {
|
|
57
|
-
throw new Error('Missing arguments');
|
|
58
|
-
}
|
|
1
|
+
import { createSelector as baseCreateSelector, createSelectorMemoized as baseCreateSelectorMemoized } from '@mui/x-internals/store';
|
|
2
|
+
export const createSelector = (...args) => {
|
|
3
|
+
const baseSelector = baseCreateSelector(...args);
|
|
4
|
+
const selector = (apiRef, a1, a2, a3) => baseSelector(unwrapIfNeeded(apiRef), a1, a2, a3);
|
|
5
|
+
return selector;
|
|
6
|
+
};
|
|
7
|
+
export const createSelectorMemoized = (...args) => {
|
|
8
|
+
const baseSelector = baseCreateSelectorMemoized(...args);
|
|
9
|
+
const selector = (apiRef, a1, a2, a3) => baseSelector(unwrapIfNeeded(apiRef), a1, a2, a3);
|
|
59
10
|
return selector;
|
|
60
11
|
};
|
|
61
12
|
|
|
@@ -64,31 +15,10 @@ export const createSelector = (a, b, c, d, e, f, ...other) => {
|
|
|
64
15
|
* and strips from the types the possibility of `apiRef` being `null`.
|
|
65
16
|
* Users are warned about this in our documentation https://mui.com/x/react-data-grid/state/#direct-selector-access
|
|
66
17
|
*/
|
|
67
|
-
export const createRootSelector = fn => (apiRef, args) => fn(apiRef
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
if (cacheArgs && cacheFn) {
|
|
75
|
-
if (!argsEqual(cacheFn.selectorArgs, selectorArgs)) {
|
|
76
|
-
const reselectArgs = selectorArgs !== undefined ? [...args.slice(0, args.length - 1), () => selectorArgs, args[args.length - 1]] : args;
|
|
77
|
-
const fn = reselectCreateSelector(...reselectArgs);
|
|
78
|
-
fn.selectorArgs = selectorArgs;
|
|
79
|
-
cacheArgs.set(args, fn);
|
|
80
|
-
return fn(apiRef, selectorArgs);
|
|
81
|
-
}
|
|
82
|
-
return cacheFn(apiRef, selectorArgs);
|
|
83
|
-
}
|
|
84
|
-
const reselectArgs = selectorArgs !== undefined ? [...args.slice(0, args.length - 1), () => selectorArgs, args[args.length - 1]] : args;
|
|
85
|
-
const fn = reselectCreateSelector(...reselectArgs);
|
|
86
|
-
fn.selectorArgs = selectorArgs;
|
|
87
|
-
if (!cacheArgsInit) {
|
|
88
|
-
cache.set(cacheKey, cacheArgs);
|
|
89
|
-
}
|
|
90
|
-
cacheArgs.set(args, fn);
|
|
91
|
-
return fn(apiRef, selectorArgs);
|
|
92
|
-
};
|
|
93
|
-
return selector;
|
|
94
|
-
};
|
|
18
|
+
export const createRootSelector = fn => (apiRef, args) => fn(unwrapIfNeeded(apiRef), args);
|
|
19
|
+
function unwrapIfNeeded(refOrState) {
|
|
20
|
+
if ('current' in refOrState) {
|
|
21
|
+
return refOrState.current.state;
|
|
22
|
+
}
|
|
23
|
+
return refOrState;
|
|
24
|
+
}
|
|
@@ -8,7 +8,7 @@ exports.unwrapPrivateAPI = unwrapPrivateAPI;
|
|
|
8
8
|
exports.useGridApiInitialization = useGridApiInitialization;
|
|
9
9
|
var React = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _EventManager = require("@mui/x-internals/EventManager");
|
|
11
|
-
var
|
|
11
|
+
var _store = require("@mui/x-internals/store");
|
|
12
12
|
var _useGridApiMethod = require("../utils/useGridApiMethod");
|
|
13
13
|
var _signature = require("../../constants/signature");
|
|
14
14
|
const SYMBOL_API_PRIVATE = Symbol('mui.api_private');
|
|
@@ -27,7 +27,7 @@ function createPrivateAPI(publicApiRef) {
|
|
|
27
27
|
const state = {};
|
|
28
28
|
const privateApi = {
|
|
29
29
|
state,
|
|
30
|
-
store:
|
|
30
|
+
store: _store.Store.create(state),
|
|
31
31
|
instanceId: {
|
|
32
32
|
id: globalId
|
|
33
33
|
}
|
|
@@ -4,9 +4,17 @@ import { GridStateCommunity } from "../../../models/gridStateCommunity.js";
|
|
|
4
4
|
* @ignore - do not document.
|
|
5
5
|
*/
|
|
6
6
|
export declare const gridColumnGroupingSelector: import("@mui/x-data-grid").OutputSelector<GridStateCommunity, unknown, import("@mui/x-data-grid").GridColumnsGroupingState>;
|
|
7
|
-
export declare const gridColumnGroupsUnwrappedModelSelector:
|
|
7
|
+
export declare const gridColumnGroupsUnwrappedModelSelector: (args_0: import("react").RefObject<{
|
|
8
|
+
state: GridStateCommunity;
|
|
9
|
+
} | null>) => {
|
|
8
10
|
[columnField: string]: string[];
|
|
9
|
-
}
|
|
10
|
-
export declare const gridColumnGroupsLookupSelector:
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
};
|
|
12
|
+
export declare const gridColumnGroupsLookupSelector: (args_0: import("react").RefObject<{
|
|
13
|
+
state: GridStateCommunity;
|
|
14
|
+
} | null>) => import("./gridColumnGroupsInterfaces.js").GridColumnGroupLookup;
|
|
15
|
+
export declare const gridColumnGroupsHeaderStructureSelector: (args_0: import("react").RefObject<{
|
|
16
|
+
state: GridStateCommunity;
|
|
17
|
+
} | null>) => import("./gridColumnGroupsInterfaces.js").GridGroupingStructure[][];
|
|
18
|
+
export declare const gridColumnGroupsHeaderMaxDepthSelector: (args_0: import("react").RefObject<{
|
|
19
|
+
state: GridStateCommunity;
|
|
20
|
+
} | null>) => number;
|
|
@@ -31,7 +31,7 @@ export interface GetHeadersParams {
|
|
|
31
31
|
type OwnerState = DataGridProcessedProps;
|
|
32
32
|
export declare const GridColumnHeaderRow: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
|
|
33
33
|
ownerState: OwnerState;
|
|
34
|
-
}, Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.
|
|
34
|
+
}, Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.HTMLAttributes<HTMLDivElement> | keyof React.ClassAttributes<HTMLDivElement>>, {}>;
|
|
35
35
|
export declare const useGridColumnHeaders: (props: UseGridColumnHeadersProps) => {
|
|
36
36
|
renderContext: GridColumnsRenderContext;
|
|
37
37
|
leftRenderContext: {
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import { GridStateCommunity } from "../../../models/gridStateCommunity.js";
|
|
2
2
|
export declare const gridColumnResizeSelector: import("@mui/x-data-grid").OutputSelector<GridStateCommunity, unknown, import("@mui/x-data-grid").GridColumnResizeState>;
|
|
3
|
-
export declare const gridResizingColumnFieldSelector:
|
|
3
|
+
export declare const gridResizingColumnFieldSelector: (args_0: import("react").RefObject<{
|
|
4
|
+
state: GridStateCommunity;
|
|
5
|
+
} | null>) => string;
|
|
@@ -9,40 +9,54 @@ export declare const gridColumnsStateSelector: import("@mui/x-data-grid").Output
|
|
|
9
9
|
* Get an array of column fields in the order rendered on screen.
|
|
10
10
|
* @category Columns
|
|
11
11
|
*/
|
|
12
|
-
export declare const gridColumnFieldsSelector:
|
|
12
|
+
export declare const gridColumnFieldsSelector: (args_0: import("react").RefObject<{
|
|
13
|
+
state: GridStateCommunity;
|
|
14
|
+
} | null>) => string[];
|
|
13
15
|
/**
|
|
14
16
|
* Get the columns as a lookup (an object containing the field for keys and the definition for values).
|
|
15
17
|
* @category Columns
|
|
16
18
|
*/
|
|
17
|
-
export declare const gridColumnLookupSelector:
|
|
19
|
+
export declare const gridColumnLookupSelector: (args_0: import("react").RefObject<{
|
|
20
|
+
state: GridStateCommunity;
|
|
21
|
+
} | null>) => GridColumnLookup;
|
|
18
22
|
/**
|
|
19
23
|
* Get an array of column definitions in the order rendered on screen..
|
|
20
24
|
* @category Columns
|
|
21
25
|
*/
|
|
22
|
-
export declare const gridColumnDefinitionsSelector:
|
|
26
|
+
export declare const gridColumnDefinitionsSelector: (args_0: import("react").RefObject<{
|
|
27
|
+
state: GridStateCommunity;
|
|
28
|
+
} | null>) => import("../../../internals/index.js").GridStateColDef[];
|
|
23
29
|
/**
|
|
24
30
|
* Get the column visibility model, containing the visibility status of each column.
|
|
25
31
|
* If a column is not registered in the model, it is visible.
|
|
26
32
|
* @category Visible Columns
|
|
27
33
|
*/
|
|
28
|
-
export declare const gridColumnVisibilityModelSelector:
|
|
34
|
+
export declare const gridColumnVisibilityModelSelector: (args_0: import("react").RefObject<{
|
|
35
|
+
state: GridStateCommunity;
|
|
36
|
+
} | null>) => import("@mui/x-data-grid").GridColumnVisibilityModel;
|
|
29
37
|
/**
|
|
30
38
|
* Get the "initial" column visibility model, containing the visibility status of each column.
|
|
31
39
|
* It is updated when the `columns` prop is updated or when `updateColumns` API method is called.
|
|
32
40
|
* If a column is not registered in the model, it is visible.
|
|
33
41
|
* @category Visible Columns
|
|
34
42
|
*/
|
|
35
|
-
export declare const gridInitialColumnVisibilityModelSelector:
|
|
43
|
+
export declare const gridInitialColumnVisibilityModelSelector: (args_0: import("react").RefObject<{
|
|
44
|
+
state: GridStateCommunity;
|
|
45
|
+
} | null>) => import("@mui/x-data-grid").GridColumnVisibilityModel;
|
|
36
46
|
/**
|
|
37
47
|
* Get the visible columns as a lookup (an object containing the field for keys and the definition for values).
|
|
38
48
|
* @category Visible Columns
|
|
39
49
|
*/
|
|
40
|
-
export declare const gridVisibleColumnDefinitionsSelector:
|
|
50
|
+
export declare const gridVisibleColumnDefinitionsSelector: (args_0: import("react").RefObject<{
|
|
51
|
+
state: GridStateCommunity;
|
|
52
|
+
} | null>) => import("../../../internals/index.js").GridStateColDef[];
|
|
41
53
|
/**
|
|
42
54
|
* Get the field of each visible column.
|
|
43
55
|
* @category Visible Columns
|
|
44
56
|
*/
|
|
45
|
-
export declare const gridVisibleColumnFieldsSelector:
|
|
57
|
+
export declare const gridVisibleColumnFieldsSelector: (args_0: import("react").RefObject<{
|
|
58
|
+
state: GridStateCommunity;
|
|
59
|
+
} | null>) => string[];
|
|
46
60
|
/**
|
|
47
61
|
* Get the visible pinned columns model.
|
|
48
62
|
* @category Visible Columns
|
|
@@ -53,36 +67,48 @@ export declare const gridPinnedColumnsSelector: import("@mui/x-data-grid").Outpu
|
|
|
53
67
|
* @category Pinned Columns
|
|
54
68
|
* @ignore - Do not document
|
|
55
69
|
*/
|
|
56
|
-
export declare const gridExistingPinnedColumnSelector: import("
|
|
70
|
+
export declare const gridExistingPinnedColumnSelector: (args_0: import("react").RefObject<{
|
|
71
|
+
state: GridStateCommunity;
|
|
72
|
+
} | null>) => {
|
|
57
73
|
left: string[];
|
|
58
74
|
right: string[];
|
|
59
|
-
}
|
|
75
|
+
};
|
|
60
76
|
/**
|
|
61
77
|
* Get the visible pinned columns.
|
|
62
78
|
* @category Visible Columns
|
|
63
79
|
*/
|
|
64
|
-
export declare const gridVisiblePinnedColumnDefinitionsSelector: import("
|
|
80
|
+
export declare const gridVisiblePinnedColumnDefinitionsSelector: (args_0: import("react").RefObject<{
|
|
81
|
+
state: GridStateCommunity;
|
|
82
|
+
} | null>) => {
|
|
65
83
|
left: import("../../../internals/index.js").GridStateColDef[];
|
|
66
84
|
right: import("../../../internals/index.js").GridStateColDef[];
|
|
67
|
-
}
|
|
85
|
+
};
|
|
68
86
|
/**
|
|
69
87
|
* Get the left position in pixel of each visible columns relative to the left of the first column.
|
|
70
88
|
* @category Visible Columns
|
|
71
89
|
*/
|
|
72
|
-
export declare const gridColumnPositionsSelector:
|
|
90
|
+
export declare const gridColumnPositionsSelector: (args_0: import("react").RefObject<{
|
|
91
|
+
state: GridStateCommunity;
|
|
92
|
+
} | null>) => number[];
|
|
73
93
|
/**
|
|
74
94
|
* Get the filterable columns as an array.
|
|
75
95
|
* @category Columns
|
|
76
96
|
*/
|
|
77
|
-
export declare const gridFilterableColumnDefinitionsSelector:
|
|
97
|
+
export declare const gridFilterableColumnDefinitionsSelector: (args_0: import("react").RefObject<{
|
|
98
|
+
state: GridStateCommunity;
|
|
99
|
+
} | null>) => import("../../../internals/index.js").GridStateColDef[];
|
|
78
100
|
/**
|
|
79
101
|
* Get the filterable columns as a lookup (an object containing the field for keys and the definition for values).
|
|
80
102
|
* @category Columns
|
|
81
103
|
*/
|
|
82
|
-
export declare const gridFilterableColumnLookupSelector:
|
|
104
|
+
export declare const gridFilterableColumnLookupSelector: (args_0: import("react").RefObject<{
|
|
105
|
+
state: GridStateCommunity;
|
|
106
|
+
} | null>) => GridColumnLookup;
|
|
83
107
|
/**
|
|
84
108
|
* Checks if some column has a colSpan field.
|
|
85
109
|
* @category Columns
|
|
86
110
|
* @ignore - Do not document
|
|
87
111
|
*/
|
|
88
|
-
export declare const gridHasColSpanSelector:
|
|
112
|
+
export declare const gridHasColSpanSelector: (args_0: import("react").RefObject<{
|
|
113
|
+
state: GridStateCommunity;
|
|
114
|
+
} | null>) => boolean;
|
|
@@ -166,7 +166,9 @@ const hydrateColumnsWidth = (rawState, dimensions) => {
|
|
|
166
166
|
flexColumns
|
|
167
167
|
});
|
|
168
168
|
Object.keys(computedColumnWidths).forEach(field => {
|
|
169
|
-
columnsLookup[field]
|
|
169
|
+
columnsLookup[field] = (0, _extends2.default)({}, columnsLookup[field], {
|
|
170
|
+
computedWidth: computedColumnWidths[field].computedWidth
|
|
171
|
+
});
|
|
170
172
|
});
|
|
171
173
|
}
|
|
172
174
|
return (0, _extends2.default)({}, rawState, {
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
export declare const gridGetRowsParamsSelector:
|
|
1
|
+
export declare const gridGetRowsParamsSelector: (args_0: import("react").RefObject<{
|
|
2
|
+
state: import("../../../models/gridStateCommunity.js").GridStateCommunity;
|
|
3
|
+
} | null>) => {
|
|
2
4
|
groupKeys: never[];
|
|
3
5
|
paginationModel: import("@mui/x-data-grid").GridPaginationModel;
|
|
4
6
|
sortModel: import("@mui/x-data-grid").GridSortModel;
|
|
5
7
|
filterModel: import("@mui/x-data-grid").GridFilterModel;
|
|
6
8
|
start: number;
|
|
7
9
|
end: number;
|
|
8
|
-
}
|
|
10
|
+
};
|
|
@@ -181,6 +181,10 @@ const useGridDataSourceBase = (apiRef, props, options = {}) => {
|
|
|
181
181
|
apiRef.current.dataSource.cache.clear();
|
|
182
182
|
apiRef.current.dataSource.fetchRows();
|
|
183
183
|
}
|
|
184
|
+
return () => {
|
|
185
|
+
// ignore the current request on unmount
|
|
186
|
+
lastRequestId.current += 1;
|
|
187
|
+
};
|
|
184
188
|
}, [apiRef, props.dataSource]);
|
|
185
189
|
return {
|
|
186
190
|
api: {
|
|
@@ -32,7 +32,7 @@ class CacheChunkManager {
|
|
|
32
32
|
|
|
33
33
|
// split the range into chunks
|
|
34
34
|
const chunkedKeys = [];
|
|
35
|
-
for (let i = key.start; i
|
|
35
|
+
for (let i = key.start; i <= key.end; i += this.chunkSize) {
|
|
36
36
|
const end = Math.min(i + this.chunkSize - 1, key.end);
|
|
37
37
|
chunkedKeys.push((0, _extends2.default)({}, key, {
|
|
38
38
|
start: i,
|
|
@@ -3,4 +3,6 @@ import { GridDensity } from "../../../models/gridDensity.js";
|
|
|
3
3
|
export declare const COMPACT_DENSITY_FACTOR = 0.7;
|
|
4
4
|
export declare const COMFORTABLE_DENSITY_FACTOR = 1.3;
|
|
5
5
|
export declare const gridDensitySelector: import("@mui/x-data-grid").OutputSelector<GridStateCommunity, unknown, GridDensity>;
|
|
6
|
-
export declare const gridDensityFactorSelector: import("
|
|
6
|
+
export declare const gridDensityFactorSelector: (args_0: import("react").RefObject<{
|
|
7
|
+
state: GridStateCommunity;
|
|
8
|
+
} | null>) => number;
|