UNPKG

@adaptabletools/adaptable

Version:

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

73 lines (72 loc) 3.44 kB
import * as React from 'react'; import { AdaptableApi } from '../../Api/AdaptableApi'; import { CellColorRange, ColumnComparison, NumericStyledColumn } from '../../AdaptableState/StyledColumns/Common/NumericStyledColumn'; import { ZeroCentredColors } from '../../AdaptableState/StyledColumns/GradientStyle'; import { ColumnScope } from '../../AdaptableState/Common/ColumnScope'; export interface RangesComponentProps extends React.ClassAttributes<RangesComponent> { ranges: CellColorRange[]; columnComparison?: ColumnComparison; rangeValueType: NumericStyledColumn['RangeValueType']; onRangeValueTypeChange: (rangeValueType: NumericStyledColumn['RangeValueType']) => void; scope: ColumnScope; api: AdaptableApi; updateRanges: (ranges: CellColorRange[]) => void; updateColumnComparison: (columnComparison?: ColumnComparison) => void; minMaxRangeValues: { min: number; max: number; } | null; disabled?: boolean; /** * When true, the user may delete every band so `ranges` becomes `[]`. * Range Bar treats bands as optional; Gradient / Percent Bar / Bullet Chart * keep at least one row by default. */ allowEmptyRanges?: boolean; /** * When true, the "Column Comparison" tab is omitted entirely. Used by Bullet * Chart and Range Bar, where the bands ARE the chart's qualitative scale and * Column Comparison doesn't make sense in the same way it does for Percent * Bar / Gradient. The Number Range / Percentage Range tabs are still shown. */ hideColumnComparison?: boolean; /** * When true, expose a third tab "Zero Centred Ranges" (Gradient only). Requires * `onApplyZeroCentred` and optional `zeroCentred` for the current colours. */ showZeroCentredTab?: boolean; zeroCentred?: ZeroCentredColors; onApplyZeroCentred?: (zc: ZeroCentredColors) => void; /** * When true, render a per-range "Reverse Gradient" toggle. Only meaningful * for Gradient Style (the renderer flips the alpha ramp within the band so * the lower the value, the darker the colour). Percent Bar / Bullet Chart * leave this off. */ showRangeDirection?: boolean; } export interface RangesComponentState { rangesType: 'None' | 'NumberRange' | 'PercentageRange' | 'ZeroCentred' | 'ColumnComparison'; } export declare class RangesComponent extends React.Component<RangesComponentProps, RangesComponentState> { constructor(props: RangesComponentProps); render(): React.JSX.Element; componentDidUpdate(prevProps: RangesComponentProps): void; private handleRangesModeTab; changeRangeMin(index: number, value: number): void; changeRangeMax(index: number, value: number): void; changeRangeColor(index: number, value: string): void; changeRangeDirectionUp(index: number, checked: boolean): void; removeRange(index: number): void; setRangeColMin(range: CellColorRange): void; setRangeColMax(range: CellColorRange): void; addRange(): void; /** * When there is exactly one band spanning the full scale (Col-Min→Col-Max or * 0→100), split at the midpoint instead of at the column maximum. */ private splitFullSpanRangeAtMidpoint; setColumnComparisonMin(value: number | string | undefined): void; setColumnComparisonMax(value: number | string | undefined): void; changeColumnComparisonColor(value: string): void; }