@ishibashi0112/spreadsheet-grid 0.37.0 → 0.38.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/dist/controllers/autoHeightMeasurer.d.ts +30 -0
- package/dist/controllers/columnAutosizeRunner.d.ts +14 -3
- package/dist/controllers/debouncedValueStore.d.ts +11 -0
- package/dist/controllers/scrollSyncController.d.ts +17 -0
- package/dist/engine/columnCommands.d.ts +56 -0
- package/dist/engine/columnLayout.d.ts +43 -0
- package/dist/engine/createGridEngine.d.ts +46 -0
- package/dist/engine/filterPopoverCommands.d.ts +56 -0
- package/dist/engine/gridApi.d.ts +61 -0
- package/dist/engine/memo.d.ts +2 -0
- package/dist/engine/notifiers.d.ts +35 -0
- package/dist/engine/rowPipeline.d.ts +50 -0
- package/dist/engine/rowSelectionCommands.d.ts +21 -0
- package/dist/engine/verticalLayout.d.ts +52 -0
- package/dist/hooks/useController.d.ts +3 -1
- package/dist/index.cjs +8 -8
- package/dist/index.js +5618 -5376
- package/dist/logic/detailRow.d.ts +5 -0
- package/package.json +1 -1
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { GridRowKey, RowModel } from '../model/gridTypes';
|
|
2
|
+
import { type RowHeightStore } from '../logic/rowHeightStore';
|
|
3
|
+
import type { RowMetrics, VerticalGeometry } from '../logic/verticalGeometry';
|
|
4
|
+
type ReadonlyRef<V> = {
|
|
5
|
+
readonly current: V;
|
|
6
|
+
};
|
|
7
|
+
export type AutoHeightMeasureArgs<T> = {
|
|
8
|
+
scrollContainerRef: ReadonlyRef<HTMLElement | null>;
|
|
9
|
+
autoHeightActive: boolean;
|
|
10
|
+
rowHeightStore: RowHeightStore | null;
|
|
11
|
+
rowMetrics: RowMetrics;
|
|
12
|
+
rowModel: RowModel<T>;
|
|
13
|
+
virtualRows: VerticalGeometry['rows'];
|
|
14
|
+
viewportHeight: number;
|
|
15
|
+
version: number;
|
|
16
|
+
nonce: number;
|
|
17
|
+
};
|
|
18
|
+
export type AutoHeightMeasureSnapshot = {
|
|
19
|
+
version: number;
|
|
20
|
+
nonce: number;
|
|
21
|
+
};
|
|
22
|
+
export type AutoHeightMeasurer<T> = {
|
|
23
|
+
update: (args: AutoHeightMeasureArgs<T>) => void;
|
|
24
|
+
getSnapshot: () => AutoHeightMeasureSnapshot;
|
|
25
|
+
subscribe: (listener: () => void) => () => void;
|
|
26
|
+
measuredHeights: Map<GridRowKey, number>;
|
|
27
|
+
dispose: () => void;
|
|
28
|
+
};
|
|
29
|
+
export declare const createAutoHeightMeasurer: <T>() => AutoHeightMeasurer<T>;
|
|
30
|
+
export {};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { gridActions } from '../model/gridActions';
|
|
2
|
-
import type { GridColumn, RowModel } from '../model/gridTypes';
|
|
2
|
+
import type { AutoSizeColumnsMode, GridColumn, RowModel } from '../model/gridTypes';
|
|
3
3
|
type ReadonlyRef<V> = {
|
|
4
4
|
readonly current: V;
|
|
5
5
|
};
|
|
6
6
|
export type ColumnAutosizeRunnerArgs<T> = {
|
|
7
|
-
|
|
7
|
+
rowModel: RowModel<T>;
|
|
8
8
|
gridRootRef: ReadonlyRef<HTMLElement | null>;
|
|
9
|
-
|
|
9
|
+
columnWidths: Record<string, number>;
|
|
10
10
|
dispatch: (action: ReturnType<typeof gridActions.syncColumnWidths>) => void;
|
|
11
11
|
};
|
|
12
12
|
export type ColumnAutosizeRunner<T> = {
|
|
@@ -17,4 +17,15 @@ export type ColumnAutosizeRunner<T> = {
|
|
|
17
17
|
dispose: () => void;
|
|
18
18
|
};
|
|
19
19
|
export declare const createColumnAutosizeRunner: <T>() => ColumnAutosizeRunner<T>;
|
|
20
|
+
export type AutoSizeOnDataArgs<T> = {
|
|
21
|
+
mode: AutoSizeColumnsMode;
|
|
22
|
+
isServerSide: boolean;
|
|
23
|
+
rows: T[];
|
|
24
|
+
visibleColumns: GridColumn<T>[];
|
|
25
|
+
runAutosize: (columns: GridColumn<T>[]) => Promise<void>;
|
|
26
|
+
};
|
|
27
|
+
export type AutoSizeOnDataTrigger<T> = {
|
|
28
|
+
update: (args: AutoSizeOnDataArgs<T>) => void;
|
|
29
|
+
};
|
|
30
|
+
export declare const createAutoSizeOnDataTrigger: <T>() => AutoSizeOnDataTrigger<T>;
|
|
20
31
|
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type DebouncedValueArgs<V> = {
|
|
2
|
+
value: V;
|
|
3
|
+
enabled: boolean;
|
|
4
|
+
};
|
|
5
|
+
export type DebouncedValueStore<V> = {
|
|
6
|
+
update: (args: DebouncedValueArgs<V>) => void;
|
|
7
|
+
getSnapshot: () => V;
|
|
8
|
+
subscribe: (listener: () => void) => () => void;
|
|
9
|
+
dispose: () => void;
|
|
10
|
+
};
|
|
11
|
+
export declare const createDebouncedValueStore: <V>(initial: V, delayMs: number) => DebouncedValueStore<V>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { GridScrollEventParams } from '../model/gridTypes';
|
|
2
|
+
import type { GridViewStatePatch } from '../model/gridStore';
|
|
3
|
+
type ReadonlyRef<V> = {
|
|
4
|
+
readonly current: V;
|
|
5
|
+
};
|
|
6
|
+
export type ScrollSyncArgs = {
|
|
7
|
+
scrollContainerRef: ReadonlyRef<HTMLElement | null>;
|
|
8
|
+
setViewState: (patch: GridViewStatePatch) => void;
|
|
9
|
+
onScroll: ((params: GridScrollEventParams) => void) | undefined;
|
|
10
|
+
};
|
|
11
|
+
export type ScrollSyncController = {
|
|
12
|
+
update: (args: ScrollSyncArgs) => void;
|
|
13
|
+
markApiScroll: () => void;
|
|
14
|
+
dispose: () => void;
|
|
15
|
+
};
|
|
16
|
+
export declare const createScrollSyncController: () => ScrollSyncController;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { GridColumn, GridColumnPinned, GridSortState } from '../model/gridTypes';
|
|
2
|
+
import { type GridUiAction } from '../model/gridActions';
|
|
3
|
+
import { type InitialColumnState } from '../logic/columnReset';
|
|
4
|
+
import type { ToolPanelTab } from '../controllers/toolPanelController';
|
|
5
|
+
export type ColumnCommandsArgs<T> = {
|
|
6
|
+
columns: GridColumn<T>[];
|
|
7
|
+
visibleColumns: GridColumn<T>[];
|
|
8
|
+
orderedColumns: GridColumn<T>[];
|
|
9
|
+
columnWidths: Record<string, number>;
|
|
10
|
+
onColumnsChange: ((columns: GridColumn<T>[]) => void) | undefined;
|
|
11
|
+
dispatch: (action: GridUiAction) => void;
|
|
12
|
+
enableSorting: boolean;
|
|
13
|
+
sort: GridSortState;
|
|
14
|
+
globalFilterText: string;
|
|
15
|
+
closeColumnMenu: () => void;
|
|
16
|
+
openToolPanel: (tab: ToolPanelTab) => void;
|
|
17
|
+
openColumnFilterPopover: (column: GridColumn<T>) => void;
|
|
18
|
+
runAutosize: (columns: GridColumn<T>[]) => Promise<void> | void;
|
|
19
|
+
};
|
|
20
|
+
export type SortDirection = 'asc' | 'desc';
|
|
21
|
+
export type ColumnCommands<T> = {
|
|
22
|
+
update: (args: ColumnCommandsArgs<T>) => void;
|
|
23
|
+
handleColumnMenuPinnedChange: (columnKey: string, nextPinned: GridColumnPinned | undefined) => void;
|
|
24
|
+
handleColumnMenuAutosizeColumn: (columnKey: string) => void;
|
|
25
|
+
handleColumnMenuAutosizeAllColumns: () => void;
|
|
26
|
+
handleColumnMenuOpenChooser: () => void;
|
|
27
|
+
handleColumnMenuOpenSortManager: () => void;
|
|
28
|
+
handleColumnMenuOpenFilter: (column: GridColumn<T>) => void;
|
|
29
|
+
handleColumnMenuOpenFilterManager: () => void;
|
|
30
|
+
handleColumnMenuResetColumns: () => void;
|
|
31
|
+
handleColumnMenuSortChange: (columnKey: string, direction: SortDirection) => void;
|
|
32
|
+
handleFilterManagerClearFilter: (columnKey: string) => void;
|
|
33
|
+
handleFilterManagerClearAll: () => void;
|
|
34
|
+
handleFilterManagerClearGlobal: () => void;
|
|
35
|
+
handleColumnChooserToggleVisibility: (columnKey: string, nextVisible: boolean) => void;
|
|
36
|
+
handleColumnChooserShowAll: () => void;
|
|
37
|
+
handleColumnChooserHideAll: () => void;
|
|
38
|
+
handleColumnChooserReorder: (orderedKeys: string[]) => void;
|
|
39
|
+
handleColumnChooserReset: () => void;
|
|
40
|
+
applyColumnOrderAndPin: (orderedKeys: string[], pinOverride?: Map<string, GridColumnPinned | undefined>) => void;
|
|
41
|
+
handleSortManagerAddLevel: (columnKey: string, direction: SortDirection) => void;
|
|
42
|
+
handleSortManagerChangeDirection: (index: number, direction: SortDirection) => void;
|
|
43
|
+
handleSortManagerChangeColumn: (index: number, columnKey: string) => void;
|
|
44
|
+
handleSortManagerRemoveLevel: (index: number) => void;
|
|
45
|
+
handleSortManagerClearAll: () => void;
|
|
46
|
+
handleSortManagerMove: (from: number, to: number) => void;
|
|
47
|
+
handleColumnResizePointerDown: (column: GridColumn<T>, event: ColumnResizePointerEvent) => void;
|
|
48
|
+
getInitialColumnState: () => Map<string, InitialColumnState> | null;
|
|
49
|
+
};
|
|
50
|
+
export type ColumnResizePointerEvent = {
|
|
51
|
+
timeStamp: number;
|
|
52
|
+
clientX: number;
|
|
53
|
+
preventDefault: () => void;
|
|
54
|
+
stopPropagation: () => void;
|
|
55
|
+
};
|
|
56
|
+
export declare const createColumnCommands: <T>() => ColumnCommands<T>;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { GridColumn } from '../model/gridTypes';
|
|
2
|
+
import { type GridPaneLayout, type PaneSourceColumns } from '../logic/geometry';
|
|
3
|
+
export type ColumnResolutionInputs<T> = {
|
|
4
|
+
columns: GridColumn<T>[];
|
|
5
|
+
isServerSide: boolean;
|
|
6
|
+
enableRowDrag: boolean;
|
|
7
|
+
hasRowsChange: boolean;
|
|
8
|
+
detailToggleColumnActive: boolean;
|
|
9
|
+
renderDetailToggleCell: NonNullable<GridColumn<T>['renderCell']>;
|
|
10
|
+
};
|
|
11
|
+
export type ColumnResolution<T> = {
|
|
12
|
+
groupColumns: GridColumn<T>[];
|
|
13
|
+
aggColumns: GridColumn<T>[];
|
|
14
|
+
rowGroupingActive: boolean;
|
|
15
|
+
rowDragAvailable: boolean;
|
|
16
|
+
effectiveColumns: GridColumn<T>[];
|
|
17
|
+
visibleColumns: GridColumn<T>[];
|
|
18
|
+
orderedColumns: GridColumn<T>[];
|
|
19
|
+
};
|
|
20
|
+
export declare const createColumnResolver: <T>() => (inputs: ColumnResolutionInputs<T>) => ColumnResolution<T>;
|
|
21
|
+
export type PaneLayoutInputs<T> = {
|
|
22
|
+
orderedColumns: GridColumn<T>[];
|
|
23
|
+
columnWidths: Record<string, number>;
|
|
24
|
+
viewportWidth: number;
|
|
25
|
+
rowHeaderWidth: number;
|
|
26
|
+
};
|
|
27
|
+
export type PaneLayoutResolution<T> = {
|
|
28
|
+
paneSourceColumns: PaneSourceColumns<T>;
|
|
29
|
+
hasFlexColumn: boolean;
|
|
30
|
+
effectiveColumnWidths: Record<string, number>;
|
|
31
|
+
paneLayout: GridPaneLayout<T>;
|
|
32
|
+
hasLeftPane: boolean;
|
|
33
|
+
hasRightPane: boolean;
|
|
34
|
+
centerOwnsRowHeader: boolean;
|
|
35
|
+
leftLeadingWidth: number;
|
|
36
|
+
centerLeadingWidth: number;
|
|
37
|
+
rightLeadingWidth: number;
|
|
38
|
+
leftPaneTotalWidth: number;
|
|
39
|
+
rightPaneTotalWidth: number;
|
|
40
|
+
centerContentWidth: number;
|
|
41
|
+
totalScrollWidth: number;
|
|
42
|
+
};
|
|
43
|
+
export declare const createPaneLayoutResolver: <T>() => (inputs: PaneLayoutInputs<T>) => PaneLayoutResolution<T>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { type GridStore } from '../model/gridStore';
|
|
2
|
+
import { type DetailIndexCacheHolder } from '../logic/detailRow';
|
|
3
|
+
import { type AutoHeightMeasurer } from '../controllers/autoHeightMeasurer';
|
|
4
|
+
import { type ScrollSyncController } from '../controllers/scrollSyncController';
|
|
5
|
+
import { type DebouncedValueStore } from '../controllers/debouncedValueStore';
|
|
6
|
+
import { type AutoSizeOnDataTrigger } from '../controllers/columnAutosizeRunner';
|
|
7
|
+
import { type ColumnResolution, type ColumnResolutionInputs, type PaneLayoutInputs, type PaneLayoutResolution } from './columnLayout';
|
|
8
|
+
import { type RowPipelineResolver, type ServerSideQueryResolution } from './rowPipeline';
|
|
9
|
+
import { type VerticalLayoutInputs, type VerticalLayoutResolution } from './verticalLayout';
|
|
10
|
+
import { type ColumnCommands } from './columnCommands';
|
|
11
|
+
import { type FilterPopoverCommands, type FilterPopoverDerived, type FilterPopoverDerivedInputs } from './filterPopoverCommands';
|
|
12
|
+
import { type RowSelectionCommands } from './rowSelectionCommands';
|
|
13
|
+
import { type GridApi } from './gridApi';
|
|
14
|
+
import { type DetailKeysNotifier, type HoverRowNotifier, type StateChangeNotifier } from './notifiers';
|
|
15
|
+
export declare const SERVER_SIDE_QUERY_DEBOUNCE_MS = 300;
|
|
16
|
+
export type GridEngineInit<T> = {
|
|
17
|
+
columnInputs: ColumnResolutionInputs<T>;
|
|
18
|
+
serverSide: {
|
|
19
|
+
isServerSide: boolean;
|
|
20
|
+
enableGlobalFilter: boolean;
|
|
21
|
+
enableColumnFilter: boolean;
|
|
22
|
+
enableSorting: boolean;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export type GridEngine<T> = {
|
|
26
|
+
store: GridStore;
|
|
27
|
+
resolveColumns: (inputs: ColumnResolutionInputs<T>) => ColumnResolution<T>;
|
|
28
|
+
resolvePaneLayout: (inputs: PaneLayoutInputs<T>) => PaneLayoutResolution<T>;
|
|
29
|
+
rowPipeline: RowPipelineResolver<T>;
|
|
30
|
+
resolveVerticalLayout: (inputs: VerticalLayoutInputs<T>) => VerticalLayoutResolution;
|
|
31
|
+
resolveFilterPopoverDerived: (inputs: FilterPopoverDerivedInputs<T>) => FilterPopoverDerived;
|
|
32
|
+
columnCommands: ColumnCommands<T>;
|
|
33
|
+
filterPopoverCommands: FilterPopoverCommands<T>;
|
|
34
|
+
rowSelectionCommands: RowSelectionCommands<T>;
|
|
35
|
+
gridApi: GridApi<T>;
|
|
36
|
+
hoverRowNotifier: HoverRowNotifier;
|
|
37
|
+
detailKeysNotifier: DetailKeysNotifier;
|
|
38
|
+
stateChangeNotifier: StateChangeNotifier<T>;
|
|
39
|
+
autoHeightMeasurer: AutoHeightMeasurer<T>;
|
|
40
|
+
scrollSync: ScrollSyncController;
|
|
41
|
+
serverSideQueryStore: DebouncedValueStore<ServerSideQueryResolution>;
|
|
42
|
+
autoSizeOnData: AutoSizeOnDataTrigger<T>;
|
|
43
|
+
detailIndexCache: DetailIndexCacheHolder;
|
|
44
|
+
dispose: () => void;
|
|
45
|
+
};
|
|
46
|
+
export declare const createGridEngine: <T>(init: GridEngineInit<T>) => GridEngine<T>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { ColumnFilterUiType, ColumnFilterValue, GridColumn } from '../model/gridTypes';
|
|
2
|
+
import { type GridUiAction } from '../model/gridActions';
|
|
3
|
+
import { type ColumnFilterSetSelection } from '../logic/setFilterSelection';
|
|
4
|
+
import { type NumberFilterConditionDraft } from '../logic/numberFilterCondition';
|
|
5
|
+
import { type TextFilterConditionDraft } from '../logic/textFilterCondition';
|
|
6
|
+
import { type DateFilterConditionDraft } from '../logic/dateFilterCondition';
|
|
7
|
+
import type { SelectOptionEntry } from '../logic/selectOptions';
|
|
8
|
+
export type FilterPopoverDerivedInputs<T> = {
|
|
9
|
+
openedFilterColumn: GridColumn<T> | null;
|
|
10
|
+
openedFilterType: ColumnFilterUiType | null;
|
|
11
|
+
openedFilterSelectOptions: SelectOptionEntry[];
|
|
12
|
+
openedFilterAllValues: ReadonlySet<string>;
|
|
13
|
+
columnFilters: Record<string, ColumnFilterValue>;
|
|
14
|
+
};
|
|
15
|
+
export type FilterPopoverDerived = {
|
|
16
|
+
isDateSetFilterColumn: boolean;
|
|
17
|
+
openedPopoverSelectOptions: SelectOptionEntry[];
|
|
18
|
+
openedPopoverAllValues: ReadonlySet<string>;
|
|
19
|
+
openedSetFilterValue: ColumnFilterValue | undefined;
|
|
20
|
+
openedSetSelection: ColumnFilterSetSelection | null;
|
|
21
|
+
openedColumnCanInvert: boolean;
|
|
22
|
+
isComboFilterColumn: boolean;
|
|
23
|
+
};
|
|
24
|
+
export declare const createFilterPopoverDerivedResolver: <T>() => (inputs: FilterPopoverDerivedInputs<T>) => FilterPopoverDerived;
|
|
25
|
+
export type FilterPopoverStateLike = {
|
|
26
|
+
columnKey: string;
|
|
27
|
+
draftValue: string;
|
|
28
|
+
numberDraft: NumberFilterConditionDraft | null;
|
|
29
|
+
};
|
|
30
|
+
export type FilterPopoverCommandsArgs<T> = {
|
|
31
|
+
filterPopoverState: FilterPopoverStateLike | null;
|
|
32
|
+
openedFilterColumn: GridColumn<T> | null;
|
|
33
|
+
openedFilterType: ColumnFilterUiType | null;
|
|
34
|
+
columnFilters: Record<string, ColumnFilterValue>;
|
|
35
|
+
derived: FilterPopoverDerived;
|
|
36
|
+
dispatch: (action: GridUiAction) => void;
|
|
37
|
+
closeColumnFilterPopover: () => void;
|
|
38
|
+
updateNumberDraft: (draft: NumberFilterConditionDraft) => void;
|
|
39
|
+
updateTextDraft: (draft: TextFilterConditionDraft) => void;
|
|
40
|
+
updateDateDraft: (draft: DateFilterConditionDraft) => void;
|
|
41
|
+
};
|
|
42
|
+
export type FilterPopoverCommands<T> = {
|
|
43
|
+
update: (args: FilterPopoverCommandsArgs<T>) => void;
|
|
44
|
+
handleSetFilterValueToggle: (value: string) => void;
|
|
45
|
+
handleSetFilterSelectAllChange: (scope: 'all' | string[], nextChecked: boolean) => void;
|
|
46
|
+
handleSetFilterReplaceSelection: (values: string[]) => void;
|
|
47
|
+
clearSetFilterPopoverValue: () => void;
|
|
48
|
+
handleNumberConditionDraftChange: (draft: NumberFilterConditionDraft) => void;
|
|
49
|
+
handleTextConditionDraftChange: (draft: TextFilterConditionDraft) => void;
|
|
50
|
+
handleDateConditionDraftChange: (draft: DateFilterConditionDraft) => void;
|
|
51
|
+
handleComboConditionClear: () => void;
|
|
52
|
+
handleComboSelectionClear: () => void;
|
|
53
|
+
applyFilterPopoverValue: () => void;
|
|
54
|
+
clearFilterPopoverValue: () => void;
|
|
55
|
+
};
|
|
56
|
+
export declare const createFilterPopoverCommands: <T>() => FilterPopoverCommands<T>;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { DetailRowOptions, GridColumn, GridRowKey, GridUiState, RowModel, RowSelectionState, ScrollAlign, SpreadsheetGridHandle, SpreadsheetGridProps } from '../model/gridTypes';
|
|
2
|
+
import { type GridUiAction } from '../model/gridActions';
|
|
3
|
+
import { type GridPaneLayout } from '../logic/geometry';
|
|
4
|
+
import { type RowMetrics } from '../logic/verticalGeometry';
|
|
5
|
+
import { type DetailIndexCache } from '../logic/detailRow';
|
|
6
|
+
import { type GroupTree } from '../logic/grouping';
|
|
7
|
+
import type { ToolPanelTab } from '../controllers/toolPanelController';
|
|
8
|
+
type ReadonlyRef<V> = {
|
|
9
|
+
readonly current: V;
|
|
10
|
+
};
|
|
11
|
+
export type GridApiArgs<T> = {
|
|
12
|
+
scrollContainerRef: ReadonlyRef<HTMLElement | null>;
|
|
13
|
+
dispatch: (action: GridUiAction) => void;
|
|
14
|
+
rowModel: RowModel<T>;
|
|
15
|
+
viewRowCount: number;
|
|
16
|
+
leafRowCount: number;
|
|
17
|
+
groupTree: GroupTree<T> | null;
|
|
18
|
+
rowMetrics: RowMetrics;
|
|
19
|
+
paneLayout: GridPaneLayout<T>;
|
|
20
|
+
orderedColumns: GridColumn<T>[];
|
|
21
|
+
columns: GridColumn<T>[];
|
|
22
|
+
onColumnsChange: ((nextColumns: GridColumn<T>[]) => void) | undefined;
|
|
23
|
+
uiState: GridUiState;
|
|
24
|
+
headerHeight: number;
|
|
25
|
+
verticalScaleFactor: number;
|
|
26
|
+
leftPaneTotalWidth: number;
|
|
27
|
+
rightPaneTotalWidth: number;
|
|
28
|
+
centerLeadingWidth: number;
|
|
29
|
+
windowFirstRow: number;
|
|
30
|
+
windowLastRow: number;
|
|
31
|
+
physicalBodyHeight: number;
|
|
32
|
+
rows: T[];
|
|
33
|
+
isServerSide: boolean;
|
|
34
|
+
serverSideRefresh: () => void;
|
|
35
|
+
resolvedRowKeyGetter: (row: T, sourceRowIndex: number) => GridRowKey;
|
|
36
|
+
isRowExportable: SpreadsheetGridProps<T>['isRowExportable'];
|
|
37
|
+
activeToolPanelTab: ToolPanelTab | null;
|
|
38
|
+
openToolPanel: (tab: ToolPanelTab) => void;
|
|
39
|
+
closeToolPanel: () => void;
|
|
40
|
+
undoRows: () => void;
|
|
41
|
+
redoRows: () => void;
|
|
42
|
+
canUndoRows: () => boolean;
|
|
43
|
+
canRedoRows: () => boolean;
|
|
44
|
+
clearUndoHistory: () => void;
|
|
45
|
+
detailRowEnabled: boolean;
|
|
46
|
+
detailIsExpandable: DetailRowOptions<T>['isExpandable'];
|
|
47
|
+
detailIndexCacheRef: ReadonlyRef<DetailIndexCache>;
|
|
48
|
+
moveRowByKey: (rowKey: GridRowKey, toIndex: number) => void;
|
|
49
|
+
commitRowSelection: (next: RowSelectionState) => void;
|
|
50
|
+
markApiScroll: () => void;
|
|
51
|
+
};
|
|
52
|
+
export type GridApi<T> = {
|
|
53
|
+
update: (args: GridApiArgs<T>) => void;
|
|
54
|
+
handle: SpreadsheetGridHandle<T>;
|
|
55
|
+
applyScroll: (logicalTop: number | null, left: number | null) => void;
|
|
56
|
+
verticalTargetFor: (viewRowIndex: number, align: ScrollAlign) => number | null;
|
|
57
|
+
horizontalTargetFor: (colIndex: number, align: ScrollAlign) => number | null;
|
|
58
|
+
scrollToCellInternal: (viewRowIndex: number, colIndex: number, align: ScrollAlign) => void;
|
|
59
|
+
};
|
|
60
|
+
export declare const createGridApi: <T>() => GridApi<T>;
|
|
61
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { GridColumn, GridRowKey, GridSortState, GridState, GridUiState } from '../model/gridTypes';
|
|
2
|
+
export type HoverRowNotifierArgs = {
|
|
3
|
+
enableRowHover: boolean;
|
|
4
|
+
isHoverControlled: boolean;
|
|
5
|
+
onHoveredRowChange: ((index: number | null, meta: {
|
|
6
|
+
source: 'pointer';
|
|
7
|
+
}) => void) | undefined;
|
|
8
|
+
setHoveredRowIndex: (index: number | null) => void;
|
|
9
|
+
};
|
|
10
|
+
export type HoverRowAction = number | null | ((current: number | null) => number | null);
|
|
11
|
+
export type HoverRowNotifier = {
|
|
12
|
+
update: (args: HoverRowNotifierArgs) => void;
|
|
13
|
+
applyHoveredRowChange: (action: HoverRowAction) => void;
|
|
14
|
+
};
|
|
15
|
+
export declare const createHoverRowNotifier: () => HoverRowNotifier;
|
|
16
|
+
export type DetailKeysNotifierArgs = {
|
|
17
|
+
expandedKeys: ReadonlySet<GridRowKey>;
|
|
18
|
+
onChange: ((keys: GridRowKey[]) => void) | undefined;
|
|
19
|
+
};
|
|
20
|
+
export type DetailKeysNotifier = {
|
|
21
|
+
update: (args: DetailKeysNotifierArgs) => void;
|
|
22
|
+
};
|
|
23
|
+
export declare const createDetailKeysNotifier: () => DetailKeysNotifier;
|
|
24
|
+
export type StateChangeNotifierArgs<T> = {
|
|
25
|
+
columnWidths: GridUiState['columnWidths'];
|
|
26
|
+
filters: GridUiState['filters'];
|
|
27
|
+
sort: GridSortState;
|
|
28
|
+
dragState: GridUiState['dragState'];
|
|
29
|
+
columns: GridColumn<T>[];
|
|
30
|
+
onStateChange: ((state: GridState) => void) | undefined;
|
|
31
|
+
};
|
|
32
|
+
export type StateChangeNotifier<T> = {
|
|
33
|
+
update: (args: StateChangeNotifierArgs<T>) => void;
|
|
34
|
+
};
|
|
35
|
+
export declare const createStateChangeNotifier: <T>() => StateChangeNotifier<T>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { ColumnFilterValue, GridColumn, GridRowKey, GridSortState, RowModel, ServerSideQuery } from '../model/gridTypes';
|
|
2
|
+
import { type RowOrder } from '../logic/filtering';
|
|
3
|
+
import { type GroupTree, type GroupedDisplay } from '../logic/grouping';
|
|
4
|
+
export type RowOrderInputs<T> = {
|
|
5
|
+
rows: T[];
|
|
6
|
+
visibleColumns: GridColumn<T>[];
|
|
7
|
+
columnFilters: Record<string, ColumnFilterValue>;
|
|
8
|
+
globalFilteredOrder: RowOrder;
|
|
9
|
+
sort: GridSortState;
|
|
10
|
+
rowDragAvailable: boolean;
|
|
11
|
+
};
|
|
12
|
+
export type RowOrderResolution = {
|
|
13
|
+
order: RowOrder;
|
|
14
|
+
orderIsIdentity: boolean;
|
|
15
|
+
rowDragOperable: boolean;
|
|
16
|
+
};
|
|
17
|
+
export type ClientSideRowModelInputs<T> = {
|
|
18
|
+
rows: T[];
|
|
19
|
+
order: RowOrder;
|
|
20
|
+
rowGroupingActive: boolean;
|
|
21
|
+
groupColumns: GridColumn<T>[];
|
|
22
|
+
aggColumns: GridColumn<T>[];
|
|
23
|
+
collapsedGroupKeys: ReadonlySet<string>;
|
|
24
|
+
rowKeyGetter: (row: T, index: number) => GridRowKey;
|
|
25
|
+
};
|
|
26
|
+
export type ClientSideRowModelResolution<T> = {
|
|
27
|
+
groupTree: GroupTree<T> | null;
|
|
28
|
+
groupedDisplay: GroupedDisplay | null;
|
|
29
|
+
rowModel: RowModel<T>;
|
|
30
|
+
};
|
|
31
|
+
export type ServerSideQueryInputs = {
|
|
32
|
+
isServerSide: boolean;
|
|
33
|
+
globalFilterEnabled: boolean;
|
|
34
|
+
globalText: string;
|
|
35
|
+
columnFilterEnabled: boolean;
|
|
36
|
+
columnFilters: Record<string, ColumnFilterValue>;
|
|
37
|
+
sortingEnabled: boolean;
|
|
38
|
+
sort: GridSortState;
|
|
39
|
+
};
|
|
40
|
+
export type ServerSideQueryResolution = {
|
|
41
|
+
query: ServerSideQuery;
|
|
42
|
+
queryKey: string;
|
|
43
|
+
};
|
|
44
|
+
export declare const createRowPipelineResolver: <T>() => {
|
|
45
|
+
resolveBaseOrder: (rowCount: number) => RowOrder;
|
|
46
|
+
resolveOrder: (inputs: RowOrderInputs<T>) => RowOrderResolution;
|
|
47
|
+
resolveClientSideRowModel: (inputs: ClientSideRowModelInputs<T>) => ClientSideRowModelResolution<T>;
|
|
48
|
+
resolveServerSideQuery: (inputs: ServerSideQueryInputs) => ServerSideQueryResolution;
|
|
49
|
+
};
|
|
50
|
+
export type RowPipelineResolver<T> = ReturnType<typeof createRowPipelineResolver<T>>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { RowModel, RowSelectionModel, RowSelectionState } from '../model/gridTypes';
|
|
2
|
+
import { type GridUiAction } from '../model/gridActions';
|
|
3
|
+
export type RowSelectionCommandsArgs<T> = {
|
|
4
|
+
rowModel: RowModel<T>;
|
|
5
|
+
rowSelectionState: RowSelectionState;
|
|
6
|
+
rowSelectionMode: 'single' | 'multiple';
|
|
7
|
+
onRowSelectionChange: ((model: RowSelectionModel) => void) | undefined;
|
|
8
|
+
controlledRowSelectionModel: RowSelectionModel | undefined;
|
|
9
|
+
leafRowCount: number;
|
|
10
|
+
dispatch: (action: GridUiAction) => void;
|
|
11
|
+
};
|
|
12
|
+
export type RowSelectionCommands<T> = {
|
|
13
|
+
update: (args: RowSelectionCommandsArgs<T>) => void;
|
|
14
|
+
commitRowSelection: (next: RowSelectionState) => void;
|
|
15
|
+
handleGutterRowSelect: (viewIndex: number, opts: {
|
|
16
|
+
shiftKey: boolean;
|
|
17
|
+
}) => void;
|
|
18
|
+
handleGutterRowSelectDrag: (viewIndex: number) => void;
|
|
19
|
+
handleToggleSelectAllRows: () => void;
|
|
20
|
+
};
|
|
21
|
+
export declare const createRowSelectionCommands: <T>() => RowSelectionCommands<T>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { GridColumn, GridRowKey, RowModel } from '../model/gridTypes';
|
|
2
|
+
import { type DetailRowExtra, type RowMetrics, type VerticalGeometry, type VerticalRow } from '../logic/verticalGeometry';
|
|
3
|
+
import { type RowHeightStore } from '../logic/rowHeightStore';
|
|
4
|
+
import { resolveDetailRowExtras, type DetailIndexCache } from '../logic/detailRow';
|
|
5
|
+
type ReadonlyRef<V> = {
|
|
6
|
+
readonly current: V;
|
|
7
|
+
};
|
|
8
|
+
export type DetailLayerEntry = {
|
|
9
|
+
rowKey: GridRowKey;
|
|
10
|
+
virtualRow: VerticalRow;
|
|
11
|
+
};
|
|
12
|
+
type DetailIsExpandable<T> = Parameters<typeof resolveDetailRowExtras<T>>[0]['isExpandable'];
|
|
13
|
+
export type VerticalLayoutInputs<T> = {
|
|
14
|
+
isServerSide: boolean;
|
|
15
|
+
autoHeight: boolean;
|
|
16
|
+
visibleColumns: GridColumn<T>[];
|
|
17
|
+
viewRowCount: number;
|
|
18
|
+
estimateRowHeight: number;
|
|
19
|
+
rowHeight: number;
|
|
20
|
+
headerHeight: number;
|
|
21
|
+
viewportHeight: number;
|
|
22
|
+
scrollTop: number;
|
|
23
|
+
rowModel: RowModel<T>;
|
|
24
|
+
measuredHeights: Map<GridRowKey, number>;
|
|
25
|
+
autoHeightVersion: number;
|
|
26
|
+
detailRowEnabled: boolean;
|
|
27
|
+
expandedDetailRowKeys: ReadonlySet<GridRowKey>;
|
|
28
|
+
detailHeight: number;
|
|
29
|
+
detailIsExpandable: DetailIsExpandable<T>;
|
|
30
|
+
detailIndexCacheRef: ReadonlyRef<DetailIndexCache>;
|
|
31
|
+
};
|
|
32
|
+
export type VerticalLayoutResolution = {
|
|
33
|
+
hasAutoHeightColumn: boolean;
|
|
34
|
+
autoHeightActive: boolean;
|
|
35
|
+
rowHeightStore: RowHeightStore | null;
|
|
36
|
+
baseRowMetrics: RowMetrics;
|
|
37
|
+
detailExtras: readonly DetailRowExtra[];
|
|
38
|
+
detailActive: boolean;
|
|
39
|
+
rowMetrics: RowMetrics;
|
|
40
|
+
verticalGeometry: VerticalGeometry;
|
|
41
|
+
virtualRows: VerticalGeometry['rows'];
|
|
42
|
+
virtualRowIndexes: VerticalGeometry['rowIndexSet'];
|
|
43
|
+
detailEntries: readonly DetailLayerEntry[];
|
|
44
|
+
windowFirstRow: number;
|
|
45
|
+
windowLastRow: number;
|
|
46
|
+
physicalBodyHeight: number;
|
|
47
|
+
bodyLayerTransform: string | undefined;
|
|
48
|
+
verticalScaleFactor: number;
|
|
49
|
+
overlayBaseOffset: number;
|
|
50
|
+
};
|
|
51
|
+
export declare const createVerticalLayoutResolver: <T>() => (inputs: VerticalLayoutInputs<T>) => VerticalLayoutResolution;
|
|
52
|
+
export {};
|
|
@@ -2,4 +2,6 @@ export type ControllerLike<Args> = {
|
|
|
2
2
|
update: (args: Args) => void;
|
|
3
3
|
dispose?: () => void;
|
|
4
4
|
};
|
|
5
|
-
export
|
|
5
|
+
export type ControllerUpdateTiming = 'layout' | 'passive';
|
|
6
|
+
export declare function useControllerLifecycle<Args, C extends ControllerLike<Args>>(controller: C, args: Args, timing?: ControllerUpdateTiming): void;
|
|
7
|
+
export declare function useController<Args, C extends ControllerLike<Args>>(create: () => C, args: Args, timing?: ControllerUpdateTiming): C;
|