jamis
Version:
一种支持通过JSON配置方式生成页面的组件库
28 lines (27 loc) • 968 B
TypeScript
import type { FormBaseControl, FormControlProps, StaticControlSchemaBase } from '../../types';
/**
* 自定义组件
*/
export interface CustomSchema extends FormBaseControl {
/**
* 实现自定义功能的组件,主要给 JS SDK 和可视化编辑器里使用。
*
*
*/
type: 'custom' | `custom-${string}`;
onMount?: (dom: HTMLElement, value: any, onChange: (val: any) => void, props: any) => void | string;
onUpdate?: Function | string;
onUnmount?: Function | string;
inline?: boolean;
id?: string;
html?: string;
}
export interface StaticCustomSchema extends Omit<CustomSchema, 'type' | 'remark' | 'labelRemark'>, StaticControlSchemaBase {
type: 'static-custom' | `static-custom-${string}`;
}
export interface CustomProps extends FormControlProps, Omit<CustomSchema, 'inputClassName' | 'descriptionClassName'> {
className?: string;
value?: any;
wrapperComponent?: any;
inline?: boolean;
}