feat: 补充物料协议

This commit is contained in:
humphry.hy 2021-12-13 20:12:42 +08:00
parent 820f8c046c
commit 0ac42471c8
5 changed files with 22 additions and 11 deletions

View File

@ -1,10 +1,9 @@
import { NpmInfo } from './npm';
import { PropConfig } from './prop-config';
import { Snippet, ComponentMetadata } from './metadata';
import { I18nData } from './i18n';
/**
* external资源的信息
* external
*
*/
export interface Package {
/**
@ -39,6 +38,7 @@ export interface Package {
/**
*
* @deprecated ComponentMetadata
*/
export interface ComponentCategory {
/**
@ -57,6 +57,7 @@ export interface ComponentCategory {
/**
*
* @deprecated ComponentMetadata
*/
export interface ComponentItem {
/**

View File

@ -3,6 +3,9 @@ import { SetterType, DynamicSetter } from './setter-config';
import { SettingTarget } from './setting-target';
import { LiveTextEditingConfig } from './metadata';
/**
* extra props for field
*/
export interface FieldExtraProps {
/**
*
@ -16,6 +19,9 @@ export interface FieldExtraProps {
* get value for field
*/
getValue?: (target: SettingTarget, fieldValue: any) => any;
/**
* set value for field
*/
setValue?: (target: SettingTarget, value: any) => void;
/**
* the field conditional show, is not set always true
@ -84,6 +90,7 @@ export interface FieldConfig extends FieldExtraProps {
items?: FieldConfig[];
/**
* extra props for field
*
*/
extraProps?: FieldExtraProps;
/**

View File

@ -51,6 +51,7 @@ export interface NodeSchema {
*/
isLocked?: boolean;
// @todo
// ------- future support -----
conditionGroup?: string;
title?: string;

View File

@ -15,10 +15,12 @@ export type CustomView = ReactElement | ComponentType<any>;
export type DynamicProps = (target: SettingTarget) => Record<string, unknown>;
export type DynamicSetter = (target: SettingTarget) => string | SetterConfig | CustomView;
/**
*
* @todo
*/
export interface SetterConfig {
/**
* if *string* passed must be a registered Setter Name
*/
// if *string* passed must be a registered Setter Name
componentName: string | CustomView;
/**
* the props pass to Setter Component
@ -27,15 +29,13 @@ export interface SetterConfig {
children?: any;
isRequired?: boolean;
initialValue?: any | ((target: SettingTarget) => any);
/* for MixedSetter */
// for MixedSetter
title?: TitleContent;
// for MixedSetter check this is available
condition?: (target: SettingTarget) => boolean;
}
/**
* if *string* passed must be a registered Setter Name, future support blockSchema
*/
// if *string* passed must be a registered Setter Name, future support blockSchema
export type SetterType = SetterConfig | SetterConfig[] | string | CustomView;
export function isSetterConfig(obj: any): obj is SetterConfig {

View File

@ -13,7 +13,9 @@ export interface JSExpression {
*
*/
mock?: any;
/** 源码 */
/**
*
*/
compiled?: string;
}