docs: 针对标准补完 value-type 和 seter-config 的类型

This commit is contained in:
humphry.hy 2021-12-14 11:38:07 +08:00
parent 0ac42471c8
commit 5f65901447
6 changed files with 81 additions and 9 deletions

View File

@ -18,9 +18,9 @@ export interface IWidgetBaseConfig {
name: string;
/**
*
* type 'Panel' 'leftFloatArea'
* type 'Widget' 'mainArea'
* 'leftArea'
* - type 'Panel' 'leftFloatArea'
* - type 'Widget' 'mainArea'
* - 'leftArea'
*/
area?: IWidgetConfigArea;
props?: Record<string, any>;

View File

@ -27,7 +27,7 @@ export interface Package {
*/
library: string;
/**
* @todo
* @todo @jinchan
*/
async?: boolean;
/**
@ -97,7 +97,7 @@ export interface ComponentItem {
*/
export interface ComponentDescription extends ComponentMetadata {
/**
* @todo
* @todo @jinchan
*/
keywords: string[];
}

View File

@ -68,7 +68,7 @@ export interface FieldExtraProps {
*/
export interface FieldConfig extends FieldExtraProps {
/**
* @todo
* field
*/
type?: 'field' | 'group';
/**
@ -81,6 +81,8 @@ export interface FieldConfig extends FieldExtraProps {
*/
title?: TitleContent;
/**
* setter
*
* the field body contains when .type = 'field'
*/
setter?: SetterType | DynamicSetter;

View File

@ -86,6 +86,11 @@ export interface ComponentConfigure {
actions?: ComponentAction[];
}
/**
*
*
* schema () schema snippets schema
*/
export interface Snippet {
/**
* title
@ -99,6 +104,9 @@ export interface Snippet {
* @todo snippet
*/
label?: string;
/**
* @todo
*/
schema?: NodeSchema;
}

View File

@ -1,6 +1,7 @@
import { ComponentClass, Component, ComponentType, ReactElement, isValidElement } from 'react';
import { TitleContent } from './title';
import { SettingTarget } from './setting-target';
import { CompositeValue } from './value-type';
function isReactClass(obj: any): obj is ComponentClass<any> {
return obj && obj.prototype && (obj.prototype.isReactComponent || obj.prototype instanceof Component);
@ -21,18 +22,48 @@ export type DynamicSetter = (target: SettingTarget) => string | SetterConfig | C
*/
export interface SetterConfig {
// if *string* passed must be a registered Setter Name
/**
* setter
*/
componentName: string | CustomView;
/**
* setter
*
* the props pass to Setter Component
*/
props?: Record<string, unknown> | DynamicProps;
/**
* @deprecated
*/
children?: any;
/**
*
*
* ArraySetter
*/
isRequired?: boolean;
/**
* Setter
*
* @todo initialValue defaultValue
*/
initialValue?: any | ((target: SettingTarget) => any);
// for MixedSetter
/**
* MixedSetter Setter
*/
title?: TitleContent;
// for MixedSetter check this is available
/**
* MixedSetter
*/
condition?: (target: SettingTarget) => boolean;
/**
* MixedSetter
*
* @todo
*/
valueType?: CompositeValue[];
}
// if *string* passed must be a registered Setter Name, future support blockSchema

View File

@ -1,7 +1,9 @@
import { NodeSchema, NodeData } from './schema';
/**
*
*
*
* this
*/
export interface JSExpression {
type: 'JSExpression';
@ -11,10 +13,14 @@ export interface JSExpression {
value: string;
/**
*
*
* @todo
*/
mock?: any;
/**
*
*
* @todo
*/
compiled?: string;
}
@ -22,6 +28,8 @@ export interface JSExpression {
/**
*
* @see https://yuque.antfin-inc.com/mo/spec/spec-low-code-building-schema#feHTW
*
* ( React / ) binding this
*/
export interface JSFunction {
type: 'JSFunction';
@ -30,35 +38,58 @@ export interface JSFunction {
*/
value: string;
/** 源码 */
/**
*
*
* @todo
*/
compiled?: string;
/**
*
*
* @todo
*/
mock?: any;
/**
* extTypeevents
*
* @todo
*/
[key: string]: any;
}
/**
* Slot
*
* ReactNode Function return ReactNode
*/
export interface JSSlot {
type: 'JSSlot';
/**
* @todo
*/
title?: string;
/**
*
* Function return ReactNode
*
* this[]
*/
params?: string[];
/**
*
*/
value?: NodeData[] | NodeData;
/**
* @todo
*/
name?: string;
}
/**
* @deprecated
*
* @todo
*/
export interface JSBlock {