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; name: string;
/** /**
* *
* type 'Panel' 'leftFloatArea' * - type 'Panel' 'leftFloatArea'
* type 'Widget' 'mainArea' * - type 'Widget' 'mainArea'
* 'leftArea' * - 'leftArea'
*/ */
area?: IWidgetConfigArea; area?: IWidgetConfigArea;
props?: Record<string, any>; props?: Record<string, any>;

View File

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

View File

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

View File

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

View File

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

View File

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