@vuu-ui/vuu-table 1.0.2 → 2.0.0-alpha.1

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/package.json CHANGED
@@ -1,22 +1,22 @@
1
1
  {
2
- "version": "1.0.2",
2
+ "version": "2.0.0-alpha.1",
3
3
  "author": "heswell",
4
4
  "license": "Apache-2.0",
5
5
  "devDependencies": {
6
- "@vuu-ui/vuu-data-types": "1.0.2",
7
- "@vuu-ui/vuu-table-types": "1.0.2",
8
- "@vuu-ui/vuu-protocol-types": "1.0.2"
6
+ "@vuu-ui/vuu-data-types": "2.0.0-alpha.1",
7
+ "@vuu-ui/vuu-table-types": "2.0.0-alpha.1",
8
+ "@vuu-ui/vuu-protocol-types": "2.0.0-alpha.1"
9
9
  },
10
10
  "dependencies": {
11
11
  "@salt-ds/core": "1.54.1",
12
12
  "@salt-ds/styles": "0.2.1",
13
13
  "@salt-ds/window": "0.1.1",
14
- "@vuu-ui/vuu-context-menu": "1.0.2",
15
- "@vuu-ui/vuu-data-react": "1.0.2",
16
- "@vuu-ui/vuu-popups": "1.0.2",
17
- "@vuu-ui/vuu-table-extras": "1.0.2",
18
- "@vuu-ui/vuu-ui-controls": "1.0.2",
19
- "@vuu-ui/vuu-utils": "1.0.2"
14
+ "@vuu-ui/vuu-context-menu": "2.0.0-alpha.1",
15
+ "@vuu-ui/vuu-data-react": "2.0.0-alpha.1",
16
+ "@vuu-ui/vuu-popups": "2.0.0-alpha.1",
17
+ "@vuu-ui/vuu-table-extras": "2.0.0-alpha.1",
18
+ "@vuu-ui/vuu-ui-controls": "2.0.0-alpha.1",
19
+ "@vuu-ui/vuu-utils": "2.0.0-alpha.1"
20
20
  },
21
21
  "peerDependencies": {
22
22
  "clsx": "^2.0.0",
package/types/Table.d.ts CHANGED
@@ -41,10 +41,6 @@ export interface TableProps extends Omit<MeasuredContainerProps, "onDragStart" |
41
41
  * if provided, row with matching key will be selected. If not present, will silently fail.
42
42
  */
43
43
  autoSelectRowKey?: string;
44
- /**
45
- * required if a fully featured column picker is to be available
46
- */
47
- availableColumns?: readonly SchemaColumn[];
48
44
  /**
49
45
  * Pixel height of header cells. If specified here, this will take precedence over CSS
50
46
  * values and Table will not respond to density changes.
package/types/index.d.ts CHANGED
@@ -7,6 +7,7 @@ export { Row } from "./Row";
7
7
  export * from "./Table";
8
8
  export * from "./table-cell";
9
9
  export * from "./table-config";
10
+ export { useTableConfig } from "./table-config/useTableConfig";
10
11
  export * from "./table-header";
11
12
  export * from "./useControlledTableNavigation";
12
13
  export * from "./useEditableCell";
@@ -0,0 +1,16 @@
1
+ import { ColumnModel, TableDisplayAttributeChangeHandler } from "@vuu-ui/vuu-table-extras";
2
+ import { TableConfig } from "@vuu-ui/vuu-table-types";
3
+ import { TableProps } from "../Table";
4
+ import type { ColumnDescriptor, TableConfigChangeHandler } from "@vuu-ui/vuu-table-types";
5
+ import { DataSource } from "@vuu-ui/vuu-data-types";
6
+ export interface TableConfigHookProps extends Pick<TableProps, "config"> {
7
+ availableColumns: readonly ColumnDescriptor[];
8
+ dataSource: DataSource;
9
+ onTableConfigChange?: TableConfigChangeHandler;
10
+ }
11
+ export declare const useTableConfig: ({ availableColumns, config: initialTableConfig, dataSource, onTableConfigChange, }: TableConfigHookProps) => {
12
+ columnModel: ColumnModel;
13
+ onTableDisplayAttributeChange: TableDisplayAttributeChangeHandler;
14
+ onTableConfigChange: TableConfigChangeHandler;
15
+ tableConfig: TableConfig;
16
+ };
@@ -1,5 +1,5 @@
1
1
  import { KeyboardEventHandler } from "react";
2
- export declare const isRowSelectionKey: (key: string) => key is "Enter" | " ";
2
+ export declare const isRowSelectionKey: (key: string) => key is " " | "Enter";
3
3
  export declare const useControlledTableNavigation: (initialValue: number, rowCount: number) => {
4
4
  highlightedIndexRef: import("react").RefObject<number | undefined>;
5
5
  onHighlight: (idx: number) => void;
@@ -7,13 +7,13 @@ type HeaderState = {
7
7
  height: number;
8
8
  count: number;
9
9
  };
10
- export interface TableHookProps extends MeasuredProps, Pick<TableProps, "allowCellBlockSelection" | "allowDragDrop" | "allowSelectCheckboxRow" | "autoSelectFirstRow" | "autoSelectRowKey" | "availableColumns" | "config" | "dataSource" | "disableFocus" | "highlightedIndex" | "id" | "navigationStyle" | "onAvailableColumnsChange" | "onConfigChange" | "onDataEdited" | "onDragStart" | "onDrop" | "onHighlight" | "onSelect" | "onSelectCellBlock" | "onSelectionChange" | "onRowClick" | "renderBufferSize" | "revealSelected" | "scrollingApiRef" | "showColumnHeaderMenus" | "showColumnHeaders" | "showPaginationControls"> {
10
+ export interface TableHookProps extends MeasuredProps, Pick<TableProps, "allowCellBlockSelection" | "allowDragDrop" | "allowSelectCheckboxRow" | "autoSelectFirstRow" | "autoSelectRowKey" | "config" | "dataSource" | "disableFocus" | "highlightedIndex" | "id" | "navigationStyle" | "onConfigChange" | "onDataEdited" | "onDragStart" | "onDrop" | "onHighlight" | "onSelect" | "onSelectCellBlock" | "onSelectionChange" | "onRowClick" | "renderBufferSize" | "revealSelected" | "scrollingApiRef" | "showColumnHeaders" | "showPaginationControls"> {
11
11
  containerRef: RefObject<HTMLDivElement | null>;
12
12
  rowHeight: number;
13
13
  selectionModel: TableSelectionModel;
14
14
  size: MeasuredSize;
15
15
  }
16
- export declare const useTable: ({ allowCellBlockSelection, allowSelectCheckboxRow, allowDragDrop, autoSelectFirstRow, autoSelectRowKey, availableColumns, config, containerRef, dataSource, disableFocus, highlightedIndex: highlightedIndexProp, id, navigationStyle, onAvailableColumnsChange, onConfigChange, onDataEdited: onDataEditedProp, onDragStart, onDrop, onHighlight, onRowClick: onRowClickProp, onSelect, onSelectCellBlock, onSelectionChange, renderBufferSize, revealSelected, rowHeight, scrollingApiRef, selectionModel, showColumnHeaderMenus, showColumnHeaders, showPaginationControls, size, }: TableHookProps) => {
16
+ export declare const useTable: ({ allowCellBlockSelection, allowSelectCheckboxRow, allowDragDrop, autoSelectFirstRow, autoSelectRowKey, config, containerRef, dataSource, disableFocus, highlightedIndex: highlightedIndexProp, id, navigationStyle, onConfigChange, onDataEdited: onDataEditedProp, onDragStart, onDrop, onHighlight, onRowClick: onRowClickProp, onSelect, onSelectCellBlock, onSelectionChange, renderBufferSize, revealSelected, rowHeight, scrollingApiRef, selectionModel, showColumnHeaders, showPaginationControls, size, }: TableHookProps) => {
17
17
  allRowsSelected: boolean;
18
18
  "aria-rowcount": number;
19
19
  cellBlock: import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | null;
@@ -1,11 +1,11 @@
1
1
  import { DataSource, TableSchema, WithBaseFilter, WithFullConfig } from "@vuu-ui/vuu-data-types";
2
- import { ColumnDescriptor, ColumnLayout, ResizePhase, RuntimeColumnDescriptor, TableAttributes, TableConfig, TableHeadings, TableSelectionModel } from "@vuu-ui/vuu-table-types";
2
+ import { ColumnDescriptor, ColumnLayout, ResizePhase, RuntimeColumnDescriptor, TableDisplayAttributes, TableConfig, TableHeadings, TableSelectionModel } from "@vuu-ui/vuu-table-types";
3
3
  /**
4
4
  * TableModel represents state used internally to manage Table. It is
5
5
  * derived initially from the TableConfig provided by user, along with the
6
6
  * data-related config from DataSource.
7
7
  */
8
- export interface TableModel extends TableAttributes {
8
+ export interface TableModel extends TableDisplayAttributes {
9
9
  columns: RuntimeColumnDescriptor[];
10
10
  headings: TableHeadings;
11
11
  }