"use client" /** * Hooks, pure helpers and small components behind `HubTable`. Kept out of * `hub-table.tsx` so the hub shell reads as wiring and each conditional lives * in a unit small enough to reason about on its own. */ import * as React from "react" import { cn } from "../../lib/utils" import { DATA_TABLE_GRID_INSET_CLASS } from "../../lib/table-edge-inset" import { DataTable, DataTableToolbar, type DataTableExtendedProps } from "../data-table" import { CountSyncer, PaginationBar } from "../data-table/pagination" import { TableViewMoreFooter } from "../data-table/table-view-more-footer" import type { ColumnDef } from "../data-table/types" import type { useTableState } from "../data-table/use-table-state" import { TablePropertiesDrawerButton } from "../table-properties/drawer-button" import type { ConditionalRule } from "../../lib/table-properties-types" import type { DataListDisplayOptions } from "../../lib/data-list-display-options" import { FULL_HUB_SUPPORTED_VIEWS, getDataListViewRenderKind, type DataListViewRenderKind, } from "../../lib/data-list-view-registry" import type { DataListViewType } from "../../lib/data-list-view" import { HUB_TABLE_EMBEDDED_PREVIEW_ROW_LIMIT } from "../../lib/hub-table-embedded-preview" import { columnPinPolicyFromDefs } from "../../lib/column-pin-policy" import { usePersistedState } from "../../lib/persisted-state" import { useTableStateLifecycle } from "../../lib/table-state-lifecycle" import { DataRowList } from "./data-row-list" import { ListPageBoardTemplate } from "./list-page-board-template" import type { ListPageConnectedViewRenderers } from "./list-page-connected-view-body" import type { HubDrawerToolbarProps, HubTableHandle, HubTableProps, HubTableRendererArgs, HubTableRenderers, } from "./hub-table" type TableState> = ReturnType> /** * Stable empty `Set` passed to `useTableStateLifecycle` when * persistence is off. The hook bails out early on `columnKeys.size === 0`, * but we still want a stable identity to keep the `useMemo` in there from * thrashing. */ const EMPTY_COLUMN_KEYS = new Set() const DEFAULT_PAGE_SIZE_OPTIONS = [10, 25, 50, 100] // ────────────────────────────────────────────────────────────────────────────── // Pagination + embedded preview // ────────────────────────────────────────────────────────────────────────────── interface PaginationOverrideInput { override: { page: number; pageSize: number } | undefined chromeOwned: boolean page: number pageSize: number embeddedActive: boolean embeddedLimit: number | undefined } function resolvePaginationOverride(i: PaginationOverrideInput): { page: number; pageSize: number } | undefined { if (i.override) return i.override if (i.chromeOwned) return { page: i.page, pageSize: i.pageSize } if (i.embeddedActive && i.embeddedLimit != null) return { page: 1, pageSize: i.embeddedLimit } return undefined } function isEmbeddedPreviewActive(i: { limit: number | undefined expanded: boolean hasOverride: boolean chromeOwned: boolean }): boolean { const hasLimit = i.limit != null && i.limit > 0 return hasLimit && !i.expanded && !i.hasOverride && !i.chromeOwned } /** * Pagination enable + page chrome. * * When the hub omits `onPaginationChange`, `HubTable` owns the Properties * "Pagination" toggle internally (Library / Placements pattern). Without this, * the drawer toggle is wired to a no-op and pagination never activates. * * When `effectivePagination === true` and the parent did NOT supply * `paginationOverride`, `HubTable` owns the page/pageSize internally and wraps the * default table + list renderers with `` + ``. Hubs * that need full control (e.g. server-side pagination) keep using `paginationOverride`. */ export function useHubPagination>(props: HubTableProps) { const { onPaginationChange, pagination, paginationOverride } = props const isPaginationControlled = onPaginationChange !== undefined const [internalPaginationEnabled, setInternalPaginationEnabled] = React.useState(false) const effectivePagination = isPaginationControlled ? (pagination ?? false) : internalPaginationEnabled const handlePaginationChange = React.useCallback( (enabled: boolean) => { if (isPaginationControlled) { onPaginationChange!(enabled) } else { setInternalPaginationEnabled(enabled) } if (!enabled) setInternalPage(1) }, [isPaginationControlled, onPaginationChange], ) const [internalPage, setInternalPage] = React.useState(1) const [internalPageSize, setInternalPageSize] = React.useState(props.paginationInitialPageSize ?? 10) const [internalEmbeddedExpanded, setInternalEmbeddedExpanded] = React.useState(false) const embeddedPreviewRowLimit = props.embeddedPreviewRowLimit ?? (props.embeddedPreview ? HUB_TABLE_EMBEDDED_PREVIEW_ROW_LIMIT : undefined) const embeddedExpanded = props.embeddedPreviewExpanded ?? internalEmbeddedExpanded const setEmbeddedExpanded = props.onEmbeddedPreviewExpandedChange ?? setInternalEmbeddedExpanded const chromeOwnedPagination = effectivePagination === true && paginationOverride === undefined const embeddedPreviewActive = isEmbeddedPreviewActive({ limit: embeddedPreviewRowLimit, expanded: embeddedExpanded, hasOverride: paginationOverride !== undefined, chromeOwned: chromeOwnedPagination, }) const effectivePaginationOverride = resolvePaginationOverride({ override: paginationOverride, chromeOwned: chromeOwnedPagination, page: internalPage, pageSize: internalPageSize, embeddedActive: embeddedPreviewActive, embeddedLimit: embeddedPreviewRowLimit, }) const handlePageChange = React.useCallback((p: number) => setInternalPage(p), []) const handlePageSizeChange = React.useCallback((n: number) => { setInternalPageSize(n) setInternalPage(1) }, []) const resetPage = React.useCallback(() => setInternalPage(1), []) const clampPageToCount = React.useCallback( (count: number) => { const maxPage = Math.max(1, Math.ceil(count / Math.max(1, internalPageSize))) setInternalPage(p => (p > maxPage ? maxPage : p)) }, [internalPageSize], ) return { effectivePagination, handlePaginationChange, internalPage, setInternalPage, internalPageSize, setInternalPageSize, embeddedPreviewRowLimit, setEmbeddedExpanded, chromeOwnedPagination, embeddedPreviewActive, tableEdgeInset: !embeddedPreviewActive, effectivePaginationOverride, handlePageChange, handlePageSizeChange, resetPage, clampPageToCount, } } export type HubPagination = ReturnType function pageModel(pg: HubPagination, filteredCount: number) { const totalPages = Math.max(1, Math.ceil(filteredCount / Math.max(1, pg.internalPageSize))) return { safePage: Math.min(pg.internalPage, totalPages) } } /** `` only when the hub chrome owns pagination. */ function HubCountSyncer({ pg, count }: { pg: HubPagination; count: number }) { if (!pg.chromeOwnedPagination) return null return } function HubPaginationBar({ pg, total, pageSizeOptions, }: { pg: HubPagination total: number pageSizeOptions: number[] }) { return ( ) } // ────────────────────────────────────────────────────────────────────────────── // Persistence (opt-in via `persistKey`) // ────────────────────────────────────────────────────────────────────────────── interface HubPersistedExtras extends Record { conditionalRules: ConditionalRule[] pagination: boolean | undefined paginationPage: number paginationPageSize: number } function positiveNumber(v: unknown): number | undefined { return typeof v === "number" && v > 0 ? v : undefined } function applyLoadedExtras( loaded: Partial | Record | undefined, setters: { setConditionalRules: (rules: ConditionalRule[]) => void handlePaginationChange: (enabled: boolean) => void setInternalPage: (page: number) => void setInternalPageSize: (size: number) => void }, ) { if (!loaded) return const e = loaded as Partial if (Array.isArray(e.conditionalRules)) setters.setConditionalRules(e.conditionalRules) if (typeof e.pagination === "boolean") setters.handlePaginationChange(e.pagination) const page = positiveNumber(e.paginationPage) if (page !== undefined) setters.setInternalPage(page) const pageSize = positiveNumber(e.paginationPageSize) if (pageSize !== undefined) setters.setInternalPageSize(pageSize) } /** * When `persistKey` is set, mirror the table lifecycle (sort/search/filters/ * columns/row-height/gridlines) and the hub-managed `extras` (conditional * rules + pagination) into `localStorage`. SSR-safe + debounced — handled * entirely inside `useTableStateLifecycle`. */ export function useHubPersistence>({ persistKey, persistTabId, columns, tableState, conditionalRules, setConditionalRules, pg, }: { persistKey: string | undefined persistTabId: string | undefined columns: ColumnDef[] tableState: TableState conditionalRules: ConditionalRule[] setConditionalRules: (rules: ConditionalRule[]) => void pg: HubPagination }) { const columnKeysSet = React.useMemo(() => new Set(columns.map(c => c.key)), [columns]) const columnPinPolicy = React.useMemo( () => (persistKey ? columnPinPolicyFromDefs(columns) : undefined), [persistKey, columns], ) const { effectivePagination, internalPage, internalPageSize } = pg const persistedExtras = React.useMemo( () => persistKey ? { conditionalRules, pagination: effectivePagination, paginationPage: internalPage, paginationPageSize: internalPageSize, } : undefined, [persistKey, conditionalRules, effectivePagination, internalPage, internalPageSize], ) useTableStateLifecycle({ namespace: persistKey ?? "", tabId: persistTabId ?? "main", tableState, columnKeys: persistKey ? columnKeysSet : EMPTY_COLUMN_KEYS, columnPinPolicy, extras: persistedExtras, onLoadExtras: persistKey ? loaded => applyLoadedExtras(loaded, { setConditionalRules, handlePaginationChange: pg.handlePaginationChange, setInternalPage: pg.setInternalPage, setInternalPageSize: pg.setInternalPageSize, }) : undefined, }) } // ────────────────────────────────────────────────────────────────────────────── // Drawer props + imperative handle // ────────────────────────────────────────────────────────────────────────────── /** Drop `undefined` entries so optional props stay absent rather than present-and-undefined. */ function pickDefined>(o: T): Partial { return Object.fromEntries(Object.entries(o).filter(([, v]) => v !== undefined)) as Partial } export function useHubDrawerToolbarProps>({ props, tableState, supportedViewTypes, filterFields, fieldDefinitions, resolveColumnLabel, display, pg, }: { props: HubTableProps tableState: TableState supportedViewTypes: readonly DataListViewType[] filterFields: HubDrawerToolbarProps["filterFields"] fieldDefinitions: HubDrawerToolbarProps["fieldDefinitions"] resolveColumnLabel: (key: string) => string display: { displayOptions: DataListDisplayOptions patchDisplay: (patch: Partial) => void conditionalRules: ConditionalRule[] addConditionalRule: HubDrawerToolbarProps["onAddConditionalRule"] removeConditionalRule: HubDrawerToolbarProps["onRemoveConditionalRule"] updateConditionalRule: HubDrawerToolbarProps["onUpdateConditionalRule"] } pg: HubPagination }) { const { rows, view, onViewChange, lifecycleTabLabel, boardGroupByColumnOptions, renderFilterOptionValue, viewName, onViewNameChange, showViewCounts, onShowViewCountsChange, } = props const { filterFieldContext } = tableState const { effectivePagination, handlePaginationChange } = pg const { displayOptions, patchDisplay, conditionalRules, addConditionalRule, removeConditionalRule, updateConditionalRule } = display return React.useMemo( () => ({ totalRows: rows.length, filterFields, fieldDefinitions, resolveColumnLabel, displayOptions, onDisplayOptionsChange: patchDisplay, conditionalRules, onAddConditionalRule: addConditionalRule, onRemoveConditionalRule: removeConditionalRule, onUpdateConditionalRule: updateConditionalRule, currentView: view, onViewChange, supportedViewTypes, lifecycleTabLabel, boardGroupByColumnOptions, renderFilterOptionValue, filterFieldContext, pagination: effectivePagination, onPaginationChange: handlePaginationChange, ...pickDefined({ viewName, onViewNameChange, showViewCounts, onShowViewCountsChange }), }), [ addConditionalRule, boardGroupByColumnOptions, conditionalRules, displayOptions, effectivePagination, fieldDefinitions, filterFields, handlePaginationChange, lifecycleTabLabel, onShowViewCountsChange, onViewChange, onViewNameChange, patchDisplay, removeConditionalRule, renderFilterOptionValue, resolveColumnLabel, rows.length, filterFieldContext, showViewCounts, supportedViewTypes, updateConditionalRule, view, viewName, ], ) } export function useHubImperativeHandle>({ handleRef, tableState, drawerToolbarProps, chromeOwnedPagination, }: { handleRef: React.Ref> | undefined tableState: TableState drawerToolbarProps: HubDrawerToolbarProps chromeOwnedPagination: boolean }) { // Extract the stable setter from `useTableState` first so the // `useImperativeHandle` deps array sees the exact value the hook reads. // `setSheetOpen` is referentially stable, so the handle is created once. const { setSheetOpen: openPropertiesSheet } = tableState const drawerToolbarPropsRef = React.useRef(drawerToolbarProps) // Layout, not passive: the imperative handle below is attached during the // same commit and a caller can read it before passive effects flush. React.useLayoutEffect(() => { drawerToolbarPropsRef.current = drawerToolbarProps }) // What the grid is showing: the page when this hub paginates, the whole // filtered set when it does not. const visibleRowsRef = React.useRef([]) React.useLayoutEffect(() => { visibleRowsRef.current = (chromeOwnedPagination ? tableState.pagedRows : tableState.rows) as TRow[] }) React.useImperativeHandle( handleRef ?? null, () => ({ openPropertiesDrawer: () => openPropertiesSheet(true), get drawerToolbarProps() { return drawerToolbarPropsRef.current }, get visibleRows() { return visibleRowsRef.current }, }), [openPropertiesSheet], ) } // ────────────────────────────────────────────────────────────────────────────── // Toolbar // ────────────────────────────────────────────────────────────────────────────── function withRecentQuery(prev: string[], q: string): string[] { return [q, ...prev.filter(x => x.toLowerCase() !== q.toLowerCase())].slice(0, 12) } export function useHubToolbar>({ props, tableState, displayOptions, drawerToolbarProps, tableEdgeInset, }: { props: HubTableProps tableState: TableState displayOptions: DataListDisplayOptions drawerToolbarProps: HubDrawerToolbarProps tableEdgeInset: boolean }) { const { columns, persistKey, renderFilterOptionValue, searchAriaLabel, toolbarActions } = props const [searchRecentQueries, setSearchRecentQueries] = usePersistedState( persistKey ? `${persistKey}:toolbar-search-recents` : "", [], { version: 1 }, ) const recordToolbarSearchRecent = React.useCallback( (query: string) => { const q = query.trim() if (!q) return setSearchRecentQueries(prev => withRecentQuery(prev, q)) }, [setSearchRecentQueries], ) return React.useMemo( () => ( } toolbarActions={toolbarActions} searchRecentQueries={persistKey ? searchRecentQueries : undefined} onSearchRecentSelect={query => tableState.setSearch(query)} onSearchRecentClear={persistKey ? () => setSearchRecentQueries([]) : undefined} onSearchRecentRecord={persistKey ? recordToolbarSearchRecent : undefined} /> ), [ columns, displayOptions.showToolbarSearch, drawerToolbarProps, persistKey, recordToolbarSearchRecent, renderFilterOptionValue, searchAriaLabel, searchRecentQueries, setSearchRecentQueries, tableState, tableEdgeInset, toolbarActions, ], ) } // ────────────────────────────────────────────────────────────────────────────── // Default view bodies // ────────────────────────────────────────────────────────────────────────────── /** Pagination bar, "View more" footer, or nothing — `undefined` keeps DataTable off the sticky foot stack. */ function renderTableStickyFooter>({ hub, pg, filteredCount, showEmbeddedFooter, }: { hub: HubTableProps pg: HubPagination filteredCount: number showEmbeddedFooter: boolean }): React.ReactNode { if (pg.chromeOwnedPagination) { return ( ) } if (!showEmbeddedFooter) return undefined return ( { if (hub.onEmbeddedPreviewViewMore) { hub.onEmbeddedPreviewViewMore() return } pg.setEmbeddedExpanded(true) }} className="rounded-none border-x-0 border-b-0" /> ) } /** * Default `data-table` renderer — full DataTable with toolbar + bulk actions. When * `pagination === true` and the parent did not provide `paginationOverride`, the chrome * (CountSyncer + PaginationBar) is wrapped automatically so the drawer toggle "Show * pagination" works out of the box. Hubs that need finer control (custom chrome, * server-side paging) can still override via `tableRenderer`. */ export function HubDefaultTable>({ hub, pg, state, displayOptions, conditionalRules, drawerToolbarProps, bulkActionsSlot, }: { hub: HubTableProps pg: HubPagination state: TableState displayOptions: DataListDisplayOptions conditionalRules: ConditionalRule[] drawerToolbarProps: HubDrawerToolbarProps bulkActionsSlot: DataTableExtendedProps["bulkActionsSlot"] }) { const filteredCount = (state.rows as TRow[]).length const limit = pg.embeddedPreviewRowLimit const showEmbeddedFooter = pg.embeddedPreviewActive && limit != null && filteredCount > limit return (
data={hub.rows} columns={hub.columns} getRowId={hub.getRowId} getRowSelectionLabel={hub.getRowSelectionLabel} selectable={hub.selectable ?? true} searchable={displayOptions.showToolbarSearch} showColumnHeaders={displayOptions.showColumnLabels} groupable={hub.groupable ?? true} defaultSort={hub.defaultSort} emptyState={hub.emptyState ??

No records match your filters.

} conditionalRules={conditionalRules} state={state} renderFilterOptionValue={hub.renderFilterOptionValue} toolbarSlot={s => } toolbarActions={hub.toolbarActions} bulkActionsSlot={bulkActionsSlot} onRowClick={hub.onRowClick} openRowId={hub.openRowId} hasFooter={pg.chromeOwnedPagination || showEmbeddedFooter} edgeInset={pg.tableEdgeInset} stickyFooter={renderTableStickyFooter({ hub, pg, filteredCount, showEmbeddedFooter })} /> {/* Pagination / view-more chrome is passed as DataTable `stickyFooter` so the bulk action bar sticks in the same foot stack. */}
) } /** Sticky pagination footer under the list view (matches the table-view footer). */ function HubListFooter({ pg, total, pageSizeOptions }: { pg: HubPagination; total: number; pageSizeOptions: number[] }) { if (!pg.chromeOwnedPagination) return null return (
) } /** * Default centralized list renderer: same DataRowList shell every hub used to roll * by hand. Hub provides only the per-row body via `renderListRow`. When `pagination` * is on (and `paginationOverride` is not externally supplied), the list view reads * `state.pagedRows` and adds the same `CountSyncer` + `PaginationBar` chrome as the * table view. */ function HubDefaultList>({ hub, pg, args, renderListRow, }: { hub: HubTableProps pg: HubPagination args: HubTableRendererArgs renderListRow: (row: TRow) => React.ReactNode }) { const fullRows = args.state.rows as TRow[] const pagedRows = pg.chromeOwnedPagination ? (args.state.pagedRows as TRow[]) : fullRows return args.toolbarShell( <> rows={pagedRows} getRowId={row => hub.getRowId(row)} ariaLabel={hub.listAriaLabel ?? hub.hubLabel} emptyState={hub.listEmptyState ?? "No records match your filters."} {...pickDefined({ virtualizeThreshold: hub.listVirtualizeThreshold, estimatedRowHeight: hub.listEstimatedRowHeight, })} openRowId={hub.openRowId} renderRow={renderListRow} /> , ) } /** * Default centralized board renderer: same ListPageBoardTemplate every hub used to wrap. * Hub provides only the per-card body via `renderBoardCard` and the column predicate set. */ function HubDefaultBoard>({ hub, args, renderBoardCard, boardGroups, }: { hub: HubTableProps args: HubTableRendererArgs renderBoardCard: (row: TRow) => React.ReactNode boardGroups: NonNullable["boardGroups"]> }) { return args.toolbarShell( columns={boardGroups} rows={args.state.rows as TRow[]} getRowKey={hub.getRowId} renderCard={renderBoardCard} columnCountBadgeClassName={hub.boardColumnCountBadgeClassName ?? {}} emptyColumnLabel={hub.boardEmptyColumnLabel ?? "No items"} />, ) } // ────────────────────────────────────────────────────────────────────────────── // Renderer composition + dev warnings // ────────────────────────────────────────────────────────────────────────────── /** True when the allowlist is the FULL hub set (same reference, or same members). */ function declaresFullViewSet(allowlist: readonly DataListViewType[]): boolean { if (allowlist === FULL_HUB_SUPPORTED_VIEWS) return true return ( allowlist.length === FULL_HUB_SUPPORTED_VIEWS.length && FULL_HUB_SUPPORTED_VIEWS.every(v => allowlist.includes(v)) ) } /** Whether a supported view's render kind is covered by an explicit renderer or a centralized default. */ function hasRendererFor>( kind: DataListViewRenderKind, props: HubTableProps, ): boolean { if (kind === "data-table") return true if (props.renderers[kind] != null) return true if (kind === "list-with-toolbar") return props.renderListRow != null return kind === "board-with-toolbar" && props.renderBoardCard != null && props.boardGroups != null } /** * Dev-time warning when a `supportedViewType` has no renderer AND no centralized * default is available. `data-table` always falls back to the built-in * default; `list-with-toolbar` and `board-with-toolbar` fall back to the synthesised * defaults when the hub passes `renderListRow` / `renderBoardCard` (the happy path * for most hubs). The warning only fires for exotic surfaces that genuinely need an * explicit renderer entry. */ export function warnAboutMissingRenderers>( props: HubTableProps, supportedViewTypes: readonly DataListViewType[], ) { if (process.env.NODE_ENV === "production") return for (const v of supportedViewTypes) { const kind = getDataListViewRenderKind(v) if (hasRendererFor(kind, props)) continue console.warn( `[Exxat DS][HubTable: ${props.hubLabel}] Missing renderer for supported view "${v}" (${kind}). ` + "Add a renderer entry, or remove the view from supportedViewTypes.", ) } // Warn when a hub opts into multi-view allowlists without renderers — or when // FULL is declared without folder/panel/tree bodies (Library reference hubs only). const allowlist = props.supportedViewTypes if (allowlist == null || !declaresFullViewSet(allowlist)) return if (props.renderListRow != null || props.renderBoardCard != null) return console.warn( `[Exxat DS][HubTable: ${props.hubLabel}] FULL_HUB_SUPPORTED_VIEWS declared but no ` + "`renderListRow` / `renderBoardCard` / auxiliary renderers. Implement bodies per " + "`.cursor/rules/exxat-hub-supported-views.mdc` or narrow to TABLE_ONLY until product asks.", ) } /** * Compose `ListPageConnectedViewBody` renderers: the built-in `data-table` (or hub override) * plus each hub-provided non-table renderer. Wrapping in `() => …` defers execution until * the active view actually selects that kind — so heavy bodies (dashboard charts) don't * pay render cost on a table tab. */ export function composeHubRenderers>({ hub, pg, args, renderTable, }: { hub: HubTableProps pg: HubPagination args: HubTableRendererArgs renderTable: (args: HubTableRendererArgs) => React.ReactNode }): ListPageConnectedViewRenderers { const { renderers, renderListRow, renderBoardCard, boardGroups } = hub const composed: ListPageConnectedViewRenderers = { "data-table": () => renderTable(args), } if (renderers["list-with-toolbar"] == null && renderListRow != null) { composed["list-with-toolbar"] = () => ( ) } if (renderers["board-with-toolbar"] == null && renderBoardCard != null && boardGroups != null) { composed["board-with-toolbar"] = () => ( ) } return applyExplicitRenderers(composed, renderers, args) } function applyExplicitRenderers>( composed: ListPageConnectedViewRenderers, renderers: HubTableRenderers, args: HubTableRendererArgs, ): ListPageConnectedViewRenderers { for (const kind of Object.keys(renderers) as DataListViewRenderKind[]) { const r = renderers[kind] if (r) composed[kind] = () => r(args) } return composed } // ────────────────────────────────────────────────────────────────────────────── // Creation drawer // ────────────────────────────────────────────────────────────────────────────── /** * Creation drawer (hideTrigger=true, gated on `creatingViewType`). Mounted as a * sibling so it has its own portal and never fights the live toolbar's Properties * button. The trigger is suppressed — the parent controls open state via * `creatingViewType` (driven through the effect into `creationState.setSheetOpen`). */ export function HubCreationDrawer>({ hub, creatingViewType, creationState, creationConditionalRules, creationDisplayOptions, patchCreationDisplay, addCreationCR, removeCreationCR, updateCreationCR, filterFields, fieldDefinitions, resolveColumnLabel, supportedViewTypes, viewTypeLabel, }: { hub: HubTableProps creatingViewType: DataListViewType creationState: TableState creationConditionalRules: ConditionalRule[] creationDisplayOptions: DataListDisplayOptions patchCreationDisplay: (patch: Partial) => void addCreationCR: HubDrawerToolbarProps["onAddConditionalRule"] removeCreationCR: HubDrawerToolbarProps["onRemoveConditionalRule"] updateCreationCR: HubDrawerToolbarProps["onUpdateConditionalRule"] filterFields: HubDrawerToolbarProps["filterFields"] fieldDefinitions: HubDrawerToolbarProps["fieldDefinitions"] resolveColumnLabel: (key: string) => string supportedViewTypes: readonly DataListViewType[] viewTypeLabel: string | undefined }) { return ( hub.onCommitCreation?.({ name: (hub.creatingViewName ?? "").trim(), viewType: creatingViewType, filters: creationState.activeFilters, sortRules: creationState.sortRules, colOrder: creationState.colOrder, hiddenCols: Array.from(creationState.hiddenCols), groupBy: creationState.groupBy, conditionalRules: creationConditionalRules, displayOptions: creationDisplayOptions, }) } /> ) }