GeezerVison is showing github.com — docs: add doc for api/model/component-meta · li55/lowcode-engine@8356298
File treeExpand file treeCollapse file tree Open diff view settings plugin-outline-pane/src/controllers
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: docs/docs/api/canvas.md +2-2Lines changed: 2 additions & 2 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -62,15 +62,15 @@ createLocation(locationData: IPublicTypeLocationData): IPublicModelDropLocation; | 62 | 62 | ```typescript | 63 | 63 | /** | 64 | 64 | * 创建一个滚动控制器 Scroller,赋予一个视图滚动的基本能力, | 65 | | - * a Scroller is a controller that gives a view (IPublicModelScrollable) the ability scrolling | | 65 | + * a Scroller is a controller that gives a view (IPublicTypeScrollable) the ability scrolling | 66 | 66 | * to some cordination by api scrollTo. | 67 | 67 | * | 68 | 68 | * when a scroller is inited, will need to pass is a scrollable, which has a scrollTarget. | 69 | 69 | * and when scrollTo(options: { left?: number; top?: number }) is called, scroller will | 70 | 70 | * move scrollTarget`s top-left corner to (options.left, options.top) that passed in. | 71 | 71 | * @since v1.1.0 | 72 | 72 | */ | 73 | | -createScroller(scrollable: IPublicModelScrollable): IPublicModelScroller; | | 73 | +createScroller(scrollable: IPublicTypeScrollable): IPublicModelScroller; | 74 | 74 |
| 75 | 75 | ``` | 76 | 76 |
| |
Collapse file Copy file name to clipboard +173Lines changed: 173 additions & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +--- | | 2 | +title: ComponentMeta | | 3 | +sidebar_position: 15 | | 4 | +--- | | 5 | + | | 6 | +> **@types** [IPublicModelComponentMeta](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/component-meta.ts)<br/> | | 7 | +> **@since** v1.0.0 | | 8 | +
| | 9 | +## 基本介绍 | | 10 | + | | 11 | +组件元数据信息模型 | | 12 | + | | 13 | +## 属性 | | 14 | + | | 15 | +### componentName | | 16 | + | | 17 | +组件名 | | 18 | + | | 19 | +`@type {string}` | | 20 | + | | 21 | +### isContainer | | 22 | + | | 23 | +是否是「容器型」组件 | | 24 | + | | 25 | +`@type {boolean}` | | 26 | + | | 27 | +### isMinimalRenderUnit | | 28 | +是否是最小渲染单元 | | 29 | + | | 30 | +当组件需要重新渲染时: | | 31 | +- 若为最小渲染单元,则只渲染当前组件, | | 32 | +- 若不为最小渲染单元,则寻找到上层最近的最小渲染单元进行重新渲染,直至根节点。 | | 33 | + | | 34 | +`@type {boolean}` | | 35 | + | | 36 | +### isModal | | 37 | + | | 38 | +是否为「模态框」组件 | | 39 | + | | 40 | +`@type {boolean}` | | 41 | + | | 42 | +### configure | | 43 | + | | 44 | +获取用于设置面板显示用的配置 | | 45 | + | | 46 | +`@type {IPublicTypeFieldConfig[]}` | | 47 | + | | 48 | +相关类型:[IPublicTypeFieldConfig](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/field-config.ts) | | 49 | + | | 50 | +### title | | 51 | + | | 52 | +标题 | | 53 | + | | 54 | +`@type {string | IPublicTypeI18nData | ReactElement}` | | 55 | + | | 56 | +相关类型:[IPublicTypeI18nData](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/i18n-data.ts) | | 57 | + | | 58 | +### icon | | 59 | + | | 60 | +图标 | | 61 | + | | 62 | +`@type {IPublicTypeIconType}` | | 63 | + | | 64 | +相关类型:[IPublicTypeIconType](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/icon-type.ts) | | 65 | + | | 66 | +### npm | | 67 | + | | 68 | +组件 npm 信息 | | 69 | + | | 70 | +`@type {IPublicTypeNpmInfo}` | | 71 | + | | 72 | +相关类型:[IPublicTypeNpmInfo](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/npm-info.ts) | | 73 | + | | 74 | +### availableActions | | 75 | + | | 76 | +获取元数据 | | 77 | + | | 78 | +`@type {IPublicTypeTransformedComponentMetadata}` | | 79 | + | | 80 | +相关类型:[IPublicTypeTransformedComponentMetadata](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/transformed-component-metadata.ts) | | 81 | + | | 82 | +### advanced | | 83 | + | | 84 | +组件元数据中高级配置部分 | | 85 | + | | 86 | +`@type {IPublicTypeAdvanced}` | | 87 | + | | 88 | +相关类型:[IPublicTypeAdvanced](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/advanced.ts) | | 89 | + | | 90 | +## 方法 | | 91 | + | | 92 | +### setNpm | | 93 | + | | 94 | +设置 npm 信息 | | 95 | + | | 96 | +```typescript | | 97 | +/** | | 98 | + * 设置 npm 信息 | | 99 | + * set method for npm inforamtion | | 100 | + * @param npm | | 101 | + */ | | 102 | +setNpm(npm: IPublicTypeNpmInfo): void; | | 103 | +``` | | 104 | + | | 105 | +相关类型:[IPublicTypeNpmInfo](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/npm-info.ts) | | 106 | + | | 107 | +### getMetadata | | 108 | + | | 109 | +获取元数据 | | 110 | + | | 111 | +```typescript | | 112 | +/** | | 113 | + * 获取元数据 | | 114 | + * get component metadata | | 115 | + */ | | 116 | +getMetadata(): IPublicTypeTransformedComponentMetadata; | | 117 | +``` | | 118 | + | | 119 | +相关类型:[IPublicTypeTransformedComponentMetadata](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/transformed-component-metadata.ts) | | 120 | + | | 121 | +### checkNestingUp | | 122 | + | | 123 | +检测当前对应节点是否可被放置在父节点中 | | 124 | + | | 125 | +```typescript | | 126 | +/** | | 127 | + * 检测当前对应节点是否可被放置在父节点中 | | 128 | + * check if the current node could be placed in parent node | | 129 | + * @param my 当前节点 | | 130 | + * @param parent 父节点 | | 131 | + */ | | 132 | +checkNestingUp(my: IPublicModelNode | IPublicTypeNodeData, parent: any): boolean; | | 133 | +``` | | 134 | + | | 135 | +相关类型: | | 136 | +- [IPublicModelNode](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) | | 137 | +- [IPublicTypeNodeData](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/node-data.ts) | | 138 | + | | 139 | + | | 140 | +### checkNestingDown | | 141 | + | | 142 | +检测目标节点是否可被放置在父节点中 | | 143 | + | | 144 | +```typescript | | 145 | +/** | | 146 | + * 检测目标节点是否可被放置在父节点中 | | 147 | + * check if the target node(s) could be placed in current node | | 148 | + * @param my 当前节点 | | 149 | + * @param parent 父节点 | | 150 | + */ | | 151 | +checkNestingDown( | | 152 | + my: IPublicModelNode | IPublicTypeNodeData, | | 153 | + target: IPublicTypeNodeSchema | IPublicModelNode | IPublicTypeNodeSchema[], | | 154 | + ): boolean; | | 155 | +``` | | 156 | + | | 157 | +相关类型: | | 158 | +- [IPublicModelNode](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) | | 159 | +- [IPublicTypeNodeData](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/node-data.ts) | | 160 | +- [IPublicTypeNodeSchema](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/node-schema.ts) | | 161 | + | | 162 | + | | 163 | +### refreshMetadata | | 164 | + | | 165 | +刷新元数据,会触发元数据的重新解析和刷新 | | 166 | + | | 167 | +```typescript | | 168 | +/** | | 169 | + * 刷新元数据,会触发元数据的重新解析和刷新 | | 170 | + * refresh metadata | | 171 | + */ | | 172 | +refreshMetadata(): void; | | 173 | +``` |
Collapse file Copy file name to clipboardExpand all lines: docs/docs/api/model/resource.md +2-2Lines changed: 2 additions & 2 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -4,7 +4,7 @@ sidebar_position: 13 | 4 | 4 | --- | 5 | 5 |
| 6 | 6 | > **[@experimental](./#experimental)**<br/> | 7 | | -> **@types** [IPublicModelWindow](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/resource.ts)<br/> | | 7 | +> **@types** [IPublicModelResource](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/resource.ts)<br/> | 8 | 8 | > **@since** v1.1.0 | 9 | 9 |
| 10 | 10 | ## 属性 | @@ -43,4 +43,4 @@ sidebar_position: 13 | 43 | 43 |
| 44 | 44 | 资源配置信息 | 45 | 45 |
| 46 | | -`@type {Object}` | | 46 | +`@type {Object}` |
Collapse file Copy file name to clipboardExpand all lines: packages/designer/src/component-meta.ts +6-3Lines changed: 6 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -110,7 +110,7 @@ export class ComponentMeta implements IComponentMeta { | 110 | 110 |
| 111 | 111 | private _transformedMetadata?: IPublicTypeTransformedComponentMetadata; | 112 | 112 |
| 113 | | - get configure() { | | 113 | + get configure(): IPublicTypeFieldConfig[] { | 114 | 114 | const config = this._transformedMetadata?.configure; | 115 | 115 | return config?.combined || config?.props || []; | 116 | 116 | } | @@ -272,8 +272,11 @@ export class ComponentMeta implements IComponentMeta { | 272 | 272 | this.parseMetadata(this.getMetadata()); | 273 | 273 | } | 274 | 274 |
| 275 | | - private transformMetadata(metadta: IPublicTypeComponentMetadata): IPublicTypeTransformedComponentMetadata { | 276 | | - const result = this.designer.componentActions.getRegisteredMetadataTransducers().reduce((prevMetadata, current) => { | | 275 | + private transformMetadata( | | 276 | + metadta: IPublicTypeComponentMetadata, | | 277 | + ): IPublicTypeTransformedComponentMetadata { | | 278 | + const registeredTransducers = this.designer.componentActions.getRegisteredMetadataTransducers(); | | 279 | + const result = registeredTransducers.reduce((prevMetadata, current) => { | 277 | 280 | return current(prevMetadata); | 278 | 281 | }, preprocessMetadata(metadta)); | 279 | 282 |
| |
Collapse file Copy file name to clipboardExpand all lines: packages/designer/src/designer/designer.ts +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -12,7 +12,7 @@ import { | 12 | 12 | IPublicTypePropsTransducer, | 13 | 13 | IShellModelFactory, | 14 | 14 | IPublicModelDragObject, | 15 | | - IPublicModelScrollable, | | 15 | + IPublicTypeScrollable, | 16 | 16 | IPublicModelScroller, | 17 | 17 | IPublicTypeLocationData, | 18 | 18 | IPublicEnumTransformStage, | @@ -70,7 +70,7 @@ export interface IDesigner { | 70 | 70 |
| 71 | 71 | get editor(): IPublicModelEditor; | 72 | 72 |
| 73 | | - createScroller(scrollable: IPublicModelScrollable): IPublicModelScroller; | | 73 | + createScroller(scrollable: IPublicTypeScrollable): IPublicModelScroller; | 74 | 74 |
| 75 | 75 | /** | 76 | 76 | * 创建插入位置,考虑放到 dragon 中 | @@ -302,7 +302,7 @@ export class Designer implements IDesigner { | 302 | 302 | this._dropLocation = undefined; | 303 | 303 | } | 304 | 304 |
| 305 | | - createScroller(scrollable: IPublicModelScrollable): IPublicModelScroller { | | 305 | + createScroller(scrollable: IPublicTypeScrollable): IPublicModelScroller { | 306 | 306 | return new Scroller(scrollable); | 307 | 307 | } | 308 | 308 |
| |
Collapse file Copy file name to clipboardExpand all lines: packages/designer/src/designer/scroller.ts +11-11Lines changed: 11 additions & 11 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | import { isElement } from '@alilc/lowcode-utils'; | 2 | | -import { IPublicModelScrollTarget, IPublicModelScrollable, IPublicModelScroller } from '@alilc/lowcode-types'; | | 2 | +import { IPublicModelScrollTarget, IPublicTypeScrollable, IPublicModelScroller } from '@alilc/lowcode-types'; | 3 | 3 |
| 4 | 4 | export interface IScrollTarget extends IPublicModelScrollTarget { | 5 | 5 | } | @@ -13,6 +13,14 @@ export class ScrollTarget implements IScrollTarget { | 13 | 13 | return 'scrollY' in this.target ? this.target.scrollY : this.target.scrollTop; | 14 | 14 | } | 15 | 15 |
| | 16 | + private doc?: HTMLElement; | | 17 | + | | 18 | + constructor(private target: Window | Element) { | | 19 | + if (isWindow(target)) { | | 20 | + this.doc = target.document.documentElement; | | 21 | + } | | 22 | + } | | 23 | + | 16 | 24 | scrollTo(options: { left?: number; top?: number }) { | 17 | 25 | this.target.scrollTo(options); | 18 | 26 | } | @@ -28,14 +36,6 @@ export class ScrollTarget implements IScrollTarget { | 28 | 36 | get scrollWidth(): number { | 29 | 37 | return ((this.doc || this.target) as any).scrollWidth; | 30 | 38 | } | 31 | | - | 32 | | - private doc?: HTMLElement; | 33 | | - | 34 | | - constructor(private target: Window | Element) { | 35 | | - if (isWindow(target)) { | 36 | | - this.doc = target.document.documentElement; | 37 | | - } | 38 | | - } | 39 | 39 | } | 40 | 40 |
| 41 | 41 | function isWindow(obj: any): obj is Window { | @@ -53,9 +53,9 @@ export interface IScroller extends IPublicModelScroller { | 53 | 53 | } | 54 | 54 | export class Scroller implements IScroller { | 55 | 55 | private pid: number | undefined; | 56 | | - scrollable: IPublicModelScrollable; | | 56 | + scrollable: IPublicTypeScrollable; | 57 | 57 |
| 58 | | - constructor(scrollable: IPublicModelScrollable) { | | 58 | + constructor(scrollable: IPublicTypeScrollable) { | 59 | 59 | this.scrollable = scrollable; | 60 | 60 | } | 61 | 61 |
| |
Collapse file Copy file name to clipboardExpand all lines: packages/designer/src/simulator.ts +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | import { ComponentType } from 'react'; | 2 | | -import { IPublicTypeComponentMetadata, IPublicTypeNodeSchema, IPublicModelScrollable, IPublicTypeComponentInstance, IPublicModelSensor, IPublicTypeNodeInstance } from '@alilc/lowcode-types'; | | 2 | +import { IPublicTypeComponentMetadata, IPublicTypeNodeSchema, IPublicTypeScrollable, IPublicTypeComponentInstance, IPublicModelSensor, IPublicTypeNodeInstance } from '@alilc/lowcode-types'; | 3 | 3 | import { Point, ScrollTarget, ILocateEvent } from './designer'; | 4 | 4 | import { BuiltinSimulatorRenderer } from './builtin-simulator/renderer'; | 5 | 5 | import { Node, INode } from './document'; | @@ -8,7 +8,7 @@ export type AutoFit = '100%'; | 8 | 8 | // eslint-disable-next-line no-redeclare | 9 | 9 | export const AutoFit = '100%'; | 10 | 10 |
| 11 | | -export interface IScrollable extends IPublicModelScrollable { | | 11 | +export interface IScrollable extends IPublicTypeScrollable { | 12 | 12 | } | 13 | 13 | export interface IViewport extends IScrollable { | 14 | 14 |
| |
Collapse file Copy file name to clipboardExpand all lines: packages/plugin-outline-pane/src/controllers/pane-controller.ts +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 8 | 8 | } from '@alilc/lowcode-utils'; | 9 | 9 | import { | 10 | 10 | IPublicModelDragObject, | 11 | | - IPublicModelScrollable, | | 11 | + IPublicTypeScrollable, | 12 | 12 | IPublicModelSensor, | 13 | 13 | IPublicTypeLocationChildrenDetail, | 14 | 14 | IPublicTypeLocationDetailType, | @@ -24,7 +24,7 @@ import { IndentTrack } from '../helper/indent-track'; | 24 | 24 | import DwellTimer from '../helper/dwell-timer'; | 25 | 25 | import { ITreeBoard, TreeMaster } from './tree-master'; | 26 | 26 |
| 27 | | -export class PaneController implements IPublicModelSensor, ITreeBoard, IPublicModelScrollable { | | 27 | +export class PaneController implements IPublicModelSensor, ITreeBoard, IPublicTypeScrollable { | 28 | 28 | private pluginContext: IPublicModelPluginContext; | 29 | 29 |
| 30 | 30 | private treeMaster?: TreeMaster; | |
Collapse file Copy file name to clipboardExpand all lines: packages/shell/src/api/canvas.ts +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 2 | 2 | IPublicApiCanvas, | 3 | 3 | IPublicModelDropLocation, | 4 | 4 | IPublicModelScrollTarget, | 5 | | - IPublicModelScrollable, | | 5 | + IPublicTypeScrollable, | 6 | 6 | IPublicModelScroller, | 7 | 7 | IPublicTypeLocationData, | 8 | 8 | IPublicModelEditor, | @@ -58,7 +58,7 @@ export class Canvas implements IPublicApiCanvas { | 58 | 58 | return new InnerScrollTarget(shell); | 59 | 59 | } | 60 | 60 |
| 61 | | - createScroller(scrollable: IPublicModelScrollable): IPublicModelScroller { | | 61 | + createScroller(scrollable: IPublicTypeScrollable): IPublicModelScroller { | 62 | 62 | return this[designerSymbol].createScroller(scrollable); | 63 | 63 | } | 64 | 64 |
| @@ -78,4 +78,4 @@ export class Canvas implements IPublicApiCanvas { | 78 | 78 | get dropLocation() { | 79 | 79 | return ShellDropLocation.create((this[designerSymbol] as any).dropLocation || null); | 80 | 80 | } | 81 | | -} | | 81 | +} |
Collapse file Copy file name to clipboardExpand all lines: packages/shell/src/model/component-meta.ts +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 2 | 2 | IComponentMeta as InnerComponentMeta, | 3 | 3 | INode, | 4 | 4 | } from '@alilc/lowcode-designer'; | 5 | | -import { IPublicTypeNodeData, IPublicTypeNodeSchema, IPublicModelComponentMeta, IPublicTypeI18nData, IPublicTypeIconType, IPublicTypeNpmInfo, IPublicTypeTransformedComponentMetadata, IPublicModelNode, IPublicTypeAdvanced } from '@alilc/lowcode-types'; | | 5 | +import { IPublicTypeNodeData, IPublicTypeNodeSchema, IPublicModelComponentMeta, IPublicTypeI18nData, IPublicTypeIconType, IPublicTypeNpmInfo, IPublicTypeTransformedComponentMetadata, IPublicModelNode, IPublicTypeAdvanced, IPublicTypeFieldConfig } from '@alilc/lowcode-types'; | 6 | 6 | import { componentMetaSymbol, nodeSymbol } from '../symbols'; | 7 | 7 | import { ReactElement } from 'react'; | 8 | 8 |
| @@ -56,7 +56,7 @@ export class ComponentMeta implements IPublicModelComponentMeta { | 56 | 56 | /** | 57 | 57 | * 元数据配置 | 58 | 58 | */ | 59 | | - get configure(): any { | | 59 | + get configure(): IPublicTypeFieldConfig[] { | 60 | 60 | return this[componentMetaSymbol].configure; | 61 | 61 | } | 62 | 62 |
| |
|