@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.
Files changed (86) hide show
  1. package/dist/components/select-all.d.ts +1 -1
  2. package/dist/data-source-client/hooks/use-flattened-data.d.ts +1 -1
  3. package/dist/data-source-client/hooks/use-pivot/auxiliary-functions/apply-reference-column.d.ts +1 -1
  4. package/dist/data-source-client/hooks/use-pivot/auxiliary-functions/pivot-paths.d.ts +1 -1
  5. package/dist/data-source-client/hooks/use-pivot/use-agg-model.d.ts +1 -1
  6. package/dist/data-source-client/hooks/use-pivot/use-pivot-columns.d.ts +1 -1
  7. package/dist/data-source-client/hooks/use-pivot/use-pivot-data.d.ts +1 -1
  8. package/dist/data-source-client/hooks/use-pivot/use-pivot-group-fn.d.ts +1 -1
  9. package/dist/data-source-client/use-client-data-source.d.ts +1 -3
  10. package/dist/index.d.ts +1 -3
  11. package/dist/root/root.d.ts +5 -8
  12. package/dist/root/root.js +5 -83
  13. package/dist/types.d.ts +3 -0
  14. package/package.json +10 -5
  15. package/dist/cell-selection/adjust-rect-for-row-and-cell-span.d.ts +0 -2
  16. package/dist/cell-selection/adjust-rect-for-row-and-cell-span.js +0 -43
  17. package/dist/cell-selection/are-rects-equal.d.ts +0 -2
  18. package/dist/cell-selection/are-rects-equal.js +0 -6
  19. package/dist/cell-selection/bound-selection-rect.d.ts +0 -3
  20. package/dist/cell-selection/bound-selection-rect.js +0 -16
  21. package/dist/cell-selection/cell-selection-containers.d.ts +0 -3
  22. package/dist/cell-selection/cell-selection-containers.js +0 -86
  23. package/dist/cell-selection/cell-selection-driver/cell-selection-driver.d.ts +0 -1
  24. package/dist/cell-selection/cell-selection-driver/cell-selection-driver.js +0 -279
  25. package/dist/cell-selection/cell-selection-driver/use-cell-focus-change.d.ts +0 -5
  26. package/dist/cell-selection/cell-selection-driver/use-cell-focus-change.js +0 -34
  27. package/dist/cell-selection/cell-style-row.d.ts +0 -8
  28. package/dist/cell-selection/cell-style-row.js +0 -79
  29. package/dist/cell-selection/data-rect-from-cell-position.d.ts +0 -3
  30. package/dist/cell-selection/data-rect-from-cell-position.js +0 -17
  31. package/dist/cell-selection/deselect-rect-range.d.ts +0 -2
  32. package/dist/cell-selection/deselect-rect-range.js +0 -43
  33. package/dist/cell-selection/expand-selection-down.d.ts +0 -3
  34. package/dist/cell-selection/expand-selection-down.js +0 -78
  35. package/dist/cell-selection/expand-selection-end.d.ts +0 -3
  36. package/dist/cell-selection/expand-selection-end.js +0 -76
  37. package/dist/cell-selection/expand-selection-start.d.ts +0 -3
  38. package/dist/cell-selection/expand-selection-start.js +0 -73
  39. package/dist/cell-selection/expand-selection-up.d.ts +0 -3
  40. package/dist/cell-selection/expand-selection-up.js +0 -74
  41. package/dist/cell-selection/full-width-start-end-index.d.ts +0 -2
  42. package/dist/cell-selection/full-width-start-end-index.js +0 -4
  43. package/dist/cell-selection/get-root-cell.d.ts +0 -3
  44. package/dist/cell-selection/get-root-cell.js +0 -6
  45. package/dist/cell-selection/index.d.ts +0 -11
  46. package/dist/cell-selection/index.js +0 -11
  47. package/dist/cell-selection/is-bottom-rect.d.ts +0 -2
  48. package/dist/cell-selection/is-bottom-rect.js +0 -4
  49. package/dist/cell-selection/is-center-col-rect.d.ts +0 -5
  50. package/dist/cell-selection/is-center-col-rect.js +0 -3
  51. package/dist/cell-selection/is-center-rect.d.ts +0 -2
  52. package/dist/cell-selection/is-center-rect.js +0 -4
  53. package/dist/cell-selection/is-end-rect.d.ts +0 -5
  54. package/dist/cell-selection/is-end-rect.js +0 -3
  55. package/dist/cell-selection/is-fully-within-rect.d.ts +0 -2
  56. package/dist/cell-selection/is-fully-within-rect.js +0 -6
  57. package/dist/cell-selection/is-overlapping-rect.d.ts +0 -2
  58. package/dist/cell-selection/is-overlapping-rect.js +0 -5
  59. package/dist/cell-selection/is-start-rect.d.ts +0 -5
  60. package/dist/cell-selection/is-start-rect.js +0 -3
  61. package/dist/cell-selection/is-top-rect.d.ts +0 -2
  62. package/dist/cell-selection/is-top-rect.js +0 -3
  63. package/dist/cell-selection/is-within-selection-rect.d.ts +0 -2
  64. package/dist/cell-selection/is-within-selection-rect.js +0 -3
  65. package/dist/cell-selection/split-cell-selection-rect.d.ts +0 -41
  66. package/dist/cell-selection/split-cell-selection-rect.js +0 -84
  67. package/dist/cell-selection/update-additive-cell-selection.d.ts +0 -4
  68. package/dist/cell-selection/update-additive-cell-selection.js +0 -21
  69. package/dist/cell-selection/use-edge-scroll.d.ts +0 -6
  70. package/dist/cell-selection/use-edge-scroll.js +0 -71
  71. package/dist/root/context.d.ts +0 -16
  72. package/dist/root/context.js +0 -4
  73. package/dist/root/hooks/use-pro-api.d.ts +0 -2
  74. package/dist/root/hooks/use-pro-api.js +0 -8
  75. package/dist/types/api.d.ts +0 -100
  76. package/dist/types/column.d.ts +0 -73
  77. package/dist/types/column.js +0 -1
  78. package/dist/types/events.d.ts +0 -56
  79. package/dist/types/events.js +0 -1
  80. package/dist/types/grid.d.ts +0 -46
  81. package/dist/types/grid.js +0 -1
  82. package/dist/types/index.d.ts +0 -7
  83. package/dist/types/index.js +0 -1
  84. package/dist/types/props.d.ts +0 -187
  85. package/dist/types/props.js +0 -1
  86. /package/dist/{types/api.js → types.js} +0 -0
@@ -1,5 +1,5 @@
1
1
  import { type SlotComponent } from "../hooks/use-slot/index.js";
2
- import type { API, GridSpec } from "../types/index.js";
2
+ import type { API, GridSpec } from "../types.js";
3
3
  export interface SelectAllProps {
4
4
  readonly slot?: SlotComponent<{
5
5
  readonly indeterminate: boolean;
@@ -1,7 +1,7 @@
1
- import type { GridSpec } from "../../types/grid.js";
2
1
  import type { UseClientDataSourceParams } from "../use-client-data-source.js";
3
2
  import type { SourceState } from "./use-controlled-ds-state.js";
4
3
  import { type LeafNodeTuple } from "@1771technologies/lytenyte-core/internal";
4
+ import type { GridSpec } from "@1771technologies/lytenyte-core/types";
5
5
  export declare function useFlattenedData<Spec extends GridSpec>(props: UseClientDataSourceParams<Spec>, [leafsTop, leafs, leafsBot, pinMap]: LeafNodeTuple<Spec["data"]>, { expandedFn }: SourceState): {
6
6
  tree: import("./use-group-tree/use-group-tree.js").RootNode<Spec["data"]> | null;
7
7
  maxDepth: number;
@@ -1,2 +1,2 @@
1
- import type { Column, GridSpec } from "../../../../types/index.js";
1
+ import type { Column, GridSpec } from "../../../../types.js";
2
2
  export declare function applyReferenceColumn<Spec extends GridSpec>(pivotColumn: Column<Spec>, reference: Omit<Column<Spec>, "id"> | undefined): Column<Spec>;
@@ -1,4 +1,4 @@
1
1
  import type { RowLeaf } from "@1771technologies/lytenyte-shared";
2
2
  import type { PivotModel } from "../../../use-client-data-source";
3
- import type { GridSpec } from "../../../../types/index.js";
3
+ import type { GridSpec } from "../../../../types.js";
4
4
  export declare function pivotPaths<Spec extends GridSpec>(filtered: number[], leafs: RowLeaf<Spec["data"]>[], columns: Required<PivotModel<Spec>>["columns"], measures: PivotModel<Spec>["measures"], labelFilter: PivotModel<Spec>["colLabelFilter"]): string[];
@@ -1,4 +1,4 @@
1
- import type { Column, GridSpec } from "../../../types/index.js";
1
+ import type { Column, GridSpec } from "../../../types.js";
2
2
  import type { PivotModel } from "../../use-client-data-source.js";
3
3
  import type { AggregationFn, Aggregator } from "@1771technologies/lytenyte-shared";
4
4
  export declare function usePivotAggFunction<Spec extends GridSpec>(pivotColumns: Column<Spec>[] | null, model: PivotModel<Spec> | undefined, aggs?: Record<string, Aggregator<Spec["data"]>>): AggregationFn<Spec["data"]> | null;
@@ -1,5 +1,5 @@
1
1
  import type { PivotModel } from "../../use-client-data-source";
2
- import type { Column, GridSpec } from "../../../types/index.js";
2
+ import type { Column, GridSpec } from "../../../types.js";
3
3
  import { type ColumnPin, type RowLeaf } from "@1771technologies/lytenyte-shared";
4
4
  import type { ControlledPivotState } from "./use-pivot-state";
5
5
  export interface PivotState {
@@ -26,7 +26,7 @@ export declare function usePivotData<Spec extends GridSpec>(props: UseClientData
26
26
  depth: number;
27
27
  }[];
28
28
  sorted: number[];
29
- pivotPiece: import("@1771technologies/lytenyte-core").Piece<import("../../../types").Column<Spec>[] | null>;
29
+ pivotPiece: import("@1771technologies/lytenyte-core").Piece<import("@1771technologies/lytenyte-core/types").Column<Spec>[] | null>;
30
30
  pivotGroupPiece: import("@1771technologies/lytenyte-core").Piece<Record<string, boolean>>;
31
31
  groupFn: import("@1771technologies/lytenyte-shared").GroupFn<Spec["data"]> | null;
32
32
  };
@@ -1,4 +1,4 @@
1
- import type { GridSpec } from "../../../types/index.js";
1
+ import type { GridSpec } from "../../../types.js";
2
2
  import type { GroupFn } from "@1771technologies/lytenyte-shared";
3
3
  import type { PivotModel } from "../../use-client-data-source.js";
4
4
  export declare function usePivotGroupFn<Spec extends GridSpec>(pivotMode: boolean, model: PivotModel<Spec> | undefined): GroupFn<Spec["data"]> | null;
@@ -1,8 +1,6 @@
1
1
  import type { AggregationFn, Aggregator, Dimension, DimensionAgg, DimensionSort, FilterFn, GroupFn, GroupIdFn, LeafIdFn, RowGroup, RowLeaf, RowNode, RowSelectionState, RowSource, SortFn } from "@1771technologies/lytenyte-shared";
2
- import type { Column, Field } from "../types/column.js";
3
- import type { GridSpec } from "../types/grid.js";
4
2
  import type { PivotState } from "./hooks/use-pivot/use-pivot-columns.js";
5
- import type { Props } from "../types/props.js";
3
+ import type { Column, Field, GridSpec, Props } from "../types.js";
6
4
  export type PivotField<Spec extends GridSpec = GridSpec> = {
7
5
  field?: Field<Spec["data"]>;
8
6
  };
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@ import { Grid as GridCore } from "@1771technologies/lytenyte-core";
3
3
  import type { PropsWithChildren, ReactNode } from "react";
4
4
  import { Root } from "./root/root.js";
5
5
  import type { RowSource } from "@1771technologies/lytenyte-shared";
6
- import type * as LnTypes from "./types/index.js";
6
+ import type * as LnTypes from "./types.js";
7
7
  export interface GridComponent {
8
8
  <Spec extends Root.GridSpec = Root.GridSpec>(props: PropsWithChildren<Root.Props<Spec> & (undefined extends Spec["api"] ? unknown : {
9
9
  apiExtension: ((incomplete: Root.API<Spec>) => Spec["api"] | null) | Spec["api"];
@@ -98,13 +98,11 @@ export declare namespace Grid {
98
98
  type PositionHeaderCell = LnTypes.PositionHeaderCell;
99
99
  type PositionHeaderGroupCell = LnTypes.PositionHeaderGroupCell;
100
100
  type PositionUnion = LnTypes.PositionUnion;
101
- type DataRectSplit = LnTypes.DataRectSplit;
102
101
  type HavingFilterFn = LnTypes.HavingFilterFn;
103
102
  type LabelFilter = LnTypes.LabelFilter;
104
103
  type PivotField<Spec extends GridSpec> = LnTypes.PivotField<Spec>;
105
104
  type PivotModel<Spec extends GridSpec> = LnTypes.PivotModel<Spec>;
106
105
  type PivotState = LnTypes.PivotState;
107
- type VirtualTarget = LnTypes.VirtualTarget;
108
106
  }
109
107
  }
110
108
  export type { UseClientDataSourceParams, RowSourceClient, } from "./data-source-client/use-client-data-source.js";
@@ -1,15 +1,12 @@
1
+ import type * as Core from "@1771technologies/lytenyte-core/types";
1
2
  import { type PropsWithChildren, type ReactNode } from "react";
2
- import type { GridSpec as LnSpec } from "../types/grid.js";
3
- import type { Column as LnColumn } from "../types/column.js";
4
- import type { API as LnAPI } from "../types/api.js";
5
- import type { Props as LnProps } from "../types/props.js";
6
3
  import type { RowSource } from "@1771technologies/lytenyte-shared";
7
4
  export declare const Root: <Spec extends Root.GridSpec = Root.GridSpec>(props: PropsWithChildren<Root.Props<Spec> & (undefined extends Spec["api"] ? object : {
8
5
  apiExtension: Spec["api"];
9
6
  })>) => ReactNode;
10
7
  export declare namespace Root {
11
- type GridSpec<T = unknown, C extends Record<string, any> = object, S extends RowSource<T> = RowSource, E extends Record<string, any> = object> = LnSpec<T, C, S, E>;
12
- type Props<Spec extends GridSpec = GridSpec> = LnProps<Spec>;
13
- type API<Spec extends GridSpec = GridSpec> = LnAPI<Spec>;
14
- type Column<Spec extends GridSpec = GridSpec> = LnColumn<Spec>;
8
+ type GridSpec<T = unknown, C extends Record<string, any> = object, S extends RowSource<T> = RowSource, E extends Record<string, any> = object> = Core.GridSpec<T, C, S, E>;
9
+ type Props<Spec extends GridSpec = GridSpec> = Core.Props<Spec>;
10
+ type API<Spec extends GridSpec = GridSpec> = Core.API<Spec>;
11
+ type Column<Spec extends GridSpec = GridSpec> = Core.Column<Spec>;
15
12
  }
package/dist/root/root.js CHANGED
@@ -1,14 +1,8 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Fallback, LnInternalShareProvider, Root as RootCore, usePiece, } from "@1771technologies/lytenyte-core/internal";
3
- import { forwardRef, memo, useEffect, useMemo, useRef, useState, } from "react";
4
- import { useProAPI } from "./hooks/use-pro-api.js";
5
- import { ProRootProvider } from "./context.js";
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Root as RootCore } from "@1771technologies/lytenyte-core/internal";
3
+ import { forwardRef, memo, useEffect } from "react";
6
4
  import { hasAValidLicense, licenseState } from "../license.js";
7
- import { useControlled, useEvent, useRoot } from "@1771technologies/lytenyte-core/internal";
8
- import { CellSelectionDriver } from "../cell-selection/cell-selection-driver/cell-selection-driver.js";
9
- import { CellSelectionBottom, CellSelectionCenter, CellSelectionTop, } from "../cell-selection/cell-selection-containers.js";
10
- import { splitCellSelectionRect } from "../cell-selection/split-cell-selection-rect.js";
11
- const RootWrapper = ({ children, ...p }, forwarded) => {
5
+ const RootWrapper = (props, forwarded) => {
12
6
  useEffect(() => {
13
7
  if (hasAValidLicense)
14
8
  return;
@@ -35,78 +29,6 @@ const RootWrapper = ({ children, ...p }, forwarded) => {
35
29
  document.body.appendChild(invalidLicenseWatermark);
36
30
  return () => invalidLicenseWatermark.remove();
37
31
  }, []);
38
- const components = p.cellSelectionMode !== "none"
39
- ? {
40
- ln_topComponent: CellSelectionTop,
41
- ln_bottomComponent: CellSelectionBottom,
42
- ln_centerComponent: CellSelectionCenter,
43
- }
44
- : {};
45
- return (_jsx(RootCore, { ref: forwarded, ...p, ...components, __noFallback: true, children: _jsx(RootImpl, { ...p, children: children }) }));
46
- };
47
- const RootImpl = ({ children, ...p }) => {
48
- const { view, source } = useRoot();
49
- const cellSelectionMode = p.cellSelectionMode ?? "none";
50
- const [cellSelections, setCellSelections] = useControlled({
51
- controlled: p.cellSelections,
52
- default: [],
53
- });
54
- const onCellSelectionChange = useEvent((rects) => {
55
- p.onCellSelectionChange?.(rects);
56
- setCellSelections(rects);
57
- });
58
- const api = useProAPI(cellSelections);
59
- const [cellSelectionPivot, setSelectionPivot] = useState(null);
60
- const [cellSelectionAdditiveRects, setCellSelectionAdditiveRects] = useState(null);
61
- const cellSelectionIsDeselect = useRef(false);
62
- const topCount = source.useTopCount();
63
- const rowCount = source.useRowCount();
64
- const botCount = source.useBottomCount();
65
- const cellSelectionSplits = useMemo(() => {
66
- const centerCount = rowCount - topCount - botCount;
67
- const selections = cellSelections;
68
- const splits = selections.flatMap((rect) => {
69
- return splitCellSelectionRect({
70
- rect,
71
- rowTopCount: topCount,
72
- rowCenterCount: centerCount,
73
- colStartCount: view.startCount,
74
- colCenterCount: view.centerCount,
75
- });
76
- });
77
- return splits;
78
- }, [botCount, cellSelections, rowCount, topCount, view.centerCount, view.startCount]);
79
- const excludeMarker = Boolean(p.columnMarker?.on && p.cellSelectionExcludeMarker);
80
- const value = useMemo(() => {
81
- return {
82
- api,
83
- excludeMarker,
84
- keepSelection: p.cellSelectionMaintainOnNonCellPosition ?? false,
85
- cellSelectionMode,
86
- cellSelections,
87
- cellSelectionPivot,
88
- setSelectionPivot: setSelectionPivot,
89
- onCellSelectionChange,
90
- cellSelectionAdditiveRects,
91
- setCellSelectionAdditiveRects,
92
- cellSelectionIsDeselect,
93
- cellSelectionSplits,
94
- };
95
- }, [
96
- api,
97
- excludeMarker,
98
- p.cellSelectionMaintainOnNonCellPosition,
99
- cellSelectionMode,
100
- cellSelections,
101
- cellSelectionPivot,
102
- onCellSelectionChange,
103
- cellSelectionAdditiveRects,
104
- cellSelectionSplits,
105
- ]);
106
- const cellSelectionsPiece = usePiece(cellSelections);
107
- return (_jsx(LnInternalShareProvider, { value: useMemo(() => ({
108
- cellSelections: cellSelectionsPiece,
109
- hasCellSelection: (p.cellSelectionMode ?? "none") !== "none",
110
- }), [cellSelectionsPiece, p.cellSelectionMode]), children: _jsxs(ProRootProvider, { value: value, children: [cellSelectionMode !== "none" && _jsx(CellSelectionDriver, {}), children ?? _jsx(Fallback, {})] }) }));
32
+ return _jsx(RootCore, { ref: forwarded, ...props });
111
33
  };
112
34
  export const Root = memo(forwardRef(RootWrapper));
@@ -0,0 +1,3 @@
1
+ export type * from "@1771technologies/lytenyte-core/types";
2
+ export type { HavingFilterFn, PivotField, PivotModel, LabelFilter, } from "./data-source-client/use-client-data-source.js";
3
+ export type { PivotState } from "./data-source-client/hooks/use-pivot/use-pivot-columns.js";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@1771technologies/lytenyte-pro",
3
3
  "description": "Blazingly fast headless React data grid with 100s of features.",
4
- "version": "2.0.3",
4
+ "version": "2.0.4-dev.0",
5
5
  "type": "module",
6
6
  "license": "COMMERCIAL",
7
7
  "files": [
@@ -49,6 +49,11 @@
49
49
  "import": "./dist/index.js",
50
50
  "require": "./dist/index.js"
51
51
  },
52
+ "./types": {
53
+ "types": "./src/types.d.ts",
54
+ "import": "./src/types.js",
55
+ "require": "./src/types.js"
56
+ },
52
57
  "./components": {
53
58
  "types": "./dist/components.d.ts",
54
59
  "import": "./dist/components.js",
@@ -74,12 +79,12 @@
74
79
  "access": "public"
75
80
  },
76
81
  "dependencies": {
77
- "@1771technologies/lytenyte-core": "2.0.3",
78
- "@1771technologies/lytenyte-shared": "2.0.3",
79
- "@1771technologies/lytenyte-design": "2.0.3"
82
+ "@1771technologies/lytenyte-shared": "2.0.4-dev.0",
83
+ "@1771technologies/lytenyte-core": "2.0.4-dev.0",
84
+ "@1771technologies/lytenyte-design": "2.0.4-dev.0"
80
85
  },
81
86
  "devDependencies": {
82
- "@1771technologies/grid-sample-data": "2.0.3"
87
+ "@1771technologies/grid-sample-data": "2.0.4-dev.0"
83
88
  },
84
89
  "peerDependencies": {
85
90
  "react": "18.0.0 || ^19.0.0",
@@ -1,2 +0,0 @@
1
- import type { API, DataRect } from "../types/api.js";
2
- export declare function adjustRectForRowAndCellSpan(cellRoot: API["cellRoot"], rect: DataRect): DataRect;
@@ -1,43 +0,0 @@
1
- import { getRootCell } from "./get-root-cell.js";
2
- export function adjustRectForRowAndCellSpan(cellRoot, rect) {
3
- let { rowStart, rowEnd, columnStart, columnEnd } = rect;
4
- // Check the top row of the rect.
5
- for (let i = columnStart; i < columnEnd; i++) {
6
- let cell = getRootCell(cellRoot, rowStart, i);
7
- if (cell) {
8
- columnStart = Math.min(columnStart, cell.colIndex);
9
- columnEnd = Math.max(columnEnd, cell.colIndex + cell.colSpan);
10
- rowStart = Math.min(rowStart, cell.rowIndex);
11
- rowEnd = Math.max(rowEnd, cell.rowIndex + cell.rowSpan);
12
- }
13
- cell = getRootCell(cellRoot, rowEnd - 1, i);
14
- if (cell) {
15
- columnStart = Math.min(columnStart, cell.colIndex);
16
- columnEnd = Math.max(columnEnd, cell.colIndex + cell.colSpan);
17
- rowStart = Math.min(rowStart, cell.rowIndex);
18
- rowEnd = Math.max(rowEnd, cell.rowIndex + cell.rowSpan);
19
- }
20
- }
21
- for (let i = rowStart; i < rowEnd; i++) {
22
- let cell = getRootCell(cellRoot, i, columnStart);
23
- if (cell) {
24
- columnStart = Math.min(columnStart, cell.colIndex);
25
- columnEnd = Math.max(columnEnd, cell.colIndex + cell.colSpan);
26
- rowStart = Math.min(rowStart, cell.rowIndex);
27
- rowEnd = Math.max(rowEnd, cell.rowIndex + cell.rowSpan);
28
- }
29
- cell = getRootCell(cellRoot, i, columnEnd - 1);
30
- if (cell) {
31
- columnStart = Math.min(columnStart, cell.colIndex);
32
- columnEnd = Math.max(columnEnd, cell.colIndex + cell.colSpan);
33
- rowStart = Math.min(rowStart, cell.rowIndex);
34
- rowEnd = Math.max(rowEnd, cell.rowIndex + cell.rowSpan);
35
- }
36
- }
37
- return {
38
- rowStart,
39
- rowEnd,
40
- columnStart,
41
- columnEnd,
42
- };
43
- }
@@ -1,2 +0,0 @@
1
- import type { DataRect } from "../types/api.js";
2
- export declare function areRectsEqual(left: DataRect, right: DataRect): boolean;
@@ -1,6 +0,0 @@
1
- export function areRectsEqual(left, right) {
2
- return (left.rowStart === right.rowStart &&
3
- left.rowEnd === right.rowEnd &&
4
- left.columnStart === right.columnStart &&
5
- left.columnEnd === right.columnEnd);
6
- }
@@ -1,3 +0,0 @@
1
- import { type ColumnView } from "@1771technologies/lytenyte-shared";
2
- import type { DataRect } from "../types";
3
- export declare function boundSelectionRect(view: ColumnView, rowCount: number, rect: DataRect): DataRect;
@@ -1,16 +0,0 @@
1
- import { clamp } from "@1771technologies/lytenyte-shared";
2
- export function boundSelectionRect(view, rowCount, rect) {
3
- const maxRow = rowCount;
4
- const minRow = 0;
5
- const maxColumn = view.visibleColumns.length;
6
- const minColumn = 0;
7
- const rowStartMaybe = clamp(minRow, rect.rowStart, maxRow);
8
- const rowEndMaybe = clamp(minRow, rect.rowEnd, maxRow);
9
- const colStartMaybe = clamp(minColumn, rect.columnStart, maxColumn);
10
- const colEndMaybe = clamp(minColumn, rect.columnEnd, maxColumn);
11
- const rowStart = Math.min(rowStartMaybe, rowEndMaybe);
12
- const rowEnd = Math.max(rowStartMaybe, rowEndMaybe);
13
- const columnStart = Math.min(colStartMaybe, colEndMaybe);
14
- const columnEnd = Math.max(colStartMaybe, colEndMaybe);
15
- return { rowStart, rowEnd, columnStart, columnEnd };
16
- }
@@ -1,3 +0,0 @@
1
- export declare const CellSelectionTop: import("react").NamedExoticComponent<object>;
2
- export declare const CellSelectionCenter: import("react").NamedExoticComponent<object>;
3
- export declare const CellSelectionBottom: import("react").NamedExoticComponent<object>;
@@ -1,86 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { memo, useMemo } from "react";
3
- import { CellStyleRow } from "./cell-style-row.js";
4
- import { isTopRect } from "./is-top-rect.js";
5
- import { isCenterRect } from "./is-center-rect.js";
6
- import { isBottomRect } from "./is-bottom-rect.js";
7
- import { useRoot } from "@1771technologies/lytenyte-core/internal";
8
- import { useProRoot } from "../root/context.js";
9
- export const CellSelectionTop = memo(function CellSelectionTop() {
10
- const { source } = useRoot();
11
- const { cellSelectionSplits: allRects, cellSelectionAdditiveRects: additive, cellSelectionIsDeselect, } = useProRoot();
12
- const topCount = source.useTopCount();
13
- const topRects = useMemo(() => {
14
- return allRects.filter((rect) => isTopRect(topCount, rect));
15
- }, [allRects, topCount]);
16
- const isDeselect = cellSelectionIsDeselect.current;
17
- const additiveRects = useMemo(() => {
18
- if (!additive)
19
- return [];
20
- return additive.filter((rect) => isTopRect(topCount, rect));
21
- }, [additive, topCount]);
22
- return (_jsxs("div", { role: "presentation", style: {
23
- width: "100%",
24
- height: 0,
25
- display: "grid",
26
- gridTemplateRows: "0px",
27
- gridTemplateColumns: "0px",
28
- }, children: [topRects.map((rect, i) => {
29
- return _jsx(CellStyleRow, { rect: rect, isRowPinnedTop: true }, i);
30
- }), additiveRects.map((rect) => {
31
- return _jsx(CellStyleRow, { rect: rect, isDeselect: isDeselect }, rect.columnStart);
32
- })] }));
33
- });
34
- export const CellSelectionCenter = memo(function CellSelectionCenter() {
35
- const { source } = useRoot();
36
- const { cellSelectionSplits: allRects, cellSelectionAdditiveRects: additive, cellSelectionIsDeselect, } = useProRoot();
37
- const topCount = source.useTopCount();
38
- const rowCount = source.useRowCount();
39
- const botCount = source.useBottomCount();
40
- const centerRects = useMemo(() => {
41
- return allRects.filter((rect) => isCenterRect(rowCount, botCount, topCount, rect));
42
- }, [allRects, botCount, rowCount, topCount]);
43
- const isDeselect = cellSelectionIsDeselect.current;
44
- const additiveRects = useMemo(() => {
45
- if (!additive)
46
- return [];
47
- return additive.filter((rect) => isCenterRect(rowCount, botCount, topCount, rect));
48
- }, [additive, botCount, rowCount, topCount]);
49
- return (_jsxs("div", { role: "presentation", style: {
50
- width: "100%",
51
- height: 0,
52
- display: "grid",
53
- gridTemplateRows: "0px",
54
- gridTemplateColumns: "0px",
55
- }, children: [centerRects.map((rect, i) => {
56
- return _jsx(CellStyleRow, { rect: rect }, i);
57
- }), additiveRects.map((rect) => {
58
- return _jsx(CellStyleRow, { rect: rect, isDeselect: isDeselect }, rect.columnStart);
59
- })] }));
60
- });
61
- export const CellSelectionBottom = memo(function CellSelectionBottom() {
62
- const { source } = useRoot();
63
- const { cellSelectionSplits: allRects, cellSelectionAdditiveRects: additive, cellSelectionIsDeselect, } = useProRoot();
64
- const rowCount = source.useRowCount();
65
- const botCount = source.useBottomCount();
66
- const bottomRects = useMemo(() => {
67
- return allRects.filter((rect) => isBottomRect(rowCount, botCount, rect));
68
- }, [allRects, botCount, rowCount]);
69
- const isDeselect = cellSelectionIsDeselect.current;
70
- const additiveRects = useMemo(() => {
71
- if (!additive)
72
- return [];
73
- return additive.filter((rect) => isBottomRect(rowCount, botCount, rect));
74
- }, [additive, botCount, rowCount]);
75
- return (_jsxs("div", { role: "presentation", style: {
76
- width: "100%",
77
- height: 0,
78
- display: "grid",
79
- gridTemplateRows: "0px",
80
- gridTemplateColumns: "0px",
81
- }, children: [bottomRects.map((rect, i) => {
82
- return _jsx(CellStyleRow, { rect: rect, isRowPinnedBottom: true }, i);
83
- }), additiveRects.map((rect) => {
84
- return _jsx(CellStyleRow, { rect: rect, isDeselect: isDeselect }, rect.columnStart);
85
- })] }));
86
- });
@@ -1 +0,0 @@
1
- export declare function CellSelectionDriver(): import("react/jsx-runtime").JSX.Element;