@kermodes/grid 0.0.0-stage → 0.3.13-dev.71.ge96feae
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/ColumnHeaderGroup.d.ts +8 -0
- package/dist/ContextMenu.d.ts +15 -0
- package/dist/EventHandlerResult.d.ts +16 -0
- package/dist/FilterBar.d.ts +32 -0
- package/dist/Grid.d.ts +458 -0
- package/dist/GridAxisRange.d.ts +9 -0
- package/dist/GridMetricCalculator.d.ts +509 -0
- package/dist/GridMetrics.d.ts +125 -0
- package/dist/GridModel.d.ts +96 -0
- package/dist/GridMouseHandler.d.ts +29 -0
- package/dist/GridRange.d.ts +268 -0
- package/dist/GridRenderer.d.ts +159 -0
- package/dist/GridRendererTypes.d.ts +25 -0
- package/dist/GridSelectionUtils.d.ts +97 -0
- package/dist/GridStyles.d.ts +2 -0
- package/dist/GridTheme.d.ts +96 -0
- package/dist/GridUtils.d.ts +457 -0
- package/dist/KeyHandler.d.ts +33 -0
- package/dist/RangedSelection.d.ts +118 -0
- package/dist/Selection.d.ts +218 -0
- package/dist/TableViewer.d.ts +16 -0
- package/dist/TableViewerGrid.d.ts +16 -0
- package/dist/TextCellRenderer.d.ts +8 -0
- package/dist/ThemeContext.d.ts +5 -0
- package/dist/ValuePopover.d.ts +23 -0
- package/dist/ViewportGridModel.d.ts +92 -0
- package/dist/cellValue.d.ts +11 -0
- package/dist/copy.d.ts +29 -0
- package/dist/cover.d.ts +16 -0
- package/dist/errors/AssertionError.d.ts +4 -0
- package/dist/errors/assertIsDefined.d.ts +2 -0
- package/dist/errors/index.d.ts +2 -0
- package/dist/fastMemoize.d.ts +50 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.js +7909 -0
- package/dist/key-handlers/SelectionKeyHandler.d.ts +11 -0
- package/dist/key-handlers/index.d.ts +1 -0
- package/dist/menuItems.d.ts +53 -0
- package/dist/mouse-handlers/GridColumnMoveMouseHandler.d.ts +50 -0
- package/dist/mouse-handlers/GridColumnSeparatorMouseHandler.d.ts +27 -0
- package/dist/mouse-handlers/GridHorizontalScrollBarMouseHandler.d.ts +24 -0
- package/dist/mouse-handlers/GridScrollBarCornerMouseHandler.d.ts +14 -0
- package/dist/mouse-handlers/GridSelectionMouseHandler.d.ts +19 -0
- package/dist/mouse-handlers/GridSeparatorMouseHandler.d.ts +61 -0
- package/dist/mouse-handlers/GridVerticalScrollBarMouseHandler.d.ts +24 -0
- package/dist/mouse-handlers/index.d.ts +8 -0
- package/dist/sorting.d.ts +19 -0
- package/dist/utils.d.ts +15 -0
- package/package.json +28 -3
- package/README.md +0 -3
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type EventHandlerResult } from '../EventHandlerResult';
|
|
2
|
+
import type Grid from '../Grid';
|
|
3
|
+
import KeyHandler, { type GridKeyboardEvent } from '../KeyHandler';
|
|
4
|
+
declare class SelectionKeyHandler extends KeyHandler {
|
|
5
|
+
onDown(event: GridKeyboardEvent, grid: Grid): EventHandlerResult;
|
|
6
|
+
handleArrowMove(deltaColumn: number, deltaRow: number, event: GridKeyboardEvent, grid: Grid): boolean;
|
|
7
|
+
handleRowEdge(targetColumn: number, event: GridKeyboardEvent, grid: Grid): boolean;
|
|
8
|
+
handlePageUp(e: GridKeyboardEvent, grid: Grid): boolean;
|
|
9
|
+
handlePageDown(e: GridKeyboardEvent, grid: Grid): boolean;
|
|
10
|
+
}
|
|
11
|
+
export default SelectionKeyHandler;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as SelectionKeyHandler } from './SelectionKeyHandler';
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { type SortKey } from '@kermodes/client';
|
|
2
|
+
/** What a menu item does; the viewer carries it out */
|
|
3
|
+
export type MenuAction = {
|
|
4
|
+
type: 'sort';
|
|
5
|
+
by: SortKey[];
|
|
6
|
+
} | {
|
|
7
|
+
type: 'filter';
|
|
8
|
+
column: string;
|
|
9
|
+
text: string;
|
|
10
|
+
} | {
|
|
11
|
+
type: 'edit-filter';
|
|
12
|
+
column: string;
|
|
13
|
+
} | {
|
|
14
|
+
type: 'clear-filters';
|
|
15
|
+
} | {
|
|
16
|
+
type: 'copy-cell';
|
|
17
|
+
} | {
|
|
18
|
+
type: 'show-value';
|
|
19
|
+
} | {
|
|
20
|
+
type: 'copy-selection';
|
|
21
|
+
header: boolean;
|
|
22
|
+
} | {
|
|
23
|
+
type: 'copy-text';
|
|
24
|
+
text: string;
|
|
25
|
+
};
|
|
26
|
+
export type MenuItem = {
|
|
27
|
+
label: string;
|
|
28
|
+
action: MenuAction;
|
|
29
|
+
hint?: string;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* What was right-clicked: a column header, or a cell with its raw value (null
|
|
33
|
+
* for a null) and the text the grid shows for it.
|
|
34
|
+
*/
|
|
35
|
+
export type MenuTarget = {
|
|
36
|
+
kind: 'header';
|
|
37
|
+
column: string;
|
|
38
|
+
type: string;
|
|
39
|
+
} | {
|
|
40
|
+
kind: 'cell';
|
|
41
|
+
column: string;
|
|
42
|
+
type: string;
|
|
43
|
+
value: unknown;
|
|
44
|
+
text: string;
|
|
45
|
+
};
|
|
46
|
+
/** The view the menu acts on */
|
|
47
|
+
export type MenuView = {
|
|
48
|
+
sort: readonly SortKey[];
|
|
49
|
+
filters: Readonly<Record<string, string>>;
|
|
50
|
+
isSelectionWide: boolean;
|
|
51
|
+
};
|
|
52
|
+
/** The menu for `target`, in sections separated by rules */
|
|
53
|
+
export declare function contextMenu(target: MenuTarget, view: MenuView): MenuItem[][];
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type Grid from '../Grid';
|
|
2
|
+
import { type GridPoint } from '../GridUtils';
|
|
3
|
+
import GridMouseHandler, { type GridMouseEvent } from '../GridMouseHandler';
|
|
4
|
+
import { type EventHandlerResult } from '../EventHandlerResult';
|
|
5
|
+
import type { VisibleIndex, MoveOperation, Coordinate } from '../GridMetrics';
|
|
6
|
+
import type { BoundedAxisRange } from '../GridAxisRange';
|
|
7
|
+
export interface DraggingColumn {
|
|
8
|
+
range: BoundedAxisRange;
|
|
9
|
+
depth: number;
|
|
10
|
+
left: Coordinate;
|
|
11
|
+
width: number;
|
|
12
|
+
}
|
|
13
|
+
interface ColumnInfo {
|
|
14
|
+
visibleIndex: VisibleIndex;
|
|
15
|
+
left: number;
|
|
16
|
+
right: number;
|
|
17
|
+
width: number;
|
|
18
|
+
}
|
|
19
|
+
declare class GridColumnMoveMouseHandler extends GridMouseHandler {
|
|
20
|
+
cursor: string | null;
|
|
21
|
+
private draggingOffset?;
|
|
22
|
+
private initialOffset?;
|
|
23
|
+
private initialGridPoint?;
|
|
24
|
+
private scrollingInterval?;
|
|
25
|
+
private scrollingDirection?;
|
|
26
|
+
private draggingColumn;
|
|
27
|
+
private setScrollInterval;
|
|
28
|
+
private clearScrollInterval;
|
|
29
|
+
onLeave(): EventHandlerResult;
|
|
30
|
+
onDown(gridPoint: GridPoint, grid: Grid): EventHandlerResult;
|
|
31
|
+
onDrag(gridPoint: GridPoint, grid: Grid, event: GridMouseEvent): EventHandlerResult;
|
|
32
|
+
/**
|
|
33
|
+
* Moves a dragging column, if possible, the specified distance
|
|
34
|
+
* @param mouseX The point the move was initiated from
|
|
35
|
+
* @param grid The Grid component
|
|
36
|
+
* @param deltaX The distance of the move
|
|
37
|
+
*/
|
|
38
|
+
moveDraggingColumn(mouseX: number, grid: Grid, deltaX: number): void;
|
|
39
|
+
/**
|
|
40
|
+
* Applies the column move and updates draggingColumn in the mouse handler
|
|
41
|
+
* Does not check if the move is valid
|
|
42
|
+
* @param draggingColumn The dragging column info
|
|
43
|
+
* @param to The index to move the column to
|
|
44
|
+
* @param movedColumns The array of column moves
|
|
45
|
+
* @returns A new array of column moves
|
|
46
|
+
*/
|
|
47
|
+
moveColumn(draggingColumn: ColumnInfo, to: number, movedColumns: readonly MoveOperation[]): readonly MoveOperation[];
|
|
48
|
+
onUp(_gridPoint: GridPoint, grid: Grid): EventHandlerResult;
|
|
49
|
+
}
|
|
50
|
+
export default GridColumnMoveMouseHandler;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type Grid from '../Grid';
|
|
2
|
+
import type GridMetricCalculator from '../GridMetricCalculator';
|
|
3
|
+
import type { ModelIndex, GridMetrics } from '../GridMetrics';
|
|
4
|
+
import type GridModel from '../GridModel';
|
|
5
|
+
import type { GridTheme } from '../GridTheme';
|
|
6
|
+
import GridUtils, { type GridPoint } from '../GridUtils';
|
|
7
|
+
import GridSeparatorMouseHandler, { type GridSeparator } from './GridSeparatorMouseHandler';
|
|
8
|
+
declare class GridColumnSeparatorMouseHandler extends GridSeparatorMouseHandler {
|
|
9
|
+
static getColumnSeparator(gridPoint: GridPoint, metrics: GridMetrics, model: GridModel, theme: GridTheme): GridSeparator | null;
|
|
10
|
+
hiddenCursor: string;
|
|
11
|
+
defaultCursor: string;
|
|
12
|
+
pointProperty: 'x';
|
|
13
|
+
userSizesProperty: 'userColumnWidths';
|
|
14
|
+
visibleOffsetProperty: 'visibleColumnXs';
|
|
15
|
+
visibleSizesProperty: 'visibleColumnWidths';
|
|
16
|
+
marginProperty: 'rowHeaderWidth';
|
|
17
|
+
calculatedSizesProperty: 'calculatedColumnWidths';
|
|
18
|
+
initialSizesProperty: 'initialColumnWidths';
|
|
19
|
+
modelIndexesProperty: 'modelColumns';
|
|
20
|
+
getHiddenItems: typeof GridUtils.getHiddenColumns;
|
|
21
|
+
getNextShownItem: typeof GridUtils.getNextShownColumn;
|
|
22
|
+
setSize(metricCalculator: GridMetricCalculator, modelIndex: ModelIndex, size: number): void;
|
|
23
|
+
resetSize(metricCalculator: GridMetricCalculator, modelIndex: ModelIndex): void;
|
|
24
|
+
updateSeparator(grid: Grid, separator: GridSeparator | null): void;
|
|
25
|
+
getSeparator: typeof GridColumnSeparatorMouseHandler.getColumnSeparator;
|
|
26
|
+
}
|
|
27
|
+
export default GridColumnSeparatorMouseHandler;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type EventHandlerResult } from '../EventHandlerResult';
|
|
2
|
+
import type Grid from '../Grid';
|
|
3
|
+
import { type VisibleIndex } from '../GridMetrics';
|
|
4
|
+
import GridMouseHandler from '../GridMouseHandler';
|
|
5
|
+
import { type GridPoint } from '../GridUtils';
|
|
6
|
+
declare class GridHorizontalScrollBarMouseHandler extends GridMouseHandler {
|
|
7
|
+
static getLeftWithOffsetFromRawLeft(grid: Grid, rawLeft: number): {
|
|
8
|
+
left: VisibleIndex;
|
|
9
|
+
leftOffset: number;
|
|
10
|
+
};
|
|
11
|
+
private dragOffset?;
|
|
12
|
+
cursor: string;
|
|
13
|
+
isInScrollBar(gridPoint: GridPoint, grid: Grid): boolean;
|
|
14
|
+
getLeftWithOffset(gridPoint: GridPoint, grid: Grid): {
|
|
15
|
+
left: number;
|
|
16
|
+
leftOffset: number;
|
|
17
|
+
};
|
|
18
|
+
onDown(gridPoint: GridPoint, grid: Grid): EventHandlerResult;
|
|
19
|
+
onDrag(gridPoint: GridPoint, grid: Grid): EventHandlerResult;
|
|
20
|
+
onMove(gridPoint: GridPoint, grid: Grid): EventHandlerResult;
|
|
21
|
+
onUp(gridPoint: GridPoint, grid: Grid): EventHandlerResult;
|
|
22
|
+
onClick(gridPoint: GridPoint, grid: Grid): EventHandlerResult;
|
|
23
|
+
}
|
|
24
|
+
export default GridHorizontalScrollBarMouseHandler;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type EventHandlerResult } from '../EventHandlerResult';
|
|
2
|
+
import type Grid from '../Grid';
|
|
3
|
+
import GridMouseHandler from '../GridMouseHandler';
|
|
4
|
+
import { type GridPoint } from '../GridUtils';
|
|
5
|
+
/**
|
|
6
|
+
* Used to eat the mouse event in the bottom right corner of the scroll bar
|
|
7
|
+
*/
|
|
8
|
+
declare class GridScrollBarCornerMouseHandler extends GridMouseHandler {
|
|
9
|
+
isInCorner(gridPoint: GridPoint, grid: Grid): boolean;
|
|
10
|
+
onDown(gridPoint: GridPoint, grid: Grid): EventHandlerResult;
|
|
11
|
+
onUp(gridPoint: GridPoint, grid: Grid): EventHandlerResult;
|
|
12
|
+
onClick(gridPoint: GridPoint, grid: Grid): EventHandlerResult;
|
|
13
|
+
}
|
|
14
|
+
export default GridScrollBarCornerMouseHandler;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type EventHandlerResult } from '../EventHandlerResult';
|
|
2
|
+
import type Grid from '../Grid';
|
|
3
|
+
import GridMouseHandler, { type GridMouseEvent } from '../GridMouseHandler';
|
|
4
|
+
import { type GridPoint } from '../GridUtils';
|
|
5
|
+
declare class GridSelectionMouseHandler extends GridMouseHandler {
|
|
6
|
+
private startPoint?;
|
|
7
|
+
private hasExtendedFloating;
|
|
8
|
+
private timer?;
|
|
9
|
+
private lastTriggerTime?;
|
|
10
|
+
onDown(gridPoint: GridPoint, grid: Grid, event: GridMouseEvent): EventHandlerResult;
|
|
11
|
+
onDrag(gridPoint: GridPoint, grid: Grid): EventHandlerResult;
|
|
12
|
+
onUp(gridPoint: GridPoint, grid: Grid): EventHandlerResult;
|
|
13
|
+
onDoubleClick(gridPoint: GridPoint, grid: Grid, event: GridMouseEvent): EventHandlerResult;
|
|
14
|
+
onContextMenu(gridPoint: GridPoint, grid: Grid, event: GridMouseEvent): EventHandlerResult;
|
|
15
|
+
moveSelection(grid: Grid, gridPoint: GridPoint, deltaX: number, deltaY: number): void;
|
|
16
|
+
startTimer(grid: Grid, gridPoint: GridPoint, deltaX: number, deltaY: number): void;
|
|
17
|
+
stopTimer(): void;
|
|
18
|
+
}
|
|
19
|
+
export default GridSelectionMouseHandler;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type Grid from '../Grid';
|
|
2
|
+
import type { GridMetricCalculator } from '../GridMetricCalculator';
|
|
3
|
+
import type GridModel from '../GridModel';
|
|
4
|
+
import { type EventHandlerResult } from '../EventHandlerResult';
|
|
5
|
+
import { type ModelIndex, type VisibleIndex } from '../GridMetrics';
|
|
6
|
+
import type GridMetrics from '../GridMetrics';
|
|
7
|
+
import GridMouseHandler from '../GridMouseHandler';
|
|
8
|
+
import type { GridTheme } from '../GridTheme';
|
|
9
|
+
import type { GridPoint } from '../GridUtils';
|
|
10
|
+
export type PointProperty = 'x' | 'y';
|
|
11
|
+
export type UserSizeProperty = 'userRowHeights' | 'userColumnWidths';
|
|
12
|
+
export type VisibleOffsetProperty = 'visibleRowYs' | 'visibleColumnXs';
|
|
13
|
+
export type VisibleSizeProperty = 'visibleRowHeights' | 'visibleColumnWidths';
|
|
14
|
+
export type MarginProperty = 'columnHeaderHeight' | 'rowHeaderWidth';
|
|
15
|
+
export type CalculatedSizeProperty = 'calculatedRowHeights' | 'calculatedColumnWidths';
|
|
16
|
+
export type InitialSizeProperty = 'initialRowHeights' | 'initialColumnWidths';
|
|
17
|
+
export type ModelIndexesProperty = 'modelRows' | 'modelColumns';
|
|
18
|
+
export interface GridSeparator {
|
|
19
|
+
index: VisibleIndex;
|
|
20
|
+
depth: number;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Abstract class that should be extended for column/row behavior
|
|
24
|
+
* Override the necessary functions/properties
|
|
25
|
+
*/
|
|
26
|
+
declare abstract class GridSeparatorMouseHandler extends GridMouseHandler {
|
|
27
|
+
protected draggingIndex?: VisibleIndex;
|
|
28
|
+
protected resizingItems: VisibleIndex[];
|
|
29
|
+
protected hiddenItems: VisibleIndex[];
|
|
30
|
+
protected targetSizes: Map<VisibleIndex, number>;
|
|
31
|
+
protected dragOffset: number;
|
|
32
|
+
abstract hiddenCursor: string;
|
|
33
|
+
abstract defaultCursor: string;
|
|
34
|
+
abstract pointProperty: PointProperty;
|
|
35
|
+
abstract userSizesProperty: UserSizeProperty;
|
|
36
|
+
abstract visibleOffsetProperty: VisibleOffsetProperty;
|
|
37
|
+
abstract visibleSizesProperty: VisibleSizeProperty;
|
|
38
|
+
abstract marginProperty: MarginProperty;
|
|
39
|
+
abstract calculatedSizesProperty: CalculatedSizeProperty;
|
|
40
|
+
abstract initialSizesProperty: InitialSizeProperty;
|
|
41
|
+
abstract modelIndexesProperty: ModelIndexesProperty;
|
|
42
|
+
abstract getHiddenItems(itemIndex: VisibleIndex, metrics: GridMetrics): VisibleIndex[];
|
|
43
|
+
abstract getNextShownItem(itemIndex: VisibleIndex, metrics: GridMetrics): VisibleIndex | null;
|
|
44
|
+
abstract setSize(metricCalculator: GridMetricCalculator, modelIndex: ModelIndex, size: number): void;
|
|
45
|
+
abstract resetSize(metricCalculator: GridMetricCalculator, modelIndex: ModelIndex): void;
|
|
46
|
+
abstract updateSeparator(grid: Grid, separator: GridSeparator | null): void;
|
|
47
|
+
abstract getSeparator(gridPoint: GridPoint, metrics: GridMetrics, model: GridModel, theme: GridTheme): GridSeparator | null;
|
|
48
|
+
onDown(gridPoint: GridPoint, grid: Grid): EventHandlerResult;
|
|
49
|
+
onMove(gridPoint: GridPoint, grid: Grid): EventHandlerResult;
|
|
50
|
+
onDrag(gridPoint: GridPoint, grid: Grid): EventHandlerResult;
|
|
51
|
+
onUp(gridPoint: GridPoint, grid: Grid): EventHandlerResult;
|
|
52
|
+
onDoubleClick(gridPoint: GridPoint, grid: Grid): EventHandlerResult;
|
|
53
|
+
updateCursor(metrics: GridMetrics, itemIndex: VisibleIndex): void;
|
|
54
|
+
/**
|
|
55
|
+
* Record the size the item should snap back to while dragging.
|
|
56
|
+
* @returns False if the item has no metrics to derive a target size from
|
|
57
|
+
*/
|
|
58
|
+
addTargetSize(metrics: GridMetrics, itemIndex: VisibleIndex): boolean;
|
|
59
|
+
removeTargetSize(itemIndex: VisibleIndex): void;
|
|
60
|
+
}
|
|
61
|
+
export default GridSeparatorMouseHandler;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type EventHandlerResult } from '../EventHandlerResult';
|
|
2
|
+
import type Grid from '../Grid';
|
|
3
|
+
import { type VisibleIndex } from '../GridMetrics';
|
|
4
|
+
import GridMouseHandler from '../GridMouseHandler';
|
|
5
|
+
import { type GridPoint } from '../GridUtils';
|
|
6
|
+
declare class GridVerticalScrollBarMouseHandler extends GridMouseHandler {
|
|
7
|
+
static getTopWithOffsetFromRawTop(grid: Grid, rawTop: number): {
|
|
8
|
+
top: VisibleIndex;
|
|
9
|
+
topOffset: number;
|
|
10
|
+
};
|
|
11
|
+
private dragOffset?;
|
|
12
|
+
cursor: string;
|
|
13
|
+
isInScrollBar(gridPoint: GridPoint, grid: Grid): boolean;
|
|
14
|
+
getTopWithOffset(gridPoint: GridPoint, grid: Grid): {
|
|
15
|
+
top: number;
|
|
16
|
+
topOffset: number;
|
|
17
|
+
};
|
|
18
|
+
onDown(gridPoint: GridPoint, grid: Grid): EventHandlerResult;
|
|
19
|
+
onMove(gridPoint: GridPoint, grid: Grid): EventHandlerResult;
|
|
20
|
+
onDrag(gridPoint: GridPoint, grid: Grid): EventHandlerResult;
|
|
21
|
+
onUp(gridPoint: GridPoint, grid: Grid): EventHandlerResult;
|
|
22
|
+
onClick(gridPoint: GridPoint, grid: Grid): EventHandlerResult;
|
|
23
|
+
}
|
|
24
|
+
export default GridVerticalScrollBarMouseHandler;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { default as GridSelectionMouseHandler } from './GridSelectionMouseHandler';
|
|
2
|
+
export { default as GridColumnSeparatorMouseHandler } from './GridColumnSeparatorMouseHandler';
|
|
3
|
+
export { default as GridHorizontalScrollBarMouseHandler } from './GridHorizontalScrollBarMouseHandler';
|
|
4
|
+
export { default as GridScrollBarCornerMouseHandler } from './GridScrollBarCornerMouseHandler';
|
|
5
|
+
export { default as GridVerticalScrollBarMouseHandler } from './GridVerticalScrollBarMouseHandler';
|
|
6
|
+
export * from './GridSeparatorMouseHandler';
|
|
7
|
+
export { default as GridColumnMoveMouseHandler } from './GridColumnMoveMouseHandler';
|
|
8
|
+
export type { DraggingColumn } from './GridColumnMoveMouseHandler';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type SortKey } from '@kermodes/client';
|
|
2
|
+
/**
|
|
3
|
+
* The sort after clicking the header of `column`. Each click cycles the column
|
|
4
|
+
* ascending → descending → unsorted. A plain click makes it the only key; an
|
|
5
|
+
* additive (shift) click cycles it in place, appending it as the last key if it
|
|
6
|
+
* was unsorted, and keeps the other keys.
|
|
7
|
+
*/
|
|
8
|
+
export declare function nextSort(sort: readonly SortKey[], column: string, additive: boolean): SortKey[];
|
|
9
|
+
/**
|
|
10
|
+
* What the viewer shows on an engine report. `sent` is the number of the last
|
|
11
|
+
* sort or filter sent, `applied` the highest the engine reports done: until it
|
|
12
|
+
* catches up the rows predate a change, which can take seconds on a big table,
|
|
13
|
+
* so they are `pending` and the header keeps the sort `asked` for (`null` if
|
|
14
|
+
* none was) rather than flip back to the old one the reports still carry.
|
|
15
|
+
*/
|
|
16
|
+
export declare function shownView(sent: number, applied: number, asked: readonly SortKey[] | null, reported: readonly SortKey[]): {
|
|
17
|
+
pending: boolean;
|
|
18
|
+
sort: readonly SortKey[];
|
|
19
|
+
};
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const EMPTY_ARRAY: readonly never[];
|
|
2
|
+
export declare function clamp(value: number, lower: number, upper: number): number;
|
|
3
|
+
export declare function assertNotNull<T>(value: T | null | undefined, message?: string): asserts value is T;
|
|
4
|
+
export declare function assertNotNaN(value: number, message?: string): void;
|
|
5
|
+
/**
|
|
6
|
+
* Retrieve a value from a map. If the value is not found and no default value is provided, throw.
|
|
7
|
+
* Use when the value _must_ be present
|
|
8
|
+
* @param map The map to get the value from
|
|
9
|
+
* @param key The key to fetch the value for
|
|
10
|
+
* @param defaultValue A default value to set if the key is not present
|
|
11
|
+
* @returns The value set for that key
|
|
12
|
+
*/
|
|
13
|
+
export declare function getOrThrow<K, V>(map: ReadonlyMap<K, V>, key: K, defaultValue?: V | undefined): V;
|
|
14
|
+
/** Keys whose values differ (by identity) between two objects */
|
|
15
|
+
export declare function getChangedKeys(oldObject: object, newObject: object): string[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kermodes/grid",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.3.13-dev.71.ge96feae",
|
|
4
|
+
"license": "Apache-2.0",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/reecetec/kermodes.git",
|
|
8
|
+
"directory": "web/grid"
|
|
9
|
+
},
|
|
10
|
+
"type": "module",
|
|
11
|
+
"main": "./dist/index.js",
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"import": "./dist/index.js"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist"
|
|
21
|
+
],
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@kermodes/client": "0.3.13-dev.71.ge96feae",
|
|
24
|
+
"apache-arrow": "^21.0.0",
|
|
25
|
+
"classnames": "^2.5.1",
|
|
26
|
+
"memoize-one": "^6.0.0"
|
|
27
|
+
},
|
|
28
|
+
"peerDependencies": {
|
|
29
|
+
"react": "^19.0.0"
|
|
30
|
+
}
|
|
6
31
|
}
|
package/README.md
DELETED