@1771technologies/lytenyte-pro 1.0.1 → 1.0.3
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 +1 -6
- package/dist/+types.d.ts +24 -4
- package/dist/cell-selection/cell-selection-driver.js +2 -1
- package/dist/cell-selection/cell-style-row.d.ts +2 -2
- package/dist/cell-selection/cell-style-row.js +1 -1
- package/dist/cell-selection/get-root-cell.js +3 -83
- package/dist/cell-selection/index.d.ts +0 -1
- package/dist/cell-selection/index.js +0 -1
- package/dist/cell-selection/split-cell-selection-rect.d.ts +8 -1
- package/dist/cell-selection/split-cell-selection-rect.js +13 -4
- package/dist/cell-selection/split-on-pivot.d.ts +3 -0
- package/dist/cell-selection/split-on-pivot.js +50 -0
- package/dist/cells/cell-editor.js +1 -1
- package/dist/cells/cell-spacer.d.ts +3 -0
- package/dist/cells/cell-spacer.js +37 -0
- package/dist/cells/cell.d.ts +1 -3
- package/dist/cells/cell.js +11 -9
- package/dist/column-manager/branch.js +1 -1
- package/dist/column-manager/leaf.js +1 -1
- package/dist/column-manager/move-handle.d.ts +0 -7
- package/dist/column-manager/move-handle.js +23 -6
- package/dist/filter-tree/leaf.js +3 -1
- package/dist/grid-box/+types.d.ts +2 -2
- package/dist/grid-box/item.js +3 -3
- package/dist/grid-box/use-aggregation-box-items.js +1 -2
- package/dist/grid-box/use-column-box-items.d.ts +2 -3
- package/dist/grid-box/use-column-box-items.js +3 -3
- package/dist/grid-box/use-row-group-box-items.d.ts +3 -3
- package/dist/grid-box/use-row-group-box-items.js +41 -5
- package/dist/grid.d.ts +1 -1
- package/dist/header/resize-handler.js +21 -15
- package/dist/license.js +1 -1
- package/dist/row-data-source-client/use-client-data-source-paginated.js +154 -164
- package/dist/row-data-source-client/use-client-data-source.js +144 -177
- package/dist/row-data-source-client/use-client-tree-data-source.js +119 -152
- package/dist/row-data-source-server/use-server-data-source.js +102 -120
- package/dist/rows/row/row.d.ts +1 -1
- package/dist/rows/row/row.js +11 -4
- package/dist/rows/rows-sections.js +1 -1
- package/dist/sort-manager/+types.d.ts +2 -0
- package/dist/sort-manager/hooks/use-sort-row-item.js +6 -6
- package/dist/sort-manager/utils/sort-item-to-sort-model.js +5 -0
- package/dist/sort-manager/utils/sort-model-to-sort-items.js +2 -1
- package/dist/state/+types.d.ts +8 -10
- package/dist/state/api/cell-root.d.ts +5 -0
- package/dist/state/api/cell-root.js +64 -0
- package/dist/state/api/edit-begin.js +5 -9
- package/dist/state/api/edit-is-cell-active.d.ts +1 -1
- package/dist/state/api/edit-is-cell-active.js +2 -7
- package/dist/state/api/focus-cell.js +2 -2
- package/dist/state/helpers/column-layout.d.ts +3 -3
- package/dist/state/helpers/column-layout.js +9 -15
- package/dist/state/helpers/get-full-width-callback.d.ts +1 -1
- package/dist/state/helpers/get-full-width-callback.js +2 -0
- package/dist/state/helpers/get-span-callback.d.ts +1 -1
- package/dist/state/helpers/get-span-callback.js +2 -0
- package/dist/state/helpers/row-layout/row-layout.d.ts +5 -4
- package/dist/state/helpers/row-layout/row-layout.js +112 -346
- package/dist/state/use-lytenyte.js +398 -334
- package/dist/viewport/viewport.js +3 -2
- package/main.css +27 -3
- package/package.json +7 -7
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type ReactNode } from "react";
|
|
2
1
|
import type { Column, DropEventParams, Grid } from "../+types.js";
|
|
3
2
|
import type { GridBoxItem } from "./+types.js";
|
|
4
3
|
export interface OnDropParams<T> {
|
|
@@ -18,13 +17,13 @@ export interface UseColumnBoxItemArgs<T> {
|
|
|
18
17
|
readonly orientation?: "horizontal" | "vertical";
|
|
19
18
|
readonly draggable?: boolean;
|
|
20
19
|
readonly itemFilter?: (c: Column<T>) => boolean;
|
|
20
|
+
readonly placeholder?: (el: HTMLElement) => HTMLElement;
|
|
21
21
|
readonly onRootDrop?: (p: OnRootDropParams<T>) => void;
|
|
22
22
|
readonly onDrop?: (p: OnDropParams<T>) => void;
|
|
23
23
|
readonly onAction?: (c: OnActionParams<T>) => void;
|
|
24
24
|
readonly onDelete?: (c: OnActionParams<T>) => void;
|
|
25
|
-
readonly dragPlaceholder?: (c: Column<T>) => ReactNode;
|
|
26
25
|
}
|
|
27
|
-
export declare function useColumnBoxItems<T>({ grid, onRootDrop, onDrop, onDelete, onAction, orientation, draggable,
|
|
26
|
+
export declare function useColumnBoxItems<T>({ grid, onRootDrop, onDrop, onDelete, onAction, orientation, draggable, itemFilter, placeholder, }: UseColumnBoxItemArgs<T>): {
|
|
28
27
|
rootProps: {
|
|
29
28
|
accepted: string[];
|
|
30
29
|
orientation: "horizontal" | "vertical" | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useMemo } from "react";
|
|
2
2
|
import { useEvent } from "@1771technologies/lytenyte-react-hooks";
|
|
3
|
-
export function useColumnBoxItems({ grid, onRootDrop, onDrop, onDelete, onAction, orientation, draggable = true,
|
|
3
|
+
export function useColumnBoxItems({ grid, onRootDrop, onDrop, onDelete, onAction, orientation, draggable = true, itemFilter, placeholder, }) {
|
|
4
4
|
const columns = grid.state.columns.useValue();
|
|
5
5
|
const base = grid.state.columnBase.useValue();
|
|
6
6
|
const gridId = grid.state.gridId.useValue();
|
|
@@ -32,8 +32,8 @@ export function useColumnBoxItems({ grid, onRootDrop, onDrop, onDelete, onAction
|
|
|
32
32
|
source: "columns",
|
|
33
33
|
draggable,
|
|
34
34
|
data: c,
|
|
35
|
+
dragPlaceholder: placeholder,
|
|
35
36
|
dragData: data,
|
|
36
|
-
dragPlaceholder: dragPlaceholder ? () => dragPlaceholder?.(c) : undefined,
|
|
37
37
|
onAction: (el) => onAction?.({ column: c, el }),
|
|
38
38
|
onDelete: (el) => onDelete?.({ column: c, el }),
|
|
39
39
|
onDrop: (p) => {
|
|
@@ -53,13 +53,13 @@ export function useColumnBoxItems({ grid, onRootDrop, onDrop, onDelete, onAction
|
|
|
53
53
|
base.uiHints?.aggsAllowed?.length,
|
|
54
54
|
base.uiHints?.rowGroupable,
|
|
55
55
|
columns,
|
|
56
|
-
dragPlaceholder,
|
|
57
56
|
draggable,
|
|
58
57
|
gridId,
|
|
59
58
|
itemFilter,
|
|
60
59
|
onAction,
|
|
61
60
|
onDelete,
|
|
62
61
|
onDrop,
|
|
62
|
+
placeholder,
|
|
63
63
|
]);
|
|
64
64
|
const onRootDropEv = useEvent((p) => {
|
|
65
65
|
const columnId = `${gridId}-column`;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { type ReactNode } from "react";
|
|
2
1
|
import type { DropEventParams, Grid, RowGroupModelItem } from "../+types.js";
|
|
3
2
|
import type { GridBoxItem } from "./+types.js";
|
|
4
3
|
export interface UseRowGroupBoxItems<T> {
|
|
5
4
|
readonly grid: Grid<T>;
|
|
6
5
|
readonly orientation?: "horizontal" | "vertical";
|
|
7
|
-
readonly dragPlaceholder?: (c: RowGroupModelItem<T>) => ReactNode;
|
|
8
6
|
readonly hideColumnOnGroup?: boolean;
|
|
7
|
+
readonly includeGroupables?: boolean;
|
|
8
|
+
readonly placeholder?: (el: HTMLElement) => HTMLElement;
|
|
9
9
|
}
|
|
10
|
-
export declare function useRowGroupBoxItems<T>({ grid, orientation,
|
|
10
|
+
export declare function useRowGroupBoxItems<T>({ grid, orientation, hideColumnOnGroup, includeGroupables, placeholder, }: UseRowGroupBoxItems<T>): {
|
|
11
11
|
rootProps: {
|
|
12
12
|
accepted: string[];
|
|
13
13
|
onRootDrop: (p: DropEventParams) => void;
|
|
@@ -1,14 +1,44 @@
|
|
|
1
1
|
import { useMemo } from "react";
|
|
2
2
|
import { useEvent } from "@1771technologies/lytenyte-react-hooks";
|
|
3
|
-
export function useRowGroupBoxItems({ grid, orientation,
|
|
3
|
+
export function useRowGroupBoxItems({ grid, orientation, hideColumnOnGroup = true, includeGroupables = false, placeholder, }) {
|
|
4
4
|
const rowGroupModel = grid.state.rowGroupModel.useValue();
|
|
5
5
|
const gridId = grid.state.gridId.useValue();
|
|
6
|
+
const columns = grid.state.columns.useValue();
|
|
7
|
+
const base = grid.state.columnBase.useValue();
|
|
6
8
|
const items = useMemo(() => {
|
|
7
9
|
const groupId = `${gridId}-group`;
|
|
10
|
+
const groupables = (includeGroupables
|
|
11
|
+
? columns.map((c) => {
|
|
12
|
+
const canGroup = c.uiHints?.rowGroupable ?? base.uiHints?.rowGroupable;
|
|
13
|
+
if (!canGroup)
|
|
14
|
+
return null;
|
|
15
|
+
if (rowGroupModel.find((x) => typeof x === "string" && x === c.id))
|
|
16
|
+
return null;
|
|
17
|
+
return c;
|
|
18
|
+
})
|
|
19
|
+
: [])
|
|
20
|
+
.filter((c) => c != null)
|
|
21
|
+
.map((c, i) => {
|
|
22
|
+
return {
|
|
23
|
+
data: c.id,
|
|
24
|
+
dragData: { [groupId]: c.id },
|
|
25
|
+
draggable: false,
|
|
26
|
+
source: "groups",
|
|
27
|
+
id: c.id,
|
|
28
|
+
index: i + rowGroupModel.length,
|
|
29
|
+
label: c.name ?? c.id,
|
|
30
|
+
onAction: () => { },
|
|
31
|
+
onDelete: () => { },
|
|
32
|
+
onDrop: () => { },
|
|
33
|
+
active: false,
|
|
34
|
+
};
|
|
35
|
+
});
|
|
8
36
|
return rowGroupModel
|
|
9
37
|
.map((c, i) => {
|
|
10
38
|
const onDelete = () => {
|
|
11
39
|
grid.state.rowGroupModel.set((prev) => prev.filter((x) => x !== c));
|
|
40
|
+
if (typeof c === "string")
|
|
41
|
+
grid.api.columnUpdate({ [c]: { hide: false } });
|
|
12
42
|
};
|
|
13
43
|
const onDrop = (p) => {
|
|
14
44
|
const target = c;
|
|
@@ -62,7 +92,8 @@ export function useRowGroupBoxItems({ grid, orientation, dragPlaceholder, hideCo
|
|
|
62
92
|
onAction: () => { },
|
|
63
93
|
onDelete: onDelete,
|
|
64
94
|
onDrop: onDrop,
|
|
65
|
-
dragPlaceholder:
|
|
95
|
+
dragPlaceholder: placeholder,
|
|
96
|
+
active: true,
|
|
66
97
|
};
|
|
67
98
|
}
|
|
68
99
|
else {
|
|
@@ -77,17 +108,22 @@ export function useRowGroupBoxItems({ grid, orientation, dragPlaceholder, hideCo
|
|
|
77
108
|
onAction: () => { },
|
|
78
109
|
onDelete: onDelete,
|
|
79
110
|
onDrop,
|
|
80
|
-
|
|
111
|
+
active: true,
|
|
112
|
+
dragPlaceholder: placeholder,
|
|
81
113
|
};
|
|
82
114
|
}
|
|
83
115
|
})
|
|
84
|
-
.filter((c) => c !== null)
|
|
116
|
+
.filter((c) => c !== null)
|
|
117
|
+
.concat(groupables);
|
|
85
118
|
}, [
|
|
119
|
+
base.uiHints?.rowGroupable,
|
|
120
|
+
columns,
|
|
86
121
|
grid.api,
|
|
87
122
|
grid.state.rowGroupModel,
|
|
88
123
|
gridId,
|
|
89
124
|
hideColumnOnGroup,
|
|
90
|
-
|
|
125
|
+
includeGroupables,
|
|
126
|
+
placeholder,
|
|
91
127
|
rowGroupModel,
|
|
92
128
|
]);
|
|
93
129
|
const onRootDrop = useEvent((p) => {
|
package/dist/grid.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export declare const Grid: {
|
|
|
11
11
|
RowsContainer: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
12
12
|
RowsBottom: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
13
13
|
RowsTop: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
14
|
-
Row: import("react").
|
|
14
|
+
Row: import("react").NamedExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "onDrag"> & import("./rows/row/row").RowProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
15
15
|
RowsCenter: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
16
16
|
Viewport: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
17
17
|
useLyteNyte: typeof useLyteNyte;
|
|
@@ -63,20 +63,11 @@ export function ResizeHandler({ as, cell, xPositions, style, className, }) {
|
|
|
63
63
|
if (!header)
|
|
64
64
|
return;
|
|
65
65
|
const pin = header.getAttribute("data-ln-pin");
|
|
66
|
-
const
|
|
67
|
-
const
|
|
68
|
-
let after;
|
|
69
|
-
if (pin !== "end") {
|
|
70
|
-
after = Array.from(vp.querySelectorAll(queryAfter)).concat(Array.from(vp.querySelectorAll(headerAfterQuery)));
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
after = [];
|
|
74
|
-
}
|
|
75
|
-
const q = Array.from(vp.querySelectorAll(query));
|
|
76
|
-
q.push(header);
|
|
66
|
+
const cells = Array.from(vp.querySelectorAll(query));
|
|
67
|
+
const headers = [header];
|
|
77
68
|
if (floating)
|
|
78
|
-
|
|
79
|
-
|
|
69
|
+
headers.push(floating);
|
|
70
|
+
headers.forEach((c) => {
|
|
80
71
|
if (!isHTMLElement(c))
|
|
81
72
|
return;
|
|
82
73
|
c.style.removeProperty("min-width");
|
|
@@ -89,13 +80,28 @@ export function ResizeHandler({ as, cell, xPositions, style, className, }) {
|
|
|
89
80
|
c.style.transform = getTranslate(isRtl ? -x : x, 0);
|
|
90
81
|
}
|
|
91
82
|
});
|
|
83
|
+
const widthPx = `${width + deltaRef.current}px`;
|
|
84
|
+
cells.forEach((c) => {
|
|
85
|
+
if (!isHTMLElement(c))
|
|
86
|
+
return;
|
|
87
|
+
c.style.minWidth = widthPx;
|
|
88
|
+
c.style.maxWidth = widthPx;
|
|
89
|
+
c.style.width = widthPx;
|
|
90
|
+
});
|
|
91
|
+
const headerAfterQuery = `${headerQuery} ~ [data-ln-header-cell="true"]`;
|
|
92
|
+
let after;
|
|
93
|
+
if (pin !== "end") {
|
|
94
|
+
after = Array.from(vp.querySelectorAll(headerAfterQuery));
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
after = [];
|
|
98
|
+
}
|
|
92
99
|
after.forEach((c) => {
|
|
93
100
|
if (!isHTMLElement(c))
|
|
94
101
|
return;
|
|
95
102
|
const thisPin = c.getAttribute("data-ln-pin");
|
|
96
|
-
if (pin === "end" && thisPin === "end")
|
|
103
|
+
if (pin === "end" && thisPin === "end")
|
|
97
104
|
return;
|
|
98
|
-
}
|
|
99
105
|
if (pin !== "end" && thisPin === "end")
|
|
100
106
|
return;
|
|
101
107
|
const colindex = getColIndexFromEl(c);
|
package/dist/license.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const hashSalt = "faec0f3c45281b1fe12d87e64a6c3271";
|
|
2
|
-
const issueDate = new Date("2025-
|
|
2
|
+
const issueDate = new Date("2025-09-01");
|
|
3
3
|
function getHostname() {
|
|
4
4
|
const win = globalThis?.document?.defaultView || (typeof window !== "undefined" ? window : null);
|
|
5
5
|
const loc = win?.location;
|