@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.
Files changed (49) hide show
  1. package/CHANGELOG.md +591 -3
  2. package/{esm/features/colspan.d.ts → features/colspan.d.mts} +4 -4
  3. package/{esm/features/dimensions.d.ts → features/dimensions.d.mts} +2 -2
  4. package/{esm/features/dimensions.js → features/dimensions.mjs} +1 -1
  5. package/features/index.d.mts +5 -0
  6. package/features/index.mjs +5 -0
  7. package/{esm/features/keyboard.d.ts → features/keyboard.d.mts} +1 -1
  8. package/{esm/features/keyboard.js → features/keyboard.mjs} +2 -2
  9. package/{esm/features/rowspan.d.ts → features/rowspan.d.mts} +3 -3
  10. package/features/virtualization/index.d.mts +2 -0
  11. package/features/virtualization/index.mjs +2 -0
  12. package/{esm/features/virtualization/layout.d.ts → features/virtualization/layout.d.mts} +9 -9
  13. package/features/virtualization/layout.js +60 -4
  14. package/{esm/features/virtualization/layout.js → features/virtualization/layout.mjs} +61 -4
  15. package/{esm/features/virtualization/virtualization.d.ts → features/virtualization/virtualization.d.mts} +5 -5
  16. package/features/virtualization/virtualization.js +10 -25
  17. package/{esm/features/virtualization/virtualization.js → features/virtualization/virtualization.mjs} +11 -26
  18. package/index.d.mts +3 -0
  19. package/index.js +1 -1
  20. package/{esm/index.js → index.mjs} +4 -4
  21. package/{esm/models/dimensions.d.ts → models/dimensions.d.mts} +1 -1
  22. package/models/index.d.mts +4 -0
  23. package/models/index.mjs +4 -0
  24. package/{esm/models/rowspan.d.ts → models/rowspan.d.mts} +1 -1
  25. package/package.json +42 -17
  26. package/{esm/useVirtualizer.d.ts → useVirtualizer.d.mts} +20 -20
  27. package/{esm/useVirtualizer.js → useVirtualizer.mjs} +6 -6
  28. package/utils/useRefCallback.d.mts +1 -0
  29. package/utils/useRefCallback.d.ts +1 -0
  30. package/utils/useRefCallback.js +28 -0
  31. package/utils/useRefCallback.mjs +21 -0
  32. package/esm/features/index.d.ts +0 -5
  33. package/esm/features/index.js +0 -5
  34. package/esm/features/virtualization/index.d.ts +0 -2
  35. package/esm/features/virtualization/index.js +0 -2
  36. package/esm/index.d.ts +0 -3
  37. package/esm/models/index.d.ts +0 -4
  38. package/esm/models/index.js +0 -4
  39. package/esm/package.json +0 -1
  40. /package/{esm/constants.d.ts → constants.d.mts} +0 -0
  41. /package/{esm/constants.js → constants.mjs} +0 -0
  42. /package/{esm/features/colspan.js → features/colspan.mjs} +0 -0
  43. /package/{esm/features/rowspan.js → features/rowspan.mjs} +0 -0
  44. /package/{esm/models/colspan.d.ts → models/colspan.d.mts} +0 -0
  45. /package/{esm/models/colspan.js → models/colspan.mjs} +0 -0
  46. /package/{esm/models/core.d.ts → models/core.d.mts} +0 -0
  47. /package/{esm/models/core.js → models/core.mjs} +0 -0
  48. /package/{esm/models/dimensions.js → models/dimensions.mjs} +0 -0
  49. /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.js";
5
- import { Dimensions } from "./features/dimensions.js";
6
- import { Rowspan } from "./features/rowspan.js";
7
- import { Virtualization } from "./features/virtualization/index.js";
8
- import type { Layout } from "./features/virtualization/layout.js";
9
- import type { HeightEntry, RowSpacing } from "./models/dimensions.js";
10
- import type { ColspanParams } from "./features/colspan.js";
11
- import type { DimensionsParams } from "./features/dimensions.js";
12
- import type { VirtualizationParams } from "./features/virtualization/index.js";
13
- import { ColumnWithWidth, FocusedCell, Size, PinnedRows, PinnedColumns, RenderContext, Row, RowEntry } from "./models/index.js";
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.js").RowId) => any;
104
+ getRowHeight: (rowId: import("./models/index.mjs").RowId) => any;
105
105
  setLastMeasuredRowIndex: (index: number) => void;
106
- storeRowHeightMeasurement: (id: import("./models/index.js").RowId, height: number) => void;
106
+ storeRowHeightMeasurement: (id: import("./models/index.mjs").RowId, height: number) => void;
107
107
  hydrateRowsMeta: () => void;
108
- observeRowHeight: (element: Element, rowId: import("./models/index.js").RowId) => () => void | undefined;
109
- rowHasAutoHeight: (id: import("./models/index.js").RowId) => any;
110
- getRowHeightEntry: (rowId: import("./models/index.js").RowId) => any;
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.js").RowId, columnIndex: integer) => import("./models/index.js").CellColSpanInfo;
116
- calculateColSpan: (rowId: import("./models/index.js").RowId, minFirstColumn: integer, maxLastColumn: integer, columns: ColumnWithWidth[]) => void;
117
- getHiddenCellsOrigin: () => Record<import("./models/index.js").RowId, Record<number, number>>;
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.js").RowId, columnIndex: integer) => import("./models/index.js").CellColSpanInfo | undefined;
125
- calculateColSpan: (rowId: import("./models/index.js").RowId, minFirstColumn: integer, maxLastColumn: integer, columns: ColumnWithWidth[]) => void;
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.js";
5
- import { Dimensions } from "./features/dimensions.js";
6
- import { Keyboard } from "./features/keyboard.js";
7
- import { Rowspan } from "./features/rowspan.js";
8
- import { Virtualization } from "./features/virtualization/index.js";
9
- import { DEFAULT_PARAMS } from "./constants.js";
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
+ }
@@ -1,5 +0,0 @@
1
- export * from "./colspan.js";
2
- export * from "./dimensions.js";
3
- export * from "./keyboard.js";
4
- export * from "./rowspan.js";
5
- export * from "./virtualization/index.js";
@@ -1,5 +0,0 @@
1
- export * from "./colspan.js";
2
- export * from "./dimensions.js";
3
- export * from "./keyboard.js";
4
- export * from "./rowspan.js";
5
- export * from "./virtualization/index.js";
@@ -1,2 +0,0 @@
1
- export * from "./layout.js";
2
- export * from "./virtualization.js";
@@ -1,2 +0,0 @@
1
- export * from "./layout.js";
2
- export * from "./virtualization.js";
package/esm/index.d.ts DELETED
@@ -1,3 +0,0 @@
1
- export * from "./useVirtualizer.js";
2
- export * from "./features/index.js";
3
- export * from "./constants.js";
@@ -1,4 +0,0 @@
1
- export * from "./core.js";
2
- export * from "./colspan.js";
3
- export * from "./dimensions.js";
4
- export * from "./rowspan.js";
@@ -1,4 +0,0 @@
1
- export * from "./core.js";
2
- export * from "./colspan.js";
3
- export * from "./dimensions.js";
4
- export * from "./rowspan.js";
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