@antv/t8
Version:
T8 is a text visualization solution for unstructured data within the AntV technology stack, and it is a declarative T8 markdown syntax that can be used to describe the content of data interpretation reports.
62 lines • 2.25 kB
TypeScript
import { CustomMetaData, CommonProps } from './common';
export type PhraseSpec = TextPhraseSpec | EntityPhraseSpec | CustomPhraseSpec<CustomMetaData>;
export declare enum PhraseType {
TEXT = "text",
ENTITY = "entity",
CUSTOM = "custom"
}
export type TextPhraseSpec = CommonProps & {
type: PhraseType.TEXT;
value: string;
bold?: boolean;
italic?: boolean;
underline?: boolean;
url?: string;
};
export type EntityPhraseSpec = CommonProps & {
type: PhraseType.ENTITY;
value?: string;
metadata?: EntityMetaData;
};
export type CustomPhraseSpec<P extends CustomMetaData = CustomMetaData> = CommonProps & {
type: PhraseType.CUSTOM;
value?: string;
metadata?: P;
};
export type ValueAssessment = 'positive' | 'negative' | 'equal';
export declare const EntityType: readonly ["metric_name", "metric_value", "other_metric_value", "contribute_ratio", "delta_value", "ratio_value", "trend_desc", "dim_value", "time_desc", "proportion", "rank", "difference", "anomaly", "association", "distribution", "seasonality"];
export type EntityType = (typeof EntityType)[number];
export type EntityMetaData = {
/**
* entity type, 实体类型标记
* */
entityType: EntityType;
/**
* assessment up or down, used for derived value
* 衍生指标评估参数,指定上涨或者下跌
* */
assessment?: ValueAssessment;
/**
* original data, 原始数据
* */
origin?: number;
/**
* detail data, 明细数据,用于弹框展示
*/
detail?: unknown;
/** source id of the variable, to access the variable info from variableSourceMap */
sourceId?: string;
};
export type TypeOrMetaReturnType<T> = T | ((...args: any[]) => T);
/** entity phrase encoding channel */
export type EntityEncoding<NodeType> = Partial<{
color: TypeOrMetaReturnType<string>;
bgColor: TypeOrMetaReturnType<string>;
fontSize: TypeOrMetaReturnType<string | number>;
fontWeight: TypeOrMetaReturnType<string | number>;
underline: TypeOrMetaReturnType<boolean>;
prefix: TypeOrMetaReturnType<NodeType>;
suffix: TypeOrMetaReturnType<NodeType>;
inlineChart: TypeOrMetaReturnType<NodeType>;
}>;
//# sourceMappingURL=phrase.d.ts.map