@1771technologies/lytenyte-pro 1.0.0-beta.2 → 1.0.0-beta.20

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 (152) hide show
  1. package/dist/+types.d.ts +40 -11
  2. package/dist/cell-selection/adjust-rect-for-row-and-cell-span.d.ts +1 -1
  3. package/dist/cell-selection/adjust-rect-for-row-and-cell-span.js +1 -1
  4. package/dist/cell-selection/are-rects-equal.d.ts +1 -1
  5. package/dist/cell-selection/bound-selection-rect.d.ts +1 -1
  6. package/dist/cell-selection/cell-selection-driver.js +9 -1
  7. package/dist/cell-selection/deselect-rect-range.d.ts +1 -1
  8. package/dist/cell-selection/deselect-rect-range.js +1 -1
  9. package/dist/cell-selection/expand-cell-selection-down.d.ts +2 -2
  10. package/dist/cell-selection/expand-cell-selection-down.js +1 -1
  11. package/dist/cell-selection/expand-cell-selection-end.d.ts +2 -2
  12. package/dist/cell-selection/expand-cell-selection-end.js +1 -1
  13. package/dist/cell-selection/expand-cell-selection-start.d.ts +2 -2
  14. package/dist/cell-selection/expand-cell-selection-start.js +1 -1
  15. package/dist/cell-selection/expand-cell-selection-up.d.ts +2 -2
  16. package/dist/cell-selection/expand-cell-selection-up.js +1 -1
  17. package/dist/cell-selection/full-width-start-end-index.d.ts +1 -1
  18. package/dist/cell-selection/get-root-cell.d.ts +1 -1
  19. package/dist/cell-selection/get-root-cell.js +2 -2
  20. package/dist/cell-selection/is-bottom-rect.d.ts +1 -1
  21. package/dist/cell-selection/is-center-col-rect.d.ts +1 -1
  22. package/dist/cell-selection/is-center-rect.d.ts +1 -1
  23. package/dist/cell-selection/is-end-rect.d.ts +1 -1
  24. package/dist/cell-selection/is-overlapping-rect.d.ts +1 -1
  25. package/dist/cell-selection/is-start-rect.d.ts +1 -1
  26. package/dist/cell-selection/is-top-rect.d.ts +1 -1
  27. package/dist/cell-selection/is-within-selection-rect.d.ts +1 -1
  28. package/dist/cell-selection/split-cell-selection-rect.d.ts +1 -1
  29. package/dist/cell-selection/update-additive-cell-selection.d.ts +2 -2
  30. package/dist/cell-selection/update-additive-cell-selection.js +4 -6
  31. package/dist/cell-selection/use-edge-scroll.d.ts +2 -2
  32. package/dist/cells/cell.js +3 -2
  33. package/dist/column-manager/branch.js +19 -3
  34. package/dist/column-manager/label.d.ts +1 -1
  35. package/dist/column-manager/label.js +2 -2
  36. package/dist/column-manager/leaf.js +21 -3
  37. package/dist/column-manager/move-handle.d.ts +1 -1
  38. package/dist/column-manager/move-handle.js +2 -2
  39. package/dist/column-manager/root.js +1 -1
  40. package/dist/column-manager/use-column-manager.d.ts +7 -3
  41. package/dist/column-manager/use-column-manager.js +3 -3
  42. package/dist/column-manager/use-columns-from-context.d.ts +2 -2
  43. package/dist/column-manager/use-columns-from-context.js +1 -1
  44. package/dist/column-manager/visibility-checkbox.d.ts +1 -1
  45. package/dist/column-manager/visibility-checkbox.js +2 -2
  46. package/dist/filter-tree/filter-tree.d.ts +7 -7
  47. package/dist/filter-tree/filter-tree.js +8 -8
  48. package/dist/filter-tree/hooks/use-tree-item.d.ts +2 -2
  49. package/dist/filter-tree/hooks/use-tree-item.js +2 -2
  50. package/dist/filter-tree/inclusion-checkbox.d.ts +1 -1
  51. package/dist/filter-tree/inclusion-checkbox.js +2 -2
  52. package/dist/filter-tree/label.d.ts +1 -1
  53. package/dist/filter-tree/label.js +2 -2
  54. package/dist/filter-tree/root.d.ts +3 -3
  55. package/dist/filter-tree/root.js +3 -3
  56. package/dist/grid-box/+types.d.ts +5 -3
  57. package/dist/grid-box/context.d.ts +1 -1
  58. package/dist/grid-box/item.d.ts +4 -1
  59. package/dist/grid-box/item.js +39 -9
  60. package/dist/grid-box/use-aggregation-box-items.d.ts +2 -2
  61. package/dist/grid-box/use-aggregation-box-items.js +3 -1
  62. package/dist/grid-box/use-column-box-items.d.ts +8 -4
  63. package/dist/grid-box/use-column-box-items.js +11 -14
  64. package/dist/grid-box/use-row-group-box-items.d.ts +4 -4
  65. package/dist/grid-box/use-row-group-box-items.js +14 -15
  66. package/dist/grid-provider/context.d.ts +2 -2
  67. package/dist/grid-provider/provider.d.ts +2 -2
  68. package/dist/grid-provider/provider.js +1 -1
  69. package/dist/grid-provider/use-grid.d.ts +2 -2
  70. package/dist/grid-provider/use-grid.js +1 -1
  71. package/dist/grid.d.ts +1 -12
  72. package/dist/grid.js +2 -12
  73. package/dist/header/header-cell.d.ts +1 -1
  74. package/dist/header/header-cell.js +2 -2
  75. package/dist/header/resize-handler.d.ts +2 -2
  76. package/dist/header/resize-handler.js +8 -3
  77. package/dist/header/use-drag-move.d.ts +2 -2
  78. package/dist/header/use-drag-move.js +9 -2
  79. package/dist/header/use-header-cell-renderer.js +3 -3
  80. package/dist/icons/index.d.ts +1 -0
  81. package/dist/icons/index.js +1 -0
  82. package/dist/index.d.ts +5 -0
  83. package/dist/index.js +5 -0
  84. package/dist/listbox/item.js +1 -1
  85. package/dist/row-data-source-client/built-ins/built-ins.d.ts +1 -1
  86. package/dist/row-data-source-client/built-ins/built-ins.js +1 -1
  87. package/dist/row-data-source-client/filter/compute-filtered-rows.js +1 -1
  88. package/dist/row-data-source-client/pivots/create-pivot-columns.js +2 -2
  89. package/dist/row-data-source-client/tree/evaluator-aggregation.d.ts +1 -1
  90. package/dist/row-data-source-client/tree/evaluator-group.d.ts +1 -1
  91. package/dist/row-data-source-client/tree/traverse.d.ts +1 -1
  92. package/dist/row-data-source-client/tree/traverse.js +1 -1
  93. package/dist/row-data-source-client/use-client-data-source-paginated.d.ts +2 -2
  94. package/dist/row-data-source-client/use-client-data-source-paginated.js +54 -25
  95. package/dist/row-data-source-client/use-client-data-source.d.ts +2 -2
  96. package/dist/row-data-source-client/use-client-data-source.js +56 -27
  97. package/dist/row-data-source-client/use-client-tree-data-source.d.ts +1 -1
  98. package/dist/row-data-source-client/use-client-tree-data-source.js +54 -25
  99. package/dist/row-data-source-server/async-tree/apply-delete-action-to-tree.js +1 -1
  100. package/dist/row-data-source-server/async-tree/make-async-tree.js +3 -3
  101. package/dist/row-data-source-server/use-server-data-source.d.ts +1 -1
  102. package/dist/row-data-source-server/use-server-data-source.js +8 -5
  103. package/dist/sort-manager/context.d.ts +3 -3
  104. package/dist/sort-manager/hooks/use-sort-manager.d.ts +2 -2
  105. package/dist/sort-manager/hooks/use-sort-manager.js +2 -2
  106. package/dist/sort-manager/hooks/use-sort-row-item.d.ts +1 -1
  107. package/dist/sort-manager/hooks/use-sort-row-item.js +1 -1
  108. package/dist/sort-manager/sort-add.d.ts +1 -1
  109. package/dist/sort-manager/sort-add.js +3 -3
  110. package/dist/sort-manager/sort-apply.d.ts +1 -1
  111. package/dist/sort-manager/sort-apply.js +3 -3
  112. package/dist/sort-manager/sort-cancel.d.ts +1 -1
  113. package/dist/sort-manager/sort-cancel.js +3 -3
  114. package/dist/sort-manager/sort-clear.d.ts +1 -1
  115. package/dist/sort-manager/sort-clear.js +3 -3
  116. package/dist/sort-manager/sort-column-select.d.ts +1 -1
  117. package/dist/sort-manager/sort-column-select.js +2 -2
  118. package/dist/sort-manager/sort-direction-select.d.ts +1 -1
  119. package/dist/sort-manager/sort-direction-select.js +2 -2
  120. package/dist/sort-manager/sort-remove.d.ts +1 -1
  121. package/dist/sort-manager/sort-remove.js +3 -3
  122. package/dist/sort-manager/sort-value-select.d.ts +1 -1
  123. package/dist/sort-manager/sort-value-select.js +2 -2
  124. package/dist/sort-manager/utils/sort-item-to-sort-model.d.ts +1 -1
  125. package/dist/sort-manager/utils/sort-model-to-sort-items.d.ts +1 -1
  126. package/dist/state/+types.d.ts +2 -1
  127. package/dist/state/api/column-autosize.d.ts +1 -1
  128. package/dist/state/api/column-autosize.js +2 -2
  129. package/dist/state/api/column-move.js +1 -1
  130. package/dist/state/api/column-update.d.ts +4 -1
  131. package/dist/state/api/column-update.js +13 -0
  132. package/dist/state/api/dialog-frame.d.ts +1 -1
  133. package/dist/state/api/edit-begin.d.ts +1 -1
  134. package/dist/state/api/edit-begin.js +1 -1
  135. package/dist/state/api/edit-end.d.ts +1 -1
  136. package/dist/state/api/edit-is-cell-active.d.ts +1 -1
  137. package/dist/state/api/edit-update.d.ts +1 -1
  138. package/dist/state/api/edit-update.js +1 -1
  139. package/dist/state/api/export-csv.js +1 -1
  140. package/dist/state/api/export-data-rect.js +1 -1
  141. package/dist/state/api/focus-cell.d.ts +1 -1
  142. package/dist/state/api/popover-frame.d.ts +2 -2
  143. package/dist/state/api/row-detail-rendered-height.d.ts +2 -2
  144. package/dist/state/helpers/column-add-row-group.d.ts +2 -1
  145. package/dist/state/helpers/column-add-row-group.js +9 -1
  146. package/dist/state/helpers/column-marker.js +1 -1
  147. package/dist/state/helpers/empty-row-data-source.js +1 -0
  148. package/dist/state/helpers/resolve-column.d.ts +1 -1
  149. package/dist/state/helpers/resolve-column.js +7 -0
  150. package/dist/state/use-lytenyte.js +5 -0
  151. package/dist/tree-view/leaf.js +1 -0
  152. package/package.json +12 -6
package/dist/+types.d.ts CHANGED
@@ -892,7 +892,8 @@ export interface HeaderGroupCellLayout {
892
892
  */
893
893
  readonly isCollapsible: boolean;
894
894
  /**
895
- * A unique identifier that can be used for rendering keys or tracking elements.
895
+ * The id for the header group. Note this is not unique across all header groups. In particular
896
+ * split header groups with the same path will share the same id. Prefer `idOccurrence` for unique keys.
896
897
  */
897
898
  readonly id: string;
898
899
  /**
@@ -1232,7 +1233,7 @@ export interface ColumnBase<T> {
1232
1233
  /**
1233
1234
  * Function used to render a floating row cell. Only called when floating rows are enabled. Must return a React node.
1234
1235
  */
1235
- readonly floatingRenderer?: HeaderFloatingCellRenderer<T>;
1236
+ readonly floatingCellRenderer?: HeaderFloatingCellRenderer<T>;
1236
1237
  /**
1237
1238
  * Defines how to render the cell content. Accepts a renderer function or a string referencing a registered renderer.
1238
1239
  */
@@ -1287,7 +1288,7 @@ export interface ColumnMarker<T> {
1287
1288
  /**
1288
1289
  * Function used to render a floating row cell. Only called when floating rows are enabled. Must return a React node.
1289
1290
  */
1290
- readonly floatingRenderer?: HeaderFloatingCellRenderer<T>;
1291
+ readonly floatingCellRenderer?: HeaderFloatingCellRenderer<T>;
1291
1292
  /**
1292
1293
  * Specifies the preferred width of the column. This value is ignored if flex sizing is used, or if it violates the column's min/max bounds.
1293
1294
  */
@@ -1441,7 +1442,7 @@ export interface Column<T> {
1441
1442
  /**
1442
1443
  * Function used to render a floating row cell. Only called when floating rows are enabled. Must return a React node.
1443
1444
  */
1444
- readonly floatingRenderer?: HeaderFloatingCellRenderer<T>;
1445
+ readonly floatingCellRenderer?: HeaderFloatingCellRenderer<T>;
1445
1446
  /**
1446
1447
  * Defines how to render the cell content. Accepts a renderer function or a string referencing a registered renderer.
1447
1448
  */
@@ -1532,7 +1533,7 @@ export interface RowGroupColumn<T> {
1532
1533
  /**
1533
1534
  * Function used to render a floating row cell. Only called when floating rows are enabled. Must return a React node.
1534
1535
  */
1535
- readonly floatingRenderer?: HeaderFloatingCellRenderer<T>;
1536
+ readonly floatingCellRenderer?: HeaderFloatingCellRenderer<T>;
1536
1537
  /**
1537
1538
  * Describes the capabilities and intended UI behavior of the column. These hints are used by external UI components.
1538
1539
  */
@@ -1704,12 +1705,12 @@ export interface ClientRowDataSourceParams<T> {
1704
1705
  */
1705
1706
  readonly rowIdLeaf?: (d: RowLeaf<T>, i: number) => string;
1706
1707
  /**
1707
- * Callback that transforms a column in-filter item before it's applied.
1708
+ * Callback that transforms a set of values for a given column into the in filter items LyteNyte Grid should use.
1708
1709
  */
1709
1710
  readonly transformInFilterItem?: (params: {
1710
- field: unknown;
1711
1711
  column: Column<T>;
1712
- }) => FilterInFilterItem;
1712
+ values: unknown[];
1713
+ }) => FilterInFilterItem[];
1713
1714
  }
1714
1715
  /**
1715
1716
  * Parameters for initializing a tree-structured data source in LyteNyte Grid.
@@ -1740,12 +1741,12 @@ export interface ClientTreeDataSourceParams<T> {
1740
1741
  */
1741
1742
  readonly rowIdLeaf?: (d: RowLeaf<T>, i: number) => string;
1742
1743
  /**
1743
- * Callback that transforms a column in-filter item before it's applied.
1744
+ * Callback that transforms a set of values for a given column into the in filter items LyteNyte Grid should use.
1744
1745
  */
1745
1746
  readonly transformInFilterItem?: (params: {
1746
- field: unknown;
1747
1747
  column: Column<T>;
1748
- }) => FilterInFilterItem;
1748
+ values: unknown[];
1749
+ }) => FilterInFilterItem[];
1749
1750
  /**
1750
1751
  * Returns the hierarchical path to group a given data row in tree mode.
1751
1752
  */
@@ -1806,6 +1807,10 @@ export interface RowDataSourceClientPaginated<T> {
1806
1807
  * Adds new rows to the grid optionally at a specific index, beginning, or end.
1807
1808
  */
1808
1809
  readonly rowAdd: (newRows: any[], atIndex?: number | "beginning" | "end") => void;
1810
+ /**
1811
+ * Sets the data for the center rows (scrollable rows) of the grid. Effectively replacing the current row data.
1812
+ */
1813
+ readonly rowSetCenterData: (newRows: any[]) => void;
1809
1814
  /**
1810
1815
  * Sets the data for rows pinned to the top section.
1811
1816
  */
@@ -1823,6 +1828,10 @@ export interface RowDataSourceClientPaginated<T> {
1823
1828
  * May return items synchronously or as a Promise.
1824
1829
  */
1825
1830
  readonly inFilterItems: (column: Column<T>) => Promise<FilterInFilterItem[]> | FilterInFilterItem[];
1831
+ /**
1832
+ * A client data source method to retrieve the raw data passed to the data source.
1833
+ */
1834
+ readonly rowData: (section: RowSection) => T[];
1826
1835
  }
1827
1836
  /**
1828
1837
  * Represents pagination-related state for the client row data source in
@@ -1899,6 +1908,10 @@ export interface RowDataSourceClient<T> {
1899
1908
  * Adds new rows to the grid optionally at a specific index, beginning, or end.
1900
1909
  */
1901
1910
  readonly rowAdd: (newRows: any[], atIndex?: number | "beginning" | "end") => void;
1911
+ /**
1912
+ * Sets the data for the center rows (scrollable rows) of the grid. Effectively replacing the current row data.
1913
+ */
1914
+ readonly rowSetCenterData: (newRows: any[]) => void;
1902
1915
  /**
1903
1916
  * Sets the data for rows pinned to the top section.
1904
1917
  */
@@ -1912,6 +1925,10 @@ export interface RowDataSourceClient<T> {
1912
1925
  * May return items synchronously or as a Promise.
1913
1926
  */
1914
1927
  readonly inFilterItems: (column: Column<T>) => Promise<FilterInFilterItem[]> | FilterInFilterItem[];
1928
+ /**
1929
+ * A client data source method to retrieve the raw data passed to the data source.
1930
+ */
1931
+ readonly rowData: (section: RowSection) => T[];
1915
1932
  }
1916
1933
  /**
1917
1934
  * The row data source interface used by LyteNyte Grid to retrieve and manage row data.
@@ -1966,6 +1983,10 @@ export interface RowDataSource<T> {
1966
1983
  * Adds new rows to the grid optionally at a specific index, beginning, or end.
1967
1984
  */
1968
1985
  readonly rowAdd: (newRows: any[], atIndex?: number | "beginning" | "end") => void;
1986
+ /**
1987
+ * Sets the data for the center rows (scrollable rows) of the grid. Effectively replacing the current row data.
1988
+ */
1989
+ readonly rowSetCenterData: (newRows: any[]) => void;
1969
1990
  /**
1970
1991
  * Sets the data for rows pinned to the top section.
1971
1992
  */
@@ -2039,6 +2060,10 @@ export interface RowDataSourceServer<T> {
2039
2060
  * Adds new rows to the grid optionally at a specific index, beginning, or end.
2040
2061
  */
2041
2062
  readonly rowAdd: (newRows: any[], atIndex?: number | "beginning" | "end") => void;
2063
+ /**
2064
+ * Sets the data for the center rows (scrollable rows) of the grid. Effectively replacing the current row data.
2065
+ */
2066
+ readonly rowSetCenterData: (newRows: any[]) => void;
2042
2067
  /**
2043
2068
  * Sets the data for rows pinned to the top section.
2044
2069
  */
@@ -2573,6 +2598,10 @@ export interface CellRendererParams<T> {
2573
2598
  * Indicates whether the row is in an indeterminate selection state.
2574
2599
  */
2575
2600
  readonly rowIndeterminate: boolean;
2601
+ /**
2602
+ * The pinning state of a row, used to fix it to the top or bottom of the grid.
2603
+ */
2604
+ readonly rowPin: RowPin;
2576
2605
  }
2577
2606
  /**
2578
2607
  * The parameters the `columnAutosize` method accepts.
@@ -1,2 +1,2 @@
1
- import type { DataRect, Grid } from "../+types";
1
+ import type { DataRect, Grid } from "../+types.js";
2
2
  export declare function adjustRectForRowAndCellSpan<T>(grid: Grid<T>, rect: DataRect): DataRect;
@@ -1,4 +1,4 @@
1
- import { getRootCell } from "./get-root-cell";
1
+ import { getRootCell } from "./get-root-cell.js";
2
2
  export function adjustRectForRowAndCellSpan(grid, rect) {
3
3
  let { rowStart, rowEnd, columnStart, columnEnd } = rect;
4
4
  // Check the top row of the rect.
@@ -1,2 +1,2 @@
1
- import type { DataRect } from "../+types";
1
+ import type { DataRect } from "../+types.js";
2
2
  export declare function areRectsEqual(left: DataRect, right: DataRect): boolean;
@@ -1,2 +1,2 @@
1
- import type { DataRect, Grid } from "../+types";
1
+ import type { DataRect, Grid } from "../+types.js";
2
2
  export declare function boundSelectionRect(grid: Grid<any>, rect: DataRect): DataRect;
@@ -2,7 +2,7 @@ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useEffect } from "react";
3
3
  import { useGridRoot } from "../context";
4
4
  import { useEdgeScroll } from "./use-edge-scroll";
5
- import { getClientX, getClientY, getRelativeXPosition, getRelativeYPosition, } from "@1771technologies/lytenyte-js-utils";
5
+ import { equal, getClientX, getClientY, getRelativeXPosition, getRelativeYPosition, } from "@1771technologies/lytenyte-js-utils";
6
6
  import { getNearestFocusable, getPositionFromFocusable } from "@1771technologies/lytenyte-shared";
7
7
  import { isHTMLElement } from "@1771technologies/lytenyte-dom-utils";
8
8
  import { updateAdditiveCellSelection } from "./update-additive-cell-selection";
@@ -238,8 +238,16 @@ export function CellSelectionDriver() {
238
238
  };
239
239
  }, [cancelX, cancelY, edgeScrollX, edgeScrollY, grid, mode, viewport]);
240
240
  useEffect(() => {
241
+ let prev = null;
241
242
  return grid.internal.focusActive.watch(() => {
242
243
  const focus = grid.internal.focusActive.get();
244
+ // If the focus is null, then we should just return. This keeps the existing selection
245
+ // in place - for things like copy and paste.
246
+ if (!focus)
247
+ return;
248
+ if (equal(prev, focus))
249
+ return;
250
+ prev = focus;
243
251
  if (focus?.kind !== "cell" && focus?.kind !== "full-width") {
244
252
  grid.state.cellSelections.set([]);
245
253
  grid.internal.cellSelectionPivot.set(null);
@@ -1,2 +1,2 @@
1
- import type { DataRect } from "../+types";
1
+ import type { DataRect } from "../+types.js";
2
2
  export declare function deselectRectRange(rect: DataRect, deselectRect: DataRect): DataRect[];
@@ -1,4 +1,4 @@
1
- import { isOverlappingRect } from "./is-overlapping-rect";
1
+ import { isOverlappingRect } from "./is-overlapping-rect.js";
2
2
  export function deselectRectRange(rect, deselectRect) {
3
3
  if (!isOverlappingRect(rect, deselectRect))
4
4
  return [rect];
@@ -1,5 +1,5 @@
1
- import type { Grid } from "../+types";
2
- import type { InternalAtoms } from "../state/+types";
1
+ import type { Grid } from "../+types.js";
2
+ import type { InternalAtoms } from "../state/+types.js";
3
3
  export declare function expandCellSelectionDown(grid: Grid<any> & {
4
4
  internal: InternalAtoms;
5
5
  }, meta: boolean): void;
@@ -1,4 +1,4 @@
1
- import { getRootCell } from "./get-root-cell";
1
+ import { getRootCell } from "./get-root-cell.js";
2
2
  export function expandCellSelectionDown(grid, meta) {
3
3
  const cellSelections = grid.state.cellSelections.get();
4
4
  const rect = cellSelections.at(-1);
@@ -1,5 +1,5 @@
1
- import type { Grid } from "../+types";
2
- import type { InternalAtoms } from "../state/+types";
1
+ import type { Grid } from "../+types.js";
2
+ import type { InternalAtoms } from "../state/+types.js";
3
3
  export declare function expandCellSelectionEnd(grid: Grid<any> & {
4
4
  internal: InternalAtoms;
5
5
  }, meta: boolean): void;
@@ -1,4 +1,4 @@
1
- import { getRootCell } from "./get-root-cell";
1
+ import { getRootCell } from "./get-root-cell.js";
2
2
  export function expandCellSelectionEnd(grid, meta) {
3
3
  const selections = grid.state.cellSelections.get();
4
4
  const cellSelectionPivot = grid.internal.cellSelectionPivot.get();
@@ -1,5 +1,5 @@
1
- import type { InternalAtoms } from "../state/+types";
2
- import type { Grid } from "../+types";
1
+ import type { InternalAtoms } from "../state/+types.js";
2
+ import type { Grid } from "../+types.js";
3
3
  export declare function expandCellSelectionStart(grid: Grid<any> & {
4
4
  internal: InternalAtoms;
5
5
  }, meta: boolean): void;
@@ -1,4 +1,4 @@
1
- import { getRootCell } from "./get-root-cell";
1
+ import { getRootCell } from "./get-root-cell.js";
2
2
  export function expandCellSelectionStart(grid, meta) {
3
3
  const selections = grid.state.cellSelections.get();
4
4
  const cellSelectionPivot = grid.internal.cellSelectionPivot.get();
@@ -1,5 +1,5 @@
1
- import type { InternalAtoms } from "../state/+types";
2
- import type { Grid } from "../+types";
1
+ import type { InternalAtoms } from "../state/+types.js";
2
+ import type { Grid } from "../+types.js";
3
3
  export declare function expandCellSelectionUp(grid: Grid<any> & {
4
4
  internal: InternalAtoms;
5
5
  }, meta: boolean): void;
@@ -1,4 +1,4 @@
1
- import { getRootCell } from "./get-root-cell";
1
+ import { getRootCell } from "./get-root-cell.js";
2
2
  export function expandCellSelectionUp(grid, meta) {
3
3
  const selections = grid.state.cellSelections.get();
4
4
  const cellSelectionPivot = grid.internal.cellSelectionPivot.get();
@@ -1,2 +1,2 @@
1
- import type { Grid } from "../+types";
1
+ import type { Grid } from "../+types.js";
2
2
  export declare function fullWidthStartEndIndex(grid: Grid<any>): number[];
@@ -1,2 +1,2 @@
1
- import type { Grid, PositionGridCell } from "../+types";
1
+ import type { Grid, PositionGridCell } from "../+types.js";
2
2
  export declare const getRootCell: (grid: Grid<any>, rowIndex: number, columnIndex: number) => PositionGridCell["root"];
@@ -1,5 +1,5 @@
1
- import { getSpanFn } from "../state/helpers/get-span-callback";
2
- import { getFullWidthCallback } from "../state/helpers/get-full-width-callback";
1
+ import { getSpanFn } from "../state/helpers/get-span-callback.js";
2
+ import { getFullWidthCallback } from "../state/helpers/get-full-width-callback.js";
3
3
  import { applyLayoutUpdate } from "@1771technologies/lytenyte-shared";
4
4
  export const getRootCell = (grid, rowIndex, columnIndex) => {
5
5
  const rds = grid.state.rowDataSource.get();
@@ -1,2 +1,2 @@
1
- import type { DataRect, Grid } from "../+types";
1
+ import type { DataRect, Grid } from "../+types.js";
2
2
  export declare function isBottomRect(grid: Grid<any>, rect: DataRect): boolean;
@@ -1,4 +1,4 @@
1
- import type { Grid } from "../+types";
1
+ import type { Grid } from "../+types.js";
2
2
  export declare function isCenterColRect(grid: Grid<any>, rect: {
3
3
  columnStart: number;
4
4
  columnEnd: number;
@@ -1,2 +1,2 @@
1
- import type { DataRect, Grid } from "../+types";
1
+ import type { DataRect, Grid } from "../+types.js";
2
2
  export declare function isCenterRect(grid: Grid<any>, rect: DataRect): boolean;
@@ -1,4 +1,4 @@
1
- import type { Grid } from "../+types";
1
+ import type { Grid } from "../+types.js";
2
2
  export declare function isEndRect(grid: Grid<any>, rect: {
3
3
  columnStart: number;
4
4
  columnEnd: number;
@@ -1,2 +1,2 @@
1
- import type { DataRect } from "../+types";
1
+ import type { DataRect } from "../+types.js";
2
2
  export declare function isOverlappingRect(rect1: DataRect, rect2: DataRect): boolean;
@@ -1,4 +1,4 @@
1
- import type { Grid } from "../+types";
1
+ import type { Grid } from "../+types.js";
2
2
  export declare function isStartRect(grid: Grid<any>, rect: {
3
3
  columnStart: number;
4
4
  columnEnd: number;
@@ -1,2 +1,2 @@
1
- import type { DataRect, Grid } from "../+types";
1
+ import type { DataRect, Grid } from "../+types.js";
2
2
  export declare function isTopRect(grid: Grid<any>, rect: DataRect): boolean;
@@ -1,2 +1,2 @@
1
- import type { DataRect } from "../+types";
1
+ import type { DataRect } from "../+types.js";
2
2
  export declare function isWithinSelectionRect(rect: DataRect, r: number, c: number): boolean;
@@ -1,4 +1,4 @@
1
- import type { DataRect } from "../+types";
1
+ import type { DataRect } from "../+types.js";
2
2
  interface SplitCellSelectionRectArgs {
3
3
  readonly rect: DataRect;
4
4
  readonly colStartCount: number;
@@ -1,5 +1,5 @@
1
- import type { DataRect, Grid } from "../+types";
2
- import type { InternalAtoms } from "../state/+types";
1
+ import type { DataRect, Grid } from "../+types.js";
2
+ import type { InternalAtoms } from "../state/+types.js";
3
3
  export declare function updateAdditiveCellSelection(grid: Grid<any> & {
4
4
  internal: InternalAtoms;
5
5
  }, rect: DataRect): void;
@@ -1,13 +1,12 @@
1
- import { boundSelectionRect } from "./bound-selection-rect";
2
- import { adjustRectForRowAndCellSpan } from "./adjust-rect-for-row-and-cell-span";
3
- import { areRectsEqual } from "./are-rects-equal";
4
- import { splitCellSelectionRect } from "./split-cell-selection-rect";
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
5
  export function updateAdditiveCellSelection(grid, rect) {
6
6
  const s = grid.state.columnMeta.get();
7
7
  const ds = grid.state.rowDataStore;
8
8
  const rowTopCount = ds.rowTopCount.get();
9
9
  const adjustedRect = adjustRectForRowAndCellSpan(grid, rect);
10
- console.log(adjustedRect);
11
10
  const rects = splitCellSelectionRect({
12
11
  rect: boundSelectionRect(grid, adjustedRect),
13
12
  colCenterCount: s.columnVisibleCenterCount,
@@ -15,7 +14,6 @@ export function updateAdditiveCellSelection(grid, rect) {
15
14
  rowCenterCount: ds.rowCenterCount.get(),
16
15
  rowTopCount: rowTopCount,
17
16
  });
18
- console.log(rects);
19
17
  const current = grid.internal.cellSelectionAdditiveRects.get();
20
18
  if (current && current.length === rects.length) {
21
19
  if (current.every((c, i) => areRectsEqual(c, rects[i])))
@@ -1,5 +1,5 @@
1
- import type { Grid } from "../+types";
2
- import type { InternalAtoms } from "../state/+types";
1
+ import type { Grid } from "../+types.js";
2
+ import type { InternalAtoms } from "../state/+types.js";
3
3
  export declare function useEdgeScroll(grid: Grid<any> & {
4
4
  internal: InternalAtoms;
5
5
  }): {
@@ -10,9 +10,10 @@ const CellImpl = forwardRef(function Cell({ cell, children, ...props }, forwarde
10
10
  const grid = useGridRoot().grid;
11
11
  const cx = grid.state;
12
12
  grid.internal.refreshKey.useValue();
13
+ const base = grid.state.columnBase.useValue();
13
14
  const row = cell.row.useValue();
14
15
  const renderers = cx.cellRenderers.useValue();
15
- const providedRenderer = children ?? cell.column.cellRenderer;
16
+ const providedRenderer = children ?? cell.column.cellRenderer ?? base.cellRenderer;
16
17
  const Renderer = providedRenderer
17
18
  ? typeof providedRenderer === "string"
18
19
  ? (renderers[providedRenderer] ?? CellDefault)
@@ -32,6 +33,6 @@ const CellImpl = forwardRef(function Cell({ cell, children, ...props }, forwarde
32
33
  const rowMeta = useRowMeta();
33
34
  if (!row)
34
35
  return null;
35
- return (_jsxs(CellReact, { ...props, ref: forwarded, cell: cell, isEditing: isEditing, viewportWidth: cx.viewportWidthInner.useValue(), detailHeight: grid.api.rowDetailRenderedHeight(row ?? ""), rtl: cx.rtl.useValue(), xPosition: cx.xPositions.useValue(), yPosition: cx.yPositions.useValue(), children: [isEditing && _jsx(CellEditor, { cell: cell }), !isEditing && (_jsx(_Fragment, { children: typeof Renderer === "function" ? (_jsx(Renderer, { column: cell.column, rowSelected: rowMeta.selected, rowIndeterminate: rowMeta.indeterminate, row: row, grid: grid, rowIndex: cell.rowIndex, colIndex: cell.colIndex })) : (Renderer) }))] }));
36
+ return (_jsxs(CellReact, { ...props, ref: forwarded, cell: cell, isEditing: isEditing, viewportWidth: cx.viewportWidthInner.useValue(), detailHeight: grid.api.rowDetailRenderedHeight(row ?? ""), rtl: cx.rtl.useValue(), xPosition: cx.xPositions.useValue(), yPosition: cx.yPositions.useValue(), children: [isEditing && _jsx(CellEditor, { cell: cell }), !isEditing && (_jsx(_Fragment, { children: typeof Renderer === "function" ? (_jsx(Renderer, { column: cell.column, rowSelected: rowMeta.selected, rowIndeterminate: rowMeta.indeterminate, row: row, grid: grid, rowIndex: cell.rowIndex, colIndex: cell.colIndex, rowPin: cell.rowPin })) : (Renderer) }))] }));
36
37
  });
37
38
  export const Cell = fastDeepMemo(CellImpl);
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { forwardRef, useMemo } from "react";
2
+ import { forwardRef, useCallback, useMemo } from "react";
3
3
  import { TreeBranch } from "../tree-view/branch/branch";
4
4
  import { ColumnItemContext } from "./context";
5
5
  import { dragState, DropWrap } from "@1771technologies/lytenyte-dragon";
@@ -9,8 +9,23 @@ export const Branch = forwardRef(function Branch({ item, label, ...props }, forw
9
9
  const grid = useGrid();
10
10
  const id = grid.state.gridId.useValue();
11
11
  const accepted = `${id}/columns`;
12
+ const base = grid.state.columnBase.useValue();
12
13
  const columns = useColumnsFromContext(item);
13
- return (_jsx(ColumnItemContext, { value: useMemo(() => ({ item }), [item]), children: _jsx(TreeBranch, { ...props, itemId: item.branch.data.idOccurrence, ref: forwarded, ...item.attrs, labelWrap: _jsx(DropWrap, { "data-ln-column-manager-branch": true, "data-ln-column-id": item.branch.data.idOccurrence, accepted: [accepted], onEnter: (el) => {
14
+ const isVisible = useMemo(() => {
15
+ const allVisible = columns.every((c) => !(c.hide ?? base.hide));
16
+ return allVisible;
17
+ }, [base.hide, columns]);
18
+ const toggle = useCallback((s) => {
19
+ const next = s ?? isVisible;
20
+ grid.api.columnUpdate(Object.fromEntries(columns.map((c) => [c.id, { hide: next }])));
21
+ }, [columns, grid.api, isVisible]);
22
+ return (_jsx(ColumnItemContext, { value: useMemo(() => ({ item }), [item]), children: _jsx(TreeBranch, { ...props, itemId: item.branch.data.idOccurrence, ref: forwarded, ...item.attrs, onKeyDown: (ev) => {
23
+ props.onKeyDown?.(ev);
24
+ if (ev.key === " ") {
25
+ toggle();
26
+ ev.preventDefault();
27
+ }
28
+ }, labelWrap: _jsx(DropWrap, { "data-ln-column-manager-branch": true, "data-ln-column-id": item.branch.data.idOccurrence, accepted: [accepted], onEnter: (el) => {
14
29
  const data = dragState.data
15
30
  .get()
16
31
  ?.siteLocalData?.[accepted]?.at(-1);
@@ -25,7 +40,8 @@ export const Branch = forwardRef(function Branch({ item, label, ...props }, forw
25
40
  return;
26
41
  const thisIndex = allColumns.findIndex((c) => c.id === columns[0].id);
27
42
  const isBefore = thisIndex > moveIndex;
28
- if (isBefore) {
43
+ // Flipped since our source is the one moving
44
+ if (!isBefore) {
29
45
  el.setAttribute("data-ln-is-before", "true");
30
46
  }
31
47
  else {
@@ -1,5 +1,5 @@
1
1
  import { type SlotComponent } from "@1771technologies/lytenyte-react-hooks";
2
2
  export interface LabelProps {
3
- readonly slot?: SlotComponent;
3
+ readonly as?: SlotComponent;
4
4
  }
5
5
  export declare const Label: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & LabelProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useSlot } from "@1771technologies/lytenyte-react-hooks";
3
3
  import { useColumnItemContext } from "./context";
4
4
  import { forwardRef, useMemo } from "react";
5
- export const Label = forwardRef(function Label({ slot, ...props }, forwarded) {
5
+ export const Label = forwardRef(function Label({ as, ...props }, forwarded) {
6
6
  const { item } = useColumnItemContext();
7
7
  const label = useMemo(() => {
8
8
  if (item.kind == "branch")
@@ -12,7 +12,7 @@ export const Label = forwardRef(function Label({ slot, ...props }, forwarded) {
12
12
  const rendered = useSlot({
13
13
  props: [{ children: label }, props],
14
14
  ref: forwarded,
15
- slot: slot ?? _jsx("div", {}),
15
+ slot: as ?? _jsx("div", {}),
16
16
  });
17
17
  return rendered;
18
18
  });
@@ -1,9 +1,10 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { forwardRef, useMemo } from "react";
2
+ import { forwardRef, useCallback, useMemo } from "react";
3
3
  import { ColumnItemContext } from "./context";
4
4
  import { TreeLeaf } from "../tree-view/leaf";
5
5
  import { dragState, DropWrap } from "@1771technologies/lytenyte-dragon";
6
6
  import { useGrid } from "../grid-provider/use-grid";
7
+ import { useColumnsFromContext } from "./use-columns-from-context";
7
8
  export const Leaf = forwardRef(function ColumnManagerLeaf({ item, ...props }, forwarded) {
8
9
  const context = useMemo(() => {
9
10
  return { item: item };
@@ -11,6 +12,16 @@ export const Leaf = forwardRef(function ColumnManagerLeaf({ item, ...props }, fo
11
12
  const grid = useGrid();
12
13
  const id = grid.state.gridId.useValue();
13
14
  const accepted = `${id}/columns`;
15
+ const base = grid.state.columnBase.useValue();
16
+ const columns = useColumnsFromContext(item);
17
+ const isVisible = useMemo(() => {
18
+ const allVisible = columns.every((c) => !(c.hide ?? base.hide));
19
+ return allVisible;
20
+ }, [base.hide, columns]);
21
+ const toggle = useCallback((s) => {
22
+ const next = s ?? isVisible;
23
+ grid.api.columnUpdate(Object.fromEntries(columns.map((c) => [c.id, { hide: next }])));
24
+ }, [columns, grid.api, isVisible]);
14
25
  return (_jsx(ColumnItemContext.Provider, { value: context, children: _jsx(DropWrap, { accepted: [accepted], onEnter: (el) => {
15
26
  const data = dragState.data
16
27
  .get()
@@ -27,7 +38,8 @@ export const Leaf = forwardRef(function ColumnManagerLeaf({ item, ...props }, fo
27
38
  return;
28
39
  const thisIndex = allColumns.findIndex((c) => c.id === columns[0].id);
29
40
  const isBefore = thisIndex > moveIndex;
30
- if (isBefore) {
41
+ // Flipped since our source is the one moving
42
+ if (!isBefore) {
31
43
  el.setAttribute("data-ln-is-before", "true");
32
44
  }
33
45
  else {
@@ -36,5 +48,11 @@ export const Leaf = forwardRef(function ColumnManagerLeaf({ item, ...props }, fo
36
48
  }, onLeave: (el) => {
37
49
  el.removeAttribute("data-ln-is-before");
38
50
  el.removeAttribute("data-ln-is-after");
39
- }, as: _jsx(TreeLeaf, { ...props, itemId: item.leaf.data.id, ref: forwarded, ...item.attrs, style: { ...props.style, ...item.attrs.style }, "data-ln-column-manager-leaf": true, "data-ln-column-id": item.leaf.data.id }) }) }));
51
+ }, as: _jsx(TreeLeaf, { ...props, itemId: item.leaf.data.id, ref: forwarded, ...item.attrs, style: { ...props.style, ...item.attrs.style }, onKeyDown: (ev) => {
52
+ props.onKeyDown?.(ev);
53
+ if (ev.key === " ") {
54
+ toggle();
55
+ ev.preventDefault();
56
+ }
57
+ }, "data-ln-column-manager-leaf": true, "data-ln-column-id": item.leaf.data.id }) }) }));
40
58
  });
@@ -3,7 +3,7 @@ import { type ReactNode } from "react";
3
3
  import type { Column } from "../+types";
4
4
  import type { TreeVirtualItem } from "../tree-view/virtualized/make-virtual-tree";
5
5
  export interface MoveHandleProps {
6
- readonly slot?: SlotComponent;
6
+ readonly as?: SlotComponent;
7
7
  readonly placeholder?: (p: {
8
8
  columns: Column<any>[];
9
9
  item: TreeVirtualItem<Column<any>>;
@@ -5,7 +5,7 @@ import { forwardRef, useMemo } from "react";
5
5
  import { useColumnItemContext } from "./context";
6
6
  import { useColumnsFromContext } from "./use-columns-from-context";
7
7
  import { useGrid } from "../grid-provider/use-grid";
8
- export const MoveHandle = forwardRef(function MoveHandle({ slot, placeholder: Placeholder, ...props }, forwarded) {
8
+ export const MoveHandle = forwardRef(function MoveHandle({ as, placeholder: Placeholder, ...props }, forwarded) {
9
9
  const item = useColumnItemContext().item;
10
10
  const grid = useGrid();
11
11
  const columns = useColumnsFromContext(item);
@@ -52,7 +52,7 @@ export const MoveHandle = forwardRef(function MoveHandle({ slot, placeholder: Pl
52
52
  const renderer = useSlot({
53
53
  props: [{ "aria-label": "Drag to move column" }, additionalProps, props],
54
54
  ref: isMovable ? combined : forwarded,
55
- slot: slot ?? _jsx("div", {}),
55
+ slot: as ?? _jsx("div", {}),
56
56
  });
57
57
  return renderer;
58
58
  });
@@ -16,5 +16,5 @@ export function Root({ grid, children, treeRef, root, ...rootProps }) {
16
16
  }
17
17
  return lookup;
18
18
  }, [root.children]);
19
- return (_jsx(branchLookupContext.Provider, { value: branchLookup, children: _jsx(GridProvider, { value: grid, children: _jsx(TreeRoot, { selectMode: "multiple", transitionEnter: 200, transitionExit: 200, expansionDefault: true, ref: treeRef, ...rootProps, children: children }) }) }));
19
+ return (_jsx(branchLookupContext.Provider, { value: branchLookup, children: _jsx(GridProvider, { value: grid, children: _jsx(TreeRoot, { selectMode: "none", transitionEnter: 200, transitionExit: 200, expansionDefault: true, ref: treeRef, ...rootProps, children: children }) }) }));
20
20
  }
@@ -1,6 +1,6 @@
1
1
  import { type Dispatch, type JSX, type SetStateAction } from "react";
2
- import type { Column, Grid } from "../+types";
3
- import type { TreeVirtualItem } from "../tree-view/virtualized/make-virtual-tree";
2
+ import type { Column, Grid } from "../+types.js";
3
+ import type { TreeVirtualItem } from "../tree-view/virtualized/make-virtual-tree.js";
4
4
  import type { PathRoot } from "@1771technologies/lytenyte-shared";
5
5
  export interface UseColumnManagerReturn<T> {
6
6
  readonly rootProps: {
@@ -16,4 +16,8 @@ export interface UseColumnManagerReturn<T> {
16
16
  readonly tree: TreeVirtualItem<Column<T>>[];
17
17
  readonly spacer: JSX.Element;
18
18
  }
19
- export declare function useColumnManager<T>(grid: Grid<T>): UseColumnManagerReturn<T>;
19
+ export interface UseColumnManagerArgs<T> {
20
+ readonly grid: Grid<T>;
21
+ readonly itemHeight?: number;
22
+ }
23
+ export declare function useColumnManager<T>({ grid, itemHeight, }: UseColumnManagerArgs<T>): UseColumnManagerReturn<T>;
@@ -1,12 +1,12 @@
1
1
  import { useState } from "react";
2
- import { useVirtualizedTree } from "../tree-view/virtualized/use-virtualized-tree";
3
- export function useColumnManager(grid) {
2
+ import { useVirtualizedTree } from "../tree-view/virtualized/use-virtualized-tree.js";
3
+ export function useColumnManager({ grid, itemHeight = 24, }) {
4
4
  const [expansions, onExpansionChange] = useState({});
5
5
  const columns = grid.state.columns.useValue();
6
6
  const virt = useVirtualizedTree({
7
7
  paths: columns,
8
8
  expansions,
9
- itemHeight: 24,
9
+ itemHeight,
10
10
  expansionDefault: true,
11
11
  nonAdjacentPathTrees: true,
12
12
  });
@@ -1,3 +1,3 @@
1
- import type { TreeVirtualItem } from "../tree-view/virtualized/make-virtual-tree";
2
- import type { Column } from "../+types";
1
+ import type { TreeVirtualItem } from "../tree-view/virtualized/make-virtual-tree.js";
2
+ import type { Column } from "../+types.js";
3
3
  export declare function useColumnsFromContext(item: TreeVirtualItem<Column<any>>): Column<any>[];