UNPKG

jamis

Version:

一种支持通过JSON配置方式生成页面的组件库

128 lines (127 loc) 2.72 kB
import type { RendererProps, SchemaClassName, ThemeProps, WithRemoteItem } from 'jamis-core'; import type { BaseSchema, SchemaCollection, SchemaExpression } from '../types'; export type StepStatus = 'wait' | 'process' | 'finish' | 'error'; export type StepObject = { className?: SchemaClassName; /** * 标题 */ title?: string | JSX.Element; /** * 子标题 */ subTitle?: string | JSX.Element; /** * 图标 */ icon?: string; value?: string | number; /** * 描述 */ description?: string | JSX.Element; status?: StepStatus; iconClassName?: string; }; export interface StepsObject { /** * 指定为 Steps 步骤条渲染器 */ type: 'steps'; /** * 步骤 */ steps?: Array<StepObject>; /** * API 或 数据映射 */ source?: string; /** * 指定当前步骤 */ value?: number | string; /** * 变量映射 */ name?: string; status: StepStatus; /** * 展示模式 */ mode?: 'horizontal' | 'vertical'; /** * 标签放置位置 */ labelPlacement?: 'horizontal' | 'vertical'; } export interface StepsProps extends ThemeProps { steps: StepObject[]; current: number; status?: StepStatus | { [propName: string]: StepStatus; }; mode?: 'horizontal' | 'vertical'; labelPlacement?: 'horizontal' | 'vertical'; progressDot?: boolean; progressDotClassName?: SchemaClassName; } export interface StepSchema extends WithRemoteItem { /** * 标题 */ title: SchemaCollection; /** * 子标题 */ subTitle?: SchemaCollection; /** * 图标 */ icon?: string; value?: string | number; /** * 描述 */ description?: SchemaCollection; className?: SchemaClassName; } export interface StepsSchema extends BaseSchema { /** * 指定为 Steps 步骤条渲染器 */ type: 'steps'; /** * 步骤 */ steps?: Array<StepSchema>; /** * API 或 数据映射 */ source?: string; /** * 指定当前步骤 */ value?: number | string; /** * 变量映射 */ name?: string; status?: StepStatus | { [propName: string]: StepStatus; } | SchemaExpression; /** * 展示模式 */ mode?: 'horizontal' | 'vertical'; /** * 标签放置位置 */ labelPlacement?: 'horizontal' | 'vertical'; /** * 点状步骤条 */ progressDot?: boolean; progressDotClassName?: SchemaClassName; } export interface StepsRendererProps extends RendererProps, Omit<StepsSchema, 'className'> { }