jamis
Version:
一种支持通过JSON配置方式生成页面的组件库
47 lines (46 loc) • 1.58 kB
TypeScript
/**
* 用来定义数据结构的编辑器
*/
import React from 'react';
import type { JSONSchema, LocaleProps, ThemeProps } from 'jamis-core';
import type { JSONSchema7TypeName } from 'json-schema';
export interface SchemaEditorProps extends LocaleProps, ThemeProps {
value?: JSONSchema;
onChange: (value: JSONSchema) => void;
disabled?: boolean;
defaultType: JSONSchema7TypeName;
renderExtraProps?: (value: JSONSchema, onChange: (value: JSONSchema) => void) => JSX.Element;
renderModalProps?: (value: JSONSchema, onChange: (value: JSONSchema) => void) => JSX.Element;
disabledTypes?: Array<string>;
/**
* 预设模板
*/
definitions?: {
[propName: string]: {
type: 'string' | 'number' | 'integer' | 'object' | 'array' | 'boolean' | 'null';
title: string;
[propName: string]: any;
};
};
/**
* 顶层是否允许修改类型
*/
rootTypeMutable: boolean;
/**
* 顶层类型信息是否隐藏
*/
showRootInfo: boolean;
/**
* 是否开启高级配置
*/
enableAdvancedSetting?: boolean;
}
export declare class SchemaEditor extends React.Component<SchemaEditorProps> {
static defaultProps: Pick<SchemaEditorProps, 'defaultType' | 'rootTypeMutable' | 'showRootInfo' | 'disabledTypes'>;
defaultTypes: Array<any>;
constructor(props: SchemaEditorProps);
handleTypeChange(type: string, value: any, origin: any): any;
render(): JSX.Element;
}
declare const _default: typeof SchemaEditor;
export default _default;