@vuu-ui/vuu-table 0.13.3 → 0.13.4

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 (64) hide show
  1. package/package.json +13 -16
  2. package/types/CellFocusState.d.ts +0 -26
  3. package/types/Row.d.ts +0 -5
  4. package/types/Table.d.ts +0 -196
  5. package/types/VirtualColSpan.d.ts +0 -3
  6. package/types/bulk-edit/BulkEditDialog.d.ts +0 -9
  7. package/types/bulk-edit/BulkEditPanel.d.ts +0 -12
  8. package/types/bulk-edit/BulkEditRow.d.ts +0 -11
  9. package/types/bulk-edit/index.d.ts +0 -4
  10. package/types/bulk-edit/useBulkEditPanel.d.ts +0 -10
  11. package/types/bulk-edit/useBulkEditRow.d.ts +0 -20
  12. package/types/cell-block/CellBlock.d.ts +0 -6
  13. package/types/cell-block/cellblock-utils.d.ts +0 -37
  14. package/types/cell-block/useCellBlockSelection.d.ts +0 -14
  15. package/types/cell-renderers/checkbox-cell/CheckboxCell.d.ts +0 -2
  16. package/types/cell-renderers/checkbox-cell/index.d.ts +0 -1
  17. package/types/cell-renderers/checkbox-row-selector/CheckboxRowSelectorCell.d.ts +0 -2
  18. package/types/cell-renderers/checkbox-row-selector/index.d.ts +0 -1
  19. package/types/cell-renderers/index.d.ts +0 -4
  20. package/types/cell-renderers/input-cell/InputCell.d.ts +0 -2
  21. package/types/cell-renderers/input-cell/index.d.ts +0 -1
  22. package/types/cell-renderers/toggle-cell/ToggleCell.d.ts +0 -2
  23. package/types/cell-renderers/toggle-cell/index.d.ts +0 -1
  24. package/types/column-header-pill/ColumnHeaderPill.d.ts +0 -8
  25. package/types/column-header-pill/GroupColumnPill.d.ts +0 -6
  26. package/types/column-header-pill/SortIndicator.d.ts +0 -5
  27. package/types/column-header-pill/index.d.ts +0 -3
  28. package/types/column-resizing/ColumnResizer.d.ts +0 -6
  29. package/types/column-resizing/index.d.ts +0 -2
  30. package/types/column-resizing/useTableColumnResize.d.ts +0 -15
  31. package/types/header-cell/GroupHeaderCell.d.ts +0 -7
  32. package/types/header-cell/HeaderCell.d.ts +0 -2
  33. package/types/header-cell/index.d.ts +0 -2
  34. package/types/index.d.ts +0 -18
  35. package/types/pagination/PaginationControl.d.ts +0 -6
  36. package/types/pagination/index.d.ts +0 -1
  37. package/types/pagination/usePagination.d.ts +0 -9
  38. package/types/table-cell/TableCell.d.ts +0 -2
  39. package/types/table-cell/TableGroupCell.d.ts +0 -2
  40. package/types/table-cell/index.d.ts +0 -2
  41. package/types/table-config.d.ts +0 -26
  42. package/types/table-dom-utils.d.ts +0 -23
  43. package/types/table-header/HeaderProvider.d.ts +0 -6
  44. package/types/table-header/TableHeader.d.ts +0 -21
  45. package/types/table-header/index.d.ts +0 -2
  46. package/types/table-header/useTableHeader.d.ts +0 -17
  47. package/types/useCell.d.ts +0 -5
  48. package/types/useCellEditing.d.ts +0 -10
  49. package/types/useCellFocus.d.ts +0 -17
  50. package/types/useControlledTableNavigation.d.ts +0 -8
  51. package/types/useDataSource.d.ts +0 -15
  52. package/types/useEditableCell.d.ts +0 -4
  53. package/types/useHighlighting.d.ts +0 -2
  54. package/types/useInitialValue.d.ts +0 -1
  55. package/types/useKeyboardNavigation.d.ts +0 -41
  56. package/types/useMeasuredHeight.d.ts +0 -10
  57. package/types/useResizeObserver.d.ts +0 -15
  58. package/types/useRowClassNameGenerators.d.ts +0 -3
  59. package/types/useSelection.d.ts +0 -14
  60. package/types/useTable.d.ts +0 -83
  61. package/types/useTableContextMenu.d.ts +0 -23
  62. package/types/useTableModel.d.ts +0 -85
  63. package/types/useTableScroll.d.ts +0 -69
  64. package/types/useTableViewport.d.ts +0 -42
package/package.json CHANGED
@@ -1,22 +1,22 @@
1
1
  {
2
- "version": "0.13.3",
2
+ "version": "0.13.4",
3
3
  "author": "heswell",
4
4
  "license": "Apache-2.0",
5
5
  "devDependencies": {
6
- "@vuu-ui/vuu-data-types": "0.13.3",
7
- "@vuu-ui/vuu-table-types": "0.13.3",
8
- "@vuu-ui/vuu-protocol-types": "0.13.3"
6
+ "@vuu-ui/vuu-data-types": "0.13.4",
7
+ "@vuu-ui/vuu-table-types": "0.13.4",
8
+ "@vuu-ui/vuu-protocol-types": "0.13.4"
9
9
  },
10
10
  "dependencies": {
11
11
  "@salt-ds/core": "1.43.0",
12
12
  "@salt-ds/styles": "0.2.1",
13
13
  "@salt-ds/window": "0.1.1",
14
- "@vuu-ui/vuu-context-menu": "0.13.3",
15
- "@vuu-ui/vuu-data-react": "0.13.3",
16
- "@vuu-ui/vuu-popups": "0.13.3",
17
- "@vuu-ui/vuu-table-extras": "0.13.3",
18
- "@vuu-ui/vuu-ui-controls": "0.13.3",
19
- "@vuu-ui/vuu-utils": "0.13.3"
14
+ "@vuu-ui/vuu-context-menu": "0.13.4",
15
+ "@vuu-ui/vuu-data-react": "0.13.4",
16
+ "@vuu-ui/vuu-popups": "0.13.4",
17
+ "@vuu-ui/vuu-table-extras": "0.13.4",
18
+ "@vuu-ui/vuu-ui-controls": "0.13.4",
19
+ "@vuu-ui/vuu-utils": "0.13.4"
20
20
  },
21
21
  "peerDependencies": {
22
22
  "clsx": "^2.0.0",
@@ -26,19 +26,16 @@
26
26
  "files": [
27
27
  "README.md",
28
28
  "esm",
29
- "cjs",
30
- "/types"
29
+ "cjs"
31
30
  ],
32
31
  "exports": {
33
32
  ".": {
34
33
  "require": "./cjs/index.js",
35
- "import": "./esm/index.js",
36
- "types": "./types/index.d.ts"
34
+ "import": "./esm/index.js"
37
35
  }
38
36
  },
39
37
  "main": "cjs/index.js",
40
38
  "module": "esm/index.js",
41
39
  "name": "@vuu-ui/vuu-table",
42
- "type": "module",
43
- "types": "types/index.d.ts"
40
+ "type": "module"
44
41
  }
@@ -1,26 +0,0 @@
1
- import { CellPos } from "@vuu-ui/vuu-table-types";
2
- /**
3
- * Used to track the Table cell (if any) with focus.
4
- */
5
- export interface ICellFocusState {
6
- el: HTMLElement | null;
7
- outsideViewport: "above" | "below" | false;
8
- placeholderEl: HTMLDivElement | null;
9
- pos: {
10
- top: number;
11
- } | undefined;
12
- cellPos: CellPos | undefined;
13
- }
14
- export declare class CellFocusState implements ICellFocusState {
15
- #private;
16
- outsideViewport: "above" | "below" | false;
17
- placeholderEl: HTMLDivElement | null;
18
- pos: {
19
- top: number;
20
- } | undefined;
21
- set cell(cell: HTMLDivElement);
22
- get cellPos(): CellPos | undefined;
23
- set cellPos(cellPos: CellPos | undefined);
24
- get el(): HTMLElement | null;
25
- set el(el: HTMLElement | null);
26
- }
package/types/Row.d.ts DELETED
@@ -1,5 +0,0 @@
1
- import { RowProps } from "@vuu-ui/vuu-table-types";
2
- export declare const RowProxy: import("react").ForwardRefExoticComponent<{
3
- height?: number;
4
- } & import("react").RefAttributes<HTMLDivElement>>;
5
- export declare const Row: import("react").MemoExoticComponent<({ className: classNameProp, classNameGenerator, columnMap, columns, groupToggleTarget, highlighted, row, offset, onCellEdit, onClick, onDataEdited, onToggleGroup, searchPattern, showBookends, virtualColSpan, zebraStripes, ...htmlAttributes }: RowProps) => import("react/jsx-runtime").JSX.Element>;
package/types/Table.d.ts DELETED
@@ -1,196 +0,0 @@
1
- import { DataSource, SchemaColumn, Selection, SelectionChangeHandler } from "@vuu-ui/vuu-data-types";
2
- import { CustomHeader, DataCellEditNotification, GroupToggleTarget, RowProps, ShowColumnHeaderMenus, TableConfig, TableConfigChangeHandler, TableRowClickHandler, TableRowSelectHandler, TableSelectionModel } from "@vuu-ui/vuu-table-types";
3
- import type { DragDropState } from "@vuu-ui/vuu-ui-controls";
4
- import { DragStartHandler, MeasuredContainerProps, dragStrategy } from "@vuu-ui/vuu-ui-controls";
5
- import { RowToObjectMapper } from "@vuu-ui/vuu-utils";
6
- import { ComponentType, FC, ForwardedRef } from "react";
7
- import { TableCellBlock } from "./cell-block/cellblock-utils";
8
- import { ScrollingAPI } from "./useTableScroll";
9
- export type TableNavigationStyle = "none" | "cell" | "row" | "tree";
10
- export interface TableProps extends Omit<MeasuredContainerProps, "onDragStart" | "onDrop" | "onSelect" | "searchPattern"> {
11
- /**
12
- * A react function componnet that will be rendered if there are no rows to display
13
- */
14
- EmptyDisplay?: ComponentType;
15
- Row?: FC<RowProps>;
16
- /**
17
- * Allow a block of cells to be selected. Typically to be copied.
18
- */
19
- allowCellBlockSelection?: boolean;
20
- allowConfigEditing?: boolean;
21
- /**
22
- * Allow column headers to be dragged to re-arrange
23
- */
24
- allowDragColumnHeader?: boolean;
25
- /**
26
- * Allow rows to be draggable
27
- */
28
- allowDragDrop?: boolean | dragStrategy;
29
- /**
30
- * required if a fully featured column picker is to be available
31
- */
32
- availableColumns?: SchemaColumn[];
33
- /**
34
- * Provide configuration settings for Table. At minimun, column
35
- * descriptors must be provided.
36
- */
37
- config: TableConfig;
38
- dataSource: DataSource;
39
- /**
40
- * define rows ro be initially selected based on row index positions
41
- */
42
- defaultSelectedIndexValues?: Selection;
43
- /**
44
- * define rows ro be initially selected based on row key value. Not all DataSource
45
- * implementations support this feature.
46
- */
47
- defaultSelectedKeyValues?: string[];
48
- disableFocus?: boolean;
49
- /**
50
- * Allows additional custom element(s) to be embedded immediately below column headers.
51
- * Could be used to present inline filters for example.
52
- * Accepts either a React Element or a Function Component or an array of these. If a React
53
- * Function Component is used, it will be passed the props described in BaseRowProps.
54
- */
55
- customHeader?: CustomHeader | CustomHeader[];
56
- /**
57
- * When rows are grouped, user can click group row(s) to expand/collapse display of child rows.
58
- * This allows precise configuration of where user may click to trigger toggle/collapse. When
59
- * row selection is also supported, clicking outside the region specified here will select or
60
- * deselect the row.
61
- * - toggle-icon - the small toggle icon must be clicked directly
62
- * - group-column (default) - user can click anywhere within the group column, i.e on the icon or the column text
63
- */
64
- groupToggleTarget?: GroupToggleTarget;
65
- /**
66
- * Defined how focus navigation within data cells will be handled by table.
67
- * Default is cell.
68
- */
69
- highlightedIndex?: number;
70
- /**
71
- * Behaves in most respects like viewportRowLimit except that, when there are fewer
72
- * rows available than the limit set here, the Table height will reduce. This can be
73
- * useful where a Table is used in a dropdown control.
74
- */
75
- maxViewportRowLimit?: number;
76
- /**
77
- * Determines bahaviour of keyboard navigation , either row focused or cell focused.
78
- * `tree` is a specialised navigation behaviour only useful where table is being
79
- * used to present purely grouped data (see TreeTable)
80
- */
81
- navigationStyle?: TableNavigationStyle;
82
- /**
83
- * required if a fully featured column picker is to be available.
84
- * Available columns can be changed by the addition or removal of
85
- * one or more calculated columns.
86
- */
87
- onAvailableColumnsChange?: (columns: SchemaColumn[]) => void;
88
- /**
89
- * This callback will be invoked any time a config attribute of TableConfig
90
- * is changed. By persisting this value and providing it to the Table as a
91
- * prop, table state can be persisted across sessions.
92
- */
93
- onConfigChange?: TableConfigChangeHandler;
94
- /**
95
- * In a Table with editable cells, this callback will be invoked every time
96
- * a user performs any edit operation on an editable field.
97
- */
98
- onDataEdited?: DataCellEditNotification;
99
- onDragStart?: DragStartHandler;
100
- onDrop?: (dragDropState: DragDropState) => void;
101
- onHighlight?: (idx: number) => void;
102
- /**
103
- * callback invoked when user 'clicks' a table row. CLick triggered either
104
- * via mouse click or keyboard (default ENTER);
105
- */
106
- onRowClick?: TableRowClickHandler;
107
- onSelect?: TableRowSelectHandler;
108
- /**
109
- * Triggered when a block of cells is selected. CellBlock selection can be
110
- * effected with either mouse or keyboard.
111
- * - mouse: hold down mouse and drag over selection area
112
- * - keyboard: press and hold shift key from start cell, then use arrow keys
113
- * to extend selection block.
114
- *
115
- * This callback is invoked when mouse is released or shift key released.
116
- */
117
- onSelectCellBlock?: (cellBlock: TableCellBlock) => void;
118
- onSelectionChange?: SelectionChangeHandler;
119
- renderBufferSize?: number;
120
- /**
121
- * When a row is selected and onSelect provided, onSelect will be invoked with a
122
- * DataSourceRowObject, derived from the internal representation of a data row,
123
- * DataSourceRow. The data attribute of DataSourceRowObject is a simple map of
124
- * column.name : value.
125
- * This prop allows a custom function to be provided to make the conversion from
126
- * DataSourceRow to DataSourceRowObject. It will very rarely be needed. It is
127
- * used by the Treetable.
128
- */
129
- rowToObject?: RowToObjectMapper;
130
- /**
131
- * Only applicable to grouped data. If there are selected rows which are not top-level
132
- * items and group items above are not already expanded, expand all group items in
133
- * the hierarchy above selected item. Selected items will thus always be visible, initially.
134
- * This affects items set at load time via defaultSelectedKeyValues as well as items
135
- * selected programatically (ie not directly by user).
136
- * Nodes can of course be collapsed by user at runtime which may hide selected rows.
137
- * Note: this is not supported by all DataSource implementations
138
- */
139
- revealSelected?: boolean;
140
- /**
141
- * Pixel height of rows. If specified here, this will take precedence over CSS
142
- * values and Table will not respond to density changes.
143
- */
144
- rowHeight?: number;
145
- /**
146
- * imperative API for scrolling table
147
- */
148
- scrollingApiRef?: ForwardedRef<ScrollingAPI>;
149
- /**
150
- * If a search has been applied against data, this is the search text used.
151
- * Will be used to highlight matching text.
152
- */
153
- searchPattern?: string;
154
- /**
155
- * Selection Bookends style the left and right edge of a selection block.
156
- * They are optional, value currently defaults to 4.
157
- * TODO this should just live in CSS
158
- */
159
- selectionBookendWidth?: number;
160
- /**
161
- * Selection behaviour for Table:
162
- * `none` selection disabled
163
- * `single` no more than one row may be selected
164
- * `extended` (default) multiple rows can be selected
165
- * `checkbox` same behaviour as extended, with checkbox column for selection
166
- */
167
- selectionModel?: TableSelectionModel;
168
- /**
169
- * if false, table rendered without headers. Useful when table is being included in a
170
- * composite component.
171
- */
172
- showColumnHeaders?: boolean;
173
- /**
174
- * if false, column headers will not display menu icon. If true, all available Column Menu
175
- * actions will be available via the menu. Alternatively, a map of specific column menu
176
- * permissions can be provided to allow control over which menu items are presented.
177
- */
178
- showColumnHeaderMenus?: ShowColumnHeaderMenus;
179
- /**
180
- * if true, pagination will be used to navigate data, scrollbars will not be rendered
181
- */
182
- showPaginationControls?: boolean;
183
- /**
184
- * As an alternative to sizing the Table height via CSS or via an explicit height value,
185
- * specify the number of rows to be displayed within the Viewport. The actual height
186
- * will then be the product of viewportRowLimit and rowHeight. Row Height will be
187
- * determined in the usual way, it can be specified explicitly in a prop or set via
188
- * CSS. If both explicit height and viewportRowLimit are provided by props, rowHeight
189
- * will be derived from these. Do not pass props for all three values - height,
190
- * rowHeight and viewportRowLimit. That will be rejected.
191
- * Use maxViewportRowLimit rather than viewportRowLimit if the height of the table
192
- * should be reduced when fewer rows are actually available than the limit specified.
193
- */
194
- viewportRowLimit?: number;
195
- }
196
- export declare const Table: import("react").ForwardRefExoticComponent<TableProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -1,3 +0,0 @@
1
- export declare const VirtualColSpan: import("react").NamedExoticComponent<{
2
- width: number;
3
- }>;
@@ -1,9 +0,0 @@
1
- import { DataSource } from "@vuu-ui/vuu-data-types";
2
- import { ColumnDescriptor } from "@vuu-ui/vuu-table-types";
3
- export interface BulkEditDialogProps {
4
- columns?: ColumnDescriptor[];
5
- sessionDs: DataSource;
6
- parentDs: DataSource;
7
- closeDialog: () => void;
8
- }
9
- export declare const BulkEditDialog: ({ columns, sessionDs, parentDs, closeDialog, }: BulkEditDialogProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,12 +0,0 @@
1
- import { DataSource, RpcResponse } from "@vuu-ui/vuu-data-types";
2
- import type { ColumnDescriptor } from "@vuu-ui/vuu-table-types";
3
- import { HTMLAttributes, ReactElement } from "react";
4
- export interface BulkEditPanelProps extends HTMLAttributes<HTMLDivElement> {
5
- columns?: ColumnDescriptor[];
6
- dataSource: DataSource;
7
- response?: RpcResponse;
8
- mainTableName?: string;
9
- parentDs: DataSource;
10
- onValidationStatusChange: (isValid: boolean) => void;
11
- }
12
- export declare const BulkEditPanel: ({ className, columns, dataSource, parentDs, onValidationStatusChange, ...htmlAttributes }: BulkEditPanelProps) => ReactElement;
@@ -1,11 +0,0 @@
1
- import { DataSource } from "@vuu-ui/vuu-data-types";
2
- import { VuuRowDataItemType } from "@vuu-ui/vuu-protocol-types";
3
- import { BaseRowProps, ColumnDescriptor } from "@vuu-ui/vuu-table-types";
4
- import { HTMLAttributes } from "react";
5
- export type EditValueChangeHandler = (column: ColumnDescriptor, value: VuuRowDataItemType) => void;
6
- export interface BulkEditProps extends Partial<BaseRowProps>, Omit<HTMLAttributes<HTMLDivElement>, "onChange"> {
7
- dataSource: DataSource;
8
- onBulkChange: EditValueChangeHandler;
9
- onRowChange: (isValid: boolean) => void;
10
- }
11
- export declare const BulkEditRow: ({ ariaRole, dataSource, onBulkChange, onRowChange, ...htmlAttributes }: BulkEditProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,4 +0,0 @@
1
- export * from "./BulkEditDialog";
2
- export * from "./BulkEditPanel";
3
- export * from "./useBulkEditPanel";
4
- export * from "./useBulkEditRow";
@@ -1,10 +0,0 @@
1
- import { DataCellEditNotification, TableConfig } from "@vuu-ui/vuu-table-types";
2
- import type { BulkEditPanelProps } from "./BulkEditPanel";
3
- import { EditValueChangeHandler } from "./useBulkEditRow";
4
- export type BulkEditPanelHookProps = Pick<BulkEditPanelProps, "columns" | "dataSource" | "onValidationStatusChange">;
5
- export declare const useBulkEditPanel: ({ columns, dataSource, onValidationStatusChange, }: BulkEditPanelHookProps) => {
6
- tableConfig: TableConfig;
7
- onBulkChange: EditValueChangeHandler;
8
- onDataEdited: DataCellEditNotification;
9
- onRowChange: (isValid: boolean) => void;
10
- };
@@ -1,20 +0,0 @@
1
- import { DataValueDescriptor } from "@vuu-ui/vuu-data-types";
2
- import { VuuRowDataItemType } from "@vuu-ui/vuu-protocol-types";
3
- import { ColumnDescriptor } from "@vuu-ui/vuu-table-types";
4
- import { CommitHandler } from "@vuu-ui/vuu-utils";
5
- import { InputProps } from "@salt-ds/core";
6
- import { FocusEventHandler } from "react";
7
- export type EditValueChangeHandler = (column: ColumnDescriptor, value: VuuRowDataItemType) => void;
8
- export interface EditableBulkHookProps {
9
- descriptors: DataValueDescriptor[];
10
- onBulkChange: EditValueChangeHandler;
11
- onRowChange: (isValid: boolean) => void;
12
- }
13
- export declare const useBulkEditRow: ({ descriptors, onBulkChange, onRowChange, }: EditableBulkHookProps) => {
14
- errorMessages: Record<string, string>;
15
- formFieldsContainerRef: import("react").RefObject<HTMLDivElement | null>;
16
- InputProps: Partial<InputProps>;
17
- onCommit: CommitHandler<HTMLElement>;
18
- onFocus: FocusEventHandler;
19
- onKeyDown: import("react").KeyboardEventHandler<HTMLDivElement>;
20
- };
@@ -1,6 +0,0 @@
1
- import { HTMLAttributes } from "react";
2
- export interface CellBlockProps extends Omit<HTMLAttributes<HTMLDivElement>, "onCopy"> {
3
- debugName?: string;
4
- onCopy?: () => void;
5
- }
6
- export declare const CellBlock: import("react").ForwardRefExoticComponent<CellBlockProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -1,37 +0,0 @@
1
- import { VuuRange } from "@vuu-ui/vuu-protocol-types";
2
- export type TableCellBlock = {
3
- columnRange: VuuRange;
4
- rowRange: VuuRange;
5
- };
6
- export type CellBox = {
7
- bottom: number;
8
- left: number;
9
- right: number;
10
- top: number;
11
- };
12
- export declare const isNullCellBox: ({ bottom, left, right, top }: CellBox) => boolean;
13
- type EndCellDirection = "self" | "n" | "ne" | "e" | "se" | "s" | "sw" | "w" | "nw";
14
- export declare const getEndCellDirection: (startBox: CellBox, endBox: CellBox) => EndCellDirection;
15
- export declare const setElementBox: (el: HTMLElement, box: CellBox) => void;
16
- export declare const outsideBox: ({ bottom, left, right, top }: CellBox, x: number, y: number) => boolean;
17
- export declare const getTableCellBlock: (startCell: HTMLDivElement, endCell: HTMLDivElement) => TableCellBlock;
18
- export type RefState = {
19
- dragState: "pending" | "active";
20
- cellBlock: HTMLDivElement | null;
21
- cellBlockClassName: string;
22
- endBox: CellBox;
23
- endCell: HTMLDivElement | null;
24
- endPos: PosTuple;
25
- mousePosX: number;
26
- mousePosY: number;
27
- mouseStartX: number;
28
- mouseStartY: number;
29
- startCell: HTMLDivElement | null;
30
- startBox: CellBox;
31
- startPos: PosTuple;
32
- };
33
- export type PosTuple = [number, number];
34
- export declare const refState: RefState;
35
- export declare const updateCellBlockClassName: (state: RefState) => void;
36
- export declare const getTextFromCells: (startCell: HTMLDivElement, endCell: HTMLDivElement) => string;
37
- export {};
@@ -1,14 +0,0 @@
1
- import { KeyboardEventHandler, MouseEventHandler, ReactElement, RefObject } from "react";
2
- import { TableCellBlock } from "./cellblock-utils";
3
- export interface CellblockSelectionHookProps {
4
- allowCellBlockSelection?: boolean;
5
- columnCount?: number;
6
- containerRef: RefObject<HTMLElement | null>;
7
- onSelectCellBlock?: (cellBlock: TableCellBlock) => void;
8
- rowCount?: number;
9
- }
10
- export declare const useCellBlockSelection: ({ allowCellBlockSelection, columnCount, containerRef, onSelectCellBlock, rowCount, }: CellblockSelectionHookProps) => {
11
- cellBlock: ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | null;
12
- onKeyDown: KeyboardEventHandler | undefined;
13
- onMouseDown: MouseEventHandler | undefined;
14
- };
@@ -1,2 +0,0 @@
1
- import { TableCellRendererProps } from "@vuu-ui/vuu-table-types";
2
- export declare const CheckboxCell: import("react").MemoExoticComponent<({ column, columnMap, onEdit, row }: TableCellRendererProps) => import("react/jsx-runtime").JSX.Element>;
@@ -1 +0,0 @@
1
- export * from "./CheckboxCell";
@@ -1,2 +0,0 @@
1
- import { TableCellRendererProps } from "@vuu-ui/vuu-table-types";
2
- export declare const CheckboxRowSelectorCell: React.FC<TableCellRendererProps>;
@@ -1 +0,0 @@
1
- export * from "./CheckboxRowSelectorCell";
@@ -1,4 +0,0 @@
1
- export * from "./checkbox-cell";
2
- export * from "./checkbox-row-selector";
3
- export * from "./input-cell";
4
- export * from "./toggle-cell";
@@ -1,2 +0,0 @@
1
- import { TableCellRendererProps } from "@vuu-ui/vuu-table-types";
2
- export declare const InputCell: ({ column, columnMap, onEdit, row, }: TableCellRendererProps) => import("react/jsx-runtime").JSX.Element;
@@ -1 +0,0 @@
1
- export * from "./InputCell";
@@ -1,2 +0,0 @@
1
- import { TableCellRendererProps } from "@vuu-ui/vuu-table-types";
2
- export declare const ToggleCell: import("react").NamedExoticComponent<TableCellRendererProps>;
@@ -1 +0,0 @@
1
- export * from "./ToggleCell";
@@ -1,8 +0,0 @@
1
- import { RuntimeColumnDescriptor } from "@vuu-ui/vuu-table-types";
2
- import { HTMLAttributes } from "react";
3
- export interface ColumnHeaderPillProps extends HTMLAttributes<HTMLDivElement> {
4
- column: RuntimeColumnDescriptor;
5
- removable?: boolean;
6
- onRemove?: (column: RuntimeColumnDescriptor) => void;
7
- }
8
- export declare const ColumnHeaderPill: ({ children, className, column, onRemove, removable, ...htmlAttributes }: ColumnHeaderPillProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,6 +0,0 @@
1
- import { RuntimeColumnDescriptor } from "@vuu-ui/vuu-table-types";
2
- import { ColumnHeaderPillProps } from "./ColumnHeaderPill";
3
- export interface GroupColumnPillProps extends ColumnHeaderPillProps {
4
- column: RuntimeColumnDescriptor;
5
- }
6
- export declare const GroupColumnPill: ({ column, ...columnHeaderProps }: GroupColumnPillProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,5 +0,0 @@
1
- import { RuntimeColumnDescriptor } from "@vuu-ui/vuu-table-types";
2
- export interface SortIndicatorProps {
3
- column: RuntimeColumnDescriptor;
4
- }
5
- export declare const SortIndicator: ({ column }: SortIndicatorProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -1,3 +0,0 @@
1
- export * from "./ColumnHeaderPill";
2
- export * from "./GroupColumnPill";
3
- export * from "./SortIndicator";
@@ -1,6 +0,0 @@
1
- export interface TableColumnResizerProps {
2
- onDrag: (evt: MouseEvent, moveBy: number, totalDistanceMoved: number) => void;
3
- onDragEnd: (evt: MouseEvent, totalDistanceMoved: number) => void;
4
- onDragStart: (evt: React.MouseEvent) => void;
5
- }
6
- export declare const ColumnResizer: ({ onDrag, onDragEnd, onDragStart, }: TableColumnResizerProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,2 +0,0 @@
1
- export * from "./ColumnResizer";
2
- export * from "./useTableColumnResize";
@@ -1,15 +0,0 @@
1
- import { Heading, ResizePhase, RuntimeColumnDescriptor } from "@vuu-ui/vuu-table-types";
2
- import { RefObject } from "react";
3
- export type ResizeHandler = (evt: MouseEvent, moveBy: number) => void;
4
- export interface CellResizeHookProps {
5
- column: RuntimeColumnDescriptor | Heading;
6
- onResize?: (phase: ResizePhase, columnName: string, width?: number) => void;
7
- rootRef: RefObject<HTMLDivElement | null>;
8
- }
9
- export interface CellResizeHookResult {
10
- isResizing: boolean;
11
- onDrag: (evt: MouseEvent, moveBy: number, totalDistanceMoved: number) => void;
12
- onDragStart: (evt: React.MouseEvent) => void;
13
- onDragEnd: (evt: MouseEvent) => void;
14
- }
15
- export declare const useTableColumnResize: ({ column, onResize, rootRef, }: CellResizeHookProps) => CellResizeHookResult;
@@ -1,7 +0,0 @@
1
- import { ColumnDescriptor, GroupColumnDescriptor, HeaderCellProps, RuntimeColumnDescriptor } from "@vuu-ui/vuu-table-types";
2
- export interface GroupHeaderCellProps extends Omit<HeaderCellProps, "onDragStart" | "onDrag" | "onDragEnd"> {
3
- column: GroupColumnDescriptor;
4
- onMoveColumn?: (columns: ColumnDescriptor[]) => void;
5
- onRemoveColumn: (column: RuntimeColumnDescriptor) => void;
6
- }
7
- export declare const GroupHeaderCell: ({ column: groupColumn, className: classNameProp, onMoveColumn, onRemoveColumn, onResize, ...htmlAttributes }: GroupHeaderCellProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,2 +0,0 @@
1
- import { HeaderCellProps } from "@vuu-ui/vuu-table-types";
2
- export declare const HeaderCell: ({ className: classNameProp, column, onClick, onResize, showColumnHeaderMenus, ...htmlAttributes }: HeaderCellProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,2 +0,0 @@
1
- export * from "./GroupHeaderCell";
2
- export * from "./HeaderCell";
package/types/index.d.ts DELETED
@@ -1,18 +0,0 @@
1
- export * from "./bulk-edit";
2
- export * from "./cell-renderers";
3
- export * from "./header-cell";
4
- export * from "./header-cell";
5
- export * from "./pagination";
6
- export * from "./Table";
7
- export * from "./table-cell";
8
- export * from "./table-config";
9
- export * from "./table-header";
10
- export * from "./useControlledTableNavigation";
11
- export * from "./useEditableCell";
12
- export * from "./useHighlighting";
13
- export * from "./useKeyboardNavigation";
14
- export * from "./useTableModel";
15
- export * from "./useTableContextMenu";
16
- export * from "./useTableScroll";
17
- export * from "./useTableViewport";
18
- export * from "./VirtualColSpan";
@@ -1,6 +0,0 @@
1
- import { HtmlHTMLAttributes } from "react";
2
- import { DataSource } from "@vuu-ui/vuu-data-types";
3
- export interface PaginationControlProps extends HtmlHTMLAttributes<HTMLDivElement> {
4
- dataSource: DataSource;
5
- }
6
- export declare const PaginationControl: import("react").ForwardRefExoticComponent<PaginationControlProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -1 +0,0 @@
1
- export * from "./PaginationControl";
@@ -1,9 +0,0 @@
1
- import { SyntheticEvent } from "react";
2
- import { DataSource } from "@vuu-ui/vuu-data-types";
3
- export interface PaginationHookProps {
4
- dataSource: DataSource;
5
- }
6
- export declare const usePagination: ({ dataSource }: PaginationHookProps) => {
7
- onPageChange: (_evt: SyntheticEvent, page: number) => void;
8
- pageCount: number;
9
- };
@@ -1,2 +0,0 @@
1
- import type { TableCellProps } from "@vuu-ui/vuu-table-types";
2
- export declare const TableCell: ({ column, columnMap, onClick, onDataEdited, row, searchPattern, }: TableCellProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,2 +0,0 @@
1
- import { TableCellProps } from "@vuu-ui/vuu-table-types";
2
- export declare const TableGroupCell: ({ column, columnMap, onClick, row, searchPattern, }: TableCellProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,2 +0,0 @@
1
- export * from "./TableCell";
2
- export * from "./TableGroupCell";
@@ -1,26 +0,0 @@
1
- import { ColumnDescriptor, RuntimeColumnDescriptor, TableConfig } from "@vuu-ui/vuu-table-types";
2
- export type MoveColumnTableConfigAction = {
3
- type: "col-move";
4
- column: ColumnDescriptor;
5
- fromIndex: number;
6
- toIndex: number;
7
- };
8
- export type ResizeColumnTableConfigAction = {
9
- type: "col-size";
10
- column: ColumnDescriptor;
11
- columns: RuntimeColumnDescriptor[];
12
- width: number;
13
- };
14
- export type SubscribeColumnTableConfigAction = {
15
- type: "subscribed";
16
- column: ColumnDescriptor;
17
- value: boolean;
18
- };
19
- export type UpdateColumnPropertyTableConfigAction = {
20
- type: "column-prop";
21
- column: ColumnDescriptor;
22
- property: keyof ColumnDescriptor;
23
- value: boolean | number | string;
24
- };
25
- export type TableConfigAction = MoveColumnTableConfigAction | ResizeColumnTableConfigAction | UpdateColumnPropertyTableConfigAction;
26
- export declare const updateTableConfig: (config: TableConfig, action: TableConfigAction) => TableConfig;
@@ -1,23 +0,0 @@
1
- import { RefObject } from "react";
2
- import { ScrollDirection } from "./useTableScroll";
3
- import type { ArrowKey, PageKey } from "@vuu-ui/vuu-utils";
4
- import type { CellPos } from "@vuu-ui/vuu-table-types";
5
- export type NavigationKey = PageKey | ArrowKey;
6
- export declare const headerCellQuery: (colIdx: number) => string;
7
- export declare const dataCellQuery: (ariaRowIdx: number, ariaColIdx: number) => string;
8
- export declare const getLevelUp: (containerRef: RefObject<HTMLElement | null>, cellPos: CellPos) => CellPos;
9
- export declare const getTableCell: (containerRef: RefObject<HTMLElement | null>, [rowIdx, colIdx]: CellPos) => HTMLElement;
10
- export declare const getFocusedCell: (el: HTMLElement | Element | null) => HTMLDivElement | null;
11
- export declare const cellIsEditable: (cell: HTMLDivElement | null) => boolean | undefined;
12
- export declare const cellDropdownShowing: (cell: HTMLDivElement | null) => boolean;
13
- export declare const cellIsTextInput: (cell: HTMLElement) => boolean;
14
- export declare const getAriaRowIndex: (rowElement: HTMLElement | null) => number;
15
- export declare const getAriaColIndex: (cellElement: HTMLElement | null) => number;
16
- export declare const getRowElementByAriaIndex: (container: HTMLDivElement | EventTarget, rowIndex: number) => HTMLElement | null;
17
- export declare const getIndexFromCellElement: (cellElement: HTMLElement | null) => number;
18
- export declare const getAriaCellPos: (tableCell: HTMLDivElement) => CellPos;
19
- export declare const closestRowIndex: (el: HTMLElement) => number;
20
- export declare function getNextCellPos(key: ArrowKey, [rowIdx, colIdx]: CellPos, columnCount: number, maxRowIndex: number): CellPos;
21
- export type TreeNodeOperation = "expand" | "collapse" | "level-up";
22
- export declare const getTreeNodeOperation: (containerRef: RefObject<HTMLElement | null>, navigationStyle: "cell" | "tree", cellPos: CellPos, key: NavigationKey, shiftKey: boolean) => TreeNodeOperation | undefined;
23
- export declare const howFarIsRowOutsideViewport: (rowEl: HTMLElement, totalHeaderHeight: number, contentContainer?: Element | null) => readonly [ScrollDirection | undefined, number | undefined];
@@ -1,6 +0,0 @@
1
- import { BaseRowProps } from "@vuu-ui/vuu-table-types";
2
- import { FC, ReactNode } from "react";
3
- export declare const HeaderProvider: FC<BaseRowProps & {
4
- children: ReactNode;
5
- }>;
6
- export declare const useHeaderProps: () => BaseRowProps;
@@ -1,21 +0,0 @@
1
- import { VuuSortType } from "@vuu-ui/vuu-protocol-types";
2
- import { ColumnDescriptor, CustomHeader, RuntimeColumnDescriptor, ShowColumnHeaderMenus, TableColumnResizeHandler, TableConfig, TableHeadings } from "@vuu-ui/vuu-table-types";
3
- export type ColumnSortHandler = (column: ColumnDescriptor, addToExistingSort: boolean, sortType?: VuuSortType) => void;
4
- export interface TableHeaderProps {
5
- allowDragColumnHeader: boolean;
6
- classBase?: string;
7
- columns: RuntimeColumnDescriptor[];
8
- customHeader?: CustomHeader | CustomHeader[];
9
- headings: TableHeadings;
10
- onHeightMeasured: (height: number, count: number) => void;
11
- onResizeColumn: TableColumnResizeHandler;
12
- onMoveColumn: (columns: ColumnDescriptor[]) => void;
13
- onMoveGroupColumn: (columns: ColumnDescriptor[]) => void;
14
- onRemoveGroupColumn: (column: RuntimeColumnDescriptor) => void;
15
- onSortColumn: ColumnSortHandler;
16
- showColumnHeaderMenus?: ShowColumnHeaderMenus;
17
- tableConfig: TableConfig;
18
- tableId: string;
19
- virtualColSpan?: number;
20
- }
21
- export declare const TableHeader: import("react").MemoExoticComponent<({ allowDragColumnHeader, classBase, columns, customHeader, headings, onHeightMeasured, onMoveColumn, onMoveGroupColumn, onRemoveGroupColumn, onResizeColumn, onSortColumn, showColumnHeaderMenus, tableConfig, tableId, virtualColSpan, }: TableHeaderProps) => import("react/jsx-runtime").JSX.Element>;
@@ -1,2 +0,0 @@
1
- export * from "./HeaderProvider";
2
- export * from "./TableHeader";
@@ -1,17 +0,0 @@
1
- import { ColumnDescriptor, TableHeadings } from "@vuu-ui/vuu-table-types";
2
- import { TableHeaderProps } from "./TableHeader";
3
- export interface TableHeaderHookProps extends Pick<TableHeaderProps, "allowDragColumnHeader" | "columns" | "onMoveColumn" | "onSortColumn" | "tableConfig"> {
4
- customHeaderCount: number;
5
- headings: TableHeadings;
6
- label?: string;
7
- onHeightMeasured: (height: number, customHeaderCount: number) => void;
8
- onMoveColumn: (columns: ColumnDescriptor[]) => void;
9
- onSortColumn: (column: ColumnDescriptor, addToExistingSort: boolean) => void;
10
- }
11
- export declare const useTableHeader: ({ allowDragColumnHeader, columns, customHeaderCount, headings, onHeightMeasured, onMoveColumn, onSortColumn, tableConfig, }: TableHeaderHookProps) => {
12
- draggableColumn: import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | undefined;
13
- draggedColumnIndex: number | undefined;
14
- onClick: (evt: React.MouseEvent | React.KeyboardEvent) => void;
15
- onMouseDown: import("react").MouseEventHandler | undefined;
16
- setContainerRef: import("react").Ref<HTMLDivElement>;
17
- };
@@ -1,5 +0,0 @@
1
- import { RuntimeColumnDescriptor } from "@vuu-ui/vuu-table-types";
2
- export declare const useCell: (column: RuntimeColumnDescriptor, classBase: string, isHeader?: boolean, hasError?: boolean) => {
3
- className: string;
4
- style: import("react").CSSProperties;
5
- };
@@ -1,10 +0,0 @@
1
- import { FocusEventHandler, KeyboardEvent as ReactKeyboardEvent, MouseEvent } from "react";
2
- export interface CellEditingHookProps {
3
- navigate: () => void;
4
- }
5
- export declare const useCellEditing: ({ navigate }: CellEditingHookProps) => {
6
- onBlur: FocusEventHandler;
7
- onDoubleClick: (e: MouseEvent<HTMLElement>) => void;
8
- onFocus: FocusEventHandler;
9
- onKeyDown: (e: ReactKeyboardEvent<HTMLElement>) => void;
10
- };
@@ -1,17 +0,0 @@
1
- import { KeyboardEventHandler, RefCallback, RefObject } from "react";
2
- import { ScrollRequestHandler } from "./useTableScroll";
3
- import { CellPos } from "@vuu-ui/vuu-table-types";
4
- import type { ICellFocusState } from "./CellFocusState";
5
- export interface CellFocusHookProps {
6
- cellFocusStateRef: RefObject<ICellFocusState>;
7
- containerRef: RefObject<HTMLElement | null>;
8
- disableFocus?: boolean;
9
- requestScroll?: ScrollRequestHandler;
10
- }
11
- export type FocusCell = (cellPos: CellPos, fromKeyboard?: boolean) => void;
12
- export declare const useCellFocus: ({ cellFocusStateRef, containerRef, disableFocus, requestScroll, }: CellFocusHookProps) => {
13
- focusCell: FocusCell;
14
- focusCellPlaceholderKeyDown: KeyboardEventHandler;
15
- focusCellPlaceholderRef: RefCallback<HTMLDivElement>;
16
- setTableBodyRef: RefCallback<HTMLDivElement>;
17
- };
@@ -1,8 +0,0 @@
1
- import { KeyboardEventHandler } from "react";
2
- export declare const isRowSelectionKey: (key: string) => key is "Enter" | " ";
3
- export declare const useControlledTableNavigation: (initialValue: number, rowCount: number) => {
4
- highlightedIndexRef: import("react").MutableRefObject<number | undefined>;
5
- onHighlight: (idx: number) => void;
6
- onKeyDown: KeyboardEventHandler;
7
- tableRef: import("react").RefObject<HTMLDivElement | null>;
8
- };
@@ -1,15 +0,0 @@
1
- import { DataSourceRow, DataSourceSubscribedMessage } from "@vuu-ui/vuu-data-types";
2
- import { Range } from "@vuu-ui/vuu-utils";
3
- import { TableProps } from "./Table";
4
- import { VuuRange } from "@vuu-ui/vuu-protocol-types";
5
- export interface DataSourceHookProps extends Pick<TableProps, "dataSource" | "defaultSelectedIndexValues" | "defaultSelectedKeyValues" | "renderBufferSize" | "revealSelected"> {
6
- onSizeChange: (size: number) => void;
7
- onSubscribed: (subscription: DataSourceSubscribedMessage) => void;
8
- }
9
- export declare const useDataSource: ({ dataSource, defaultSelectedIndexValues, defaultSelectedKeyValues, onSizeChange, onSubscribed, renderBufferSize, revealSelected, }: DataSourceHookProps) => {
10
- data: DataSourceRow[];
11
- dataRef: import("react").RefObject<DataSourceRow[]>;
12
- getSelectedRows: () => DataSourceRow[];
13
- range: Range;
14
- setRange: (viewportRange: VuuRange) => void;
15
- };
@@ -1,4 +0,0 @@
1
- import { KeyboardEventHandler } from "react";
2
- export declare const useEditableCell: () => {
3
- onKeyDown: KeyboardEventHandler<HTMLDivElement>;
4
- };
@@ -1,2 +0,0 @@
1
- import { ReactElement } from "react";
2
- export declare const useHighlighting: (value: string, pattern: Lowercase<string>) => string | ReactElement;
@@ -1 +0,0 @@
1
- export declare const useInitialValue: <T = unknown>(value: T) => T;
@@ -1,41 +0,0 @@
1
- import { VuuRange } from "@vuu-ui/vuu-protocol-types";
2
- import { PageKey } from "@vuu-ui/vuu-utils";
3
- import { KeyboardEvent, MouseEvent, MutableRefObject, RefObject } from "react";
4
- import { TableNavigationStyle } from "./Table";
5
- import { NavigationKey } from "./table-dom-utils";
6
- import { ScrollRequestHandler } from "./useTableScroll";
7
- import { FocusCell } from "./useCellFocus";
8
- import { CellFocusState } from "./CellFocusState";
9
- export declare const isNavigationKey: (key: string, navigationStyle: TableNavigationStyle) => key is NavigationKey;
10
- export declare const isPagingKey: (key: string) => key is PageKey;
11
- export type GroupToggleHandler = (treeNodeOperation: "expand" | "collapse", rowIndex: number) => void;
12
- export interface NavigationHookProps {
13
- cellFocusStateRef: MutableRefObject<CellFocusState>;
14
- containerRef: RefObject<HTMLElement | null>;
15
- columnCount?: number;
16
- headerCount: number;
17
- defaultHighlightedIndex?: number;
18
- disableFocus?: boolean;
19
- disableHighlightOnFocus?: boolean;
20
- focusCell: FocusCell;
21
- highlightedIndex?: number;
22
- label?: string;
23
- navigationStyle: TableNavigationStyle;
24
- viewportRange: VuuRange;
25
- onHighlight?: (idx: number) => void;
26
- onToggleGroup: GroupToggleHandler;
27
- requestScroll?: ScrollRequestHandler;
28
- restoreLastFocus?: boolean;
29
- rowCount?: number;
30
- selected?: unknown;
31
- viewportRowCount: number;
32
- }
33
- export declare const useKeyboardNavigation: ({ cellFocusStateRef, columnCount, containerRef, defaultHighlightedIndex, disableHighlightOnFocus, focusCell, headerCount, highlightedIndex: highlightedIndexProp, navigationStyle, requestScroll, onHighlight, onToggleGroup, rowCount, viewportRowCount, }: NavigationHookProps) => {
34
- highlightedIndexRef: RefObject<number | undefined>;
35
- navigateCell: () => void;
36
- onClick: (evt: MouseEvent) => void;
37
- onFocus: () => void;
38
- onKeyDown: (e: KeyboardEvent) => void;
39
- onMouseLeave: (() => void) | undefined;
40
- onMouseMove: ((evt: MouseEvent) => void) | undefined;
41
- };
@@ -1,10 +0,0 @@
1
- import { RefCallback } from "react";
2
- interface MeasuredHeightHookProps {
3
- onHeightMeasured?: (height: number) => void;
4
- height?: number;
5
- }
6
- export declare const useMeasuredHeight: ({ onHeightMeasured, height: heightProp, }: MeasuredHeightHookProps) => {
7
- measuredHeight: number;
8
- measuredRef: RefCallback<HTMLDivElement>;
9
- };
10
- export {};
@@ -1,15 +0,0 @@
1
- import { RefObject } from "react";
2
- export declare const WidthHeight: string[];
3
- export declare const WidthOnly: string[];
4
- export type measurements<T = string | number> = {
5
- height?: T;
6
- clientHeight?: number;
7
- clientWidth?: number;
8
- contentHeight?: number;
9
- contentWidth?: number;
10
- scrollHeight?: number;
11
- scrollWidth?: number;
12
- width?: T;
13
- };
14
- export type ResizeHandler = (measurements: measurements<number>) => void;
15
- export declare function useResizeObserver(ref: RefObject<Element | HTMLElement | null>, dimensions: string[], onResize: ResizeHandler, reportInitialSize?: boolean): void;
@@ -1,3 +0,0 @@
1
- import { TableConfig } from "@vuu-ui/vuu-table-types";
2
- import { RowClassNameGenerator } from "@vuu-ui/vuu-utils";
3
- export declare const useRowClassNameGenerators: ({ rowClassNameGenerators, }: TableConfig) => RowClassNameGenerator | undefined;
@@ -1,14 +0,0 @@
1
- import { TableRowClickHandlerInternal, TableRowSelectHandlerInternal, TableSelectionModel } from "@vuu-ui/vuu-table-types";
2
- import { KeyboardEventHandler, RefObject } from "react";
3
- import { TableProps } from "./Table";
4
- export interface SelectionHookProps extends Pick<TableProps, "defaultSelectedIndexValues" | "onSelectionChange"> {
5
- containerRef: RefObject<HTMLElement | null>;
6
- highlightedIndexRef: RefObject<number | undefined>;
7
- selectionKeys?: string[];
8
- selectionModel: TableSelectionModel;
9
- onSelect?: TableRowSelectHandlerInternal;
10
- }
11
- export declare const useSelection: ({ containerRef, defaultSelectedIndexValues, highlightedIndexRef, selectionKeys, selectionModel, onSelect, onSelectionChange, }: SelectionHookProps) => {
12
- onKeyDown: KeyboardEventHandler<HTMLElement>;
13
- onRowClick: TableRowClickHandlerInternal;
14
- };
@@ -1,83 +0,0 @@
1
- import { DataSourceRow } from "@vuu-ui/vuu-data-types";
2
- import { VuuSortType } from "@vuu-ui/vuu-protocol-types";
3
- import { ColumnDescriptor, DataCellEditEvent, RuntimeColumnDescriptor, TableColumnResizeHandler, TableConfig, TableRowClickHandlerInternal, TableSelectionModel } from "@vuu-ui/vuu-table-types";
4
- import { MeasuredProps, MeasuredSize } from "@vuu-ui/vuu-ui-controls";
5
- import { FocusEvent, KeyboardEvent, MouseEventHandler, RefObject } from "react";
6
- import { TableProps } from "./Table";
7
- type HeaderState = {
8
- height: number;
9
- count: number;
10
- };
11
- export interface TableHookProps extends MeasuredProps, Pick<TableProps, "allowCellBlockSelection" | "allowDragDrop" | "availableColumns" | "config" | "dataSource" | "defaultSelectedIndexValues" | "defaultSelectedKeyValues" | "disableFocus" | "highlightedIndex" | "id" | "navigationStyle" | "onAvailableColumnsChange" | "onConfigChange" | "onDataEdited" | "onDragStart" | "onDrop" | "onHighlight" | "onSelect" | "onSelectCellBlock" | "onSelectionChange" | "onRowClick" | "renderBufferSize" | "revealSelected" | "rowToObject" | "scrollingApiRef" | "selectionBookendWidth" | "showColumnHeaderMenus" | "showColumnHeaders" | "showPaginationControls"> {
12
- containerRef: RefObject<HTMLDivElement | null>;
13
- rowHeight: number;
14
- selectionModel: TableSelectionModel;
15
- size: MeasuredSize;
16
- }
17
- export declare const useTable: ({ allowCellBlockSelection, allowDragDrop, availableColumns, config, containerRef, dataSource, defaultSelectedIndexValues, defaultSelectedKeyValues, disableFocus, highlightedIndex: highlightedIndexProp, id, navigationStyle, onAvailableColumnsChange, onConfigChange, onDataEdited: onDataEditedProp, onDragStart, onDrop, onHighlight, onRowClick: onRowClickProp, onSelect, onSelectCellBlock, onSelectionChange, renderBufferSize, revealSelected, rowHeight, rowToObject, scrollingApiRef, selectionBookendWidth, selectionModel, showColumnHeaderMenus, showColumnHeaders, showPaginationControls, size, }: TableHookProps) => {
18
- "aria-rowcount": number;
19
- cellBlock: import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | null;
20
- columnMap: import("@vuu-ui/vuu-utils").ColumnMap;
21
- columns: RuntimeColumnDescriptor[];
22
- data: DataSourceRow[];
23
- draggableRow: import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | undefined;
24
- focusCellPlaceholderKeyDown: import("react").KeyboardEventHandler;
25
- focusCellPlaceholderRef: import("react").RefCallback<HTMLDivElement>;
26
- getRowOffset: import("@vuu-ui/vuu-utils").RowOffsetFunc;
27
- handleColumnAction: import("@vuu-ui/vuu-context-menu").MenuActionHandler<import("@vuu-ui/vuu-table-extras/src/column-menu/column-menu-utils").ColumnMenuActionType, ColumnDescriptor>;
28
- headerState: HeaderState;
29
- headings: import("@vuu-ui/vuu-table-types").TableHeadings;
30
- highlightedIndex: number | undefined;
31
- onBlur: import("react").FocusEventHandler;
32
- onDoubleClick: (e: import("react").MouseEvent<HTMLElement>) => void;
33
- onFocus: (e: FocusEvent<HTMLElement>) => void;
34
- onKeyDown: (e: KeyboardEvent<HTMLElement>) => void;
35
- onMouseDown: MouseEventHandler;
36
- onContextMenu: ((evt: import("react").MouseEvent<HTMLElement>) => void) | undefined;
37
- onDataEdited: (editState: DataCellEditEvent) => Promise<string | true | undefined>;
38
- onHeaderHeightMeasured: (height: number, count: number) => void;
39
- onMoveColumn: (columns: ColumnDescriptor[]) => void;
40
- onMoveGroupColumn: (columns: ColumnDescriptor[]) => void;
41
- onRemoveGroupColumn: (column: RuntimeColumnDescriptor) => void;
42
- onRowClick: TableRowClickHandlerInternal;
43
- onSortColumn: (column: ColumnDescriptor, extendSort?: boolean, sortType?: VuuSortType) => void;
44
- onResizeColumn: TableColumnResizeHandler;
45
- onToggleGroup: (row: DataSourceRow, column: RuntimeColumnDescriptor) => void;
46
- rowClassNameGenerator: import("@vuu-ui/vuu-utils").RowClassNameGenerator | undefined;
47
- scrollProps: {
48
- columnsWithinViewport: RuntimeColumnDescriptor[];
49
- scrollbarContainerRef: (el: HTMLDivElement | null) => void;
50
- contentContainerRef: (el: HTMLDivElement | null) => void;
51
- virtualColSpan: number;
52
- };
53
- tableAttributes: {
54
- availableWidth: number;
55
- columnDefaultWidth?: number;
56
- columnFormatHeader?: "capitalize" | "uppercase";
57
- columnLayout?: import("@vuu-ui/vuu-table-types").ColumnLayout;
58
- columnSeparators?: boolean;
59
- rowSeparators?: boolean;
60
- zebraStripes?: boolean;
61
- };
62
- tableBodyRef: import("react").RefCallback<HTMLDivElement>;
63
- tableConfig: Readonly<TableConfig>;
64
- viewportMeasurements: {
65
- appliedPageSize: number;
66
- contentHeight: number;
67
- horizontalScrollbarHeight: number;
68
- isVirtualScroll: boolean;
69
- pinnedWidthLeft: number;
70
- pinnedWidthRight: number;
71
- rowCount: number;
72
- contentWidth: number;
73
- totalHeaderHeight: number;
74
- usesMeasuredHeaderHeight: boolean;
75
- verticalScrollbarWidth: number;
76
- viewportBodyHeight: number;
77
- viewportWidth: number;
78
- };
79
- onClick: (evt: import("react").MouseEvent) => void;
80
- onMouseLeave: (() => void) | undefined;
81
- onMouseMove: ((evt: import("react").MouseEvent) => void) | undefined;
82
- };
83
- export {};
@@ -1,23 +0,0 @@
1
- import { DataSource, DataSourceRow } from "@vuu-ui/vuu-data-types";
2
- import { ColumnDescriptor } from "@vuu-ui/vuu-table-types";
3
- import { ColumnMap } from "@vuu-ui/vuu-utils";
4
- import { MouseEvent } from "react";
5
- export interface TableContextMenuHookProps {
6
- allowContextMenu?: boolean;
7
- columns: ColumnDescriptor[];
8
- data: DataSourceRow[];
9
- dataSource: DataSource;
10
- getSelectedRows: () => DataSourceRow[];
11
- headerCount?: number;
12
- }
13
- export type TableMenuLocation = "grid" | "header" | "filter";
14
- export interface TableContextMenuOptions {
15
- columnMap: ColumnMap;
16
- column: ColumnDescriptor;
17
- columns?: ColumnDescriptor[];
18
- row: DataSourceRow;
19
- selectedRows: DataSourceRow[];
20
- viewport?: string;
21
- }
22
- export declare const isTableLocation: (location: string) => location is TableMenuLocation;
23
- export declare const useTableContextMenu: ({ allowContextMenu, columns, data, dataSource, getSelectedRows, headerCount, }: TableContextMenuHookProps) => ((evt: MouseEvent<HTMLElement>) => void) | undefined;
@@ -1,85 +0,0 @@
1
- import { ColumnDescriptor, ColumnLayout, PinLocation, ResizePhase, RuntimeColumnDescriptor, TableAttributes, TableConfig, TableHeadings, TableSelectionModel } from "@vuu-ui/vuu-table-types";
2
- import { DataSource, TableSchema, WithBaseFilter, WithFullConfig } from "@vuu-ui/vuu-data-types";
3
- /**
4
- * TableModel represents state used internally to manage Table. It is
5
- * derived initially from the TableConfig provided by user, along with the
6
- * data-related config from DataSource.
7
- */
8
- export interface TableModel extends TableAttributes {
9
- columns: RuntimeColumnDescriptor[];
10
- headings: TableHeadings;
11
- }
12
- export interface ColumnActionInit {
13
- availableWidth: number;
14
- type: "init";
15
- tableConfig: TableConfig;
16
- dataSource: DataSource;
17
- }
18
- export interface ColumnActionHide {
19
- type: "hideColumns";
20
- columns: ColumnDescriptor[];
21
- }
22
- export interface ColumnActionShow {
23
- type: "showColumns";
24
- columns: RuntimeColumnDescriptor[];
25
- }
26
- export interface ColumnActionMove {
27
- type: "moveColumn";
28
- column: RuntimeColumnDescriptor;
29
- moveBy?: 1 | -1;
30
- }
31
- export interface ColumnActionPin {
32
- type: "pinColumn";
33
- column: ColumnDescriptor;
34
- pin: PinLocation | false;
35
- }
36
- export interface ColumnActionResize {
37
- type: "resizeColumn";
38
- column: RuntimeColumnDescriptor;
39
- phase: ResizePhase;
40
- width?: number;
41
- }
42
- export interface ColumnActionSetTableSchema {
43
- type: "setTableSchema";
44
- tableSchema: TableSchema;
45
- }
46
- export interface ColumnActionUpdate {
47
- type: "updateColumn";
48
- column: ColumnDescriptor;
49
- }
50
- export interface ColumnActionUpdateProp {
51
- align?: ColumnDescriptor["align"];
52
- column: ColumnDescriptor;
53
- hidden?: ColumnDescriptor["hidden"];
54
- label?: ColumnDescriptor["label"];
55
- resizing?: RuntimeColumnDescriptor["resizing"];
56
- type: "updateColumnProp";
57
- width?: ColumnDescriptor["width"];
58
- }
59
- export interface ColumnActionTableConfig extends WithBaseFilter<WithFullConfig> {
60
- confirmed?: boolean;
61
- type: "tableConfig";
62
- }
63
- export type TableModelAction = ColumnActionHide | ColumnActionInit | ColumnActionMove | ColumnActionPin | ColumnActionResize | ColumnActionSetTableSchema | ColumnActionShow | ColumnActionUpdate | ColumnActionUpdateProp | ColumnActionTableConfig;
64
- export type TableModelActionDispatch = (action: TableModelAction) => void;
65
- export interface TableModelHookProps {
66
- config: TableConfig;
67
- dataSource: DataSource;
68
- selectionModel: TableSelectionModel;
69
- availableWidth: number;
70
- }
71
- export declare const useTableModel: ({ config: tableConfigProp, dataSource, selectionModel, availableWidth, }: TableModelHookProps) => {
72
- columns: RuntimeColumnDescriptor[];
73
- dispatchTableModelAction: import("react").ActionDispatch<[action: TableModelAction]>;
74
- headings: TableHeadings;
75
- tableAttributes: {
76
- availableWidth: number;
77
- columnDefaultWidth?: number;
78
- columnFormatHeader?: "capitalize" | "uppercase";
79
- columnLayout?: ColumnLayout;
80
- columnSeparators?: boolean;
81
- rowSeparators?: boolean;
82
- zebraStripes?: boolean;
83
- };
84
- tableConfig: Readonly<TableConfig>;
85
- };
@@ -1,69 +0,0 @@
1
- import { RowAtPositionFunc } from "@vuu-ui/vuu-utils";
2
- import type { VuuRange } from "@vuu-ui/vuu-protocol-types";
3
- import { ForwardedRef, MutableRefObject } from "react";
4
- import type { ViewportMeasurements } from "./useTableViewport";
5
- import type { RuntimeColumnDescriptor } from "@vuu-ui/vuu-table-types";
6
- import { FocusCell } from "./useCellFocus";
7
- import { ICellFocusState } from "./CellFocusState";
8
- export type ScrollDirectionVertical = "up" | "down";
9
- export type ScrollDirectionHorizontal = "left" | "right";
10
- export type ScrollDirection = ScrollDirectionVertical | ScrollDirectionHorizontal;
11
- /**
12
- * scroll into view the row at given pixel offset.
13
- */
14
- export interface ScrollRequestPosition {
15
- scrollPos: number;
16
- type: "scroll-top" | "scroll-bottom";
17
- }
18
- /**
19
- * scroll into view the row at given row index posiiton.
20
- */
21
- export interface ScrollRequestRow {
22
- rowIndex: number;
23
- type: "scroll-row";
24
- }
25
- export interface ScrollRequestEnd {
26
- type: "scroll-end";
27
- direction: "home" | "end";
28
- }
29
- export interface ScrollRequestPage {
30
- type: "scroll-page";
31
- direction: ScrollDirectionVertical;
32
- }
33
- export type ScrollRequest = ScrollRequestPage | ScrollRequestEnd | ScrollRequestRow | ScrollRequestPosition;
34
- export type ScrollRequestHandler = (request: ScrollRequest) => void;
35
- export interface ScrollingAPI {
36
- scrollToIndex: (itemIndex: number) => void;
37
- scrollToKey: (rowKey: string) => void;
38
- }
39
- export declare const noScrolling: ScrollingAPI;
40
- export interface TableScrollHookProps {
41
- cellFocusStateRef: MutableRefObject<ICellFocusState>;
42
- columns: RuntimeColumnDescriptor[];
43
- focusCell?: FocusCell;
44
- getRowAtPosition: RowAtPositionFunc;
45
- onHorizontalScroll?: (scrollLeft: number) => void;
46
- onVerticalScroll?: (scrollTop: number, pctScrollTop: number) => void;
47
- /**
48
- * When we have a virtualized scroll container, keyboard navigation is
49
- * performed `in situ`. We shift the range of rows rendered within the
50
- * viewport, whithout actually moving the scroll position
51
- */
52
- onVerticalScrollInSitu?: (rowIndexOffsetCount: number) => void;
53
- rowHeight: number;
54
- scrollingApiRef?: ForwardedRef<ScrollingAPI>;
55
- setRange: (range: VuuRange) => void;
56
- showPaginationControls?: boolean;
57
- viewportMeasurements: ViewportMeasurements;
58
- }
59
- export declare const useTableScroll: ({ cellFocusStateRef, columns, focusCell, getRowAtPosition, onHorizontalScroll, onVerticalScroll, onVerticalScrollInSitu, rowHeight, scrollingApiRef, setRange, viewportMeasurements, }: TableScrollHookProps) => {
60
- columnsWithinViewport: RuntimeColumnDescriptor[];
61
- /** Ref to be assigned to ScrollbarContainer */
62
- scrollbarContainerRef: (el: HTMLDivElement | null) => void;
63
- /** Ref to be assigned to ContentContainer */
64
- contentContainerRef: (el: HTMLDivElement | null) => void;
65
- /** Scroll the table */
66
- requestScroll: ScrollRequestHandler;
67
- /** number of leading columns not rendered because of virtualization */
68
- virtualColSpan: number;
69
- };
@@ -1,42 +0,0 @@
1
- /**
2
- * This hook measures and calculates the values needed to manage layout
3
- * and virtualisation of the table. This includes measurements required
4
- * to support pinned columns.
5
- */
6
- import { RuntimeColumnDescriptor } from "@vuu-ui/vuu-table-types";
7
- import { MeasuredSize } from "@vuu-ui/vuu-ui-controls";
8
- import { RowAtPositionFunc, RowOffsetFunc } from "@vuu-ui/vuu-utils";
9
- export interface TableViewportHookProps {
10
- columns: RuntimeColumnDescriptor[];
11
- headerHeight: number;
12
- rowCount: number;
13
- rowHeight: number;
14
- /**
15
- * this is the solid left/right `border` rendered on the selection block
16
- */
17
- selectionEndSize?: number;
18
- showPaginationControls?: boolean;
19
- size: MeasuredSize;
20
- }
21
- export interface ViewportMeasurements {
22
- appliedPageSize: number;
23
- contentHeight: number;
24
- horizontalScrollbarHeight: number;
25
- isVirtualScroll: boolean;
26
- pinnedWidthLeft: number;
27
- pinnedWidthRight: number;
28
- rowCount: number;
29
- contentWidth: number;
30
- totalHeaderHeight: number;
31
- usesMeasuredHeaderHeight: boolean;
32
- verticalScrollbarWidth: number;
33
- viewportBodyHeight: number;
34
- viewportWidth: number;
35
- }
36
- export interface TableViewportHookResult extends ViewportMeasurements {
37
- getRowAtPosition: RowAtPositionFunc;
38
- getRowOffset: RowOffsetFunc;
39
- setInSituRowOffset: (rowIndexOffset: number) => void;
40
- setScrollTop: (scrollTop: number, scrollPct: number) => void;
41
- }
42
- export declare const useTableViewport: ({ columns, headerHeight, rowCount, rowHeight, selectionEndSize, showPaginationControls, size, }: TableViewportHookProps) => TableViewportHookResult;