import { SimpleTableConfig } from "../types/SimpleTableConfig"; import { TableAPI } from "../types/TableAPI"; import "../styles/all-themes.css"; export declare class SimpleTableVanilla { private container; private config; private customTheme; private mergedColumnEditorConfig; private resolvedIcons; private domManager; private renderOrchestrator; private draggedHeaderRef; private hoveredHeaderRef; private localRows; private headers; private essentialAccessors; private currentPage; private scrollTop; private scrollDirection; private isResizing; private isScrolling; /** True when this render is scroll-driven so body can use position-only updates for existing cells. */ private _positionOnlyBody; private firstRenderDone; private internalIsLoading; private scrollbarWidth; private isMainSectionScrollable; private columnEditorOpen; private collapsedHeaders; private expandedDepths; private expandedRows; private collapsedRows; private rowStateMap; private announcement; private cellRegistry; private headerRegistry; private rowIndexMap; private animationCoordinator; private autoScaleManager; private dimensionManager; private scrollManager; private sectionScrollController; private sortManager; private filterManager; private selectionManager; private rowSelectionManager; private windowResizeManager; private handleOutsideClickManager; private scrollbarVisibilityManager; private expandedDepthsManager; private ariaAnnouncementManager; private mounted; private scrollRafId; private scrollEndTimeoutId; private lastScrollTop; private isUpdating; /** Currently resolved external scroll parent (HTMLElement or window). Null when external scroll mode is inactive. */ private resolvedScrollParent; /** Bound scroll handler attached to the external scroll parent. */ private externalScrollListener; /** Bound resize handler attached to window when scrollParent is "window". */ private externalWindowResizeListener; /** ResizeObserver watching the external scroll parent element. */ private externalParentResizeObserver; /** Cached visible viewport height of the table inside the external parent. Fed into virtualization. */ private externalViewportHeight; /** True iff the body-container scroll listener is currently attached. */ private bodyScrollListenerAttached; /** Bound mouseleave handler on the body container. */ private bodyContainerMouseLeaveListener; /** Bound scroll handler attached to the body container (internal scroll mode). */ private bodyContainerScrollListener; /** * When external scroll mode is active we briefly take control of the scroll * parent's `overscroll-behavior-y` to neutralize the browser's rubber-band / * scroll-chaining at the boundaries. Without this, pulling past the top or * bottom of the scroll parent visually translates the entire scroll content * layer (including the CSS-sticky header), causing the header to "disappear" * during overscroll bounces even though its layout position is unchanged. * We record the previous inline value so {@link detachExternalScrollWiring} * can restore it cleanly. */ private overscrollBehaviorTarget; private overscrollBehaviorPrev; /** * Active accordion axis for the next render. Set by row/column collapse- * expand mutators (see {@link beginAccordionAnimation}) and consumed by the * cell renderers via the render context. Cleared in {@link render} after * each render so subsequent non-accordion renders (sort, scroll, etc.) * don't re-trigger the size transitions. */ private pendingAccordionAxis; /** Pending timeout id used to remove the accordion CSS class. */ private accordionCleanupTimerId; /** * Visible-leaf-headers key as of the last render that committed to the DOM. * Used by `setHeaders` to detect hide/show/pin/unpin and trigger the * accordion-horizontal animation. Comparing against `this.headers` directly * doesn't work because the column editor mutates header objects in place * (e.g. `header.hide = true`) BEFORE invoking setHeaders, so by the time * setHeaders runs, the prev and next trees already point to the same * mutated header instances. */ private lastRenderedVisibilityKey; constructor(container: HTMLElement, config: SimpleTableConfig); private applyAnimationsConfig; private rebuildRowIndexMap; private getBodyContainers; private getHeaderContainers; /** * All cell-bearing containers — body sections AND header sections — that the * animation coordinator needs to inspect. Headers participate in FLIP for * column reorder so their cells slide to their new slot rather than * teleporting. */ private getAnimatableContainers; /** * Capture pre-change cell positions for the FLIP animation, including * conceptual positions for cells outside the virtualization viewport so * incoming cells can animate from off-screen on column reorder/sort. The * `play` step that runs at the end of the next render consumes this * snapshot to inverse-transform cells from their old visual positions and * tween them to their new ones. * * Called on every layout-affecting state change — including the chain of * mid-drag `setHeaders` calls that fire on each `dragover` swap — so that * displaced columns slide smoothly out of the dragged column's way rather * than snapping into place. */ /** * Build a key summarizing the leaf columns that will paint (accessor + * pinned section). Hidden leaves and excluded subtrees drop out; nested * children are flattened so a parent collapse/expand counts as a * visibility change at the leaf level too. */ private buildVisibilityKey; /** * True when the visible-leaf-set (or its pinned-section assignment) for * `nextHeaders` differs from the last render that committed to the DOM. * * We deliberately compare against {@link lastRenderedVisibilityKey} rather * than `this.headers`: the column editor mutates header objects in place * before invoking setHeaders (e.g. `header.hide = true`, then * `setHeaders(deepClone(headers))`), and `this.headers` shares those * mutated references — so a prev-vs-next compare always reads the same * state and reports no change. Comparing to the last-rendered key sees * the user's actually-painted state and correctly detects hide/show and * pin/unpin changes. */ private didColumnVisibilityChange; private captureAnimationSnapshot; /** * Open the accordion animation window for the next render: capture a FLIP * snapshot, mark the active axis so cell renderers initialize incoming * cells at zero size, and add the CSS class that enables the size * transitions on `.st-cell` / `.st-header-cell`. * * The CSS class is removed after `duration + ACCORDION_CLEANUP_BUFFER_MS` * so non-accordion renders don't keep transitioning size on subsequent * inline-style writes. * * No-op when animations are disabled (which already includes the * prefers-reduced-motion check via {@link AnimationCoordinator.isEnabled}). */ private beginAccordionAnimation; private initializeManagers; mount(): void; private setupManagers; private setupEventListeners; /** * Reconciles which element owns the vertical scroll listener based on the * current `scrollParent` config. Called on mount and whenever `update()` * could have changed the relevant inputs (`scrollParent` / `height` / * `maxHeight`). Idempotent — safe to call repeatedly. */ private syncExternalScrollWiring; private ensureBodyScrollListenerAttached; private ensureBodyScrollListenerDetached; private attachExternalScrollWiring; private detachExternalScrollWiring; /** * Set `overscroll-behavior-y: none` on the resolved scroll parent (or * `document.documentElement` for `scrollParent: "window"`). This neutralizes * the browser's elastic rubber-band at the scroll boundaries, which would * otherwise translate the entire scroll content layer (including our * `position: sticky` header) during overscroll bounces — making the header * visually disappear off the top of the parent. `contain` only stops scroll * chaining; we need `none` to actually disable the elastic bounce on the * scroll container itself. Previous inline value is captured so we can * restore it on detach. */ private applyOverscrollContainment; private restoreOverscrollBehavior; /** * Read the resolved scroll parent's computed `padding-top` and publish it * as `--st-external-scroll-padding-top` on the table root. The sticky * header CSS uses `top: calc(-1 * var(...))` so the header pins flush to * the parent's outer top edge instead of the padding edge, eliminating the * visible gap that CSS sticky would otherwise produce when the consumer * gives the scroll parent any top padding. Re-run on layout changes via * ResizeObserver / window resize. */ private recomputeExternalScrollPaddingTop; /** * Recompute the visible portion of the table inside the external scroll * parent and push it into the DimensionManager so virtualization math * picks it up. Cheap; called on scroll, on parent/window resize, and on * every re-render where the resolved parent may have moved. */ private recomputeExternalViewportHeight; private handleExternalResize; private handleExternalScroll; private handleScroll; private clearHoveredRows; private updateAriaLiveRegion; private getRenderContext; private getRenderState; private render; update(config: Partial): void; /** @deprecated Use {@link update} — same behavior. */ updateConfig(config: Partial): void; destroy(): void; getAPI(): TableAPI; }