UNPKG

@adaptabletools/adaptable

Version:

Powerful AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements

53 lines (52 loc) 3.06 kB
import type { IRowNode } from 'ag-grid-enterprise'; import type { AdaptableApi } from '../../../Api/AdaptableApi'; import type { StyledColumn } from '../../../AdaptableState/StyledColumnState'; import type { RowScope } from '../../../AdaptableState/Common/RowScope'; /** * Row kinds used by {@link RowScope} and the Styled Column Scope wizard. * All are available to all Styled Columns with exception of Sparkline (which is data rows only) */ export type StyledColumnRowKind = 'Data' | 'Group' | 'Summary' | 'Total'; export declare const STYLED_COLUMN_ROW_KINDS: StyledColumnRowKind[]; export declare const STYLED_COLUMN_ROW_KIND_EXCLUDE_KEY: Record<StyledColumnRowKind, keyof RowScope>; export declare const isStyledColumnRowKindSupported: (styledColumn: StyledColumn, kind: StyledColumnRowKind) => boolean; export declare const getStyledColumnRowKindDisabledReason: (styledColumn: StyledColumn, kind: StyledColumnRowKind) => string | undefined; /** * Classifies the AG Grid row node into a single {@link StyledColumnRowKind}. * Order matches {@link shouldRenderStyledColumnOnRow}: total before summary, * summary before group. */ export declare const getStyledColumnRowKindForNode: (node: IRowNode, api: AdaptableApi) => StyledColumnRowKind; /** * Forces `Exclude*` to `true` for row kinds that do not apply to the current * Styled Column type, so persisted state cannot contradict the capability * matrix. Returns `undefined` when no change is needed. */ export declare const sanitizeStyledColumnRowScope: (styledColumn: StyledColumn) => RowScope | undefined; /** * Returns `true` when the Styled Column should render on the given row. * * Single source of truth consulted by every styled-column cell renderer * (Badge / Icon / Rating / Percent Bar / Bullet Chart / Range Bar) and * by `getStyledColumnStyle` (Gradient / Percent Bar cellStyle). * * Semantics: * - **Type capabilities** first: some types never target certain row kinds * (see {@link isStyledColumnRowKindSupported}). Unsupported kinds always * return `false` regardless of `RowScope`. * - When `StyledColumn.RowScope` is **set**, the explicit `Exclude*` * flags win. Unset flags default to "include" — i.e. `RowScope: {}` * means "render on every *supported* row kind". * - When `StyledColumn.RowScope` is **unset**, the historical per-type * default applies: * - Badge: render on every row kind (that the type supports). * - All other types: render on every row kind *except* group rows * (matches the hardcoded "isGroupRowNode → plain text" check that * every other styled-column renderer used to carry), again * intersected with type capabilities (e.g. Sparkline → data only). * * The per-type default lets us promote `RowScope` cleanly without * altering existing user-visible behaviour: state that doesn't mention * `RowScope` keeps rendering exactly as before. */ export declare const shouldRenderStyledColumnOnRow: (styledColumn: StyledColumn, node: IRowNode, api: AdaptableApi) => boolean;