import { type GridPredicateExpr, type CellEditorOption, type Column, type ColumnDef, type Row, type RowData, type TableFeatures, type ChartType, type ChartSpec, type ChartValueFormat } from "./index"; import "./sv-grid-scrollbar"; import { type ColumnStat } from "./conditional-formatting"; import type { Props, SelectionRange, CellEditState, FilterOperator, MenuPosition, ContextMenuTarget, ChartingConfig } from "./SvGrid.types"; import { operatorOption, operatorsForColumn, defaultOperatorFor, operatorLabelFor } from "./filter-operators"; import { type FacetBucket, isBucketableColumn, buildBuckets, isInBucket } from "./facet-buckets"; import { getColumnBaseValue, isGroupRow, toolPanelHeaderLabel, formatSummaryNumeric, getColumnAlign, getPinnedCellValue, getColumnAccessorValue, columnDefMatchesId } from "./cell-values"; /** * SvGrid controller. The component's entire reactive core - every $state, * $derived, $effect and handler - lives here so SvGrid.svelte can stay a thin * view. Instantiated once during the component's init (so $effect attaches to * the component lifecycle) and consumed through the returned getters. */ export type SvGridController = ReturnType>; export declare function createSvGridController(rawProps: Props, domIdBase?: string): { readonly props: Props; optionOverrides: Record; readonly editingEnabled: boolean; readonly paginationEnabled: boolean; readonly groupingControlsEnabled: boolean; globalFilter: string; scrollContainer: HTMLDivElement | null; gridRootEl: HTMLElement | null; filterRowValues: Record; filterMenuValues: Record; advancedFilter: GridPredicateExpr | null; verticalScrollbarEl: HTMLElement | null; horizontalScrollbarEl: HTMLElement | null; scrollVersion: number; viewportVersion: number; lastResetSignature: string; pendingScrollTop: number; pendingScrollLeft: number; scrollSyncRaf: number | null; selectionRange: SelectionRange; selectionRanges: SelectionRange[]; isDraggingSelection: boolean; fillDrag: { sourceMinRow: number; sourceMaxRow: number; sourceMinCol: number; sourceMaxCol: number; targetRow: number; targetCol: number; } | null; activeAtPointerDown: { rowIndex: number; colIndex: number; } | null; editingCell: CellEditState; fullRowEdit: { rowId: string; draft: Record; } | null; editedCellValues: Record; readonly UNDO_LIMIT: number; history: { rowId: string; columnId: string; field: string; before: unknown; after: unknown; }[]; historyPtr: number; historyVersion: number; tooltip: { text: string; x: number; y: number; below: boolean; } | null; tooltipTimer: number | null; readonly showTooltipFor: (el: HTMLElement, text: string) => void; readonly hideTooltip: () => void; findOpen: boolean; findQuery: string; findHitIndex: number; readonly findHits: { rowIndex: number; colIndex: number; columnId: string; }[]; theadEl: HTMLElement | null; headerHeight: number; editorSelectAll: boolean; columnWidths: Record; resizingColumnId: string | null; resizeStartX: number; resizeStartWidth: number; readonly MIN_COLUMN_WIDTH: number; columnPinning: { left: Array; right: Array; }; readonly effectivePinning: { left: Array; right: Array; }; readonly isNarrowResponsive: boolean; columnVirtualizerVersion: number; gridStateVersion: number; readonly selectionColumnWidth: number; readonly rowNumberColumnWidth: number; readonly showRowNumbersEffective: boolean; readonly filterOperatorOptions: import("./SvGrid.types").FilterOption[]; readonly TEXT_OPERATORS: FilterOperator[]; readonly NUMBER_OPERATORS: FilterOperator[]; readonly DATE_OPERATORS: FilterOperator[]; readonly CHECKBOX_OPERATORS: FilterOperator[]; columnMenuFor: string | null; columnMenuTab: "filter" | "columns" | "general"; columnMenuPos: MenuPosition; columnMenuSearch: string; filterMenuFor: string | null; filterMenuPos: MenuPosition; operatorMenuFor: string | null; operatorMenuPos: MenuPosition; inSuggestFor: string | null; inSuggestPos: MenuPosition; inSuggestQuery: string; readonly inSuggestValues: string[]; readonly inSuggestOptions: { value: string; label: string; }[]; readonly facetValuesForColumn: (columnId: string) => Array; chooseColumnsPos: MenuPosition | null; contextMenuFor: ContextMenuTarget | null; contextMenuPos: MenuPosition; noteOverrides: Record>; commentEditFor: { rowId: string; columnId: string; x: number; y: number; } | null; commentDraft: string; valueFilters: Record>; readonly viewportWidth: number; readonly viewportHeight: number; readonly scrollMetrics: { scrollTop: number; scrollLeft: number; clientHeight: number; clientWidth: number; scrollHeight: number; scrollWidth: number; }; readonly hasVerticalOverflow: boolean; readonly showGlobalFilterEffective: boolean; readonly showFilterRowEffective: boolean; readonly showColumnFiltersEffective: boolean; readonly showInlineColumnFilterEffective: boolean; readonly showRowSelectionEffective: boolean; readonly enableCellSelectionEffective: boolean; readonly flushScheduledScrollSync: () => void; readonly scheduleScrollSync: (scrollTop: number, scrollLeft: number) => void; internalData: readonly TData[]; internalColumns: ColumnDef[]; hiddenColumns: Record; readonly declaredHiddenColumns: Record; readonly toggleColumnGroup: (groupId: string) => void; readonly isColumnGroupCollapsed: (groupId: string) => boolean; readonly externalSortEnabled: boolean; readonly externalFilterEnabled: boolean; readonly passthroughSortedRowModel: ({ rows }: { rows: Array>; }) => Row[]; readonly resolveEffectiveFeatures: () => TableFeatures; readonly grid: import("./createGrid.svelte").SvelteGrid; userColumnOrder: string[]; lastSeededOrder: string; readonly allColumns: Column[]; readonly headerGroups: import("./core").HeaderGroup[]; readonly groupHeaderRows: { id: string; cells: { key: string; label: string; colSpan: number; widthPx: number; /** First leaf-column index this cell spans. */ firstLeafIndex: number; /** True for the placeholder cells that fill the column above an * early-bottoming leaf (e.g. the row-label column to the left of a * multi-level value tree). They render as empty cells so the * layout stays aligned without showing duplicate labels. */ isPlaceholder: boolean; /** Set when this group cell has a collapse toggle. */ groupId?: string; collapsible: boolean; collapsed: boolean; }[]; }[]; readonly groupHeaderRowsWindowed: { id: string; cells: { key: string; label: string; colSpan: number; widthPx: number; /** First leaf-column index this cell spans. */ firstLeafIndex: number; /** True for the placeholder cells that fill the column above an * early-bottoming leaf (e.g. the row-label column to the left of a * multi-level value tree). They render as empty cells so the * layout stays aligned without showing duplicate labels. */ isPlaceholder: boolean; /** Set when this group cell has a collapse toggle. */ groupId?: string; collapsible: boolean; collapsed: boolean; }[]; }[]; readonly pinnedOffsets: { left: Record; right: Record; }; readonly cellPinStyle: (columnId: string) => string; readonly isColumnPinned: (columnId: string) => "left" | "right" | null; colDragId: string | null; colDropOnId: string | null; colDropSide: "before" | "after" | null; rowDragActive: boolean; rowDropIndex: number | null; rowDropSide: "before" | "after" | null; readonly onRowDragStart: (e: DragEvent, rowIndex: number) => void; readonly onRowDragOver: (e: DragEvent, rowIndex: number) => void; readonly onRowDragLeave: (rowIndex: number) => void; readonly onRowDrop: (e: DragEvent, rowIndex: number) => void; readonly onRowsContainerDragOver: (e: DragEvent) => void; readonly onRowsContainerDrop: (e: DragEvent) => void; readonly onRowDragEnd: () => void; readonly broadcastAlignedScroll: (left: number) => void; readonly getCurrentColumnOrder: () => string[]; readonly emitColumnOrder: () => void; readonly setColumnOrderInternal: (ids: ReadonlyArray) => void; readonly applyColumnDrop: (dragId: string, targetId: string, side: "before" | "after") => void; readonly onColumnHeaderDragStart: (e: DragEvent, columnId: string) => void; readonly onColumnHeaderDragOver: (e: DragEvent, columnId: string) => void; readonly onColumnHeaderDragLeave: (columnId: string) => void; readonly onColumnHeaderDrop: (e: DragEvent, columnId: string) => void; readonly onColumnHeaderDragEnd: () => void; readonly pinColumnLeft: (columnId: string) => void; readonly pinColumnRight: (columnId: string) => void; readonly unpinColumn: (columnId: string) => void; readonly getColumnBaseValue: typeof getColumnBaseValue; readonly hasConditionalFormats: boolean; readonly conditionalColumnStats: Map; readonly cellConditionalFormat: (row: Row, column: Column, value: unknown) => import("./conditional-formatting").ResolvedCellFormat | null; readonly isGroupRow: typeof isGroupRow; readonly isCellEditable: (column: Column, row?: Row | undefined) => boolean; readonly isCellEditableAt: (rowIndex: number, colIndex: number) => boolean; readonly sortDirectionByColumn: Record; readonly groupingColumns: any; readonly groupDisplayMode: import("./group-display").GroupDisplayType; readonly groupColumnMode: boolean; readonly autoGroupCell: (row: Row, columnId: string) => { label: string; count: number; depth: number; } | null; readonly paginationState: any; readonly externalPaginationEnabled: boolean; readonly paginationTotalRows: number; readonly paginationPageIndex: any; readonly paginationPageSize: any; readonly getRowColumnValue: (row: Row, columnId: string) => unknown; readonly allRowsBeforePagination: Row[]; readonly allRows: Row[]; readonly rowSelectionState: any; lastSelectionSerialized: string; lastCellRangeSerialized: string; readonly statusBarEnabled: boolean; readonly statusBarAggregates: readonly ("sum" | "avg" | "min" | "max" | "count" | "numericCount")[]; readonly statusBarStats: { count: number; numericCount: number; sum: number; avg: number; min: number; max: number; } | null; toolPanelOpen: boolean; toolPanelTab: "columns" | "filters"; readonly toolPanelEnabled: boolean; readonly toolPanelColumns: Column[]; readonly toolPanelHeaderLabel: typeof toolPanelHeaderLabel; readonly toggleColumnVisibleInPanel: (columnId: string) => void; readonly moveColumnInPanel: (columnId: string, dir: -1 | 1) => void; readonly messages: import("./grid-messages").GridMessages; readonly pivotConfig: import("./pivot-view.svelte").GridPivotConfig | null; readonly pivotActive: boolean; readonly pivotResult: { rows: import("./pivot-view.svelte").GridPivotRow[]; columns: ColumnDef[]; } | null; readonly pivotModeOn: boolean; readonly hasPivotEngine: boolean; togglePivotMode: () => void; readonly chartingEnabled: boolean; readonly chartingConfig: { position: "right" | "bottom"; defaultOpen: boolean; defaultType: ChartType; height: number; width: number; crossFilter: boolean; } | null; readonly chartCfg: ChartingConfig | null; readonly chartIsCustom: boolean; chartPanelOpen: boolean; chartType: ChartType; chartReduce: "sum" | "avg" | "count"; chartDimensionId: string | null; chartMeasureId: string | null; chartSeriesId: string | null; chartStacked: boolean; chartDataLabels: boolean; chartLogScale: boolean; chartTimeAxis: boolean; chartValueFormat: ChartValueFormat; readonly chartDimensionIsDate: boolean; chartSize: number | null; chartFloating: boolean; chartMaximized: boolean; chartFloatRect: { x: number; y: number; w: number; h: number; } | null; readonly chartableColumns: { dims: { id: string; field: string; label: string; }[]; measures: { id: string; field: string; label: string; }[]; }; readonly chartSpec: ChartSpec | null; applyChartCrossFilter: (category: string) => void; clearChartCrossFilter: () => void; readonly charts: { id: string; title: string; }[]; activeChartIndex: number; addChart(): void; removeChart(index?: number): void; renameChart(index: number, title: string): void; getChartsState(): { title: string; type: ChartType; dimension: string | null; series: string | null; measure: string | null; reduce: "sum" | "avg" | "count"; stacked: boolean | null; dataLabels: boolean | null; logScale: boolean | null; timeAxis: boolean | null; valueFormat: ChartValueFormat | null; }[]; applyChartsState(list: ReadonlyArray>, active?: number): void; chartAiHandler: ((prompt: string) => Promise | null>) | null; applyChartConfig(config: { open?: boolean; type?: ChartType; dimension?: string | null; series?: string | null; measure?: string | null; reduce?: "sum" | "avg" | "count"; stacked?: boolean; dataLabels?: boolean; logScale?: boolean; timeAxis?: boolean; valueFormat?: ChartValueFormat; }): void; readonly toggleGroupInPanel: (columnId: string) => void; lastSortingSerialized: string; lastFiltersSerialized: string; readonly virtualizer: { readonly version: number; setOptions: (next: Partial) => void; setScrollOffset: (scrollOffset: number) => void; setViewportHeight: (viewportHeight: number) => void; scrollToIndex: (index: number) => void; getVirtualItems: () => import("./index").VirtualItem[]; getTotalSize: () => number; getOffsetForIndex: (index: number) => number; getSizeForIndex: (index: number) => number; getState: () => import("./index").VirtualizerState; }; readonly columnVirtualizer: { setViewportWidth(viewportWidth: number): void; setHorizontalOffset(scrollOffset: number): void; setOptions(next: Partial): void; setScrollOffset(scrollOffset: number): void; setViewportHeight(viewportHeight: number): void; scrollToIndex(index: number): void; getVirtualItems(): import("./index").VirtualItem[]; getTotalSize(): number; getOffsetForIndex(index: number): number; getSizeForIndex(index: number): number; getState(): import("./index").VirtualizerState; subscribe(listener: () => void): () => boolean; }; readonly rowVirtualizationEnabled: boolean; readonly columnVirtualizationEnabled: boolean; readonly virtualRows: import("./index").VirtualItem[]; readonly autoRowHeightOn: boolean; /** Svelte action: measure this row and report its natural height. */ readonly measureRowHeight: (node: HTMLElement, index: number) => { update(next: number): void; destroy(): void; }; /** A row's measured height, or undefined before it has been measured. * The non-virtualized body reads this directly (it has no virtual item). */ readonly measuredRowHeightPx: (index: number) => number | undefined; readonly virtualRowTotalSize: number; readonly virtualRowStart: number; readonly virtualRowEnd: number; readonly virtualRowBottomSpacer: number; readonly rowDomTotalSize: number; readonly rowScrollScalingActive: boolean; readonly rowTopSpacer: number; readonly rowBottomSpacer: number; readonly domToLogicalRowOffset: (domTop: number) => number; readonly logicalToDomRowOffset: (logical: number) => number; readonly virtualColumns: import("./index").VirtualItem[]; readonly virtualColumnTotalSize: number; readonly renderedColumnItems: import("./index").VirtualItem[] | { index: number; key: number; size: any; start: number; end: any; }[]; readonly hasRenderedColumn: (entry: { item: any; column: any | undefined; }) => entry is { item: any; column: any; }; readonly renderedColumns: { item: any; column: any; }[]; readonly totalColumnWidth: number; readonly hasHorizontalOverflow: boolean; readonly columnWindowStart: number; readonly columnWindowEnd: any; readonly columnWindowRightSpacer: number; readonly activeCell: any; readonly activeDescendantId: string | null; readonly gridDomId: string; readonly formatSummaryNumeric: typeof formatSummaryNumeric; readonly computeSummaries: (rows: readonly Row[], columns: readonly Column[]) => Record; readonly SUMMARY_DEFER_CELL_LIMIT: number; summaryByColumn: Record; hasMeasured: boolean; scrollBottomArmed: boolean; readonly onBodyScroll: (event: Event) => void; readonly computeRowClass: (row: Row, rowIndex: number) => string; readonly computeCellClass: (row: Row, column: Column) => string; readonly computeCellTooltip: (row: Row, column: Column) => string | null; readonly computeCellValidity: (row: Row, column: Column) => { invalid: boolean; message: string | null; }; readonly computeCellNote: (row: Row, column: Column) => string | null; readonly getCellDisplayValue: (rowId: string, columnId: string, baseValue: unknown) => any; readonly getColumnAlign: typeof getColumnAlign; readonly editorOptionsCache: Record; asyncEditorOptions: Record; readonly asyncEditorOptionsPending: Set; readonly asyncEditorColumns: Set; readonly getColumnEditorOptions: (column: Column, row?: Row | null | undefined) => CellEditorOption[]; readonly areEditorOptionsLoading: (column: Column, row?: Row | null | undefined) => boolean; readonly formatListCellValue: (column: Column, value: unknown, row?: Row | null | undefined) => string; readonly formatCellValue: (column: Column, value: unknown, row: Row) => string; readonly getPinnedCellValue: typeof getPinnedCellValue; readonly formatPinnedValue: (column: Column, value: unknown) => string; readonly computePinnedCellClass: (rowData: TData, column: Column) => string; readonly isRowSelected: (rowId: string) => boolean; readonly toggleRowSelectionById: (rowId: string) => void; readonly headerSelectionState: "none" | "all" | "some"; readonly toggleSelectAllRows: () => void; userHasActivatedCell: boolean; readonly setActiveCell: (rowIndex: number, colIndex: number) => void; readonly scrollActiveCellIntoView: (rowIndex: number, colIndex: number) => void; readonly getColumnBaseWidth: (columnId: string) => any; readonly fittedColumnWidths: Record | null; readonly getColumnWidth: (columnId: string) => any; resizePendingWidth: number; resizeRaf: number | null; readonly startColumnResize: (event: PointerEvent, columnId: string) => void; readonly onColumnResizeMove: (event: PointerEvent) => void; readonly endColumnResize: () => void; readonly setSelection: (rowIndex: number, colIndex: number, additive?: boolean) => void; readonly extendSelection: (rowIndex: number, colIndex: number) => void; readonly isCellInSelectedRange: (rowIndex: number, colIndex: number) => boolean; readonly getCellRangeEdges: (rowIndex: number, colIndex: number) => { top: boolean; bottom: boolean; left: boolean; right: boolean; } | null; readonly getSelectionRects: () => { minRow: number; maxRow: number; minCol: number; maxCol: number; }[]; readonly fillHandleCell: { rowIndex: any; colIndex: any; } | null; readonly isInFillPreview: (rowIndex: number, colIndex: number) => boolean; readonly fillMarqueeEdges: (rowIndex: number, colIndex: number) => { top: boolean; bottom: boolean; left: boolean; right: boolean; } | null; readonly findColumnById: (columnId: string) => any; readonly readCellRaw: (rowIndex: number, columnId: string) => unknown; readonly writeCellRaw: (rowIndex: number, columnId: string, value: unknown) => void; readonly applyFillPattern: () => void; readonly clearSelectedCellValues: () => void; readonly startFillDrag: (event: PointerEvent, rowIndex: number, colIndex: number) => void; readonly onFillPointerMove: (event: PointerEvent) => void; readonly onFillPointerUp: () => void; readonly toggleBooleanCell: (rowIndex: number, colIndex: number) => void; readonly onCellPointerDown: (rowIndex: number, colIndex: number, event: PointerEvent) => void; readonly onCellPointerEnter: (rowIndex: number, colIndex: number) => void; readonly endDragSelection: () => void; readonly onWindowPointerMove: (event: PointerEvent) => void; readonly onCellClick: (rowIndex: number, colIndex: number) => void; readonly emitCellDoubleClick: (rowIndex: number, colIndex: number) => void; readonly copySelectionToClipboard: () => void; readonly cutSelectionToClipboard: () => Promise; readonly pasteFromClipboard: () => Promise; readonly onGridPaste: (event: ClipboardEvent) => void; readonly clearSelectedCells: () => boolean; readonly onCellDoubleClick: (rowIndex: number, colIndex: number) => void; readonly startEditingWithChar: (rowIndex: number, colIndex: number, char: string) => boolean; readonly startEditing: (rowIndex: number, columnId: string) => boolean; readonly stopEditing: (cancel?: boolean) => boolean; readonly startFullRowEdit: (rowIndex: number) => boolean; readonly setFullRowDraft: (columnId: string, value: unknown) => void; readonly commitFullRowEdit: () => void; readonly cancelFullRowEdit: () => void; readonly saveEditingCell: () => void; readonly applyHistoryStep: (step: { rowId: string; columnId: string; field: string; before: unknown; after: unknown; }, direction: "undo" | "redo") => void; readonly updateEditingCellValue: (value: unknown) => void; readonly onEditorKeyDown: (event: KeyboardEvent) => void; readonly commitAndMoveByTab: (shiftKey: boolean) => void; readonly focusOnMount: (node: HTMLInputElement | HTMLTextAreaElement) => void; readonly onHeaderSortClick: (event: MouseEvent, columnId: string) => void; readonly onGridKeyDown: (event: KeyboardEvent) => void; readonly changePage: (delta: number) => void; readonly goToPage: (pageIndex: number) => void; readonly setPageSize: (pageSize: number) => void; readonly openContextMenu: (event: MouseEvent, rowIndex: number, colIndex: number, columnId: string) => void; readonly closeContextMenu: () => void; readonly contextMenuItems: () => { key: string; label: string; separator?: boolean; disabled?: boolean; run?: (() => void) | undefined; }[]; readonly saveComment: () => void; readonly removeComment: () => void; readonly closeCommentEditor: () => void; readonly updateFilterRow: (columnId: string, value: string) => void; readonly updateFilterOperator: (columnId: string, operator: FilterOperator) => void; readonly updateFilterMenuValue: (columnId: string, value: string) => void; readonly updateFilterMenuValueTo: (columnId: string, valueTo: string) => void; readonly toggleCheckboxWithKeyboard: (event: KeyboardEvent, toggle: () => void) => void; readonly getColumnAccessorValue: typeof getColumnAccessorValue; readonly fallbackOperatorOption: import("./SvGrid.types").FilterOption; readonly operatorOption: typeof operatorOption; readonly operatorsForColumn: typeof operatorsForColumn; readonly defaultOperatorFor: typeof defaultOperatorFor; readonly operatorLabelFor: typeof operatorLabelFor; readonly isColumnFiltered: (columnId: string) => boolean; readonly closeMenus: () => void; measureCanvas: HTMLCanvasElement | null; readonly measureText: (text: string, font: string) => number; readonly autosizeColumn: (columnId: string) => void; readonly autosizeAllColumns: () => void; readonly resetColumns: () => void; readonly openChooseColumns: (event: MouseEvent) => void; readonly openColumnMenu: (event: MouseEvent, columnId: string) => void; readonly openFilterMenu: (event: MouseEvent, columnId: string) => void; readonly openOperatorMenu: (event: MouseEvent, columnId: string) => void; readonly openInSuggest: (anchor: HTMLElement, columnId: string) => void; readonly closeInSuggest: () => void; readonly addFilterToken: (columnId: string, token: string) => void; readonly removeFilterToken: (columnId: string, token: string) => void; readonly toggleFilterToken: (columnId: string, token: string) => void; readonly setFilterTokens: (columnId: string, tokens: Iterable) => void; readonly sortColumnFromMenu: (columnId: string, desc: boolean) => void; readonly clearColumnSort: (columnId: string) => void; readonly groupByColumnFromMenu: (columnId: string) => void; readonly clearGroupingFromMenu: (columnId: string) => void; readonly isBucketableColumn: typeof isBucketableColumn; readonly buildBuckets: typeof buildBuckets; readonly isInBucket: typeof isInBucket; readonly facetBucketsByColumn: Map; readonly serverFacetLoading: string | null; readonly columnMenuFacetValues: string[]; readonly columnMenuVisibleFacets: string[]; readonly columnMenuFacetOptions: { value: string; label: string; }[]; readonly columnMenuSelectedFacets: ReadonlySet; readonly isFacetChecked: (columnId: string, value: string) => any; readonly toggleFacetValue: (columnId: string, value: string) => void; readonly setFacetSelection: (columnId: string, next: ReadonlySet) => void; readonly isAllFacetsChecked: (columnId: string) => boolean; readonly toggleAllFacets: (columnId: string) => void; readonly clearColumnFilter: (columnId: string) => void; readonly onWindowKeydown: (event: KeyboardEvent) => void; readonly columnDefMatchesId: typeof columnDefMatchesId; readonly buildApi: () => import("./svgrid-wrapper.types").SvGridApi; apiNotified: boolean; };