类型调整

This commit is contained in:
2betop 2020-09-15 16:20:48 +08:00
parent 79009c27e9
commit 26d1aecff9
7 changed files with 141 additions and 12 deletions

View File

@ -9,6 +9,7 @@ import {BaseSchema} from '../Schema';
export interface DividerSchema extends BaseSchema {
type: 'divider';
lineStyle?: 'dashed' | 'solid';
[propName: string]: any;
}
export interface DividerProps extends RendererProps, DividerSchema {}

View File

@ -9,7 +9,46 @@ import Editor from '../../components/Editor';
* https://baidu.gitee.io/amis/docs/components/form/editor
*/
export interface EditorControlSchema extends Omit<FormBaseControl, 'size'> {
type: 'editor';
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';
/**
*

View File

@ -63,7 +63,7 @@ import {RatingControlSchema} from './Rating';
import {RepeatControlSchema} from './Repeat';
import {RichTextControlSchema} from './RichText';
import {ServiceControlSchema} from './Service';
import {StaticControlSchema} from './Static';
import {StaticControlRestSchema, StaticControlSchema} from './Static';
import {SubFormControlSchema} from './SubForm';
import {SwitchControlSchema} from './Switch';
import {TableControlSchema} from './Table';
@ -73,6 +73,9 @@ import {TagControlSchema} from './Tag';
import {TransferControlSchema} from './Transfer';
import {TreeControlSchema} from './Tree';
import {TreeSelectControlSchema} from './TreeSelect';
import {PlainSchema} from '../Plain';
import {TplSchema} from '../Tpl';
import {DividerSchema} from '../Divider';
export type FormControlType =
| 'array'
@ -94,7 +97,49 @@ export type FormControlType =
| 'time'
| 'date-range'
| 'diff'
// editor 系列
| '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'
//
| 'fieldset'
| 'file'
| 'formula'
@ -134,7 +179,13 @@ export type FormControlType =
| 'textarea'
| 'transfer'
| 'tree'
| 'tree-select';
| 'tree-select'
// 非表单项但是也可以放进来
| 'divider'
| 'html'
| 'plain'
| 'tpl';
export type FormControlSchema =
| ArrayControlSchema
@ -182,6 +233,7 @@ export type FormControlSchema =
| SubFormControlSchema
| SwitchControlSchema
| StaticControlSchema
| StaticControlRestSchema
| TableControlSchema
| TabsControlSchema
| TabsTransferControlSchema
@ -190,7 +242,10 @@ export type FormControlSchema =
| TextareaControlSchema
| TransferControlSchema
| TreeControlSchema
| TreeSelectControlSchema;
| TreeSelectControlSchema
// 非表单项,但是也可以放进来。
| DividerSchema;
export type FormControlSchemaAlias = FormControlSchema;
@ -208,7 +263,7 @@ export interface FormBaseControl extends Omit<BaseSchema, 'type'> {
/**
*
*/
label?: string;
label?: string | false;
/**
* label className
@ -256,6 +311,11 @@ export interface FormBaseControl extends Omit<BaseSchema, 'type'> {
*/
description?: string;
/**
* @deprecated description
*/
desc?: string;
/**
* className
*/

View File

@ -25,7 +25,7 @@ export interface ListControlSchema extends FormOptionsControl {
/**
* div类名
*/
imageClassName: string;
imageClassName?: string;
/**
*

View File

@ -1,12 +1,12 @@
import React from 'react';
import {FormItem, FormControlProps, FormBaseControl} from './Item';
import {TableCell} from '../Table';
import PopOver from '../PopOver';
import QuickEdit from '../QuickEdit';
import PopOver, {SchemaPopOver} from '../PopOver';
import QuickEdit, {SchemaQuickEdit} from '../QuickEdit';
import {Renderer} from '../../factory';
import Copyable from '../Copyable';
import Copyable, {SchemaCopyable} from '../Copyable';
import {extendObject} from '../../utils/helper';
import {SchemaTpl} from '../../Schema';
import {SchemaTpl, SchemaType} from '../../Schema';
/**
* Static
@ -24,6 +24,28 @@ export interface StaticControlSchema extends FormBaseControl {
* HTML
*/
text?: SchemaTpl;
/**
*
*/
popOver?: SchemaPopOver;
/**
*
*/
quickEdit?: SchemaQuickEdit;
/**
*
*/
copyable?: SchemaCopyable;
}
export interface StaticControlRestSchema
extends Omit<StaticControlSchema, 'type'> {
type: SchemaType;
[propName: string]: any;
}
export interface StaticProps extends FormControlProps {

View File

@ -25,7 +25,7 @@ export interface TagControlSchema extends FormOptionsControl {
/**
*
*/
optionsTip: string;
optionsTip?: string;
/**
*

View File

@ -51,7 +51,7 @@ import {ActionSchema} from '../Action';
export interface FormSchemaHorizontal {
left?: number;
right?: number;
leftField?: boolean | number | 'xs' | 'sm' | 'md' | 'lg';
leftFixed?: boolean | number | 'xs' | 'sm' | 'md' | 'lg';
}
/**
@ -177,7 +177,14 @@ export interface FormSchema extends BaseSchema {
*/
resetAfterSubmit?: boolean;
/**
*
*/
mode?: 'normal' | 'inline' | 'horizontal';
/**
*
*/
horizontal?: FormSchemaHorizontal;
/**