@adaptabletools/adaptable
Version:
Powerful AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements
55 lines (54 loc) • 3.38 kB
TypeScript
import type { CSSProperties } from 'react';
import type { IRowNode } from 'ag-grid-community';
import { StyledColumn } from '../../../AdaptableState/StyledColumnState';
import { CellColorRange, NumericStyledColumn } from '../../../AdaptableState/StyledColumns/Common/NumericStyledColumn';
import { GradientStyle } from '../../../AdaptableState/StyledColumns/GradientStyle';
import { AdaptableApi } from '../../../Api/AdaptableApi';
/**
* Default alpha at the **low** end of a Gradient range when `MinAlpha` is unset.
* Slightly above zero so the bottom-edge value of every range still shows its
* colour (rather than rendering fully transparent).
*/
export declare const DEFAULT_GRADIENT_MIN_ALPHA = 0.15;
/**
* Default alpha at the **high** end of a Gradient range when `MaxAlpha` is unset.
*/
export declare const DEFAULT_GRADIENT_MAX_ALPHA = 1;
export declare const hasGradientRangesConfigured: (gs: GradientStyle | undefined) => boolean;
/** Number of sample cells shown in Gradient / Percent Bar style previews. */
export declare const STYLED_COLUMN_PREVIEW_SAMPLE_COUNT = 6;
/** Illustrative zero-centred scale endpoints for preview geometry. */
export declare const ZERO_CENTRED_PREVIEW_SCALE_MIN = -20;
export declare const ZERO_CENTRED_PREVIEW_SCALE_MAX = 20;
/** @deprecated Use {@link getZeroCentredGradientPreviewValues} — kept for callers using endpoints. */
export declare const ZERO_CENTRED_GRADIENT_PREVIEW_VALUES: readonly number[];
export declare const getZeroCentredGradientPreviewValues: () => number[];
export declare function isDivergingZeroCellRanges(ranges: CellColorRange[] | undefined): boolean;
export declare function isZeroCentredGradientStyle(gs: GradientStyle): boolean;
/**
* Sample cell values for gradient preview strips — spread across the effective scale.
*/
export declare const getGradientPreviewSampleValues: (styledColumn: StyledColumn, api: AdaptableApi) => number[];
/**
* Cell CSS for gradient preview — mirrors `AgGridColumnAdapter.getStyledColumnStyle` gradient path.
*/
export declare const getGradientPreviewCellStyle: (cellValue: number, styledColumn: StyledColumn, api: AdaptableApi, rowNode?: IRowNode | null) => CSSProperties;
/**
* Effective cell ranges for gradient rendering / range lookup.
* When `ZeroCentred` is set, expands to the canonical Col-Min…0 and 0…Col-Max bands.
*/
export declare function expandGradientCellRanges(gs: GradientStyle): CellColorRange[] | undefined;
/**
* Value type passed to `findRangeForColumn` / `getCellColorRangeMinValue` /
* `getCellColorRangeMaxValue` when resolving which gradient band a cell falls in.
*
* Zero-centred bands use numeric `0` as an **absolute** zero crossing between
* `Col-Min…0` and `0…Col-Max`. Under `RangeValueType: 'Percentage'`, numeric
* endpoints are interpreted as % positions along the column min–max span, so
* literal `0` wrongly becomes `Col-Min` and the negative band collapses to a
* single point — boundary cells (e.g. the column minimum) pick up the negative
* colour incorrectly. Zero-centred lookup must always use Number semantics.
*/
export declare function gradientStyleRangeLookupValueType(gs: GradientStyle): NumericStyledColumn['RangeValueType'];
/** The negative half of a zero-centred gradient (darker toward Col-Min). */
export declare function isNegativeZeroCentredBand(range: CellColorRange): boolean;