@antv/s2
Version:
effective spreadsheet render core lib
51 lines (50 loc) • 2.27 kB
TypeScript
import { type DataCellStyle, type MultiData, type S2CellType, type S2Options, type SimpleData } from '../common/interface';
import type { SimpleBBox } from '../engine';
export declare const getDisplayText: (text: SimpleData, placeholder?: string | undefined | null) => string | null | undefined;
export declare const replaceEmptyFieldValue: (value: string) => string;
/**
* To decide whether the data is positive or negative.
* Two cases needed to be considered since the derived value could be number or string.
* @param value
*/
export declare const isUpDataValue: (value: SimpleData) => boolean;
/**
* Determines whether the data is actually equal to 0 or empty or nil
* example: "0.00%" => true
* @param value
*/
export declare const isZeroOrEmptyValue: (value: SimpleData) => boolean;
/**
* Determines whether the data is actually equal to 0 or empty or nil or equals to compareValue
* example: "0.00%" => true
* @param value
* @param compareValue
*/
export declare const isUnchangedValue: (value: SimpleData, compareValue: SimpleData) => boolean;
/**
* 获取自定义空值占位符
*/
export declare const getEmptyPlaceholder: (meta: Record<string, any>, placeHolder: S2Options['placeholder']) => string | null | undefined;
/**
* @desc 获取多指标情况下每一个指标的内容包围盒
* --------------------------------------------
* | text icon | text icon | text icon |
* |-------------|-------------|-------------|
* | text icon | text icon | text icon |
* --------------------------------------------
* @param box SimpleBBox 整体绘制内容包围盒
* @param textValues SimpleDataItem[][] 指标集合
* @param widthPercent number[] 每行指标的宽度百分比
*/
export declare const getContentAreaForMultiData: (box: SimpleBBox, textValues: SimpleData[][], widthPercent?: number[]) => SimpleBBox[][];
/**
* @desc draw text shape of object
* @param cell
* @multiData 自定义文本内容
* @useCondition 是否使用条件格式
*/
export declare const drawCustomContent: (cell: S2CellType, multiData?: MultiData, useCondition?: boolean) => void;
/**
* 根据 dataCell 配置获取当前单元格宽度
*/
export declare const getCellWidth: (dataCell: DataCellStyle, labelSize?: number) => number;