import type { ActionObject } from 'jamis-core'; import type { BadgeObject, BaseSchema, SchemaCollection, SchemaTpl, StaticControlSchema, StaticControlSchemaBase } from '../../types'; export * from './_Alert'; export * from './_Custom'; export * from './_Json'; export * from './_Remark'; /** * tpl 组件 */ export interface TplSchema extends BaseSchema { type: 'tpl' | 'html'; /** 标题 */ title?: string; tpl?: SchemaTpl | SchemaTpl[]; html?: SchemaTpl | SchemaTpl[]; text?: SchemaTpl | SchemaTpl[]; raw?: string; /** * 是否内联显示? */ inline?: boolean; /** * 角标 */ badge?: BadgeObject; /** 占位符 */ placeholder?: string; icon?: string; wrapperComponent?: React.ElementType; } export interface StaticTplSchema extends Omit, StaticControlSchemaBase { type: 'static-html' | 'static-tpl'; } /** * Divider 分割线组件。 * */ export interface DividerSchema extends BaseSchema { type: 'divider'; lineStyle?: 'dashed' | 'solid'; title?: SchemaTpl; } /** * Each 循环功能组件。 * */ export interface EachSchema extends BaseSchema { /** * 指定为each展示类型 */ type: 'each'; /** * 关联字段名 */ name?: string; /** * 关联字段名 支持数据映射 */ source?: string; items?: SchemaCollection; placeholder?: string; value?: any; } /** * Link 链接展示控件。 * */ export interface LinkSchema extends BaseSchema { /** * 指定为 link 链接展示控件 */ type: 'link'; /** * 是否新窗口打开。 */ blank?: boolean; /** * 链接地址 */ href?: string; /** * 链接内容,如果不配置将显示链接地址。 */ body?: SchemaTpl; /** * 角标 */ badge?: BadgeObject; /** * a标签原生target属性 */ htmlTarget?: string; /** * 图标 */ icon?: string; /** * 右侧图标 */ rightIcon?: string; } /** * Plain 纯文本组件 * */ export interface PlainSchema extends BaseSchema, StaticControlSchemaBase { /** * 指定为模板组件。 * * */ type: 'plain' | 'text'; tpl?: SchemaTpl; text?: SchemaTpl; /** * 是否内联显示? */ inline?: boolean; /** * 占位符 * @deprecated - */ placeholder?: string; /** * 后缀属性, 这个属性应该所有的formitem都具备 */ addOn?: (ActionObject | StaticControlSchema | BaseSchema) & { position?: 'left' | 'right'; label?: string; icon?: string; className?: string; }; } export interface StaticPlainSchema extends Omit { type: 'static-text' | 'static-plain'; } /** * 状态展示控件。 * */ export interface StatusSchema extends BaseSchema { /** * 指定为状态展示控件 */ type: 'status'; /** * 占位符 * @default - */ placeholder?: string; /** * 状态图标映射关系 * @default { * 0: 'svg-fail', * 1: 'svg-success', * success: 'svg-success', * pending: 'rolling', * fail: 'svg-fail', * queue: 'svg-warning', * schedule: 'svg-schedule' * } */ map?: { [propName: string]: string; }; /** * 文字映射关系 * * @default { * success: '成功', * pending: '运行中', * fail: '失败', * queue: '排队中', * schedule: '调度中' * } */ labelMap?: { [propName: string]: string; }; /** 默认值 */ value?: number | string; }