ag-grid-enterprise
Version:
Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
65 lines (64 loc) • 5.15 kB
TypeScript
import type { AgColumn, BeanCollection, ColKey, ColumnEventType, ColumnModel, ColumnState, ColumnStateParams, IColsService, _ColumnChangedEventType } from 'ag-grid-community';
import { BeanStub } from 'ag-grid-community';
/** @internal AG_GRID_INTERNAL - Not for public use. Can change / be removed at any time. */
export declare abstract class BaseColsService extends BeanStub implements IColsService {
protected colModel: ColumnModel;
protected abstract eventName: _ColumnChangedEventType;
/** Membership + insertion order; the single source of truth (O(1), idempotent add). The per-col flag
* (`rowGroupActive`/…) is a denormalised copy of `has(col)` for the public `Column` API. */
protected activeColSet: Set<AgColumn<any>>;
/** Lazy array view of {@link activeColSet}; `null` when stale. */
private colsCache;
/** Extract-pass buckets, opened lazily per pass and released by {@link commitExtract} (no stale carry-over).
* `…WithIndex` = cols with an order key (sorted first in commit); `…WithValue` = the rest. */
private extractColsWithIndex;
private extractColsWithValue;
/** Bucket an indexed col, opening {@link extractColsWithIndex} lazily. */
protected extractAddColWithIndex(col: AgColumn, key: number): void;
/** Bucket a non-indexed (value) col, opening {@link extractColsWithValue} lazily. */
protected extractAddColWithValue(col: AgColumn): void;
/** Cols changed since the last flush; non-null = dirty. Dispatched once by {@link dispatchColChange}. */
pendingChanged: Set<AgColumn> | null;
/** Active columns, in order. Ref-stable until the next edit. */
get columns(): AgColumn[];
wireBeans(beans: BeanCollection): void;
/** Replace the active cols with `cols` (must be dup-free); `cols` doubles as the cached view. */
protected resetActiveCols(cols: AgColumn[]): void;
/** Activate/deactivate a col (O(1)): flag + per-col events via {@link writeColActive}, membership here, and
* the `runSideEffects`-gated {@link onColActiveChanged}. `OrderedColsService` overrides to seat virtuals. */
protected setColActive(col: AgColumn, active: boolean, source: ColumnEventType, runSideEffects?: boolean): boolean;
/** Per-subclass: set the col's role flag and, if it changed, dispatch its per-col events; returns whether it
* flipped. Only this col's state — not the active set (that's {@link setColActive}). */
protected abstract writeColActive(col: AgColumn, active: boolean, source: ColumnEventType): boolean;
/** Auto side-effects of (de)activate (rowGroup auto-hide, value default agg-func); only on `runSideEffects`
* (imperative paths). Default no-op. */
protected onColActiveChanged(_col: AgColumn, _active: boolean, _source: ColumnEventType): void;
/** Bulk diff: flip flags to match `targetSet` (insertion order = active order); `runSideEffects` runs
* {@link onColActiveChanged}. Reuses `targetSet` as the active set; `targetArr` seeds the cache, else lazy. */
private applyActiveCols;
/** After a flush, dispatch batched per-col side-effects (rowGroup `columnVisible`). Default no-op. */
protected onColActiveChangesComplete(_source: ColumnEventType): void;
/** React to a `this.columns` order/content change; `rowGroupColsSvc` stamps `rowGroupActiveIndex`. Default no-op. */
protected onColumnsChanged(): void;
/** Cols differing in membership or position between `before` and `after` (the change-event payload). */
private changedColsBetween;
setColumns(colKeys: ColKey[] | undefined, source: ColumnEventType): void;
/** Seat a col into `res`; base adds just the col, `OrderedColsService` seats its virtuals first. */
protected seatActiveCol(res: Set<AgColumn>, col: AgColumn): void;
/** Expand to active order via {@link seatActiveCol}; dedupes into a fresh Set (insertion order = active order). */
private expandActiveCols;
/** Record changed cols for the next {@link ColumnModel.flushColChanges}; a `Set` dedupes the payload. */
protected stageColChange(changedCols: AgColumn[]): void;
/** Dispatch this service's staged change (if any); called by {@link ColumnModel.flushColChanges}. */
dispatchColChange(source: ColumnEventType): void;
addColumns(keys: (ColKey | null | undefined)[] | undefined, source: ColumnEventType): void;
removeColumns(keys: (ColKey | null | undefined)[] | undefined, source: ColumnEventType): void;
private updateColList;
/** Bucket one primary col for the pass; no-op if not in this role. `colIsNew` ⇒ `initial*` props apply. */
abstract extractCol(col: AgColumn, colIsNew: boolean): void;
/** Finalise the pass: order the buckets, diff vs the previous active cols (flagging changes), re-seat,
* then release the buckets. */
commitExtract(source: ColumnEventType): AgColumn[];
/** Apply one `ColumnState` entry to this service; ordered services share the impl, `valueColsSvc` overrides. */
abstract syncColState(column: AgColumn, stateItem: ColumnState | null, defaultState: ColumnStateParams | undefined, source: ColumnEventType): void;
}