/** * 页面级吸顶表头 + 吸底横向滚动条控制器(brick 宽表专用)。 * * 背景:`.brick-table-main-body-wrap` 自带 `overflow: auto hidden`,本身是一个横向滚动容器, * 会把原生 `position: sticky` 的作用域限制在其内部,无法相对页面/外层容器吸顶。故采用 * 「克隆 `.brick-table` 根节点 + `position: fixed` 浮层」方案: * * - 吸顶表头:真实表头滚出滚动区顶部时,克隆一份(去掉 tbody)用 fixed 悬浮到顶部;浮层通过 * `scrollLeft` 与真实表体同步横向偏移,从而保留左固定列(sticky-left)的吸附效果。 * - 吸底滚动条:真实横向滚动条落到滚动区底部之外时,再造一条 fixed 到底部的横向滚动条, * 与真实表体双向同步 `scrollLeft`(互斥锁防抖),让用户任何时候都能横向拖动宽表。 * * 该控制器不依赖 React,只操作传入的 DOM,供 Table 类组件在生命周期里挂载/刷新/卸载。 */ export interface StickyControllerOptions { /** 取 `.brick-table` 根节点(通常来自 Table 的 refTable) */ getRoot: () => HTMLElement | null; /** 表头吸顶时距滚动区顶部的偏移,默认 0 */ top?: number; /** 滚动条吸底时距滚动区底部的偏移,默认 0 */ bottom?: number; /** * 可选的内层纵向滚动容器。缺省 → 相对 window(整页滚动); * 传入 → 吸顶/吸底相对该容器计算,并监听其滚动。 */ getScrollTarget?: () => HTMLElement | null; } export declare class StickyController { private readonly options; private floatEl; private scrollbarEl; private scrollbarInner; private cloneBodyWrap; private cloneRoot; private root; private bodyWrap; private scrollTarget; private syncingScroll; private raf; private resizeObserver; constructor(options: StickyControllerOptions); private get topOffset(); private get bottomOffset(); private getContainerTop; private getContainerBottom; /** 挂载:创建浮层 + 绑定监听。重复调用前应先 destroy。 */ mount(): void; /** 刷新:数据/列宽变化后重建克隆并重新定位(供 componentDidUpdate 调用)。 */ refresh(): void; /** 卸载:移除浮层 + 解绑所有监听。 */ destroy(): void; private syncColWidths; private build; private syncScrollPositionClasses; private readonly sync; private syncScrollbar; private readonly onScrollbarScroll; private readonly onFloatClick; private readonly onScroll; private readonly onResize; }