@1771technologies/lytenyte-pro 2.0.3 → 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/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 +10 -5
- 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,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 {};
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Splits a cell selection rectangle into multiple rectangles when it crosses specified boundary regions.
|
|
3
|
-
* This is useful for handling selections that span across different grid sections (e.g., fixed columns/rows,
|
|
4
|
-
* scrollable areas).
|
|
5
|
-
*
|
|
6
|
-
* The splitting process happens in two phases:
|
|
7
|
-
* 1. Column-wise splitting: Splits rectangles that cross column section boundaries
|
|
8
|
-
* 2. Row-wise splitting: Further splits the resulting rectangles if they cross row section boundaries
|
|
9
|
-
*
|
|
10
|
-
* Splitting does not support full width rows. It is assumed that if full width rows are present then
|
|
11
|
-
* the cell selection will just be drawn over them
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* // For a grid with 2 fixed start columns and 1 fixed top row:
|
|
15
|
-
* const splits = splitCellSelectionRect({
|
|
16
|
-
* rect: { columnStart: 0, columnEnd: 3, rowStart: 0, rowEnd: 2 },
|
|
17
|
-
* colStartCount: 2, // Number of fixed start columns
|
|
18
|
-
* colCenterCount: 10, // Number of scrollable columns
|
|
19
|
-
* rowTopCount: 1, // Number of fixed top rows
|
|
20
|
-
* rowCenterCount: 50 // Number of scrollable rows
|
|
21
|
-
* });
|
|
22
|
-
*
|
|
23
|
-
* @param rect - The original cell selection rectangle to split
|
|
24
|
-
* @param colStartCount - Number of columns in the start (usually fixed) section
|
|
25
|
-
* @param colCenterCount - Number of columns in the center (usually scrollable) section
|
|
26
|
-
* @param rowTopCount - Number of rows in the top (usually fixed) section
|
|
27
|
-
* @param rowCenterCount - Number of rows in the center (usually scrollable) section
|
|
28
|
-
* @returns An array of split rectangles. If no splits were necessary, returns an array with just the original rectangle
|
|
29
|
-
*/
|
|
30
|
-
export function splitCellSelectionRect({ rect, colStartCount, colCenterCount, rowTopCount, rowCenterCount, }) {
|
|
31
|
-
// Calculate the boundary positions for columns
|
|
32
|
-
const colStartBound = colStartCount;
|
|
33
|
-
const colEndBound = colStartCount + colCenterCount;
|
|
34
|
-
const colSplits = [];
|
|
35
|
-
// Handle column splits first
|
|
36
|
-
// Case 1: Selection starts before the fixed columns and extends into the scrollable area
|
|
37
|
-
if (rect.columnStart < colStartBound && rect.columnEnd > colStartBound) {
|
|
38
|
-
const startSplit = {
|
|
39
|
-
...rect,
|
|
40
|
-
columnEnd: colStartBound,
|
|
41
|
-
};
|
|
42
|
-
colSplits.push(startSplit);
|
|
43
|
-
rect = { ...rect, columnStart: colStartBound };
|
|
44
|
-
}
|
|
45
|
-
// Case 2: Selection starts in the scrollable area and extends into the end section
|
|
46
|
-
if (rect.columnStart < colEndBound && rect.columnEnd > colEndBound) {
|
|
47
|
-
const endSplit = {
|
|
48
|
-
...rect,
|
|
49
|
-
columnStart: colEndBound,
|
|
50
|
-
};
|
|
51
|
-
rect = { ...rect, columnEnd: colEndBound };
|
|
52
|
-
colSplits.push(endSplit);
|
|
53
|
-
}
|
|
54
|
-
// Add the remaining rectangle after column splits
|
|
55
|
-
colSplits.push({ ...rect });
|
|
56
|
-
// Calculate the boundary positions for rows
|
|
57
|
-
const topBound = rowTopCount;
|
|
58
|
-
const bottomBound = rowTopCount + rowCenterCount;
|
|
59
|
-
// Process row splits for each column-split rectangle
|
|
60
|
-
const rowSplits = [];
|
|
61
|
-
for (let split of colSplits) {
|
|
62
|
-
// Case 1: Selection spans from top section into center section
|
|
63
|
-
if (split.rowStart < topBound && split.rowEnd > topBound) {
|
|
64
|
-
const topSplit = { ...split, rowEnd: topBound };
|
|
65
|
-
split = { ...split, rowStart: topBound };
|
|
66
|
-
rowSplits.push(topSplit);
|
|
67
|
-
}
|
|
68
|
-
// Case 2: Selection spans from center section into bottom section
|
|
69
|
-
if (split.rowStart < bottomBound && split.rowEnd > bottomBound) {
|
|
70
|
-
const bottomSplit = {
|
|
71
|
-
...split,
|
|
72
|
-
rowStart: bottomBound,
|
|
73
|
-
};
|
|
74
|
-
split = { ...split, rowEnd: bottomBound };
|
|
75
|
-
rowSplits.push(bottomSplit);
|
|
76
|
-
}
|
|
77
|
-
rowSplits.push(split);
|
|
78
|
-
}
|
|
79
|
-
return rowSplits
|
|
80
|
-
.map((c) => ({ ...c, borderTop: true, borderBottom: true, borderEnd: true, borderStart: true }))
|
|
81
|
-
.sort((l, r) => {
|
|
82
|
-
return l.rowStart - r.rowStart || l.columnStart - r.columnStart;
|
|
83
|
-
});
|
|
84
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { ColumnView } from "@1771technologies/lytenyte-shared";
|
|
2
|
-
import type { API, DataRect } from "../types/api.js";
|
|
3
|
-
import type { DataRectSplit } from "../types/grid.js";
|
|
4
|
-
export declare function updateAdditiveCellSelection(api: API, view: ColumnView, rowTopCount: number, rowCount: number, rowBottomCount: number, rect: DataRect, cellSelectionAdditiveRects: DataRectSplit[] | null, setSelectionAdditiveRects: (d: DataRectSplit[] | null) => void): void;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { boundSelectionRect } from "./bound-selection-rect.js";
|
|
2
|
-
import { adjustRectForRowAndCellSpan } from "./adjust-rect-for-row-and-cell-span.js";
|
|
3
|
-
import { areRectsEqual } from "./are-rects-equal.js";
|
|
4
|
-
import { splitCellSelectionRect } from "./split-cell-selection-rect.js";
|
|
5
|
-
export function updateAdditiveCellSelection(api, view, rowTopCount, rowCount, rowBottomCount, rect, cellSelectionAdditiveRects, setSelectionAdditiveRects) {
|
|
6
|
-
const s = view;
|
|
7
|
-
const adjustedRect = adjustRectForRowAndCellSpan(api.cellRoot, rect);
|
|
8
|
-
const rects = splitCellSelectionRect({
|
|
9
|
-
rect: boundSelectionRect(view, rowCount, adjustedRect),
|
|
10
|
-
colCenterCount: s.centerCount,
|
|
11
|
-
colStartCount: s.startCount,
|
|
12
|
-
rowCenterCount: rowCount - rowTopCount - rowBottomCount,
|
|
13
|
-
rowTopCount: rowTopCount,
|
|
14
|
-
});
|
|
15
|
-
const current = cellSelectionAdditiveRects;
|
|
16
|
-
if (current && current.length === rects.length) {
|
|
17
|
-
if (current.every((c, i) => areRectsEqual(c, rects[i])))
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
setSelectionAdditiveRects(rects);
|
|
21
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { useRoot } from "@1771technologies/lytenyte-core/internal";
|
|
2
|
-
import { useCallback, useRef } from "react";
|
|
3
|
-
export function useEdgeScroll() {
|
|
4
|
-
const { viewport, dimensions, totalHeaderHeight, yPositions, source } = useRoot();
|
|
5
|
-
const rowTopCount = source.useTopCount();
|
|
6
|
-
const rowBottomCount = source.useBottomCount();
|
|
7
|
-
const bottomHeight = yPositions.at(-1) - yPositions.at(-1 - rowBottomCount);
|
|
8
|
-
const topHeight = yPositions.at(rowTopCount);
|
|
9
|
-
const intervalIdX = useRef(null);
|
|
10
|
-
const intervalIdY = useRef(null);
|
|
11
|
-
const cancelX = useCallback(() => {
|
|
12
|
-
if (intervalIdX.current) {
|
|
13
|
-
clearInterval(intervalIdX.current);
|
|
14
|
-
intervalIdX.current = null;
|
|
15
|
-
}
|
|
16
|
-
}, []);
|
|
17
|
-
const cancelY = useCallback(() => {
|
|
18
|
-
if (intervalIdY.current) {
|
|
19
|
-
clearInterval(intervalIdY.current);
|
|
20
|
-
intervalIdY.current = null;
|
|
21
|
-
}
|
|
22
|
-
}, []);
|
|
23
|
-
const edgeScrollY = useCallback((visualPositionY, startY) => {
|
|
24
|
-
if (!viewport)
|
|
25
|
-
return;
|
|
26
|
-
const viewportClientHeight = dimensions.innerHeight;
|
|
27
|
-
const topBound = totalHeaderHeight + topHeight;
|
|
28
|
-
const botBound = viewportClientHeight - bottomHeight;
|
|
29
|
-
const scrollTop = startY > topBound && visualPositionY <= totalHeaderHeight + 20;
|
|
30
|
-
const scrollBottom = startY < botBound && visualPositionY >= viewportClientHeight - 20;
|
|
31
|
-
const speed = 6;
|
|
32
|
-
if (scrollTop && !intervalIdY.current) {
|
|
33
|
-
intervalIdY.current = setInterval(() => {
|
|
34
|
-
viewport.scrollBy({ top: -speed });
|
|
35
|
-
}, 6);
|
|
36
|
-
}
|
|
37
|
-
else if (scrollBottom && !intervalIdY.current) {
|
|
38
|
-
intervalIdY.current = setInterval(() => {
|
|
39
|
-
viewport.scrollBy({ top: speed });
|
|
40
|
-
}, 6);
|
|
41
|
-
}
|
|
42
|
-
if (!scrollBottom && !scrollTop && intervalIdY.current) {
|
|
43
|
-
clearInterval(intervalIdY.current);
|
|
44
|
-
intervalIdY.current = null;
|
|
45
|
-
}
|
|
46
|
-
}, [bottomHeight, dimensions.innerHeight, topHeight, totalHeaderHeight, viewport]);
|
|
47
|
-
const edgeScrollX = useCallback((visualPositionX, isRtl) => {
|
|
48
|
-
if (!viewport)
|
|
49
|
-
return;
|
|
50
|
-
const viewportClientWidth = dimensions.innerWidth;
|
|
51
|
-
const viewportWidth = Math.min(viewportClientWidth * 0.1, 100);
|
|
52
|
-
const buffer = viewportWidth;
|
|
53
|
-
const leftBound = buffer;
|
|
54
|
-
const rightBound = viewportClientWidth - buffer;
|
|
55
|
-
const speed = 3;
|
|
56
|
-
if (visualPositionX < leftBound && !intervalIdX.current) {
|
|
57
|
-
intervalIdX.current = setInterval(() => {
|
|
58
|
-
viewport.scrollBy({ left: isRtl ? speed : -speed });
|
|
59
|
-
}, 6);
|
|
60
|
-
}
|
|
61
|
-
else if (visualPositionX > rightBound && !intervalIdX.current) {
|
|
62
|
-
intervalIdX.current = setInterval(() => {
|
|
63
|
-
viewport.scrollBy({ left: isRtl ? -speed : speed });
|
|
64
|
-
}, 6);
|
|
65
|
-
}
|
|
66
|
-
if (intervalIdX.current && visualPositionX > leftBound && visualPositionX < rightBound) {
|
|
67
|
-
cancelX();
|
|
68
|
-
}
|
|
69
|
-
}, [cancelX, dimensions.innerWidth, viewport]);
|
|
70
|
-
return { cancelX, edgeScrollX, cancelY, edgeScrollY };
|
|
71
|
-
}
|
package/dist/root/context.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { type Dispatch, type RefObject, type SetStateAction } from "react";
|
|
2
|
-
import type { API, DataRect, DataRectSplit } from "../types";
|
|
3
|
-
export interface ProContext {
|
|
4
|
-
readonly api: API;
|
|
5
|
-
readonly excludeMarker: boolean;
|
|
6
|
-
readonly keepSelection: boolean;
|
|
7
|
-
readonly cellSelections: DataRect[];
|
|
8
|
-
readonly onCellSelectionChange: (rect: DataRect[]) => void;
|
|
9
|
-
readonly cellSelectionMode: "range" | "multi-range" | "none";
|
|
10
|
-
readonly cellSelectionAdditiveRects: DataRectSplit[] | null;
|
|
11
|
-
readonly setCellSelectionAdditiveRects: Dispatch<SetStateAction<DataRectSplit[] | null>>;
|
|
12
|
-
readonly cellSelectionIsDeselect: RefObject<boolean>;
|
|
13
|
-
readonly cellSelectionSplits: DataRectSplit[];
|
|
14
|
-
}
|
|
15
|
-
export declare const ProRootProvider: import("react").Provider<ProContext>;
|
|
16
|
-
export declare const useProRoot: () => ProContext;
|
package/dist/root/context.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { useEvent, useRoot } from "@1771technologies/lytenyte-core/internal";
|
|
2
|
-
import {} from "@1771technologies/lytenyte-shared";
|
|
3
|
-
export function useProAPI(cellSelections) {
|
|
4
|
-
const { api: coreApi } = useRoot();
|
|
5
|
-
const api = coreApi;
|
|
6
|
-
api.cellSelections = useEvent(() => cellSelections);
|
|
7
|
-
return api;
|
|
8
|
-
}
|