@1771technologies/lytenyte-pro 2.0.2 → 2.0.4-dev.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/README.md +297 -11
- package/dist/components/headless/dialog/container.js +1 -2
- package/dist/components/select-all.d.ts +1 -1
- package/dist/data-source-client/hooks/use-flattened-data.d.ts +1 -1
- package/dist/data-source-client/hooks/use-pivot/auxiliary-functions/apply-reference-column.d.ts +1 -1
- package/dist/data-source-client/hooks/use-pivot/auxiliary-functions/pivot-paths.d.ts +1 -1
- package/dist/data-source-client/hooks/use-pivot/use-agg-model.d.ts +1 -1
- package/dist/data-source-client/hooks/use-pivot/use-pivot-columns.d.ts +1 -1
- package/dist/data-source-client/hooks/use-pivot/use-pivot-data.d.ts +1 -1
- package/dist/data-source-client/hooks/use-pivot/use-pivot-group-fn.d.ts +1 -1
- package/dist/data-source-client/use-client-data-source.d.ts +1 -3
- package/dist/index.d.ts +1 -3
- package/dist/root/root.d.ts +5 -8
- package/dist/root/root.js +5 -83
- package/dist/types.d.ts +3 -0
- package/package.json +27 -6
- package/dist/cell-selection/adjust-rect-for-row-and-cell-span.d.ts +0 -2
- package/dist/cell-selection/adjust-rect-for-row-and-cell-span.js +0 -43
- package/dist/cell-selection/are-rects-equal.d.ts +0 -2
- package/dist/cell-selection/are-rects-equal.js +0 -6
- package/dist/cell-selection/bound-selection-rect.d.ts +0 -3
- package/dist/cell-selection/bound-selection-rect.js +0 -16
- package/dist/cell-selection/cell-selection-containers.d.ts +0 -3
- package/dist/cell-selection/cell-selection-containers.js +0 -86
- package/dist/cell-selection/cell-selection-driver/cell-selection-driver.d.ts +0 -1
- package/dist/cell-selection/cell-selection-driver/cell-selection-driver.js +0 -279
- package/dist/cell-selection/cell-selection-driver/use-cell-focus-change.d.ts +0 -5
- package/dist/cell-selection/cell-selection-driver/use-cell-focus-change.js +0 -34
- package/dist/cell-selection/cell-style-row.d.ts +0 -8
- package/dist/cell-selection/cell-style-row.js +0 -79
- package/dist/cell-selection/data-rect-from-cell-position.d.ts +0 -3
- package/dist/cell-selection/data-rect-from-cell-position.js +0 -17
- package/dist/cell-selection/deselect-rect-range.d.ts +0 -2
- package/dist/cell-selection/deselect-rect-range.js +0 -43
- package/dist/cell-selection/expand-selection-down.d.ts +0 -3
- package/dist/cell-selection/expand-selection-down.js +0 -78
- package/dist/cell-selection/expand-selection-end.d.ts +0 -3
- package/dist/cell-selection/expand-selection-end.js +0 -76
- package/dist/cell-selection/expand-selection-start.d.ts +0 -3
- package/dist/cell-selection/expand-selection-start.js +0 -73
- package/dist/cell-selection/expand-selection-up.d.ts +0 -3
- package/dist/cell-selection/expand-selection-up.js +0 -74
- package/dist/cell-selection/full-width-start-end-index.d.ts +0 -2
- package/dist/cell-selection/full-width-start-end-index.js +0 -4
- package/dist/cell-selection/get-root-cell.d.ts +0 -3
- package/dist/cell-selection/get-root-cell.js +0 -6
- package/dist/cell-selection/index.d.ts +0 -11
- package/dist/cell-selection/index.js +0 -11
- package/dist/cell-selection/is-bottom-rect.d.ts +0 -2
- package/dist/cell-selection/is-bottom-rect.js +0 -4
- package/dist/cell-selection/is-center-col-rect.d.ts +0 -5
- package/dist/cell-selection/is-center-col-rect.js +0 -3
- package/dist/cell-selection/is-center-rect.d.ts +0 -2
- package/dist/cell-selection/is-center-rect.js +0 -4
- package/dist/cell-selection/is-end-rect.d.ts +0 -5
- package/dist/cell-selection/is-end-rect.js +0 -3
- package/dist/cell-selection/is-fully-within-rect.d.ts +0 -2
- package/dist/cell-selection/is-fully-within-rect.js +0 -6
- package/dist/cell-selection/is-overlapping-rect.d.ts +0 -2
- package/dist/cell-selection/is-overlapping-rect.js +0 -5
- package/dist/cell-selection/is-start-rect.d.ts +0 -5
- package/dist/cell-selection/is-start-rect.js +0 -3
- package/dist/cell-selection/is-top-rect.d.ts +0 -2
- package/dist/cell-selection/is-top-rect.js +0 -3
- package/dist/cell-selection/is-within-selection-rect.d.ts +0 -2
- package/dist/cell-selection/is-within-selection-rect.js +0 -3
- package/dist/cell-selection/split-cell-selection-rect.d.ts +0 -41
- package/dist/cell-selection/split-cell-selection-rect.js +0 -84
- package/dist/cell-selection/update-additive-cell-selection.d.ts +0 -4
- package/dist/cell-selection/update-additive-cell-selection.js +0 -21
- package/dist/cell-selection/use-edge-scroll.d.ts +0 -6
- package/dist/cell-selection/use-edge-scroll.js +0 -71
- package/dist/root/context.d.ts +0 -16
- package/dist/root/context.js +0 -4
- package/dist/root/hooks/use-pro-api.d.ts +0 -2
- package/dist/root/hooks/use-pro-api.js +0 -8
- package/dist/types/api.d.ts +0 -100
- package/dist/types/column.d.ts +0 -73
- package/dist/types/column.js +0 -1
- package/dist/types/events.d.ts +0 -56
- package/dist/types/events.js +0 -1
- package/dist/types/grid.d.ts +0 -46
- package/dist/types/grid.js +0 -1
- package/dist/types/index.d.ts +0 -7
- package/dist/types/index.js +0 -1
- package/dist/types/props.d.ts +0 -187
- package/dist/types/props.js +0 -1
- /package/dist/{types/api.js → types.js} +0 -0
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export function dataRectFromCellPosition(position) {
|
|
2
|
-
if (position.root) {
|
|
3
|
-
const r = position.root;
|
|
4
|
-
return {
|
|
5
|
-
rowStart: r.rowIndex,
|
|
6
|
-
rowEnd: r.rowIndex + r.rowSpan,
|
|
7
|
-
columnStart: r.colIndex,
|
|
8
|
-
columnEnd: r.colIndex + r.colSpan,
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
return {
|
|
12
|
-
rowStart: position.rowIndex,
|
|
13
|
-
rowEnd: position.rowIndex + 1,
|
|
14
|
-
columnStart: position.colIndex,
|
|
15
|
-
columnEnd: position.colIndex + 1,
|
|
16
|
-
};
|
|
17
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { isOverlappingRect } from "./is-overlapping-rect.js";
|
|
2
|
-
export function deselectRectRange(rect, deselectRect) {
|
|
3
|
-
if (!isOverlappingRect(rect, deselectRect))
|
|
4
|
-
return [rect];
|
|
5
|
-
const result = [];
|
|
6
|
-
// Check for top split
|
|
7
|
-
if (deselectRect.rowStart > rect.rowStart) {
|
|
8
|
-
result.push({
|
|
9
|
-
rowStart: rect.rowStart,
|
|
10
|
-
rowEnd: deselectRect.rowStart,
|
|
11
|
-
columnStart: rect.columnStart,
|
|
12
|
-
columnEnd: rect.columnEnd,
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
// Check for bottom split
|
|
16
|
-
if (deselectRect.rowEnd < rect.rowEnd) {
|
|
17
|
-
result.push({
|
|
18
|
-
rowStart: deselectRect.rowEnd,
|
|
19
|
-
rowEnd: rect.rowEnd,
|
|
20
|
-
columnStart: rect.columnStart,
|
|
21
|
-
columnEnd: rect.columnEnd,
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
// Check for left split
|
|
25
|
-
if (deselectRect.columnStart > rect.columnStart) {
|
|
26
|
-
result.push({
|
|
27
|
-
rowStart: Math.max(deselectRect.rowStart, rect.rowStart),
|
|
28
|
-
rowEnd: Math.min(deselectRect.rowEnd, rect.rowEnd),
|
|
29
|
-
columnStart: rect.columnStart,
|
|
30
|
-
columnEnd: deselectRect.columnStart,
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
// Check for right split
|
|
34
|
-
if (deselectRect.columnEnd < rect.columnEnd) {
|
|
35
|
-
result.push({
|
|
36
|
-
rowStart: Math.max(deselectRect.rowStart, rect.rowStart),
|
|
37
|
-
rowEnd: Math.min(deselectRect.rowEnd, rect.rowEnd),
|
|
38
|
-
columnStart: deselectRect.columnEnd,
|
|
39
|
-
columnEnd: rect.columnEnd,
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
return result.filter((rect) => !(rect.rowStart >= rect.rowEnd || rect.columnStart >= rect.columnEnd));
|
|
43
|
-
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { PositionGridCell } from "@1771technologies/lytenyte-shared";
|
|
2
|
-
import type { API, DataRect } from "../types/api.js";
|
|
3
|
-
export declare function expandSelectionDown(api: API, selections: DataRect[], setSelections: (d: DataRect[]) => void, meta: boolean, position: PositionGridCell, rowCount: number): void;
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { dataRectFromCellPosition } from "./data-rect-from-cell-position.js";
|
|
2
|
-
import { isOverlappingRect } from "./is-overlapping-rect.js";
|
|
3
|
-
import { isFullyWithinRect } from "./is-fully-within-rect.js";
|
|
4
|
-
export function expandSelectionDown(api, selections, setSelections, meta, position, rowCount) {
|
|
5
|
-
const pos = dataRectFromCellPosition(position);
|
|
6
|
-
const rect = selections.at(-1);
|
|
7
|
-
if (!rect || !isOverlappingRect(rect, pos) || isFullyWithinRect(pos, rect))
|
|
8
|
-
return;
|
|
9
|
-
if (meta) {
|
|
10
|
-
const next = { ...rect, rowEnd: rowCount, rowStart: pos.rowStart };
|
|
11
|
-
const nextSelections = [...selections];
|
|
12
|
-
nextSelections[nextSelections.length - 1] = next;
|
|
13
|
-
setSelections(nextSelections);
|
|
14
|
-
if (pos.rowStart !== 0)
|
|
15
|
-
api.scrollIntoView({ row: rowCount - 1 });
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
const isAtEdge = pos.rowStart == rect.rowStart || pos.rowEnd === rect.rowEnd;
|
|
19
|
-
let pivotStart = pos.rowStart;
|
|
20
|
-
let pivotEnd = pos.rowEnd;
|
|
21
|
-
// Our cell some how is spanned over. so for the current rowIndex, find the maximum span along the columns
|
|
22
|
-
if (!isAtEdge) {
|
|
23
|
-
for (let i = rect.columnStart; i < rect.columnEnd; i++) {
|
|
24
|
-
const cell = dataRectFromCellPosition(api.cellRoot(pos.rowStart, i));
|
|
25
|
-
pivotStart = Math.min(pivotStart, cell.rowStart);
|
|
26
|
-
pivotEnd = Math.max(pivotEnd, cell.rowEnd);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
let next;
|
|
30
|
-
// Reduce our rect by one level
|
|
31
|
-
if (rect.rowStart < pivotStart) {
|
|
32
|
-
let highestRowEnd = -Infinity;
|
|
33
|
-
let setCell = rect;
|
|
34
|
-
for (let i = rect.columnStart; i < rect.columnEnd; i++) {
|
|
35
|
-
const cell = dataRectFromCellPosition(api.cellRoot(rect.rowStart + 1, i));
|
|
36
|
-
if (cell.rowStart > highestRowEnd) {
|
|
37
|
-
setCell = cell;
|
|
38
|
-
highestRowEnd = cell.rowStart;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
api.scrollIntoView({ row: highestRowEnd });
|
|
42
|
-
next = {
|
|
43
|
-
...rect,
|
|
44
|
-
rowStart: highestRowEnd,
|
|
45
|
-
columnStart: Math.min(setCell.columnStart, rect.columnStart),
|
|
46
|
-
columnEnd: Math.max(setCell.columnEnd, rect.columnEnd),
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
// Move the rect level down by one.
|
|
51
|
-
let highestRowEnd = -Infinity;
|
|
52
|
-
let setCell = rect;
|
|
53
|
-
if (rect.rowEnd >= rowCount) {
|
|
54
|
-
highestRowEnd = rowCount;
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
for (let i = rect.columnStart; i < rect.columnEnd; i++) {
|
|
58
|
-
const cell = dataRectFromCellPosition(api.cellRoot(rect.rowEnd, i));
|
|
59
|
-
highestRowEnd = Math.max(cell.rowEnd, highestRowEnd);
|
|
60
|
-
if (cell.rowEnd > highestRowEnd) {
|
|
61
|
-
setCell = cell;
|
|
62
|
-
highestRowEnd = cell.rowEnd;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
api.scrollIntoView({ row: highestRowEnd - 1 });
|
|
67
|
-
next = {
|
|
68
|
-
...rect,
|
|
69
|
-
rowEnd: highestRowEnd,
|
|
70
|
-
columnStart: Math.min(setCell.columnStart, rect.columnStart),
|
|
71
|
-
columnEnd: Math.max(setCell.columnEnd, rect.columnEnd),
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
const nextSelections = [...selections];
|
|
75
|
-
nextSelections[nextSelections.length - 1] = next;
|
|
76
|
-
setSelections(nextSelections);
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { ColumnView, PositionGridCell } from "@1771technologies/lytenyte-shared";
|
|
2
|
-
import type { API, DataRect } from "../types/api.js";
|
|
3
|
-
export declare function expandSelectionEnd(api: API, selections: DataRect[], setSelections: (d: DataRect[]) => void, meta: boolean, position: PositionGridCell, view: ColumnView): void;
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { dataRectFromCellPosition } from "./data-rect-from-cell-position.js";
|
|
2
|
-
import { isOverlappingRect } from "./is-overlapping-rect.js";
|
|
3
|
-
import { isFullyWithinRect } from "./is-fully-within-rect.js";
|
|
4
|
-
export function expandSelectionEnd(api, selections, setSelections, meta, position, view) {
|
|
5
|
-
const pos = dataRectFromCellPosition(position);
|
|
6
|
-
const rect = selections.at(-1);
|
|
7
|
-
if (!rect || !isOverlappingRect(rect, pos) || isFullyWithinRect(pos, rect))
|
|
8
|
-
return;
|
|
9
|
-
if (meta) {
|
|
10
|
-
const next = {
|
|
11
|
-
...rect,
|
|
12
|
-
columnStart: pos.columnStart,
|
|
13
|
-
columnEnd: view.visibleColumns.length,
|
|
14
|
-
};
|
|
15
|
-
const nextSelections = [...selections];
|
|
16
|
-
nextSelections[nextSelections.length - 1] = next;
|
|
17
|
-
setSelections(nextSelections);
|
|
18
|
-
if (pos.columnStart !== 0)
|
|
19
|
-
api.scrollIntoView({ column: view.visibleColumns.length - 1 });
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
const isAtEdge = pos.columnStart == rect.columnStart || pos.columnEnd === rect.columnEnd;
|
|
23
|
-
let pivotStart = pos.columnStart;
|
|
24
|
-
let pivotEnd = pos.columnEnd;
|
|
25
|
-
// Our cell some how is spanned over. so for the current rowIndex, find the maximum span along the columns
|
|
26
|
-
if (!isAtEdge) {
|
|
27
|
-
for (let i = rect.rowStart; i < rect.rowEnd; i++) {
|
|
28
|
-
const cell = dataRectFromCellPosition(api.cellRoot(pos.columnStart, i));
|
|
29
|
-
pivotStart = Math.min(pivotStart, cell.columnStart);
|
|
30
|
-
pivotEnd = Math.max(pivotEnd, cell.columnEnd);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
let next;
|
|
34
|
-
if (rect.columnStart < pivotStart) {
|
|
35
|
-
let highestColEnd = -Infinity;
|
|
36
|
-
let setCell = rect;
|
|
37
|
-
for (let i = rect.rowStart; i < rect.rowEnd; i++) {
|
|
38
|
-
const cell = dataRectFromCellPosition(api.cellRoot(i, rect.columnStart + 1));
|
|
39
|
-
if (cell.columnStart > highestColEnd) {
|
|
40
|
-
highestColEnd = cell.columnStart;
|
|
41
|
-
setCell = cell;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
next = {
|
|
45
|
-
...rect,
|
|
46
|
-
columnStart: highestColEnd,
|
|
47
|
-
rowStart: Math.min(setCell.rowStart, rect.rowStart),
|
|
48
|
-
rowEnd: Math.max(setCell.rowEnd, rect.rowEnd),
|
|
49
|
-
};
|
|
50
|
-
api.scrollIntoView({ column: highestColEnd });
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
if (rect.columnEnd === view.visibleColumns.length)
|
|
54
|
-
return;
|
|
55
|
-
let highestColEnd = -Infinity;
|
|
56
|
-
let setCell = rect;
|
|
57
|
-
for (let i = rect.rowStart; i < rect.rowEnd; i++) {
|
|
58
|
-
const cell = dataRectFromCellPosition(api.cellRoot(i, rect.columnEnd));
|
|
59
|
-
if (cell.columnStart > highestColEnd) {
|
|
60
|
-
highestColEnd = cell.columnStart;
|
|
61
|
-
setCell = cell;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
next = {
|
|
65
|
-
...rect,
|
|
66
|
-
columnEnd: highestColEnd + 1,
|
|
67
|
-
rowStart: Math.min(setCell.rowStart, rect.rowStart),
|
|
68
|
-
rowEnd: Math.max(setCell.rowEnd, rect.rowEnd),
|
|
69
|
-
};
|
|
70
|
-
api.scrollIntoView({ column: highestColEnd - 1 });
|
|
71
|
-
}
|
|
72
|
-
const nextSelections = [...selections];
|
|
73
|
-
nextSelections[nextSelections.length - 1] = next;
|
|
74
|
-
setSelections(nextSelections);
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { ColumnView, PositionGridCell } from "@1771technologies/lytenyte-shared";
|
|
2
|
-
import type { API, DataRect } from "../types/api.js";
|
|
3
|
-
export declare function expandSelectionStart(api: API, selections: DataRect[], setSelections: (d: DataRect[]) => void, meta: boolean, position: PositionGridCell, excludeMarker: boolean, view: ColumnView): void;
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { dataRectFromCellPosition } from "./data-rect-from-cell-position.js";
|
|
2
|
-
import { isOverlappingRect } from "./is-overlapping-rect.js";
|
|
3
|
-
import { isFullyWithinRect } from "./is-fully-within-rect.js";
|
|
4
|
-
export function expandSelectionStart(api, selections, setSelections, meta, position, excludeMarker, view) {
|
|
5
|
-
const pos = dataRectFromCellPosition(position);
|
|
6
|
-
const rect = selections.at(-1);
|
|
7
|
-
if (!rect || !isOverlappingRect(rect, pos) || isFullyWithinRect(pos, rect))
|
|
8
|
-
return;
|
|
9
|
-
const first = excludeMarker ? 1 : 0;
|
|
10
|
-
if (meta) {
|
|
11
|
-
const next = { ...rect, columnStart: first, columnEnd: pos.columnStart + 1 };
|
|
12
|
-
const nextSelections = [...selections];
|
|
13
|
-
nextSelections[nextSelections.length - 1] = next;
|
|
14
|
-
setSelections(nextSelections);
|
|
15
|
-
if (pos.columnStart !== view.visibleColumns.length - 1)
|
|
16
|
-
api.scrollIntoView({ column: first });
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
const isAtEdge = pos.columnStart == rect.columnStart || pos.columnEnd === rect.columnEnd;
|
|
20
|
-
let pivotStart = pos.columnStart;
|
|
21
|
-
let pivotEnd = pos.columnEnd;
|
|
22
|
-
// Our cell some how is spanned over. so for the current rowIndex, find the maximum span along the columns
|
|
23
|
-
if (!isAtEdge) {
|
|
24
|
-
for (let i = rect.rowStart; i < rect.rowEnd; i++) {
|
|
25
|
-
const cell = dataRectFromCellPosition(api.cellRoot(pos.columnStart, i));
|
|
26
|
-
pivotStart = Math.min(pivotStart, cell.columnStart);
|
|
27
|
-
pivotEnd = Math.max(pivotEnd, cell.columnEnd);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
let next;
|
|
31
|
-
if (rect.columnEnd <= pivotEnd) {
|
|
32
|
-
if (rect.columnStart === first)
|
|
33
|
-
return;
|
|
34
|
-
let highestColEnd = -Infinity;
|
|
35
|
-
let setCell = rect;
|
|
36
|
-
for (let i = rect.rowStart; i < rect.rowEnd; i++) {
|
|
37
|
-
const cell = dataRectFromCellPosition(api.cellRoot(i, rect.columnStart - 1));
|
|
38
|
-
if (cell.columnStart > highestColEnd) {
|
|
39
|
-
highestColEnd = cell.columnStart;
|
|
40
|
-
setCell = cell;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
next = {
|
|
44
|
-
...rect,
|
|
45
|
-
columnStart: highestColEnd,
|
|
46
|
-
rowStart: Math.min(setCell.rowStart, rect.rowStart),
|
|
47
|
-
rowEnd: Math.max(setCell.rowEnd, rect.rowEnd),
|
|
48
|
-
};
|
|
49
|
-
api.scrollIntoView({ column: highestColEnd });
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
let highestColEnd = -Infinity;
|
|
53
|
-
let setCell = rect;
|
|
54
|
-
for (let i = rect.rowStart; i < rect.rowEnd; i++) {
|
|
55
|
-
const cell = dataRectFromCellPosition(api.cellRoot(i, rect.columnEnd - 1));
|
|
56
|
-
if (cell.columnStart > highestColEnd) {
|
|
57
|
-
highestColEnd = cell.columnStart;
|
|
58
|
-
setCell = cell;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
next = {
|
|
62
|
-
...rect,
|
|
63
|
-
columnEnd: highestColEnd,
|
|
64
|
-
rowStart: Math.min(setCell.rowStart, rect.rowStart),
|
|
65
|
-
rowEnd: Math.max(setCell.rowEnd, rect.rowEnd),
|
|
66
|
-
};
|
|
67
|
-
api.scrollIntoView({ column: highestColEnd - 1 });
|
|
68
|
-
}
|
|
69
|
-
const nextSelections = [...selections];
|
|
70
|
-
nextSelections[nextSelections.length - 1] = next;
|
|
71
|
-
setSelections(nextSelections);
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { PositionGridCell } from "@1771technologies/lytenyte-shared";
|
|
2
|
-
import type { API, DataRect } from "../types/api.js";
|
|
3
|
-
export declare function expandSelectionUp(api: API, selections: DataRect[], setSelections: (d: DataRect[]) => void, meta: boolean, position: PositionGridCell, rowCount: number): void;
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { dataRectFromCellPosition } from "./data-rect-from-cell-position.js";
|
|
2
|
-
import { isOverlappingRect } from "./is-overlapping-rect.js";
|
|
3
|
-
import { isFullyWithinRect } from "./is-fully-within-rect.js";
|
|
4
|
-
export function expandSelectionUp(api, selections, setSelections, meta, position, rowCount) {
|
|
5
|
-
const pos = dataRectFromCellPosition(position);
|
|
6
|
-
const rect = selections.at(-1);
|
|
7
|
-
if (!rect || !isOverlappingRect(rect, pos) || isFullyWithinRect(pos, rect))
|
|
8
|
-
return;
|
|
9
|
-
if (meta) {
|
|
10
|
-
const next = { ...rect, rowStart: 0, rowEnd: pos.rowStart + 1 };
|
|
11
|
-
const nextSelections = [...selections];
|
|
12
|
-
nextSelections[nextSelections.length - 1] = next;
|
|
13
|
-
setSelections(nextSelections);
|
|
14
|
-
if (pos.rowStart !== rowCount - 1)
|
|
15
|
-
api.scrollIntoView({ row: 0 });
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
const isAtEdge = pos.rowStart == rect.rowStart || pos.rowEnd === rect.rowEnd;
|
|
19
|
-
let pivotStart = pos.rowStart;
|
|
20
|
-
let pivotEnd = pos.rowEnd;
|
|
21
|
-
// Our cell some how is spanned over. so for the current rowIndex, find the maximum span along the columns
|
|
22
|
-
if (!isAtEdge) {
|
|
23
|
-
for (let i = rect.columnStart; i < rect.columnEnd; i++) {
|
|
24
|
-
const cell = dataRectFromCellPosition(api.cellRoot(pos.rowStart, i));
|
|
25
|
-
pivotStart = Math.min(pivotStart, cell.rowStart);
|
|
26
|
-
pivotEnd = Math.max(pivotEnd, cell.rowEnd);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
let next;
|
|
30
|
-
if (rect.rowEnd > pivotEnd) {
|
|
31
|
-
let lowestRowStart = Infinity;
|
|
32
|
-
let c = rect;
|
|
33
|
-
for (let i = rect.columnStart; i < rect.columnEnd; i++) {
|
|
34
|
-
const cell = dataRectFromCellPosition(api.cellRoot(rect.rowEnd - 1, i));
|
|
35
|
-
lowestRowStart = Math.min(cell.rowStart, lowestRowStart);
|
|
36
|
-
if (cell.rowStart < lowestRowStart) {
|
|
37
|
-
lowestRowStart = cell.rowStart;
|
|
38
|
-
c = cell;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
api.scrollIntoView({ row: lowestRowStart - 1 });
|
|
42
|
-
next = {
|
|
43
|
-
...rect,
|
|
44
|
-
rowEnd: lowestRowStart,
|
|
45
|
-
columnStart: Math.min(c.columnStart, rect.columnStart),
|
|
46
|
-
columnEnd: Math.max(c.columnEnd, rect.columnEnd),
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
if (rect.rowStart === 0)
|
|
51
|
-
return;
|
|
52
|
-
let lowestRowStart = Infinity;
|
|
53
|
-
let c = rect;
|
|
54
|
-
for (let i = rect.columnStart; i < rect.columnEnd; i++) {
|
|
55
|
-
const cell = dataRectFromCellPosition(api.cellRoot(rect.rowStart - 1, i));
|
|
56
|
-
lowestRowStart = Math.min(cell.rowStart, lowestRowStart);
|
|
57
|
-
if (cell.rowStart < lowestRowStart) {
|
|
58
|
-
lowestRowStart = cell.rowStart;
|
|
59
|
-
c = cell;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
api.scrollIntoView({ row: lowestRowStart });
|
|
63
|
-
next = {
|
|
64
|
-
...rect,
|
|
65
|
-
rowStart: lowestRowStart,
|
|
66
|
-
columnStart: Math.min(c.columnStart, rect.columnStart),
|
|
67
|
-
columnEnd: Math.max(c.columnEnd, rect.columnEnd),
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
const nextSelections = [...selections];
|
|
71
|
-
nextSelections[nextSelections.length - 1] = next;
|
|
72
|
-
setSelections(nextSelections);
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export { isWithinSelectionRect } from "./is-within-selection-rect.js";
|
|
2
|
-
export { boundSelectionRect } from "./bound-selection-rect.js";
|
|
3
|
-
export { fullWidthStartEndIndex } from "./full-width-start-end-index.js";
|
|
4
|
-
export { areRectsEqual } from "./are-rects-equal.js";
|
|
5
|
-
export { updateAdditiveCellSelection } from "./update-additive-cell-selection.js";
|
|
6
|
-
export { isBottomRect } from "./is-bottom-rect.js";
|
|
7
|
-
export { isCenterRect } from "./is-center-rect.js";
|
|
8
|
-
export { isTopRect } from "./is-top-rect.js";
|
|
9
|
-
export { isCenterColRect } from "./is-center-col-rect.js";
|
|
10
|
-
export { isStartRect } from "./is-start-rect.js";
|
|
11
|
-
export { isEndRect } from "./is-end-rect.js";
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export { isWithinSelectionRect } from "./is-within-selection-rect.js";
|
|
2
|
-
export { boundSelectionRect } from "./bound-selection-rect.js";
|
|
3
|
-
export { fullWidthStartEndIndex } from "./full-width-start-end-index.js";
|
|
4
|
-
export { areRectsEqual } from "./are-rects-equal.js";
|
|
5
|
-
export { updateAdditiveCellSelection } from "./update-additive-cell-selection.js";
|
|
6
|
-
export { isBottomRect } from "./is-bottom-rect.js";
|
|
7
|
-
export { isCenterRect } from "./is-center-rect.js";
|
|
8
|
-
export { isTopRect } from "./is-top-rect.js";
|
|
9
|
-
export { isCenterColRect } from "./is-center-col-rect.js";
|
|
10
|
-
export { isStartRect } from "./is-start-rect.js";
|
|
11
|
-
export { isEndRect } from "./is-end-rect.js";
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import type { DataRect } from "../types/api.js";
|
|
2
|
-
import type { DataRectSplit } from "../types/grid.js";
|
|
3
|
-
interface SplitCellSelectionRectArgs {
|
|
4
|
-
readonly rect: DataRect;
|
|
5
|
-
readonly colStartCount: number;
|
|
6
|
-
readonly colCenterCount: number;
|
|
7
|
-
readonly rowTopCount: number;
|
|
8
|
-
readonly rowCenterCount: number;
|
|
9
|
-
readonly isDeselect?: boolean;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Splits a cell selection rectangle into multiple rectangles when it crosses specified boundary regions.
|
|
13
|
-
* This is useful for handling selections that span across different grid sections (e.g., fixed columns/rows,
|
|
14
|
-
* scrollable areas).
|
|
15
|
-
*
|
|
16
|
-
* The splitting process happens in two phases:
|
|
17
|
-
* 1. Column-wise splitting: Splits rectangles that cross column section boundaries
|
|
18
|
-
* 2. Row-wise splitting: Further splits the resulting rectangles if they cross row section boundaries
|
|
19
|
-
*
|
|
20
|
-
* Splitting does not support full width rows. It is assumed that if full width rows are present then
|
|
21
|
-
* the cell selection will just be drawn over them
|
|
22
|
-
*
|
|
23
|
-
* @example
|
|
24
|
-
* // For a grid with 2 fixed start columns and 1 fixed top row:
|
|
25
|
-
* const splits = splitCellSelectionRect({
|
|
26
|
-
* rect: { columnStart: 0, columnEnd: 3, rowStart: 0, rowEnd: 2 },
|
|
27
|
-
* colStartCount: 2, // Number of fixed start columns
|
|
28
|
-
* colCenterCount: 10, // Number of scrollable columns
|
|
29
|
-
* rowTopCount: 1, // Number of fixed top rows
|
|
30
|
-
* rowCenterCount: 50 // Number of scrollable rows
|
|
31
|
-
* });
|
|
32
|
-
*
|
|
33
|
-
* @param rect - The original cell selection rectangle to split
|
|
34
|
-
* @param colStartCount - Number of columns in the start (usually fixed) section
|
|
35
|
-
* @param colCenterCount - Number of columns in the center (usually scrollable) section
|
|
36
|
-
* @param rowTopCount - Number of rows in the top (usually fixed) section
|
|
37
|
-
* @param rowCenterCount - Number of rows in the center (usually scrollable) section
|
|
38
|
-
* @returns An array of split rectangles. If no splits were necessary, returns an array with just the original rectangle
|
|
39
|
-
*/
|
|
40
|
-
export declare function splitCellSelectionRect({ rect, colStartCount, colCenterCount, rowTopCount, rowCenterCount, }: SplitCellSelectionRectArgs): DataRectSplit[];
|
|
41
|
-
export {};
|