mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-14 13:03:07 +00:00
docs: add doc for api/model/component-meta
This commit is contained in:
parent
b754e61bf8
commit
83562989d5
@ -62,7 +62,7 @@ createLocation(locationData: IPublicTypeLocationData): IPublicModelDropLocation;
|
|||||||
```typescript
|
```typescript
|
||||||
/**
|
/**
|
||||||
* 创建一个滚动控制器 Scroller,赋予一个视图滚动的基本能力,
|
* 创建一个滚动控制器 Scroller,赋予一个视图滚动的基本能力,
|
||||||
* a Scroller is a controller that gives a view (IPublicModelScrollable) the ability scrolling
|
* a Scroller is a controller that gives a view (IPublicTypeScrollable) the ability scrolling
|
||||||
* to some cordination by api scrollTo.
|
* to some cordination by api scrollTo.
|
||||||
*
|
*
|
||||||
* when a scroller is inited, will need to pass is a scrollable, which has a scrollTarget.
|
* when a scroller is inited, will need to pass is a scrollable, which has a scrollTarget.
|
||||||
@ -70,7 +70,7 @@ createLocation(locationData: IPublicTypeLocationData): IPublicModelDropLocation;
|
|||||||
* move scrollTarget`s top-left corner to (options.left, options.top) that passed in.
|
* move scrollTarget`s top-left corner to (options.left, options.top) that passed in.
|
||||||
* @since v1.1.0
|
* @since v1.1.0
|
||||||
*/
|
*/
|
||||||
createScroller(scrollable: IPublicModelScrollable): IPublicModelScroller;
|
createScroller(scrollable: IPublicTypeScrollable): IPublicModelScroller;
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
173
docs/docs/api/model/component-meta.md
Normal file
173
docs/docs/api/model/component-meta.md
Normal file
@ -0,0 +1,173 @@
|
|||||||
|
---
|
||||||
|
title: ComponentMeta
|
||||||
|
sidebar_position: 15
|
||||||
|
---
|
||||||
|
|
||||||
|
> **@types** [IPublicModelComponentMeta](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/component-meta.ts)<br/>
|
||||||
|
> **@since** v1.0.0
|
||||||
|
|
||||||
|
## 基本介绍
|
||||||
|
|
||||||
|
组件元数据信息模型
|
||||||
|
|
||||||
|
## 属性
|
||||||
|
|
||||||
|
### componentName
|
||||||
|
|
||||||
|
组件名
|
||||||
|
|
||||||
|
`@type {string}`
|
||||||
|
|
||||||
|
### isContainer
|
||||||
|
|
||||||
|
是否是「容器型」组件
|
||||||
|
|
||||||
|
`@type {boolean}`
|
||||||
|
|
||||||
|
### isMinimalRenderUnit
|
||||||
|
是否是最小渲染单元
|
||||||
|
|
||||||
|
当组件需要重新渲染时:
|
||||||
|
- 若为最小渲染单元,则只渲染当前组件,
|
||||||
|
- 若不为最小渲染单元,则寻找到上层最近的最小渲染单元进行重新渲染,直至根节点。
|
||||||
|
|
||||||
|
`@type {boolean}`
|
||||||
|
|
||||||
|
### isModal
|
||||||
|
|
||||||
|
是否为「模态框」组件
|
||||||
|
|
||||||
|
`@type {boolean}`
|
||||||
|
|
||||||
|
### configure
|
||||||
|
|
||||||
|
获取用于设置面板显示用的配置
|
||||||
|
|
||||||
|
`@type {IPublicTypeFieldConfig[]}`
|
||||||
|
|
||||||
|
相关类型:[IPublicTypeFieldConfig](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/field-config.ts)
|
||||||
|
|
||||||
|
### title
|
||||||
|
|
||||||
|
标题
|
||||||
|
|
||||||
|
`@type {string | IPublicTypeI18nData | ReactElement}`
|
||||||
|
|
||||||
|
相关类型:[IPublicTypeI18nData](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/i18n-data.ts)
|
||||||
|
|
||||||
|
### icon
|
||||||
|
|
||||||
|
图标
|
||||||
|
|
||||||
|
`@type {IPublicTypeIconType}`
|
||||||
|
|
||||||
|
相关类型:[IPublicTypeIconType](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/icon-type.ts)
|
||||||
|
|
||||||
|
### npm
|
||||||
|
|
||||||
|
组件 npm 信息
|
||||||
|
|
||||||
|
`@type {IPublicTypeNpmInfo}`
|
||||||
|
|
||||||
|
相关类型:[IPublicTypeNpmInfo](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/npm-info.ts)
|
||||||
|
|
||||||
|
### availableActions
|
||||||
|
|
||||||
|
获取元数据
|
||||||
|
|
||||||
|
`@type {IPublicTypeTransformedComponentMetadata}`
|
||||||
|
|
||||||
|
相关类型:[IPublicTypeTransformedComponentMetadata](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/transformed-component-metadata.ts)
|
||||||
|
|
||||||
|
### advanced
|
||||||
|
|
||||||
|
组件元数据中高级配置部分
|
||||||
|
|
||||||
|
`@type {IPublicTypeAdvanced}`
|
||||||
|
|
||||||
|
相关类型:[IPublicTypeAdvanced](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/advanced.ts)
|
||||||
|
|
||||||
|
## 方法
|
||||||
|
|
||||||
|
### setNpm
|
||||||
|
|
||||||
|
设置 npm 信息
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
/**
|
||||||
|
* 设置 npm 信息
|
||||||
|
* set method for npm inforamtion
|
||||||
|
* @param npm
|
||||||
|
*/
|
||||||
|
setNpm(npm: IPublicTypeNpmInfo): void;
|
||||||
|
```
|
||||||
|
|
||||||
|
相关类型:[IPublicTypeNpmInfo](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/npm-info.ts)
|
||||||
|
|
||||||
|
### getMetadata
|
||||||
|
|
||||||
|
获取元数据
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
/**
|
||||||
|
* 获取元数据
|
||||||
|
* get component metadata
|
||||||
|
*/
|
||||||
|
getMetadata(): IPublicTypeTransformedComponentMetadata;
|
||||||
|
```
|
||||||
|
|
||||||
|
相关类型:[IPublicTypeTransformedComponentMetadata](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/transformed-component-metadata.ts)
|
||||||
|
|
||||||
|
### checkNestingUp
|
||||||
|
|
||||||
|
检测当前对应节点是否可被放置在父节点中
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
/**
|
||||||
|
* 检测当前对应节点是否可被放置在父节点中
|
||||||
|
* check if the current node could be placed in parent node
|
||||||
|
* @param my 当前节点
|
||||||
|
* @param parent 父节点
|
||||||
|
*/
|
||||||
|
checkNestingUp(my: IPublicModelNode | IPublicTypeNodeData, parent: any): boolean;
|
||||||
|
```
|
||||||
|
|
||||||
|
相关类型:
|
||||||
|
- [IPublicModelNode](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts)
|
||||||
|
- [IPublicTypeNodeData](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/node-data.ts)
|
||||||
|
|
||||||
|
|
||||||
|
### checkNestingDown
|
||||||
|
|
||||||
|
检测目标节点是否可被放置在父节点中
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
/**
|
||||||
|
* 检测目标节点是否可被放置在父节点中
|
||||||
|
* check if the target node(s) could be placed in current node
|
||||||
|
* @param my 当前节点
|
||||||
|
* @param parent 父节点
|
||||||
|
*/
|
||||||
|
checkNestingDown(
|
||||||
|
my: IPublicModelNode | IPublicTypeNodeData,
|
||||||
|
target: IPublicTypeNodeSchema | IPublicModelNode | IPublicTypeNodeSchema[],
|
||||||
|
): boolean;
|
||||||
|
```
|
||||||
|
|
||||||
|
相关类型:
|
||||||
|
- [IPublicModelNode](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts)
|
||||||
|
- [IPublicTypeNodeData](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/node-data.ts)
|
||||||
|
- [IPublicTypeNodeSchema](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/node-schema.ts)
|
||||||
|
|
||||||
|
|
||||||
|
### refreshMetadata
|
||||||
|
|
||||||
|
刷新元数据,会触发元数据的重新解析和刷新
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
/**
|
||||||
|
* 刷新元数据,会触发元数据的重新解析和刷新
|
||||||
|
* refresh metadata
|
||||||
|
*/
|
||||||
|
refreshMetadata(): void;
|
||||||
|
```
|
||||||
@ -4,7 +4,7 @@ sidebar_position: 13
|
|||||||
---
|
---
|
||||||
|
|
||||||
> **[@experimental](./#experimental)**<br/>
|
> **[@experimental](./#experimental)**<br/>
|
||||||
> **@types** [IPublicModelWindow](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/resource.ts)<br/>
|
> **@types** [IPublicModelResource](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/resource.ts)<br/>
|
||||||
> **@since** v1.1.0
|
> **@since** v1.1.0
|
||||||
|
|
||||||
## 属性
|
## 属性
|
||||||
@ -43,4 +43,4 @@ sidebar_position: 13
|
|||||||
|
|
||||||
资源配置信息
|
资源配置信息
|
||||||
|
|
||||||
`@type {Object}`
|
`@type {Object}`
|
||||||
|
|||||||
@ -110,7 +110,7 @@ export class ComponentMeta implements IComponentMeta {
|
|||||||
|
|
||||||
private _transformedMetadata?: IPublicTypeTransformedComponentMetadata;
|
private _transformedMetadata?: IPublicTypeTransformedComponentMetadata;
|
||||||
|
|
||||||
get configure() {
|
get configure(): IPublicTypeFieldConfig[] {
|
||||||
const config = this._transformedMetadata?.configure;
|
const config = this._transformedMetadata?.configure;
|
||||||
return config?.combined || config?.props || [];
|
return config?.combined || config?.props || [];
|
||||||
}
|
}
|
||||||
@ -272,8 +272,11 @@ export class ComponentMeta implements IComponentMeta {
|
|||||||
this.parseMetadata(this.getMetadata());
|
this.parseMetadata(this.getMetadata());
|
||||||
}
|
}
|
||||||
|
|
||||||
private transformMetadata(metadta: IPublicTypeComponentMetadata): IPublicTypeTransformedComponentMetadata {
|
private transformMetadata(
|
||||||
const result = this.designer.componentActions.getRegisteredMetadataTransducers().reduce((prevMetadata, current) => {
|
metadta: IPublicTypeComponentMetadata,
|
||||||
|
): IPublicTypeTransformedComponentMetadata {
|
||||||
|
const registeredTransducers = this.designer.componentActions.getRegisteredMetadataTransducers();
|
||||||
|
const result = registeredTransducers.reduce((prevMetadata, current) => {
|
||||||
return current(prevMetadata);
|
return current(prevMetadata);
|
||||||
}, preprocessMetadata(metadta));
|
}, preprocessMetadata(metadta));
|
||||||
|
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import {
|
|||||||
IPublicTypePropsTransducer,
|
IPublicTypePropsTransducer,
|
||||||
IShellModelFactory,
|
IShellModelFactory,
|
||||||
IPublicModelDragObject,
|
IPublicModelDragObject,
|
||||||
IPublicModelScrollable,
|
IPublicTypeScrollable,
|
||||||
IPublicModelScroller,
|
IPublicModelScroller,
|
||||||
IPublicTypeLocationData,
|
IPublicTypeLocationData,
|
||||||
IPublicEnumTransformStage,
|
IPublicEnumTransformStage,
|
||||||
@ -70,7 +70,7 @@ export interface IDesigner {
|
|||||||
|
|
||||||
get editor(): IPublicModelEditor;
|
get editor(): IPublicModelEditor;
|
||||||
|
|
||||||
createScroller(scrollable: IPublicModelScrollable): IPublicModelScroller;
|
createScroller(scrollable: IPublicTypeScrollable): IPublicModelScroller;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建插入位置,考虑放到 dragon 中
|
* 创建插入位置,考虑放到 dragon 中
|
||||||
@ -302,7 +302,7 @@ export class Designer implements IDesigner {
|
|||||||
this._dropLocation = undefined;
|
this._dropLocation = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
createScroller(scrollable: IPublicModelScrollable): IPublicModelScroller {
|
createScroller(scrollable: IPublicTypeScrollable): IPublicModelScroller {
|
||||||
return new Scroller(scrollable);
|
return new Scroller(scrollable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { isElement } from '@alilc/lowcode-utils';
|
import { isElement } from '@alilc/lowcode-utils';
|
||||||
import { IPublicModelScrollTarget, IPublicModelScrollable, IPublicModelScroller } from '@alilc/lowcode-types';
|
import { IPublicModelScrollTarget, IPublicTypeScrollable, IPublicModelScroller } from '@alilc/lowcode-types';
|
||||||
|
|
||||||
export interface IScrollTarget extends IPublicModelScrollTarget {
|
export interface IScrollTarget extends IPublicModelScrollTarget {
|
||||||
}
|
}
|
||||||
@ -13,6 +13,14 @@ export class ScrollTarget implements IScrollTarget {
|
|||||||
return 'scrollY' in this.target ? this.target.scrollY : this.target.scrollTop;
|
return 'scrollY' in this.target ? this.target.scrollY : this.target.scrollTop;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private doc?: HTMLElement;
|
||||||
|
|
||||||
|
constructor(private target: Window | Element) {
|
||||||
|
if (isWindow(target)) {
|
||||||
|
this.doc = target.document.documentElement;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
scrollTo(options: { left?: number; top?: number }) {
|
scrollTo(options: { left?: number; top?: number }) {
|
||||||
this.target.scrollTo(options);
|
this.target.scrollTo(options);
|
||||||
}
|
}
|
||||||
@ -28,14 +36,6 @@ export class ScrollTarget implements IScrollTarget {
|
|||||||
get scrollWidth(): number {
|
get scrollWidth(): number {
|
||||||
return ((this.doc || this.target) as any).scrollWidth;
|
return ((this.doc || this.target) as any).scrollWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
private doc?: HTMLElement;
|
|
||||||
|
|
||||||
constructor(private target: Window | Element) {
|
|
||||||
if (isWindow(target)) {
|
|
||||||
this.doc = target.document.documentElement;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function isWindow(obj: any): obj is Window {
|
function isWindow(obj: any): obj is Window {
|
||||||
@ -53,9 +53,9 @@ export interface IScroller extends IPublicModelScroller {
|
|||||||
}
|
}
|
||||||
export class Scroller implements IScroller {
|
export class Scroller implements IScroller {
|
||||||
private pid: number | undefined;
|
private pid: number | undefined;
|
||||||
scrollable: IPublicModelScrollable;
|
scrollable: IPublicTypeScrollable;
|
||||||
|
|
||||||
constructor(scrollable: IPublicModelScrollable) {
|
constructor(scrollable: IPublicTypeScrollable) {
|
||||||
this.scrollable = scrollable;
|
this.scrollable = scrollable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { ComponentType } from 'react';
|
import { ComponentType } from 'react';
|
||||||
import { IPublicTypeComponentMetadata, IPublicTypeNodeSchema, IPublicModelScrollable, IPublicTypeComponentInstance, IPublicModelSensor, IPublicTypeNodeInstance } from '@alilc/lowcode-types';
|
import { IPublicTypeComponentMetadata, IPublicTypeNodeSchema, IPublicTypeScrollable, IPublicTypeComponentInstance, IPublicModelSensor, IPublicTypeNodeInstance } from '@alilc/lowcode-types';
|
||||||
import { Point, ScrollTarget, ILocateEvent } from './designer';
|
import { Point, ScrollTarget, ILocateEvent } from './designer';
|
||||||
import { BuiltinSimulatorRenderer } from './builtin-simulator/renderer';
|
import { BuiltinSimulatorRenderer } from './builtin-simulator/renderer';
|
||||||
import { Node, INode } from './document';
|
import { Node, INode } from './document';
|
||||||
@ -8,7 +8,7 @@ export type AutoFit = '100%';
|
|||||||
// eslint-disable-next-line no-redeclare
|
// eslint-disable-next-line no-redeclare
|
||||||
export const AutoFit = '100%';
|
export const AutoFit = '100%';
|
||||||
|
|
||||||
export interface IScrollable extends IPublicModelScrollable {
|
export interface IScrollable extends IPublicTypeScrollable {
|
||||||
}
|
}
|
||||||
export interface IViewport extends IScrollable {
|
export interface IViewport extends IScrollable {
|
||||||
|
|
||||||
|
|||||||
@ -8,7 +8,7 @@ import {
|
|||||||
} from '@alilc/lowcode-utils';
|
} from '@alilc/lowcode-utils';
|
||||||
import {
|
import {
|
||||||
IPublicModelDragObject,
|
IPublicModelDragObject,
|
||||||
IPublicModelScrollable,
|
IPublicTypeScrollable,
|
||||||
IPublicModelSensor,
|
IPublicModelSensor,
|
||||||
IPublicTypeLocationChildrenDetail,
|
IPublicTypeLocationChildrenDetail,
|
||||||
IPublicTypeLocationDetailType,
|
IPublicTypeLocationDetailType,
|
||||||
@ -24,7 +24,7 @@ import { IndentTrack } from '../helper/indent-track';
|
|||||||
import DwellTimer from '../helper/dwell-timer';
|
import DwellTimer from '../helper/dwell-timer';
|
||||||
import { ITreeBoard, TreeMaster } from './tree-master';
|
import { ITreeBoard, TreeMaster } from './tree-master';
|
||||||
|
|
||||||
export class PaneController implements IPublicModelSensor, ITreeBoard, IPublicModelScrollable {
|
export class PaneController implements IPublicModelSensor, ITreeBoard, IPublicTypeScrollable {
|
||||||
private pluginContext: IPublicModelPluginContext;
|
private pluginContext: IPublicModelPluginContext;
|
||||||
|
|
||||||
private treeMaster?: TreeMaster;
|
private treeMaster?: TreeMaster;
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import {
|
|||||||
IPublicApiCanvas,
|
IPublicApiCanvas,
|
||||||
IPublicModelDropLocation,
|
IPublicModelDropLocation,
|
||||||
IPublicModelScrollTarget,
|
IPublicModelScrollTarget,
|
||||||
IPublicModelScrollable,
|
IPublicTypeScrollable,
|
||||||
IPublicModelScroller,
|
IPublicModelScroller,
|
||||||
IPublicTypeLocationData,
|
IPublicTypeLocationData,
|
||||||
IPublicModelEditor,
|
IPublicModelEditor,
|
||||||
@ -58,7 +58,7 @@ export class Canvas implements IPublicApiCanvas {
|
|||||||
return new InnerScrollTarget(shell);
|
return new InnerScrollTarget(shell);
|
||||||
}
|
}
|
||||||
|
|
||||||
createScroller(scrollable: IPublicModelScrollable): IPublicModelScroller {
|
createScroller(scrollable: IPublicTypeScrollable): IPublicModelScroller {
|
||||||
return this[designerSymbol].createScroller(scrollable);
|
return this[designerSymbol].createScroller(scrollable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,4 +78,4 @@ export class Canvas implements IPublicApiCanvas {
|
|||||||
get dropLocation() {
|
get dropLocation() {
|
||||||
return ShellDropLocation.create((this[designerSymbol] as any).dropLocation || null);
|
return ShellDropLocation.create((this[designerSymbol] as any).dropLocation || null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import {
|
|||||||
IComponentMeta as InnerComponentMeta,
|
IComponentMeta as InnerComponentMeta,
|
||||||
INode,
|
INode,
|
||||||
} from '@alilc/lowcode-designer';
|
} from '@alilc/lowcode-designer';
|
||||||
import { IPublicTypeNodeData, IPublicTypeNodeSchema, IPublicModelComponentMeta, IPublicTypeI18nData, IPublicTypeIconType, IPublicTypeNpmInfo, IPublicTypeTransformedComponentMetadata, IPublicModelNode, IPublicTypeAdvanced } from '@alilc/lowcode-types';
|
import { IPublicTypeNodeData, IPublicTypeNodeSchema, IPublicModelComponentMeta, IPublicTypeI18nData, IPublicTypeIconType, IPublicTypeNpmInfo, IPublicTypeTransformedComponentMetadata, IPublicModelNode, IPublicTypeAdvanced, IPublicTypeFieldConfig } from '@alilc/lowcode-types';
|
||||||
import { componentMetaSymbol, nodeSymbol } from '../symbols';
|
import { componentMetaSymbol, nodeSymbol } from '../symbols';
|
||||||
import { ReactElement } from 'react';
|
import { ReactElement } from 'react';
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ export class ComponentMeta implements IPublicModelComponentMeta {
|
|||||||
/**
|
/**
|
||||||
* 元数据配置
|
* 元数据配置
|
||||||
*/
|
*/
|
||||||
get configure(): any {
|
get configure(): IPublicTypeFieldConfig[] {
|
||||||
return this[componentMetaSymbol].configure;
|
return this[componentMetaSymbol].configure;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { IPublicModelDragon, IPublicModelDropLocation, IPublicModelScrollTarget, IPublicModelScrollable, IPublicModelScroller, IPublicModelActiveTracker, IPublicModelClipboard } from '../model';
|
import { IPublicModelDragon, IPublicModelDropLocation, IPublicModelScrollTarget, IPublicTypeScrollable, IPublicModelScroller, IPublicModelActiveTracker, IPublicModelClipboard } from '../model';
|
||||||
import { IPublicTypeLocationData } from '../type';
|
import { IPublicTypeLocationData } from '../type';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -8,7 +8,7 @@ export interface IPublicApiCanvas {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 创一个滚动控制器 Scroller,赋予一个视图滚动的基本能力,
|
* 创一个滚动控制器 Scroller,赋予一个视图滚动的基本能力,
|
||||||
* a Scroller is a controller that gives a view (IPublicModelScrollable) the ability scrolling
|
* a Scroller is a controller that gives a view (IPublicTypeScrollable) the ability scrolling
|
||||||
* to some cordination by api scrollTo.
|
* to some cordination by api scrollTo.
|
||||||
*
|
*
|
||||||
* when a scroller is inited, will need to pass is a scrollable, which has a scrollTarget.
|
* when a scroller is inited, will need to pass is a scrollable, which has a scrollTarget.
|
||||||
@ -16,7 +16,7 @@ export interface IPublicApiCanvas {
|
|||||||
* move scrollTarget`s top-left corner to (options.left, options.top) that passed in.
|
* move scrollTarget`s top-left corner to (options.left, options.top) that passed in.
|
||||||
* @since v1.1.0
|
* @since v1.1.0
|
||||||
*/
|
*/
|
||||||
createScroller(scrollable: IPublicModelScrollable): IPublicModelScroller;
|
createScroller(scrollable: IPublicTypeScrollable): IPublicModelScroller;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建一个 ScrollTarget,与 Scroller 一起发挥作用,详见 createScroller 中的描述
|
* 创建一个 ScrollTarget,与 Scroller 一起发挥作用,详见 createScroller 中的描述
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { IPublicTypeNodeSchema, IPublicTypeNodeData, IPublicTypeIconType, IPublicTypeTransformedComponentMetadata, IPublicTypeI18nData, IPublicTypeNpmInfo, IPublicTypeAdvanced } from '../type';
|
import { IPublicTypeNodeSchema, IPublicTypeNodeData, IPublicTypeIconType, IPublicTypeTransformedComponentMetadata, IPublicTypeI18nData, IPublicTypeNpmInfo, IPublicTypeAdvanced, IPublicTypeFieldConfig, IPublicTypeComponentAction } from '../type';
|
||||||
import { ReactElement } from 'react';
|
import { ReactElement } from 'react';
|
||||||
import { IPublicModelNode } from './node';
|
import { IPublicModelNode } from './node';
|
||||||
|
|
||||||
@ -6,11 +6,13 @@ export interface IPublicModelComponentMeta {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 组件名
|
* 组件名
|
||||||
|
* component name
|
||||||
*/
|
*/
|
||||||
get componentName(): string;
|
get componentName(): string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否是「容器型」组件
|
* 是否是「容器型」组件
|
||||||
|
* is container node or not
|
||||||
*/
|
*/
|
||||||
get isContainer(): boolean;
|
get isContainer(): boolean;
|
||||||
|
|
||||||
@ -19,37 +21,53 @@ export interface IPublicModelComponentMeta {
|
|||||||
* 当组件需要重新渲染时:
|
* 当组件需要重新渲染时:
|
||||||
* 若为最小渲染单元,则只渲染当前组件,
|
* 若为最小渲染单元,则只渲染当前组件,
|
||||||
* 若不为最小渲染单元,则寻找到上层最近的最小渲染单元进行重新渲染,直至根节点。
|
* 若不为最小渲染单元,则寻找到上层最近的最小渲染单元进行重新渲染,直至根节点。
|
||||||
|
*
|
||||||
|
* check if this is a mininal render unit.
|
||||||
|
* when a rerender is needed for a component:
|
||||||
|
* case 'it`s a mininal render unit': only render itself.
|
||||||
|
* case 'it`s not a mininal render unit': find a mininal render unit to render in
|
||||||
|
* its ancesters until root node is reached.
|
||||||
*/
|
*/
|
||||||
get isMinimalRenderUnit(): boolean;
|
get isMinimalRenderUnit(): boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否为「模态框」组件
|
* 是否为「模态框」组件
|
||||||
|
* check if this is a modal component or not.
|
||||||
*/
|
*/
|
||||||
get isModal(): boolean;
|
get isModal(): boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 元数据配置
|
* 获取用于设置面板显示用的配置
|
||||||
|
* get configs for Settings Panel
|
||||||
*/
|
*/
|
||||||
get configure(): any;
|
get configure(): IPublicTypeFieldConfig[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 标题
|
* 标题
|
||||||
|
* title for this component
|
||||||
*/
|
*/
|
||||||
get title(): string | IPublicTypeI18nData | ReactElement;
|
get title(): string | IPublicTypeI18nData | ReactElement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 图标
|
* 图标
|
||||||
|
* icon config for this component
|
||||||
*/
|
*/
|
||||||
get icon(): IPublicTypeIconType;
|
get icon(): IPublicTypeIconType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 组件 npm 信息
|
* 组件 npm 信息
|
||||||
|
* npm informations
|
||||||
*/
|
*/
|
||||||
get npm(): IPublicTypeNpmInfo;
|
get npm(): IPublicTypeNpmInfo;
|
||||||
|
|
||||||
get availableActions(): any;
|
/**
|
||||||
|
* 当前组件的可用 Action
|
||||||
|
* available actions
|
||||||
|
*/
|
||||||
|
get availableActions(): IPublicTypeComponentAction[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 组件元数据中高级配置部分
|
||||||
* configure.advanced
|
* configure.advanced
|
||||||
* @since v1.1.0
|
* @since v1.1.0
|
||||||
*/
|
*/
|
||||||
@ -57,34 +75,39 @@ export interface IPublicModelComponentMeta {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置 npm 信息
|
* 设置 npm 信息
|
||||||
|
* set method for npm inforamtion
|
||||||
* @param npm
|
* @param npm
|
||||||
*/
|
*/
|
||||||
setNpm(npm: IPublicTypeNpmInfo): void;
|
setNpm(npm: IPublicTypeNpmInfo): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取元数据
|
* 获取元数据
|
||||||
* @returns
|
* get component metadata
|
||||||
*/
|
*/
|
||||||
getMetadata(): IPublicTypeTransformedComponentMetadata;
|
getMetadata(): IPublicTypeTransformedComponentMetadata;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 检测当前对应节点是否可被放置在父节点中
|
||||||
* check if the current node could be placed in parent node
|
* check if the current node could be placed in parent node
|
||||||
* @param my
|
* @param my 当前节点
|
||||||
* @param parent
|
* @param parent 父节点
|
||||||
* @returns
|
|
||||||
*/
|
*/
|
||||||
checkNestingUp(my: IPublicModelNode | IPublicTypeNodeData, parent: any): boolean;
|
checkNestingUp(my: IPublicModelNode | IPublicTypeNodeData, parent: any): boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 检测目标节点是否可被放置在父节点中
|
||||||
* check if the target node(s) could be placed in current node
|
* check if the target node(s) could be placed in current node
|
||||||
* @param my
|
* @param my 当前节点
|
||||||
* @param parent
|
* @param parent 父节点
|
||||||
* @returns
|
|
||||||
*/
|
*/
|
||||||
checkNestingDown(
|
checkNestingDown(
|
||||||
my: IPublicModelNode | IPublicTypeNodeData,
|
my: IPublicModelNode | IPublicTypeNodeData,
|
||||||
target: IPublicTypeNodeSchema | IPublicModelNode | IPublicTypeNodeSchema[],
|
target: IPublicTypeNodeSchema | IPublicModelNode | IPublicTypeNodeSchema[],
|
||||||
): boolean;
|
): boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 刷新元数据,会触发元数据的重新解析和刷新
|
||||||
|
* refresh metadata
|
||||||
|
*/
|
||||||
refreshMetadata(): void;
|
refreshMetadata(): void;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import { IPublicTypeDragNodeDataObject, IPublicTypeDragObject } from '../type';
|
|||||||
import { IPublicModelDragObject, IPublicModelLocateEvent, IPublicModelNode } from './';
|
import { IPublicModelDragObject, IPublicModelLocateEvent, IPublicModelNode } from './';
|
||||||
|
|
||||||
export interface IPublicModelDragon {
|
export interface IPublicModelDragon {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否正在拖动
|
* 是否正在拖动
|
||||||
* is dragging or not
|
* is dragging or not
|
||||||
@ -33,7 +34,6 @@ export interface IPublicModelDragon {
|
|||||||
*/
|
*/
|
||||||
onDragend(func: (o: { dragObject: IPublicModelDragObject; copy?: boolean }) => any): () => void;
|
onDragend(func: (o: { dragObject: IPublicModelDragObject; copy?: boolean }) => any): () => void;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置拖拽监听的区域 shell,以及自定义拖拽转换函数 boost
|
* 设置拖拽监听的区域 shell,以及自定义拖拽转换函数 boost
|
||||||
* set a html element as shell to dragon as monitoring target, and
|
* set a html element as shell to dragon as monitoring target, and
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { IPublicModelPreference } from './';
|
import { IPublicModelPreference } from './';
|
||||||
|
|
||||||
|
|
||||||
export interface IPublicModelEngineConfig {
|
export interface IPublicModelEngineConfig {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 判断指定 key 是否有值
|
* 判断指定 key 是否有值
|
||||||
* check if config has certain key configed
|
* check if config has certain key configed
|
||||||
|
|||||||
@ -18,7 +18,6 @@ export * from '../type/plugin';
|
|||||||
export * from './window';
|
export * from './window';
|
||||||
export * from './scroll-target';
|
export * from './scroll-target';
|
||||||
export * from './scroller';
|
export * from './scroller';
|
||||||
export * from './scrollable';
|
|
||||||
export * from './active-tracker';
|
export * from './active-tracker';
|
||||||
export * from './exclusive-group';
|
export * from './exclusive-group';
|
||||||
export * from './plugin-context';
|
export * from './plugin-context';
|
||||||
@ -29,4 +28,4 @@ export * from './preference';
|
|||||||
export * from './plugin-instance';
|
export * from './plugin-instance';
|
||||||
export * from './sensor';
|
export * from './sensor';
|
||||||
export * from './resource';
|
export * from './resource';
|
||||||
export * from './clipboard';
|
export * from './clipboard';
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import { IPublicEnumTransformStage } from '../enum';
|
|||||||
import { IPublicModelNode } from './';
|
import { IPublicModelNode } from './';
|
||||||
|
|
||||||
export interface IPublicModelNodeChildren {
|
export interface IPublicModelNodeChildren {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 返回当前 children 实例所属的节点实例
|
* 返回当前 children 实例所属的节点实例
|
||||||
* get owner node of this nodeChildren
|
* get owner node of this nodeChildren
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
|
|
||||||
export interface IPublicModelPreference {
|
export interface IPublicModelPreference {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set value from local storage by module and key
|
* set value from local storage by module and key
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
import { IPublicTypeCustomView, IPublicTypeCompositeValue, IPublicTypeSetterType, IPublicTypeSetValueOptions, IPublicTypeFieldConfig, IPublicTypeFieldExtraProps } from '../type';
|
import { IPublicTypeCustomView, IPublicTypeCompositeValue, IPublicTypeSetterType, IPublicTypeSetValueOptions, IPublicTypeFieldConfig, IPublicTypeFieldExtraProps } from '../type';
|
||||||
import { IPublicModelNode, IPublicModelComponentMeta, IPublicModelSettingTopEntry } from './';
|
import { IPublicModelNode, IPublicModelComponentMeta, IPublicModelSettingTopEntry } from './';
|
||||||
|
|
||||||
|
|
||||||
export interface IPublicModelSettingPropEntry {
|
export interface IPublicModelSettingPropEntry {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取设置属性的 isGroup
|
* 获取设置属性的 isGroup
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import { IPublicModelNode, IPublicModelSettingPropEntry } from './';
|
import { IPublicModelNode, IPublicModelSettingPropEntry } from './';
|
||||||
|
|
||||||
export interface IPublicModelSettingTopEntry {
|
export interface IPublicModelSettingTopEntry {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 返回所属的节点实例
|
* 返回所属的节点实例
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -6,23 +6,28 @@ import { IPublicTypeActionContentObject } from './';
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
export interface IPublicTypeComponentAction {
|
export interface IPublicTypeComponentAction {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* behaviorName
|
* behaviorName
|
||||||
*/
|
*/
|
||||||
name: string;
|
name: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 菜单名称
|
* 菜单名称
|
||||||
*/
|
*/
|
||||||
content: string | ReactNode | IPublicTypeActionContentObject;
|
content: string | ReactNode | IPublicTypeActionContentObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 子集
|
* 子集
|
||||||
*/
|
*/
|
||||||
items?: IPublicTypeComponentAction[];
|
items?: IPublicTypeComponentAction[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 显示与否
|
* 显示与否
|
||||||
* always: 无法禁用
|
* always: 无法禁用
|
||||||
*/
|
*/
|
||||||
condition?: boolean | ((currentNode: any) => boolean) | 'always';
|
condition?: boolean | ((currentNode: any) => boolean) | 'always';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 显示在工具条上
|
* 显示在工具条上
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -4,38 +4,46 @@ import { IPublicTypeTitleContent, IPublicTypeSetterType, IPublicTypeFieldExtraPr
|
|||||||
* 属性面板配置
|
* 属性面板配置
|
||||||
*/
|
*/
|
||||||
export interface IPublicTypeFieldConfig extends IPublicTypeFieldExtraProps {
|
export interface IPublicTypeFieldConfig extends IPublicTypeFieldExtraProps {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 面板配置隶属于单个 field 还是分组
|
* 面板配置隶属于单个 field 还是分组
|
||||||
*/
|
*/
|
||||||
type?: 'field' | 'group';
|
type?: 'field' | 'group';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the name of this setting field, which used in quickEditor
|
* the name of this setting field, which used in quickEditor
|
||||||
*/
|
*/
|
||||||
name: string | number;
|
name: string | number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the field title
|
* the field title
|
||||||
* @default sameas .name
|
* @default sameas .name
|
||||||
*/
|
*/
|
||||||
title?: IPublicTypeTitleContent;
|
title?: IPublicTypeTitleContent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 单个属性的 setter 配置
|
* 单个属性的 setter 配置
|
||||||
*
|
*
|
||||||
* the field body contains when .type = 'field'
|
* the field body contains when .type = 'field'
|
||||||
*/
|
*/
|
||||||
setter?: IPublicTypeSetterType | IPublicTypeDynamicSetter;
|
setter?: IPublicTypeSetterType | IPublicTypeDynamicSetter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the setting items which group body contains when .type = 'group'
|
* the setting items which group body contains when .type = 'group'
|
||||||
*/
|
*/
|
||||||
items?: IPublicTypeFieldConfig[];
|
items?: IPublicTypeFieldConfig[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* extra props for field
|
* extra props for field
|
||||||
* 其他配置属性(不做流通要求)
|
* 其他配置属性(不做流通要求)
|
||||||
*/
|
*/
|
||||||
extraProps?: IPublicTypeFieldExtraProps;
|
extraProps?: IPublicTypeFieldExtraProps;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
description?: IPublicTypeTitleContent;
|
description?: IPublicTypeTitleContent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -88,4 +88,5 @@ export * from './resource-type';
|
|||||||
export * from './resource-type-config';
|
export * from './resource-type-config';
|
||||||
export * from './editor-view-config';
|
export * from './editor-view-config';
|
||||||
export * from './hotkey-callback-config';
|
export * from './hotkey-callback-config';
|
||||||
export * from './hotkey-callbacks';
|
export * from './hotkey-callbacks';
|
||||||
|
export * from './scrollable';
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { IPublicModelScrollTarget } from './';
|
import { IPublicModelScrollTarget } from '../model';
|
||||||
|
|
||||||
export interface IPublicModelScrollable {
|
export interface IPublicTypeScrollable {
|
||||||
scrollTarget?: IPublicModelScrollTarget | Element;
|
scrollTarget?: IPublicModelScrollTarget | Element;
|
||||||
bounds?: DOMRect | null;
|
bounds?: DOMRect | null;
|
||||||
scale?: number;
|
scale?: number;
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user