@mui/x-virtualizer 0.3.3 → 1.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +591 -3
- package/{esm/features/colspan.d.ts → features/colspan.d.mts} +4 -4
- package/{esm/features/dimensions.d.ts → features/dimensions.d.mts} +2 -2
- package/{esm/features/dimensions.js → features/dimensions.mjs} +1 -1
- package/features/index.d.mts +5 -0
- package/features/index.mjs +5 -0
- package/{esm/features/keyboard.d.ts → features/keyboard.d.mts} +1 -1
- package/{esm/features/keyboard.js → features/keyboard.mjs} +2 -2
- package/{esm/features/rowspan.d.ts → features/rowspan.d.mts} +3 -3
- package/features/virtualization/index.d.mts +2 -0
- package/features/virtualization/index.mjs +2 -0
- package/{esm/features/virtualization/layout.d.ts → features/virtualization/layout.d.mts} +9 -9
- package/features/virtualization/layout.js +60 -4
- package/{esm/features/virtualization/layout.js → features/virtualization/layout.mjs} +61 -4
- package/{esm/features/virtualization/virtualization.d.ts → features/virtualization/virtualization.d.mts} +5 -5
- package/features/virtualization/virtualization.js +10 -25
- package/{esm/features/virtualization/virtualization.js → features/virtualization/virtualization.mjs} +11 -26
- package/index.d.mts +3 -0
- package/index.js +1 -1
- package/{esm/index.js → index.mjs} +4 -4
- package/{esm/models/dimensions.d.ts → models/dimensions.d.mts} +1 -1
- package/models/index.d.mts +4 -0
- package/models/index.mjs +4 -0
- package/{esm/models/rowspan.d.ts → models/rowspan.d.mts} +1 -1
- package/package.json +42 -17
- package/{esm/useVirtualizer.d.ts → useVirtualizer.d.mts} +20 -20
- package/{esm/useVirtualizer.js → useVirtualizer.mjs} +6 -6
- package/utils/useRefCallback.d.mts +1 -0
- package/utils/useRefCallback.d.ts +1 -0
- package/utils/useRefCallback.js +28 -0
- package/utils/useRefCallback.mjs +21 -0
- package/esm/features/index.d.ts +0 -5
- package/esm/features/index.js +0 -5
- package/esm/features/virtualization/index.d.ts +0 -2
- package/esm/features/virtualization/index.js +0 -2
- package/esm/index.d.ts +0 -3
- package/esm/models/index.d.ts +0 -4
- package/esm/models/index.js +0 -4
- package/esm/package.json +0 -1
- /package/{esm/constants.d.ts → constants.d.mts} +0 -0
- /package/{esm/constants.js → constants.mjs} +0 -0
- /package/{esm/features/colspan.js → features/colspan.mjs} +0 -0
- /package/{esm/features/rowspan.js → features/rowspan.mjs} +0 -0
- /package/{esm/models/colspan.d.ts → models/colspan.d.mts} +0 -0
- /package/{esm/models/colspan.js → models/colspan.mjs} +0 -0
- /package/{esm/models/core.d.ts → models/core.d.mts} +0 -0
- /package/{esm/models/core.js → models/core.mjs} +0 -0
- /package/{esm/models/dimensions.js → models/dimensions.mjs} +0 -0
- /package/{esm/models/rowspan.js → models/rowspan.mjs} +0 -0
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { integer } from '@mui/x-internals/types';
|
|
3
3
|
import { Store } from '@mui/x-internals/store';
|
|
4
|
-
import { Colspan } from "./features/colspan.
|
|
5
|
-
import { Dimensions } from "./features/dimensions.
|
|
6
|
-
import { Rowspan } from "./features/rowspan.
|
|
7
|
-
import { Virtualization } from "./features/virtualization/index.
|
|
8
|
-
import type { Layout } from "./features/virtualization/layout.
|
|
9
|
-
import type { HeightEntry, RowSpacing } from "./models/dimensions.
|
|
10
|
-
import type { ColspanParams } from "./features/colspan.
|
|
11
|
-
import type { DimensionsParams } from "./features/dimensions.
|
|
12
|
-
import type { VirtualizationParams } from "./features/virtualization/index.
|
|
13
|
-
import { ColumnWithWidth, FocusedCell, Size, PinnedRows, PinnedColumns, RenderContext, Row, RowEntry } from "./models/index.
|
|
4
|
+
import { Colspan } from "./features/colspan.mjs";
|
|
5
|
+
import { Dimensions } from "./features/dimensions.mjs";
|
|
6
|
+
import { Rowspan } from "./features/rowspan.mjs";
|
|
7
|
+
import { Virtualization } from "./features/virtualization/index.mjs";
|
|
8
|
+
import type { Layout } from "./features/virtualization/layout.mjs";
|
|
9
|
+
import type { HeightEntry, RowSpacing } from "./models/dimensions.mjs";
|
|
10
|
+
import type { ColspanParams } from "./features/colspan.mjs";
|
|
11
|
+
import type { DimensionsParams } from "./features/dimensions.mjs";
|
|
12
|
+
import type { VirtualizationParams } from "./features/virtualization/index.mjs";
|
|
13
|
+
import { ColumnWithWidth, FocusedCell, Size, PinnedRows, PinnedColumns, RenderContext, Row, RowEntry } from "./models/index.mjs";
|
|
14
14
|
export type Virtualizer = ReturnType<typeof useVirtualizer>;
|
|
15
15
|
export type VirtualScrollerCompat<L extends Layout = Layout> = Virtualization.State<L>['getters'];
|
|
16
16
|
export type BaseState<L extends Layout = Layout> = Virtualization.State<L> & Dimensions.State;
|
|
@@ -101,28 +101,28 @@ export declare const useVirtualizer: <L extends Layout = Layout>(params: Virtual
|
|
|
101
101
|
updateDimensions: (firstUpdate?: boolean) => void;
|
|
102
102
|
debouncedUpdateDimensions: (((firstUpdate?: boolean) => void) & import("@mui/x-internals/throttle").Cancelable) | undefined;
|
|
103
103
|
rowsMeta: {
|
|
104
|
-
getRowHeight: (rowId: import("./models/index.
|
|
104
|
+
getRowHeight: (rowId: import("./models/index.mjs").RowId) => any;
|
|
105
105
|
setLastMeasuredRowIndex: (index: number) => void;
|
|
106
|
-
storeRowHeightMeasurement: (id: import("./models/index.
|
|
106
|
+
storeRowHeightMeasurement: (id: import("./models/index.mjs").RowId, height: number) => void;
|
|
107
107
|
hydrateRowsMeta: () => void;
|
|
108
|
-
observeRowHeight: (element: Element, rowId: import("./models/index.
|
|
109
|
-
rowHasAutoHeight: (id: import("./models/index.
|
|
110
|
-
getRowHeightEntry: (rowId: import("./models/index.
|
|
108
|
+
observeRowHeight: (element: Element, rowId: import("./models/index.mjs").RowId) => () => void | undefined;
|
|
109
|
+
rowHasAutoHeight: (id: import("./models/index.mjs").RowId) => any;
|
|
110
|
+
getRowHeightEntry: (rowId: import("./models/index.mjs").RowId) => any;
|
|
111
111
|
getLastMeasuredRowIndex: () => number;
|
|
112
112
|
resetRowHeights: () => void;
|
|
113
113
|
};
|
|
114
114
|
} & {
|
|
115
|
-
getCellColSpanInfo: (rowId: import("./models/index.
|
|
116
|
-
calculateColSpan: (rowId: import("./models/index.
|
|
117
|
-
getHiddenCellsOrigin: () => Record<import("./models/index.
|
|
115
|
+
getCellColSpanInfo: (rowId: import("./models/index.mjs").RowId, columnIndex: integer) => import("./models/index.mjs").CellColSpanInfo;
|
|
116
|
+
calculateColSpan: (rowId: import("./models/index.mjs").RowId, minFirstColumn: integer, maxLastColumn: integer, columns: ColumnWithWidth[]) => void;
|
|
117
|
+
getHiddenCellsOrigin: () => Record<import("./models/index.mjs").RowId, Record<number, number>>;
|
|
118
118
|
getters: any;
|
|
119
119
|
setPanels: React.Dispatch<React.SetStateAction<Readonly<Map<any, React.ReactNode>>>>;
|
|
120
120
|
forceUpdateRenderContext: () => void;
|
|
121
121
|
scheduleUpdateRenderContext: () => void;
|
|
122
122
|
} & {
|
|
123
123
|
resetColSpan: () => void;
|
|
124
|
-
getCellColSpanInfo: (rowId: import("./models/index.
|
|
125
|
-
calculateColSpan: (rowId: import("./models/index.
|
|
124
|
+
getCellColSpanInfo: (rowId: import("./models/index.mjs").RowId, columnIndex: integer) => import("./models/index.mjs").CellColSpanInfo | undefined;
|
|
125
|
+
calculateColSpan: (rowId: import("./models/index.mjs").RowId, minFirstColumn: integer, maxLastColumn: integer, columns: ColumnWithWidth[]) => void;
|
|
126
126
|
} & {
|
|
127
127
|
getHiddenCellsOrigin: () => Record<number, Record<number, number>>;
|
|
128
128
|
} & {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import useLazyRef from '@mui/utils/useLazyRef';
|
|
3
3
|
import { Store } from '@mui/x-internals/store';
|
|
4
|
-
import { Colspan } from "./features/colspan.
|
|
5
|
-
import { Dimensions } from "./features/dimensions.
|
|
6
|
-
import { Keyboard } from "./features/keyboard.
|
|
7
|
-
import { Rowspan } from "./features/rowspan.
|
|
8
|
-
import { Virtualization } from "./features/virtualization/index.
|
|
9
|
-
import { DEFAULT_PARAMS } from "./constants.
|
|
4
|
+
import { Colspan } from "./features/colspan.mjs";
|
|
5
|
+
import { Dimensions } from "./features/dimensions.mjs";
|
|
6
|
+
import { Keyboard } from "./features/keyboard.mjs";
|
|
7
|
+
import { Rowspan } from "./features/rowspan.mjs";
|
|
8
|
+
import { Virtualization } from "./features/virtualization/index.mjs";
|
|
9
|
+
import { DEFAULT_PARAMS } from "./constants.mjs";
|
|
10
10
|
|
|
11
11
|
/* eslint-disable jsdoc/require-param-type */
|
|
12
12
|
/* eslint-disable jsdoc/require-param-description */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function useRefCallback(fn: (node: HTMLDivElement) => (() => void) | undefined): (node: HTMLDivElement | null) => (() => void | undefined) | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function useRefCallback(fn: (node: HTMLDivElement) => (() => void) | undefined): (node: HTMLDivElement | null) => (() => void | undefined) | undefined;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
exports.default = useRefCallback;
|
|
10
|
+
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _useEventCallback = _interopRequireDefault(require("@mui/utils/useEventCallback"));
|
|
12
|
+
var _reactMajor = _interopRequireDefault(require("@mui/x-internals/reactMajor"));
|
|
13
|
+
function useRefCallback(fn) {
|
|
14
|
+
const refCleanup = React.useRef(undefined);
|
|
15
|
+
const refCallback = (0, _useEventCallback.default)(node => {
|
|
16
|
+
if (!node) {
|
|
17
|
+
// Cleanup for R18
|
|
18
|
+
refCleanup.current?.();
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
refCleanup.current = fn(node);
|
|
22
|
+
if (_reactMajor.default >= 19) {
|
|
23
|
+
/* eslint-disable-next-line consistent-return */
|
|
24
|
+
return refCleanup.current;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
return refCallback;
|
|
28
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import useEventCallback from '@mui/utils/useEventCallback';
|
|
5
|
+
import reactMajor from '@mui/x-internals/reactMajor';
|
|
6
|
+
export default function useRefCallback(fn) {
|
|
7
|
+
const refCleanup = React.useRef(undefined);
|
|
8
|
+
const refCallback = useEventCallback(node => {
|
|
9
|
+
if (!node) {
|
|
10
|
+
// Cleanup for R18
|
|
11
|
+
refCleanup.current?.();
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
refCleanup.current = fn(node);
|
|
15
|
+
if (reactMajor >= 19) {
|
|
16
|
+
/* eslint-disable-next-line consistent-return */
|
|
17
|
+
return refCleanup.current;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
return refCallback;
|
|
21
|
+
}
|
package/esm/features/index.d.ts
DELETED
package/esm/features/index.js
DELETED
package/esm/index.d.ts
DELETED
package/esm/models/index.d.ts
DELETED
package/esm/models/index.js
DELETED
package/esm/package.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"type":"module","sideEffects":false}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|