@deephaven/grid 0.7.0 → 0.7.1-beta.4
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/Grid.d.ts +3 -13
- package/dist/Grid.d.ts.map +1 -1
- package/dist/GridMetricCalculator.d.ts +448 -165
- package/dist/GridMetricCalculator.d.ts.map +1 -1
- package/dist/GridMetricCalculator.js +523 -119
- package/dist/GridMetricCalculator.js.map +1 -1
- package/dist/GridMetrics.d.ts +97 -0
- package/dist/GridMetrics.d.ts.map +1 -0
- package/dist/GridMetrics.js +2 -0
- package/dist/GridMetrics.js.map +1 -0
- package/dist/GridRange.d.ts +186 -111
- package/dist/GridRange.d.ts.map +1 -1
- package/dist/GridRange.js +185 -87
- package/dist/GridRange.js.map +1 -1
- package/dist/GridRenderer.js +6 -1
- package/dist/GridRenderer.js.map +1 -1
- package/dist/GridTheme.d.ts +49 -37
- package/dist/GridTheme.d.ts.map +1 -1
- package/dist/GridTheme.js +8 -0
- package/dist/GridTheme.js.map +1 -1
- package/dist/GridUtils.d.ts +236 -97
- package/dist/GridUtils.d.ts.map +1 -1
- package/dist/GridUtils.js +240 -75
- package/dist/GridUtils.js.map +1 -1
- package/dist/mouse-handlers/GridRowSeparatorMouseHandler.d.ts +1 -1
- package/dist/mouse-handlers/GridRowSeparatorMouseHandler.d.ts.map +1 -1
- package/dist/mouse-handlers/GridSelectionMouseHandler.js +4 -4
- package/dist/mouse-handlers/GridSelectionMouseHandler.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
|
@@ -1,4 +1,48 @@
|
|
|
1
|
-
|
|
1
|
+
import GridModel from './GridModel';
|
|
2
|
+
import GridMetrics, { BoxCoordinates, Coordinate, CoordinateMap, VisibleIndex, IndexModelMap, ModelIndex, ModelSizeMap, MoveOperation, SizeMap } from './GridMetrics';
|
|
3
|
+
import { GridFont, GridTheme } from './GridTheme';
|
|
4
|
+
export declare type GridMetricState = {
|
|
5
|
+
left: VisibleIndex;
|
|
6
|
+
top: VisibleIndex;
|
|
7
|
+
leftOffset: Coordinate;
|
|
8
|
+
topOffset: Coordinate;
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
context: CanvasRenderingContext2D;
|
|
12
|
+
theme: GridTheme;
|
|
13
|
+
model: GridModel;
|
|
14
|
+
movedColumns: MoveOperation[];
|
|
15
|
+
movedRows: MoveOperation[];
|
|
16
|
+
isDraggingHorizontalScrollBar: boolean;
|
|
17
|
+
isDraggingVerticalScrollBar: boolean;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Retrieve a value from a map. If the value is not found and no default value is provided, throw.
|
|
21
|
+
* Use when the value _must_ be present
|
|
22
|
+
* @param map The map to get the value from
|
|
23
|
+
* @param key The key to fetch the value for
|
|
24
|
+
* @param defaultValue A default value to set if the key is not present
|
|
25
|
+
* @returns The value set for that key
|
|
26
|
+
*/
|
|
27
|
+
export declare function getOrThrow<K, V>(map: Map<K, V>, key: K, defaultValue?: V | undefined): V;
|
|
28
|
+
/**
|
|
29
|
+
* Trim the provided map in place. Trims oldest inserted items down to the target size if the cache size is exceeded.
|
|
30
|
+
* Instead of trimming one item on every tick, we trim half the items so there isn't a cache clear on every new item.
|
|
31
|
+
* @param map The map to trim
|
|
32
|
+
* @param cacheSize The maximum number of elements to cache
|
|
33
|
+
* @param targetSize The number of elements to reduce the cache down to if `cacheSize` is exceeded
|
|
34
|
+
*/
|
|
35
|
+
export declare function trimMap(map: Map<unknown, unknown>, cacheSize?: number, targetSize?: number): void;
|
|
36
|
+
/**
|
|
37
|
+
* Get the coordinates of floating items in one dimension.
|
|
38
|
+
* Can be used for getting the y coordinates of floating rows, or x coordinates of floating columns, calculated using the `sizeMap` passed in.
|
|
39
|
+
* @param startCount The number of floating items at the start (ie. `floatingTopRowCount` for rows, `floatingLeftColumnCount` for columns)
|
|
40
|
+
* @param endCount The number of floating items at the end (ie. `floatingBottomRowCount` for rows, `floatingRightColumnCount` for columns)
|
|
41
|
+
* @param totalCount Total number of items in this dimension (ie. `rowCount` for rows, `columnCount` for columns)
|
|
42
|
+
* @param max The max coordinate value (ie. `maxY` for rows, `maxX` for columns)
|
|
43
|
+
* @param sizeMap Map from index to size of item (ie. `rowHeightMap` for rows, `columnWidthMap` for columns)
|
|
44
|
+
*/
|
|
45
|
+
export declare function getFloatingCoordinates(startCount: number, endCount: number, totalCount: number, max: number, sizeMap: SizeMap): CoordinateMap;
|
|
2
46
|
/**
|
|
3
47
|
* Class to calculate all the metrics for drawing a grid.
|
|
4
48
|
* Call getMetrics() with the state to get the full metrics.
|
|
@@ -9,190 +53,429 @@ declare class GridMetricCalculator {
|
|
|
9
53
|
static CACHE_SIZE: number;
|
|
10
54
|
/** The maximum column width as a percentage of the full grid */
|
|
11
55
|
static MAX_COLUMN_WIDTH: number;
|
|
12
|
-
/**
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
constructor({ userColumnWidths, userRowHeights,
|
|
56
|
+
/** User set column widths */
|
|
57
|
+
private userColumnWidths;
|
|
58
|
+
/** User set row heights */
|
|
59
|
+
private userRowHeights;
|
|
60
|
+
/** Calculated column widths based on cell contents */
|
|
61
|
+
private calculatedColumnWidths;
|
|
62
|
+
/** Calculated row heights based on cell contents */
|
|
63
|
+
private calculatedRowHeights;
|
|
64
|
+
/** Cache of fonts to estimated width of one char */
|
|
65
|
+
private fontWidths;
|
|
66
|
+
/** Map from visible index to model index for rows (e.g. reversing movedRows operations) */
|
|
67
|
+
private modelRows;
|
|
68
|
+
/** Map from visible index to model index for columns (e.g. reversing movedColumns operations) */
|
|
69
|
+
private modelColumns;
|
|
70
|
+
/** List of moved row operations. Need to track the previous value so we know if modelRows needs to be cleared. */
|
|
71
|
+
private movedRows;
|
|
72
|
+
/** List of moved column operations. Need to track the previous value so we know if modelColumns needs to be cleared. */
|
|
73
|
+
private movedColumns;
|
|
74
|
+
constructor({ userColumnWidths, userRowHeights, calculatedColumnWidths, calculatedRowHeights, fontWidths, modelRows, modelColumns, movedRows, movedColumns, }?: {
|
|
31
75
|
userColumnWidths?: Map<any, any> | undefined;
|
|
32
76
|
userRowHeights?: Map<any, any> | undefined;
|
|
33
|
-
calculatedRowHeights?: Map<any, any> | undefined;
|
|
34
77
|
calculatedColumnWidths?: Map<any, any> | undefined;
|
|
78
|
+
calculatedRowHeights?: Map<any, any> | undefined;
|
|
35
79
|
fontWidths?: Map<any, any> | undefined;
|
|
36
80
|
modelRows?: Map<any, any> | undefined;
|
|
37
81
|
modelColumns?: Map<any, any> | undefined;
|
|
38
|
-
movedRows?:
|
|
39
|
-
movedColumns?:
|
|
82
|
+
movedRows?: never[] | undefined;
|
|
83
|
+
movedColumns?: never[] | undefined;
|
|
40
84
|
});
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
scrollX: number;
|
|
96
|
-
scrollY: number;
|
|
97
|
-
visibleRows: any[];
|
|
98
|
-
visibleColumns: any[];
|
|
99
|
-
floatingRows: any[];
|
|
100
|
-
floatingColumns: any[];
|
|
101
|
-
allRows: any[];
|
|
102
|
-
allColumns: any[];
|
|
103
|
-
visibleRowHeights: Map<any, any>;
|
|
104
|
-
visibleColumnWidths: Map<any, any>;
|
|
105
|
-
floatingTopHeight: number;
|
|
106
|
-
floatingBottomHeight: number;
|
|
107
|
-
floatingLeftWidth: number;
|
|
108
|
-
floatingRightWidth: number;
|
|
109
|
-
visibleRowYs: Map<any, any>;
|
|
110
|
-
visibleColumnXs: Map<any, any>;
|
|
111
|
-
visibleRowTreeBoxes: Map<any, any>;
|
|
112
|
-
modelRows: Map<any, any>;
|
|
113
|
-
modelColumns: Map<any, any>;
|
|
114
|
-
fontWidths: Map<any, any>;
|
|
115
|
-
userColumnWidths: Map<any, any>;
|
|
116
|
-
userRowHeights: Map<any, any>;
|
|
117
|
-
calculatedRowHeights: Map<any, any>;
|
|
118
|
-
calculatedColumnWidths: Map<any, any>;
|
|
119
|
-
};
|
|
120
|
-
getGridX(state: any): any;
|
|
121
|
-
getGridY(state: any): any;
|
|
122
|
-
getVisibleHeight(state: any, visibleRowHeights?: Map<any, any>): number;
|
|
123
|
-
getVisibleWidth(state: any, visibleColumnWidths?: Map<any, any>): number;
|
|
124
|
-
getFirstIndex(itemSizes: any, getModelIndex: any, state: any): number;
|
|
125
|
-
/** Get the first column index that isn't hidden */
|
|
126
|
-
getFirstColumn(state: any): number;
|
|
127
|
-
/** Get the first row index that isn't hidden */
|
|
128
|
-
getFirstRow(state: any): number;
|
|
129
|
-
/**
|
|
130
|
-
* Get the last column that can be the left most column (eg. scrolled to the right)
|
|
85
|
+
/**
|
|
86
|
+
* Get the metrics for the provided metric state
|
|
87
|
+
* @params state The state to get metrics for
|
|
88
|
+
* @returns The full metrics
|
|
89
|
+
*/
|
|
90
|
+
getMetrics(state: GridMetricState): GridMetrics;
|
|
91
|
+
/**
|
|
92
|
+
* The x offset of the grid
|
|
93
|
+
* @param state The current grid state
|
|
94
|
+
* @returns x value of the left side of the first cell
|
|
95
|
+
*/
|
|
96
|
+
getGridX(state: GridMetricState): Coordinate;
|
|
97
|
+
/**
|
|
98
|
+
* The y offset of the grid
|
|
99
|
+
* @param state The current grid state
|
|
100
|
+
* @returns y value of the top side of the first cell
|
|
101
|
+
*/
|
|
102
|
+
getGridY(state: GridMetricState): Coordinate;
|
|
103
|
+
/**
|
|
104
|
+
* The height of the "visible" area (excludes floating areas)
|
|
105
|
+
* @param state The current grid state
|
|
106
|
+
* @param visibleRowHeights All the visible row heights
|
|
107
|
+
* @returns The visible height in pixels
|
|
108
|
+
*/
|
|
109
|
+
getVisibleHeight(state: GridMetricState, visibleRowHeights?: SizeMap): number;
|
|
110
|
+
/**
|
|
111
|
+
* The width of the "visible" area (excludes floating areas)
|
|
112
|
+
* @param state The current grid state
|
|
113
|
+
* @param visibleColumnWidths All the visible column widths
|
|
114
|
+
* @returns The visible width in pixels
|
|
115
|
+
*/
|
|
116
|
+
getVisibleWidth(state: GridMetricState, visibleColumnWidths?: SizeMap): number;
|
|
117
|
+
/**
|
|
118
|
+
* Retrieve the index of the first non-hidden item
|
|
119
|
+
* @param itemSizes The size of the items in this dimension
|
|
120
|
+
* @param getModelIndex A function to map from the Index to the ModelIndex
|
|
121
|
+
* @param state The current grid state
|
|
122
|
+
* @returns The first item that is not hidden
|
|
123
|
+
*/
|
|
124
|
+
getFirstIndex(itemSizes: ModelSizeMap, getModelIndex: (visibleIndex: VisibleIndex, state: GridMetricState) => ModelIndex, state: GridMetricState): VisibleIndex;
|
|
125
|
+
/**
|
|
126
|
+
* Get the first column index that isn't hidden
|
|
127
|
+
* @param state The current grid state
|
|
128
|
+
* @returns The first column that is not hidden
|
|
129
|
+
*/
|
|
130
|
+
getFirstColumn(state: GridMetricState): VisibleIndex;
|
|
131
|
+
/**
|
|
132
|
+
* Get the first row index that isn't hidden
|
|
133
|
+
* @param state The current grid state
|
|
134
|
+
* @returns The first row that is not hidden
|
|
135
|
+
*/
|
|
136
|
+
getFirstRow(state: GridMetricState): VisibleIndex;
|
|
137
|
+
/**
|
|
138
|
+
* Get the last column that can be the left most column (e.g. scrolled to the right)
|
|
131
139
|
* If no right column is provided, then the last column is used.
|
|
140
|
+
* @param state The current grid state
|
|
141
|
+
* @param right The right-most column to be visible, or null to default to last cell
|
|
142
|
+
* @param visibleWidth The width of the "visible" area (excluding floating items)
|
|
143
|
+
* @returns The index of the last left visible column
|
|
132
144
|
*/
|
|
133
|
-
getLastLeft(state:
|
|
145
|
+
getLastLeft(state: GridMetricState, right?: VisibleIndex | null, visibleWidth?: number): VisibleIndex;
|
|
134
146
|
/**
|
|
135
|
-
* The last row that can be the top row (
|
|
147
|
+
* The last row that can be the top row (e.g. scrolled to the bottom)
|
|
136
148
|
* If no bottom row is provided, then the last row that is not floating is used
|
|
137
149
|
*/
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
150
|
+
/**
|
|
151
|
+
* The last row that can be the top row (e.g. scrolled to the bottom)
|
|
152
|
+
* If no bottom row is provided, then the last row that is not floating is used
|
|
153
|
+
* @param state The current grid state
|
|
154
|
+
* @param bottom The bottom-most row to be visible, or null to default to last cell
|
|
155
|
+
* @param visibleHeight The height of the "visible" area (excluding floating items)
|
|
156
|
+
* @returns The index of the last left visible column
|
|
157
|
+
*/
|
|
158
|
+
getLastTop(state: GridMetricState, bottom?: VisibleIndex | null, visibleHeight?: number): VisibleIndex;
|
|
159
|
+
/**
|
|
160
|
+
* Retrieve the top row to scroll to so the passed in `topVisible` is completely visible, taking the floating rows into account.
|
|
161
|
+
* The `top` row is at the top underneath any floating rows, whereas `topVisible` is visible below the floating rows.
|
|
162
|
+
* If there are no floating rows, they should be the same value.
|
|
163
|
+
* @param state The grid metric state
|
|
164
|
+
* @param topVisible The top row to be visible
|
|
165
|
+
* @returns The index of the top row to scroll to (under the floating top rows)
|
|
166
|
+
*/
|
|
167
|
+
getTopForTopVisible(state: GridMetricState, topVisible: VisibleIndex): VisibleIndex;
|
|
168
|
+
/**
|
|
169
|
+
* Retrieve the top row to scroll to so the passed in `bottomVisible` is completely visible
|
|
170
|
+
* at the bottom of the visible viewport, taking the floating rows into account.
|
|
171
|
+
* @param state The grid metric state
|
|
172
|
+
* @param bottomVisible The bottom row to be visible
|
|
173
|
+
* @returns The index of the top row to scroll to (under the floating top rows)
|
|
174
|
+
*/
|
|
175
|
+
getTopForBottomVisible(state: GridMetricState, bottomVisible: VisibleIndex): VisibleIndex;
|
|
176
|
+
/**
|
|
177
|
+
* Retrieve the left column to scroll to so the passed in `leftVisible` is completely visible
|
|
178
|
+
* at the left of the visible viewport, taking the floating columns into account.
|
|
179
|
+
* @param state The grid metric state
|
|
180
|
+
* @param leftVisible The left column to be visible
|
|
181
|
+
* @returns The index of the left column to scroll to (under the floating left columns)
|
|
182
|
+
*/
|
|
183
|
+
getLeftForLeftVisible(state: GridMetricState, leftVisible: VisibleIndex): VisibleIndex;
|
|
184
|
+
/**
|
|
185
|
+
* Retrieve the left column to scroll to so the passed in `rightVisible` is completely visible
|
|
186
|
+
* at the right of the visible viewport, taking the floating columns into account.
|
|
187
|
+
* @param state The grid metric state
|
|
188
|
+
* @param rightVisible The right column to be visible
|
|
189
|
+
* @returns The index of the left column to scroll to (under the floating left columns)
|
|
190
|
+
*/
|
|
191
|
+
getLeftForRightVisible(state: GridMetricState, rightVisible: VisibleIndex): VisibleIndex;
|
|
192
|
+
/**
|
|
193
|
+
* Retrieve a map of the height of each floating row
|
|
194
|
+
* @param state The grid metric state
|
|
195
|
+
* @returns The heights of all the floating rows
|
|
196
|
+
*/
|
|
197
|
+
getFloatingRowHeights(state: GridMetricState): SizeMap;
|
|
198
|
+
/**
|
|
199
|
+
* Retrieve a map of the height of all the visible rows (non-floating)
|
|
200
|
+
* @param state The grid metric state
|
|
201
|
+
* @returns The heights of all the visible rows
|
|
202
|
+
*/
|
|
203
|
+
getVisibleRowHeights(state: GridMetricState): SizeMap;
|
|
204
|
+
/**
|
|
205
|
+
* Retrieve a map of the width of each floating column
|
|
206
|
+
* @param state The grid metric state
|
|
207
|
+
* @param firstColumn The first non-hidden column
|
|
208
|
+
* @param treePaddingX The amount of padding taken up for the tree expansion buttons
|
|
209
|
+
* @returns The widths of all the floating columns
|
|
210
|
+
*/
|
|
211
|
+
getFloatingColumnWidths(state: GridMetricState, firstColumn?: VisibleIndex, treePaddingX?: number): SizeMap;
|
|
212
|
+
/**
|
|
213
|
+
* Retrieve a map of the width of all the visible columns (non-floating)
|
|
214
|
+
* @param state The grid metric state
|
|
215
|
+
* @returns The widths of all the visible columns
|
|
216
|
+
*/
|
|
217
|
+
getVisibleColumnWidths(state: GridMetricState, firstColumn?: VisibleIndex, treePaddingX?: number): SizeMap;
|
|
218
|
+
/**
|
|
219
|
+
* Retrieve a map of all the floating columns to their x coordinate
|
|
220
|
+
* @param state The grid metric state
|
|
221
|
+
* @param columnWidthMap Map from visible index to column width
|
|
222
|
+
* @param maxX The maximum X size for the grid
|
|
223
|
+
* @returns Map of the x coordinate of all floating columns
|
|
224
|
+
*/
|
|
225
|
+
getFloatingColumnXs(state: GridMetricState, columnWidthMap: SizeMap, maxX: Coordinate): CoordinateMap;
|
|
226
|
+
/**
|
|
227
|
+
* Retrieve a map of all the visible columns to their x coordinate.
|
|
228
|
+
* Starts at leftOffset with the first index in `visibleColumns`, then
|
|
229
|
+
* calculates all the coordinates from there
|
|
230
|
+
* @param visibleColumnWidths Map of visible column index to widths
|
|
231
|
+
* @param visibleColumns All visible columns
|
|
232
|
+
* @param leftOffset The left scroll offset
|
|
233
|
+
* @returns Map of the x coordinate of all visible columns
|
|
234
|
+
*/
|
|
235
|
+
getVisibleColumnXs(visibleColumnWidths: SizeMap, visibleColumns: VisibleIndex[], leftOffset: number): CoordinateMap;
|
|
236
|
+
/**
|
|
237
|
+
* Retrieve a map of all the floating rows to their y coordinate
|
|
238
|
+
* @param state The grid metric state
|
|
239
|
+
* @param rowHeightMap Map of visible index to row height
|
|
240
|
+
* @param maxY The maximum Y size for the grid
|
|
241
|
+
* @returns Map of the y coordinate of all floating rows
|
|
242
|
+
*/
|
|
243
|
+
getFloatingRowYs(state: GridMetricState, rowHeightMap: SizeMap, maxY: Coordinate): CoordinateMap;
|
|
244
|
+
/**
|
|
245
|
+
* Retrieve a map of all the visible rows to their y coordinate.
|
|
246
|
+
* Starts at topOffset with the first index in `visibleRows`, then
|
|
247
|
+
* calculates all the coordinates from there
|
|
248
|
+
* @param visibleRowHeights Map of visible row index to heights
|
|
249
|
+
* @param visibleRows All visible rows
|
|
250
|
+
* @param topOffset The top scroll offset
|
|
251
|
+
* @returns Map of the y coordinate of all visible rows
|
|
252
|
+
*/
|
|
253
|
+
getVisibleRowYs(visibleRowHeights: SizeMap, visibleRows: VisibleIndex[], topOffset: number): CoordinateMap;
|
|
254
|
+
/**
|
|
255
|
+
* Calculates the tree box click areas that are visible. In relation to the columnX/rowY
|
|
256
|
+
* @param visibleRowHeights Map of visible index to row height
|
|
257
|
+
* @param modelRows Map from visible `Index` to `ModelIndex`
|
|
258
|
+
* @param state The grid metric state
|
|
259
|
+
* @returns Coordinates of tree boxes for each row
|
|
260
|
+
*/
|
|
261
|
+
getVisibleRowTreeBoxes(visibleRowHeights: SizeMap, modelRows: IndexModelMap, state: GridMetricState): Map<VisibleIndex, BoxCoordinates>;
|
|
262
|
+
/**
|
|
263
|
+
* Get the total width of the floating columns on the left
|
|
264
|
+
* @param state The grid metric state
|
|
265
|
+
* @param columnWidths Map of column index to width
|
|
266
|
+
* @returns The total width of the floating left section
|
|
267
|
+
*/
|
|
268
|
+
getFloatingLeftWidth(state: GridMetricState, columnWidths?: SizeMap): number;
|
|
269
|
+
/**
|
|
270
|
+
* Get the total width of the floating columns on the right
|
|
271
|
+
* @param state The grid metric state
|
|
272
|
+
* @param columnWidths Map of column index to width
|
|
273
|
+
* @returns The total width of the floating right section
|
|
274
|
+
*/
|
|
275
|
+
getFloatingRightWidth(state: GridMetricState, columnWidths?: SizeMap): number;
|
|
276
|
+
/**
|
|
277
|
+
* Get the total height of the floating rows on the top
|
|
278
|
+
* @param state The grid metric state
|
|
279
|
+
* @param rowHeights Map of row index to height
|
|
280
|
+
* @returns The total height of the floating top section
|
|
281
|
+
*/
|
|
282
|
+
getFloatingTopHeight(state: GridMetricState, rowHeights?: SizeMap): number;
|
|
283
|
+
/**
|
|
284
|
+
* Get the total height of the floating rows on the bottom
|
|
285
|
+
* @param state The grid metric state
|
|
286
|
+
* @param rowHeights Map of row index to height
|
|
287
|
+
* @returns The total height of the floating bottom section
|
|
288
|
+
*/
|
|
289
|
+
getFloatingBottomHeight(state: GridMetricState, rowHeights?: SizeMap): number;
|
|
290
|
+
/**
|
|
291
|
+
* Retrieve the index of the first fully visible row in the "visible" viewport of the grid.
|
|
292
|
+
* E.g. First row visible after the floating rows, provided the visible rows.
|
|
293
|
+
* @param state The grid metric state
|
|
294
|
+
* @param visibleRowYs Map of row index to y coordinate
|
|
295
|
+
* @param visibleRowHeights Map of row index to height
|
|
296
|
+
* @param visibleRows Array of visible row indexes
|
|
297
|
+
* @returns Index of the top visible row
|
|
298
|
+
*/
|
|
299
|
+
getTopVisible(state: GridMetricState, visibleRowYs: CoordinateMap, visibleRowHeights: SizeMap, visibleRows: VisibleIndex[]): VisibleIndex;
|
|
300
|
+
/**
|
|
301
|
+
* Retrieve the index of the first fully visible column in the "visible" viewport of the grid.
|
|
302
|
+
* E.g. First column visible after the floating columns, provided the visible columns.
|
|
303
|
+
* @param state The grid metric state
|
|
304
|
+
* @param visibleColumnXs Map of column index to x coordinate
|
|
305
|
+
* @param visibleColumnWidths Map of column index to widths
|
|
306
|
+
* @param visibleColumns Array of visible row indexes
|
|
307
|
+
* @returns Index of the left visible column
|
|
308
|
+
*/
|
|
309
|
+
getLeftVisible(state: GridMetricState, visibleColumnXs: CoordinateMap, visibleColumnWidths: SizeMap, visibleColumns: VisibleIndex[]): VisibleIndex;
|
|
310
|
+
/**
|
|
311
|
+
* Retrieve the index of the last fully visible row in the "visible" viewport of the grid.
|
|
312
|
+
* E.g. Last row visible before the bottom floating rows, provided the visible rows.
|
|
313
|
+
* @param state The grid metric state
|
|
314
|
+
* @param visibleRowYs Map of row index to y coordinate
|
|
315
|
+
* @param visibleRowHeights Map of row index to height
|
|
316
|
+
* @param visibleRows Array of visible row indexes
|
|
317
|
+
* @param gridY The starting y coordinate of the grid
|
|
318
|
+
* @returns Index of the bottom visible row
|
|
319
|
+
*/
|
|
320
|
+
getBottomVisible(state: GridMetricState, visibleRowYs: CoordinateMap, visibleRowHeights: SizeMap, visibleRows: VisibleIndex[], gridY: Coordinate): VisibleIndex;
|
|
321
|
+
/**
|
|
322
|
+
* Retrieve the index of the last fully visible column in the "visible" viewport of the grid.
|
|
323
|
+
* E.g. Last column visible before the floating columns, provided the visible columns.
|
|
324
|
+
* @param state The grid metric state
|
|
325
|
+
* @param visibleColumnXs Map of column index to x coordinate
|
|
326
|
+
* @param visibleColumnWidths Map of column index to widths
|
|
327
|
+
* @param visibleColumns Array of visible column indexes
|
|
328
|
+
* @returns Index of the right visible column
|
|
329
|
+
*/
|
|
330
|
+
getRightVisible(state: GridMetricState, visibleColumnXs: CoordinateMap, visibleColumnWidths: SizeMap, visibleColumns: VisibleIndex[], gridX: Coordinate): VisibleIndex;
|
|
331
|
+
/**
|
|
332
|
+
* Retrieve the possible bottom of the visible viewport (not limited by data size)
|
|
333
|
+
* @param state The grid metric state
|
|
334
|
+
* @param visibleRows Array of visible row indexes
|
|
335
|
+
* @param visibleRowYs Map of row index to y coordinate
|
|
336
|
+
* @param visibleRowHeights Map of row index to height
|
|
337
|
+
* @returns The index of the bottom viewport possible
|
|
338
|
+
*/
|
|
339
|
+
getBottomViewport(state: GridMetricState, visibleRows: VisibleIndex[], visibleRowYs: CoordinateMap, visibleRowHeights: SizeMap): VisibleIndex;
|
|
340
|
+
/**
|
|
341
|
+
* Retrieve the possible right of the visible viewport (not limited by data size)
|
|
342
|
+
* @param state The grid metric state
|
|
343
|
+
* @param visibleColumns Array of visible column indexes
|
|
344
|
+
* @param visibleColumnXs Map of column index to x coordinate
|
|
345
|
+
* @param visibleColumnWidths Map of column index to width
|
|
346
|
+
* @returns The index of the right viewport possible
|
|
347
|
+
*/
|
|
348
|
+
getRightViewport(state: GridMetricState, visibleColumns: VisibleIndex[], visibleColumnXs: CoordinateMap, visibleColumnWidths: SizeMap): VisibleIndex;
|
|
349
|
+
/**
|
|
350
|
+
* Get the Index of the of the last index visible
|
|
351
|
+
* @param items Array of visible item indexes
|
|
352
|
+
* @param itemXs Map of index to coordinate
|
|
353
|
+
* @param itemSizes Map of index to size
|
|
354
|
+
* @param maxSize Full size of the grid
|
|
355
|
+
* @param defaultItemSize Default size of an item
|
|
356
|
+
* @returns The Index of the last index visible
|
|
357
|
+
*/
|
|
358
|
+
getLastIndexViewport(items: VisibleIndex[], itemXs: CoordinateMap, itemSizes: SizeMap, maxSize: number, defaultItemSize: number): VisibleIndex;
|
|
359
|
+
/**
|
|
360
|
+
* Get the size from the provided size map of the specified item
|
|
361
|
+
* @param modelIndex The model index to get the size for
|
|
362
|
+
* @param userSizes The user set sizes
|
|
363
|
+
* @param calculateSize Method to calculate the size for this item
|
|
364
|
+
* @returns The size from the provided size map of the specified item
|
|
365
|
+
*/
|
|
366
|
+
getVisibleItemSize(modelIndex: ModelIndex, userSizes: ModelSizeMap, calculateSize: () => number): number;
|
|
367
|
+
/**
|
|
368
|
+
* Get the height of the specified row
|
|
369
|
+
* @param row Index of the row to get the height of
|
|
370
|
+
* @param state The grid metric state
|
|
371
|
+
* @returns The height of the row specified
|
|
372
|
+
*/
|
|
373
|
+
getVisibleRowHeight(row: VisibleIndex, state: GridMetricState): number;
|
|
374
|
+
/**
|
|
375
|
+
* Get the width of the specified column
|
|
376
|
+
* @param column Index of the column to get the width of
|
|
377
|
+
* @param state The grid metric state
|
|
378
|
+
* @param firstColumn Index of first visible column
|
|
379
|
+
* @param treePaddingX The amount of tree padding to add to the first visible column
|
|
380
|
+
* @returns The width of the column
|
|
381
|
+
*/
|
|
382
|
+
getVisibleColumnWidth(column: VisibleIndex, state: GridMetricState, firstColumn?: VisibleIndex, treePaddingX?: number): number;
|
|
383
|
+
/**
|
|
384
|
+
* Get a map of ModelIndex to Index
|
|
385
|
+
* @param visibleRows Array of visible row indexes
|
|
386
|
+
* @param state The grid metric state
|
|
387
|
+
* @returns Map of Index to ModelIndex
|
|
388
|
+
*/
|
|
389
|
+
getModelRows(visibleRows: VisibleIndex[], state: GridMetricState): IndexModelMap;
|
|
390
|
+
/**
|
|
391
|
+
* Get the ModelIndex of the specified row
|
|
392
|
+
* @param visibleRow Index of the row
|
|
393
|
+
* @param state The grid metric state
|
|
394
|
+
* @returns ModelIndex of the row
|
|
395
|
+
*/
|
|
396
|
+
getModelRow(visibleRow: VisibleIndex, state: GridMetricState): ModelIndex;
|
|
397
|
+
/**
|
|
398
|
+
* Get a map of Index to ModelIndex. Applies the move operations to get the transformation.
|
|
399
|
+
* @param visibleColumns Array of visible column indexes
|
|
400
|
+
* @param state The grid metric state
|
|
401
|
+
* @returns Map of Index to ModelIndex
|
|
402
|
+
*/
|
|
403
|
+
getModelColumns(visibleColumns: VisibleIndex[], state: GridMetricState): IndexModelMap;
|
|
404
|
+
/**
|
|
405
|
+
* Get the ModelIndex of the specified column
|
|
406
|
+
* @param visibleColumn Index of the column
|
|
407
|
+
* @param state The grid metric state
|
|
408
|
+
* @returns ModelIndex of the column
|
|
409
|
+
*/
|
|
410
|
+
getModelColumn(visibleColumn: VisibleIndex, state: GridMetricState): ModelIndex;
|
|
411
|
+
/**
|
|
412
|
+
* Calculate the height of the row specified.
|
|
413
|
+
* @param row Index of the row to calculate the height for
|
|
414
|
+
* @param modelRow ModelIndex of the row to calculate the height
|
|
415
|
+
* @param state The grid metric state
|
|
416
|
+
* @returns The height of the row
|
|
417
|
+
*/
|
|
418
|
+
calculateRowHeight(row: VisibleIndex, modelRow: ModelIndex, state: GridMetricState): number;
|
|
419
|
+
/**
|
|
420
|
+
* Calculates the column width based on the provided column model index
|
|
421
|
+
* @param column Index of the column to calculate the width for
|
|
422
|
+
* @param modelColumn ModelIndex of the column to calculate the width
|
|
423
|
+
* @param state The grid metric state
|
|
424
|
+
* @param firstColumn The first visible column
|
|
425
|
+
* @param treePaddingX Tree padding offset for expandable rows
|
|
426
|
+
* @returns The width of the column
|
|
427
|
+
*/
|
|
428
|
+
calculateColumnWidth(column: VisibleIndex, modelColumn: ModelIndex, state: GridMetricState, firstColumn?: VisibleIndex, treePaddingX?: number): number;
|
|
429
|
+
/**
|
|
430
|
+
* Calculate the width of the specified column's header
|
|
431
|
+
* @param modelColumn ModelIndex of the column to get the header width for
|
|
432
|
+
* @param state The grid metric state
|
|
433
|
+
* @returns The calculated width of the column header
|
|
434
|
+
*/
|
|
435
|
+
calculateColumnHeaderWidth(modelColumn: ModelIndex, state: GridMetricState): number;
|
|
436
|
+
/**
|
|
437
|
+
* Calculate the width of the specified column's data
|
|
438
|
+
* @param modelColumn ModelIndex of the column to get the data width for
|
|
439
|
+
* @param state The grid metric state
|
|
440
|
+
* @returns The calculated width of the column data
|
|
441
|
+
*/
|
|
442
|
+
calculateColumnDataWidth(modelColumn: ModelIndex, state: GridMetricState): number;
|
|
443
|
+
/**
|
|
444
|
+
* The coordinate for where the tree padding should be drawn
|
|
445
|
+
* @param state The grid metric state
|
|
446
|
+
* @returns The coordinate for tree padding
|
|
447
|
+
*/
|
|
448
|
+
calculateTreePaddingX(state: GridMetricState): Coordinate;
|
|
449
|
+
/**
|
|
450
|
+
* Get the width of the provided font. Exploits the fact that we're
|
|
451
|
+
* using tabular figures so every character is same width
|
|
452
|
+
* @param font The font to get the width for
|
|
453
|
+
* @param state The grid metric state
|
|
454
|
+
* @returns Width of the char `8` for the specified font
|
|
455
|
+
*/
|
|
456
|
+
getWidthForFont(font: GridFont, state: GridMetricState): number;
|
|
179
457
|
/**
|
|
180
458
|
* Sets the width for the specified column
|
|
181
|
-
* @param
|
|
182
|
-
* @param
|
|
459
|
+
* @param column The column model index to set
|
|
460
|
+
* @param size The size to set it to
|
|
183
461
|
*/
|
|
184
|
-
setColumnWidth(column:
|
|
462
|
+
setColumnWidth(column: ModelIndex, size: number): void;
|
|
185
463
|
/**
|
|
186
464
|
* Resets the column width for the specified column to the calculated width
|
|
187
|
-
* @param
|
|
465
|
+
* @param column The column model index to reset
|
|
188
466
|
*/
|
|
189
|
-
resetColumnWidth(column:
|
|
467
|
+
resetColumnWidth(column: ModelIndex): void;
|
|
190
468
|
/**
|
|
191
469
|
* Sets the width for the specified row
|
|
192
|
-
* @param
|
|
193
|
-
* @param
|
|
470
|
+
* @param row The row model index to set
|
|
471
|
+
* @param size The size to set it to
|
|
194
472
|
*/
|
|
195
|
-
setRowHeight(row:
|
|
196
|
-
|
|
473
|
+
setRowHeight(row: ModelIndex, size: number): void;
|
|
474
|
+
/**
|
|
475
|
+
* Resets the row height for the specified row to the calculated height
|
|
476
|
+
* @param row The row model index to reset
|
|
477
|
+
*/
|
|
478
|
+
resetRowHeight(row: ModelIndex): void;
|
|
197
479
|
}
|
|
480
|
+
export default GridMetricCalculator;
|
|
198
481
|
//# sourceMappingURL=GridMetricCalculator.d.ts.map
|