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 { Snippet, ComponentMetadata } from './metadata';
import { I18nData } from './i18n'; import { I18nData } from './i18n';
/** /**
* 定义组件大包及external资源的信息,应该被编辑器默认加载 * 定义组件大包及 external 资源的信息
* 应该被编辑器默认加载
*/ */
export interface Package { export interface Package {
/** /**
@ -39,6 +38,7 @@ export interface Package {
/** /**
* 组件分类 * 组件分类
* @deprecated 已被 ComponentMetadata 替代
*/ */
export interface ComponentCategory { export interface ComponentCategory {
/** /**
@ -57,6 +57,7 @@ export interface ComponentCategory {
/** /**
* 组件 * 组件
* @deprecated 已被 ComponentMetadata 替代
*/ */
export interface ComponentItem { export interface ComponentItem {
/** /**

View File

@ -3,6 +3,9 @@ import { SetterType, DynamicSetter } from './setter-config';
import { SettingTarget } from './setting-target'; import { SettingTarget } from './setting-target';
import { LiveTextEditingConfig } from './metadata'; import { LiveTextEditingConfig } from './metadata';
/**
* extra props for field
*/
export interface FieldExtraProps { export interface FieldExtraProps {
/** /**
* 是否必填参数 * 是否必填参数
@ -16,6 +19,9 @@ export interface FieldExtraProps {
* get value for field * get value for field
*/ */
getValue?: (target: SettingTarget, fieldValue: any) => any; getValue?: (target: SettingTarget, fieldValue: any) => any;
/**
* set value for field
*/
setValue?: (target: SettingTarget, value: any) => void; setValue?: (target: SettingTarget, value: any) => void;
/** /**
* the field conditional show, is not set always true * the field conditional show, is not set always true
@ -84,6 +90,7 @@ export interface FieldConfig extends FieldExtraProps {
items?: FieldConfig[]; items?: FieldConfig[];
/** /**
* extra props for field * extra props for field
* 其他配置属性(不做流通要求)
*/ */
extraProps?: FieldExtraProps; extraProps?: FieldExtraProps;
/** /**

View File

@ -51,6 +51,7 @@ export interface NodeSchema {
*/ */
isLocked?: boolean; isLocked?: boolean;
// @todo
// ------- future support ----- // ------- future support -----
conditionGroup?: string; conditionGroup?: string;
title?: 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 DynamicProps = (target: SettingTarget) => Record<string, unknown>;
export type DynamicSetter = (target: SettingTarget) => string | SetterConfig | CustomView; export type DynamicSetter = (target: SettingTarget) => string | SetterConfig | CustomView;
/**
* 设置器配置
* @todo
*/
export interface SetterConfig { export interface SetterConfig {
/** // if *string* passed must be a registered Setter Name
* if *string* passed must be a registered Setter Name
*/
componentName: string | CustomView; componentName: string | CustomView;
/** /**
* the props pass to Setter Component * the props pass to Setter Component
@ -27,15 +29,13 @@ export interface SetterConfig {
children?: any; children?: any;
isRequired?: boolean; isRequired?: boolean;
initialValue?: any | ((target: SettingTarget) => any); initialValue?: any | ((target: SettingTarget) => any);
/* for MixedSetter */ // for MixedSetter
title?: TitleContent; title?: TitleContent;
// for MixedSetter check this is available // for MixedSetter check this is available
condition?: (target: SettingTarget) => boolean; 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 type SetterType = SetterConfig | SetterConfig[] | string | CustomView;
export function isSetterConfig(obj: any): obj is SetterConfig { export function isSetterConfig(obj: any): obj is SetterConfig {

View File

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