@mui/x-virtualizer 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10645 -0
- package/README.md +3 -0
- package/esm/features/colspan.d.ts +28 -0
- package/esm/features/colspan.js +88 -0
- package/esm/features/dimensions.d.ts +41 -0
- package/esm/features/dimensions.js +465 -0
- package/esm/features/index.d.ts +5 -0
- package/esm/features/index.js +5 -0
- package/esm/features/keyboard.d.ts +16 -0
- package/esm/features/keyboard.js +35 -0
- package/esm/features/rowspan.d.ts +25 -0
- package/esm/features/rowspan.js +36 -0
- package/esm/features/virtualization.d.ts +103 -0
- package/esm/features/virtualization.js +844 -0
- package/esm/index.d.ts +2 -0
- package/esm/index.js +9 -0
- package/esm/models/colspan.d.ts +13 -0
- package/esm/models/colspan.js +1 -0
- package/esm/models/core.d.ts +72 -0
- package/esm/models/core.js +43 -0
- package/esm/models/dimensions.d.ts +132 -0
- package/esm/models/dimensions.js +1 -0
- package/esm/models/index.d.ts +4 -0
- package/esm/models/index.js +4 -0
- package/esm/models/rowspan.d.ts +17 -0
- package/esm/models/rowspan.js +1 -0
- package/esm/package.json +1 -0
- package/esm/useVirtualizer.d.ts +193 -0
- package/esm/useVirtualizer.js +26 -0
- package/features/colspan.d.ts +28 -0
- package/features/colspan.js +94 -0
- package/features/dimensions.d.ts +41 -0
- package/features/dimensions.js +472 -0
- package/features/index.d.ts +5 -0
- package/features/index.js +60 -0
- package/features/keyboard.d.ts +16 -0
- package/features/keyboard.js +40 -0
- package/features/rowspan.d.ts +25 -0
- package/features/rowspan.js +42 -0
- package/features/virtualization.d.ts +103 -0
- package/features/virtualization.js +853 -0
- package/index.d.ts +2 -0
- package/index.js +34 -0
- package/models/colspan.d.ts +13 -0
- package/models/colspan.js +5 -0
- package/models/core.d.ts +72 -0
- package/models/core.js +49 -0
- package/models/dimensions.d.ts +132 -0
- package/models/dimensions.js +5 -0
- package/models/index.d.ts +4 -0
- package/models/index.js +49 -0
- package/models/rowspan.d.ts +17 -0
- package/models/rowspan.js +5 -0
- package/package.json +67 -0
- package/useVirtualizer.d.ts +193 -0
- package/useVirtualizer.js +33 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Rowspan = void 0;
|
|
7
|
+
/* eslint-disable import/export, @typescript-eslint/no-redeclare */
|
|
8
|
+
|
|
9
|
+
const EMPTY_RANGE = {
|
|
10
|
+
firstRowIndex: 0,
|
|
11
|
+
lastRowIndex: 0
|
|
12
|
+
};
|
|
13
|
+
const EMPTY_CACHES = {
|
|
14
|
+
spannedCells: {},
|
|
15
|
+
hiddenCells: {},
|
|
16
|
+
hiddenCellOriginMap: {}
|
|
17
|
+
};
|
|
18
|
+
const selectors = {
|
|
19
|
+
state: state => state.rowSpanning,
|
|
20
|
+
hiddenCells: state => state.rowSpanning.caches.hiddenCells,
|
|
21
|
+
spannedCells: state => state.rowSpanning.caches.spannedCells,
|
|
22
|
+
hiddenCellsOriginMap: state => state.rowSpanning.caches.hiddenCellOriginMap
|
|
23
|
+
};
|
|
24
|
+
const Rowspan = exports.Rowspan = {
|
|
25
|
+
initialize: initializeState,
|
|
26
|
+
use: useRowspan,
|
|
27
|
+
selectors
|
|
28
|
+
};
|
|
29
|
+
function initializeState(params) {
|
|
30
|
+
return {
|
|
31
|
+
rowSpanning: params.initialState?.rowSpanning ?? {
|
|
32
|
+
caches: EMPTY_CACHES,
|
|
33
|
+
processedRange: EMPTY_RANGE
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function useRowspan(store, _params, _api) {
|
|
38
|
+
const getHiddenCellsOrigin = () => selectors.hiddenCellsOriginMap(store.state);
|
|
39
|
+
return {
|
|
40
|
+
getHiddenCellsOrigin
|
|
41
|
+
};
|
|
42
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { integer } from '@mui/x-internals/types';
|
|
3
|
+
import { Store } from '@mui/x-internals/store';
|
|
4
|
+
import type { CellColSpanInfo } from "../models/colspan.js";
|
|
5
|
+
import { Dimensions } from "./dimensions.js";
|
|
6
|
+
import type { BaseState, VirtualizerParams } from "../useVirtualizer.js";
|
|
7
|
+
import { PinnedRowPosition, RenderContext, ColumnsRenderContext, ColumnWithWidth, RowId, RowEntry } from "../models/index.js";
|
|
8
|
+
export type VirtualizationState = {
|
|
9
|
+
enabled: boolean;
|
|
10
|
+
enabledForRows: boolean;
|
|
11
|
+
enabledForColumns: boolean;
|
|
12
|
+
renderContext: RenderContext;
|
|
13
|
+
};
|
|
14
|
+
export declare const EMPTY_RENDER_CONTEXT: {
|
|
15
|
+
firstRowIndex: number;
|
|
16
|
+
lastRowIndex: number;
|
|
17
|
+
firstColumnIndex: number;
|
|
18
|
+
lastColumnIndex: number;
|
|
19
|
+
};
|
|
20
|
+
export declare const Virtualization: {
|
|
21
|
+
initialize: typeof initializeState;
|
|
22
|
+
use: typeof useVirtualization;
|
|
23
|
+
selectors: {
|
|
24
|
+
renderContext: (state: BaseState) => RenderContext;
|
|
25
|
+
enabledForRows: (state: BaseState) => boolean;
|
|
26
|
+
enabledForColumns: (state: BaseState) => boolean;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export declare namespace Virtualization {
|
|
30
|
+
type State = {
|
|
31
|
+
virtualization: VirtualizationState;
|
|
32
|
+
getters: ReturnType<typeof useVirtualization>['getters'];
|
|
33
|
+
};
|
|
34
|
+
type API = ReturnType<typeof useVirtualization>;
|
|
35
|
+
}
|
|
36
|
+
declare function initializeState(params: VirtualizerParams): Virtualization.State;
|
|
37
|
+
/** APIs to override for colspan/rowspan */
|
|
38
|
+
type AbstractAPI = {
|
|
39
|
+
getCellColSpanInfo: (rowId: RowId, columnIndex: integer) => CellColSpanInfo;
|
|
40
|
+
calculateColSpan: (rowId: RowId, minFirstColumn: integer, maxLastColumn: integer, columns: ColumnWithWidth[]) => void;
|
|
41
|
+
getHiddenCellsOrigin: () => Record<RowId, Record<number, number>>;
|
|
42
|
+
};
|
|
43
|
+
type RequiredAPI = Dimensions.API & AbstractAPI;
|
|
44
|
+
declare function useVirtualization(store: Store<BaseState>, params: VirtualizerParams, api: RequiredAPI): {
|
|
45
|
+
getters: {
|
|
46
|
+
setPanels: React.Dispatch<React.SetStateAction<Readonly<Map<any, React.ReactNode>>>>;
|
|
47
|
+
getRows: (rowParams: {
|
|
48
|
+
rows?: RowEntry[];
|
|
49
|
+
position?: PinnedRowPosition;
|
|
50
|
+
renderContext?: RenderContext;
|
|
51
|
+
} | undefined, unstable_rowTree: Record<RowId, any>) => React.ReactNode[];
|
|
52
|
+
getContainerProps: () => {
|
|
53
|
+
ref: React.RefObject<HTMLDivElement | null>;
|
|
54
|
+
};
|
|
55
|
+
getScrollerProps: () => {
|
|
56
|
+
ref: React.RefObject<HTMLDivElement | null>;
|
|
57
|
+
onScroll: () => void;
|
|
58
|
+
onWheel: ((event: React.WheelEvent) => void) | undefined;
|
|
59
|
+
onTouchMove: ((event: React.TouchEvent) => void) | undefined;
|
|
60
|
+
style: React.CSSProperties;
|
|
61
|
+
role: string;
|
|
62
|
+
tabIndex: number | undefined;
|
|
63
|
+
};
|
|
64
|
+
getContentProps: () => {
|
|
65
|
+
style: React.CSSProperties;
|
|
66
|
+
role: string;
|
|
67
|
+
ref: (node: HTMLDivElement | null) => void;
|
|
68
|
+
};
|
|
69
|
+
getRenderZoneProps: () => {
|
|
70
|
+
role: string;
|
|
71
|
+
};
|
|
72
|
+
getScrollbarVerticalProps: () => {
|
|
73
|
+
ref: React.RefObject<HTMLDivElement | null>;
|
|
74
|
+
scrollPosition: React.RefObject<{
|
|
75
|
+
top: number;
|
|
76
|
+
left: number;
|
|
77
|
+
}>;
|
|
78
|
+
};
|
|
79
|
+
getScrollbarHorizontalProps: () => {
|
|
80
|
+
ref: React.RefObject<HTMLDivElement | null>;
|
|
81
|
+
scrollPosition: React.RefObject<{
|
|
82
|
+
top: number;
|
|
83
|
+
left: number;
|
|
84
|
+
}>;
|
|
85
|
+
};
|
|
86
|
+
getScrollAreaProps: () => {
|
|
87
|
+
scrollPosition: React.RefObject<{
|
|
88
|
+
top: number;
|
|
89
|
+
left: number;
|
|
90
|
+
}>;
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
useVirtualization: () => BaseState;
|
|
94
|
+
setPanels: React.Dispatch<React.SetStateAction<Readonly<Map<any, React.ReactNode>>>>;
|
|
95
|
+
forceUpdateRenderContext: () => void;
|
|
96
|
+
getCellColSpanInfo: (rowId: RowId, columnIndex: integer) => CellColSpanInfo;
|
|
97
|
+
calculateColSpan: (rowId: RowId, minFirstColumn: integer, maxLastColumn: integer, columns: ColumnWithWidth[]) => void;
|
|
98
|
+
getHiddenCellsOrigin: () => Record<RowId, Record<number, number>>;
|
|
99
|
+
};
|
|
100
|
+
export declare function areRenderContextsEqual(context1: RenderContext, context2: RenderContext): boolean;
|
|
101
|
+
export declare function computeOffsetLeft(columnPositions: number[], renderContext: ColumnsRenderContext, pinnedLeftLength: number): number;
|
|
102
|
+
export declare function roundToDecimalPlaces(value: number, decimals: number): number;
|
|
103
|
+
export {};
|