@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.
Files changed (88) hide show
  1. package/README.md +297 -11
  2. package/dist/components/headless/dialog/container.js +1 -2
  3. package/dist/components/select-all.d.ts +1 -1
  4. package/dist/data-source-client/hooks/use-flattened-data.d.ts +1 -1
  5. package/dist/data-source-client/hooks/use-pivot/auxiliary-functions/apply-reference-column.d.ts +1 -1
  6. package/dist/data-source-client/hooks/use-pivot/auxiliary-functions/pivot-paths.d.ts +1 -1
  7. package/dist/data-source-client/hooks/use-pivot/use-agg-model.d.ts +1 -1
  8. package/dist/data-source-client/hooks/use-pivot/use-pivot-columns.d.ts +1 -1
  9. package/dist/data-source-client/hooks/use-pivot/use-pivot-data.d.ts +1 -1
  10. package/dist/data-source-client/hooks/use-pivot/use-pivot-group-fn.d.ts +1 -1
  11. package/dist/data-source-client/use-client-data-source.d.ts +1 -3
  12. package/dist/index.d.ts +1 -3
  13. package/dist/root/root.d.ts +5 -8
  14. package/dist/root/root.js +5 -83
  15. package/dist/types.d.ts +3 -0
  16. package/package.json +27 -6
  17. package/dist/cell-selection/adjust-rect-for-row-and-cell-span.d.ts +0 -2
  18. package/dist/cell-selection/adjust-rect-for-row-and-cell-span.js +0 -43
  19. package/dist/cell-selection/are-rects-equal.d.ts +0 -2
  20. package/dist/cell-selection/are-rects-equal.js +0 -6
  21. package/dist/cell-selection/bound-selection-rect.d.ts +0 -3
  22. package/dist/cell-selection/bound-selection-rect.js +0 -16
  23. package/dist/cell-selection/cell-selection-containers.d.ts +0 -3
  24. package/dist/cell-selection/cell-selection-containers.js +0 -86
  25. package/dist/cell-selection/cell-selection-driver/cell-selection-driver.d.ts +0 -1
  26. package/dist/cell-selection/cell-selection-driver/cell-selection-driver.js +0 -279
  27. package/dist/cell-selection/cell-selection-driver/use-cell-focus-change.d.ts +0 -5
  28. package/dist/cell-selection/cell-selection-driver/use-cell-focus-change.js +0 -34
  29. package/dist/cell-selection/cell-style-row.d.ts +0 -8
  30. package/dist/cell-selection/cell-style-row.js +0 -79
  31. package/dist/cell-selection/data-rect-from-cell-position.d.ts +0 -3
  32. package/dist/cell-selection/data-rect-from-cell-position.js +0 -17
  33. package/dist/cell-selection/deselect-rect-range.d.ts +0 -2
  34. package/dist/cell-selection/deselect-rect-range.js +0 -43
  35. package/dist/cell-selection/expand-selection-down.d.ts +0 -3
  36. package/dist/cell-selection/expand-selection-down.js +0 -78
  37. package/dist/cell-selection/expand-selection-end.d.ts +0 -3
  38. package/dist/cell-selection/expand-selection-end.js +0 -76
  39. package/dist/cell-selection/expand-selection-start.d.ts +0 -3
  40. package/dist/cell-selection/expand-selection-start.js +0 -73
  41. package/dist/cell-selection/expand-selection-up.d.ts +0 -3
  42. package/dist/cell-selection/expand-selection-up.js +0 -74
  43. package/dist/cell-selection/full-width-start-end-index.d.ts +0 -2
  44. package/dist/cell-selection/full-width-start-end-index.js +0 -4
  45. package/dist/cell-selection/get-root-cell.d.ts +0 -3
  46. package/dist/cell-selection/get-root-cell.js +0 -6
  47. package/dist/cell-selection/index.d.ts +0 -11
  48. package/dist/cell-selection/index.js +0 -11
  49. package/dist/cell-selection/is-bottom-rect.d.ts +0 -2
  50. package/dist/cell-selection/is-bottom-rect.js +0 -4
  51. package/dist/cell-selection/is-center-col-rect.d.ts +0 -5
  52. package/dist/cell-selection/is-center-col-rect.js +0 -3
  53. package/dist/cell-selection/is-center-rect.d.ts +0 -2
  54. package/dist/cell-selection/is-center-rect.js +0 -4
  55. package/dist/cell-selection/is-end-rect.d.ts +0 -5
  56. package/dist/cell-selection/is-end-rect.js +0 -3
  57. package/dist/cell-selection/is-fully-within-rect.d.ts +0 -2
  58. package/dist/cell-selection/is-fully-within-rect.js +0 -6
  59. package/dist/cell-selection/is-overlapping-rect.d.ts +0 -2
  60. package/dist/cell-selection/is-overlapping-rect.js +0 -5
  61. package/dist/cell-selection/is-start-rect.d.ts +0 -5
  62. package/dist/cell-selection/is-start-rect.js +0 -3
  63. package/dist/cell-selection/is-top-rect.d.ts +0 -2
  64. package/dist/cell-selection/is-top-rect.js +0 -3
  65. package/dist/cell-selection/is-within-selection-rect.d.ts +0 -2
  66. package/dist/cell-selection/is-within-selection-rect.js +0 -3
  67. package/dist/cell-selection/split-cell-selection-rect.d.ts +0 -41
  68. package/dist/cell-selection/split-cell-selection-rect.js +0 -84
  69. package/dist/cell-selection/update-additive-cell-selection.d.ts +0 -4
  70. package/dist/cell-selection/update-additive-cell-selection.js +0 -21
  71. package/dist/cell-selection/use-edge-scroll.d.ts +0 -6
  72. package/dist/cell-selection/use-edge-scroll.js +0 -71
  73. package/dist/root/context.d.ts +0 -16
  74. package/dist/root/context.js +0 -4
  75. package/dist/root/hooks/use-pro-api.d.ts +0 -2
  76. package/dist/root/hooks/use-pro-api.js +0 -8
  77. package/dist/types/api.d.ts +0 -100
  78. package/dist/types/column.d.ts +0 -73
  79. package/dist/types/column.js +0 -1
  80. package/dist/types/events.d.ts +0 -56
  81. package/dist/types/events.js +0 -1
  82. package/dist/types/grid.d.ts +0 -46
  83. package/dist/types/grid.js +0 -1
  84. package/dist/types/index.d.ts +0 -7
  85. package/dist/types/index.js +0 -1
  86. package/dist/types/props.d.ts +0 -187
  87. package/dist/types/props.js +0 -1
  88. /package/dist/{types/api.js → types.js} +0 -0
@@ -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,6 +0,0 @@
1
- export declare function useEdgeScroll(): {
2
- cancelX: () => void;
3
- edgeScrollX: (visualPositionX: number, isRtl: boolean) => void;
4
- cancelY: () => void;
5
- edgeScrollY: (visualPositionY: number, startY: number) => void;
6
- };
@@ -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
- }
@@ -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;
@@ -1,4 +0,0 @@
1
- import { createContext, useContext } from "react";
2
- const context = createContext({});
3
- export const ProRootProvider = context.Provider;
4
- export const useProRoot = () => useContext(context);
@@ -1,2 +0,0 @@
1
- import type { API, DataRect } from "../../types";
2
- export declare function useProAPI(cellSelections: DataRect[]): API;
@@ -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
- }
@@ -1,100 +0,0 @@
1
- import type { ColumnView, PositionFullWidthRow, PositionGridCell, PositionUnion, RowAggregated, RowGroup, RowLeaf, RowNode, RowSource } from "@1771technologies/lytenyte-shared";
2
- import type { Column } from "./column.js";
3
- import type { GridSpec } from "./grid.js";
4
- import type { Piece, useDraggable, UseDraggableProps } from "@1771technologies/lytenyte-core/internal";
5
- import type { Props } from "./props.js";
6
- type WithId = {
7
- readonly id: string;
8
- };
9
- type RowSourceOmits = "onRowGroupExpansionsChange" | "onRowsUpdated" | "onRowsSelected";
10
- export interface DataRect {
11
- readonly rowStart: number;
12
- readonly rowEnd: number;
13
- readonly columnStart: number;
14
- readonly columnEnd: number;
15
- }
16
- export interface ExportDataRectResult<Spec extends GridSpec = GridSpec> {
17
- readonly headers: string[];
18
- readonly groupHeaders: (string | null)[][];
19
- readonly data: unknown[][];
20
- readonly columns: Column<Spec>[];
21
- }
22
- export type API<Spec extends GridSpec = GridSpec> = {
23
- readonly cellSelections: () => DataRect[];
24
- readonly positionFromElement: (el: HTMLElement) => PositionUnion | null;
25
- readonly xPositions$: Piece<Uint32Array>;
26
- readonly yPositions$: Piece<Uint32Array>;
27
- readonly viewport$: Piece<HTMLElement | null>;
28
- readonly cellRoot: (row: number, column: number) => PositionGridCell | PositionFullWidthRow | null;
29
- readonly columnById: (id: string) => Column<Spec> | null;
30
- readonly columnByIndex: (index: number) => Column<Spec> | null;
31
- readonly columnField: (columnOrId: string | WithId, row: RowNode<Spec["data"]>) => unknown;
32
- readonly columnMove: (params: {
33
- readonly moveColumns: (string | WithId)[];
34
- readonly moveTarget: string | number | WithId;
35
- readonly before?: boolean;
36
- readonly updatePinState?: boolean;
37
- }) => void;
38
- readonly columnResize: (sizes: Record<string, number>) => void;
39
- readonly columnAutosize: (params?: {
40
- readonly dryRun?: boolean;
41
- readonly includeHeader?: boolean;
42
- readonly columns?: (string | number | WithId)[];
43
- }) => Record<string, number>;
44
- readonly columnUpdate: (updates: Record<string, Omit<Partial<Column<Spec>>, "id">>) => void;
45
- readonly columnToggleGroup: (group: string | string[], state?: boolean) => void;
46
- readonly columnView: () => ColumnView;
47
- readonly rowDetailHeight: (rowId: WithId | string) => number;
48
- readonly rowDetailExpanded: (rowOrId: RowNode<Spec["data"]> | string | number) => boolean;
49
- readonly rowDetailToggle: (rowOrId: string | RowNode<Spec["data"]>, state?: boolean) => void;
50
- readonly rowGroupToggle: (rowOrId: RowNode<Spec["data"]> | string, state?: boolean) => void;
51
- readonly rowIsLeaf: (row: RowNode<Spec["data"]>) => row is RowLeaf<Spec["data"]>;
52
- readonly rowIsGroup: (row: RowNode<Spec["data"]>) => row is RowGroup;
53
- readonly rowIsAggregated: (row: RowNode<Spec["data"]>) => row is RowAggregated;
54
- readonly rowIsExpanded: (row: RowNode<Spec["data"]>) => boolean;
55
- readonly rowIsExpandable: (row: RowNode<Spec["data"]>) => boolean;
56
- readonly rowView: () => {
57
- rowCount: number;
58
- topCount: number;
59
- bottomCount: number;
60
- centerCount: number;
61
- };
62
- readonly exportData: (params?: {
63
- readonly rect?: DataRect;
64
- }) => Promise<ExportDataRectResult<Spec>>;
65
- readonly scrollIntoView: (params: {
66
- readonly column?: number | string | WithId;
67
- readonly row?: number;
68
- readonly behavior?: "smooth" | "auto" | "instant";
69
- }) => void;
70
- readonly viewport: () => HTMLElement | null;
71
- readonly editBegin: (params: {
72
- readonly init?: any;
73
- readonly column: WithId | string | number;
74
- readonly rowIndex: number;
75
- readonly focusIfNotEditable?: boolean;
76
- }) => void;
77
- readonly editEnd: (cancel?: boolean) => void;
78
- readonly editIsCellActive: (params: {
79
- readonly column: WithId | string | number;
80
- readonly rowIndex: number;
81
- }) => boolean;
82
- readonly editUpdateRows: (rows: Map<string | number, unknown>) => true | Map<string | number, boolean | Record<string, unknown>>;
83
- readonly editUpdateCells: (cells: Map<string | number, {
84
- value: any;
85
- column: Column<Spec> | string | number;
86
- }[]>) => true | Map<string | number, boolean | Record<string, unknown>>;
87
- readonly rowSelect: (params: {
88
- readonly selected: string | [start: string, end: string] | Set<string> | "all";
89
- readonly deselect?: boolean;
90
- }) => void;
91
- readonly rowHandleSelect: (params: {
92
- readonly target: EventTarget;
93
- readonly shiftKey: boolean;
94
- }) => void;
95
- readonly useRowDrag: (params: Partial<Pick<UseDraggableProps, "data" | "placeholder">> & {
96
- rowIndex: number;
97
- }) => ReturnType<typeof useDraggable>;
98
- readonly props: () => Props<Spec>;
99
- } & Omit<RowSource, RowSourceOmits> & (undefined extends Spec["source"] ? object : Omit<Spec["source"], RowSourceOmits>) & Spec["api"];
100
- export {};
@@ -1,73 +0,0 @@
1
- import type { ReactNode } from "react";
2
- import type { ColumnAbstract, LayoutCell, LayoutFullWidthRow, RowNode } from "@1771technologies/lytenyte-shared";
3
- import type { GridSpec } from "./grid.js";
4
- import type { API } from "./api.js";
5
- export type PathField = {
6
- kind: "path";
7
- path: string;
8
- };
9
- export interface RowParams<Spec extends GridSpec = GridSpec> {
10
- readonly rowIndex: number;
11
- readonly row: RowNode<Spec["data"]>;
12
- readonly api: API<Spec>;
13
- }
14
- export interface RowFullWidthRendererParams<Spec extends GridSpec = GridSpec> extends RowParams<Spec> {
15
- readonly layout: LayoutFullWidthRow;
16
- }
17
- export interface HeaderParams<Spec extends GridSpec = GridSpec> {
18
- readonly column: Column<Spec>;
19
- readonly api: API<Spec>;
20
- }
21
- export interface HeaderGroupParams<Spec extends GridSpec = GridSpec> {
22
- readonly collapsible: boolean;
23
- readonly collapsed: boolean;
24
- readonly groupPath: string[];
25
- readonly columns: Column<Spec>[];
26
- readonly api: API<Spec>;
27
- }
28
- export interface CellParams<Spec extends GridSpec = GridSpec> {
29
- readonly row: RowNode<Spec["data"]>;
30
- readonly column: Column<Spec>;
31
- readonly api: API<Spec>;
32
- }
33
- export interface CellParamsWithIndex<Spec extends GridSpec = GridSpec> extends CellParams<Spec> {
34
- readonly rowIndex: number;
35
- readonly colIndex: number;
36
- }
37
- export interface CellRendererParams<Spec extends GridSpec = GridSpec> extends CellParamsWithIndex<Spec> {
38
- readonly selected: boolean;
39
- readonly indeterminate: boolean;
40
- readonly detailExpanded: boolean;
41
- readonly editData: unknown;
42
- readonly layout: LayoutCell;
43
- }
44
- export interface EditParams<Spec extends GridSpec = GridSpec> extends CellParamsWithIndex<Spec> {
45
- readonly editValue: unknown;
46
- readonly changeValue: (value: unknown) => boolean | Record<string, unknown>;
47
- readonly editData: unknown;
48
- readonly editValidation: boolean | Record<string, unknown>;
49
- readonly changeData: (data: unknown) => boolean | Record<string, unknown>;
50
- readonly commit: () => boolean | Record<string, unknown>;
51
- readonly cancel: () => void;
52
- readonly layout: LayoutCell;
53
- }
54
- export type Field<T> = string | number | PathField | ((params: {
55
- row: RowNode<T>;
56
- }) => unknown);
57
- interface ColumnUnextended<Spec extends GridSpec = GridSpec> extends ColumnAbstract {
58
- readonly field?: Field<Spec["data"]>;
59
- readonly colSpan?: number | ((params: CellParamsWithIndex<Spec>) => number);
60
- readonly rowSpan?: number | ((params: CellParamsWithIndex<Spec>) => number);
61
- readonly autosizeCellFn?: (params: CellParams<Spec>) => number | null | undefined;
62
- readonly autosizeHeaderFn?: (params: HeaderParams<Spec>) => number | null | undefined;
63
- readonly floatingCellRenderer?: (props: HeaderParams<Spec>) => ReactNode;
64
- readonly headerRenderer?: (props: HeaderParams<Spec>) => ReactNode;
65
- readonly cellRenderer?: (props: CellRendererParams<Spec>) => ReactNode;
66
- readonly editOnPrintable?: boolean;
67
- readonly editRenderer?: (props: EditParams<Spec>) => ReactNode;
68
- readonly editable?: boolean | ((params: CellParamsWithIndex<Spec>) => boolean);
69
- readonly editSetter?: (params: Pick<EditParams<Spec>, "api" | "editValue" | "editData" | "row" | "column">) => unknown;
70
- readonly editMutateCommit?: (params: Pick<EditParams<Spec>, "api" | "editData" | "row" | "column">) => void;
71
- }
72
- export type Column<Spec extends GridSpec = GridSpec> = ColumnUnextended<Spec> & Spec["column"];
73
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,56 +0,0 @@
1
- import type { LayoutCell, LayoutFullWidthRow, LayoutHeaderCell, LayoutHeaderFloating, LayoutHeaderGroup, LayoutRowWithCells, RowNode } from "@1771technologies/lytenyte-shared";
2
- import type { Column } from "./column.js";
3
- import type { GridSpec } from "./grid.js";
4
- import type { JSX } from "react";
5
- import type { API } from "./api.js";
6
- export type Events = {
7
- [key in keyof Required<JSX.IntrinsicElements["div"]> as key extends `on${string}` ? key : never]: JSX.IntrinsicElements["div"][key];
8
- };
9
- type CellEvents<Spec extends GridSpec = GridSpec> = {
10
- [key in keyof Required<JSX.IntrinsicElements["div"]> as key extends `on${infer X}` ? Uncapitalize<X> : never]: (params: {
11
- event: Parameters<JSX.IntrinsicElements["div"][key]>[0];
12
- column: Column<Spec>;
13
- row: RowNode<Spec["data"]>;
14
- layout: LayoutCell;
15
- api: API<Spec>;
16
- }) => void;
17
- };
18
- type RowEvents<Spec extends GridSpec = GridSpec> = {
19
- [key in keyof Required<JSX.IntrinsicElements["div"]> as key extends `on${infer X}` ? Uncapitalize<X> : never]: (params: {
20
- event: Parameters<JSX.IntrinsicElements["div"][key]>[0];
21
- row: RowNode<Spec["data"]>;
22
- layout: LayoutRowWithCells | LayoutFullWidthRow;
23
- api: API<Spec>;
24
- }) => void;
25
- };
26
- type HeaderEvents<Spec extends GridSpec = GridSpec> = {
27
- [key in keyof Required<JSX.IntrinsicElements["div"]> as key extends `on${infer X}` ? Uncapitalize<X> : never]: (params: {
28
- event: Parameters<JSX.IntrinsicElements["div"][key]>[0];
29
- layout: LayoutHeaderCell | LayoutHeaderFloating;
30
- column: Column<Spec>;
31
- api: API<Spec>;
32
- }) => void;
33
- };
34
- type HeaderGroupEvents<Spec extends GridSpec = GridSpec> = {
35
- [key in keyof Required<JSX.IntrinsicElements["div"]> as key extends `on${infer X}` ? Uncapitalize<X> : never]: (params: {
36
- event: Parameters<JSX.IntrinsicElements["div"][key]>[0];
37
- layout: LayoutHeaderGroup;
38
- columns: Column<Spec>[];
39
- api: API<Spec>;
40
- }) => void;
41
- };
42
- type ViewportEvents<Spec extends GridSpec = GridSpec> = {
43
- [key in keyof Required<JSX.IntrinsicElements["div"]> as key extends `on${infer X}` ? Uncapitalize<X> : never]: (params: {
44
- event: Parameters<JSX.IntrinsicElements["div"][key]>[0];
45
- viewport: HTMLElement;
46
- api: API<Spec>;
47
- }) => void;
48
- };
49
- export type GridEvents<Spec extends GridSpec = GridSpec> = {
50
- readonly cell?: Partial<CellEvents<Spec>>;
51
- readonly row?: Partial<RowEvents<Spec>>;
52
- readonly headerCell?: Partial<HeaderEvents<Spec>>;
53
- readonly headerGroup?: Partial<HeaderGroupEvents<Spec>>;
54
- readonly viewport?: Partial<ViewportEvents<Spec>>;
55
- };
56
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,46 +0,0 @@
1
- import type { RowSource } from "@1771technologies/lytenyte-shared";
2
- import type { DataRect } from "./api";
3
- import type { CSSProperties } from "react";
4
- export interface GridSpec<Data = unknown, ColExt extends Record<string, any> = object, S extends RowSource<Data> = RowSource, Ext extends Record<string, any> = object> {
5
- readonly data?: Data;
6
- readonly column?: ColExt;
7
- readonly source?: S;
8
- readonly api?: Ext;
9
- }
10
- export interface VirtualTarget {
11
- readonly getBoundingClientRect: () => Omit<DOMRect, "toJSON">;
12
- readonly getClientRects?: () => Omit<DOMRect, "toJSON">[];
13
- readonly contextElement?: HTMLElement;
14
- }
15
- export interface DataRectSplit extends DataRect {
16
- readonly borderTop?: boolean;
17
- readonly borderBottom?: boolean;
18
- readonly borderStart?: boolean;
19
- readonly borderEnd?: boolean;
20
- }
21
- export type GridStyle = {
22
- readonly viewport?: {
23
- readonly style?: CSSProperties;
24
- readonly className?: string;
25
- };
26
- readonly row?: {
27
- readonly style?: CSSProperties;
28
- readonly className?: string;
29
- };
30
- readonly header?: {
31
- readonly style?: CSSProperties;
32
- readonly className?: string;
33
- };
34
- readonly detail?: {
35
- readonly style?: CSSProperties;
36
- readonly className?: string;
37
- };
38
- readonly headerGroup?: {
39
- readonly style?: CSSProperties;
40
- readonly className?: string;
41
- };
42
- readonly cell?: {
43
- readonly style?: CSSProperties;
44
- readonly className?: string;
45
- };
46
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,7 +0,0 @@
1
- export type * from "./api.js";
2
- export type * from "./column.js";
3
- export type * from "./grid.js";
4
- export type * from "./props.js";
5
- export type { HavingFilterFn, PivotField, PivotModel, LabelFilter, } from "../data-source-client/use-client-data-source.js";
6
- export type { PivotState } from "../data-source-client/hooks/use-pivot/use-pivot-columns.js";
7
- export type { SortFn, GroupFn, DimensionSort, DimensionAgg, Dimension, FilterFn, AggregationFn, Aggregator, LeafIdFn, GroupIdFn, RowSelectionState, RowSelectionIsolated, RowSelectionLinked, RowSelectNode, RowNode, RowLeaf, RowGroup, RowAggregated, ColumnPin, LayoutCell, LayoutHeader, LayoutHeaderCell, LayoutHeaderGroup, LayoutHeaderFloating, LayoutFullWidthRow, LayoutRow, LayoutRowWithCells, PositionDetailCell, PositionFloatingCell, PositionFullWidthRow, PositionGridCell, PositionGridCellRoot, PositionHeaderCell, PositionHeaderGroupCell, PositionUnion, } from "@1771technologies/lytenyte-shared";
@@ -1 +0,0 @@
1
- export {};