GeezerVison is showing github.com — fix: fix lint issues in shell · li55/lowcode-engine@8537eff
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: docs/docs/api/model/detecting.md +1-1Lines changed: 1 addition & 1 deletion - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -77,7 +77,7 @@ hover 节点变化事件 | 77 | 77 | * set callback which will be called when hovering object changed. | 78 | 78 | * @since v1.1.0 | 79 | 79 | */ | 80 | | -onDetectingChange(fn: (node: IPublicModelNode) => void): IPublicTypeDisposable; | | 80 | +onDetectingChange(fn: (node: IPublicModelNode | null) => void): IPublicTypeDisposable; | 81 | 81 | ``` | 82 | 82 |
| 83 | 83 | 相关类型: | |
Collapse file Copy file name to clipboardExpand all lines: packages/designer/src/designer/active-tracker.ts +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 6 | 6 | } from '@alilc/lowcode-types'; | 7 | 7 | import { isNode } from '@alilc/lowcode-utils'; | 8 | 8 |
| 9 | | -export interface IActiveTracker extends IPublicModelActiveTracker { | | 9 | +export interface IActiveTracker extends Omit< IPublicModelActiveTracker, 'track' > { | 10 | 10 | track(originalTarget: IPublicTypeActiveTarget | INode): void; | 11 | 11 | } | 12 | 12 |
| |
Collapse file Copy file name to clipboardExpand all lines: packages/designer/src/designer/designer.ts +35-11Lines changed: 35 additions & 11 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -17,17 +17,16 @@ import { | 17 | 17 | IPublicTypeLocationData, | 18 | 18 | IPublicEnumTransformStage, | 19 | 19 | IPublicModelDragon, | 20 | | - IPublicModelActiveTracker, | 21 | 20 | IPublicModelDropLocation, | 22 | 21 | } from '@alilc/lowcode-types'; | 23 | 22 | import { megreAssets, IPublicTypeAssetsJson, isNodeSchema, isDragNodeObject, isDragNodeDataObject, isLocationChildrenDetail, Logger } from '@alilc/lowcode-utils'; | 24 | 23 | import { Project } from '../project'; | 25 | 24 | import { Node, DocumentModel, insertChildren, INode } from '../document'; | 26 | | -import { ComponentMeta } from '../component-meta'; | | 25 | +import { ComponentMeta, IComponentMeta } from '../component-meta'; | 27 | 26 | import { INodeSelector, Component } from '../simulator'; | 28 | 27 | import { Scroller } from './scroller'; | 29 | | -import { Dragon, ILocateEvent } from './dragon'; | 30 | | -import { ActiveTracker } from './active-tracker'; | | 28 | +import { Dragon, IDragon, ILocateEvent } from './dragon'; | | 29 | +import { ActiveTracker, IActiveTracker } from './active-tracker'; | 31 | 30 | import { Detecting } from './detecting'; | 32 | 31 | import { DropLocation } from './location'; | 33 | 32 | import { OffsetObserver, createOffsetObserver } from './offset-observer'; | @@ -56,24 +55,49 @@ export interface DesignerProps { | 56 | 55 | onMount?: (designer: Designer) => void; | 57 | 56 | onDragstart?: (e: ILocateEvent) => void; | 58 | 57 | onDrag?: (e: ILocateEvent) => void; | 59 | | - onDragend?: (e: { dragObject: IPublicModelDragObject; copy: boolean }, loc?: DropLocation) => void; | | 58 | + onDragend?: ( | | 59 | + e: { dragObject: IPublicModelDragObject; copy: boolean }, | | 60 | + loc?: DropLocation, | | 61 | + ) => void; | 60 | 62 | } | 61 | 63 |
| 62 | 64 | export interface IDesigner { | | 65 | + | 63 | 66 | get dragon(): IPublicModelDragon; | 64 | | - get activeTracker(): IPublicModelActiveTracker; | | 67 | + | | 68 | + get activeTracker(): IActiveTracker; | | 69 | + | | 70 | + get componentActions(): ComponentActions; | | 71 | + | | 72 | + get editor(): IPublicModelEditor; | | 73 | + | 65 | 74 | createScroller(scrollable: IPublicModelScrollable): IPublicModelScroller; | 66 | 75 |
| 67 | 76 | /** | 68 | 77 | * 创建插入位置,考虑放到 dragon 中 | 69 | 78 | */ | 70 | 79 | createLocation(locationData: IPublicTypeLocationData): IPublicModelDropLocation; | | 80 | + | | 81 | + get componentsMap(): { [key: string]: IPublicTypeNpmInfo | Component }; | | 82 | + | | 83 | + loadIncrementalAssets(incrementalAssets: IPublicTypeAssetsJson): Promise<void>; | | 84 | + | | 85 | + getComponentMeta( | | 86 | + componentName: string, | | 87 | + generateMetadata?: () => IPublicTypeComponentMetadata | null, | | 88 | + ): IComponentMeta; | | 89 | + | | 90 | + createComponentMeta(data: IPublicTypeComponentMetadata): IComponentMeta | null; | | 91 | + | | 92 | + getComponentMetasMap(): Map<string, IComponentMeta>; | | 93 | + | | 94 | + addPropsReducer(reducer: IPublicTypePropsTransducer, stage: IPublicEnumTransformStage): void; | 71 | 95 | } | 72 | 96 |
| 73 | 97 | export class Designer implements IDesigner { | 74 | | - public dragon: Dragon; | | 98 | + dragon: IDragon; | 75 | 99 |
| 76 | | - public viewName: string | undefined; | | 100 | + viewName: string | undefined; | 77 | 101 |
| 78 | 102 | readonly componentActions = new ComponentActions(); | 79 | 103 |
| @@ -99,7 +123,7 @@ export class Designer implements IDesigner { | 99 | 123 |
| 100 | 124 | private oobxList: OffsetObserver[] = []; | 101 | 125 |
| 102 | | - @obx.ref private _componentMetasMap = new Map<string, ComponentMeta>(); | | 126 | + @obx.ref private _componentMetasMap = new Map<string, IComponentMeta>(); | 103 | 127 |
| 104 | 128 | @obx.ref private _simulatorComponent?: ComponentType<any>; | 105 | 129 |
| @@ -483,7 +507,7 @@ export class Designer implements IDesigner { | 483 | 507 | metas.forEach((data) => this.createComponentMeta(data)); | 484 | 508 | } | 485 | 509 |
| 486 | | - createComponentMeta(data: IPublicTypeComponentMetadata): ComponentMeta | null { | | 510 | + createComponentMeta(data: IPublicTypeComponentMetadata): IComponentMeta | null { | 487 | 511 | const key = data.componentName; | 488 | 512 | if (!key) { | 489 | 513 | return null; | @@ -515,7 +539,7 @@ export class Designer implements IDesigner { | 515 | 539 | getComponentMeta( | 516 | 540 | componentName: string, | 517 | 541 | generateMetadata?: () => IPublicTypeComponentMetadata | null, | 518 | | - ) { | | 542 | + ): IComponentMeta { | 519 | 543 | if (this._componentMetasMap.has(componentName)) { | 520 | 544 | return this._componentMetasMap.get(componentName)!; | 521 | 545 | } | |
Collapse file Copy file name to clipboardExpand all lines: packages/designer/src/designer/detecting.ts +13-9Lines changed: 13 additions & 9 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | import { makeObservable, obx, IEventBus, createModuleEventBus } from '@alilc/lowcode-editor-core'; | 2 | | -import { IPublicModelDetecting, IPublicModelNode, IPublicModelDocumentModel } from '@alilc/lowcode-types'; | | 2 | +import { IPublicModelDetecting } from '@alilc/lowcode-types'; | | 3 | +import { IDocumentModel } from '../document/document-model'; | | 4 | +import { INode } from '../document/node/node'; | 3 | 5 |
| 4 | 6 | const DETECTING_CHANGE_EVENT = 'detectingChange'; | 5 | 7 | export interface IDetecting extends Omit< IPublicModelDetecting, 'capture' | 'release' | 'leave' > { | 6 | 8 |
| 7 | | - capture(node: IPublicModelNode | null): void; | | 9 | + capture(node: INode | null): void; | 8 | 10 |
| 9 | | - release(node: IPublicModelNode | null): void; | | 11 | + release(node: INode | null): void; | 10 | 12 |
| 11 | | - leave(document: IPublicModelDocumentModel | undefined): void; | | 13 | + leave(document: IDocumentModel | undefined): void; | | 14 | + | | 15 | + get current(): INode | null; | 12 | 16 | } | 13 | 17 |
| 14 | 18 | export class Detecting implements IDetecting { | @@ -31,7 +35,7 @@ export class Detecting implements IDetecting { | 31 | 35 |
| 32 | 36 | @obx.ref xRayMode = false; | 33 | 37 |
| 34 | | - @obx.ref private _current: IPublicModelNode | null = null; | | 38 | + @obx.ref private _current: INode | null = null; | 35 | 39 |
| 36 | 40 | private emitter: IEventBus = createModuleEventBus('Detecting'); | 37 | 41 |
| @@ -43,27 +47,27 @@ export class Detecting implements IDetecting { | 43 | 47 | return this._current; | 44 | 48 | } | 45 | 49 |
| 46 | | - capture(node: IPublicModelNode | null) { | | 50 | + capture(node: INode | null) { | 47 | 51 | if (this._current !== node) { | 48 | 52 | this._current = node; | 49 | 53 | this.emitter.emit(DETECTING_CHANGE_EVENT, this.current); | 50 | 54 | } | 51 | 55 | } | 52 | 56 |
| 53 | | - release(node: IPublicModelNode | null) { | | 57 | + release(node: INode | null) { | 54 | 58 | if (this._current === node) { | 55 | 59 | this._current = null; | 56 | 60 | this.emitter.emit(DETECTING_CHANGE_EVENT, this.current); | 57 | 61 | } | 58 | 62 | } | 59 | 63 |
| 60 | | - leave(document: IPublicModelDocumentModel | undefined) { | | 64 | + leave(document: IDocumentModel | undefined) { | 61 | 65 | if (this.current && this.current.document === document) { | 62 | 66 | this._current = null; | 63 | 67 | } | 64 | 68 | } | 65 | 69 |
| 66 | | - onDetectingChange(fn: (node: IPublicModelNode) => void) { | | 70 | + onDetectingChange(fn: (node: INode) => void) { | 67 | 71 | this.emitter.on(DETECTING_CHANGE_EVENT, fn); | 68 | 72 | return () => { | 69 | 73 | this.emitter.off(DETECTING_CHANGE_EVENT, fn); | |
Collapse file Copy file name to clipboardExpand all lines: packages/designer/src/document/document-model.ts +23-12Lines changed: 23 additions & 12 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -9,21 +9,18 @@ import { | 9 | 9 | IPublicTypeDragNodeDataObject, | 10 | 10 | IPublicModelDocumentModel, | 11 | 11 | IPublicModelHistory, | 12 | | - IPublicModelModalNodesManager, | 13 | 12 | IPublicModelNode, | 14 | | - IPublicApiProject, | 15 | | - IPublicModelDropLocation, | 16 | 13 | IPublicEnumTransformStage, | 17 | 14 | IPublicTypeOnChangeOptions, | 18 | 15 | } from '@alilc/lowcode-types'; | 19 | | -import { Project } from '../project'; | | 16 | +import { IProject, Project } from '../project'; | 20 | 17 | import { ISimulatorHost } from '../simulator'; | 21 | 18 | import { ComponentMeta } from '../component-meta'; | 22 | | -import { IDropLocation, Designer } from '../designer'; | | 19 | +import { IDropLocation, Designer, IHistory } from '../designer'; | 23 | 20 | import { Node, insertChildren, insertChild, isNode, RootNode, INode } from './node/node'; | 24 | 21 | import { Selection, ISelection } from './selection'; | 25 | 22 | import { History } from './history'; | 26 | | -import { ModalNodesManager } from './node'; | | 23 | +import { IModalNodesManager, ModalNodesManager } from './node'; | 27 | 24 | import { uniqueId, isPlainObject, compatStage, isJSExpression, isDOMText, isNodeSchema, isDragNodeObject, isDragNodeDataObject } from '@alilc/lowcode-utils'; | 28 | 25 | import { EDITOR_EVENT } from '../types'; | 29 | 26 |
| @@ -44,17 +41,31 @@ export interface IDocumentModel extends Omit< IPublicModelDocumentModel, 'select | 44 | 41 | */ | 45 | 42 | readonly selection: ISelection; | 46 | 43 |
| | 44 | + readonly project: IProject; | | 45 | + | | 46 | + /** | | 47 | + * 模态节点管理 | | 48 | + */ | | 49 | + readonly modalNodesManager: IModalNodesManager; | | 50 | + | 47 | 51 | /** | 48 | 52 | * 根据 id 获取节点 | 49 | 53 | */ | 50 | 54 | getNode(id: string): INode | null; | | 55 | + | | 56 | + getHistory(): IHistory; | | 57 | + | | 58 | + get focusNode(): INode | null; | | 59 | + | | 60 | + get rootNode(): INode | null; | | 61 | + | 51 | 62 | } | 52 | 63 |
| 53 | 64 | export class DocumentModel implements IDocumentModel { | 54 | 65 | /** | 55 | 66 | * 根节点 类型有:Page/Component/Block | 56 | 67 | */ | 57 | | - rootNode: RootNode | null; | | 68 | + rootNode: INode | null; | 58 | 69 |
| 59 | 70 | /** | 60 | 71 | * 文档编号 | @@ -74,11 +85,11 @@ export class DocumentModel implements IDocumentModel { | 74 | 85 | /** | 75 | 86 | * 模态节点管理 | 76 | 87 | */ | 77 | | - readonly modalNodesManager: IPublicModelModalNodesManager; | | 88 | + readonly modalNodesManager: IModalNodesManager; | 78 | 89 |
| 79 | 90 | private _nodesMap = new Map<string, IPublicModelNode>(); | 80 | 91 |
| 81 | | - readonly project: IPublicApiProject; | | 92 | + readonly project: IProject; | 82 | 93 |
| 83 | 94 | readonly designer: Designer; | 84 | 95 |
| @@ -114,7 +125,7 @@ export class DocumentModel implements IDocumentModel { | 114 | 125 | this.rootNode?.getExtraProp('fileName', true)?.setValue(fileName); | 115 | 126 | } | 116 | 127 |
| 117 | | - get focusNode() { | | 128 | + get focusNode(): INode { | 118 | 129 | if (this._drillDownNode) { | 119 | 130 | return this._drillDownNode; | 120 | 131 | } | @@ -147,7 +158,7 @@ export class DocumentModel implements IDocumentModel { | 147 | 158 |
| 148 | 159 | @obx.ref private _dropLocation: IDropLocation | null = null; | 149 | 160 |
| 150 | | - set dropLocation(loc: IPublicModelDropLocation | null) { | | 161 | + set dropLocation(loc: IDropLocation | null) { | 151 | 162 | this._dropLocation = loc; | 152 | 163 | // pub event | 153 | 164 | this.designer.editor.eventBus.emit( | @@ -626,7 +637,7 @@ export class DocumentModel implements IDocumentModel { | 626 | 637 | return data; | 627 | 638 | } | 628 | 639 |
| 629 | | - getHistory(): History { | | 640 | + getHistory(): IHistory { | 630 | 641 | return this.history; | 631 | 642 | } | 632 | 643 |
| |
Collapse file Copy file name to clipboardExpand all lines: packages/designer/src/document/history.ts +3-2Lines changed: 3 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -193,7 +193,7 @@ export class History<T = IPublicTypeNodeSchema> implements IHistory { | 193 | 193 | return this.onStateChange(func); | 194 | 194 | } | 195 | 195 |
| 196 | | - onStateChange(func: () => any) { | | 196 | + onStateChange(func: () => any): () => void { | 197 | 197 | this.emitter.on('statechange', func); | 198 | 198 | return () => { | 199 | 199 | this.emitter.removeListener('statechange', func); | @@ -208,7 +208,8 @@ export class History<T = IPublicTypeNodeSchema> implements IHistory { | 208 | 208 | onChangeCursor(func: () => any): () => void { | 209 | 209 | return this.onCursor(func); | 210 | 210 | } | 211 | | - onCursor(func: () => any) { | | 211 | + | | 212 | + onCursor(func: () => any): () => void { | 212 | 213 | this.emitter.on('cursor', func); | 213 | 214 | return () => { | 214 | 215 | this.emitter.removeListener('cursor', func); | |
|