@vuu-ui/vuu-table 0.8.56 → 0.8.58
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/cjs/Row.js.map +1 -1
- package/cjs/Table.css.js +1 -1
- package/cjs/Table.js +13 -10
- package/cjs/Table.js.map +1 -1
- package/cjs/bulk-edit/bulk-edit-panel/BulkEditPanel.css.js +6 -0
- package/cjs/bulk-edit/bulk-edit-panel/BulkEditPanel.css.js.map +1 -0
- package/cjs/bulk-edit/bulk-edit-panel/BulkEditPanel.js +47 -0
- package/cjs/bulk-edit/bulk-edit-panel/BulkEditPanel.js.map +1 -0
- package/cjs/bulk-edit/bulk-edit-row/BulkEditRow.css.js +6 -0
- package/cjs/bulk-edit/bulk-edit-row/BulkEditRow.css.js.map +1 -0
- package/cjs/bulk-edit/bulk-edit-row/BulkEditRow.js +29 -0
- package/cjs/bulk-edit/bulk-edit-row/BulkEditRow.js.map +1 -0
- package/cjs/column-resizing/ColumnResizer.css.js +1 -1
- package/cjs/header-cell/HeaderCell.css.js +1 -1
- package/cjs/index.js +17 -9
- package/cjs/index.js.map +1 -1
- package/cjs/table-dom-utils.js +7 -0
- package/cjs/table-dom-utils.js.map +1 -1
- package/cjs/table-header/HeaderProvider.js +18 -0
- package/cjs/table-header/HeaderProvider.js.map +1 -0
- package/cjs/table-header/TableHeader.js +30 -0
- package/cjs/table-header/TableHeader.js.map +1 -1
- package/cjs/table-header/useTableHeader.js +7 -1
- package/cjs/table-header/useTableHeader.js.map +1 -1
- package/cjs/useKeyboardNavigation.js +4 -0
- package/cjs/useKeyboardNavigation.js.map +1 -1
- package/cjs/{useRowHeight.js → useMeasuredHeight.js} +11 -13
- package/cjs/useMeasuredHeight.js.map +1 -0
- package/cjs/useTable.js +6 -2
- package/cjs/useTable.js.map +1 -1
- package/cjs/useTableAndColumnSettings.js +17 -10
- package/cjs/useTableAndColumnSettings.js.map +1 -1
- package/cjs/useTableScroll.js +0 -1
- package/cjs/useTableScroll.js.map +1 -1
- package/cjs/useTableViewport.js +2 -8
- package/cjs/useTableViewport.js.map +1 -1
- package/esm/Row.js.map +1 -1
- package/esm/Table.css.js +1 -1
- package/esm/Table.js +13 -10
- package/esm/Table.js.map +1 -1
- package/esm/bulk-edit/bulk-edit-panel/BulkEditPanel.css.js +4 -0
- package/esm/bulk-edit/bulk-edit-panel/BulkEditPanel.css.js.map +1 -0
- package/esm/bulk-edit/bulk-edit-panel/BulkEditPanel.js +45 -0
- package/esm/bulk-edit/bulk-edit-panel/BulkEditPanel.js.map +1 -0
- package/esm/bulk-edit/bulk-edit-row/BulkEditRow.css.js +4 -0
- package/esm/bulk-edit/bulk-edit-row/BulkEditRow.css.js.map +1 -0
- package/esm/bulk-edit/bulk-edit-row/BulkEditRow.js +27 -0
- package/esm/bulk-edit/bulk-edit-row/BulkEditRow.js.map +1 -0
- package/esm/column-resizing/ColumnResizer.css.js +1 -1
- package/esm/header-cell/HeaderCell.css.js +1 -1
- package/esm/index.js +9 -5
- package/esm/index.js.map +1 -1
- package/esm/table-dom-utils.js +7 -1
- package/esm/table-dom-utils.js.map +1 -1
- package/esm/table-header/HeaderProvider.js +15 -0
- package/esm/table-header/HeaderProvider.js.map +1 -0
- package/esm/table-header/TableHeader.js +32 -2
- package/esm/table-header/TableHeader.js.map +1 -1
- package/esm/table-header/useTableHeader.js +7 -1
- package/esm/table-header/useTableHeader.js.map +1 -1
- package/esm/useKeyboardNavigation.js +6 -2
- package/esm/useKeyboardNavigation.js.map +1 -1
- package/esm/{useRowHeight.js → useMeasuredHeight.js} +12 -14
- package/esm/useMeasuredHeight.js.map +1 -0
- package/esm/useTable.js +6 -2
- package/esm/useTable.js.map +1 -1
- package/esm/useTableAndColumnSettings.js +18 -11
- package/esm/useTableAndColumnSettings.js.map +1 -1
- package/esm/useTableScroll.js +0 -1
- package/esm/useTableScroll.js.map +1 -1
- package/esm/useTableViewport.js +2 -8
- package/esm/useTableViewport.js.map +1 -1
- package/package.json +9 -9
- package/types/Row.d.ts +2 -19
- package/types/Table.d.ts +5 -7
- package/types/bulk-edit/bulk-edit-panel/BulkEditPanel.d.ts +13 -0
- package/types/bulk-edit/bulk-edit-panel/index.d.ts +1 -0
- package/types/bulk-edit/bulk-edit-row/BulkEditRow.d.ts +13 -0
- package/types/bulk-edit/bulk-edit-row/index.d.ts +1 -0
- package/types/bulk-edit/index.d.ts +2 -0
- package/types/index.d.ts +4 -3
- package/types/table-dom-utils.d.ts +1 -0
- package/types/table-header/HeaderProvider.d.ts +4 -0
- package/types/table-header/TableHeader.d.ts +4 -2
- package/types/table-header/index.d.ts +2 -0
- package/types/table-header/useTableHeader.d.ts +4 -3
- package/types/useCellEditing.d.ts +2 -2
- package/types/useControlledTableNavigation.d.ts +1 -1
- package/types/useMeasuredHeight.d.ts +10 -0
- package/types/useTable.d.ts +6 -5
- package/types/useTableViewport.d.ts +2 -3
- package/cjs/useRowHeight.js.map +0 -1
- package/esm/useRowHeight.js.map +0 -1
- package/types/useRowHeight.d.ts +0 -8
package/types/Table.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { DataSource, SchemaColumn, SelectionChangeHandler, VuuFeatureInvocationMessage } from "@vuu-ui/vuu-data-types";
|
|
2
|
-
import { TableConfig, TableConfigChangeHandler, TableRowClickHandler, TableRowSelectHandler, TableSelectionModel } from "@vuu-ui/vuu-table-types";
|
|
2
|
+
import { CustomHeader, RowProps, TableConfig, TableConfigChangeHandler, TableRowClickHandler, TableRowSelectHandler, TableSelectionModel } from "@vuu-ui/vuu-table-types";
|
|
3
3
|
import type { DragDropState } from "@vuu-ui/vuu-ui-controls";
|
|
4
|
-
import { DragStartHandler,
|
|
4
|
+
import { DragStartHandler, MeasuredContainerProps, dragStrategy } from "@vuu-ui/vuu-ui-controls";
|
|
5
5
|
import { FC, ForwardedRef } from "react";
|
|
6
|
-
import { RowProps } from "./Row";
|
|
7
6
|
import { ScrollingAPI } from "./useTableScroll";
|
|
8
7
|
export type TableNavigationStyle = "none" | "cell" | "row";
|
|
9
8
|
export interface TableProps extends Omit<MeasuredContainerProps, "onDragStart" | "onDrop" | "onSelect"> {
|
|
@@ -22,11 +21,10 @@ export interface TableProps extends Omit<MeasuredContainerProps, "onDragStart" |
|
|
|
22
21
|
dataSource: DataSource;
|
|
23
22
|
disableFocus?: boolean;
|
|
24
23
|
/**
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* rowHeight, whether set vis rowHeight prop or CSS.
|
|
24
|
+
* Allows additional custom element(s) to be embedded immediately below column headers.
|
|
25
|
+
* Could be used to present inline filters for example.
|
|
28
26
|
*/
|
|
29
|
-
|
|
27
|
+
customHeader?: CustomHeader | CustomHeader[];
|
|
30
28
|
/**
|
|
31
29
|
* Defined how focus navigation within data cells will be handled by table.
|
|
32
30
|
* Default is cell.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { DataSource } from "@vuu-ui/vuu-data-types";
|
|
3
|
+
import { TableConfig } from "@vuu-ui/vuu-table-types";
|
|
4
|
+
type BulkEditPanelProps = {
|
|
5
|
+
className?: string;
|
|
6
|
+
tableConfig: TableConfig;
|
|
7
|
+
dataSource: DataSource;
|
|
8
|
+
onCancel: () => void;
|
|
9
|
+
onEditMultiple: () => void;
|
|
10
|
+
onSubmit: () => void;
|
|
11
|
+
};
|
|
12
|
+
export declare const BulkEditPanel: (props: BulkEditPanelProps) => JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./BulkEditPanel";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { DataSourceRow } from "@vuu-ui/vuu-data-types";
|
|
3
|
+
import { RuntimeColumnDescriptor } from "@vuu-ui/vuu-table-types";
|
|
4
|
+
import { ColumnMap } from "@vuu-ui/vuu-utils";
|
|
5
|
+
type BulkEditRowProps = {
|
|
6
|
+
className?: string;
|
|
7
|
+
columnMap: ColumnMap;
|
|
8
|
+
columns: RuntimeColumnDescriptor[];
|
|
9
|
+
row: DataSourceRow;
|
|
10
|
+
offset: number;
|
|
11
|
+
};
|
|
12
|
+
export declare const BulkEditRow: (props: BulkEditRowProps) => JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./BulkEditRow";
|
package/types/index.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from "./header-cell";
|
|
2
|
+
export * from "./cell-renderers";
|
|
2
3
|
export * from "./header-cell";
|
|
3
4
|
export * from "./Table";
|
|
4
5
|
export * from "./table-cell";
|
|
5
6
|
export * from "./table-config";
|
|
6
|
-
export * from "./
|
|
7
|
-
export type { RowProps } from "./Row";
|
|
7
|
+
export * from "./table-header";
|
|
8
8
|
export * from "./useControlledTableNavigation";
|
|
9
9
|
export * from "./useTableModel";
|
|
10
10
|
export * from "./useTableScroll";
|
|
11
11
|
export * from "./useTableViewport";
|
|
12
|
+
export * from "./bulk-edit";
|
|
@@ -8,6 +8,7 @@ export declare const headerCellQuery: (colIdx: number) => string;
|
|
|
8
8
|
export declare const dataCellQuery: (rowIdx: number, colIdx: number) => string;
|
|
9
9
|
export declare const getTableCell: (containerRef: RefObject<HTMLElement>, [rowIdx, colIdx]: CellPos) => HTMLElement;
|
|
10
10
|
export declare const cellIsEditable: (cell: HTMLDivElement | null) => boolean | undefined;
|
|
11
|
+
export declare const cellDropdownShowing: (cell: HTMLDivElement | null) => boolean;
|
|
11
12
|
export declare const cellIsTextInput: (cell: HTMLElement) => boolean;
|
|
12
13
|
export declare function getRowIndex(rowEl?: HTMLElement): number;
|
|
13
14
|
export declare const closestRowIndex: (el: HTMLElement) => number;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { VuuSortType } from "@vuu-ui/vuu-protocol-types";
|
|
3
|
-
import { ColumnDescriptor, RuntimeColumnDescriptor, TableColumnResizeHandler, TableConfig, TableHeadings } from "@vuu-ui/vuu-table-types";
|
|
3
|
+
import { ColumnDescriptor, CustomHeader, RuntimeColumnDescriptor, TableColumnResizeHandler, TableConfig, TableHeadings } from "@vuu-ui/vuu-table-types";
|
|
4
4
|
export type ColumnSortHandler = (column: ColumnDescriptor, addToExistingSort: boolean, sortType?: VuuSortType) => void;
|
|
5
5
|
export interface TableHeaderProps {
|
|
6
6
|
classBase?: string;
|
|
7
7
|
columns: RuntimeColumnDescriptor[];
|
|
8
|
+
customHeader?: CustomHeader | CustomHeader[];
|
|
8
9
|
headings: TableHeadings;
|
|
10
|
+
onHeightMeasured: (height: number) => void;
|
|
9
11
|
onResizeColumn: TableColumnResizeHandler;
|
|
10
12
|
onMoveColumn: (columns: ColumnDescriptor[]) => void;
|
|
11
13
|
onMoveGroupColumn: (columns: ColumnDescriptor[]) => void;
|
|
@@ -16,4 +18,4 @@ export interface TableHeaderProps {
|
|
|
16
18
|
tableId: string;
|
|
17
19
|
virtualColSpan?: number;
|
|
18
20
|
}
|
|
19
|
-
export declare const TableHeader: import("react").MemoExoticComponent<({ classBase, columns, headings, onMoveColumn, onMoveGroupColumn, onRemoveGroupColumn, onResizeColumn, onSortColumn, showColumnHeaderMenus, tableConfig, tableId, virtualColSpan, }: TableHeaderProps) => JSX.Element>;
|
|
21
|
+
export declare const TableHeader: import("react").MemoExoticComponent<({ classBase, columns, customHeader, headings, onHeightMeasured, onMoveColumn, onMoveGroupColumn, onRemoveGroupColumn, onResizeColumn, onSortColumn, showColumnHeaderMenus, tableConfig, tableId, virtualColSpan, }: TableHeaderProps) => JSX.Element>;
|
|
@@ -3,13 +3,14 @@ import { ColumnDescriptor } from "@vuu-ui/vuu-table-types";
|
|
|
3
3
|
import { TableHeaderProps } from "./TableHeader";
|
|
4
4
|
export interface TableHeaderHookProps extends Pick<TableHeaderProps, "columns" | "onMoveColumn" | "onSortColumn" | "tableConfig"> {
|
|
5
5
|
label?: string;
|
|
6
|
+
onHeightMeasured: (height: number) => void;
|
|
6
7
|
onMoveColumn: (columns: ColumnDescriptor[]) => void;
|
|
7
8
|
onSortColumn: (column: ColumnDescriptor, addToExistingSort: boolean) => void;
|
|
8
9
|
}
|
|
9
|
-
export declare const useTableHeader: ({ columns, onMoveColumn, onSortColumn, tableConfig, }: TableHeaderHookProps) => {
|
|
10
|
+
export declare const useTableHeader: ({ columns, onHeightMeasured, onMoveColumn, onSortColumn, tableConfig, }: TableHeaderHookProps) => {
|
|
10
11
|
draggableColumn: JSX.Element | undefined;
|
|
11
12
|
draggedColumnIndex: number | undefined;
|
|
12
13
|
onClick: (evt: React.MouseEvent | React.KeyboardEvent) => void;
|
|
13
|
-
onMouseDown: import("react").MouseEventHandler
|
|
14
|
-
setContainerRef: (
|
|
14
|
+
onMouseDown: import("react").MouseEventHandler | undefined;
|
|
15
|
+
setContainerRef: import("react").Ref<HTMLDivElement>;
|
|
15
16
|
};
|
|
@@ -3,8 +3,8 @@ export interface CellEditingHookProps {
|
|
|
3
3
|
navigate: () => void;
|
|
4
4
|
}
|
|
5
5
|
export declare const useCellEditing: ({ navigate }: CellEditingHookProps) => {
|
|
6
|
-
onBlur: FocusEventHandler
|
|
6
|
+
onBlur: FocusEventHandler;
|
|
7
7
|
onDoubleClick: (e: MouseEvent<HTMLElement>) => void;
|
|
8
|
-
onFocus: FocusEventHandler
|
|
8
|
+
onFocus: FocusEventHandler;
|
|
9
9
|
onKeyDown: (e: ReactKeyboardEvent<HTMLElement>) => void;
|
|
10
10
|
};
|
|
@@ -2,6 +2,6 @@ import { KeyboardEventHandler } from "react";
|
|
|
2
2
|
export declare const useControlledTableNavigation: (initialValue: number, rowCount: number) => {
|
|
3
3
|
highlightedIndexRef: import("react").MutableRefObject<number | undefined>;
|
|
4
4
|
onHighlight: (idx: number) => void;
|
|
5
|
-
onKeyDown: KeyboardEventHandler
|
|
5
|
+
onKeyDown: KeyboardEventHandler;
|
|
6
6
|
tableRef: import("react").RefObject<HTMLDivElement>;
|
|
7
7
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
rowHeight: number;
|
|
8
|
+
rowRef: RefCallback<HTMLDivElement>;
|
|
9
|
+
};
|
|
10
|
+
export {};
|
package/types/useTable.d.ts
CHANGED
|
@@ -6,30 +6,31 @@ import { FocusEvent, KeyboardEvent, RefObject } from "react";
|
|
|
6
6
|
import { TableProps } from "./Table";
|
|
7
7
|
export interface TableHookProps extends MeasuredProps, Pick<TableProps, "allowDragDrop" | "availableColumns" | "config" | "dataSource" | "disableFocus" | "highlightedIndex" | "id" | "navigationStyle" | "onAvailableColumnsChange" | "onConfigChange" | "onDragStart" | "onDrop" | "onFeatureInvocation" | "onHighlight" | "onSelect" | "onSelectionChange" | "onRowClick" | "renderBufferSize" | "scrollingApiRef"> {
|
|
8
8
|
containerRef: RefObject<HTMLDivElement>;
|
|
9
|
-
headerHeight: number;
|
|
10
9
|
rowHeight: number;
|
|
11
10
|
selectionModel: TableSelectionModel;
|
|
12
11
|
size: MeasuredSize;
|
|
13
12
|
}
|
|
14
|
-
export declare const useTable: ({ allowDragDrop, availableColumns, config, containerRef, dataSource, disableFocus,
|
|
13
|
+
export declare const useTable: ({ allowDragDrop, availableColumns, config, containerRef, dataSource, disableFocus, highlightedIndex: highlightedIndexProp, id, navigationStyle, onAvailableColumnsChange, onConfigChange, onDragStart, onDrop, onFeatureInvocation, onHighlight, onRowClick: onRowClickProp, onSelect, onSelectionChange, renderBufferSize, rowHeight, scrollingApiRef, selectionModel, size, }: TableHookProps) => {
|
|
15
14
|
"aria-rowcount": number;
|
|
16
15
|
rowClassNameGenerator: import("@vuu-ui/vuu-utils").RowClassNameGenerator | undefined;
|
|
17
16
|
draggableRow: JSX.Element | undefined;
|
|
18
|
-
onBlur: import("react").FocusEventHandler
|
|
17
|
+
onBlur: import("react").FocusEventHandler;
|
|
19
18
|
onDoubleClick: (e: import("react").MouseEvent<HTMLElement, MouseEvent>) => void;
|
|
20
19
|
onFocus: (e: FocusEvent<HTMLElement>) => void;
|
|
21
20
|
onKeyDown: (e: KeyboardEvent<HTMLElement>) => void;
|
|
22
|
-
onMouseDown: import("react").MouseEventHandler
|
|
21
|
+
onMouseDown: import("react").MouseEventHandler | undefined;
|
|
23
22
|
columnMap: import("@vuu-ui/vuu-utils").ColumnMap;
|
|
24
23
|
columns: RuntimeColumnDescriptor[];
|
|
25
24
|
data: DataSourceRow[];
|
|
26
25
|
getRowOffset: import("@vuu-ui/vuu-utils").RowOffsetFunc;
|
|
27
26
|
handleContextMenuAction: import("@vuu-ui/vuu-data-types").MenuActionHandler;
|
|
27
|
+
headerHeight: number;
|
|
28
28
|
headings: import("@vuu-ui/vuu-table-types").TableHeadings;
|
|
29
29
|
highlightedIndex: number | undefined;
|
|
30
|
-
menuBuilder: import("@vuu-ui/vuu-data-types").MenuBuilder
|
|
30
|
+
menuBuilder: import("@vuu-ui/vuu-data-types").MenuBuilder;
|
|
31
31
|
onContextMenu: (evt: import("react").MouseEvent<HTMLElement, MouseEvent>) => void;
|
|
32
32
|
onDataEdited: DataCellEditHandler;
|
|
33
|
+
onHeaderHeightMeasured: (height: number) => void;
|
|
33
34
|
onMoveColumn: (columns: ColumnDescriptor[]) => void;
|
|
34
35
|
onMoveGroupColumn: (columns: ColumnDescriptor[]) => void;
|
|
35
36
|
onRemoveGroupColumn: (column: RuntimeColumnDescriptor) => void;
|
|
@@ -3,13 +3,12 @@
|
|
|
3
3
|
* and virtualisation of the table. This includes measurements required
|
|
4
4
|
* to support pinned columns.
|
|
5
5
|
*/
|
|
6
|
-
import { RuntimeColumnDescriptor
|
|
6
|
+
import { RuntimeColumnDescriptor } from "@vuu-ui/vuu-table-types";
|
|
7
7
|
import { MeasuredSize } from "@vuu-ui/vuu-ui-controls";
|
|
8
8
|
import { RowAtPositionFunc, RowOffsetFunc } from "@vuu-ui/vuu-utils";
|
|
9
9
|
export interface TableViewportHookProps {
|
|
10
10
|
columns: RuntimeColumnDescriptor[];
|
|
11
11
|
headerHeight: number;
|
|
12
|
-
headings: TableHeadings;
|
|
13
12
|
rowCount: number;
|
|
14
13
|
rowHeight: number;
|
|
15
14
|
/**
|
|
@@ -38,4 +37,4 @@ export interface TableViewportHookResult extends ViewportMeasurements {
|
|
|
38
37
|
setInSituRowOffset: (rowIndexOffset: number) => void;
|
|
39
38
|
setScrollTop: (scrollTop: number, scrollPct: number) => void;
|
|
40
39
|
}
|
|
41
|
-
export declare const useTableViewport: ({ columns, headerHeight,
|
|
40
|
+
export declare const useTableViewport: ({ columns, headerHeight, rowCount, rowHeight, selectionEndSize, size, }: TableViewportHookProps) => TableViewportHookResult;
|
package/cjs/useRowHeight.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useRowHeight.js","sources":["../src/useRowHeight.ts"],"sourcesContent":["import { isValidNumber } from \"@vuu-ui/vuu-utils\";\nimport { RefCallback, useCallback, useMemo, useRef, useState } from \"react\";\n\ninterface RowHeightHookProps {\n rowHeight?: number;\n}\n\nexport const useRowHeight = ({\n rowHeight: rowHeightProp = 0,\n}: RowHeightHookProps) => {\n const [rowHeight, setRowHeight] = useState(rowHeightProp);\n const heightRef = useRef(rowHeight);\n\n const resizeObserver = useMemo(() => {\n return new ResizeObserver((entries: ResizeObserverEntry[]) => {\n for (const entry of entries) {\n const [{ blockSize: measuredSize }] = entry.borderBoxSize;\n const newHeight = Math.round(measuredSize);\n if (isValidNumber(newHeight) && heightRef.current !== newHeight) {\n heightRef.current = newHeight;\n setRowHeight(newHeight);\n }\n }\n });\n }, []);\n\n const rowRef = useCallback<RefCallback<HTMLDivElement>>(\n (el) => {\n if (el) {\n if (rowHeightProp === 0) {\n const { height } = el.getBoundingClientRect();\n console.log({ boundingClientHeight: height });\n console.log(`measured rowHeight = ${height} (${rowHeightProp})`);\n resizeObserver.observe(el);\n setRowHeight(height);\n }\n } else {\n resizeObserver.disconnect();\n }\n },\n [resizeObserver, rowHeightProp]\n );\n\n return { rowHeight, rowRef };\n};\n"],"names":["useState","useRef","useMemo","isValidNumber","useCallback"],"mappings":";;;;;AAOO,MAAM,eAAe,CAAC;AAAA,EAC3B,WAAW,aAAgB,GAAA,CAAA;AAC7B,CAA0B,KAAA;AACxB,EAAA,MAAM,CAAC,SAAA,EAAW,YAAY,CAAA,GAAIA,eAAS,aAAa,CAAA,CAAA;AACxD,EAAM,MAAA,SAAA,GAAYC,aAAO,SAAS,CAAA,CAAA;AAElC,EAAM,MAAA,cAAA,GAAiBC,cAAQ,MAAM;AACnC,IAAO,OAAA,IAAI,cAAe,CAAA,CAAC,OAAmC,KAAA;AAC5D,MAAA,KAAA,MAAW,SAAS,OAAS,EAAA;AAC3B,QAAA,MAAM,CAAC,EAAE,SAAA,EAAW,YAAa,EAAC,IAAI,KAAM,CAAA,aAAA,CAAA;AAC5C,QAAM,MAAA,SAAA,GAAY,IAAK,CAAA,KAAA,CAAM,YAAY,CAAA,CAAA;AACzC,QAAA,IAAIC,sBAAc,CAAA,SAAS,CAAK,IAAA,SAAA,CAAU,YAAY,SAAW,EAAA;AAC/D,UAAA,SAAA,CAAU,OAAU,GAAA,SAAA,CAAA;AACpB,UAAA,YAAA,CAAa,SAAS,CAAA,CAAA;AAAA,SACxB;AAAA,OACF;AAAA,KACD,CAAA,CAAA;AAAA,GACH,EAAG,EAAE,CAAA,CAAA;AAEL,EAAA,MAAM,MAAS,GAAAC,iBAAA;AAAA,IACb,CAAC,EAAO,KAAA;AACN,MAAA,IAAI,EAAI,EAAA;AACN,QAAA,IAAI,kBAAkB,CAAG,EAAA;AACvB,UAAA,MAAM,EAAE,MAAA,EAAW,GAAA,EAAA,CAAG,qBAAsB,EAAA,CAAA;AAC5C,UAAA,OAAA,CAAQ,GAAI,CAAA,EAAE,oBAAsB,EAAA,MAAA,EAAQ,CAAA,CAAA;AAC5C,UAAA,OAAA,CAAQ,GAAI,CAAA,CAAA,qBAAA,EAAwB,MAAM,CAAA,EAAA,EAAK,aAAa,CAAG,CAAA,CAAA,CAAA,CAAA;AAC/D,UAAA,cAAA,CAAe,QAAQ,EAAE,CAAA,CAAA;AACzB,UAAA,YAAA,CAAa,MAAM,CAAA,CAAA;AAAA,SACrB;AAAA,OACK,MAAA;AACL,QAAA,cAAA,CAAe,UAAW,EAAA,CAAA;AAAA,OAC5B;AAAA,KACF;AAAA,IACA,CAAC,gBAAgB,aAAa,CAAA;AAAA,GAChC,CAAA;AAEA,EAAO,OAAA,EAAE,WAAW,MAAO,EAAA,CAAA;AAC7B;;;;"}
|
package/esm/useRowHeight.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useRowHeight.js","sources":["../src/useRowHeight.ts"],"sourcesContent":["import { isValidNumber } from \"@vuu-ui/vuu-utils\";\nimport { RefCallback, useCallback, useMemo, useRef, useState } from \"react\";\n\ninterface RowHeightHookProps {\n rowHeight?: number;\n}\n\nexport const useRowHeight = ({\n rowHeight: rowHeightProp = 0,\n}: RowHeightHookProps) => {\n const [rowHeight, setRowHeight] = useState(rowHeightProp);\n const heightRef = useRef(rowHeight);\n\n const resizeObserver = useMemo(() => {\n return new ResizeObserver((entries: ResizeObserverEntry[]) => {\n for (const entry of entries) {\n const [{ blockSize: measuredSize }] = entry.borderBoxSize;\n const newHeight = Math.round(measuredSize);\n if (isValidNumber(newHeight) && heightRef.current !== newHeight) {\n heightRef.current = newHeight;\n setRowHeight(newHeight);\n }\n }\n });\n }, []);\n\n const rowRef = useCallback<RefCallback<HTMLDivElement>>(\n (el) => {\n if (el) {\n if (rowHeightProp === 0) {\n const { height } = el.getBoundingClientRect();\n console.log({ boundingClientHeight: height });\n console.log(`measured rowHeight = ${height} (${rowHeightProp})`);\n resizeObserver.observe(el);\n setRowHeight(height);\n }\n } else {\n resizeObserver.disconnect();\n }\n },\n [resizeObserver, rowHeightProp]\n );\n\n return { rowHeight, rowRef };\n};\n"],"names":[],"mappings":";;;AAOO,MAAM,eAAe,CAAC;AAAA,EAC3B,WAAW,aAAgB,GAAA,CAAA;AAC7B,CAA0B,KAAA;AACxB,EAAA,MAAM,CAAC,SAAA,EAAW,YAAY,CAAA,GAAI,SAAS,aAAa,CAAA,CAAA;AACxD,EAAM,MAAA,SAAA,GAAY,OAAO,SAAS,CAAA,CAAA;AAElC,EAAM,MAAA,cAAA,GAAiB,QAAQ,MAAM;AACnC,IAAO,OAAA,IAAI,cAAe,CAAA,CAAC,OAAmC,KAAA;AAC5D,MAAA,KAAA,MAAW,SAAS,OAAS,EAAA;AAC3B,QAAA,MAAM,CAAC,EAAE,SAAA,EAAW,YAAa,EAAC,IAAI,KAAM,CAAA,aAAA,CAAA;AAC5C,QAAM,MAAA,SAAA,GAAY,IAAK,CAAA,KAAA,CAAM,YAAY,CAAA,CAAA;AACzC,QAAA,IAAI,aAAc,CAAA,SAAS,CAAK,IAAA,SAAA,CAAU,YAAY,SAAW,EAAA;AAC/D,UAAA,SAAA,CAAU,OAAU,GAAA,SAAA,CAAA;AACpB,UAAA,YAAA,CAAa,SAAS,CAAA,CAAA;AAAA,SACxB;AAAA,OACF;AAAA,KACD,CAAA,CAAA;AAAA,GACH,EAAG,EAAE,CAAA,CAAA;AAEL,EAAA,MAAM,MAAS,GAAA,WAAA;AAAA,IACb,CAAC,EAAO,KAAA;AACN,MAAA,IAAI,EAAI,EAAA;AACN,QAAA,IAAI,kBAAkB,CAAG,EAAA;AACvB,UAAA,MAAM,EAAE,MAAA,EAAW,GAAA,EAAA,CAAG,qBAAsB,EAAA,CAAA;AAC5C,UAAA,OAAA,CAAQ,GAAI,CAAA,EAAE,oBAAsB,EAAA,MAAA,EAAQ,CAAA,CAAA;AAC5C,UAAA,OAAA,CAAQ,GAAI,CAAA,CAAA,qBAAA,EAAwB,MAAM,CAAA,EAAA,EAAK,aAAa,CAAG,CAAA,CAAA,CAAA,CAAA;AAC/D,UAAA,cAAA,CAAe,QAAQ,EAAE,CAAA,CAAA;AACzB,UAAA,YAAA,CAAa,MAAM,CAAA,CAAA;AAAA,SACrB;AAAA,OACK,MAAA;AACL,QAAA,cAAA,CAAe,UAAW,EAAA,CAAA;AAAA,OAC5B;AAAA,KACF;AAAA,IACA,CAAC,gBAAgB,aAAa,CAAA;AAAA,GAChC,CAAA;AAEA,EAAO,OAAA,EAAE,WAAW,MAAO,EAAA,CAAA;AAC7B;;;;"}
|
package/types/useRowHeight.d.ts
DELETED