@vuu-ui/vuu-table 0.6.14-debug
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/cjs/index.js +24262 -0
- package/index.css +722 -0
- package/index.css.map +7 -0
- package/package.json +26 -0
- package/types/ColumnBasedTable.d.ts +3 -0
- package/types/ColumnResizer.d.ts +8 -0
- package/types/DragVisualizer.d.ts +8 -0
- package/types/RowBasedTable.d.ts +3 -0
- package/types/SortIndicator.d.ts +7 -0
- package/types/Table.d.ts +4 -0
- package/types/TableCell.d.ts +4 -0
- package/types/TableGroupCell.d.ts +6 -0
- package/types/TableGroupHeaderCell.d.ts +13 -0
- package/types/TableHeaderCell.d.ts +11 -0
- package/types/TableRow.d.ts +15 -0
- package/types/cell-renderers/index.d.ts +1 -0
- package/types/cell-renderers/json-cell/JsonCell.d.ts +1 -0
- package/types/cell-renderers/json-cell/index.d.ts +1 -0
- package/types/context-menu/buildContextMenuDescriptors.d.ts +4 -0
- package/types/context-menu/index.d.ts +2 -0
- package/types/context-menu/useContextMenu.d.ts +16 -0
- package/types/dataTableTypes.d.ts +70 -0
- package/types/filter-indicator.d.ts +13 -0
- package/types/index.d.ts +4 -0
- package/types/keyUtils.d.ts +19 -0
- package/types/useDataSource.d.ts +40 -0
- package/types/useDataTable.d.ts +54 -0
- package/types/useDraggableColumn.d.ts +12 -0
- package/types/useKeyboardNavigation.d.ts +22 -0
- package/types/useMeasuredContainer.d.ts +25 -0
- package/types/useMeasuredSize.d.ts +26 -0
- package/types/useResizeObserver.d.ts +15 -0
- package/types/useSelection.d.ts +7 -0
- package/types/useTableColumnResize.d.ts +17 -0
- package/types/useTableModel.d.ts +71 -0
- package/types/useTableScroll.d.ts +38 -0
- package/types/useTableViewport.d.ts +28 -0
- package/types/useVirtualViewport.d.ts +16 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { ColumnDescriptor, GridConfig, KeyedColumnDescriptor, PinLocation } from "@vuu-ui/vuu-datagrid-types";
|
|
2
|
+
import { Reducer } from "react";
|
|
3
|
+
import { VuuColumnDataType } from "@vuu-ui/vuu-protocol-types";
|
|
4
|
+
import { DataSourceConfig } from "@vuu-ui/vuu-data";
|
|
5
|
+
export interface GridModel extends Omit<GridConfig, "columns"> {
|
|
6
|
+
columns: KeyedColumnDescriptor[];
|
|
7
|
+
}
|
|
8
|
+
export interface ColumnActionInit {
|
|
9
|
+
type: "init";
|
|
10
|
+
tableConfig: Omit<GridConfig, "headings">;
|
|
11
|
+
dataSourceConfig?: DataSourceConfig;
|
|
12
|
+
}
|
|
13
|
+
export interface ColumnActionHide {
|
|
14
|
+
type: "hideColumns";
|
|
15
|
+
columns: KeyedColumnDescriptor[];
|
|
16
|
+
}
|
|
17
|
+
export interface ColumnActionShow {
|
|
18
|
+
type: "showColumns";
|
|
19
|
+
columns: KeyedColumnDescriptor[];
|
|
20
|
+
}
|
|
21
|
+
export interface ColumnActionMove {
|
|
22
|
+
type: "moveColumn";
|
|
23
|
+
column: KeyedColumnDescriptor;
|
|
24
|
+
moveBy?: 1 | -1;
|
|
25
|
+
moveTo?: number;
|
|
26
|
+
}
|
|
27
|
+
export interface ColumnActionPin {
|
|
28
|
+
type: "pinColumn";
|
|
29
|
+
column: ColumnDescriptor;
|
|
30
|
+
pin?: PinLocation;
|
|
31
|
+
}
|
|
32
|
+
export interface ColumnActionResize {
|
|
33
|
+
type: "resizeColumn";
|
|
34
|
+
column: KeyedColumnDescriptor;
|
|
35
|
+
phase: "begin" | "resize" | "end";
|
|
36
|
+
width?: number;
|
|
37
|
+
}
|
|
38
|
+
export interface ColumnActionSetTypes {
|
|
39
|
+
type: "setTypes";
|
|
40
|
+
columnNames: string[];
|
|
41
|
+
serverDataTypes: VuuColumnDataType[];
|
|
42
|
+
}
|
|
43
|
+
export interface ColumnActionUpdate {
|
|
44
|
+
type: "updateColumn";
|
|
45
|
+
column: ColumnDescriptor;
|
|
46
|
+
}
|
|
47
|
+
export interface ColumnActionUpdateProp {
|
|
48
|
+
align?: ColumnDescriptor["align"];
|
|
49
|
+
column: KeyedColumnDescriptor;
|
|
50
|
+
hidden?: ColumnDescriptor["hidden"];
|
|
51
|
+
label?: ColumnDescriptor["label"];
|
|
52
|
+
resizing?: KeyedColumnDescriptor["resizing"];
|
|
53
|
+
type: "updateColumnProp";
|
|
54
|
+
width?: ColumnDescriptor["width"];
|
|
55
|
+
}
|
|
56
|
+
export interface ColumnActionTableConfig extends DataSourceConfig {
|
|
57
|
+
confirmed?: boolean;
|
|
58
|
+
type: "tableConfig";
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* PersistentColumnActions are those actions that require us to persist user changes across sessions
|
|
62
|
+
*/
|
|
63
|
+
export type PersistentColumnAction = ColumnActionPin | ColumnActionHide;
|
|
64
|
+
export type GridModelAction = ColumnActionHide | ColumnActionInit | ColumnActionMove | ColumnActionPin | ColumnActionResize | ColumnActionSetTypes | ColumnActionShow | ColumnActionUpdate | ColumnActionUpdateProp | ColumnActionTableConfig;
|
|
65
|
+
export type GridModelReducer = Reducer<GridModel, GridModelAction>;
|
|
66
|
+
export type ColumnActionDispatch = (action: GridModelAction) => void;
|
|
67
|
+
export declare const useTableModel: (tableConfig: Omit<GridConfig, "headings">, dataSourceConfig?: DataSourceConfig) => {
|
|
68
|
+
columns: KeyedColumnDescriptor[];
|
|
69
|
+
dispatchColumnAction: import("react").Dispatch<GridModelAction>;
|
|
70
|
+
headings: import("@vuu-ui/vuu-datagrid-types").TableHeadings;
|
|
71
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Viewport } from "./dataTableTypes";
|
|
3
|
+
export interface ScrollRequestEnd {
|
|
4
|
+
type: "scroll-end";
|
|
5
|
+
direction: "home" | "end";
|
|
6
|
+
}
|
|
7
|
+
export interface ScrollRequestPage {
|
|
8
|
+
type: "scroll-page";
|
|
9
|
+
direction: "up" | "down";
|
|
10
|
+
}
|
|
11
|
+
export interface ScrollRequestDistance {
|
|
12
|
+
type: "scroll-distance";
|
|
13
|
+
distance: number;
|
|
14
|
+
}
|
|
15
|
+
export type ScrollRequest = ScrollRequestPage | ScrollRequestDistance | ScrollRequestEnd;
|
|
16
|
+
export type ScrollRequestHandler = (request: ScrollRequest) => void;
|
|
17
|
+
export interface TableScrollHookProps {
|
|
18
|
+
onHorizontalScroll?: (scrollLeft: number) => void;
|
|
19
|
+
onVerticalScroll?: (scrollTop: number) => void;
|
|
20
|
+
viewportHeight: number;
|
|
21
|
+
viewport: Viewport;
|
|
22
|
+
}
|
|
23
|
+
export declare const useTableScroll: ({ onHorizontalScroll, onVerticalScroll, viewport, }: TableScrollHookProps) => {
|
|
24
|
+
/** Ref to be assigned to ScrollbarContainer */
|
|
25
|
+
scrollbarContainerRef: import("react").RefObject<HTMLDivElement>;
|
|
26
|
+
/** Scroll handler to be attached to ScrollbarContainer */
|
|
27
|
+
onScrollbarContainerScroll: () => void;
|
|
28
|
+
/** Ref to be assigned to ContentContainer */
|
|
29
|
+
contentContainerRef: import("react").RefObject<HTMLDivElement>;
|
|
30
|
+
/** Scroll handler to be attached to ContentContainer */
|
|
31
|
+
onContentContainerScroll: () => void;
|
|
32
|
+
/** Ref to be assigned to TableContainer */
|
|
33
|
+
tableContainerRef: import("react").RefObject<HTMLDivElement>;
|
|
34
|
+
/** Scroll handler to be attached to TableContainer */
|
|
35
|
+
onTableContainerScroll: () => void;
|
|
36
|
+
/** Scroll the table */
|
|
37
|
+
requestScroll: ScrollRequestHandler;
|
|
38
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
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 { KeyedColumnDescriptor, TableHeadings } from "@vuu-ui/vuu-datagrid-types";
|
|
7
|
+
import { MeasuredSize } from "./useMeasuredContainer";
|
|
8
|
+
export interface TableViewportHookProps {
|
|
9
|
+
columns: KeyedColumnDescriptor[];
|
|
10
|
+
headerHeight: number;
|
|
11
|
+
headings: TableHeadings;
|
|
12
|
+
rowCount: number;
|
|
13
|
+
rowHeight: number;
|
|
14
|
+
size?: MeasuredSize;
|
|
15
|
+
}
|
|
16
|
+
export interface ViewportMeasurements {
|
|
17
|
+
fillerHeight: number;
|
|
18
|
+
maxScrollContainerScrollHorizontal: number;
|
|
19
|
+
maxScrollContainerScrollVertical: number;
|
|
20
|
+
pinnedWidthLeft: number;
|
|
21
|
+
pinnedWidthRight: number;
|
|
22
|
+
rowCount: number;
|
|
23
|
+
scrollContentHeight: number;
|
|
24
|
+
scrollbarSize: number;
|
|
25
|
+
scrollContentWidth: number;
|
|
26
|
+
totalHeaderHeight: number;
|
|
27
|
+
}
|
|
28
|
+
export declare const useTableViewport: ({ columns, headerHeight, headings, rowCount, rowHeight, size, }: TableViewportHookProps) => ViewportMeasurements;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { KeyedColumnDescriptor } from "@vuu-ui/vuu-datagrid-types";
|
|
2
|
+
import { VuuRange } from "@vuu-ui/vuu-protocol-types";
|
|
3
|
+
import { ViewportMeasurements } from "./useTableViewport";
|
|
4
|
+
export interface VirtualViewportHookProps {
|
|
5
|
+
columns: KeyedColumnDescriptor[];
|
|
6
|
+
rowHeight: number;
|
|
7
|
+
setRange: (range: VuuRange) => void;
|
|
8
|
+
viewportMeasurements: ViewportMeasurements;
|
|
9
|
+
}
|
|
10
|
+
export interface VirtualViewportHookResult {
|
|
11
|
+
onHorizontalScroll: (scrollLeft: number) => void;
|
|
12
|
+
onVerticalScroll: (scrollTop: number) => void;
|
|
13
|
+
columnsWithinViewport: KeyedColumnDescriptor[];
|
|
14
|
+
virtualColSpan: number;
|
|
15
|
+
}
|
|
16
|
+
export declare const useVirtualViewport: ({ columns, rowHeight, setRange, viewportMeasurements, }: VirtualViewportHookProps) => VirtualViewportHookResult;
|