@vuu-ui/vuu-datatable 0.6.10-debug → 0.6.11-debug-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.
@@ -0,0 +1,66 @@
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: "hideColumn";
15
+ column: KeyedColumnDescriptor;
16
+ }
17
+ export interface ColumnActionMove {
18
+ type: "moveColumn";
19
+ column: KeyedColumnDescriptor;
20
+ moveBy?: 1 | -1;
21
+ moveTo?: number;
22
+ }
23
+ export interface ColumnActionPin {
24
+ type: "pinColumn";
25
+ column: ColumnDescriptor;
26
+ pin?: PinLocation;
27
+ }
28
+ export interface ColumnActionResize {
29
+ type: "resizeColumn";
30
+ column: KeyedColumnDescriptor;
31
+ phase: "begin" | "resize" | "end";
32
+ width?: number;
33
+ }
34
+ export interface ColumnActionSetTypes {
35
+ type: "setTypes";
36
+ columnNames: string[];
37
+ serverDataTypes: VuuColumnDataType[];
38
+ }
39
+ export interface ColumnActionUpdate {
40
+ type: "updateColumn";
41
+ column: ColumnDescriptor;
42
+ }
43
+ export interface ColumnActionUpdateProp {
44
+ align?: ColumnDescriptor["align"];
45
+ column: KeyedColumnDescriptor;
46
+ hidden?: ColumnDescriptor["hidden"];
47
+ label?: ColumnDescriptor["label"];
48
+ resizing?: KeyedColumnDescriptor["resizing"];
49
+ type: "updateColumnProp";
50
+ width?: ColumnDescriptor["width"];
51
+ }
52
+ export interface ColumnActionTableConfig extends DataSourceConfig {
53
+ type: "tableConfig";
54
+ }
55
+ /**
56
+ * PersistentColumnActions are those actions that require us to persist user changes across sessions
57
+ */
58
+ export type PersistentColumnAction = ColumnActionPin | ColumnActionHide;
59
+ export type GridModelAction = ColumnActionHide | ColumnActionInit | ColumnActionMove | ColumnActionPin | ColumnActionResize | ColumnActionSetTypes | ColumnActionUpdate | ColumnActionUpdateProp | ColumnActionTableConfig;
60
+ export type GridModelReducer = Reducer<GridModel, GridModelAction>;
61
+ export type ColumnActionDispatch = (action: GridModelAction) => void;
62
+ export declare const useTableModel: (tableConfig: Omit<GridConfig, "headings">, dataSourceConfig?: DataSourceConfig) => {
63
+ columns: KeyedColumnDescriptor[];
64
+ dispatchColumnAction: import("react").Dispatch<GridModelAction>;
65
+ headings: import("@vuu-ui/vuu-datagrid-types").TableHeadings;
66
+ };
@@ -0,0 +1,31 @@
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
+ onRangeChange: (from: number, to: number) => void;
19
+ rowHeight: number;
20
+ viewportHeight: number;
21
+ viewport: Viewport;
22
+ }
23
+ export declare const useTableScroll: ({ onRangeChange, rowHeight, viewport, }: TableScrollHookProps) => {
24
+ onScrollbarContainerScroll: () => void;
25
+ onContentContainerScroll: () => void;
26
+ onTableContainerScroll: () => void;
27
+ requestScroll: ScrollRequestHandler;
28
+ contentContainerRef: import("react").RefObject<HTMLDivElement>;
29
+ scrollbarContainerRef: import("react").RefObject<HTMLDivElement>;
30
+ tableContainerRef: import("react").RefObject<HTMLDivElement>;
31
+ };
@@ -0,0 +1,39 @@
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) => {
29
+ fillerHeight: number;
30
+ maxScrollContainerScrollHorizontal: number;
31
+ maxScrollContainerScrollVertical: number;
32
+ pinnedWidthLeft: number;
33
+ pinnedWidthRight: number;
34
+ rowCount: number;
35
+ scrollContentHeight: number;
36
+ scrollbarSize: number;
37
+ scrollContentWidth: number;
38
+ totalHeaderHeight: number;
39
+ };