Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

feat: unify row viewer and column explorer (#8905)

Kiran Gadhave9d64f844f06f
diff --git a/frontend/src/components/data-table/TableActions.tsx b/frontend/src/components/data-table/TableActions.tsx
index 26ce464e0b..bb956e6c08 100644
--- a/frontend/src/components/data-table/TableActions.tsx
+++ b/frontend/src/components/data-table/TableActions.tsx
@@ -2,17 +2,15 @@
"use no memo";
import type { RowSelectionState, Table } from "@tanstack/react-table";
-import {
- ChartColumnStacked,
- ChartSplineIcon,
- PanelRightIcon,
- SearchIcon,
-} from "lucide-react";
+import { ChartSplineIcon, PanelRightIcon, SearchIcon } from "lucide-react";
import React from "react";
import { useLocale } from "react-aria";
import type { GetRowIds } from "@/plugins/impl/DataTablePlugin";
import { cn } from "@/utils/cn";
-import type { PanelType } from "../editor/chrome/panels/context-aware-panel/context-aware-panel";
+import {
+ PANEL_TYPES,
+ type PanelType,
+} from "../editor/chrome/panels/context-aware-panel/context-aware-panel";
import { Button } from "../ui/button";
import { Tooltip } from "../ui/tooltip";
import { toast } from "../ui/use-toast";
@@ -35,11 +33,10 @@ interface TableActionsProps<TData> {
getRowIds?: GetRowIds;
toggleDisplayHeader?: () => void;
showChartBuilder?: boolean;
- showColumnExplorer?: boolean;
- showRowExplorer?: boolean;
+ showTableExplorer?: boolean;
showPageSizeSelector?: boolean;
togglePanel?: (panelType: PanelType) => void;
- isPanelOpen?: (panelType: PanelType) => boolean;
+ isAnyPanelOpen?: boolean;
tableLoading?: boolean;
}
@@ -58,11 +55,10 @@ export const TableActions = <TData,>({
getRowIds,
toggleDisplayHeader,
showChartBuilder,
- showColumnExplorer,
- showRowExplorer,
+ showTableExplorer,
showPageSizeSelector,
togglePanel,
- isPanelOpen,
+ isAnyPanelOpen,
tableLoading,
}: TableActionsProps<TData>) => {
const { locale } = useLocale();
@@ -136,43 +132,22 @@ export const TableActions = <TData,>({
</Button>
</Tooltip>
)}
- {togglePanel && isPanelOpen !== undefined && (
- <>
- {showRowExplorer && (
- <Tooltip content="Toggle row viewer">
- <Button
- variant="text"
- size="xs"
- onClick={() => togglePanel("row-viewer")}
- className="print:hidden"
- >
- <PanelRightIcon
- className={cn(
- "w-4 h-4 text-muted-foreground",
- isPanelOpen("row-viewer") && "text-primary",
- )}
- />
- </Button>
- </Tooltip>
- )}
- {showColumnExplorer && (
- <Tooltip content="Toggle column explorer">
- <Button
- variant="text"
- size="xs"
- onClick={() => togglePanel("column-explorer")}
- className="print:hidden"
- >
- <ChartColumnStacked
- className={cn(
- "w-4 h-4 text-muted-foreground",
- isPanelOpen("column-explorer") && "text-primary",
- )}
- />
- </Button>
- </Tooltip>
- )}
- </>
+ {showTableExplorer && togglePanel && (
+ <Tooltip content="Toggle table explorer">
+ <Button
+ variant="text"
+ size="xs"
+ onClick={() => togglePanel(PANEL_TYPES.ROW_VIEWER)}
+ className="print:hidden"
+ >
+ <PanelRightIcon
+ className={cn(
+ "w-4 h-4 text-muted-foreground",
+ isAnyPanelOpen && "text-primary",
+ )}
+ />
+ </Button>
+ </Tooltip>
)}
{pagination ? (
diff --git a/frontend/src/components/data-table/column-explorer-panel/column-explorer.tsx b/frontend/src/components/data-table/column-explorer-panel/column-explorer.tsx
index 9cb0163104..deceb030ea 100644
--- a/frontend/src/components/data-table/column-explorer-panel/column-explorer.tsx
+++ b/frontend/src/components/data-table/column-explorer-panel/column-explorer.tsx
@@ -1,5 +1,6 @@
/* Copyright 2026 Marimo. All rights reserved. */
+import { ChevronDownIcon, ChevronRightIcon } from "lucide-react";
import { useState } from "react";
import { useLocale } from "react-aria";
import {
@@ -88,18 +89,21 @@ export const ColumnExplorerPanel = ({
/>
<CommandList className="max-h-full">
<CommandEmpty>No results.</CommandEmpty>
- {filteredColumns?.map(([columnName, [dataType, externalType]]) => {
- return (
- <ColumnItem
- // Tables may have the same column names, hence we use tableId to make it unique
- key={`${tableId}-${columnName}`}
- columnName={columnName}
- dataType={dataType}
- externalType={externalType}
- previewColumn={previewColumn}
- />
- );
- })}
+ {filteredColumns?.map(
+ ([columnName, [dataType, externalType]], index) => {
+ return (
+ <ColumnItem
+ // Tables may have the same column names, hence we use tableId to make it unique
+ key={`${tableId}-${columnName}`}
+ columnName={columnName}
+ dataType={dataType}
+ externalType={externalType}
+ previewColumn={previewColumn}
+ defaultExpanded={index === 0}
+ />
+ );
+ },
+ )}
</CommandList>
</Command>
</div>
@@ -111,13 +115,15 @@ const ColumnItem = ({
dataType,
externalType,
previewColumn,
+ defaultExpanded = false,
}: {
columnName: string;
dataType: DataType;
externalType: string;
previewColumn: PreviewColumn;
+ defaultExpanded?: boolean;
}) => {
- const [isExpanded, setIsExpanded] = useState(false);
+ const [isExpanded, setIsExpanded] = useState(defaultExpanded);
const columnText = (
<span className={isExpanded ? "font-semibold" : ""}>{columnName}</span>
@@ -130,6 +136,11 @@ const ColumnItem = ({
onSelect={() => setIsExpanded(!isExpanded)}
className="flex flex-row items-center gap-1.5 group w-full cursor-pointer"
>
+ {isExpanded ? (
+ <ChevronDownIcon className="w-3 h-3 shrink-0 text-muted-foreground" />
+ ) : (
+ <ChevronRightIcon className="w-3 h-3 shrink-0 text-muted-foreground" />
+ )}
<ColumnName columnName={columnText} dataType={dataType} />
<div className="ml-auto">
<Tooltip content="Copy column name" delayDuration={400}>
diff --git a/frontend/src/components/data-table/data-table.tsx b/frontend/src/components/data-table/data-table.tsx
index f471b2b944..8d170ac38e 100644
--- a/frontend/src/components/data-table/data-table.tsx
+++ b/frontend/src/components/data-table/data-table.tsx
@@ -24,7 +24,10 @@ import { useLocale } from "react-aria";
import { Table } from "@/components/ui/table";
import type { GetRowIds } from "@/plugins/impl/DataTablePlugin";
import { cn } from "@/utils/cn";
-import type { PanelType } from "../editor/chrome/panels/context-aware-panel/context-aware-panel";
+import {
+ PANEL_TYPES,
+ type PanelType,
+} from "../editor/chrome/panels/context-aware-panel/context-aware-panel";
import { CellHoverTemplateFeature } from "./cell-hover-template/feature";
import { CellHoverTextFeature } from "./cell-hover-text/feature";
import { CellSelectionFeature } from "./cell-selection/feature";
@@ -97,10 +100,10 @@ interface DataTableProps<TData> extends Partial<DownloadActionProps> {
// Others
showChartBuilder?: boolean;
showPageSizeSelector?: boolean;
- showColumnExplorer?: boolean;
- showRowExplorer?: boolean;
+ showTableExplorer?: boolean;
togglePanel?: (panelType: PanelType) => void;
isPanelOpen?: (panelType: PanelType) => boolean;
+ isAnyPanelOpen?: boolean;
}
const DataTableInternal = <TData,>({
@@ -142,10 +145,10 @@ const DataTableInternal = <TData,>({
toggleDisplayHeader,
showChartBuilder,
showPageSizeSelector,
- showColumnExplorer,
- showRowExplorer,
+ showTableExplorer,
togglePanel,
isPanelOpen,
+ isAnyPanelOpen,
viewedRowIdx,
onViewedRowChange,
}: DataTableProps<TData>) => {
@@ -272,7 +275,7 @@ const DataTableInternal = <TData,>({
},
});
- const rowViewerPanelOpen = isPanelOpen?.("row-viewer") ?? false;
+ const rowViewerPanelOpen = isPanelOpen?.(PANEL_TYPES.ROW_VIEWER) ?? false;
const virtualize = !pagination && data.length > MIN_ROWS_TO_VIRTUALIZE;
const tableRef = useScrollContainerHeight({ maxHeight, virtualize });
@@ -324,10 +327,9 @@ const DataTableInternal = <TData,>({
toggleDisplayHeader={toggleDisplayHeader}
showChartBuilder={showChartBuilder}
showPageSizeSelector={showPageSizeSelector}
- showColumnExplorer={showColumnExplorer}
- showRowExplorer={showRowExplorer}
+ showTableExplorer={showTableExplorer}
togglePanel={togglePanel}
- isPanelOpen={isPanelOpen}
+ isAnyPanelOpen={isAnyPanelOpen}
tableLoading={reloading}
/>
</div>
diff --git a/frontend/src/components/data-table/hooks/use-panel-ownership.ts b/frontend/src/components/data-table/hooks/use-panel-ownership.ts
index 0af4e9b79c..5a5894efca 100644
--- a/frontend/src/components/data-table/hooks/use-panel-ownership.ts
+++ b/frontend/src/components/data-table/hooks/use-panel-ownership.ts
@@ -13,7 +13,10 @@ import { Logger } from "@/utils/Logger";
interface PanelOwnershipResult {
isPanelOpen: (panelType: PanelType) => boolean;
- togglePanel: (panelType: PanelType) => void;
+ isAnyPanelOpen: boolean;
+ togglePanel: (panelType?: PanelType) => void;
+ panelType: PanelType | null;
+ setPanelType: (panelType: PanelType) => void;
}
export function usePanelOwnership(
@@ -55,24 +58,31 @@ export function usePanelOwnership(
setPanelOwner(panelId);
}
- function togglePanel(panelType: PanelType) {
- if (isPanelOpen(panelType)) {
+ const isAnyPanelOpen = panelOwner === panelId && isContextAwarePanelOpen;
+
+ function togglePanel(requestedType?: PanelType) {
+ if (isAnyPanelOpen) {
setPanelOwner(null);
setContextAwarePanelOpen(false);
} else {
setPanelOwner(panelId);
- // if cell-aware, we want to focus on this cell when toggled open
if (isPanelCellAware && cellId) {
focusCell({ cellId });
}
setContextAwarePanelOpen(true);
- setPanelType(panelType);
+ // Only set type if explicitly requested and no previous type exists
+ if (requestedType && !panelType) {
+ setPanelType(requestedType);
+ }
}
}
return {
isPanelOpen,
+ isAnyPanelOpen,
togglePanel,
+ panelType,
+ setPanelType,
};
}
diff --git a/frontend/src/components/data-table/row-viewer-panel/row-viewer.tsx b/frontend/src/components/data-table/row-viewer-panel/row-viewer.tsx
index 136669319d..8a202ed947 100644
--- a/frontend/src/components/data-table/row-viewer-panel/row-viewer.tsx
+++ b/frontend/src/components/data-table/row-viewer-panel/row-viewer.tsx
@@ -12,16 +12,16 @@ import {
ChevronsLeft,
ChevronsRight,
Info,
- SearchIcon,
} from "lucide-react";
-import { useRef, useState } from "react";
+import { type KeyboardEvent, useId, useRef, useState } from "react";
import { useLocale } from "react-aria";
import { ColumnName } from "@/components/datasources/components";
import { CopyClipboardIcon } from "@/components/icons/copy-icon";
import { Spinner } from "@/components/icons/spinner";
import { KeyboardHotkeys } from "@/components/shortcuts/renderShortcut";
import { Button } from "@/components/ui/button";
-import { Input } from "@/components/ui/input";
+import { Checkbox } from "@/components/ui/checkbox";
+import { Command, CommandInput } from "@/components/ui/command";
import {
Table,
TableBody,
@@ -32,7 +32,6 @@ import {
} from "@/components/ui/table";
import { DelayMount } from "@/components/utils/delay-mount";
import { useAsyncData } from "@/hooks/useAsyncData";
-import { useKeydownOnElement } from "@/hooks/useHotkey";
import { Banner, ErrorBanner } from "@/plugins/impl/common/error-banner";
import type { GetRowResult } from "@/plugins/impl/DataTablePlugin";
import { NAMELESS_COLUMN_PREFIX, renderCellValue } from "../columns";
@@ -68,7 +67,7 @@ export const RowViewerPanel: React.FC<RowViewerPanelProps> = ({
}: RowViewerPanelProps) => {
const [searchQuery, setSearchQuery] = useState("");
const panelRef = useRef<HTMLDivElement>(null);
- const searchInputRef = useRef<HTMLInputElement>(null);
+ const checkboxId = useId();
const { locale } = useLocale();
const tooManyRows = totalRows === TOO_MANY_ROWS;
@@ -102,26 +101,29 @@ export const RowViewerPanel: React.FC<RowViewerPanelProps> = ({
setRow(totalRows - 1);
}
- useKeydownOnElement(panelRef, {
- ArrowLeft: (e) => {
- if (e?.target === searchInputRef.current) {
- return false;
- }
- setRow(rowIdx - 1);
- },
- ArrowRight: (e) => {
- if (e?.target === searchInputRef.current) {
- return false;
- }
- setRow(rowIdx + 1);
- },
- Space: (e) => {
- if (e?.target === searchInputRef.current) {
- return false;
- }
- toggleRowSelection();
- },
- });
+ const handleKeyDown = (e: KeyboardEvent) => {
+ // Don't intercept keys when typing in an input
+ if (e.target instanceof HTMLInputElement) {
+ return;
+ }
+ switch (e.key) {
+ case "ArrowLeft":
+ setRow(rowIdx - 1);
+
+ break;
+
+ case "ArrowRight":
+ setRow(rowIdx + 1);
+
+ break;
+
+ case " ":
+ e.preventDefault();
+ toggleRowSelection();
+
+ break;
+ }
+ };
const buttonStyles = "h-6 w-6 p-0.5";
@@ -248,19 +250,29 @@ export const RowViewerPanel: React.FC<RowViewerPanelProps> = ({
className="flex flex-col gap-3 mt-4 focus:outline-hidden"
ref={panelRef}
tabIndex={-1}
+ onKeyDown={handleKeyDown}
>
- <div className="flex flex-row gap-2 items-center mr-2">
+ <div className="flex flex-row gap-2 items-center mr-2 px-2">
{isSelectable && (
- <div className="flex flex-row gap-1 items-center">
- <Button
- variant="link"
- size="xs"
- className="pr-0"
- onClick={toggleRowSelection}
- >
- {isRowSelected ? "Deselect row" : "Select row"}
- </Button>
- <KeyboardHotkeys shortcut="Space" />
+ <div
+ className="flex items-center"
+ title="Select/unselect the current row"
+ >
+ <div className="flex items-center gap-1.5">
+ <Checkbox
+ id={checkboxId}
+ checked={isRowSelected}
+ onCheckedChange={toggleRowSelection}
+ className="h-3.5 w-3.5"
+ />
+ <label
+ htmlFor={checkboxId}
+ className="text-xs text-muted-foreground cursor-pointer"
+ >
+ Select
+ </label>
+ </div>
+ <KeyboardHotkeys shortcut="Space" className="scale-75" />
</div>
)}
@@ -315,17 +327,14 @@ export const RowViewerPanel: React.FC<RowViewerPanelProps> = ({
</Button>
</div>
- <div className="mx-2 -mb-1">
- <Input
- ref={searchInputRef}
- type="text"
+ <Command className="bg-background" shouldFilter={false}>
+ <CommandInput
placeholder="Search"
- onChange={(e) => setSearchQuery(e.target.value)}
- icon={<SearchIcon className="w-4 h-4" />}
- className="mb-0 border-border"
+ value={searchQuery}
+ onValueChange={setSearchQuery}
data-testid="selection-panel-search-input"
/>
- </div>
+ </Command>
{renderTable()}
</div>
);
diff --git a/frontend/src/components/data-table/table-explorer-panel/table-explorer-panel.tsx b/frontend/src/components/data-table/table-explorer-panel/table-explorer-panel.tsx
new file mode 100644
index 0000000000..d3bb0ab79f
--- /dev/null
+++ b/frontend/src/components/data-table/table-explorer-panel/table-explorer-panel.tsx
@@ -0,0 +1,161 @@
+/* Copyright 2026 Marimo. All rights reserved. */
+
+import { Fill } from "@marimo-team/react-slotz";
+import type { OnChangeFn, RowSelectionState } from "@tanstack/react-table";
+import type React from "react";
+import { Button } from "@/components/ui/button";
+import { Tabs, TabsContent } from "@/components/ui/tabs";
+import { SlotNames } from "@/core/slots/slots";
+import type {
+ GetRowResult,
+ PreviewColumn,
+} from "@/plugins/impl/DataTablePlugin";
+import { cn } from "@/utils/cn";
+import {
+ PANEL_TYPES,
+ type PanelType,
+} from "../../editor/chrome/panels/context-aware-panel/context-aware-panel";
+import { ColumnExplorerPanel } from "../column-explorer-panel/column-explorer";
+import { RowViewerPanel } from "../row-viewer-panel/row-viewer";
+import type { FieldTypesWithExternalType, TooManyRows } from "../types";
+
+export interface TableExplorerPanelProps {
+ // Row viewer props
+ rowIdx: number;
+ setRowIdx: (rowIdx: number) => void;
+ totalRows: number | TooManyRows;
+ fieldTypes: FieldTypesWithExternalType | undefined | null;
+ getRow: (rowIdx: number) => Promise<GetRowResult>;
+ isSelectable: boolean;
+ isRowSelected: boolean;
+ handleRowSelectionChange?: OnChangeFn<RowSelectionState>;
+ // Column explorer props
+ previewColumn?: PreviewColumn;
+ totalColumns: number;
+ tableId: string;
+ // Visibility flags
+ showRowExplorer: boolean;
+ showColumnExplorer: boolean;
+ // Tab state (driven by contextAwarePanelType atom)
+ activeTab: PanelType | null;
+ onTabChange: (tab: PanelType) => void;
+}
+
+const tabTriggerClassName =
+ "text-xs uppercase tracking-wide font-semibold cursor-pointer transition-colors";
+const activeClassName = "text-primary";
+const inactiveClassName = "hover:text-foreground";
+
+export const TableExplorerPanel: React.FC<TableExplorerPanelProps> = ({
+ // Row viewer
+ rowIdx,
+ setRowIdx,
+ totalRows,
+ fieldTypes,
+ getRow,
+ isSelectable,
+ isRowSelected,
+ handleRowSelectionChange,
+ // Column explorer
+ previewColumn,
+ totalColumns,
+ tableId,
+ // Visibility
+ showRowExplorer,
+ showColumnExplorer,
+ // Tab state
+ activeTab,
+ onTabChange,
+}) => {
+ const showTabs = showRowExplorer && showColumnExplorer;
+
+ const rowViewer = (
+ <RowViewerPanel
+ rowIdx={rowIdx}
+ setRowIdx={setRowIdx}
+ totalRows={totalRows}
+ fieldTypes={fieldTypes}
+ getRow={getRow}
+ isSelectable={isSelectable}
+ isRowSelected={isRowSelected}
+ handleRowSelectionChange={handleRowSelectionChange}
+ />
+ );
+
+ const columnExplorer = previewColumn && (
+ <ColumnExplorerPanel
+ previewColumn={previewColumn}
+ fieldTypes={fieldTypes}
+ totalRows={totalRows}
+ totalColumns={totalColumns}
+ tableId={tableId}
+ />
+ );
+
+ // If only one panel is visible, don't show tabs
+ if (!showTabs) {
+ if (showRowExplorer) {
+ return rowViewer;
+ }
+ if (showColumnExplorer) {
+ return columnExplorer;
+ }
+ return null;
+ }
+
+ // Resolve active tab — fall back to first available
+ const resolvedTab = activeTab ?? PANEL_TYPES.ROW_VIEWER;
+
+ return (
+ <Tabs
+ value={resolvedTab}
+ onValueChange={(value) => onTabChange(value as PanelType)}
+ className="h-full flex flex-col min-w-[350px]"
+ >
+ <Fill name={SlotNames.CONTEXT_AWARE_PANEL_HEADER}>
+ <div className="flex items-center gap-1">
+ <Button
+ variant="text"
+ size="xs"
+ onClick={() => onTabChange(PANEL_TYPES.ROW_VIEWER)}
+ className={cn(
+ tabTriggerClassName,
+ resolvedTab === PANEL_TYPES.ROW_VIEWER
+ ? activeClassName
+ : inactiveClassName,
+ )}
+ >
+ Rows
+ </Button>
+ <span className="text-muted-foreground text-xs">|</span>
+ <Button
+ variant="text"
+ size="xs"
+ onClick={() => onTabChange(PANEL_TYPES.COLUMN_EXPLORER)}
+ className={cn(
+ tabTriggerClassName,
+ resolvedTab === PANEL_TYPES.COLUMN_EXPLORER
+ ? activeClassName
+ : inactiveClassName,
+ )}
+ >
+ Explorer
+ </Button>
+ </div>
+ </Fill>
+
+ <TabsContent
+ value={PANEL_TYPES.ROW_VIEWER}
+ className="flex-1 overflow-auto"
+ >
+ {rowViewer}
+ </TabsContent>
+ <TabsContent
+ value={PANEL_TYPES.COLUMN_EXPLORER}
+ className="flex-1 overflow-auto"
+ >
+ {columnExplorer}
+ </TabsContent>
+ </Tabs>
+ );
+};
diff --git a/frontend/src/components/editor/chrome/panels/context-aware-panel/context-aware-panel.tsx b/frontend/src/components/editor/chrome/panels/context-aware-panel/context-aware-panel.tsx
index 81f8434f60..7b1078965c 100644
--- a/frontend/src/components/editor/chrome/panels/context-aware-panel/context-aware-panel.tsx
+++ b/frontend/src/components/editor/chrome/panels/context-aware-panel/context-aware-panel.tsx
@@ -21,7 +21,12 @@ import {
isPinnedAtom,
} from "./atoms";
-export type PanelType = "row-viewer" | "column-explorer";
+export const PANEL_TYPES = {
+ ROW_VIEWER: "row-viewer",
+ COLUMN_EXPLORER: "column-explorer",
+} as const;
+
+export type PanelType = (typeof PANEL_TYPES)[keyof typeof PANEL_TYPES];
export const ContextAwarePanel: React.FC = () => {
const [owner, setOwner] = useAtom(contextAwarePanelOwner);
@@ -51,7 +56,7 @@ export const ContextAwarePanel: React.FC = () => {
aria-label={isPinned ? "Unpin panel" : "Pin panel"}
>
{isPinned ? (
- <PinIcon className="w-4 h-4" />
+ <PinIcon className="w-4 h-4 text-primary" />
) : (
<PinOffIcon className="w-4 h-4" />
)}
@@ -95,16 +100,18 @@ export const ContextAwarePanel: React.FC = () => {
const renderBody = () => {
return (
- <div className="mt-2 pb-7 mb-4 h-full overflow-auto">
- <div className="flex flex-row justify-between items-center mx-2">
+ <div className="pb-7 mb-4 h-full overflow-auto">
+ <div className="p-3 border-b flex justify-between items-center">
{renderModeToggle()}
+ <Slot name={SlotNames.CONTEXT_AWARE_PANEL_HEADER} />
<Button
- variant="linkDestructive"
- size="icon"
+ variant="text"
+ size="xs"
+ className="m-0"
onClick={closePanel}
aria-label="Close selection panel"
>
- <XIcon className="w-4 h-4" />
+ <XIcon className="w-4 h-4 hover:text-destructive" />
</Button>
</div>
@@ -126,7 +133,7 @@ export const ContextAwarePanel: React.FC = () => {
onDragging={handleDragging}
className="resize-handle border-border z-20 print:hidden border-l"
/>
- <Panel defaultSize={20} minSize={15} maxSize={80}>
+ <Panel defaultSize={25} minSize={25} maxSize={80}>
{renderBody()}
</Panel>
</>
@@ -150,7 +157,7 @@ interface ResizableComponentProps {
const ResizableComponent = ({ children }: ResizableComponentProps) => {
const { resizableDivRef, handleRefs, style } = useResizeHandle({
startingWidth: 400,
- minWidth: 300,
+ minWidth: 400,
maxWidth: 1500,
onResize: () => {
raf2(() => {
diff --git a/frontend/src/core/slots/slots.ts b/frontend/src/core/slots/slots.ts
index 87e6e31686..fc1011514f 100644
--- a/frontend/src/core/slots/slots.ts
+++ b/frontend/src/core/slots/slots.ts
@@ -6,4 +6,5 @@ export const slotsController = new SlotzController();
export const SlotNames = {
SIDEBAR: "sidebar",
CONTEXT_AWARE_PANEL: "context-aware-panel",
+ CONTEXT_AWARE_PANEL_HEADER: "context-aware-panel-header",
};
diff --git a/frontend/src/plugins/impl/DataTablePlugin.tsx b/frontend/src/plugins/impl/DataTablePlugin.tsx
index 2359c82d2a..dbffad2772 100644
--- a/frontend/src/plugins/impl/DataTablePlugin.tsx
+++ b/frontend/src/plugins/impl/DataTablePlugin.tsx
@@ -26,7 +26,6 @@ import type { CellSelectionState } from "@/components/data-table/cell-selection/
import type { CellStyleState } from "@/components/data-table/cell-styling/types";
import { TablePanel } from "@/components/data-table/charts/charts";
import { hasChart } from "@/components/data-table/charts/storage";
-import { ColumnExplorerPanel } from "@/components/data-table/column-explorer-panel/column-explorer";
import { ColumnChartSpecModel } from "@/components/data-table/column-summary/chart-spec-model";
import { ColumnChartContext } from "@/components/data-table/column-summary/column-summary";
import {
@@ -35,11 +34,11 @@ import {
} from "@/components/data-table/filters";
import { usePanelOwnership } from "@/components/data-table/hooks/use-panel-ownership";
import { LoadingTable } from "@/components/data-table/loading-table";
-import { RowViewerPanel } from "@/components/data-table/row-viewer-panel/row-viewer";
import {
type DownloadAsArgs,
DownloadAsSchema,
} from "@/components/data-table/schemas";
+import { TableExplorerPanel } from "@/components/data-table/table-explorer-panel/table-explorer-panel";
import {
type BinValues,
type ColumnHeaderStats,
@@ -839,7 +838,8 @@ const DataTableComponent = ({
}): JSX.Element => {
const id = useId();
const [viewedRowIdx, setViewedRowIdx] = useState(0);
- const { isPanelOpen, togglePanel } = usePanelOwnership(id, cellId);
+ const { isPanelOpen, isAnyPanelOpen, togglePanel, panelType, setPanelType } =
+ usePanelOwnership(id, cellId);
const chartSpecModel = useMemo(() => {
if (!columnSummaries) {
@@ -1002,8 +1002,7 @@ const DataTableComponent = ({
);
const isSelectable = selection === "multi" || selection === "single";
- const showColExplorer =
- showColumnExplorer && preview_column && isPanelOpen("column-explorer");
+ const canShowColumnExplorer = showColumnExplorer && !!preview_column;
const isInVscode = isInVscodeExtension();
@@ -1032,28 +1031,24 @@ const DataTableComponent = ({
</Banner>
)}
- {isPanelOpen("row-viewer") && (
+ {isAnyPanelOpen && (showRowExplorer || canShowColumnExplorer) && (
<ContextAwarePanelItem>
- <RowViewerPanel
- getRow={getRow}
- fieldTypes={memoizedUnclampedFieldTypes}
- totalRows={totalRows}
+ <TableExplorerPanel
rowIdx={viewedRowIdx}
setRowIdx={setViewedRow}
+ totalRows={totalRows}
+ fieldTypes={memoizedUnclampedFieldTypes}
+ getRow={getRow}
isSelectable={isSelectable}
- isRowSelected={rowSelection[viewedRowIdx]}
+ isRowSelected={Boolean(rowSelection[viewedRowIdx])}
handleRowSelectionChange={handleRowSelectionChange}
- />
- </ContextAwarePanelItem>
- )}
- {showColExplorer && (
- <ContextAwarePanelItem>
- <ColumnExplorerPanel
previewColumn={preview_column}
- fieldTypes={memoizedUnclampedFieldTypes}
- totalRows={totalRows}
totalColumns={totalColumns}
tableId={id}
+ showRowExplorer={showRowExplorer && !isInVscode}
+ showColumnExplorer={canShowColumnExplorer && !isInVscode}
+ activeTab={panelType}
+ onTabChange={setPanelType}
/>
</ContextAwarePanelItem>
)}
@@ -1099,11 +1094,13 @@ const DataTableComponent = ({
showChartBuilder={showChartBuilder}
showPageSizeSelector={showPageSizeSelector}
// Hidden in VSCode (for now) because we don't have a panel to show
- // the column/row explorer.
- showColumnExplorer={showColumnExplorer && !isInVscode}
- showRowExplorer={showRowExplorer && !isInVscode}
+ // the table explorer.
+ showTableExplorer={
+ (showRowExplorer || canShowColumnExplorer) && !isInVscode
+ }
togglePanel={togglePanel}
isPanelOpen={isPanelOpen}
+ isAnyPanelOpen={isAnyPanelOpen}
viewedRowIdx={viewedRowIdx}
onViewedRowChange={(rowIdx) => setViewedRowIdx(rowIdx)}
/>