@1771technologies/lytenyte-pro 1.0.13 → 1.0.15
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/__play__/cell-selections/cell-selection.play.d.ts +5 -0
- package/dist/__play__/{grid-navigation/normal-layout.play.js → cell-selections/cell-selection.play.js} +32 -24
- package/dist/__play__/test-utils/row-handler.js +3 -3
- package/dist/cell-selection/cell-selection-driver.js +5 -2
- package/dist/context.d.ts +2 -1
- package/dist/context.js +5 -4
- package/dist/grid/cell.d.ts +6 -0
- package/dist/grid/cell.js +3 -0
- package/dist/{header → grid}/header-cell.d.ts +2 -2
- package/dist/grid/header-cell.js +4 -0
- package/dist/grid/header-group-cell.d.ts +6 -0
- package/dist/grid/header-group-cell.js +3 -0
- package/dist/grid/header-row.d.ts +5 -0
- package/dist/grid/header-row.js +2 -0
- package/dist/grid/header.js +2 -0
- package/dist/{root → grid}/root.d.ts +1 -1
- package/dist/grid/root.js +37 -0
- package/dist/{rows → grid}/row-full-width.d.ts +2 -1
- package/dist/grid/row-full-width.js +4 -0
- package/dist/grid/row.d.ts +8 -0
- package/dist/grid/row.js +4 -0
- package/dist/grid/rows-container.js +2 -0
- package/dist/grid/rows-sections.js +13 -0
- package/dist/grid/viewport.js +9 -0
- package/dist/grid.d.ts +7 -7
- package/dist/grid.js +11 -11
- package/dist/state/helpers/row-layout/row-layout.js +6 -5
- package/dist/types/types.d.ts +6 -6
- package/package.json +7 -7
- package/dist/__play__/grid-navigation/cell-spans-large.play.d.ts +0 -3
- package/dist/__play__/grid-navigation/cell-spans-large.play.js +0 -26
- package/dist/__play__/grid-navigation/cell-spans-with-pins.play.d.ts +0 -3
- package/dist/__play__/grid-navigation/cell-spans-with-pins.play.js +0 -27
- package/dist/__play__/grid-navigation/cell-spans.play.d.ts +0 -3
- package/dist/__play__/grid-navigation/cell-spans.play.js +0 -52
- package/dist/__play__/grid-navigation/cell-with-tabbables.play.d.ts +0 -3
- package/dist/__play__/grid-navigation/cell-with-tabbables.play.js +0 -47
- package/dist/__play__/grid-navigation/column-groups.play.d.ts +0 -3
- package/dist/__play__/grid-navigation/column-groups.play.js +0 -24
- package/dist/__play__/grid-navigation/full-width-rows.play.d.ts +0 -6
- package/dist/__play__/grid-navigation/full-width-rows.play.js +0 -67
- package/dist/__play__/grid-navigation/horizontal-navigation.pt.d.ts +0 -1
- package/dist/__play__/grid-navigation/horizontal-navigation.pt.js +0 -877
- package/dist/__play__/grid-navigation/normal-layout.play.d.ts +0 -10
- package/dist/__play__/grid-navigation/pinned-gap-layout.play.d.ts +0 -3
- package/dist/__play__/grid-navigation/pinned-gap-layout.play.js +0 -11
- package/dist/__play__/grid-navigation/row-detail-with-spans.play.d.ts +0 -6
- package/dist/__play__/grid-navigation/row-detail-with-spans.play.js +0 -79
- package/dist/__play__/grid-navigation/row-detail.play.d.ts +0 -6
- package/dist/__play__/grid-navigation/row-detail.play.js +0 -78
- package/dist/__play__/grid-navigation/row-detail.pt.d.ts +0 -1
- package/dist/__play__/grid-navigation/row-detail.pt.js +0 -68
- package/dist/__play__/grid-navigation/vertical-navigation.pt.d.ts +0 -1
- package/dist/__play__/grid-navigation/vertical-navigation.pt.js +0 -176
- package/dist/cells/+types.cell.d.ts +0 -13
- package/dist/cells/+types.cell.js +0 -1
- package/dist/cells/cell-default.d.ts +0 -2
- package/dist/cells/cell-default.js +0 -8
- package/dist/cells/cell-editor.d.ts +0 -6
- package/dist/cells/cell-editor.js +0 -110
- package/dist/cells/cell-spacer.d.ts +0 -9
- package/dist/cells/cell-spacer.js +0 -39
- package/dist/cells/cell.d.ts +0 -5
- package/dist/cells/cell.js +0 -44
- package/dist/cells/use-cell-style.d.ts +0 -3
- package/dist/cells/use-cell-style.js +0 -51
- package/dist/header/header-cell.js +0 -22
- package/dist/header/header-group-cell.d.ts +0 -5
- package/dist/header/header-group-cell.js +0 -16
- package/dist/header/header-row.d.ts +0 -4
- package/dist/header/header-row.js +0 -10
- package/dist/header/header.js +0 -12
- package/dist/header/resize-handler.d.ts +0 -12
- package/dist/header/resize-handler.js +0 -136
- package/dist/header/use-drag-move.d.ts +0 -14
- package/dist/header/use-drag-move.js +0 -97
- package/dist/header/use-header-cell-renderer.d.ts +0 -4
- package/dist/header/use-header-cell-renderer.js +0 -37
- package/dist/root/root.js +0 -108
- package/dist/rows/row/context.d.ts +0 -15
- package/dist/rows/row/context.js +0 -14
- package/dist/rows/row/row.d.ts +0 -7
- package/dist/rows/row/row.js +0 -25
- package/dist/rows/row/use-row-context-value.d.ts +0 -6
- package/dist/rows/row/use-row-context-value.js +0 -45
- package/dist/rows/row-detail-row.d.ts +0 -4
- package/dist/rows/row-detail-row.js +0 -47
- package/dist/rows/row-full-width.js +0 -19
- package/dist/rows/rows-container.js +0 -9
- package/dist/rows/rows-sections.js +0 -27
- package/dist/rows/scrollers/native-scroller.d.ts +0 -2
- package/dist/rows/scrollers/native-scroller.js +0 -4
- package/dist/utils/cycle-sorts.d.ts +0 -2
- package/dist/utils/cycle-sorts.js +0 -16
- package/dist/viewport/begin-editing.d.ts +0 -5
- package/dist/viewport/begin-editing.js +0 -15
- package/dist/viewport/viewport.js +0 -85
- /package/dist/{root → grid}/dialog-driver.d.ts +0 -0
- /package/dist/{root → grid}/dialog-driver.js +0 -0
- /package/dist/{header → grid}/header.d.ts +0 -0
- /package/dist/{root → grid}/popover-driver.d.ts +0 -0
- /package/dist/{root → grid}/popover-driver.js +0 -0
- /package/dist/{rows → grid}/rows-container.d.ts +0 -0
- /package/dist/{rows → grid}/rows-sections.d.ts +0 -0
- /package/dist/{viewport → grid}/viewport.d.ts +0 -0
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { CellRendererFn, ColumnBase, RowLayout, RowNode } from "../../+types";
|
|
2
|
-
export interface RowMetaData {
|
|
3
|
-
readonly selected: boolean;
|
|
4
|
-
readonly indeterminate: boolean;
|
|
5
|
-
readonly colBounds: [number, number];
|
|
6
|
-
readonly row: RowNode<any> | null;
|
|
7
|
-
readonly layout: RowLayout<any>;
|
|
8
|
-
readonly xPositions: Uint32Array;
|
|
9
|
-
readonly yPositions: Uint32Array;
|
|
10
|
-
readonly base: ColumnBase<any>;
|
|
11
|
-
readonly renderers: Record<string, CellRendererFn<any>>;
|
|
12
|
-
readonly rtl: boolean;
|
|
13
|
-
}
|
|
14
|
-
export declare const RowContext: import("react").Context<RowMetaData>;
|
|
15
|
-
export declare const useRowMeta: () => RowMetaData;
|
package/dist/rows/row/context.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { createContext, useContext } from "react";
|
|
2
|
-
export const RowContext = createContext({
|
|
3
|
-
selected: false,
|
|
4
|
-
indeterminate: false,
|
|
5
|
-
colBounds: [0, 0],
|
|
6
|
-
row: null,
|
|
7
|
-
layout: null,
|
|
8
|
-
xPositions: new Uint32Array(),
|
|
9
|
-
yPositions: new Uint32Array(),
|
|
10
|
-
base: null,
|
|
11
|
-
renderers: null,
|
|
12
|
-
rtl: false,
|
|
13
|
-
});
|
|
14
|
-
export const useRowMeta = () => useContext(RowContext);
|
package/dist/rows/row/row.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { RowNormalRowLayout } from "../../+types";
|
|
2
|
-
import { type DropWrapProps } from "@1771technologies/lytenyte-shared";
|
|
3
|
-
export interface RowProps extends Omit<DropWrapProps, "accepted"> {
|
|
4
|
-
readonly row: RowNormalRowLayout<any>;
|
|
5
|
-
readonly accepted?: string[];
|
|
6
|
-
}
|
|
7
|
-
export declare const Row: import("react").NamedExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "onDrag"> & RowProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
package/dist/rows/row/row.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef, memo } from "react";
|
|
3
|
-
import { useGridRoot } from "../../context.js";
|
|
4
|
-
import { RowDetailRow } from "../row-detail-row.js";
|
|
5
|
-
import { RowReact } from "@1771technologies/lytenyte-shared";
|
|
6
|
-
import { useRowContextValue } from "./use-row-context-value.js";
|
|
7
|
-
import { RowContext } from "./context.js";
|
|
8
|
-
import { equal } from "@1771technologies/lytenyte-js-utils";
|
|
9
|
-
import { CellSpacerNoPin } from "../../cells/cell-spacer.js";
|
|
10
|
-
const empty = [];
|
|
11
|
-
const RowImpl = forwardRef(function Rows({ row, ...props }, forwarded) {
|
|
12
|
-
const ctx = useGridRoot().grid;
|
|
13
|
-
const yPos = ctx.state.yPositions.useValue();
|
|
14
|
-
const rowMeta = useRowContextValue(ctx, row, yPos);
|
|
15
|
-
const hasSpans = ctx.internal.hasSpans.useValue();
|
|
16
|
-
const accepted = props.accepted ?? empty;
|
|
17
|
-
return (_jsx(RowContext.Provider, { value: rowMeta, children: _jsxs(RowReact, { ...props, ref: forwarded, accepted: accepted, gridId: ctx.state.gridId.useValue(), rowIndex: row.rowIndex, rowFirstPinBottom: row.rowFirstPinBottom, rowLastPinTop: row.rowLastPinTop, rowIsFocusRow: row.rowIsFocusRow ?? false, rowPin: row.rowPin, topOffset: ctx.view.useValue().rows.rowTopTotalHeight, yPositions: yPos, hasSpans: hasSpans, "data-ln-row-selected": rowMeta.selected, children: [_jsx(CellSpacerNoPin, { xPositions: rowMeta.xPositions }), props.children, _jsx(RowDetailRow, { layout: row })] }) }));
|
|
18
|
-
});
|
|
19
|
-
export const Row = memo(RowImpl, (prev, next) => {
|
|
20
|
-
const { row: rowP, ...propsP } = prev;
|
|
21
|
-
const { row: rowN, ...propsN } = next;
|
|
22
|
-
const { cells: _, ...rowPropsP } = rowP;
|
|
23
|
-
const { cells: __, ...rowPropsN } = rowN;
|
|
24
|
-
return equal(rowPropsN, rowPropsP) && equal(propsP, propsN);
|
|
25
|
-
});
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { Grid, RowLayout } from "../../+types.js";
|
|
2
|
-
import type { InternalAtoms } from "../../state/+types.js";
|
|
3
|
-
import type { RowMetaData } from "./context.js";
|
|
4
|
-
export declare function useRowContextValue(grid: Grid<any> & {
|
|
5
|
-
internal: InternalAtoms;
|
|
6
|
-
}, row: RowLayout<any>, yPositions: Uint32Array): RowMetaData;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { useEffect, useMemo, useState } from "react";
|
|
2
|
-
export function useRowContextValue(grid, row, yPositions) {
|
|
3
|
-
const r = row.row.useValue();
|
|
4
|
-
const xPositions = grid.state.xPositions.useValue();
|
|
5
|
-
const [indeterminate, setIndeterminate] = useState(false);
|
|
6
|
-
const [selected, setSelected] = useState(false);
|
|
7
|
-
const colBounds = grid.internal.colBounds.useValue();
|
|
8
|
-
const rtl = grid.state.rtl.useValue();
|
|
9
|
-
const base = grid.state.columnBase.useValue();
|
|
10
|
-
const renderers = grid.state.cellRenderers.useValue();
|
|
11
|
-
useEffect(() => {
|
|
12
|
-
function handleSelection() {
|
|
13
|
-
if (!r)
|
|
14
|
-
return;
|
|
15
|
-
const selectedIds = grid.state.rowSelectedIds.get();
|
|
16
|
-
if (selectedIds.has(r.id))
|
|
17
|
-
setSelected(true);
|
|
18
|
-
else
|
|
19
|
-
setSelected(false);
|
|
20
|
-
if (r.kind === "branch") {
|
|
21
|
-
const childIds = grid.state.rowDataSource.get().rowAllChildIds(r.id);
|
|
22
|
-
setIndeterminate(childIds.some((c) => selectedIds.has(c)) && childIds.some((c) => !selectedIds.has(c)));
|
|
23
|
-
}
|
|
24
|
-
else
|
|
25
|
-
setIndeterminate(false);
|
|
26
|
-
}
|
|
27
|
-
handleSelection();
|
|
28
|
-
return grid.state.rowSelectedIds.watch(() => handleSelection());
|
|
29
|
-
}, [grid.state.rowDataSource, grid.state.rowSelectedIds, r]);
|
|
30
|
-
const value = useMemo(() => {
|
|
31
|
-
return {
|
|
32
|
-
selected,
|
|
33
|
-
indeterminate,
|
|
34
|
-
colBounds,
|
|
35
|
-
row: r,
|
|
36
|
-
layout: row,
|
|
37
|
-
xPositions,
|
|
38
|
-
yPositions,
|
|
39
|
-
rtl,
|
|
40
|
-
base,
|
|
41
|
-
renderers,
|
|
42
|
-
};
|
|
43
|
-
}, [base, colBounds, indeterminate, r, renderers, row, rtl, selected, xPositions, yPositions]);
|
|
44
|
-
return value;
|
|
45
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { SCROLL_WIDTH_VARIABLE_USE, sizeFromCoord } from "@1771technologies/lytenyte-shared";
|
|
3
|
-
import { useGridRoot } from "../context.js";
|
|
4
|
-
import { useEffect, useState } from "react";
|
|
5
|
-
export function RowDetailRow({ layout, }) {
|
|
6
|
-
const cx = useGridRoot();
|
|
7
|
-
const row = layout.row.useValue();
|
|
8
|
-
if (!row || !cx.grid.api.rowDetailIsExpanded(row))
|
|
9
|
-
return null;
|
|
10
|
-
return _jsx(RowDetailImpl, { row: row, rowIndex: layout.rowIndex });
|
|
11
|
-
}
|
|
12
|
-
function RowDetailImpl({ row, rowIndex }) {
|
|
13
|
-
const cx = useGridRoot();
|
|
14
|
-
const rtl = cx.grid.state.rtl.useValue();
|
|
15
|
-
const height = cx.grid.api.rowDetailRenderedHeight(row);
|
|
16
|
-
const rowHeight = sizeFromCoord(rowIndex, cx.grid.state.yPositions.get()) - height;
|
|
17
|
-
const Renderer = cx.grid.state.rowDetailRenderer.useValue().fn;
|
|
18
|
-
const [ref, setRef] = useState(null);
|
|
19
|
-
useEffect(() => {
|
|
20
|
-
const first = ref?.firstElementChild;
|
|
21
|
-
if (!first)
|
|
22
|
-
return;
|
|
23
|
-
const obs = new ResizeObserver(() => {
|
|
24
|
-
cx.grid.internal.rowDetailAutoHeightCache.set((prev) => ({
|
|
25
|
-
...prev,
|
|
26
|
-
[rowIndex]: first.offsetHeight,
|
|
27
|
-
}));
|
|
28
|
-
});
|
|
29
|
-
obs.observe(first);
|
|
30
|
-
return () => obs.disconnect();
|
|
31
|
-
}, [cx.grid.internal.rowDetailAutoHeightCache, ref?.firstElementChild, rowIndex]);
|
|
32
|
-
const isAuto = cx.grid.state.rowDetailHeight.useValue() === "auto";
|
|
33
|
-
return (_jsx("div", { ref: setRef, role: "gridcell", style: {
|
|
34
|
-
pointerEvents: "none",
|
|
35
|
-
position: "absolute",
|
|
36
|
-
left: 0,
|
|
37
|
-
width: SCROLL_WIDTH_VARIABLE_USE,
|
|
38
|
-
}, children: _jsx("div", { tabIndex: 0, "data-ln-gridid": cx.grid.state.gridId.get(), "data-ln-row-detail": true, "data-ln-rowindex": rowIndex, style: {
|
|
39
|
-
position: "sticky",
|
|
40
|
-
pointerEvents: "all",
|
|
41
|
-
right: rtl ? "0px" : undefined,
|
|
42
|
-
left: rtl ? undefined : "0px",
|
|
43
|
-
marginTop: rowHeight,
|
|
44
|
-
width: cx.grid.state.viewportWidthInner.useValue(),
|
|
45
|
-
height: isAuto ? "auto" : height,
|
|
46
|
-
}, children: _jsx(Renderer, { grid: cx.grid, row: row, rowIndex: rowIndex }) }) }));
|
|
47
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef } from "react";
|
|
3
|
-
import { fastDeepMemo } from "@1771technologies/lytenyte-react-hooks";
|
|
4
|
-
import { useGridRoot } from "../context.js";
|
|
5
|
-
import { RowFullWidthReact } from "@1771technologies/lytenyte-shared";
|
|
6
|
-
import { RowDetailRow } from "./row-detail-row.js";
|
|
7
|
-
import { useRowContextValue } from "./row/use-row-context-value.js";
|
|
8
|
-
const empty = [];
|
|
9
|
-
const RowFullWidthImpl = forwardRef(function RowFullWidth({ row: layout, space, children, ...props }, forwarded) {
|
|
10
|
-
const grid = useGridRoot().grid;
|
|
11
|
-
const Renderer = grid.state.rowFullWidthRenderer.useValue().fn;
|
|
12
|
-
const row = layout.row.useValue();
|
|
13
|
-
const yPositions = grid.state.yPositions.useValue();
|
|
14
|
-
const hasSpans = grid.internal.hasSpans.useValue();
|
|
15
|
-
const meta = useRowContextValue(grid, layout, yPositions);
|
|
16
|
-
return (_jsx(RowFullWidthReact, { ...props, ref: forwarded, accepted: props.accepted ?? empty, detail: _jsx(RowDetailRow, { layout: layout }), detailHeight: grid.api.rowDetailRenderedHeight(row ?? ""), gridId: grid.state.gridId.useValue(), rtl: meta.rtl, hasSpans: hasSpans, rowFirstPinBottom: layout.rowFirstPinBottom, rowLastPinTop: layout.rowLastPinTop, rowIndex: layout.rowIndex, rowIsFocusRow: layout.rowIsFocusRow ?? false, rowPin: layout.rowPin, topOffset: grid.view.useValue().rows.rowTopTotalHeight, yPositions: yPositions, space: space, "data-ln-row-selected": meta.selected, children: children ??
|
|
17
|
-
(row ? (_jsx(Renderer, { grid: grid, row: row, rowIndex: layout.rowIndex, rowSelected: meta.selected, rowIndeterminate: meta.indeterminate })) : null) }));
|
|
18
|
-
});
|
|
19
|
-
export const RowFullWidth = fastDeepMemo(RowFullWidthImpl);
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef } from "react";
|
|
3
|
-
import { useGridRoot } from "../context.js";
|
|
4
|
-
import { fastDeepMemo } from "@1771technologies/lytenyte-react-hooks";
|
|
5
|
-
import { RowsContainerReact } from "@1771technologies/lytenyte-shared";
|
|
6
|
-
export const RowsContainer = fastDeepMemo(forwardRef(function Rows(props, forwarded) {
|
|
7
|
-
const ctx = useGridRoot().grid;
|
|
8
|
-
return (_jsx(RowsContainerReact, { ...props, ref: forwarded, height: ctx.state.heightTotal.useValue(), width: ctx.state.widthTotal.useValue(), viewportHeight: ctx.state.viewportHeightInner.useValue(), viewportWidth: ctx.state.viewportWidthInner.useValue() }));
|
|
9
|
-
}));
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef } from "react";
|
|
3
|
-
import { fastDeepMemo } from "@1771technologies/lytenyte-react-hooks";
|
|
4
|
-
import { useGridRoot } from "../context.js";
|
|
5
|
-
import { NativeScroller } from "./scrollers/native-scroller.js";
|
|
6
|
-
import { RowsBottomReact, RowsCenterReact, RowsTopReact } from "@1771technologies/lytenyte-shared";
|
|
7
|
-
import { CellSelectionBottom, CellSelectionCenter, CellSelectionTop, } from "../cell-selection/cell-selection-containers.js";
|
|
8
|
-
export const RowsTop = fastDeepMemo(forwardRef(function RowsTop(props, forwarded) {
|
|
9
|
-
const cx = useGridRoot().grid;
|
|
10
|
-
const view = cx.view.useValue().rows;
|
|
11
|
-
const topCount = cx.state.rowDataStore.rowTopCount.useValue();
|
|
12
|
-
return (_jsxs(RowsTopReact, { ...props, rowFirst: topCount || -1, rowLast: topCount, ref: forwarded, top: cx.internal.headerHeightTotal.useValue(), height: view.rowTopTotalHeight, children: [props.children, _jsx(CellSelectionTop, {})] }));
|
|
13
|
-
}));
|
|
14
|
-
export const RowsCenter = fastDeepMemo(forwardRef(function RowsCenter({ children, ...props }, forwarded) {
|
|
15
|
-
const cx = useGridRoot().grid;
|
|
16
|
-
const view = cx.view.useValue().rows;
|
|
17
|
-
const rowCenterCount = cx.state.rowDataStore.rowCenterCount.useValue();
|
|
18
|
-
return (_jsx(RowsCenterReact, { ...props, ref: forwarded, rowFirst: cx.state.rowDataStore.rowTopCount.useValue(), rowLast: rowCenterCount + cx.state.rowDataStore.rowTopCount.useValue(), height: view.rowCenterTotalHeight, pinSectionHeights: view.rowBottomTotalHeight + view.rowTopTotalHeight, children: _jsxs(NativeScroller, { children: [_jsx(CellSelectionCenter, {}), children] }) }));
|
|
19
|
-
}));
|
|
20
|
-
export const RowsBottom = fastDeepMemo(forwardRef(function RowsBottom(props, forwarded) {
|
|
21
|
-
const cx = useGridRoot().grid;
|
|
22
|
-
const view = cx.view.useValue().rows;
|
|
23
|
-
const rowCenterCount = cx.state.rowDataStore.rowCenterCount.useValue();
|
|
24
|
-
const rowTopCount = cx.state.rowDataStore.rowTopCount.useValue();
|
|
25
|
-
const rowBottomCount = cx.state.rowDataStore.rowBottomCount.useValue();
|
|
26
|
-
return (_jsxs(RowsBottomReact, { ...props, ref: forwarded, rowFirst: rowCenterCount + rowTopCount, rowLast: rowCenterCount + rowBottomCount + rowTopCount, height: view.rowBottomTotalHeight, children: [_jsx(CellSelectionBottom, {}), props.children] }));
|
|
27
|
-
}));
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export function cycleSorts(grid, column) {
|
|
2
|
-
const current = grid.api.sortForColumn(column.id);
|
|
3
|
-
if (current) {
|
|
4
|
-
if (current.sort.isDescending)
|
|
5
|
-
grid.state.sortModel.set([]);
|
|
6
|
-
else
|
|
7
|
-
grid.state.sortModel.set([
|
|
8
|
-
{ columnId: column.id, sort: { kind: "string" }, isDescending: true },
|
|
9
|
-
]);
|
|
10
|
-
}
|
|
11
|
-
else {
|
|
12
|
-
grid.state.sortModel.set([
|
|
13
|
-
{ columnId: column.id, sort: { kind: "string" }, isDescending: false },
|
|
14
|
-
]);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export function beginEditing(grid, activator, init) {
|
|
2
|
-
const focusPos = grid.internal.focusActive.get();
|
|
3
|
-
const editMode = grid.state.editCellMode.get();
|
|
4
|
-
const editActivator = grid.state.editClickActivator.get();
|
|
5
|
-
if (focusPos?.kind !== "cell" || editMode === "readonly")
|
|
6
|
-
return;
|
|
7
|
-
if (activator && editActivator !== activator)
|
|
8
|
-
return;
|
|
9
|
-
const column = grid.api.columnByIndex(focusPos.colIndex);
|
|
10
|
-
if (!column)
|
|
11
|
-
return;
|
|
12
|
-
if (grid.api.editIsCellActive({ column, rowIndex: focusPos.rowIndex }))
|
|
13
|
-
return;
|
|
14
|
-
grid.api.editBegin({ column, rowIndex: focusPos.rowIndex, init });
|
|
15
|
-
}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef } from "react";
|
|
3
|
-
import { useCombinedRefs } from "@1771technologies/lytenyte-react-hooks";
|
|
4
|
-
import { useGridRoot } from "../context.js";
|
|
5
|
-
import { handleNavigation, useFocusTracking } from "@1771technologies/lytenyte-shared";
|
|
6
|
-
import { beginEditing } from "./begin-editing.js";
|
|
7
|
-
export const Viewport = forwardRef(function Viewport({ children, style, ...props }, forwarded) {
|
|
8
|
-
const ctx = useGridRoot();
|
|
9
|
-
const ref = useCombinedRefs(ctx.ref, forwarded);
|
|
10
|
-
const vp = ctx.grid.state.viewport.useValue();
|
|
11
|
-
const width = ctx.grid.state.widthTotal.useValue();
|
|
12
|
-
const height = ctx.grid.state.heightTotal.useValue();
|
|
13
|
-
const rtl = ctx.grid.state.rtl.useValue();
|
|
14
|
-
const cellSelectionMode = ctx.grid.state.cellSelectionMode.useValue();
|
|
15
|
-
const [focused, vpFocused] = useFocusTracking(vp, ctx.grid.internal.focusActive);
|
|
16
|
-
const shouldCapture = !focused && !vpFocused;
|
|
17
|
-
return (_jsxs(_Fragment, { children: [_jsxs("div", { tabIndex: 0, ...props, "data-ln-has-cell-selection": cellSelectionMode !== "none", onKeyDown: (e) => {
|
|
18
|
-
props.onKeyDown?.(e);
|
|
19
|
-
if (e.defaultPrevented || e.isPropagationStopped() || !vp)
|
|
20
|
-
return;
|
|
21
|
-
handleNavigation({
|
|
22
|
-
gridId: ctx.grid.state.gridId.get(),
|
|
23
|
-
rtl,
|
|
24
|
-
event: e,
|
|
25
|
-
viewport: vp,
|
|
26
|
-
topCount: ctx.grid.state.rowDataStore.rowTopCount.get(),
|
|
27
|
-
centerCount: ctx.grid.state.rowDataStore.rowCenterCount.get(),
|
|
28
|
-
getRootCell: ctx.grid.api.cellRoot,
|
|
29
|
-
scrollIntoView: ctx.grid.api.scrollIntoView,
|
|
30
|
-
focusActive: ctx.grid.internal.focusActive,
|
|
31
|
-
columnCount: ctx.grid.state.columnMeta.get().columnsVisible.length,
|
|
32
|
-
rowCount: ctx.grid.state.rowDataStore.rowCount.get(),
|
|
33
|
-
isRowDetailExpanded: (r) => {
|
|
34
|
-
const row = ctx.grid.api.rowByIndex(r);
|
|
35
|
-
if (!row)
|
|
36
|
-
return false;
|
|
37
|
-
return ctx.grid.api.rowDetailIsExpanded(row);
|
|
38
|
-
},
|
|
39
|
-
});
|
|
40
|
-
if (e.key === "Enter" || e.key.length === 1) {
|
|
41
|
-
// We use a timeout to avoid setting the value on clicks. This can happen when a user types
|
|
42
|
-
// a non-printable key.
|
|
43
|
-
setTimeout(() => {
|
|
44
|
-
beginEditing(ctx.grid, undefined, e.key === "Enter" ? undefined : e.key);
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
if (e.key === "Backspace" || e.key === "Delete") {
|
|
48
|
-
const focusPos = ctx.grid.internal.focusActive.get();
|
|
49
|
-
if (focusPos?.kind === "cell")
|
|
50
|
-
ctx.grid.api.editUpdate({
|
|
51
|
-
column: focusPos.colIndex,
|
|
52
|
-
rowIndex: focusPos.rowIndex,
|
|
53
|
-
value: null,
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
}, onClick: (e) => {
|
|
57
|
-
props.onClick?.(e);
|
|
58
|
-
if (e.defaultPrevented)
|
|
59
|
-
return;
|
|
60
|
-
beginEditing(ctx.grid, "single");
|
|
61
|
-
if (ctx.grid.state.rowSelectionActivator.get() === "single-click")
|
|
62
|
-
ctx.grid.api.rowHandleSelect(e);
|
|
63
|
-
}, onDoubleClick: (e) => {
|
|
64
|
-
props.onDoubleClick?.(e);
|
|
65
|
-
if (e.defaultPrevented)
|
|
66
|
-
return;
|
|
67
|
-
beginEditing(ctx.grid, "double-click");
|
|
68
|
-
if (ctx.grid.state.rowSelectionActivator.get() === "double-click")
|
|
69
|
-
ctx.grid.api.rowHandleSelect(e);
|
|
70
|
-
}, role: "grid", ref: ref, "data-ln-viewport": true, style: {
|
|
71
|
-
...style,
|
|
72
|
-
position: "relative",
|
|
73
|
-
display: "flex",
|
|
74
|
-
flexDirection: "column",
|
|
75
|
-
contain: "strict",
|
|
76
|
-
width: "100%",
|
|
77
|
-
height: "100%",
|
|
78
|
-
overflow: style?.overflow ?? "auto",
|
|
79
|
-
direction: rtl ? "rtl" : "ltr",
|
|
80
|
-
}, children: [vp && children, !vp && _jsx("div", { style: { width, height } })] }), shouldCapture && (_jsx("div", { role: "none", "data-ln-focus-capture": true, onFocusCapture: (e) => {
|
|
81
|
-
e.preventDefault();
|
|
82
|
-
e.stopPropagation();
|
|
83
|
-
vp?.focus();
|
|
84
|
-
}, tabIndex: 0 }))] }));
|
|
85
|
-
});
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|