Skip to content

Commit

Permalink
feat: UI.Table density prop
Browse files Browse the repository at this point in the history
  • Loading branch information
mattrunyon committed Jul 17, 2024
1 parent e56424c commit 82256aa
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions plugins/ui/src/deephaven/ui/components/table.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from __future__ import annotations
from typing import Literal

from deephaven.table import Table
from ..elements import UITable
Expand Down Expand Up @@ -31,6 +32,7 @@ def table(
frozen_columns: list[ColumnName] | None = None,
hidden_columns: list[ColumnName] | None = None,
column_groups: list[ColumnGroup] | None = None,
density: Literal["compact", "normal", "spacious"] | None = None,
context_menu: (
ResolvableContextMenuItem | list[ResolvableContextMenuItem] | None
) = None,
Expand Down Expand Up @@ -70,6 +72,8 @@ def table(
column_groups: Columns to group together by default. The groups will be shown in the table header.
Group names must be unique within the column and group names.
Groups may be nested by providing the group name as a child of another group.
density: The density of the data displayed in the table.
One of "compact", "normal", or "spacious".
context_menu: The context menu items to show when a cell is right clicked.
May contain action items or submenu items.
May also be a function that receives the cell data and returns the context menu items or None.
Expand Down
3 changes: 3 additions & 0 deletions plugins/ui/src/js/src/elements/UITable/UITable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export function UITable({
frozenColumns,
hiddenColumns,
columnGroups,
density,
contextMenu,
contextHeaderMenu,
}: UITableProps): JSX.Element | null {
Expand Down Expand Up @@ -170,6 +171,7 @@ export function UITable({
reverseType: reverse
? TableUtils.REVERSE_TYPE.POST_SORT
: TableUtils.REVERSE_TYPE.NONE,
density,
settings,
onContextMenu,
}) satisfies Partial<IrisGridProps>,
Expand All @@ -181,6 +183,7 @@ export function UITable({
hydratedSorts,
hydratedQuickFilters,
reverse,
density,
settings,
onContextMenu,
]
Expand Down
1 change: 1 addition & 0 deletions plugins/ui/src/js/src/elements/UITable/UITableUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export type UITableProps = {
frozenColumns?: string[];
hiddenColumns?: string[];
columnGroups?: dh.ColumnGroup[];
density?: 'compact' | 'normal' | 'spacious';
contextMenu?: ResolvableUIContextItem | ResolvableUIContextItem[];
contextHeaderMenu?: ResolvableUIContextItem | ResolvableUIContextItem[];
};
Expand Down

0 comments on commit 82256aa

Please sign in to comment.