mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-14 21:12:53 +00:00
feat: fix designer:entry ts errors
This commit is contained in:
parent
4433b2ee78
commit
4d4a8a6d6f
@ -833,11 +833,11 @@ props 数组下对象字段描述:
|
|||||||
| name | 属性名 | String | type = 'field' 生效 |
|
| name | 属性名 | String | type = 'field' 生效 |
|
||||||
| defaultValue | 默认值 | Any(视字段类型而定) | type = 'field' 生效 |
|
| defaultValue | 默认值 | Any(视字段类型而定) | type = 'field' 生效 |
|
||||||
| supportVariable | 是否支持配置变量 | Boolean | type = 'field' 生效 |
|
| supportVariable | 是否支持配置变量 | Boolean | type = 'field' 生效 |
|
||||||
| condition | 配置当前 prop 是否展示 | (target: SettingTarget) => boolean; | - |
|
| condition | 配置当前 prop 是否展示 | (target: IPublicModelSettingField) => boolean; | - |
|
||||||
| setter | 单个控件 (setter) 描述,搭建基础协议组件的描述对象,支持 JSExpression / JSFunction / JSSlot | `String\|Object\|Function` | type = 'field' 生效 |
|
| setter | 单个控件 (setter) 描述,搭建基础协议组件的描述对象,支持 JSExpression / JSFunction / JSSlot | `String\|Object\|Function` | type = 'field' 生效 |
|
||||||
| extraProps | 其他配置属性(不做流通要求) | Object | 其他配置 |
|
| extraProps | 其他配置属性(不做流通要求) | Object | 其他配置 |
|
||||||
| extraProps.getValue | setter 渲染时被调用,setter 会根据该函数的返回值设置 setter 当前值 | Function | (target: SettingTarget, value: any) => any; |
|
| extraProps.getValue | setter 渲染时被调用,setter 会根据该函数的返回值设置 setter 当前值 | Function | (target: IPublicModelSettingField, value: any) => any; |
|
||||||
| extraProps.setValue | setter 内容修改时调用,开发者可在该函数内部修改节点 schema 或者进行其他操作 | Function | (target: SettingTarget, value: any) => void; |
|
| extraProps.setValue | setter 内容修改时调用,开发者可在该函数内部修改节点 schema 或者进行其他操作 | Function | (target: IPublicModelSettingField, value: any) => void; |
|
||||||
|
|
||||||
|
|
||||||
根据属性值类型 propType,确定对应控件类型 (setter) 。
|
根据属性值类型 propType,确定对应控件类型 (setter) 。
|
||||||
@ -922,7 +922,7 @@ props 数组下对象字段描述:
|
|||||||
|
|
||||||
| 字段 | 用途 | 类型 | 备注 |
|
| 字段 | 用途 | 类型 | 备注 |
|
||||||
| ------------------------------- | --------------------------------------------------------------------------------------------------- | ------- | --- |
|
| ------------------------------- | --------------------------------------------------------------------------------------------------- | ------- | --- |
|
||||||
|initialChildren | 组件拖入“设计器”时根据此配置自动生成 children 节点 schema |NodeData[]/Function NodeData[] | ((target: SettingTarget) => NodeData[]);|
|
|initialChildren | 组件拖入“设计器”时根据此配置自动生成 children 节点 schema |NodeData[]/Function NodeData[] | ((target: IPublicModelSettingField) => NodeData[]);|
|
||||||
|getResizingHandlers| 用于配置设计器中组件 resize 操作工具的样式和内容 | Function| (currentNode: any) => Array<{ type: 'N' | 'W' | 'S' | 'E' | 'NW' | 'NE' | 'SE' | 'SW'; content?: ReactElement; propTarget?: string; appearOn?: 'mouse-enter' | 'mouse-hover' | 'selected' | 'always'; }> / ReactElement[];
|
|getResizingHandlers| 用于配置设计器中组件 resize 操作工具的样式和内容 | Function| (currentNode: any) => Array<{ type: 'N' | 'W' | 'S' | 'E' | 'NW' | 'NE' | 'SE' | 'SW'; content?: ReactElement; propTarget?: string; appearOn?: 'mouse-enter' | 'mouse-hover' | 'selected' | 'always'; }> / ReactElement[];
|
||||||
|callbacks| 配置 callbacks 可捕获引擎抛出的一些事件,例如 onNodeAdd、onResize 等 | Callback| -
|
|callbacks| 配置 callbacks 可捕获引擎抛出的一些事件,例如 onNodeAdd、onResize 等 | Callback| -
|
||||||
|callbacks.onNodeAdd| 在容器中拖入组件时触发的事件回调 | Function| (e: MouseEvent, currentNode: any) => any
|
|callbacks.onNodeAdd| 在容器中拖入组件时触发的事件回调 | Function| (e: MouseEvent, currentNode: any) => any
|
||||||
@ -1098,7 +1098,7 @@ export interface Advanced {
|
|||||||
/**
|
/**
|
||||||
* 拖入容器时,自动带入 children 列表
|
* 拖入容器时,自动带入 children 列表
|
||||||
*/
|
*/
|
||||||
initialChildren?: NodeData[] | ((target: SettingTarget) => NodeData[]);
|
initialChildren?: NodeData[] | ((target: IPublicModelSettingField) => NodeData[]);
|
||||||
/**
|
/**
|
||||||
* @todo 待补充文档
|
* @todo 待补充文档
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -8,10 +8,11 @@ import {
|
|||||||
IPublicTypeTransformedComponentMetadata,
|
IPublicTypeTransformedComponentMetadata,
|
||||||
IPublicTypeNestingFilter,
|
IPublicTypeNestingFilter,
|
||||||
IPublicTypeI18nData,
|
IPublicTypeI18nData,
|
||||||
IPublicTypePluginConfig,
|
|
||||||
IPublicTypeFieldConfig,
|
IPublicTypeFieldConfig,
|
||||||
IPublicModelComponentMeta,
|
IPublicModelComponentMeta,
|
||||||
IPublicTypeAdvanced,
|
IPublicTypeAdvanced,
|
||||||
|
IPublicTypeDisposable,
|
||||||
|
IPublicTypeLiveTextEditingConfig,
|
||||||
} from '@alilc/lowcode-types';
|
} from '@alilc/lowcode-types';
|
||||||
import { deprecate, isRegExp, isTitleConfig, isNode } from '@alilc/lowcode-utils';
|
import { deprecate, isRegExp, isTitleConfig, isNode } from '@alilc/lowcode-utils';
|
||||||
import { computed, createModuleEventBus, IEventBus } from '@alilc/lowcode-editor-core';
|
import { computed, createModuleEventBus, IEventBus } from '@alilc/lowcode-editor-core';
|
||||||
@ -59,9 +60,11 @@ export function buildFilter(rule?: string | string[] | RegExp | IPublicTypeNesti
|
|||||||
export interface IComponentMeta extends IPublicModelComponentMeta<INode> {
|
export interface IComponentMeta extends IPublicModelComponentMeta<INode> {
|
||||||
prototype?: any;
|
prototype?: any;
|
||||||
|
|
||||||
|
get rootSelector(): string | undefined;
|
||||||
|
|
||||||
setMetadata(metadata: IPublicTypeComponentMetadata): void;
|
setMetadata(metadata: IPublicTypeComponentMetadata): void;
|
||||||
|
|
||||||
get rootSelector(): string | undefined;
|
onMetadataChange(fn: (args: any) => void): IPublicTypeDisposable;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ComponentMeta implements IComponentMeta {
|
export class ComponentMeta implements IComponentMeta {
|
||||||
@ -120,7 +123,7 @@ export class ComponentMeta implements IComponentMeta {
|
|||||||
return config?.combined || config?.props || [];
|
return config?.combined || config?.props || [];
|
||||||
}
|
}
|
||||||
|
|
||||||
private _liveTextEditing?: IPublicTypePluginConfig[];
|
private _liveTextEditing?: IPublicTypeLiveTextEditingConfig[];
|
||||||
|
|
||||||
get liveTextEditing() {
|
get liveTextEditing() {
|
||||||
return this._liveTextEditing;
|
return this._liveTextEditing;
|
||||||
@ -357,7 +360,7 @@ export class ComponentMeta implements IComponentMeta {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
onMetadataChange(fn: (args: any) => void): () => void {
|
onMetadataChange(fn: (args: any) => void): IPublicTypeDisposable {
|
||||||
this.emitter.on('metadata_change', fn);
|
this.emitter.on('metadata_change', fn);
|
||||||
return () => {
|
return () => {
|
||||||
this.emitter.removeListener('metadata_change', fn);
|
this.emitter.removeListener('metadata_change', fn);
|
||||||
|
|||||||
@ -140,7 +140,7 @@ export class Designer implements IDesigner {
|
|||||||
|
|
||||||
@obx.ref private _simulatorComponent?: ComponentType<any>;
|
@obx.ref private _simulatorComponent?: ComponentType<any>;
|
||||||
|
|
||||||
@obx.ref private _simulatorProps?: object | ((project: Project) => object);
|
@obx.ref private _simulatorProps?: Record<string, any> | ((project: Project) => object);
|
||||||
|
|
||||||
@obx.ref private _suspensed = false;
|
@obx.ref private _suspensed = false;
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
export * from './setting-field';
|
export * from './setting-field';
|
||||||
export * from './setting-top-entry';
|
export * from './setting-top-entry';
|
||||||
export * from './setting-entry';
|
export * from './setting-entry-type';
|
||||||
|
export * from './setting-prop-entry';
|
||||||
|
|||||||
45
packages/designer/src/designer/setting/setting-entry-type.ts
Normal file
45
packages/designer/src/designer/setting/setting-entry-type.ts
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
import { IPublicApiSetters, IPublicModelEditor } from '@alilc/lowcode-types';
|
||||||
|
import { IDesigner } from '../designer';
|
||||||
|
import { INode } from '../../document';
|
||||||
|
import { ISettingField } from './setting-field';
|
||||||
|
|
||||||
|
export interface ISettingEntry {
|
||||||
|
readonly designer: IDesigner | undefined;
|
||||||
|
|
||||||
|
readonly id: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同样类型的节点
|
||||||
|
*/
|
||||||
|
readonly isSameComponent: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 一个
|
||||||
|
*/
|
||||||
|
readonly isSingle: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多个
|
||||||
|
*/
|
||||||
|
readonly isMultiple: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑器引用
|
||||||
|
*/
|
||||||
|
readonly editor: IPublicModelEditor;
|
||||||
|
|
||||||
|
readonly setters: IPublicApiSetters;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取得子项
|
||||||
|
*/
|
||||||
|
get: (propName: string | number) => ISettingField | null;
|
||||||
|
|
||||||
|
readonly nodes: INode[];
|
||||||
|
|
||||||
|
// @todo 补充 node 定义
|
||||||
|
/**
|
||||||
|
* 获取 node 中的第一项
|
||||||
|
*/
|
||||||
|
getNode: () => any;
|
||||||
|
}
|
||||||
@ -1,26 +0,0 @@
|
|||||||
import { IBaseModelSettingEntry, IPublicModelSettingPropEntry, IPublicTypeSetValueOptions } from '@alilc/lowcode-types';
|
|
||||||
import { IComponentMeta } from '../../component-meta';
|
|
||||||
import { IDesigner } from '../designer';
|
|
||||||
import { INode } from '../../document';
|
|
||||||
|
|
||||||
export interface ISettingEntry extends IBaseModelSettingEntry<
|
|
||||||
INode,
|
|
||||||
IComponentMeta,
|
|
||||||
ISettingEntry
|
|
||||||
> {
|
|
||||||
readonly designer: IDesigner;
|
|
||||||
|
|
||||||
readonly isGroup: boolean;
|
|
||||||
|
|
||||||
readonly id: string;
|
|
||||||
|
|
||||||
get name(): string | number | undefined;
|
|
||||||
|
|
||||||
internalToShellPropEntry(): IPublicModelSettingPropEntry;
|
|
||||||
|
|
||||||
valueChange(options: IPublicTypeSetValueOptions): void;
|
|
||||||
|
|
||||||
get valueState(): number;
|
|
||||||
|
|
||||||
clearValue(): void;
|
|
||||||
}
|
|
||||||
@ -7,14 +7,18 @@ import {
|
|||||||
IPublicTypeFieldConfig,
|
IPublicTypeFieldConfig,
|
||||||
IPublicTypeCustomView,
|
IPublicTypeCustomView,
|
||||||
IPublicTypeSetValueOptions,
|
IPublicTypeSetValueOptions,
|
||||||
|
IPublicTypeDisposable,
|
||||||
|
IPublicModelSettingField,
|
||||||
|
IBaseModelSettingField,
|
||||||
} from '@alilc/lowcode-types';
|
} from '@alilc/lowcode-types';
|
||||||
import { Transducer } from './utils';
|
import { Transducer } from './utils';
|
||||||
import { SettingPropEntry } from './setting-prop-entry';
|
import { ISettingPropEntry, SettingPropEntry } from './setting-prop-entry';
|
||||||
import { ISettingEntry } from './setting-entry';
|
|
||||||
import { computed, obx, makeObservable, action, untracked, intl } from '@alilc/lowcode-editor-core';
|
import { computed, obx, makeObservable, action, untracked, intl } from '@alilc/lowcode-editor-core';
|
||||||
import { cloneDeep, isCustomView, isDynamicSetter } from '@alilc/lowcode-utils';
|
import { cloneDeep, isCustomView, isDynamicSetter } from '@alilc/lowcode-utils';
|
||||||
|
import { ISettingTopEntry } from './setting-top-entry';
|
||||||
|
import { IComponentMeta, INode } from '@alilc/lowcode-designer';
|
||||||
|
|
||||||
function getSettingFieldCollectorKey(parent: ISettingEntry, config: IPublicTypeFieldConfig) {
|
function getSettingFieldCollectorKey(parent: ISettingTopEntry | ISettingField, config: IPublicTypeFieldConfig) {
|
||||||
let cur = parent;
|
let cur = parent;
|
||||||
const path = [config.name];
|
const path = [config.name];
|
||||||
while (cur !== parent.top) {
|
while (cur !== parent.top) {
|
||||||
@ -26,11 +30,18 @@ function getSettingFieldCollectorKey(parent: ISettingEntry, config: IPublicTypeF
|
|||||||
return path.join('.');
|
return path.join('.');
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ISettingField extends Omit<ISettingEntry, 'setValue'> {
|
export interface ISettingField extends ISettingPropEntry, Omit<IBaseModelSettingField<
|
||||||
|
ISettingTopEntry,
|
||||||
|
ISettingField,
|
||||||
|
IComponentMeta,
|
||||||
|
INode
|
||||||
|
>, 'setValue' | 'key' | 'node'> {
|
||||||
get items(): Array<ISettingField | IPublicTypeCustomView>;
|
get items(): Array<ISettingField | IPublicTypeCustomView>;
|
||||||
|
|
||||||
get title(): string | ReactNode | undefined;
|
get title(): string | ReactNode | undefined;
|
||||||
|
|
||||||
|
readonly isSettingField: true;
|
||||||
|
|
||||||
purge(): void;
|
purge(): void;
|
||||||
|
|
||||||
extraProps: IPublicTypeFieldExtraProps;
|
extraProps: IPublicTypeFieldExtraProps;
|
||||||
@ -41,6 +52,10 @@ export interface ISettingField extends Omit<ISettingEntry, 'setValue'> {
|
|||||||
|
|
||||||
readonly isRequired: boolean;
|
readonly isRequired: boolean;
|
||||||
|
|
||||||
|
readonly isGroup: boolean;
|
||||||
|
|
||||||
|
get valueState(): number;
|
||||||
|
|
||||||
setExpanded(value: boolean): void;
|
setExpanded(value: boolean): void;
|
||||||
|
|
||||||
setValue(
|
setValue(
|
||||||
@ -49,6 +64,16 @@ export interface ISettingField extends Omit<ISettingEntry, 'setValue'> {
|
|||||||
force?: boolean,
|
force?: boolean,
|
||||||
extraOptions?: IPublicTypeSetValueOptions,
|
extraOptions?: IPublicTypeSetValueOptions,
|
||||||
): void;
|
): void;
|
||||||
|
|
||||||
|
clearValue(): void;
|
||||||
|
|
||||||
|
valueChange(options: IPublicTypeSetValueOptions): void;
|
||||||
|
|
||||||
|
createField(config: IPublicTypeFieldConfig): ISettingField;
|
||||||
|
|
||||||
|
onEffect(action: () => void): IPublicTypeDisposable;
|
||||||
|
|
||||||
|
internalToShell(): IPublicModelSettingField;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SettingField extends SettingPropEntry implements ISettingField {
|
export class SettingField extends SettingPropEntry implements ISettingField {
|
||||||
@ -62,7 +87,7 @@ export class SettingField extends SettingPropEntry implements ISettingField {
|
|||||||
|
|
||||||
private hotValue: any;
|
private hotValue: any;
|
||||||
|
|
||||||
parent: ISettingEntry;
|
parent: ISettingTopEntry | ISettingField;
|
||||||
|
|
||||||
extraProps: IPublicTypeFieldExtraProps;
|
extraProps: IPublicTypeFieldExtraProps;
|
||||||
|
|
||||||
@ -82,7 +107,7 @@ export class SettingField extends SettingPropEntry implements ISettingField {
|
|||||||
private _items: Array<ISettingField | IPublicTypeCustomView> = [];
|
private _items: Array<ISettingField | IPublicTypeCustomView> = [];
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
parent: ISettingEntry,
|
parent: ISettingTopEntry | ISettingField,
|
||||||
config: IPublicTypeFieldConfig,
|
config: IPublicTypeFieldConfig,
|
||||||
private settingFieldCollector?: (name: string | number, field: ISettingField) => void,
|
private settingFieldCollector?: (name: string | number, field: ISettingField) => void,
|
||||||
) {
|
) {
|
||||||
@ -118,8 +143,8 @@ export class SettingField extends SettingPropEntry implements ISettingField {
|
|||||||
}
|
}
|
||||||
if (isDynamicSetter(this._setter)) {
|
if (isDynamicSetter(this._setter)) {
|
||||||
return untracked(() => {
|
return untracked(() => {
|
||||||
const shellThis = this.internalToShellPropEntry();
|
const shellThis = this.internalToShell();
|
||||||
return (this._setter as IPublicTypeDynamicSetter)?.call(shellThis, shellThis);
|
return (this._setter as IPublicTypeDynamicSetter)?.call(shellThis, shellThis!);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return this._setter;
|
return this._setter;
|
||||||
@ -266,8 +291,13 @@ export class SettingField extends SettingPropEntry implements ISettingField {
|
|||||||
this.valueChange(options);
|
this.valueChange(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
onEffect(action: () => void): () => void {
|
onEffect(action: () => void): IPublicTypeDisposable {
|
||||||
return this.designer.autorun(action, true);
|
return this.designer!.autorun(action, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
internalToShell() {
|
||||||
|
return this.designer!.shellModelFactory.createSettingField(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,13 +1,44 @@
|
|||||||
import { obx, computed, makeObservable, runInAction, IEventBus, createModuleEventBus } from '@alilc/lowcode-editor-core';
|
import { obx, computed, makeObservable, runInAction, IEventBus, createModuleEventBus } from '@alilc/lowcode-editor-core';
|
||||||
import { GlobalEvent, IPublicApiSetters, IPublicModelEditor, IPublicTypeSetValueOptions } from '@alilc/lowcode-types';
|
import { GlobalEvent, IPublicApiSetters, IPublicModelEditor, IPublicModelSettingField, IPublicTypeFieldExtraProps, IPublicTypeSetValueOptions } from '@alilc/lowcode-types';
|
||||||
import { uniqueId, isJSExpression, isSettingField } from '@alilc/lowcode-utils';
|
import { uniqueId, isJSExpression } from '@alilc/lowcode-utils';
|
||||||
import { ISettingEntry } from './setting-entry';
|
import { ISettingEntry } from './setting-entry-type';
|
||||||
import { INode } from '../../document';
|
import { INode } from '../../document';
|
||||||
import { IComponentMeta } from '../../component-meta';
|
import { IComponentMeta } from '../../component-meta';
|
||||||
import { IDesigner } from '../designer';
|
import { IDesigner } from '../designer';
|
||||||
import { ISettingField } from './setting-field';
|
import { ISettingTopEntry } from './setting-top-entry';
|
||||||
|
import { ISettingField, isSettingField } from './setting-field';
|
||||||
|
|
||||||
export class SettingPropEntry implements ISettingEntry {
|
export interface ISettingPropEntry extends ISettingEntry {
|
||||||
|
get props(): ISettingTopEntry;
|
||||||
|
|
||||||
|
readonly isGroup: boolean;
|
||||||
|
|
||||||
|
get name(): string | number | undefined;
|
||||||
|
|
||||||
|
valueChange(options: IPublicTypeSetValueOptions): void;
|
||||||
|
|
||||||
|
getKey(): string | number | undefined;
|
||||||
|
|
||||||
|
setKey(key: string | number): void;
|
||||||
|
|
||||||
|
getDefaultValue(): any;
|
||||||
|
|
||||||
|
setUseVariable(flag: boolean): void;
|
||||||
|
|
||||||
|
getProps(): ISettingTopEntry;
|
||||||
|
|
||||||
|
isUseVariable(): boolean;
|
||||||
|
|
||||||
|
getMockOrValue(): any;
|
||||||
|
|
||||||
|
remove(): void;
|
||||||
|
|
||||||
|
setValue(val: any, isHotValue?: boolean, force?: boolean, extraOptions?: IPublicTypeSetValueOptions): void;
|
||||||
|
|
||||||
|
internalToShell(): IPublicModelSettingField;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class SettingPropEntry implements ISettingPropEntry {
|
||||||
// === static properties ===
|
// === static properties ===
|
||||||
readonly editor: IPublicModelEditor;
|
readonly editor: IPublicModelEditor;
|
||||||
|
|
||||||
@ -23,9 +54,9 @@ export class SettingPropEntry implements ISettingEntry {
|
|||||||
|
|
||||||
readonly componentMeta: IComponentMeta | null;
|
readonly componentMeta: IComponentMeta | null;
|
||||||
|
|
||||||
readonly designer: IDesigner;
|
readonly designer: IDesigner | undefined;
|
||||||
|
|
||||||
readonly top: ISettingEntry;
|
readonly top: ISettingTopEntry;
|
||||||
|
|
||||||
readonly isGroup: boolean;
|
readonly isGroup: boolean;
|
||||||
|
|
||||||
@ -50,9 +81,9 @@ export class SettingPropEntry implements ISettingEntry {
|
|||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
extraProps: any = {};
|
extraProps: IPublicTypeFieldExtraProps = {};
|
||||||
|
|
||||||
constructor(readonly parent: ISettingEntry | ISettingField, name: string | number | undefined, type?: 'field' | 'group') {
|
constructor(readonly parent: ISettingTopEntry | ISettingField, name: string | number | undefined, type?: 'field' | 'group') {
|
||||||
makeObservable(this);
|
makeObservable(this);
|
||||||
if (type == null) {
|
if (type == null) {
|
||||||
const c = typeof name === 'string' ? name.slice(0, 1) : '';
|
const c = typeof name === 'string' ? name.slice(0, 1) : '';
|
||||||
@ -126,7 +157,7 @@ export class SettingPropEntry implements ISettingEntry {
|
|||||||
if (this.type !== 'field') {
|
if (this.type !== 'field') {
|
||||||
const { getValue } = this.extraProps;
|
const { getValue } = this.extraProps;
|
||||||
return getValue
|
return getValue
|
||||||
? getValue(this.internalToShellPropEntry(), undefined) === undefined
|
? getValue(this.internalToShell()!, undefined) === undefined
|
||||||
? 0
|
? 0
|
||||||
: 1
|
: 1
|
||||||
: 0;
|
: 0;
|
||||||
@ -165,7 +196,7 @@ export class SettingPropEntry implements ISettingEntry {
|
|||||||
}
|
}
|
||||||
const { getValue } = this.extraProps;
|
const { getValue } = this.extraProps;
|
||||||
try {
|
try {
|
||||||
return getValue ? getValue(this.internalToShellPropEntry(), val) : val;
|
return getValue ? getValue(this.internalToShell()!, val) : val;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.warn(e);
|
console.warn(e);
|
||||||
return val;
|
return val;
|
||||||
@ -184,7 +215,7 @@ export class SettingPropEntry implements ISettingEntry {
|
|||||||
const { setValue } = this.extraProps;
|
const { setValue } = this.extraProps;
|
||||||
if (setValue && !extraOptions?.disableMutator) {
|
if (setValue && !extraOptions?.disableMutator) {
|
||||||
try {
|
try {
|
||||||
setValue(this.internalToShellPropEntry(), val);
|
setValue(this.internalToShell()!, val);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
/* istanbul ignore next */
|
/* istanbul ignore next */
|
||||||
console.warn(e);
|
console.warn(e);
|
||||||
@ -207,7 +238,7 @@ export class SettingPropEntry implements ISettingEntry {
|
|||||||
const { setValue } = this.extraProps;
|
const { setValue } = this.extraProps;
|
||||||
if (setValue) {
|
if (setValue) {
|
||||||
try {
|
try {
|
||||||
setValue(this.internalToShellPropEntry(), undefined);
|
setValue(this.internalToShell()!, undefined);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
/* istanbul ignore next */
|
/* istanbul ignore next */
|
||||||
console.warn(e);
|
console.warn(e);
|
||||||
@ -363,7 +394,7 @@ export class SettingPropEntry implements ISettingEntry {
|
|||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
internalToShellPropEntry() {
|
internalToShell(): IPublicModelSettingField {
|
||||||
return this.designer.shellModelFactory.createSettingPropEntry(this);
|
return this.designer!.shellModelFactory.createSettingField(this);;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,11 +1,10 @@
|
|||||||
import { IPublicTypeCustomView, IPublicModelEditor } from '@alilc/lowcode-types';
|
import { IPublicTypeCustomView, IPublicModelEditor, IPublicModelSettingTopEntry } from '@alilc/lowcode-types';
|
||||||
import { isCustomView } from '@alilc/lowcode-utils';
|
import { isCustomView } from '@alilc/lowcode-utils';
|
||||||
import { computed, IEventBus, createModuleEventBus } from '@alilc/lowcode-editor-core';
|
import { computed, IEventBus, createModuleEventBus } from '@alilc/lowcode-editor-core';
|
||||||
import { ISettingEntry } from './setting-entry';
|
import { ISettingEntry } from './setting-entry-type';
|
||||||
import { SettingField } from './setting-field';
|
import { ISettingField, SettingField } from './setting-field';
|
||||||
import { SettingPropEntry } from './setting-prop-entry';
|
|
||||||
import { INode } from '../../document';
|
import { INode } from '../../document';
|
||||||
import { ComponentMeta } from '../../component-meta';
|
import { IComponentMeta } from '../../component-meta';
|
||||||
import { IDesigner } from '../designer';
|
import { IDesigner } from '../designer';
|
||||||
import { Setters } from '@alilc/lowcode-shell';
|
import { Setters } from '@alilc/lowcode-shell';
|
||||||
|
|
||||||
@ -16,8 +15,25 @@ function generateSessionId(nodes: INode[]) {
|
|||||||
.join(',');
|
.join(',');
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ISettingTopEntry extends ISettingEntry {
|
export interface ISettingTopEntry extends ISettingEntry, IPublicModelSettingTopEntry<
|
||||||
|
INode,
|
||||||
|
ISettingField
|
||||||
|
> {
|
||||||
purge(): void;
|
purge(): void;
|
||||||
|
|
||||||
|
items: Array<ISettingField | IPublicTypeCustomView>;
|
||||||
|
|
||||||
|
readonly top: ISettingTopEntry;
|
||||||
|
|
||||||
|
readonly parent: ISettingTopEntry;
|
||||||
|
|
||||||
|
readonly path: never[];
|
||||||
|
|
||||||
|
componentMeta: IComponentMeta | null;
|
||||||
|
|
||||||
|
getExtraPropValue(propName: string): void;
|
||||||
|
|
||||||
|
setExtraPropValue(propName: string, value: any): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SettingTopEntry implements ISettingTopEntry {
|
export class SettingTopEntry implements ISettingTopEntry {
|
||||||
@ -25,11 +41,11 @@ export class SettingTopEntry implements ISettingTopEntry {
|
|||||||
|
|
||||||
private _items: Array<SettingField | IPublicTypeCustomView> = [];
|
private _items: Array<SettingField | IPublicTypeCustomView> = [];
|
||||||
|
|
||||||
private _componentMeta: ComponentMeta | null = null;
|
private _componentMeta: IComponentMeta | null = null;
|
||||||
|
|
||||||
private _isSame = true;
|
private _isSame = true;
|
||||||
|
|
||||||
private _settingFieldMap: { [prop: string]: SettingField } = {};
|
private _settingFieldMap: { [prop: string]: ISettingField } = {};
|
||||||
|
|
||||||
readonly path = [];
|
readonly path = [];
|
||||||
|
|
||||||
@ -122,8 +138,8 @@ export class SettingTopEntry implements ISettingTopEntry {
|
|||||||
|
|
||||||
private setupItems() {
|
private setupItems() {
|
||||||
if (this.componentMeta) {
|
if (this.componentMeta) {
|
||||||
const settingFieldMap: { [prop: string]: SettingField } = {};
|
const settingFieldMap: { [prop: string]: ISettingField } = {};
|
||||||
const settingFieldCollector = (name: string | number, field: SettingField) => {
|
const settingFieldCollector = (name: string | number, field: ISettingField) => {
|
||||||
settingFieldMap[name] = field;
|
settingFieldMap[name] = field;
|
||||||
};
|
};
|
||||||
this._items = this.componentMeta.configure.map((item) => {
|
this._items = this.componentMeta.configure.map((item) => {
|
||||||
@ -160,34 +176,34 @@ export class SettingTopEntry implements ISettingTopEntry {
|
|||||||
/**
|
/**
|
||||||
* 获取子项
|
* 获取子项
|
||||||
*/
|
*/
|
||||||
get(propName: string | number): SettingPropEntry | null {
|
get(propName: string | number): ISettingField | null {
|
||||||
if (!propName) return null;
|
if (!propName) return null;
|
||||||
return this._settingFieldMap[propName] || (new SettingPropEntry(this, propName));
|
return this._settingFieldMap[propName] || (new SettingField(this, { name: propName }));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置子级属性值
|
* 设置子级属性值
|
||||||
*/
|
*/
|
||||||
setPropValue(propName: string, value: any) {
|
setPropValue(propName: string | number, value: any) {
|
||||||
this.nodes.forEach((node) => {
|
this.nodes.forEach((node) => {
|
||||||
node.setPropValue(propName, value);
|
node.setPropValue(propName.toString(), value);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 清除已设置值
|
* 清除已设置值
|
||||||
*/
|
*/
|
||||||
clearPropValue(propName: string) {
|
clearPropValue(propName: string | number) {
|
||||||
this.nodes.forEach((node) => {
|
this.nodes.forEach((node) => {
|
||||||
node.clearPropValue(propName);
|
node.clearPropValue(propName.toString());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取子级属性值
|
* 获取子级属性值
|
||||||
*/
|
*/
|
||||||
getPropValue(propName: string): any {
|
getPropValue(propName: string | number): any {
|
||||||
return this.first.getProp(propName, true)?.getValue();
|
return this.first.getProp(propName.toString(), true)?.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -153,6 +153,12 @@ export interface IBaseNode<Schema extends IPublicTypeNodeSchema = IPublicTypeNod
|
|||||||
getVisible(): boolean;
|
getVisible(): boolean;
|
||||||
|
|
||||||
getChildren(): INodeChildren | null;
|
getChildren(): INodeChildren | null;
|
||||||
|
|
||||||
|
clearPropValue(path: string): void;
|
||||||
|
|
||||||
|
setProps(props?: IPublicTypePropsMap | IPublicTypePropsList | Props | null): void;
|
||||||
|
|
||||||
|
mergeProps(props: IPublicTypePropsMap): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -203,7 +209,7 @@ export interface IBaseNode<Schema extends IPublicTypeNodeSchema = IPublicTypeNod
|
|||||||
* isLocked
|
* isLocked
|
||||||
* hidden
|
* hidden
|
||||||
*/
|
*/
|
||||||
export class Node<Schema extends IPublicTypeNodeSchema = IPublicTypeNodeSchema> implements INode {
|
export class Node<Schema extends IPublicTypeNodeSchema = IPublicTypeNodeSchema> implements IBaseNode {
|
||||||
private emitter: IEventBus;
|
private emitter: IEventBus;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -427,18 +433,24 @@ export class Node<Schema extends IPublicTypeNodeSchema = IPublicTypeNodeSchema>
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private initialChildren(children: any): IPublicTypeNodeData[] {
|
private initialChildren(children: IPublicTypeNodeData | IPublicTypeNodeData[] | undefined): IPublicTypeNodeData[] {
|
||||||
// FIXME! this is dirty code
|
// FIXME! this is dirty code
|
||||||
if (children == null) {
|
if (children == null) {
|
||||||
const { initialChildren } = this.componentMeta.advanced;
|
const { initialChildren } = this.componentMeta.advanced;
|
||||||
if (initialChildren) {
|
if (initialChildren) {
|
||||||
if (typeof initialChildren === 'function') {
|
if (typeof initialChildren === 'function') {
|
||||||
return initialChildren(this as any) || [];
|
return initialChildren(this.internalToShellNode()!) || [];
|
||||||
}
|
}
|
||||||
return initialChildren;
|
return initialChildren;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return children || [];
|
if (Array.isArray(children)) {
|
||||||
|
return children;
|
||||||
|
} else if (children) {
|
||||||
|
return [children];
|
||||||
|
} else {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
isContainer(): boolean {
|
isContainer(): boolean {
|
||||||
@ -900,12 +912,12 @@ export class Node<Schema extends IPublicTypeNodeSchema = IPublicTypeNodeSchema>
|
|||||||
(subNode: INode) => {
|
(subNode: INode) => {
|
||||||
subNode.remove(true, true);
|
subNode.remove(true, true);
|
||||||
},
|
},
|
||||||
(iterable, idx) => (iterable as NodeChildren).get(idx),
|
(iterable, idx) => (iterable as INodeChildren).get(idx),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (this.isParental()) {
|
if (this.isParental()) {
|
||||||
this.props.import(props, extras);
|
this.props.import(props, extras);
|
||||||
(this._children as NodeChildren).import(children, checkId);
|
this._children?.import(children, checkId);
|
||||||
} else {
|
} else {
|
||||||
this.props
|
this.props
|
||||||
.get('children', true)!
|
.get('children', true)!
|
||||||
|
|||||||
@ -104,7 +104,7 @@ describe('setting-field 测试', () => {
|
|||||||
|
|
||||||
// group 类型的 field
|
// group 类型的 field
|
||||||
const groupField = settingEntry.get('groupkgzzeo41') as SettingField;
|
const groupField = settingEntry.get('groupkgzzeo41') as SettingField;
|
||||||
expect(groupField.items).toBeUndefined();
|
expect(groupField.items).toEqual([]);
|
||||||
|
|
||||||
// 有子节点的 field
|
// 有子节点的 field
|
||||||
const objField = settingEntry.get('obj') as SettingField;
|
const objField = settingEntry.get('obj') as SettingField;
|
||||||
|
|||||||
@ -14,7 +14,7 @@ export interface FieldProps {
|
|||||||
[extra: string]: any;
|
[extra: string]: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createField(props: FieldProps, children: ReactNode, type?: 'accordion' | 'inline' | 'block' | 'plain' | 'popup' | 'entry') {
|
export function createField(props: FieldProps, children: ReactNode, type?: 'accordion' | 'inline' | 'block' | 'plain' | 'popup' | 'entry'): ReactNode {
|
||||||
if (type === 'popup') {
|
if (type === 'popup') {
|
||||||
return createElement(PopupField, props, children);
|
return createElement(PopupField, props, children);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import { shallowIntl, observer, obx, engineConfig, runInAction, globalContext }
|
|||||||
import { createContent, isJSSlot, isSetterConfig } from '@alilc/lowcode-utils';
|
import { createContent, isJSSlot, isSetterConfig } from '@alilc/lowcode-utils';
|
||||||
import { Skeleton, Stage } from '@alilc/lowcode-editor-skeleton';
|
import { Skeleton, Stage } from '@alilc/lowcode-editor-skeleton';
|
||||||
import { IPublicTypeCustomView } from '@alilc/lowcode-types';
|
import { IPublicTypeCustomView } from '@alilc/lowcode-types';
|
||||||
import { SettingField, SettingTopEntry, ISettingEntry, IComponentMeta, ISettingField, isSettingField } from '@alilc/lowcode-designer';
|
import { ISettingEntry, IComponentMeta, ISettingField, isSettingField, ISettingTopEntry } from '@alilc/lowcode-designer';
|
||||||
import { createField } from '../field';
|
import { createField } from '../field';
|
||||||
import PopupService, { PopupPipe } from '../popup';
|
import PopupService, { PopupPipe } from '../popup';
|
||||||
import { SkeletonContext } from '../../context';
|
import { SkeletonContext } from '../../context';
|
||||||
@ -80,7 +80,7 @@ class SettingFieldView extends Component<SettingFieldViewProps, SettingFieldView
|
|||||||
const { extraProps } = this.field;
|
const { extraProps } = this.field;
|
||||||
const { condition } = extraProps;
|
const { condition } = extraProps;
|
||||||
try {
|
try {
|
||||||
return typeof condition === 'function' ? condition(this.field.internalToShellPropEntry()) !== false : true;
|
return typeof condition === 'function' ? condition(this.field.internalToShell()) !== false : true;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('exception when condition (hidden) is excuted', error);
|
console.error('exception when condition (hidden) is excuted', error);
|
||||||
}
|
}
|
||||||
@ -111,7 +111,7 @@ class SettingFieldView extends Component<SettingFieldViewProps, SettingFieldView
|
|||||||
if (setter.props) {
|
if (setter.props) {
|
||||||
setterProps = setter.props;
|
setterProps = setter.props;
|
||||||
if (typeof setterProps === 'function') {
|
if (typeof setterProps === 'function') {
|
||||||
setterProps = setterProps(this.field.internalToShellPropEntry());
|
setterProps = setterProps(this.field.internalToShell());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (setter.initialValue != null) {
|
if (setter.initialValue != null) {
|
||||||
@ -177,7 +177,7 @@ class SettingFieldView extends Component<SettingFieldViewProps, SettingFieldView
|
|||||||
}
|
}
|
||||||
// 当前 field 没有 value 值时,将 initialValue 写入 field
|
// 当前 field 没有 value 值时,将 initialValue 写入 field
|
||||||
// 之所以用 initialValue,而不是 defaultValue 是为了保持跟 props.onInitial 的逻辑一致
|
// 之所以用 initialValue,而不是 defaultValue 是为了保持跟 props.onInitial 的逻辑一致
|
||||||
const _initialValue = typeof initialValue === 'function' ? initialValue(this.field.internalToShellPropEntry()) : initialValue;
|
const _initialValue = typeof initialValue === 'function' ? initialValue(this.field.internalToShell()) : initialValue;
|
||||||
this.field.setValue(_initialValue);
|
this.field.setValue(_initialValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -225,9 +225,9 @@ class SettingFieldView extends Component<SettingFieldViewProps, SettingFieldView
|
|||||||
forceInline: extraProps.forceInline,
|
forceInline: extraProps.forceInline,
|
||||||
key: field.id,
|
key: field.id,
|
||||||
// === injection
|
// === injection
|
||||||
prop: field.internalToShellPropEntry(), // for compatible vision
|
prop: field.internalToShell(), // for compatible vision
|
||||||
selected: field.top?.getNode()?.internalToShellNode(),
|
selected: field.top?.getNode()?.internalToShellNode(),
|
||||||
field: field.internalToShellPropEntry(),
|
field: field.internalToShell(),
|
||||||
// === IO
|
// === IO
|
||||||
value, // reaction point
|
value, // reaction point
|
||||||
initialValue,
|
initialValue,
|
||||||
@ -244,7 +244,7 @@ class SettingFieldView extends Component<SettingFieldViewProps, SettingFieldView
|
|||||||
if (initialValue == null) {
|
if (initialValue == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const value = typeof initialValue === 'function' ? initialValue(field.internalToShellPropEntry()) : initialValue;
|
const value = typeof initialValue === 'function' ? initialValue(field.internalToShell()) : initialValue;
|
||||||
this.setState({
|
this.setState({
|
||||||
// eslint-disable-next-line react/no-unused-state
|
// eslint-disable-next-line react/no-unused-state
|
||||||
value,
|
value,
|
||||||
@ -303,7 +303,7 @@ class SettingGroupView extends Component<SettingGroupViewProps> {
|
|||||||
const { field } = this.props;
|
const { field } = this.props;
|
||||||
const { extraProps } = field;
|
const { extraProps } = field;
|
||||||
const { condition, display } = extraProps;
|
const { condition, display } = extraProps;
|
||||||
const visible = field.isSingle && typeof condition === 'function' ? condition(field.internalToShellPropEntry()) !== false : true;
|
const visible = field.isSingle && typeof condition === 'function' ? condition(field.internalToShell()) !== false : true;
|
||||||
|
|
||||||
if (!visible) {
|
if (!visible) {
|
||||||
return null;
|
return null;
|
||||||
@ -340,7 +340,7 @@ export function createSettingFieldView(item: ISettingField | IPublicTypeCustomVi
|
|||||||
}
|
}
|
||||||
|
|
||||||
export type SettingsPaneProps = {
|
export type SettingsPaneProps = {
|
||||||
target: SettingTopEntry | SettingField;
|
target: ISettingTopEntry | ISettingField;
|
||||||
usePopup?: boolean;
|
usePopup?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import {
|
import {
|
||||||
IPublicTypeTransformedComponentMetadata,
|
IPublicTypeTransformedComponentMetadata,
|
||||||
IPublicTypeFieldConfig,
|
IPublicTypeFieldConfig,
|
||||||
IPublicModelSettingTarget,
|
IPublicModelSettingField,
|
||||||
} from '@alilc/lowcode-types';
|
} from '@alilc/lowcode-types';
|
||||||
import { IconSlot } from '../icons/slot';
|
import { IconSlot } from '../icons/slot';
|
||||||
import { getConvertedExtraKey } from '@alilc/lowcode-designer';
|
import { getConvertedExtraKey } from '@alilc/lowcode-designer';
|
||||||
@ -214,11 +214,11 @@ export default function (
|
|||||||
definition: eventsDefinition,
|
definition: eventsDefinition,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
getValue(field: IPublicModelSettingTarget, val?: any[]) {
|
getValue(field: IPublicModelSettingField, val?: any[]) {
|
||||||
return val;
|
return val;
|
||||||
},
|
},
|
||||||
|
|
||||||
setValue(field: IPublicModelSettingTarget, eventData) {
|
setValue(field: IPublicModelSettingField, eventData) {
|
||||||
const { eventDataList, eventList } = eventData;
|
const { eventDataList, eventList } = eventData;
|
||||||
Array.isArray(eventList) &&
|
Array.isArray(eventList) &&
|
||||||
eventList.map((item) => {
|
eventList.map((item) => {
|
||||||
|
|||||||
@ -1,18 +1,19 @@
|
|||||||
import {
|
import {
|
||||||
INode,
|
INode,
|
||||||
SettingField as InnerSettingField,
|
ISettingField,
|
||||||
} from '@alilc/lowcode-designer';
|
} from '@alilc/lowcode-designer';
|
||||||
import { IShellModelFactory, IPublicModelNode, IPublicModelSettingPropEntry } from '@alilc/lowcode-types';
|
import { IShellModelFactory, IPublicModelNode } from '@alilc/lowcode-types';
|
||||||
|
import { IPublicModelSettingField } from '../../../types/src/shell/model/setting-field';
|
||||||
import {
|
import {
|
||||||
Node,
|
Node,
|
||||||
SettingPropEntry,
|
SettingField,
|
||||||
} from '@alilc/lowcode-shell';
|
} from '@alilc/lowcode-shell';
|
||||||
class ShellModelFactory implements IShellModelFactory {
|
class ShellModelFactory implements IShellModelFactory {
|
||||||
createNode(node: INode | null | undefined): IPublicModelNode | null {
|
createNode(node: INode | null | undefined): IPublicModelNode | null {
|
||||||
return Node.create(node);
|
return Node.create(node);
|
||||||
}
|
}
|
||||||
createSettingPropEntry(prop: InnerSettingField): IPublicModelSettingPropEntry {
|
createSettingField(prop: ISettingField): IPublicModelSettingField {
|
||||||
return SettingPropEntry.create(prop);
|
return SettingField.create(prop);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export const shellModelFactory = new ShellModelFactory();
|
export const shellModelFactory = new ShellModelFactory();
|
||||||
@ -6,7 +6,7 @@ import {
|
|||||||
designerSymbol,
|
designerSymbol,
|
||||||
skeletonSymbol,
|
skeletonSymbol,
|
||||||
editorSymbol,
|
editorSymbol,
|
||||||
settingPropEntrySymbol,
|
settingFieldSymbol,
|
||||||
settingTopEntrySymbol,
|
settingTopEntrySymbol,
|
||||||
designerCabinSymbol,
|
designerCabinSymbol,
|
||||||
propSymbol,
|
propSymbol,
|
||||||
@ -21,7 +21,7 @@ export default {
|
|||||||
skeletonSymbol,
|
skeletonSymbol,
|
||||||
editorSymbol,
|
editorSymbol,
|
||||||
designerSymbol,
|
designerSymbol,
|
||||||
settingPropEntrySymbol,
|
settingPropEntrySymbol: settingFieldSymbol,
|
||||||
settingTopEntrySymbol,
|
settingTopEntrySymbol,
|
||||||
designerCabinSymbol,
|
designerCabinSymbol,
|
||||||
propSymbol,
|
propSymbol,
|
||||||
|
|||||||
@ -7,10 +7,10 @@ import {
|
|||||||
Prop,
|
Prop,
|
||||||
Selection,
|
Selection,
|
||||||
Dragon,
|
Dragon,
|
||||||
SettingPropEntry,
|
|
||||||
SettingTopEntry,
|
SettingTopEntry,
|
||||||
Clipboard,
|
Clipboard,
|
||||||
Config,
|
Config,
|
||||||
|
SettingField,
|
||||||
} from './model';
|
} from './model';
|
||||||
import {
|
import {
|
||||||
Project,
|
Project,
|
||||||
@ -51,7 +51,7 @@ export {
|
|||||||
Setters,
|
Setters,
|
||||||
Hotkey,
|
Hotkey,
|
||||||
Skeleton,
|
Skeleton,
|
||||||
SettingPropEntry,
|
SettingField as SettingPropEntry,
|
||||||
SettingTopEntry,
|
SettingTopEntry,
|
||||||
Dragon,
|
Dragon,
|
||||||
Common,
|
Common,
|
||||||
@ -63,4 +63,5 @@ export {
|
|||||||
Clipboard,
|
Clipboard,
|
||||||
SimulatorHost,
|
SimulatorHost,
|
||||||
Config,
|
Config,
|
||||||
|
SettingField,
|
||||||
};
|
};
|
||||||
|
|||||||
@ -12,8 +12,8 @@ export * from './node';
|
|||||||
export * from './prop';
|
export * from './prop';
|
||||||
export * from './props';
|
export * from './props';
|
||||||
export * from './selection';
|
export * from './selection';
|
||||||
export * from './setting-prop-entry';
|
|
||||||
export * from './setting-top-entry';
|
export * from './setting-top-entry';
|
||||||
|
export * from './setting-field';
|
||||||
export * from './resource';
|
export * from './resource';
|
||||||
export * from './active-tracker';
|
export * from './active-tracker';
|
||||||
export * from './plugin-instance';
|
export * from './plugin-instance';
|
||||||
|
|||||||
@ -28,7 +28,7 @@ export class Props implements IPublicModelProps {
|
|||||||
/**
|
/**
|
||||||
* 返回当前 props 的路径
|
* 返回当前 props 的路径
|
||||||
*/
|
*/
|
||||||
get path(): any[] {
|
get path(): string[] {
|
||||||
return this[propsSymbol].path;
|
return this[propsSymbol].path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,144 +1,149 @@
|
|||||||
import { SettingField, ISettingEntry } from '@alilc/lowcode-designer';
|
import { ISettingField, isSettingField } from '@alilc/lowcode-designer';
|
||||||
import {
|
import {
|
||||||
IPublicTypeCompositeValue,
|
IPublicTypeCompositeValue,
|
||||||
IPublicTypeFieldConfig,
|
IPublicTypeFieldConfig,
|
||||||
IPublicTypeCustomView,
|
IPublicTypeCustomView,
|
||||||
IPublicModelSettingPropEntry,
|
|
||||||
IPublicTypeSetterType,
|
IPublicTypeSetterType,
|
||||||
IPublicTypeFieldExtraProps,
|
IPublicTypeFieldExtraProps,
|
||||||
IPublicModelSettingTopEntry,
|
IPublicModelSettingTopEntry,
|
||||||
IPublicModelNode,
|
IPublicModelNode,
|
||||||
IPublicModelComponentMeta,
|
IPublicModelComponentMeta,
|
||||||
IPublicTypeSetValueOptions,
|
IPublicTypeSetValueOptions,
|
||||||
|
IPublicModelSettingField,
|
||||||
|
IPublicTypeDisposable,
|
||||||
} from '@alilc/lowcode-types';
|
} from '@alilc/lowcode-types';
|
||||||
import { settingPropEntrySymbol } from '../symbols';
|
import { settingFieldSymbol } from '../symbols';
|
||||||
import { Node as ShellNode } from './node';
|
import { Node as ShellNode } from './node';
|
||||||
import { SettingTopEntry as ShellSettingTopEntry } from './setting-top-entry';
|
import { SettingTopEntry, SettingTopEntry as ShellSettingTopEntry } from './setting-top-entry';
|
||||||
import { ComponentMeta as ShellComponentMeta } from './component-meta';
|
import { ComponentMeta as ShellComponentMeta } from './component-meta';
|
||||||
import { isCustomView } from '@alilc/lowcode-utils';
|
import { isCustomView } from '@alilc/lowcode-utils';
|
||||||
|
|
||||||
export class SettingPropEntry implements IPublicModelSettingPropEntry {
|
export class SettingField implements IPublicModelSettingField {
|
||||||
private readonly [settingPropEntrySymbol]: SettingField;
|
private readonly [settingFieldSymbol]: ISettingField;
|
||||||
|
|
||||||
constructor(prop: SettingField) {
|
constructor(prop: ISettingField) {
|
||||||
this[settingPropEntrySymbol] = prop;
|
this[settingFieldSymbol] = prop;
|
||||||
}
|
}
|
||||||
|
|
||||||
static create(prop: SettingField): IPublicModelSettingPropEntry {
|
static create(prop: ISettingField): IPublicModelSettingField {
|
||||||
return new SettingPropEntry(prop);
|
return new SettingField(prop);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取设置属性的 isGroup
|
* 获取设置属性的 isGroup
|
||||||
*/
|
*/
|
||||||
get isGroup(): boolean {
|
get isGroup(): boolean {
|
||||||
return this[settingPropEntrySymbol].isGroup;
|
return this[settingFieldSymbol].isGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取设置属性的 id
|
* 获取设置属性的 id
|
||||||
*/
|
*/
|
||||||
get id(): string {
|
get id(): string {
|
||||||
return this[settingPropEntrySymbol].id;
|
return this[settingFieldSymbol].id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取设置属性的 name
|
* 获取设置属性的 name
|
||||||
*/
|
*/
|
||||||
get name(): string | number {
|
get name(): string | number | undefined {
|
||||||
return this[settingPropEntrySymbol].name;
|
return this[settingFieldSymbol].name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取设置属性的 key
|
* 获取设置属性的 key
|
||||||
*/
|
*/
|
||||||
get key(): string | number {
|
get key(): string | number | undefined {
|
||||||
return this[settingPropEntrySymbol].getKey();
|
return this[settingFieldSymbol].getKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取设置属性的 path
|
* 获取设置属性的 path
|
||||||
*/
|
*/
|
||||||
get path(): any[] {
|
get path(): any[] {
|
||||||
return this[settingPropEntrySymbol].path;
|
return this[settingFieldSymbol].path;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取设置属性的 title
|
* 获取设置属性的 title
|
||||||
*/
|
*/
|
||||||
get title(): any {
|
get title(): any {
|
||||||
return this[settingPropEntrySymbol].title;
|
return this[settingFieldSymbol].title;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取设置属性的 setter
|
* 获取设置属性的 setter
|
||||||
*/
|
*/
|
||||||
get setter(): IPublicTypeSetterType | null {
|
get setter(): IPublicTypeSetterType | null {
|
||||||
return this[settingPropEntrySymbol].setter;
|
return this[settingFieldSymbol].setter;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取设置属性的 expanded
|
* 获取设置属性的 expanded
|
||||||
*/
|
*/
|
||||||
get expanded(): boolean {
|
get expanded(): boolean {
|
||||||
return this[settingPropEntrySymbol].expanded;
|
return this[settingFieldSymbol].expanded;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取设置属性的 extraProps
|
* 获取设置属性的 extraProps
|
||||||
*/
|
*/
|
||||||
get extraProps(): IPublicTypeFieldExtraProps {
|
get extraProps(): IPublicTypeFieldExtraProps {
|
||||||
return this[settingPropEntrySymbol].extraProps;
|
return this[settingFieldSymbol].extraProps;
|
||||||
}
|
}
|
||||||
|
|
||||||
get props(): IPublicModelSettingTopEntry {
|
get props(): IPublicModelSettingTopEntry {
|
||||||
return ShellSettingTopEntry.create(this[settingPropEntrySymbol].props);
|
return ShellSettingTopEntry.create(this[settingFieldSymbol].props);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取设置属性对应的节点实例
|
* 获取设置属性对应的节点实例
|
||||||
*/
|
*/
|
||||||
get node(): IPublicModelNode | null {
|
get node(): IPublicModelNode | null {
|
||||||
return ShellNode.create(this[settingPropEntrySymbol].getNode());
|
return ShellNode.create(this[settingFieldSymbol].getNode());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取设置属性的父设置属性
|
* 获取设置属性的父设置属性
|
||||||
*/
|
*/
|
||||||
get parent(): IPublicModelSettingPropEntry {
|
get parent(): IPublicModelSettingField | IPublicModelSettingTopEntry {
|
||||||
return SettingPropEntry.create(this[settingPropEntrySymbol].parent as any);
|
if (isSettingField(this[settingFieldSymbol].parent)) {
|
||||||
|
return SettingField.create(this[settingFieldSymbol].parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
return SettingTopEntry.create(this[settingFieldSymbol].parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取顶级设置属性
|
* 获取顶级设置属性
|
||||||
*/
|
*/
|
||||||
get top(): IPublicModelSettingTopEntry {
|
get top(): IPublicModelSettingTopEntry {
|
||||||
return ShellSettingTopEntry.create(this[settingPropEntrySymbol].top);
|
return ShellSettingTopEntry.create(this[settingFieldSymbol].top);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否是 SettingField 实例
|
* 是否是 SettingField 实例
|
||||||
*/
|
*/
|
||||||
get isSettingField(): boolean {
|
get isSettingField(): boolean {
|
||||||
return this[settingPropEntrySymbol].isSettingField;
|
return this[settingFieldSymbol].isSettingField;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* componentMeta
|
* componentMeta
|
||||||
*/
|
*/
|
||||||
get componentMeta(): IPublicModelComponentMeta | null {
|
get componentMeta(): IPublicModelComponentMeta | null {
|
||||||
return ShellComponentMeta.create(this[settingPropEntrySymbol].componentMeta);
|
return ShellComponentMeta.create(this[settingFieldSymbol].componentMeta);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取设置属性的 items
|
* 获取设置属性的 items
|
||||||
*/
|
*/
|
||||||
get items(): Array<IPublicModelSettingPropEntry | IPublicTypeCustomView> {
|
get items(): Array<IPublicModelSettingField | IPublicTypeCustomView> {
|
||||||
return this[settingPropEntrySymbol].items?.map((item) => {
|
return this[settingFieldSymbol].items?.map((item) => {
|
||||||
if (isCustomView(item)) {
|
if (isCustomView(item)) {
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
return item.internalToShellPropEntry();
|
return item.internalToShell();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,7 +152,7 @@ export class SettingPropEntry implements IPublicModelSettingPropEntry {
|
|||||||
* @param key
|
* @param key
|
||||||
*/
|
*/
|
||||||
setKey(key: string | number): void {
|
setKey(key: string | number): void {
|
||||||
this[settingPropEntrySymbol].setKey(key);
|
this[settingFieldSymbol].setKey(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -169,7 +174,7 @@ export class SettingPropEntry implements IPublicModelSettingPropEntry {
|
|||||||
* @param val 值
|
* @param val 值
|
||||||
*/
|
*/
|
||||||
setValue(val: IPublicTypeCompositeValue, extraOptions?: IPublicTypeSetValueOptions): void {
|
setValue(val: IPublicTypeCompositeValue, extraOptions?: IPublicTypeSetValueOptions): void {
|
||||||
this[settingPropEntrySymbol].setValue(val, false, false, extraOptions);
|
this[settingFieldSymbol].setValue(val, false, false, extraOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -178,7 +183,7 @@ export class SettingPropEntry implements IPublicModelSettingPropEntry {
|
|||||||
* @param value 值
|
* @param value 值
|
||||||
*/
|
*/
|
||||||
setPropValue(propName: string | number, value: any): void {
|
setPropValue(propName: string | number, value: any): void {
|
||||||
this[settingPropEntrySymbol].setPropValue(propName, value);
|
this[settingFieldSymbol].setPropValue(propName, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -186,7 +191,7 @@ export class SettingPropEntry implements IPublicModelSettingPropEntry {
|
|||||||
* @param propName
|
* @param propName
|
||||||
*/
|
*/
|
||||||
clearPropValue(propName: string | number): void {
|
clearPropValue(propName: string | number): void {
|
||||||
this[settingPropEntrySymbol].clearPropValue(propName);
|
this[settingFieldSymbol].clearPropValue(propName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -194,7 +199,7 @@ export class SettingPropEntry implements IPublicModelSettingPropEntry {
|
|||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
getDefaultValue(): any {
|
getDefaultValue(): any {
|
||||||
return this[settingPropEntrySymbol].getDefaultValue();
|
return this[settingFieldSymbol].getDefaultValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -202,7 +207,7 @@ export class SettingPropEntry implements IPublicModelSettingPropEntry {
|
|||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
getValue(): any {
|
getValue(): any {
|
||||||
return this[settingPropEntrySymbol].getValue();
|
return this[settingFieldSymbol].getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -211,21 +216,21 @@ export class SettingPropEntry implements IPublicModelSettingPropEntry {
|
|||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
getPropValue(propName: string | number): any {
|
getPropValue(propName: string | number): any {
|
||||||
return this[settingPropEntrySymbol].getPropValue(propName);
|
return this[settingFieldSymbol].getPropValue(propName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取顶层附属属性值
|
* 获取顶层附属属性值
|
||||||
*/
|
*/
|
||||||
getExtraPropValue(propName: string): any {
|
getExtraPropValue(propName: string): any {
|
||||||
return this[settingPropEntrySymbol].getExtraPropValue(propName);
|
return this[settingFieldSymbol].getExtraPropValue(propName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置顶层附属属性值
|
* 设置顶层附属属性值
|
||||||
*/
|
*/
|
||||||
setExtraPropValue(propName: string, value: any): void {
|
setExtraPropValue(propName: string, value: any): void {
|
||||||
this[settingPropEntrySymbol].setExtraPropValue(propName, value);
|
this[settingFieldSymbol].setExtraPropValue(propName, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -233,7 +238,7 @@ export class SettingPropEntry implements IPublicModelSettingPropEntry {
|
|||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
getProps(): IPublicModelSettingTopEntry {
|
getProps(): IPublicModelSettingTopEntry {
|
||||||
return ShellSettingTopEntry.create(this[settingPropEntrySymbol].getProps() as ISettingEntry);
|
return ShellSettingTopEntry.create(this[settingFieldSymbol].getProps());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -241,7 +246,7 @@ export class SettingPropEntry implements IPublicModelSettingPropEntry {
|
|||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
isUseVariable(): boolean {
|
isUseVariable(): boolean {
|
||||||
return this[settingPropEntrySymbol].isUseVariable();
|
return this[settingFieldSymbol].isUseVariable();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -249,7 +254,7 @@ export class SettingPropEntry implements IPublicModelSettingPropEntry {
|
|||||||
* @param flag
|
* @param flag
|
||||||
*/
|
*/
|
||||||
setUseVariable(flag: boolean): void {
|
setUseVariable(flag: boolean): void {
|
||||||
this[settingPropEntrySymbol].setUseVariable(flag);
|
this[settingFieldSymbol].setUseVariable(flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -257,8 +262,8 @@ export class SettingPropEntry implements IPublicModelSettingPropEntry {
|
|||||||
* @param config
|
* @param config
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
createField(config: IPublicTypeFieldConfig): IPublicModelSettingPropEntry {
|
createField(config: IPublicTypeFieldConfig): IPublicModelSettingField {
|
||||||
return SettingPropEntry.create(this[settingPropEntrySymbol].createField(config));
|
return SettingField.create(this[settingFieldSymbol].createField(config));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -266,21 +271,21 @@ export class SettingPropEntry implements IPublicModelSettingPropEntry {
|
|||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
getMockOrValue(): any {
|
getMockOrValue(): any {
|
||||||
return this[settingPropEntrySymbol].getMockOrValue();
|
return this[settingFieldSymbol].getMockOrValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 销毁当前 field 实例
|
* 销毁当前 field 实例
|
||||||
*/
|
*/
|
||||||
purge(): void {
|
purge(): void {
|
||||||
this[settingPropEntrySymbol].purge();
|
this[settingFieldSymbol].purge();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 移除当前 field 实例
|
* 移除当前 field 实例
|
||||||
*/
|
*/
|
||||||
remove(): void {
|
remove(): void {
|
||||||
this[settingPropEntrySymbol].remove();
|
this[settingFieldSymbol].remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -288,15 +293,15 @@ export class SettingPropEntry implements IPublicModelSettingPropEntry {
|
|||||||
* @param action
|
* @param action
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
onEffect(action: () => void): () => void {
|
onEffect(action: () => void): IPublicTypeDisposable {
|
||||||
return this[settingPropEntrySymbol].onEffect(action);
|
return this[settingFieldSymbol].onEffect(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 返回 shell 模型,兼容某些场景下 field 已经是 shell field 了
|
* 返回 shell 模型,兼容某些场景下 field 已经是 shell field 了
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
internalToShellPropEntry() {
|
internalToShellField() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,17 +1,17 @@
|
|||||||
import { ISettingEntry } from '@alilc/lowcode-designer';
|
import { ISettingTopEntry } from '@alilc/lowcode-designer';
|
||||||
import { settingTopEntrySymbol } from '../symbols';
|
import { settingTopEntrySymbol } from '../symbols';
|
||||||
import { Node as ShellNode } from './node';
|
import { Node as ShellNode } from './node';
|
||||||
import { SettingPropEntry as ShellSettingPropEntry } from './setting-prop-entry';
|
import { IPublicModelSettingTopEntry, IPublicModelNode, IPublicModelSettingField } from '@alilc/lowcode-types';
|
||||||
import { IPublicModelSettingTopEntry, IPublicModelNode, IPublicModelSettingPropEntry } from '@alilc/lowcode-types';
|
import { SettingField } from './setting-field';
|
||||||
|
|
||||||
export class SettingTopEntry implements IPublicModelSettingTopEntry {
|
export class SettingTopEntry implements IPublicModelSettingTopEntry {
|
||||||
private readonly [settingTopEntrySymbol]: ISettingEntry;
|
private readonly [settingTopEntrySymbol]: ISettingTopEntry;
|
||||||
|
|
||||||
constructor(prop: ISettingEntry) {
|
constructor(prop: ISettingTopEntry) {
|
||||||
this[settingTopEntrySymbol] = prop;
|
this[settingTopEntrySymbol] = prop;
|
||||||
}
|
}
|
||||||
|
|
||||||
static create(prop: ISettingEntry): IPublicModelSettingTopEntry {
|
static create(prop: ISettingTopEntry): IPublicModelSettingTopEntry {
|
||||||
return new SettingTopEntry(prop);
|
return new SettingTopEntry(prop);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -27,8 +27,8 @@ export class SettingTopEntry implements IPublicModelSettingTopEntry {
|
|||||||
* @param propName
|
* @param propName
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
get(propName: string | number): IPublicModelSettingPropEntry {
|
get(propName: string | number): IPublicModelSettingField {
|
||||||
return ShellSettingPropEntry.create(this[settingTopEntrySymbol].get(propName) as any);
|
return SettingField.create(this[settingTopEntrySymbol].get(propName)!);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -55,4 +55,8 @@ export class SettingTopEntry implements IPublicModelSettingTopEntry {
|
|||||||
setPropValue(propName: string | number, value: any): void {
|
setPropValue(propName: string | number, value: any): void {
|
||||||
this[settingTopEntrySymbol].setPropValue(propName, value);
|
this[settingTopEntrySymbol].setPropValue(propName, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clearPropValue(propName: string | number) {
|
||||||
|
this[settingTopEntrySymbol].clearPropValue(propName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -10,7 +10,7 @@ export const nodeSymbol = Symbol('node');
|
|||||||
export const modalNodesManagerSymbol = Symbol('modalNodesManager');
|
export const modalNodesManagerSymbol = Symbol('modalNodesManager');
|
||||||
export const nodeChildrenSymbol = Symbol('nodeChildren');
|
export const nodeChildrenSymbol = Symbol('nodeChildren');
|
||||||
export const propSymbol = Symbol('prop');
|
export const propSymbol = Symbol('prop');
|
||||||
export const settingPropEntrySymbol = Symbol('settingPropEntry');
|
export const settingFieldSymbol = Symbol('settingField');
|
||||||
export const settingTopEntrySymbol = Symbol('settingTopEntry');
|
export const settingTopEntrySymbol = Symbol('settingTopEntry');
|
||||||
export const propsSymbol = Symbol('props');
|
export const propsSymbol = Symbol('props');
|
||||||
export const detectingSymbol = Symbol('detecting');
|
export const detectingSymbol = Symbol('detecting');
|
||||||
|
|||||||
@ -1,8 +1,9 @@
|
|||||||
import { IPublicModelSettingPropEntry, IPublicModelNode } from './shell';
|
import { IPublicModelNode, IPublicModelSettingField } from './shell';
|
||||||
|
|
||||||
export interface IShellModelFactory {
|
export interface IShellModelFactory {
|
||||||
// TODO: 需要给 innerNode 提供一个 interface 并用在这里
|
// TODO: 需要给 innerNode 提供一个 interface 并用在这里
|
||||||
createNode(node: any | null | undefined): IPublicModelNode | null;
|
createNode(node: any | null | undefined): IPublicModelNode | null;
|
||||||
// TODO: 需要给 InnerSettingField 提供一个 interface 并用在这里
|
// TODO: 需要给 InnerSettingField 提供一个 interface 并用在这里
|
||||||
createSettingPropEntry(prop: any): IPublicModelSettingPropEntry;
|
|
||||||
|
createSettingField(prop: any): IPublicModelSettingField;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,5 +29,4 @@ export * from './plugin-instance';
|
|||||||
export * from './sensor';
|
export * from './sensor';
|
||||||
export * from './resource';
|
export * from './resource';
|
||||||
export * from './clipboard';
|
export * from './clipboard';
|
||||||
export * from './setting-entry';
|
|
||||||
export * from './setting-field';
|
export * from './setting-field';
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { IPublicTypeCompositeValue } from '../type';
|
import { IPublicTypeCompositeValue } from '../type';
|
||||||
import { IPublicModelNode } from './';
|
import { IPublicModelNode, IPublicModelProp } from './';
|
||||||
|
|
||||||
export interface IBaseModelProps<
|
export interface IBaseModelProps<
|
||||||
Prop
|
Prop
|
||||||
@ -86,4 +86,4 @@ export interface IBaseModelProps<
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type IPublicModelProps = IBaseModelProps<IPublicModelProps>;
|
export interface IPublicModelProps extends IBaseModelProps<IPublicModelProp> {};
|
||||||
@ -1,20 +0,0 @@
|
|||||||
import { IPublicModelComponentMeta } from "./component-meta";
|
|
||||||
import { IPublicModelNode } from "./node";
|
|
||||||
import { IBaseModelSettingTarget } from "./setting-target";
|
|
||||||
|
|
||||||
export interface IBaseModelSettingEntry<
|
|
||||||
Node,
|
|
||||||
ComponentMeta,
|
|
||||||
SettingEntry
|
|
||||||
> extends IBaseModelSettingTarget<
|
|
||||||
SettingEntry
|
|
||||||
> {
|
|
||||||
readonly nodes: Node[];
|
|
||||||
readonly componentMeta: ComponentMeta | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IPublicModelSettingEntry extends IBaseModelSettingEntry<
|
|
||||||
IPublicModelNode,
|
|
||||||
IPublicModelComponentMeta,
|
|
||||||
IPublicModelSettingEntry
|
|
||||||
> {}
|
|
||||||
@ -1,5 +1,198 @@
|
|||||||
import { IPublicModelSettingEntry } from "./setting-entry";
|
import { IPublicTypeCustomView, IPublicTypeCompositeValue, IPublicTypeSetterType, IPublicTypeSetValueOptions, IPublicTypeFieldConfig, IPublicTypeFieldExtraProps, IPublicTypeDisposable } from '../type';
|
||||||
|
import { IPublicModelNode, IPublicModelComponentMeta, IPublicModelSettingTopEntry } from './';
|
||||||
|
|
||||||
export interface IPublicModelSettingField extends IPublicModelSettingEntry {
|
export interface IBaseModelSettingField<
|
||||||
|
SettingTopEntry,
|
||||||
|
SettingField,
|
||||||
|
ComponentMeta,
|
||||||
|
Node
|
||||||
|
> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取设置属性的 isGroup
|
||||||
|
*/
|
||||||
|
get isGroup(): boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取设置属性的 id
|
||||||
|
*/
|
||||||
|
get id(): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取设置属性的 name
|
||||||
|
*/
|
||||||
|
get name(): string | number | undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取设置属性的 key
|
||||||
|
*/
|
||||||
|
get key(): string | number | undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取设置属性的 path
|
||||||
|
*/
|
||||||
|
get path(): any[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取设置属性的 title
|
||||||
|
*/
|
||||||
|
get title(): any;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取设置属性的 setter
|
||||||
|
*/
|
||||||
|
get setter(): IPublicTypeSetterType | null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取设置属性的 expanded
|
||||||
|
*/
|
||||||
|
get expanded(): boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取设置属性的 extraProps
|
||||||
|
*/
|
||||||
|
get extraProps(): IPublicTypeFieldExtraProps;
|
||||||
|
|
||||||
|
get props(): SettingTopEntry;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取设置属性对应的节点实例
|
||||||
|
*/
|
||||||
|
get node(): Node | null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取设置属性的父设置属性
|
||||||
|
*/
|
||||||
|
readonly parent: SettingTopEntry | SettingField;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取顶级设置属性
|
||||||
|
*/
|
||||||
|
get top(): SettingTopEntry;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否是 SettingField 实例
|
||||||
|
*/
|
||||||
|
get isSettingField(): boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* componentMeta
|
||||||
|
*/
|
||||||
|
get componentMeta(): ComponentMeta | null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取设置属性的 items
|
||||||
|
*/
|
||||||
|
get items(): Array<SettingField | IPublicTypeCustomView>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置 key 值
|
||||||
|
* @param key
|
||||||
|
*/
|
||||||
|
setKey(key: string | number): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置值
|
||||||
|
* @param val 值
|
||||||
|
*/
|
||||||
|
setValue(val: IPublicTypeCompositeValue, extraOptions?: IPublicTypeSetValueOptions): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置子级属性值
|
||||||
|
* @param propName 子属性名
|
||||||
|
* @param value 值
|
||||||
|
*/
|
||||||
|
setPropValue(propName: string | number, value: any): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清空指定属性值
|
||||||
|
* @param propName
|
||||||
|
*/
|
||||||
|
clearPropValue(propName: string | number): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取配置的默认值
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
getDefaultValue(): any;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取值
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
getValue(): any;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取子级属性值
|
||||||
|
* @param propName 子属性名
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
getPropValue(propName: string | number): any;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取顶层附属属性值
|
||||||
|
*/
|
||||||
|
getExtraPropValue(propName: string): any;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置顶层附属属性值
|
||||||
|
*/
|
||||||
|
setExtraPropValue(propName: string, value: any): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取设置属性集
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
getProps(): SettingTopEntry;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否绑定了变量
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
isUseVariable(): boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置绑定变量
|
||||||
|
* @param flag
|
||||||
|
*/
|
||||||
|
setUseVariable(flag: boolean): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建一个设置 field 实例
|
||||||
|
* @param config
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
createField(config: IPublicTypeFieldConfig): SettingField;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取值,当为变量时,返回 mock
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
getMockOrValue(): any;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 销毁当前 field 实例
|
||||||
|
*/
|
||||||
|
purge(): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 移除当前 field 实例
|
||||||
|
*/
|
||||||
|
remove(): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置 autorun
|
||||||
|
* @param action
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
onEffect(action: () => void): IPublicTypeDisposable;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IPublicModelSettingField extends IBaseModelSettingField<
|
||||||
|
IPublicModelSettingTopEntry,
|
||||||
|
IPublicModelSettingField,
|
||||||
|
IPublicModelComponentMeta,
|
||||||
|
IPublicModelNode
|
||||||
|
> {
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1,184 +1,6 @@
|
|||||||
import { IPublicTypeCustomView, IPublicTypeCompositeValue, IPublicTypeSetterType, IPublicTypeSetValueOptions, IPublicTypeFieldConfig, IPublicTypeFieldExtraProps } from '../type';
|
import { IPublicModelSettingField } from './';
|
||||||
import { IPublicModelNode, IPublicModelComponentMeta, IPublicModelSettingTopEntry } from './';
|
|
||||||
|
|
||||||
export interface IPublicModelSettingPropEntry {
|
/**
|
||||||
|
* @deprecated please use IPublicModelSettingField
|
||||||
/**
|
|
||||||
* 获取设置属性的 isGroup
|
|
||||||
*/
|
*/
|
||||||
get isGroup(): boolean;
|
export type IPublicModelSettingPropEntry = IPublicModelSettingField
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取设置属性的 id
|
|
||||||
*/
|
|
||||||
get id(): string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取设置属性的 name
|
|
||||||
*/
|
|
||||||
get name(): string | number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取设置属性的 key
|
|
||||||
*/
|
|
||||||
get key(): string | number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取设置属性的 path
|
|
||||||
*/
|
|
||||||
get path(): any[];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取设置属性的 title
|
|
||||||
*/
|
|
||||||
get title(): any;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取设置属性的 setter
|
|
||||||
*/
|
|
||||||
get setter(): IPublicTypeSetterType | null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取设置属性的 expanded
|
|
||||||
*/
|
|
||||||
get expanded(): boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取设置属性的 extraProps
|
|
||||||
*/
|
|
||||||
get extraProps(): IPublicTypeFieldExtraProps;
|
|
||||||
|
|
||||||
get props(): IPublicModelSettingTopEntry;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取设置属性对应的节点实例
|
|
||||||
*/
|
|
||||||
get node(): IPublicModelNode | null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取设置属性的父设置属性
|
|
||||||
*/
|
|
||||||
get parent(): IPublicModelSettingPropEntry;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取顶级设置属性
|
|
||||||
*/
|
|
||||||
get top(): IPublicModelSettingTopEntry;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否是 SettingField 实例
|
|
||||||
*/
|
|
||||||
get isSettingField(): boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* componentMeta
|
|
||||||
*/
|
|
||||||
get componentMeta(): IPublicModelComponentMeta | null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取设置属性的 items
|
|
||||||
*/
|
|
||||||
get items(): Array<IPublicModelSettingPropEntry | IPublicTypeCustomView>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置 key 值
|
|
||||||
* @param key
|
|
||||||
*/
|
|
||||||
setKey(key: string | number): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置值
|
|
||||||
* @param val 值
|
|
||||||
*/
|
|
||||||
setValue(val: IPublicTypeCompositeValue, extraOptions?: IPublicTypeSetValueOptions): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置子级属性值
|
|
||||||
* @param propName 子属性名
|
|
||||||
* @param value 值
|
|
||||||
*/
|
|
||||||
setPropValue(propName: string | number, value: any): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 清空指定属性值
|
|
||||||
* @param propName
|
|
||||||
*/
|
|
||||||
clearPropValue(propName: string | number): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取配置的默认值
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
getDefaultValue(): any;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取值
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
getValue(): any;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取子级属性值
|
|
||||||
* @param propName 子属性名
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
getPropValue(propName: string | number): any;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取顶层附属属性值
|
|
||||||
*/
|
|
||||||
getExtraPropValue(propName: string): any;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置顶层附属属性值
|
|
||||||
*/
|
|
||||||
setExtraPropValue(propName: string, value: any): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取设置属性集
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
getProps(): IPublicModelSettingTopEntry;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否绑定了变量
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
isUseVariable(): boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置绑定变量
|
|
||||||
* @param flag
|
|
||||||
*/
|
|
||||||
setUseVariable(flag: boolean): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建一个设置 field 实例
|
|
||||||
* @param config
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
createField(config: IPublicTypeFieldConfig): IPublicModelSettingPropEntry;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取值,当为变量时,返回 mock
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
getMockOrValue(): any;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 销毁当前 field 实例
|
|
||||||
*/
|
|
||||||
purge(): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 移除当前 field 实例
|
|
||||||
*/
|
|
||||||
remove(): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置 autorun
|
|
||||||
* @param action
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
onEffect(action: () => void): () => void;
|
|
||||||
}
|
|
||||||
|
|||||||
@ -1,101 +1,6 @@
|
|||||||
import { IPublicApiSetters } from '../api';
|
import { IPublicModelSettingField } from './';
|
||||||
import { IPublicModelEditor } from './';
|
|
||||||
|
|
||||||
export interface IBaseModelSettingTarget<
|
/**
|
||||||
SettingTarget
|
* @deprecated please use IPublicModelSettingField
|
||||||
> {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 同样类型的节点
|
|
||||||
*/
|
*/
|
||||||
readonly isSameComponent: boolean;
|
export type IPublicModelSettingTarget = IPublicModelSettingField;
|
||||||
|
|
||||||
/**
|
|
||||||
* 一个
|
|
||||||
*/
|
|
||||||
readonly isSingle: boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 多个
|
|
||||||
*/
|
|
||||||
readonly isMultiple: boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 编辑器引用
|
|
||||||
*/
|
|
||||||
readonly editor: IPublicModelEditor;
|
|
||||||
|
|
||||||
readonly setters: IPublicApiSetters;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 访问路径
|
|
||||||
*/
|
|
||||||
readonly path: Array<string| number>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 顶端
|
|
||||||
*/
|
|
||||||
readonly top: SettingTarget;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 父级
|
|
||||||
*/
|
|
||||||
readonly parent: SettingTarget;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取当前值
|
|
||||||
*/
|
|
||||||
getValue: () => any;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置当前值
|
|
||||||
*/
|
|
||||||
setValue: (value: any) => void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 取得子项
|
|
||||||
*/
|
|
||||||
get: (propName: string | number) => SettingTarget | null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 取得子项
|
|
||||||
*/
|
|
||||||
getProps?: () => SettingTarget;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取子项属性值
|
|
||||||
*/
|
|
||||||
getPropValue: (propName: string | number) => any;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置子项属性值
|
|
||||||
*/
|
|
||||||
setPropValue: (propName: string | number, value: any) => void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 清除已设置值
|
|
||||||
*/
|
|
||||||
clearPropValue: (propName: string | number) => void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取顶层附属属性值
|
|
||||||
*/
|
|
||||||
getExtraPropValue: (propName: string) => any;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置顶层附属属性值
|
|
||||||
*/
|
|
||||||
setExtraPropValue: (propName: string, value: any) => void;
|
|
||||||
|
|
||||||
// @todo 补充 node 定义
|
|
||||||
/**
|
|
||||||
* 获取 node 中的第一项
|
|
||||||
*/
|
|
||||||
getNode: () => any;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IPublicModelSettingTarget extends IBaseModelSettingTarget<
|
|
||||||
IPublicModelSettingTarget
|
|
||||||
> {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|||||||
@ -1,18 +1,21 @@
|
|||||||
import { IPublicModelNode, IPublicModelSettingPropEntry } from './';
|
import { IPublicModelNode, IPublicModelSettingField } from './';
|
||||||
|
|
||||||
export interface IPublicModelSettingTopEntry {
|
export interface IPublicModelSettingTopEntry<
|
||||||
|
Node = IPublicModelNode,
|
||||||
|
SettingField = IPublicModelSettingField
|
||||||
|
> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 返回所属的节点实例
|
* 返回所属的节点实例
|
||||||
*/
|
*/
|
||||||
get node(): IPublicModelNode | null;
|
get node(): Node | null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取子级属性对象
|
* 获取子级属性对象
|
||||||
* @param propName
|
* @param propName
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
get(propName: string | number): IPublicModelSettingPropEntry;
|
get(propName: string | number): SettingField | null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取指定 propName 的值
|
* 获取指定 propName 的值
|
||||||
@ -27,4 +30,10 @@ export interface IPublicModelSettingTopEntry {
|
|||||||
* @param value
|
* @param value
|
||||||
*/
|
*/
|
||||||
setPropValue(propName: string | number, value: any): void;
|
setPropValue(propName: string | number, value: any): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清除指定 propName 的值
|
||||||
|
* @param propName
|
||||||
|
*/
|
||||||
|
clearPropValue(propName: string | number): void;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { ComponentType, ReactElement } from 'react';
|
import { ComponentType, ReactElement } from 'react';
|
||||||
import { IPublicTypeNodeData, IPublicTypeSnippet, IPublicTypeInitialItem, IPublicTypeFilterItem, IPublicTypeAutorunItem, IPublicTypeCallbacks, IPublicTypeLiveTextEditingConfig } from './';
|
import { IPublicTypeNodeData, IPublicTypeSnippet, IPublicTypeInitialItem, IPublicTypeFilterItem, IPublicTypeAutorunItem, IPublicTypeCallbacks, IPublicTypeLiveTextEditingConfig } from './';
|
||||||
import { IPublicModelSettingTarget } from '../model';
|
import { IPublicModelNode, IPublicModelSettingField } from '../model';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 高级特性配置
|
* 高级特性配置
|
||||||
@ -17,7 +17,7 @@ export interface IPublicTypeAdvanced {
|
|||||||
/**
|
/**
|
||||||
* 拖入容器时,自动带入 children 列表
|
* 拖入容器时,自动带入 children 列表
|
||||||
*/
|
*/
|
||||||
initialChildren?: IPublicTypeNodeData[] | ((target: IPublicModelSettingTarget) => IPublicTypeNodeData[]);
|
initialChildren?: IPublicTypeNodeData[] | ((target: IPublicModelNode) => IPublicTypeNodeData[]);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 样式 及 位置,handle 上必须有明确的标识以便事件路由判断,或者主动设置事件独占模式
|
* 样式 及 位置,handle 上必须有明确的标识以便事件路由判断,或者主动设置事件独占模式
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
import { IPublicModelSettingTarget } from '../model/setting-target';
|
import { IPublicModelSettingField } from '../model';
|
||||||
|
|
||||||
export type IPublicTypeDynamicProps = (target: IPublicModelSettingTarget) => Record<string, unknown>;
|
export type IPublicTypeDynamicProps = (target: IPublicModelSettingField) => Record<string, unknown>;
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { IPublicModelSettingPropEntry, IPublicModelSettingTarget } from '../model';
|
import { IPublicModelSettingField } from '../model';
|
||||||
import { IPublicTypeLiveTextEditingConfig } from './';
|
import { IPublicTypeLiveTextEditingConfig } from './';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -19,28 +19,28 @@ export interface IPublicTypeFieldExtraProps {
|
|||||||
/**
|
/**
|
||||||
* get value for field
|
* get value for field
|
||||||
*/
|
*/
|
||||||
getValue?: (target: IPublicModelSettingPropEntry, fieldValue: any) => any;
|
getValue?: (target: IPublicModelSettingField, fieldValue: any) => any;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set value for field
|
* set value for field
|
||||||
*/
|
*/
|
||||||
setValue?: (target: IPublicModelSettingPropEntry, value: any) => void;
|
setValue?: (target: IPublicModelSettingField, value: any) => void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the field conditional show, is not set always true
|
* the field conditional show, is not set always true
|
||||||
* @default undefined
|
* @default undefined
|
||||||
*/
|
*/
|
||||||
condition?: (target: IPublicModelSettingPropEntry) => boolean;
|
condition?: (target: IPublicModelSettingField) => boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* autorun when something change
|
* autorun when something change
|
||||||
*/
|
*/
|
||||||
autorun?: (target: IPublicModelSettingTarget) => void;
|
autorun?: (target: IPublicModelSettingField) => void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* is this field is a virtual field that not save to schema
|
* is this field is a virtual field that not save to schema
|
||||||
*/
|
*/
|
||||||
virtual?: (target: IPublicModelSettingTarget) => boolean;
|
virtual?: (target: IPublicModelSettingField) => boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* default collapsed when display accordion
|
* default collapsed when display accordion
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { IPublicTypePropType, IPublicTypeComponentAction } from './';
|
import { IPublicTypePropType, IPublicTypeComponentAction } from './';
|
||||||
import { IPublicModelNode, IPublicModelProp, IPublicModelSettingTarget } from '../model';
|
import { IPublicModelNode, IPublicModelProp, IPublicModelSettingField } from '../model';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 嵌套控制函数
|
* 嵌套控制函数
|
||||||
@ -93,11 +93,11 @@ export interface IPublicTypeComponentConfigure {
|
|||||||
|
|
||||||
export interface IPublicTypeInitialItem {
|
export interface IPublicTypeInitialItem {
|
||||||
name: string;
|
name: string;
|
||||||
initial: (target: IPublicModelSettingTarget, currentValue: any) => any;
|
initial: (target: IPublicModelSettingField, currentValue: any) => any;
|
||||||
}
|
}
|
||||||
export interface IPublicTypeFilterItem {
|
export interface IPublicTypeFilterItem {
|
||||||
name: string;
|
name: string;
|
||||||
filter: (target: IPublicModelSettingTarget | null, currentValue: any) => any;
|
filter: (target: IPublicModelSettingField | null, currentValue: any) => any;
|
||||||
}
|
}
|
||||||
export interface IPublicTypeAutorunItem {
|
export interface IPublicTypeAutorunItem {
|
||||||
name: string;
|
name: string;
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
import { IPublicModelSettingTarget } from '../model/setting-target';
|
import { IPublicTypeCustomView, IPublicTypeCompositeValue, IPublicTypeTitleContent, IPublicModelSettingField } from '..';
|
||||||
import { IPublicTypeCustomView, IPublicTypeCompositeValue, IPublicTypeTitleContent } from '..';
|
|
||||||
import { IPublicTypeDynamicProps } from './dynamic-props';
|
import { IPublicTypeDynamicProps } from './dynamic-props';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -37,7 +36,7 @@ export interface IPublicTypeSetterConfig {
|
|||||||
*
|
*
|
||||||
* @todo initialValue 可能要和 defaultValue 二选一
|
* @todo initialValue 可能要和 defaultValue 二选一
|
||||||
*/
|
*/
|
||||||
initialValue?: any | ((target: IPublicModelSettingTarget) => any);
|
initialValue?: any | ((target: IPublicModelSettingField) => any);
|
||||||
|
|
||||||
defaultValue?: any;
|
defaultValue?: any;
|
||||||
|
|
||||||
@ -51,7 +50,7 @@ export interface IPublicTypeSetterConfig {
|
|||||||
/**
|
/**
|
||||||
* 给 MixedSetter 用于判断优先选中哪个
|
* 给 MixedSetter 用于判断优先选中哪个
|
||||||
*/
|
*/
|
||||||
condition?: (target: IPublicModelSettingTarget) => boolean;
|
condition?: (target: IPublicModelSettingField) => boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 给 MixedSetter,切换值时声明类型
|
* 给 MixedSetter,切换值时声明类型
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user