jamis
Version:
一种支持通过JSON配置方式生成页面的组件库
104 lines (103 loc) • 2.42 kB
TypeScript
import type { SchemaClassName, ThemeProps } from 'jamis-core';
import type { BaseSchema, SchemaTpl, StaticControlSchemaBase } from '../types';
export interface ColorItemType {
value: number;
color: string;
}
export interface ThresholdProps {
value: string;
color?: string;
}
export type ColorMapType = Array<string> | Array<ColorItemType> | string;
export interface ProgressProps extends ThemeProps {
type: 'line' | 'circle' | 'dashboard';
showLabel: boolean;
value: number;
stripe?: boolean;
animate?: boolean;
map?: ColorMapType;
placeholder?: string;
format?: (value?: number) => JSX.Element;
gapDegree?: number;
gapPosition?: 'top' | 'bottom' | 'left' | 'right';
strokeWidth?: number;
progressClassName?: SchemaClassName;
threshold: ThresholdProps | ThresholdProps[];
showThresholdText: boolean;
}
/**
* 进度展示控件。
*
*/
export interface ProgressSchema extends BaseSchema {
type: 'progress';
/**
* 关联字段名
*/
name?: string;
/**
* 进度值
*/
value: number;
/**
* 进度条类型
*/
mode?: 'line' | 'circle' | 'dashboard';
/**
* 进度条 CSS 类名
*/
progressClassName?: SchemaClassName;
/**
* 配置不同的值段,用不同的样式提示用户
*/
map?: ColorMapType;
/**
* 是否显示值
*/
showLabel?: boolean;
/**
* 占位符
*/
placeholder?: string;
/**
* 是否显示背景间隔
*/
stripe?: boolean;
/**
* 是否显示动画(只有在开启的时候才能看出来)
*/
animate?: boolean;
/**
* 进度条线的宽度
*/
strokeWidth?: number;
/**
* 仪表盘进度条缺口角度,可取值 0 ~ 295
*/
gapDegree?: number;
/**
* 仪表盘进度条缺口位置
*/
gapPosition?: 'top' | 'bottom' | 'left' | 'right';
/**
* 内容的模板函数
*/
valueTpl?: string;
/**
* 阈值
*/
threshold?: {
value: SchemaTpl;
color?: string;
} | {
value: SchemaTpl;
color?: string;
}[];
/**
* 是否显示阈值数值
*/
showThresholdText?: boolean;
}
export interface StaticProgressSchema extends Omit<ProgressSchema, 'type'>, Omit<StaticControlSchemaBase, 'mode' | 'value'> {
type: 'static-progress';
}