jamis
Version:
一种支持通过JSON配置方式生成页面的组件库
83 lines (82 loc) • 1.98 kB
TypeScript
import type { RendererProps } from 'jamis-core';
import type { BaseSchema, SchemaClassName, SchemaCopyable, SchemaExpression, SchemaObject, SchemaTpl } from '../types';
export interface PropertyItem {
/**
* 属性名
*/
label: SchemaTpl;
/**
* 属性值
*/
content: SchemaTpl | SchemaObject;
/**
* 配置是否显示,如果不显示,后续的节点会补上来
*/
visible?: boolean;
visibleOn?: SchemaExpression;
/**
* 配置是否显示,如果不显示,后续的节点会补上来
*/
hidden?: boolean;
hiddenOn?: SchemaExpression;
/**
* 跨几列
*/
span?: number;
copyable?: SchemaCopyable;
}
/**
* Property 属性列表
*
*/
export interface PropertySchema extends BaseSchema {
/**
* 指定为 property 展示类型
*/
type: 'property';
/**
* 标题
*/
title?: string;
/**
* 一共几列
*/
column?: number;
/**
* 配置几列的表达式
*/
columnExpr?: SchemaExpression;
/**
* 显示模式
*/
mode?: 'table' | 'simple';
/**
* 每个 property 的设置
*/
items: Array<PropertyItem>;
/**
* 标题样式
*/
titleStyle?: React.CSSProperties;
titleClassName?: SchemaClassName;
/**
* 自定义样式
*/
labelStyle?: React.CSSProperties;
labelClassName?: SchemaClassName;
/**
* 分隔符, 默认是`: `
*/
separator?: string;
/**
* 自定义样式
*/
contentStyle?: React.CSSProperties;
contentClassName?: SchemaClassName;
}
export interface PropertyProps extends RendererProps, Omit<PropertySchema, 'type' | 'className'> {
}
export interface PropertyCellProps extends Pick<PropertyProps, 'data' | 'render' | 'env' | 'name' | 'mode' | 'labelClassName' | 'labelStyle' | 'contentClassName' | 'contentStyle' | 'separator'> {
index: number;
property: PropertyItem;
}