mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-03-05 01:37:17 +00:00
Merge branch 'develop' into release/1.1.0-beta
This commit is contained in:
commit
fc896df066
@ -1,5 +1,5 @@
|
||||
---
|
||||
title: cavas - 画布 API
|
||||
title: canvas - 画布 API
|
||||
sidebar_position: 12
|
||||
---
|
||||
|
||||
@ -17,30 +17,25 @@ sidebar_position: 12
|
||||
|
||||
获取拖拽操作对象的实例
|
||||
|
||||
```typescript
|
||||
/**
|
||||
* 获取拖拽操作对象的实例
|
||||
* get dragon instance, you can use this to obtain draging related abilities and lifecycle hooks
|
||||
* @since v1.1.0
|
||||
*/
|
||||
get dragon(): IPublicModelDragon | null;
|
||||
```
|
||||
关联模型 [IPublicModelDragon](./model/dragon)
|
||||
`@type {IPublicModelDragon | null}`
|
||||
|
||||
|
||||
相关类型:[IPublicModelDragon](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/dragon.ts)
|
||||
|
||||
### activeTracker
|
||||
|
||||
获取活动追踪器实例
|
||||
|
||||
```typescript
|
||||
/**
|
||||
* 获取活动追踪器实例
|
||||
* get activeTracker instance, which is a singleton running in engine.
|
||||
* it tracks document`s current focusing node/node[], and notify it`s subscribers that when
|
||||
* focusing node/node[] changed.
|
||||
* @since v1.1.0
|
||||
*/
|
||||
get activeTracker(): IPublicModelActiveTracker | null;
|
||||
```
|
||||
`@type {IPublicModelActiveTracker | null}`
|
||||
|
||||
相关类型:[IPublicModelActiveTracker](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/active-tracker.ts)
|
||||
|
||||
### isInLiveEditing
|
||||
|
||||
是否处于 LiveEditing 状态
|
||||
|
||||
`@type {boolean}`
|
||||
|
||||
|
||||
## 方法
|
||||
|
||||
@ -83,4 +78,4 @@ createScroller(scrollable: IPublicModelScrollable): IPublicModelScroller;
|
||||
* @since v1.1.0
|
||||
*/
|
||||
createScrollTarget(shell: HTMLDivElement): IPublicModelScrollTarget;
|
||||
```
|
||||
```
|
||||
|
||||
@ -17,7 +17,7 @@ sidebar_position: 13
|
||||
|
||||
拖拽放置位置目标
|
||||
|
||||
`@type {IPublicModelNode}`
|
||||
`@type {IPublicModelNode | null}`
|
||||
|
||||
相关类型:[IPublicModelNode](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts)
|
||||
|
||||
|
||||
@ -6,16 +6,22 @@ import {
|
||||
} from '@alilc/lowcode-types';
|
||||
import { isNode } from '@alilc/lowcode-utils';
|
||||
|
||||
export interface IActiveTracker extends Omit< IPublicModelActiveTracker, 'track' > {
|
||||
track(originalTarget: IPublicTypeActiveTarget | INode): void;
|
||||
export interface IActiveTracker extends Omit< IPublicModelActiveTracker, 'track' | 'onChange' > {
|
||||
track(originalTarget: ActiveTarget | INode): void;
|
||||
|
||||
onChange(fn: (target: ActiveTarget) => void): () => void;
|
||||
}
|
||||
|
||||
export interface ActiveTarget extends Omit< IPublicTypeActiveTarget, 'node' > {
|
||||
node: INode;
|
||||
}
|
||||
|
||||
export class ActiveTracker implements IActiveTracker {
|
||||
private emitter: IEventBus = createModuleEventBus('ActiveTracker');
|
||||
|
||||
@obx.ref private _target?: IPublicTypeActiveTarget | INode;
|
||||
@obx.ref private _target?: ActiveTarget | INode;
|
||||
|
||||
track(originalTarget: IPublicTypeActiveTarget | INode) {
|
||||
track(originalTarget: ActiveTarget | INode) {
|
||||
let target = originalTarget;
|
||||
if (isNode(originalTarget)) {
|
||||
target = { node: originalTarget as INode };
|
||||
@ -25,11 +31,11 @@ export class ActiveTracker implements IActiveTracker {
|
||||
}
|
||||
|
||||
get currentNode() {
|
||||
return (this._target as IPublicTypeActiveTarget)?.node;
|
||||
return (this._target as ActiveTarget)?.node;
|
||||
}
|
||||
|
||||
get detail() {
|
||||
return (this._target as IPublicTypeActiveTarget)?.detail;
|
||||
return (this._target as ActiveTarget)?.detail;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -41,10 +47,10 @@ export class ActiveTracker implements IActiveTracker {
|
||||
}
|
||||
|
||||
get instance() {
|
||||
return (this._target as IPublicTypeActiveTarget)?.instance;
|
||||
return (this._target as ActiveTarget)?.instance;
|
||||
}
|
||||
|
||||
onChange(fn: (target: IPublicTypeActiveTarget) => void): () => void {
|
||||
onChange(fn: (target: ActiveTarget) => void): () => void {
|
||||
this.emitter.addListener('change', fn);
|
||||
return () => {
|
||||
this.emitter.removeListener('change', fn);
|
||||
|
||||
@ -7,9 +7,9 @@ import {
|
||||
IPublicTypeRect,
|
||||
IPublicTypeLocationDetail,
|
||||
IPublicTypeLocationData,
|
||||
IPublicModelLocateEvent,
|
||||
} from '@alilc/lowcode-types';
|
||||
|
||||
|
||||
export interface Point {
|
||||
clientX: number;
|
||||
clientY: number;
|
||||
@ -99,11 +99,15 @@ function isDocument(elem: any): elem is Document {
|
||||
export function getWindow(elem: Element | Document): Window {
|
||||
return (isDocument(elem) ? elem : elem.ownerDocument!).defaultView!;
|
||||
}
|
||||
export interface IDropLocation extends IPublicModelDropLocation {
|
||||
export interface IDropLocation extends Omit< IPublicModelDropLocation, 'target' | 'clone' > {
|
||||
|
||||
readonly source: string;
|
||||
|
||||
get target(): INode;
|
||||
|
||||
get document(): IPublicModelDocumentModel;
|
||||
|
||||
clone(event: IPublicModelLocateEvent): IDropLocation;
|
||||
}
|
||||
|
||||
export class DropLocation implements IDropLocation {
|
||||
@ -126,7 +130,7 @@ export class DropLocation implements IDropLocation {
|
||||
this.event = event;
|
||||
}
|
||||
|
||||
clone(event: ILocateEvent): DropLocation {
|
||||
clone(event: ILocateEvent): IDropLocation {
|
||||
return new DropLocation({
|
||||
target: this.target,
|
||||
detail: this.detail,
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
import { IPublicModelSettingTarget } from '@alilc/lowcode-types';
|
||||
import { ComponentMeta } from '../../component-meta';
|
||||
import { IComponentMeta } from '../../component-meta';
|
||||
import { Designer } from '../designer';
|
||||
import { Node } from '../../document';
|
||||
import { INode } from '../../document';
|
||||
|
||||
export interface SettingEntry extends IPublicModelSettingTarget {
|
||||
readonly nodes: Node[];
|
||||
readonly componentMeta: ComponentMeta | null;
|
||||
readonly nodes: INode[];
|
||||
readonly componentMeta: IComponentMeta | null;
|
||||
readonly designer: Designer;
|
||||
|
||||
// 顶端
|
||||
|
||||
@ -2,8 +2,8 @@ import { obx, computed, makeObservable, runInAction, IEventBus, createModuleEven
|
||||
import { GlobalEvent, IPublicModelEditor, IPublicTypeSetValueOptions } from '@alilc/lowcode-types';
|
||||
import { uniqueId, isJSExpression, isSettingField } from '@alilc/lowcode-utils';
|
||||
import { SettingEntry } from './setting-entry';
|
||||
import { Node } from '../../document';
|
||||
import { ComponentMeta } from '../../component-meta';
|
||||
import { INode } from '../../document';
|
||||
import { IComponentMeta } from '../../component-meta';
|
||||
import { Designer } from '../designer';
|
||||
import { Setters } from '@alilc/lowcode-shell';
|
||||
|
||||
@ -19,9 +19,9 @@ export class SettingPropEntry implements SettingEntry {
|
||||
|
||||
readonly setters: Setters;
|
||||
|
||||
readonly nodes: Node[];
|
||||
readonly nodes: INode[];
|
||||
|
||||
readonly componentMeta: ComponentMeta | null;
|
||||
readonly componentMeta: IComponentMeta | null;
|
||||
|
||||
readonly designer: Designer;
|
||||
|
||||
|
||||
@ -11,12 +11,14 @@ export const UNSET = Symbol.for('unset');
|
||||
// eslint-disable-next-line no-redeclare
|
||||
export type UNSET = typeof UNSET;
|
||||
|
||||
export interface IProp extends Omit<IPublicModelProp, 'exportSchema' | 'node'> {
|
||||
export interface IProp extends Omit<IPublicModelProp, 'exportSchema' | 'node' | 'slotNode' > {
|
||||
|
||||
readonly props: Props;
|
||||
|
||||
readonly owner: INode;
|
||||
|
||||
get slotNode(): INode | null;
|
||||
|
||||
delete(prop: Prop): void;
|
||||
|
||||
export(stage: IPublicEnumTransformStage): IPublicTypeCompositeValue;
|
||||
@ -113,8 +115,8 @@ export class Prop implements IProp, IPropParent {
|
||||
|
||||
private _slotNode?: INode;
|
||||
|
||||
get slotNode(): INode | undefined | null {
|
||||
return this._slotNode;
|
||||
get slotNode(): INode | null {
|
||||
return this._slotNode || null;
|
||||
}
|
||||
|
||||
@obx.shallow private _items: Prop[] | null = null;
|
||||
|
||||
@ -7,11 +7,11 @@ import {
|
||||
import { Designer } from '../../src/designer/designer';
|
||||
import formSchema from '../fixtures/schema/form';
|
||||
import { fireEvent } from '@testing-library/react';
|
||||
import { isInLiveEditing, builtinHotkey } from '../../../engine/src/inner-plugins/builtin-hotkey';
|
||||
import { builtinHotkey } from '../../../engine/src/inner-plugins/builtin-hotkey';
|
||||
import { shellModelFactory } from '../../../engine/src/modules/shell-model-factory';
|
||||
import { ILowCodePluginContextPrivate, LowCodePluginManager } from '@alilc/lowcode-designer';
|
||||
import { IPublicApiPlugins } from '@alilc/lowcode-types';
|
||||
import { Logger, Project } from '@alilc/lowcode-shell';
|
||||
import { Logger, Project, Canvas } from '@alilc/lowcode-shell';
|
||||
import { Workspace } from '@alilc/lowcode-workspace';
|
||||
|
||||
const editor = new Editor();
|
||||
@ -19,12 +19,6 @@ const workspace = new Workspace();
|
||||
|
||||
let designer: Designer;
|
||||
|
||||
describe('error scenarios', () => {
|
||||
it('edtior not registered', () => {
|
||||
expect(isInLiveEditing()).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
// keyCode 对应表:https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode
|
||||
// hotkey 模块底层用的 keyCode,所以还不能用 key / code 测试
|
||||
describe('快捷键测试', () => {
|
||||
@ -40,6 +34,7 @@ describe('快捷键测试', () => {
|
||||
context.hotkey = hotkey;
|
||||
context.logger = logger;
|
||||
context.project = project;
|
||||
context.canvas = new Canvas(editor);
|
||||
}
|
||||
};
|
||||
pluginManager = new LowCodePluginManager(contextApiAssembler).toProxy();
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
/* eslint-disable max-len */
|
||||
import { Editor, globalContext } from '@alilc/lowcode-editor-core';
|
||||
import { isFormEvent } from '@alilc/lowcode-utils';
|
||||
import {
|
||||
focusing,
|
||||
@ -12,23 +11,9 @@ import {
|
||||
IPublicModelNode,
|
||||
} from '@alilc/lowcode-types';
|
||||
import symbols from '../modules/symbols';
|
||||
|
||||
const { nodeSymbol, documentSymbol } = symbols;
|
||||
|
||||
export function isInLiveEditing() {
|
||||
const workspace = globalContext.has('workspace') && globalContext.get('workspace');
|
||||
if (workspace?.isActive) {
|
||||
return Boolean(
|
||||
workspace.window.editor.get('designer')?.project?.simulator?.liveEditing?.editing,
|
||||
);
|
||||
}
|
||||
|
||||
if (globalContext.has(Editor)) {
|
||||
return Boolean(
|
||||
globalContext.get(Editor).get('designer')?.project?.simulator?.liveEditing?.editing,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/* istanbul ignore next */
|
||||
function getNextForSelect(next: IPublicModelNode | null, head?: any, parent?: IPublicModelNode | null): any {
|
||||
if (next) {
|
||||
@ -95,12 +80,12 @@ function getPrevForSelect(prev: IPublicModelNode | null, head?: any, parent?: IP
|
||||
export const builtinHotkey = (ctx: IPublicModelPluginContext) => {
|
||||
return {
|
||||
init() {
|
||||
const { hotkey, project, logger } = ctx;
|
||||
const { hotkey, project, logger, canvas } = ctx;
|
||||
// hotkey binding
|
||||
hotkey.bind(['backspace', 'del'], (e: KeyboardEvent, action) => {
|
||||
logger.info(`action ${action} is triggered`);
|
||||
|
||||
if (isInLiveEditing()) {
|
||||
if (canvas.isInLiveEditing) {
|
||||
return;
|
||||
}
|
||||
// TODO: use focus-tracker
|
||||
@ -124,7 +109,7 @@ export const builtinHotkey = (ctx: IPublicModelPluginContext) => {
|
||||
hotkey.bind('escape', (e: KeyboardEvent, action) => {
|
||||
logger.info(`action ${action} is triggered`);
|
||||
// const currentFocus = focusing.current;
|
||||
if (isInLiveEditing()) {
|
||||
if (canvas.isInLiveEditing) {
|
||||
return;
|
||||
}
|
||||
const sel = focusing.focusDesigner?.currentDocument?.selection;
|
||||
@ -140,7 +125,7 @@ export const builtinHotkey = (ctx: IPublicModelPluginContext) => {
|
||||
// command + c copy command + x cut
|
||||
hotkey.bind(['command+c', 'ctrl+c', 'command+x', 'ctrl+x'], (e, action) => {
|
||||
logger.info(`action ${action} is triggered`);
|
||||
if (isInLiveEditing()) {
|
||||
if (canvas.isInLiveEditing) {
|
||||
return;
|
||||
}
|
||||
const doc = project.currentDocument;
|
||||
@ -179,10 +164,9 @@ export const builtinHotkey = (ctx: IPublicModelPluginContext) => {
|
||||
// command + v paste
|
||||
hotkey.bind(['command+v', 'ctrl+v'], (e, action) => {
|
||||
logger.info(`action ${action} is triggered`);
|
||||
if (isInLiveEditing()) {
|
||||
if (canvas.isInLiveEditing) {
|
||||
return;
|
||||
}
|
||||
if (isInLiveEditing()) return;
|
||||
// TODO
|
||||
const designer = focusing.focusDesigner;
|
||||
const doc = project?.currentDocument;
|
||||
@ -212,7 +196,7 @@ export const builtinHotkey = (ctx: IPublicModelPluginContext) => {
|
||||
// command + z undo
|
||||
hotkey.bind(['command+z', 'ctrl+z'], (e, action) => {
|
||||
logger.info(`action ${action} is triggered`);
|
||||
if (isInLiveEditing()) {
|
||||
if (canvas.isInLiveEditing) {
|
||||
return;
|
||||
}
|
||||
const history = project.currentDocument?.history;
|
||||
@ -230,7 +214,7 @@ export const builtinHotkey = (ctx: IPublicModelPluginContext) => {
|
||||
// command + shift + z redo
|
||||
hotkey.bind(['command+y', 'ctrl+y', 'command+shift+z'], (e, action) => {
|
||||
logger.info(`action ${action} is triggered`);
|
||||
if (isInLiveEditing()) {
|
||||
if (canvas.isInLiveEditing) {
|
||||
return;
|
||||
}
|
||||
const history = project.currentDocument?.history;
|
||||
@ -247,7 +231,7 @@ export const builtinHotkey = (ctx: IPublicModelPluginContext) => {
|
||||
// sibling selection
|
||||
hotkey.bind(['left', 'right'], (e, action) => {
|
||||
logger.info(`action ${action} is triggered`);
|
||||
if (isInLiveEditing()) {
|
||||
if (canvas.isInLiveEditing) {
|
||||
return;
|
||||
}
|
||||
const doc = project.currentDocument;
|
||||
@ -266,7 +250,7 @@ export const builtinHotkey = (ctx: IPublicModelPluginContext) => {
|
||||
|
||||
hotkey.bind(['up', 'down'], (e, action) => {
|
||||
logger.info(`action ${action} is triggered`);
|
||||
if (isInLiveEditing()) {
|
||||
if (canvas.isInLiveEditing) {
|
||||
return;
|
||||
}
|
||||
const doc = project.currentDocument;
|
||||
@ -291,7 +275,7 @@ export const builtinHotkey = (ctx: IPublicModelPluginContext) => {
|
||||
|
||||
hotkey.bind(['option+left', 'option+right'], (e, action) => {
|
||||
logger.info(`action ${action} is triggered`);
|
||||
if (isInLiveEditing()) {
|
||||
if (canvas.isInLiveEditing) {
|
||||
return;
|
||||
}
|
||||
const doc = project.currentDocument;
|
||||
@ -325,7 +309,7 @@ export const builtinHotkey = (ctx: IPublicModelPluginContext) => {
|
||||
|
||||
hotkey.bind(['option+up'], (e, action) => {
|
||||
logger.info(`action ${action} is triggered`);
|
||||
if (isInLiveEditing()) {
|
||||
if (canvas.isInLiveEditing) {
|
||||
return;
|
||||
}
|
||||
const doc = project.currentDocument;
|
||||
@ -367,7 +351,7 @@ export const builtinHotkey = (ctx: IPublicModelPluginContext) => {
|
||||
|
||||
hotkey.bind(['option+down'], (e, action) => {
|
||||
logger.info(`action ${action} is triggered`);
|
||||
if (isInLiveEditing()) {
|
||||
if (canvas.isInLiveEditing) {
|
||||
return;
|
||||
}
|
||||
const doc = project.getCurrentDocument();
|
||||
|
||||
@ -36,6 +36,10 @@ export class Canvas implements IPublicApiCanvas {
|
||||
return activeTracker;
|
||||
}
|
||||
|
||||
get isInLiveEditing(): boolean {
|
||||
return Boolean(this[editorSymbol].get('designer')?.project?.simulator?.liveEditing?.editing);
|
||||
}
|
||||
|
||||
constructor(editor: IPublicModelEditor, readonly workspaceMode: boolean = false) {
|
||||
this[editorSymbol] = editor;
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { IPublicModelActiveTracker, IPublicModelNode, IPublicTypeActiveTarget } from '@alilc/lowcode-types';
|
||||
import { IActiveTracker as InnerActiveTracker, INode as InnerNode } from '@alilc/lowcode-designer';
|
||||
import { IActiveTracker as InnerActiveTracker, ActiveTarget } from '@alilc/lowcode-designer';
|
||||
import { Node as ShellNode } from './node';
|
||||
import { nodeSymbol } from '../symbols';
|
||||
|
||||
@ -16,9 +16,9 @@ export class ActiveTracker implements IPublicModelActiveTracker {
|
||||
if (!fn) {
|
||||
return () => {};
|
||||
}
|
||||
return this[activeTrackerSymbol].onChange((t: IPublicTypeActiveTarget) => {
|
||||
return this[activeTrackerSymbol].onChange((t: ActiveTarget) => {
|
||||
const { node: innerNode, detail, instance } = t;
|
||||
const publicNode = ShellNode.create(innerNode as InnerNode);
|
||||
const publicNode = ShellNode.create(innerNode);
|
||||
const publicActiveTarget = {
|
||||
node: publicNode!,
|
||||
detail,
|
||||
|
||||
@ -2,7 +2,7 @@ import {
|
||||
IDropLocation as InnerDropLocation,
|
||||
} from '@alilc/lowcode-designer';
|
||||
import { dropLocationSymbol } from '../symbols';
|
||||
import { Node } from './node';
|
||||
import { Node as ShellNode } from './node';
|
||||
import { IPublicModelDropLocation, IPublicTypeLocationDetail, IPublicModelLocateEvent } from '@alilc/lowcode-types';
|
||||
|
||||
export class DropLocation implements IPublicModelDropLocation {
|
||||
@ -20,7 +20,7 @@ export class DropLocation implements IPublicModelDropLocation {
|
||||
}
|
||||
|
||||
get target() {
|
||||
return Node.create(this[dropLocationSymbol].target);
|
||||
return ShellNode.create(this[dropLocationSymbol].target);
|
||||
}
|
||||
|
||||
get detail(): IPublicTypeLocationDetail {
|
||||
|
||||
@ -335,6 +335,7 @@ export class Node implements IPublicModelNode {
|
||||
}
|
||||
const shellNode = new Node(node);
|
||||
// @ts-ignore 挂载 shell node 实例
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
node[shellNodeSymbol] = shellNode;
|
||||
return shellNode;
|
||||
}
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
import { IPublicModelResource } from '@alilc/lowcode-types';
|
||||
import { Resource as InnerResource } from '@alilc/lowcode-workspace';
|
||||
import { resourceSymbol } from '../symbols';
|
||||
import { ResourceType } from './resource-type';
|
||||
|
||||
export class Resource implements IPublicModelResource {
|
||||
readonly [resourceSymbol]: InnerResource;
|
||||
|
||||
@ -12,9 +12,9 @@ import {
|
||||
IPublicTypeSetValueOptions,
|
||||
} from '@alilc/lowcode-types';
|
||||
import { settingPropEntrySymbol } from '../symbols';
|
||||
import { Node } from './node';
|
||||
import { SettingTopEntry } from './setting-top-entry';
|
||||
import { ComponentMeta } from './component-meta';
|
||||
import { Node as ShellNode } from './node';
|
||||
import { SettingTopEntry as ShellSettingTopEntry } from './setting-top-entry';
|
||||
import { ComponentMeta as ShellComponentMeta } from './component-meta';
|
||||
import { isCustomView } from '@alilc/lowcode-utils';
|
||||
|
||||
export class SettingPropEntry implements IPublicModelSettingPropEntry {
|
||||
@ -92,14 +92,14 @@ export class SettingPropEntry implements IPublicModelSettingPropEntry {
|
||||
}
|
||||
|
||||
get props(): IPublicModelSettingTopEntry {
|
||||
return SettingTopEntry.create(this[settingPropEntrySymbol].props);
|
||||
return ShellSettingTopEntry.create(this[settingPropEntrySymbol].props);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取设置属性对应的节点实例
|
||||
*/
|
||||
get node(): IPublicModelNode | null {
|
||||
return Node.create(this[settingPropEntrySymbol].getNode());
|
||||
return ShellNode.create(this[settingPropEntrySymbol].getNode());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -113,7 +113,7 @@ export class SettingPropEntry implements IPublicModelSettingPropEntry {
|
||||
* 获取顶级设置属性
|
||||
*/
|
||||
get top(): IPublicModelSettingTopEntry {
|
||||
return SettingTopEntry.create(this[settingPropEntrySymbol].top);
|
||||
return ShellSettingTopEntry.create(this[settingPropEntrySymbol].top);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -127,7 +127,7 @@ export class SettingPropEntry implements IPublicModelSettingPropEntry {
|
||||
* componentMeta
|
||||
*/
|
||||
get componentMeta(): IPublicModelComponentMeta | null {
|
||||
return ComponentMeta.create(this[settingPropEntrySymbol].componentMeta);
|
||||
return ShellComponentMeta.create(this[settingPropEntrySymbol].componentMeta);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -233,7 +233,7 @@ export class SettingPropEntry implements IPublicModelSettingPropEntry {
|
||||
* @returns
|
||||
*/
|
||||
getProps(): IPublicModelSettingTopEntry {
|
||||
return SettingTopEntry.create(this[settingPropEntrySymbol].getProps() as SettingEntry) as any;
|
||||
return ShellSettingTopEntry.create(this[settingPropEntrySymbol].getProps() as SettingEntry);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { SettingEntry } from '@alilc/lowcode-designer';
|
||||
import { settingTopEntrySymbol } from '../symbols';
|
||||
import { Node } from './node';
|
||||
import { SettingPropEntry } from './setting-prop-entry';
|
||||
import { Node as ShellNode } from './node';
|
||||
import { SettingPropEntry as ShellSettingPropEntry } from './setting-prop-entry';
|
||||
import { IPublicModelSettingTopEntry, IPublicModelNode, IPublicModelSettingPropEntry } from '@alilc/lowcode-types';
|
||||
|
||||
export class SettingTopEntry implements IPublicModelSettingTopEntry {
|
||||
@ -19,7 +19,7 @@ export class SettingTopEntry implements IPublicModelSettingTopEntry {
|
||||
* 返回所属的节点实例
|
||||
*/
|
||||
get node(): IPublicModelNode | null {
|
||||
return Node.create(this[settingTopEntrySymbol].getNode());
|
||||
return ShellNode.create(this[settingTopEntrySymbol].getNode());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -28,7 +28,7 @@ export class SettingTopEntry implements IPublicModelSettingTopEntry {
|
||||
* @returns
|
||||
*/
|
||||
get(propName: string | number): IPublicModelSettingPropEntry {
|
||||
return SettingPropEntry.create(this[settingTopEntrySymbol].get(propName) as any);
|
||||
return ShellSettingPropEntry.create(this[settingTopEntrySymbol].get(propName) as any);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { windowSymbol } from '../symbols';
|
||||
import { IPublicModelResource, IPublicModelWindow } from '@alilc/lowcode-types';
|
||||
import { EditorWindow } from '@alilc/lowcode-workspace';
|
||||
import { Resource } from './resource';
|
||||
import { Resource as ShellResource } from './resource';
|
||||
|
||||
export class Window implements IPublicModelWindow {
|
||||
private readonly [windowSymbol]: EditorWindow;
|
||||
@ -19,7 +19,7 @@ export class Window implements IPublicModelWindow {
|
||||
}
|
||||
|
||||
get resource(): IPublicModelResource {
|
||||
return new Resource(this[windowSymbol].resource);
|
||||
return new ShellResource(this[windowSymbol].resource);
|
||||
}
|
||||
|
||||
constructor(editorWindow: EditorWindow) {
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
import { IPublicModelDragon, IPublicModelDropLocation, IPublicModelScrollTarget, IPublicModelScrollable, IPublicModelScroller, IPublicModelActiveTracker } from '../model';
|
||||
import { IPublicTypeLocationData } from '../type';
|
||||
|
||||
/**
|
||||
* @since v1.1.0
|
||||
*/
|
||||
export interface IPublicApiCanvas {
|
||||
|
||||
|
||||
/**
|
||||
* 创一个滚动控制器 Scroller,赋予一个视图滚动的基本能力,
|
||||
* a Scroller is a controller that gives a view (IPublicModelScrollable) the ability scrolling
|
||||
@ -45,4 +47,11 @@ export interface IPublicApiCanvas {
|
||||
* @since v1.1.0
|
||||
*/
|
||||
get activeTracker(): IPublicModelActiveTracker | null;
|
||||
|
||||
/**
|
||||
* 是否处于 LiveEditing 状态
|
||||
* check if canvas is in liveEditing state
|
||||
* @since v1.1.0
|
||||
*/
|
||||
get isInLiveEditing(): boolean;
|
||||
}
|
||||
|
||||
@ -7,7 +7,7 @@ export interface IPublicModelDropLocation {
|
||||
* 拖拽位置目标
|
||||
* get target of dropLocation
|
||||
*/
|
||||
get target(): IPublicModelNode;
|
||||
get target(): IPublicModelNode | null;
|
||||
|
||||
/**
|
||||
* 拖拽放置位置详情
|
||||
|
||||
@ -1,4 +1,10 @@
|
||||
|
||||
export function isJSFunction(x: any): boolean {
|
||||
return typeof x === 'object' && x && x.type === 'JSFunction';
|
||||
/**
|
||||
* 内部版本 的 { type: 'JSExpression', source: '', value: '', extType: 'function' } 能力上等同于 JSFunction
|
||||
*/
|
||||
export function isInnerJsFunction(data: any) {
|
||||
return data && data.type === 'JSExpression' && data.extType === 'function';
|
||||
}
|
||||
|
||||
export function isJSFunction(data: any): boolean {
|
||||
return typeof data === 'object' && data && data.type === 'JSFunction' || isInnerJsFunction(data);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user