@bigcapitalhq/blueprintjs-react-table 0.1.0 → 0.3.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 (49) hide show
  1. package/README.md +245 -7
  2. package/dist/blueprintjs-react-table.cjs +6 -0
  3. package/dist/blueprintjs-react-table.cjs.map +1 -0
  4. package/dist/blueprintjs-react-table.js +2533 -0
  5. package/dist/blueprintjs-react-table.js.map +1 -0
  6. package/dist/styles.css +1 -0
  7. package/dist/types/components/BP_Table.d.ts +119 -6
  8. package/dist/types/components/body/TableBody.d.ts +18 -1
  9. package/dist/types/components/body/TableBodyCell.d.ts +6 -3
  10. package/dist/types/components/body/TableGhostCells.d.ts +18 -4
  11. package/dist/types/components/body/TableRowHeaderCell.d.ts +9 -3
  12. package/dist/types/components/body/TableRowHeaders.d.ts +16 -1
  13. package/dist/types/components/body/TableRowSelectionCell.d.ts +18 -0
  14. package/dist/types/components/common/cell-selection.d.ts +57 -0
  15. package/dist/types/components/common/cellCoordinates.d.ts +25 -4
  16. package/dist/types/components/common/classes.d.ts +8 -0
  17. package/dist/types/components/common/dimensions.d.ts +5 -0
  18. package/dist/types/components/common/menu-context.d.ts +81 -0
  19. package/dist/types/components/common/pinning.d.ts +44 -0
  20. package/dist/types/components/common/region.d.ts +26 -0
  21. package/dist/types/components/common/table-selection-context.d.ts +3 -3
  22. package/dist/types/components/container/TableContainer.d.ts +8 -2
  23. package/dist/types/components/head/TableColumnHeaders.d.ts +4 -1
  24. package/dist/types/components/head/TableHead.d.ts +3 -1
  25. package/dist/types/components/head/TableRowSelectionHeaderCell.d.ts +13 -0
  26. package/dist/types/components/layers/TableRegionLayer.d.ts +10 -2
  27. package/dist/types/components/layers/TableReorderGuides.d.ts +10 -1
  28. package/dist/types/components/layers/TableResizeGuides.d.ts +18 -5
  29. package/dist/types/components/pagination/TablePaginationBar.d.ts +30 -0
  30. package/dist/types/components/pagination/constants.d.ts +4 -0
  31. package/dist/types/components/pagination/withPagination.d.ts +51 -0
  32. package/dist/types/components/quadrant/TableQuadrant.d.ts +41 -10
  33. package/dist/types/components/quadrant/TableQuadrantStack.d.ts +38 -0
  34. package/dist/types/components/quadrant/quadrant-type.d.ts +10 -0
  35. package/dist/types/hooks/use-bp-table-instance.d.ts +31 -0
  36. package/dist/types/hooks/use-cell-selection.d.ts +62 -0
  37. package/dist/types/hooks/use-column-header-height.d.ts +24 -0
  38. package/dist/types/hooks/use-column-reorder.d.ts +7 -3
  39. package/dist/types/hooks/use-freeze-pinning.d.ts +25 -0
  40. package/dist/types/hooks/use-row-virtualizer.d.ts +13 -2
  41. package/dist/types/hooks/use-uncontrolled.d.ts +19 -0
  42. package/dist/types/index.d.ts +8 -0
  43. package/dist/types/types.d.ts +12 -1
  44. package/package.json +2 -2
  45. package/dist/types/components/body/TableStaticBody.d.ts +0 -10
  46. package/dist/types/components/body/VirtualBody.d.ts +0 -12
  47. package/dist/types/components/quadrant/TableBottomContainer.d.ts +0 -14
  48. package/dist/types/components/quadrant/TableTopContainer.d.ts +0 -11
  49. package/dist/types/hooks/use-cell-focus-selection.d.ts +0 -34
@@ -1,5 +1,5 @@
1
1
  import { type HTMLProps, type MutableRefObject } from 'react';
2
- import { ColumnVisibilityState, RowData, TableFeatures, TableOptions, TableState, ReactTable, type CellData } from '@tanstack/react-table';
2
+ import { ColumnPinningState, ColumnVisibilityState, RowData, RowPinningState, RowSelectionState, TableFeatures, TableOptions, TableState, ReactTable, type CellData } from '@tanstack/react-table';
3
3
  declare module '@tanstack/react-table' {
4
4
  /**
5
5
  * Extra metadata supported on column definitions, applied by `BP_Table` when
@@ -31,6 +31,11 @@ export type Xor<A, B> = Prettify<{
31
31
  } & B> | Prettify<{
32
32
  [k in keyof B]?: never;
33
33
  } & A>;
34
+ /**
35
+ * Standard HTML attributes accepted for the table's outer container element:
36
+ * React's `HTMLProps`, minus a handful of attributes reserved by the table API,
37
+ * plus a `ref` to the container element.
38
+ */
34
39
  export type HTMLPropsRef<T extends HTMLElement> = {
35
40
  ref?: MutableRefObject<null | T> | null;
36
41
  } & Omit<HTMLProps<T>, 'color' | 'data' | 'label' | 'ref' | 'size' | 'style' | 'type'>;
@@ -62,4 +67,10 @@ export type BP_TableFeatures = TableFeatures;
62
67
  export type BP_TableState = TableState<BP_TableFeatures>;
63
68
  /** Maps column ids to their visibility (`true` = visible, `false` = hidden). */
64
69
  export type BP_VisibilityState = ColumnVisibilityState;
70
+ /** Maps frozen ("start") and right-pinned ("end") column ids. */
71
+ export type BP_ColumnPinningState = ColumnPinningState;
72
+ /** Maps frozen ("top") and bottom-pinned ("bottom") row ids. */
73
+ export type BP_RowPinningState = RowPinningState;
74
+ /** Maps row ids to their selection (`true` = selected), driven by the row-selection checkboxes. */
75
+ export type BP_RowSelectionState = RowSelectionState;
65
76
  export type BP_TableInstance<TData extends BP_RowData = BP_RowData> = ReactTable<BP_TableFeatures, TData>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigcapitalhq/blueprintjs-react-table",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "description": "A Blueprint.js-styled data table for React, built on TanStack Table v9 with row virtualization, quadrant layout, and Blueprint-style focus & selection.",
5
5
  "type": "module",
6
6
  "main": "./dist/blueprintjs-react-table.cjs",
@@ -37,7 +37,7 @@
37
37
  ],
38
38
  "repository": {
39
39
  "type": "git",
40
- "url": "git+https://github.com/bigcapitalhq/blueprintjs-react-table.git"
40
+ "url": "git+https://github.com/bigcapitalhq/blueprintjs-tanstack-table.git"
41
41
  },
42
42
  "scripts": {
43
43
  "dev": "vite",
@@ -1,10 +0,0 @@
1
- import type { BP_GhostCells } from '../../hooks/use-ghost-cells.js';
2
- import type { RowResizingApi } from '../../hooks/use-row-resizing.js';
3
- import type { BP_RowData, BP_TableInstance, HTMLPropsRef } from '../../types.js';
4
- export type TableStaticBodyProps<TData extends BP_RowData> = HTMLPropsRef<HTMLDivElement> & {
5
- table: BP_TableInstance<TData>;
6
- areCellsLoading: boolean;
7
- rowResizing: RowResizingApi;
8
- ghosts?: BP_GhostCells;
9
- };
10
- export declare function TableStaticBody<TData extends BP_RowData>({ table, areCellsLoading, rowResizing, ghosts, className, ...restProps }: TableStaticBodyProps<TData>): import("react").JSX.Element;
@@ -1,12 +0,0 @@
1
- import type { BP_GhostCells } from '../../hooks/use-ghost-cells.js';
2
- import type { BP_RowVirtualizer } from '../../hooks/use-row-virtualizer.js';
3
- import type { RowResizingApi } from '../../hooks/use-row-resizing.js';
4
- import type { BP_RowData, BP_TableInstance, HTMLPropsRef } from '../../types.js';
5
- export type VirtualBodyProps<TData extends BP_RowData> = HTMLPropsRef<HTMLDivElement> & {
6
- table: BP_TableInstance<TData>;
7
- areCellsLoading: boolean;
8
- rowVirtualizer: BP_RowVirtualizer;
9
- rowResizing: RowResizingApi;
10
- ghosts?: BP_GhostCells;
11
- };
12
- export declare function VirtualBody<TData extends BP_RowData>({ table, areCellsLoading, rowVirtualizer, rowResizing, ghosts, className, ...restProps }: VirtualBodyProps<TData>): import("react").JSX.Element;
@@ -1,14 +0,0 @@
1
- import type { BP_GhostCells } from '../../hooks/use-ghost-cells.js';
2
- import type { BP_RowVirtualizer } from '../../hooks/use-row-virtualizer.js';
3
- import type { RowResizingApi } from '../../hooks/use-row-resizing.js';
4
- import type { BP_RowData, BP_TableInstance, HTMLPropsRef } from '../../types.js';
5
- export type TableBottomContainerProps<TData extends BP_RowData> = HTMLPropsRef<HTMLDivElement> & {
6
- table: BP_TableInstance<TData>;
7
- rowHeaderWidth: number;
8
- areCellsLoading: boolean;
9
- areRowHeadersLoading: boolean;
10
- rowVirtualizer?: BP_RowVirtualizer;
11
- rowResizing: RowResizingApi;
12
- ghosts?: BP_GhostCells;
13
- };
14
- export declare function TableBottomContainer<TData extends BP_RowData>({ table, rowHeaderWidth, areCellsLoading, areRowHeadersLoading, rowVirtualizer, rowResizing, ghosts, className, ...restProps }: TableBottomContainerProps<TData>): import("react").JSX.Element;
@@ -1,11 +0,0 @@
1
- import type { BP_GhostCells } from '../../hooks/use-ghost-cells.js';
2
- import type { BP_RowData, BP_TableInstance, HTMLPropsRef } from '../../types.js';
3
- export type TableTopContainerProps<TData extends BP_RowData> = HTMLPropsRef<HTMLDivElement> & {
4
- table: BP_TableInstance<TData>;
5
- rowHeaderWidth: number;
6
- columnHeaderHeight: number;
7
- enableSorting?: boolean;
8
- areColumnHeadersLoading: boolean;
9
- ghosts?: BP_GhostCells;
10
- };
11
- export declare function TableTopContainer<TData extends BP_RowData>({ table, rowHeaderWidth, columnHeaderHeight, enableSorting, areColumnHeadersLoading, ghosts, className, ...restProps }: TableTopContainerProps<TData>): import("react").JSX.Element;
@@ -1,34 +0,0 @@
1
- import { type KeyboardEvent as ReactKeyboardEvent, type MouseEvent as ReactMouseEvent, type MutableRefObject, type PointerEvent as ReactPointerEvent } from 'react';
2
- import type { BP_RowData, BP_TableInstance } from '../types.js';
3
- import { RegionCardinality, type FocusedCellCoordinates, type FocusedRegion, type Region, type StyledRegionGroup } from '../components/common/region.js';
4
- export type CellFocusSelectionOptions<TData extends BP_RowData> = {
5
- table: BP_TableInstance<TData>;
6
- /** Resolved absolute top offset of the row at the given index. */
7
- getRowTop: (index: number) => number;
8
- /** Resolved height of the row at the given index. */
9
- getRowHeight: (index: number) => number;
10
- scrollContainerRef: MutableRefObject<HTMLDivElement | null>;
11
- enableFocusedCell?: boolean;
12
- focusedCell?: FocusedCellCoordinates | undefined;
13
- onFocusedCell?: (cell: FocusedCellCoordinates) => void;
14
- onFocusedRegion?: (region: FocusedRegion) => void;
15
- selectedRegions?: Region[] | undefined;
16
- onSelection?: (regions: Region[]) => void;
17
- enableMultipleSelection?: boolean;
18
- selectionModes?: RegionCardinality[];
19
- };
20
- export type CellFocusSelectionApi = {
21
- focusedRegion: FocusedRegion | undefined;
22
- selectedRegions: Region[];
23
- regionGroups: StyledRegionGroup[];
24
- isSelectionModeEnabled: (cardinality: RegionCardinality) => boolean;
25
- handleKeyDown: (event: ReactKeyboardEvent<HTMLDivElement>) => void;
26
- handleBodyPointerDown: (event: ReactPointerEvent<HTMLDivElement>) => void;
27
- handleBodyPointerMove: (event: ReactPointerEvent<HTMLDivElement>) => void;
28
- handleBodyPointerUp: () => void;
29
- handleBodyPointerCancel: () => void;
30
- handleColumnHeaderMouseDown: (index: number, event: ReactMouseEvent) => void;
31
- handleRowHeaderMouseDown: (index: number, event: ReactMouseEvent) => void;
32
- handleMenuMouseDown: (event: ReactMouseEvent) => void;
33
- };
34
- export declare function useCellFocusSelection<TData extends BP_RowData>({ table, getRowTop, getRowHeight, scrollContainerRef, enableFocusedCell, focusedCell, onFocusedCell, onFocusedRegion, selectedRegions: controlledSelectedRegions, onSelection, selectionModes, }: CellFocusSelectionOptions<TData>): CellFocusSelectionApi;