jamis
Version:
一种支持通过JSON配置方式生成页面的组件库
57 lines (56 loc) • 2.45 kB
TypeScript
import type { OnEventProps, SchemaExpression } from 'jamis-core';
import type { FormBaseControl, FormBaseControlSchema, FormControlProps, SchemaTokenizeableString, SizeUnit } from '../types';
/**
* Editor 代码编辑器
*
*/
export interface EditorControlSchema extends Omit<FormBaseControl, 'size'>, OnEventProps {
type: 'editor' | 'bat-editor' | 'c-editor' | 'coffeescript-editor' | 'cpp-editor' | 'csharp-editor' | 'css-editor' | 'dockerfile-editor' | 'fsharp-editor' | 'go-editor' | 'handlebars-editor' | 'html-editor' | 'ini-editor' | 'java-editor' | 'javascript-editor' | 'json-editor' | 'less-editor' | 'lua-editor' | 'markdown-editor' | 'msdax-editor' | 'objective-c-editor' | 'php-editor' | 'plaintext-editor' | 'postiats-editor' | 'powershell-editor' | 'pug-editor' | 'python-editor' | 'r-editor' | 'razor-editor' | 'ruby-editor' | 'sb-editor' | 'scss-editor' | 'sol-editor' | 'sql-editor' | 'swift-editor' | 'typescript-editor' | 'vb-editor' | 'xml-editor' | 'yaml-editor';
/**
* 语言类型
*/
language?: 'bat' | 'c' | 'coffeescript' | 'cpp' | 'csharp' | 'css' | 'dockerfile' | 'fsharp' | 'go' | 'handlebars' | 'html' | 'ini' | 'java' | 'javascript' | 'json' | 'less' | 'lua' | 'markdown' | 'msdax' | 'objective-c' | 'php' | 'plaintext' | 'postiats' | 'powershell' | 'pug' | 'python' | 'r' | 'razor' | 'ruby' | 'sb' | 'scss' | 'shell' | 'sol' | 'sql' | 'swift' | 'typescript' | 'vb' | 'xml' | 'yaml';
/**
* 编辑器大小
*/
size?: SizeUnit | 'xxl';
sizeExpr?: SchemaExpression;
/**
* 是否展示全屏模式开关
*/
allowFullscreen?: boolean;
/**
* 获取编辑器底层实例
*/
editorDidMount?: string;
/**
* 默认打底的内容
*/
placeholder?: string;
}
export type EditorRendererEvent = 'blur' | 'focus';
export interface EditorProps extends FormControlProps, Omit<EditorControlSchema, 'className' | 'descriptionClassName' | 'inputClassName' | 'editorDidMount' | 'size'> {
options?: Record<string, any>;
}
/**
* Diff 编辑器
*
*/
export interface DiffControlSchema extends FormBaseControlSchema {
/**
* 指定为 Diff 编辑器
*/
type: 'diff-editor';
/**
* 左侧面板的值, 支持取变量。
*/
diffValue?: SchemaTokenizeableString;
/**
* 语言,参考 monaco-editor
*/
language?: string;
/**
* 编辑器配置
*/
options?: any;
}