mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-06-08 08:29:08 +00:00
Compare commits
21 Commits
main
...
v1.1.7-bet
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d53d5bbe8b | ||
|
|
032606edf0 | ||
|
|
83267dd68e | ||
|
|
1bdc1065d7 | ||
|
|
e0a01890e4 | ||
|
|
20e67e85c1 | ||
|
|
fdb74f0aeb | ||
|
|
e4f5ff5010 | ||
|
|
0254aa8b01 | ||
|
|
13c5c21a10 | ||
|
|
b0bef21b05 | ||
|
|
3f30f840eb | ||
|
|
1f81f0d85c | ||
|
|
55534f00ce | ||
|
|
386db0ca9a | ||
|
|
309f392b6e | ||
|
|
c64647bf2b | ||
|
|
d60eceda46 | ||
|
|
07f4d68781 | ||
|
|
e977715b86 | ||
|
|
778c8a5d58 |
2
.github/workflows/cov packages.yml
vendored
2
.github/workflows/cov packages.yml
vendored
@ -91,6 +91,6 @@ cov-utils:
|
|||||||
- uses: ArtiomTr/jest-coverage-report-action@v2
|
- uses: ArtiomTr/jest-coverage-report-action@v2
|
||||||
with:
|
with:
|
||||||
working-directory: packages/utils
|
working-directory: packages/utils
|
||||||
test-script: npm test
|
test-script: npm test -- --jest-ci --jest-json --jest-coverage --jest-testLocationInResults --jest-outputFile=report.json
|
||||||
package-manager: yarn
|
package-manager: yarn
|
||||||
annotations: none
|
annotations: none
|
||||||
50
.github/workflows/test packages.yml
vendored
50
.github/workflows/test packages.yml
vendored
@ -43,7 +43,7 @@ jobs:
|
|||||||
- name: test
|
- name: test
|
||||||
run: cd packages/designer && npm test
|
run: cd packages/designer && npm test
|
||||||
|
|
||||||
editor-skeleton:
|
test-editor-skeleton:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: checkout
|
- name: checkout
|
||||||
@ -58,3 +58,51 @@ jobs:
|
|||||||
|
|
||||||
- name: test
|
- name: test
|
||||||
run: cd packages/editor-skeleton && npm test
|
run: cd packages/editor-skeleton && npm test
|
||||||
|
|
||||||
|
test-renderer-core:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- uses: actions/setup-node@v2
|
||||||
|
with:
|
||||||
|
node-version: '14'
|
||||||
|
|
||||||
|
- name: install
|
||||||
|
run: npm i && npm run setup:skip-build
|
||||||
|
|
||||||
|
- name: test
|
||||||
|
run: cd packages/renderer-core && npm test
|
||||||
|
|
||||||
|
test-react-simulator-renderer:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- uses: actions/setup-node@v2
|
||||||
|
with:
|
||||||
|
node-version: '14'
|
||||||
|
|
||||||
|
- name: install
|
||||||
|
run: npm i && npm run setup:skip-build
|
||||||
|
|
||||||
|
- name: test
|
||||||
|
run: cd packages/react-simulator-renderer && npm test
|
||||||
|
|
||||||
|
test-utils:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- uses: actions/setup-node@v2
|
||||||
|
with:
|
||||||
|
node-version: '14'
|
||||||
|
|
||||||
|
- name: install
|
||||||
|
run: npm i && npm run setup:skip-build
|
||||||
|
|
||||||
|
- name: test
|
||||||
|
run: cd packages/utils && npm test
|
||||||
@ -105,6 +105,17 @@ getPreference(): IPublicModelPreference;
|
|||||||
|
|
||||||
**@since v1.1.0**
|
**@since v1.1.0**
|
||||||
|
|
||||||
|
示例
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
import { config } from '@alilc/lowcode-engine';
|
||||||
|
|
||||||
|
const panelName = 'outline-master-pane';
|
||||||
|
|
||||||
|
// 设置大纲树面板钉住,在大纲树下次重新打开时生效
|
||||||
|
config.getPreference().set(`${panelName}-pinned-status-isFloat`, false, 'skeleton')
|
||||||
|
```
|
||||||
|
|
||||||
## 事件
|
## 事件
|
||||||
|
|
||||||
### onceGot
|
### onceGot
|
||||||
|
|||||||
@ -245,6 +245,7 @@ material.getComponentMeta('Input');
|
|||||||
```
|
```
|
||||||
|
|
||||||
#### getComponentMetasMap
|
#### getComponentMetasMap
|
||||||
|
|
||||||
获取所有已注册的物料元数据
|
获取所有已注册的物料元数据
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
@ -264,6 +265,15 @@ import { material } from '@alilc/lowcode-engine';
|
|||||||
material.getComponentMetasMap();
|
material.getComponentMetasMap();
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### refreshComponentMetasMap
|
||||||
|
|
||||||
|
刷新 componentMetasMap,可触发模拟器里的 components 重新构建
|
||||||
|
|
||||||
|
**@since v1.1.7**
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
refreshComponentMetasMap(): void;
|
||||||
|
```
|
||||||
|
|
||||||
### 物料元数据管道函数
|
### 物料元数据管道函数
|
||||||
#### registerMetadataTransducer
|
#### registerMetadataTransducer
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"lerna": "4.0.0",
|
"lerna": "4.0.0",
|
||||||
"version": "1.1.6",
|
"version": "1.1.7-beta.9",
|
||||||
"npmClient": "yarn",
|
"npmClient": "yarn",
|
||||||
"useWorkspaces": true,
|
"useWorkspaces": true,
|
||||||
"packages": [
|
"packages": [
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@alilc/lowcode-designer",
|
"name": "@alilc/lowcode-designer",
|
||||||
"version": "1.1.6",
|
"version": "1.1.7-beta.9",
|
||||||
"description": "Designer for Ali LowCode Engine",
|
"description": "Designer for Ali LowCode Engine",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"module": "es/index.js",
|
"module": "es/index.js",
|
||||||
@ -15,9 +15,9 @@
|
|||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@alilc/lowcode-editor-core": "1.1.6",
|
"@alilc/lowcode-editor-core": "1.1.7-beta.9",
|
||||||
"@alilc/lowcode-types": "1.1.6",
|
"@alilc/lowcode-types": "1.1.7-beta.9",
|
||||||
"@alilc/lowcode-utils": "1.1.6",
|
"@alilc/lowcode-utils": "1.1.7-beta.9",
|
||||||
"classnames": "^2.2.6",
|
"classnames": "^2.2.6",
|
||||||
"react": "^16",
|
"react": "^16",
|
||||||
"react-dom": "^16.7.0",
|
"react-dom": "^16.7.0",
|
||||||
@ -52,5 +52,5 @@
|
|||||||
"type": "http",
|
"type": "http",
|
||||||
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/designer"
|
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/designer"
|
||||||
},
|
},
|
||||||
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6"
|
"gitHead": "fdb74f0aeb15a30f85387979f620e27dd1673b92"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,7 +20,9 @@ export function createSimulator(
|
|||||||
): Promise<BuiltinSimulatorRenderer> {
|
): Promise<BuiltinSimulatorRenderer> {
|
||||||
const win: any = iframe.contentWindow;
|
const win: any = iframe.contentWindow;
|
||||||
const doc = iframe.contentDocument!;
|
const doc = iframe.contentDocument!;
|
||||||
|
const innerPlugins = host.designer.editor.get('innerPlugins');
|
||||||
|
|
||||||
|
win.AliLowCodeEngine = innerPlugins._getLowCodePluginContext({});
|
||||||
win.LCSimulatorHost = host;
|
win.LCSimulatorHost = host;
|
||||||
win._ = window._;
|
win._ = window._;
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import { observer, globalContext } from '@alilc/lowcode-editor-core';
|
import { observer } from '@alilc/lowcode-editor-core';
|
||||||
import { BuiltinSimulatorHost, BuiltinSimulatorProps } from './host';
|
import { BuiltinSimulatorHost, BuiltinSimulatorProps } from './host';
|
||||||
import { BemTools } from './bem-tools';
|
import { BemTools } from './bem-tools';
|
||||||
import { Project } from '../project';
|
import { Project } from '../project';
|
||||||
@ -76,8 +76,7 @@ class Content extends Component<{ host: BuiltinSimulatorHost }> {
|
|||||||
private dispose?: () => void;
|
private dispose?: () => void;
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
const workspace = globalContext.get('workspace');
|
const editor = this.props.host.designer.editor;
|
||||||
const editor = workspace.isActive ? workspace.window.editor : globalContext.get('editor');
|
|
||||||
const onEnableEvents = (type: boolean) => {
|
const onEnableEvents = (type: boolean) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
disabledEvents: type,
|
disabledEvents: type,
|
||||||
|
|||||||
@ -336,13 +336,9 @@ export class Prop implements IProp, IPropParent {
|
|||||||
if (!this._items) {
|
if (!this._items) {
|
||||||
return this._value;
|
return this._value;
|
||||||
}
|
}
|
||||||
const values = this.items!.map((prop) => {
|
return this.items!.map((prop) => {
|
||||||
return prop?.export(stage);
|
return prop?.export(stage);
|
||||||
});
|
});
|
||||||
if (values.every((val) => val === undefined)) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
return values;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -16,6 +16,7 @@ import {
|
|||||||
IPublicApiWorkspace,
|
IPublicApiWorkspace,
|
||||||
IPublicTypePluginMeta,
|
IPublicTypePluginMeta,
|
||||||
IPublicTypePluginRegisterOptions,
|
IPublicTypePluginRegisterOptions,
|
||||||
|
IPublicModelWindow,
|
||||||
} from '@alilc/lowcode-types';
|
} from '@alilc/lowcode-types';
|
||||||
import PluginContext from './plugin-context';
|
import PluginContext from './plugin-context';
|
||||||
|
|
||||||
@ -56,6 +57,7 @@ export interface ILowCodePluginContextPrivate {
|
|||||||
set pluginEvent(event: IPublicApiEvent);
|
set pluginEvent(event: IPublicApiEvent);
|
||||||
set canvas(canvas: IPublicApiCanvas);
|
set canvas(canvas: IPublicApiCanvas);
|
||||||
set workspace(workspace: IPublicApiWorkspace);
|
set workspace(workspace: IPublicApiWorkspace);
|
||||||
|
set editorWindow(window: IPublicModelWindow);
|
||||||
}
|
}
|
||||||
export interface ILowCodePluginContextApiAssembler {
|
export interface ILowCodePluginContextApiAssembler {
|
||||||
assembleApis(
|
assembleApis(
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
import { IPublicTypePluginMeta } from './../../../../lib/packages/types/src/shell/type/plugin-meta.d';
|
||||||
import '../fixtures/window';
|
import '../fixtures/window';
|
||||||
import {
|
import {
|
||||||
Editor,
|
Editor,
|
||||||
@ -22,6 +23,7 @@ import { BuiltinSimulatorHost } from '../../src/builtin-simulator/host';
|
|||||||
import { fireEvent } from '@testing-library/react';
|
import { fireEvent } from '@testing-library/react';
|
||||||
import { shellModelFactory } from '../../../engine/src/modules/shell-model-factory';
|
import { shellModelFactory } from '../../../engine/src/modules/shell-model-factory';
|
||||||
import { Setters, Workspace } from '@alilc/lowcode-shell';
|
import { Setters, Workspace } from '@alilc/lowcode-shell';
|
||||||
|
import { ILowCodePluginContextApiAssembler, ILowCodePluginContextPrivate, LowCodePluginManager } from '@alilc/lowcode-designer';
|
||||||
|
|
||||||
describe('Host 测试', () => {
|
describe('Host 测试', () => {
|
||||||
let editor: Editor;
|
let editor: Editor;
|
||||||
@ -32,10 +34,20 @@ describe('Host 测试', () => {
|
|||||||
|
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
editor = new Editor();
|
editor = new Editor();
|
||||||
const innerWorkspace = new InnerWorkspace();
|
const pluginContextApiAssembler: ILowCodePluginContextApiAssembler = {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
|
assembleApis: (context: ILowCodePluginContextPrivate, pluginName: string, meta: IPublicTypePluginMeta) => {
|
||||||
|
context.project = project;
|
||||||
|
const eventPrefix = meta?.eventPrefix || 'common';
|
||||||
|
context.workspace = workspace;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
const innerPlugins = new LowCodePluginManager(pluginContextApiAssembler);
|
||||||
|
const innerWorkspace = new InnerWorkspace(() => {}, {});
|
||||||
const workspace = new Workspace(innerWorkspace);
|
const workspace = new Workspace(innerWorkspace);
|
||||||
editor.set('innerHotkey', new InnerHotkey())
|
editor.set('innerHotkey', new InnerHotkey())
|
||||||
editor.set('setters', new Setters(new InnerSetters()));
|
editor.set('setters', new Setters(new InnerSetters()));
|
||||||
|
editor.set('innerPlugins' as any, innerPlugins);
|
||||||
!globalContext.has(Editor) && globalContext.register(editor, Editor);
|
!globalContext.has(Editor) && globalContext.register(editor, Editor);
|
||||||
!globalContext.has('workspace') && globalContext.register(innerWorkspace, 'workspace');
|
!globalContext.has('workspace') && globalContext.register(innerWorkspace, 'workspace');
|
||||||
});
|
});
|
||||||
|
|||||||
@ -435,7 +435,7 @@ describe('Prop 类测试', () => {
|
|||||||
|
|
||||||
it('should return undefined when all items are undefined', () => {
|
it('should return undefined when all items are undefined', () => {
|
||||||
prop = new Prop(mockPropsInst, [undefined, undefined], '___loopArgs___');
|
prop = new Prop(mockPropsInst, [undefined, undefined], '___loopArgs___');
|
||||||
expect(prop.getValue()).toBeUndefined();
|
expect(prop.getValue()).toEqual([undefined, undefined]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('迭代器 / map / forEach', () => {
|
it('迭代器 / map / forEach', () => {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@alilc/lowcode-editor-core",
|
"name": "@alilc/lowcode-editor-core",
|
||||||
"version": "1.1.6",
|
"version": "1.1.7-beta.9",
|
||||||
"description": "Core Api for Ali lowCode engine",
|
"description": "Core Api for Ali lowCode engine",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
@ -14,8 +14,8 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@alifd/next": "^1.19.16",
|
"@alifd/next": "^1.19.16",
|
||||||
"@alilc/lowcode-types": "1.1.6",
|
"@alilc/lowcode-types": "1.1.7-beta.9",
|
||||||
"@alilc/lowcode-utils": "1.1.6",
|
"@alilc/lowcode-utils": "1.1.7-beta.9",
|
||||||
"classnames": "^2.2.6",
|
"classnames": "^2.2.6",
|
||||||
"debug": "^4.1.1",
|
"debug": "^4.1.1",
|
||||||
"intl-messageformat": "^9.3.1",
|
"intl-messageformat": "^9.3.1",
|
||||||
@ -47,5 +47,5 @@
|
|||||||
"type": "http",
|
"type": "http",
|
||||||
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/editor-core"
|
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/editor-core"
|
||||||
},
|
},
|
||||||
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6"
|
"gitHead": "fdb74f0aeb15a30f85387979f620e27dd1673b92"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -145,6 +145,11 @@ const VALID_ENGINE_OPTIONS = {
|
|||||||
type: 'function',
|
type: 'function',
|
||||||
description: '配置指定节点为根组件',
|
description: '配置指定节点为根组件',
|
||||||
},
|
},
|
||||||
|
enableAutoOpenFirstWindow: {
|
||||||
|
type: 'boolean',
|
||||||
|
description: '应用级设计模式下,自动打开第一个窗口',
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const getStrictModeValue = (engineOptions: IPublicTypeEngineOptions, defaultValue: boolean): boolean => {
|
const getStrictModeValue = (engineOptions: IPublicTypeEngineOptions, defaultValue: boolean): boolean => {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@alilc/lowcode-editor-skeleton",
|
"name": "@alilc/lowcode-editor-skeleton",
|
||||||
"version": "1.1.6",
|
"version": "1.1.7-beta.9",
|
||||||
"description": "alibaba lowcode editor skeleton",
|
"description": "alibaba lowcode editor skeleton",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"module": "es/index.js",
|
"module": "es/index.js",
|
||||||
@ -19,10 +19,10 @@
|
|||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@alifd/next": "^1.20.12",
|
"@alifd/next": "^1.20.12",
|
||||||
"@alilc/lowcode-designer": "1.1.6",
|
"@alilc/lowcode-designer": "1.1.7-beta.9",
|
||||||
"@alilc/lowcode-editor-core": "1.1.6",
|
"@alilc/lowcode-editor-core": "1.1.7-beta.9",
|
||||||
"@alilc/lowcode-types": "1.1.6",
|
"@alilc/lowcode-types": "1.1.7-beta.9",
|
||||||
"@alilc/lowcode-utils": "1.1.6",
|
"@alilc/lowcode-utils": "1.1.7-beta.9",
|
||||||
"classnames": "^2.2.6",
|
"classnames": "^2.2.6",
|
||||||
"react": "^16.8.1",
|
"react": "^16.8.1",
|
||||||
"react-dom": "^16.8.1"
|
"react-dom": "^16.8.1"
|
||||||
@ -42,5 +42,5 @@
|
|||||||
"type": "http",
|
"type": "http",
|
||||||
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/editor-skeleton"
|
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/editor-skeleton"
|
||||||
},
|
},
|
||||||
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6"
|
"gitHead": "fdb74f0aeb15a30f85387979f620e27dd1673b92"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { Component, MouseEvent, Fragment } from 'react';
|
import { Component, MouseEvent, Fragment } from 'react';
|
||||||
import { shallowIntl, observer, obx, engineConfig, runInAction, globalContext } from '@alilc/lowcode-editor-core';
|
import { shallowIntl, observer, obx, engineConfig, runInAction } from '@alilc/lowcode-editor-core';
|
||||||
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';
|
||||||
@ -40,7 +40,7 @@ class SettingFieldView extends Component<SettingFieldViewProps, SettingFieldView
|
|||||||
|
|
||||||
stageName: string | undefined;
|
stageName: string | undefined;
|
||||||
|
|
||||||
setters: Setters;
|
setters?: Setters;
|
||||||
|
|
||||||
constructor(props: SettingFieldViewProps) {
|
constructor(props: SettingFieldViewProps) {
|
||||||
super(props);
|
super(props);
|
||||||
@ -49,10 +49,10 @@ class SettingFieldView extends Component<SettingFieldViewProps, SettingFieldView
|
|||||||
const { extraProps } = field;
|
const { extraProps } = field;
|
||||||
const { display } = extraProps;
|
const { display } = extraProps;
|
||||||
|
|
||||||
const workspace = globalContext.get('workspace');
|
const editor = field.designer?.editor;
|
||||||
const editor = workspace.isActive ? workspace.window.editor : globalContext.get('editor');
|
const skeleton = editor?.get('skeleton') as Skeleton;
|
||||||
const { stages } = editor.get('skeleton') as Skeleton;
|
const { stages } = skeleton || {};
|
||||||
this.setters = editor.get('setters');
|
this.setters = editor?.get('setters');
|
||||||
let stageName;
|
let stageName;
|
||||||
if (display === 'entry') {
|
if (display === 'entry') {
|
||||||
runInAction(() => {
|
runInAction(() => {
|
||||||
@ -291,9 +291,8 @@ class SettingGroupView extends Component<SettingGroupViewProps> {
|
|||||||
const { field } = this.props;
|
const { field } = this.props;
|
||||||
const { extraProps } = field;
|
const { extraProps } = field;
|
||||||
const { display } = extraProps;
|
const { display } = extraProps;
|
||||||
const workspace = globalContext.get('workspace');
|
const editor = this.props.field.designer?.editor;
|
||||||
const editor = workspace.isActive ? workspace.window.editor : globalContext.get('editor');
|
const { stages } = editor?.get('skeleton') as Skeleton;
|
||||||
const { stages } = editor.get('skeleton') as Skeleton;
|
|
||||||
// const items = field.items;
|
// const items = field.items;
|
||||||
|
|
||||||
let stageName;
|
let stageName;
|
||||||
@ -343,15 +342,15 @@ class SettingGroupView extends Component<SettingGroupViewProps> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createSettingFieldView(item: ISettingField | IPublicTypeCustomView, field: ISettingEntry, index?: number) {
|
export function createSettingFieldView(field: ISettingField | IPublicTypeCustomView, fieldEntry: ISettingEntry, index?: number) {
|
||||||
if (isSettingField(item)) {
|
if (isSettingField(field)) {
|
||||||
if (item.isGroup) {
|
if (field.isGroup) {
|
||||||
return <SettingGroupView field={item} key={item.id} />;
|
return <SettingGroupView field={field} key={field.id} />;
|
||||||
} else {
|
} else {
|
||||||
return <SettingFieldView field={item} key={item.id} />;
|
return <SettingFieldView field={field} key={field.id} />;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return createContent(item, { key: index, field });
|
return createContent(field, { key: index, field: fieldEntry });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
[![][issues-helper-image]][issues-helper-url] [![Issues need help][help-wanted-image]][help-wanted-url]
|
[![][issues-helper-image]][issues-helper-url] [![Issues need help][help-wanted-image]][help-wanted-url]
|
||||||
|
|
||||||
[![codecov][codecov-image-url]][codecov-url]
|
[![codecov][codecov-image-url]][codecov-url] [](https://github.com/lowcode-workspace/awesome-lowcode-engine)
|
||||||
|
|
||||||
[](https://opensource.alibaba.com/contribution_leaderboard/details?projectValue=lowcode-engine)
|
[](https://opensource.alibaba.com/contribution_leaderboard/details?projectValue=lowcode-engine)
|
||||||
|
|
||||||
|
|||||||
@ -14,7 +14,7 @@ An enterprise-class low-code technology stack with scale-out design
|
|||||||
|
|
||||||
[![][issues-helper-image]][issues-helper-url] [![Issues need help][help-wanted-image]][help-wanted-url]
|
[![][issues-helper-image]][issues-helper-url] [![Issues need help][help-wanted-image]][help-wanted-url]
|
||||||
|
|
||||||
[![codecov][codecov-image-url]][codecov-url]
|
[![codecov][codecov-image-url]][codecov-url] [](https://github.com/lowcode-workspace/awesome-lowcode-engine)
|
||||||
|
|
||||||
[](https://opensource.alibaba.com/contribution_leaderboard/details?projectValue=lowcode-engine)
|
[](https://opensource.alibaba.com/contribution_leaderboard/details?projectValue=lowcode-engine)
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@alilc/lowcode-engine",
|
"name": "@alilc/lowcode-engine",
|
||||||
"version": "1.1.6",
|
"version": "1.1.7-beta.9",
|
||||||
"description": "An enterprise-class low-code technology stack with scale-out design / 一套面向扩展设计的企业级低代码技术体系",
|
"description": "An enterprise-class low-code technology stack with scale-out design / 一套面向扩展设计的企业级低代码技术体系",
|
||||||
"main": "lib/engine-core.js",
|
"main": "lib/engine-core.js",
|
||||||
"module": "es/engine-core.js",
|
"module": "es/engine-core.js",
|
||||||
@ -19,15 +19,15 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@alifd/next": "^1.19.12",
|
"@alifd/next": "^1.19.12",
|
||||||
"@alilc/lowcode-designer": "1.1.6",
|
"@alilc/lowcode-designer": "1.1.7-beta.9",
|
||||||
"@alilc/lowcode-editor-core": "1.1.6",
|
"@alilc/lowcode-editor-core": "1.1.7-beta.9",
|
||||||
"@alilc/lowcode-editor-skeleton": "1.1.6",
|
"@alilc/lowcode-editor-skeleton": "1.1.7-beta.9",
|
||||||
"@alilc/lowcode-engine-ext": "^1.0.0",
|
"@alilc/lowcode-engine-ext": "^1.0.0",
|
||||||
"@alilc/lowcode-plugin-designer": "1.1.6",
|
"@alilc/lowcode-plugin-designer": "1.1.7-beta.9",
|
||||||
"@alilc/lowcode-plugin-outline-pane": "1.1.6",
|
"@alilc/lowcode-plugin-outline-pane": "1.1.7-beta.9",
|
||||||
"@alilc/lowcode-shell": "1.1.6",
|
"@alilc/lowcode-shell": "1.1.7-beta.9",
|
||||||
"@alilc/lowcode-utils": "1.1.6",
|
"@alilc/lowcode-utils": "1.1.7-beta.9",
|
||||||
"@alilc/lowcode-workspace": "1.1.6",
|
"@alilc/lowcode-workspace": "1.1.7-beta.9",
|
||||||
"react": "^16.8.1",
|
"react": "^16.8.1",
|
||||||
"react-dom": "^16.8.1"
|
"react-dom": "^16.8.1"
|
||||||
},
|
},
|
||||||
@ -53,5 +53,5 @@
|
|||||||
"type": "http",
|
"type": "http",
|
||||||
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/engine"
|
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/engine"
|
||||||
},
|
},
|
||||||
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6"
|
"gitHead": "fdb74f0aeb15a30f85387979f620e27dd1673b92"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,11 +9,15 @@ import {
|
|||||||
engineConfig,
|
engineConfig,
|
||||||
Setters as InnerSetters,
|
Setters as InnerSetters,
|
||||||
Hotkey as InnerHotkey,
|
Hotkey as InnerHotkey,
|
||||||
|
IEditor,
|
||||||
} from '@alilc/lowcode-editor-core';
|
} from '@alilc/lowcode-editor-core';
|
||||||
import {
|
import {
|
||||||
IPublicTypeEngineOptions,
|
IPublicTypeEngineOptions,
|
||||||
IPublicModelDocumentModel,
|
IPublicModelDocumentModel,
|
||||||
IPublicTypePluginMeta,
|
IPublicTypePluginMeta,
|
||||||
|
IPublicTypeDisposable,
|
||||||
|
IPublicApiPlugins,
|
||||||
|
IPublicApiWorkspace,
|
||||||
} from '@alilc/lowcode-types';
|
} from '@alilc/lowcode-types';
|
||||||
import {
|
import {
|
||||||
Designer,
|
Designer,
|
||||||
@ -21,6 +25,7 @@ import {
|
|||||||
ILowCodePluginContextPrivate,
|
ILowCodePluginContextPrivate,
|
||||||
ILowCodePluginContextApiAssembler,
|
ILowCodePluginContextApiAssembler,
|
||||||
PluginPreference,
|
PluginPreference,
|
||||||
|
IDesigner,
|
||||||
} from '@alilc/lowcode-designer';
|
} from '@alilc/lowcode-designer';
|
||||||
import {
|
import {
|
||||||
Skeleton as InnerSkeleton,
|
Skeleton as InnerSkeleton,
|
||||||
@ -29,6 +34,7 @@ import {
|
|||||||
import {
|
import {
|
||||||
Workspace as InnerWorkspace,
|
Workspace as InnerWorkspace,
|
||||||
Workbench as WorkSpaceWorkbench,
|
Workbench as WorkSpaceWorkbench,
|
||||||
|
IWorkspace,
|
||||||
} from '@alilc/lowcode-workspace';
|
} from '@alilc/lowcode-workspace';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@ -60,18 +66,30 @@ export * from './modules/skeleton-types';
|
|||||||
export * from './modules/designer-types';
|
export * from './modules/designer-types';
|
||||||
export * from './modules/lowcode-types';
|
export * from './modules/lowcode-types';
|
||||||
|
|
||||||
async function registryInnerPlugin(designer: Designer, editor: Editor, plugins: Plugins) {
|
async function registryInnerPlugin(designer: IDesigner, editor: IEditor, plugins: IPublicApiPlugins): Promise<IPublicTypeDisposable> {
|
||||||
// 注册一批内置插件
|
// 注册一批内置插件
|
||||||
|
const componentMetaParserPlugin = componentMetaParser(designer);
|
||||||
|
const defaultPanelRegistryPlugin = defaultPanelRegistry(editor);
|
||||||
await plugins.register(OutlinePlugin, {}, { autoInit: true });
|
await plugins.register(OutlinePlugin, {}, { autoInit: true });
|
||||||
await plugins.register(componentMetaParser(designer));
|
await plugins.register(componentMetaParserPlugin);
|
||||||
await plugins.register(setterRegistry, {});
|
await plugins.register(setterRegistry, {});
|
||||||
await plugins.register(defaultPanelRegistry(editor));
|
await plugins.register(defaultPanelRegistryPlugin);
|
||||||
await plugins.register(builtinHotkey);
|
await plugins.register(builtinHotkey);
|
||||||
await plugins.register(registerDefaults, {}, { autoInit: true });
|
await plugins.register(registerDefaults, {}, { autoInit: true });
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
plugins.delete(OutlinePlugin.pluginName);
|
||||||
|
plugins.delete(componentMetaParserPlugin.pluginName);
|
||||||
|
plugins.delete(setterRegistry.pluginName);
|
||||||
|
plugins.delete(defaultPanelRegistryPlugin.pluginName);
|
||||||
|
plugins.delete(defaultPanelRegistryPlugin.pluginName);
|
||||||
|
plugins.delete(builtinHotkey.pluginName);
|
||||||
|
plugins.delete(registerDefaults.pluginName);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const innerWorkspace = new InnerWorkspace(registryInnerPlugin, shellModelFactory);
|
const innerWorkspace: IWorkspace = new InnerWorkspace(registryInnerPlugin, shellModelFactory);
|
||||||
const workspace = new Workspace(innerWorkspace);
|
const workspace: IPublicApiWorkspace = new Workspace(innerWorkspace);
|
||||||
const editor = new Editor();
|
const editor = new Editor();
|
||||||
globalContext.register(editor, Editor);
|
globalContext.register(editor, Editor);
|
||||||
globalContext.register(editor, 'editor');
|
globalContext.register(editor, 'editor');
|
||||||
@ -139,8 +157,6 @@ export {
|
|||||||
logger,
|
logger,
|
||||||
hotkey,
|
hotkey,
|
||||||
common,
|
common,
|
||||||
// 兼容原 editor 的事件功能
|
|
||||||
event as editor,
|
|
||||||
workspace,
|
workspace,
|
||||||
canvas,
|
canvas,
|
||||||
};
|
};
|
||||||
@ -158,7 +174,7 @@ let engineContainer: HTMLElement;
|
|||||||
export const version = VERSION_PLACEHOLDER;
|
export const version = VERSION_PLACEHOLDER;
|
||||||
engineConfig.set('ENGINE_VERSION', version);
|
engineConfig.set('ENGINE_VERSION', version);
|
||||||
|
|
||||||
registryInnerPlugin(designer, editor, plugins);
|
const pluginPromise = registryInnerPlugin(designer, editor, plugins);
|
||||||
|
|
||||||
export async function init(
|
export async function init(
|
||||||
container?: HTMLElement,
|
container?: HTMLElement,
|
||||||
@ -183,10 +199,10 @@ export async function init(
|
|||||||
}
|
}
|
||||||
engineConfig.setEngineOptions(engineOptions as any);
|
engineConfig.setEngineOptions(engineOptions as any);
|
||||||
|
|
||||||
await plugins.init(pluginPreference as any);
|
|
||||||
|
|
||||||
const { Workbench } = common.skeletonCabin;
|
const { Workbench } = common.skeletonCabin;
|
||||||
if (options && options.enableWorkspaceMode) {
|
if (options && options.enableWorkspaceMode) {
|
||||||
|
const disposeFun = await pluginPromise;
|
||||||
|
disposeFun && disposeFun();
|
||||||
render(
|
render(
|
||||||
createElement(WorkSpaceWorkbench, {
|
createElement(WorkSpaceWorkbench, {
|
||||||
workspace: innerWorkspace,
|
workspace: innerWorkspace,
|
||||||
@ -196,12 +212,16 @@ export async function init(
|
|||||||
}),
|
}),
|
||||||
engineContainer,
|
engineContainer,
|
||||||
);
|
);
|
||||||
|
innerWorkspace.enableAutoOpenFirstWindow = engineConfig.get('enableAutoOpenFirstWindow', true);
|
||||||
innerWorkspace.setActive(true);
|
innerWorkspace.setActive(true);
|
||||||
|
innerWorkspace.initWindow();
|
||||||
innerHotkey.activate(false);
|
innerHotkey.activate(false);
|
||||||
await innerWorkspace.plugins.init(pluginPreference);
|
await innerWorkspace.plugins.init(pluginPreference);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await plugins.init(pluginPreference as any);
|
||||||
|
|
||||||
render(
|
render(
|
||||||
createElement(Workbench, {
|
createElement(Workbench, {
|
||||||
skeleton: innerSkeleton,
|
skeleton: innerSkeleton,
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@alilc/lowcode-ignitor",
|
"name": "@alilc/lowcode-ignitor",
|
||||||
"version": "1.1.6",
|
"version": "1.1.7-beta.9",
|
||||||
"description": "点火器,bootstrap lce project",
|
"description": "点火器,bootstrap lce project",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"private": true,
|
"private": true,
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@alilc/lowcode-plugin-designer",
|
"name": "@alilc/lowcode-plugin-designer",
|
||||||
"version": "1.1.6",
|
"version": "1.1.7-beta.9",
|
||||||
"description": "alibaba lowcode editor designer plugin",
|
"description": "alibaba lowcode editor designer plugin",
|
||||||
"files": [
|
"files": [
|
||||||
"es",
|
"es",
|
||||||
@ -18,9 +18,9 @@
|
|||||||
],
|
],
|
||||||
"author": "xiayang.xy",
|
"author": "xiayang.xy",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@alilc/lowcode-designer": "1.1.6",
|
"@alilc/lowcode-designer": "1.1.7-beta.9",
|
||||||
"@alilc/lowcode-editor-core": "1.1.6",
|
"@alilc/lowcode-editor-core": "1.1.7-beta.9",
|
||||||
"@alilc/lowcode-utils": "1.1.6",
|
"@alilc/lowcode-utils": "1.1.7-beta.9",
|
||||||
"react": "^16.8.1",
|
"react": "^16.8.1",
|
||||||
"react-dom": "^16.8.1"
|
"react-dom": "^16.8.1"
|
||||||
},
|
},
|
||||||
@ -37,5 +37,5 @@
|
|||||||
"type": "http",
|
"type": "http",
|
||||||
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/plugin-designer"
|
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/plugin-designer"
|
||||||
},
|
},
|
||||||
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6"
|
"gitHead": "fdb74f0aeb15a30f85387979f620e27dd1673b92"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@alilc/lowcode-plugin-outline-pane",
|
"name": "@alilc/lowcode-plugin-outline-pane",
|
||||||
"version": "1.1.6",
|
"version": "1.1.7-beta.9",
|
||||||
"description": "Outline pane for Ali lowCode engine",
|
"description": "Outline pane for Ali lowCode engine",
|
||||||
"files": [
|
"files": [
|
||||||
"es",
|
"es",
|
||||||
@ -13,10 +13,10 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@alifd/next": "^1.19.16",
|
"@alifd/next": "^1.19.16",
|
||||||
"@alilc/lowcode-designer": "1.1.6",
|
"@alilc/lowcode-designer": "1.1.7-beta.9",
|
||||||
"@alilc/lowcode-editor-core": "1.1.6",
|
"@alilc/lowcode-editor-core": "1.1.7-beta.9",
|
||||||
"@alilc/lowcode-types": "1.1.6",
|
"@alilc/lowcode-types": "1.1.7-beta.9",
|
||||||
"@alilc/lowcode-utils": "1.1.6",
|
"@alilc/lowcode-utils": "1.1.7-beta.9",
|
||||||
"classnames": "^2.2.6",
|
"classnames": "^2.2.6",
|
||||||
"react": "^16",
|
"react": "^16",
|
||||||
"react-dom": "^16.7.0",
|
"react-dom": "^16.7.0",
|
||||||
@ -40,5 +40,5 @@
|
|||||||
"type": "http",
|
"type": "http",
|
||||||
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/plugin-outline-pane"
|
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/plugin-outline-pane"
|
||||||
},
|
},
|
||||||
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6"
|
"gitHead": "fdb74f0aeb15a30f85387979f620e27dd1673b92"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,6 +9,8 @@ import { IPublicModelPluginContext, IPublicModelModalNodesManager, IPublicTypeDi
|
|||||||
class ModalTreeNodeView extends PureComponent<{
|
class ModalTreeNodeView extends PureComponent<{
|
||||||
treeNode: TreeNode;
|
treeNode: TreeNode;
|
||||||
pluginContext: IPublicModelPluginContext;
|
pluginContext: IPublicModelPluginContext;
|
||||||
|
}, {
|
||||||
|
treeChildren: TreeNode[] | null;
|
||||||
}> {
|
}> {
|
||||||
private modalNodesManager: IPublicModelModalNodesManager | undefined | null;
|
private modalNodesManager: IPublicModelModalNodesManager | undefined | null;
|
||||||
readonly pluginContext: IPublicModelPluginContext;
|
readonly pluginContext: IPublicModelPluginContext;
|
||||||
@ -20,18 +22,36 @@ class ModalTreeNodeView extends PureComponent<{
|
|||||||
this.pluginContext = props.pluginContext;
|
this.pluginContext = props.pluginContext;
|
||||||
const { project } = this.pluginContext;
|
const { project } = this.pluginContext;
|
||||||
this.modalNodesManager = project.currentDocument?.modalNodesManager;
|
this.modalNodesManager = project.currentDocument?.modalNodesManager;
|
||||||
|
this.state = {
|
||||||
|
treeChildren: this.rootTreeNode.children,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
hideAllNodes() {
|
hideAllNodes() {
|
||||||
this.modalNodesManager?.hideModalNodes();
|
this.modalNodesManager?.hideModalNodes();
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
componentDidMount(): void {
|
||||||
|
const rootTreeNode = this.rootTreeNode;
|
||||||
|
rootTreeNode.onExpandableChanged(() => {
|
||||||
|
this.setState({
|
||||||
|
treeChildren: rootTreeNode.children,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
get rootTreeNode() {
|
||||||
const { treeNode } = this.props;
|
const { treeNode } = this.props;
|
||||||
// 当指定了新的根节点时,要从原始的根节点去获取模态节点
|
// 当指定了新的根节点时,要从原始的根节点去获取模态节点
|
||||||
const { project } = this.pluginContext;
|
const { project } = this.pluginContext;
|
||||||
const rootNode = project.currentDocument?.root;
|
const rootNode = project.currentDocument?.root;
|
||||||
const rootTreeNode = treeNode.tree.getTreeNode(rootNode!);
|
const rootTreeNode = treeNode.tree.getTreeNode(rootNode!);
|
||||||
|
|
||||||
|
return rootTreeNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const rootTreeNode = this.rootTreeNode;
|
||||||
const { expanded } = rootTreeNode;
|
const { expanded } = rootTreeNode;
|
||||||
|
|
||||||
const hasVisibleModalNode = !!this.modalNodesManager?.getVisibleModalNode();
|
const hasVisibleModalNode = !!this.modalNodesManager?.getVisibleModalNode();
|
||||||
@ -49,7 +69,7 @@ class ModalTreeNodeView extends PureComponent<{
|
|||||||
<div className="tree-pane-modal-content">
|
<div className="tree-pane-modal-content">
|
||||||
<TreeBranches
|
<TreeBranches
|
||||||
treeNode={rootTreeNode}
|
treeNode={rootTreeNode}
|
||||||
treeChildren={rootTreeNode.children}
|
treeChildren={this.state.treeChildren}
|
||||||
expanded={expanded}
|
expanded={expanded}
|
||||||
isModal
|
isModal
|
||||||
pluginContext={this.pluginContext}
|
pluginContext={this.pluginContext}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@alilc/lowcode-rax-renderer",
|
"name": "@alilc/lowcode-rax-renderer",
|
||||||
"version": "1.1.6",
|
"version": "1.1.7-beta.9",
|
||||||
"description": "Rax renderer for Ali lowCode engine",
|
"description": "Rax renderer for Ali lowCode engine",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"module": "es/index.js",
|
"module": "es/index.js",
|
||||||
@ -30,8 +30,8 @@
|
|||||||
"build": "build-scripts build"
|
"build": "build-scripts build"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@alilc/lowcode-renderer-core": "1.1.6",
|
"@alilc/lowcode-renderer-core": "1.1.7-beta.9",
|
||||||
"@alilc/lowcode-utils": "1.1.6",
|
"@alilc/lowcode-utils": "1.1.7-beta.9",
|
||||||
"rax-find-dom-node": "^1.0.1"
|
"rax-find-dom-node": "^1.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@ -49,5 +49,5 @@
|
|||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"homepage": "https://unpkg.alibaba-inc.com/@alilc/lowcode-rax-renderer@0.1.2/build/index.html",
|
"homepage": "https://unpkg.alibaba-inc.com/@alilc/lowcode-rax-renderer@0.1.2/build/index.html",
|
||||||
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6"
|
"gitHead": "fdb74f0aeb15a30f85387979f620e27dd1673b92"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@alilc/lowcode-rax-simulator-renderer",
|
"name": "@alilc/lowcode-rax-simulator-renderer",
|
||||||
"version": "1.1.6",
|
"version": "1.1.7-beta.9",
|
||||||
"description": "rax simulator renderer for alibaba lowcode designer",
|
"description": "rax simulator renderer for alibaba lowcode designer",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"module": "es/index.js",
|
"module": "es/index.js",
|
||||||
@ -13,10 +13,10 @@
|
|||||||
"build:umd": "build-scripts build --config build.umd.json"
|
"build:umd": "build-scripts build --config build.umd.json"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@alilc/lowcode-designer": "1.1.6",
|
"@alilc/lowcode-designer": "1.1.7-beta.9",
|
||||||
"@alilc/lowcode-rax-renderer": "1.1.6",
|
"@alilc/lowcode-rax-renderer": "1.1.7-beta.9",
|
||||||
"@alilc/lowcode-types": "1.1.6",
|
"@alilc/lowcode-types": "1.1.7-beta.9",
|
||||||
"@alilc/lowcode-utils": "1.1.6",
|
"@alilc/lowcode-utils": "1.1.7-beta.9",
|
||||||
"classnames": "^2.2.6",
|
"classnames": "^2.2.6",
|
||||||
"driver-universal": "^3.1.3",
|
"driver-universal": "^3.1.3",
|
||||||
"history": "^5.0.0",
|
"history": "^5.0.0",
|
||||||
@ -50,5 +50,5 @@
|
|||||||
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/rax-simulator-renderer"
|
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/rax-simulator-renderer"
|
||||||
},
|
},
|
||||||
"homepage": "https://unpkg.alibaba-inc.com/@alilc/lowcode-rax-simulator-renderer@1.0.73/build/index.html",
|
"homepage": "https://unpkg.alibaba-inc.com/@alilc/lowcode-rax-simulator-renderer@1.0.73/build/index.html",
|
||||||
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6"
|
"gitHead": "fdb74f0aeb15a30f85387979f620e27dd1673b92"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@alilc/lowcode-react-renderer",
|
"name": "@alilc/lowcode-react-renderer",
|
||||||
"version": "1.1.6",
|
"version": "1.1.7-beta.9",
|
||||||
"description": "react renderer for ali lowcode engine",
|
"description": "react renderer for ali lowcode engine",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"module": "es/index.js",
|
"module": "es/index.js",
|
||||||
@ -22,7 +22,7 @@
|
|||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@alifd/next": "^1.21.16",
|
"@alifd/next": "^1.21.16",
|
||||||
"@alilc/lowcode-renderer-core": "1.1.6"
|
"@alilc/lowcode-renderer-core": "1.1.7-beta.9"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@alib/build-scripts": "^0.1.18",
|
"@alib/build-scripts": "^0.1.18",
|
||||||
@ -42,5 +42,5 @@
|
|||||||
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/react-renderer"
|
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/react-renderer"
|
||||||
},
|
},
|
||||||
"homepage": "https://unpkg.alibaba-inc.com/@alilc/lowcode-react-renderer@1.0.21/build/index.html",
|
"homepage": "https://unpkg.alibaba-inc.com/@alilc/lowcode-react-renderer@1.0.21/build/index.html",
|
||||||
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6"
|
"gitHead": "fdb74f0aeb15a30f85387979f620e27dd1673b92"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@alilc/lowcode-react-simulator-renderer",
|
"name": "@alilc/lowcode-react-simulator-renderer",
|
||||||
"version": "1.1.6",
|
"version": "1.1.7-beta.9",
|
||||||
"description": "react simulator renderer for alibaba lowcode designer",
|
"description": "react simulator renderer for alibaba lowcode designer",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"module": "es/index.js",
|
"module": "es/index.js",
|
||||||
@ -17,10 +17,10 @@
|
|||||||
"test:cov": "build-scripts test --config build.test.json --jest-coverage"
|
"test:cov": "build-scripts test --config build.test.json --jest-coverage"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@alilc/lowcode-designer": "1.1.6",
|
"@alilc/lowcode-designer": "1.1.7-beta.9",
|
||||||
"@alilc/lowcode-react-renderer": "1.1.6",
|
"@alilc/lowcode-react-renderer": "1.1.7-beta.9",
|
||||||
"@alilc/lowcode-types": "1.1.6",
|
"@alilc/lowcode-types": "1.1.7-beta.9",
|
||||||
"@alilc/lowcode-utils": "1.1.6",
|
"@alilc/lowcode-utils": "1.1.7-beta.9",
|
||||||
"classnames": "^2.2.6",
|
"classnames": "^2.2.6",
|
||||||
"mobx": "^6.3.0",
|
"mobx": "^6.3.0",
|
||||||
"mobx-react": "^7.2.0",
|
"mobx-react": "^7.2.0",
|
||||||
@ -43,5 +43,5 @@
|
|||||||
"type": "http",
|
"type": "http",
|
||||||
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/react-simulator-renderer"
|
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/react-simulator-renderer"
|
||||||
},
|
},
|
||||||
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6"
|
"gitHead": "fdb74f0aeb15a30f85387979f620e27dd1673b92"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,6 +11,7 @@ const jestConfig = {
|
|||||||
// },
|
// },
|
||||||
// testMatch: ['(/tests?/.*(test))\\.[jt]s$'],
|
// testMatch: ['(/tests?/.*(test))\\.[jt]s$'],
|
||||||
// testMatch: ['**/*/base.test.tsx'],
|
// testMatch: ['**/*/base.test.tsx'],
|
||||||
|
// testMatch: ['**/utils/common.test.ts'],
|
||||||
transformIgnorePatterns: [
|
transformIgnorePatterns: [
|
||||||
`/node_modules/(?!${esModules})/`,
|
`/node_modules/(?!${esModules})/`,
|
||||||
],
|
],
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@alilc/lowcode-renderer-core",
|
"name": "@alilc/lowcode-renderer-core",
|
||||||
"version": "1.1.6",
|
"version": "1.1.7-beta.9",
|
||||||
"description": "renderer core",
|
"description": "renderer core",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
@ -16,8 +16,8 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@alilc/lowcode-datasource-engine": "^1.0.0",
|
"@alilc/lowcode-datasource-engine": "^1.0.0",
|
||||||
"@alilc/lowcode-types": "1.1.6",
|
"@alilc/lowcode-types": "1.1.7-beta.9",
|
||||||
"@alilc/lowcode-utils": "1.1.6",
|
"@alilc/lowcode-utils": "1.1.7-beta.9",
|
||||||
"classnames": "^2.2.6",
|
"classnames": "^2.2.6",
|
||||||
"debug": "^4.1.1",
|
"debug": "^4.1.1",
|
||||||
"fetch-jsonp": "^1.1.3",
|
"fetch-jsonp": "^1.1.3",
|
||||||
@ -32,7 +32,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@alib/build-scripts": "^0.1.18",
|
"@alib/build-scripts": "^0.1.18",
|
||||||
"@alifd/next": "^1.26.0",
|
"@alifd/next": "^1.26.0",
|
||||||
"@alilc/lowcode-designer": "1.1.6",
|
"@alilc/lowcode-designer": "1.1.7-beta.9",
|
||||||
"@babel/plugin-transform-typescript": "^7.16.8",
|
"@babel/plugin-transform-typescript": "^7.16.8",
|
||||||
"@testing-library/react": "^11.2.2",
|
"@testing-library/react": "^11.2.2",
|
||||||
"@types/classnames": "^2.2.11",
|
"@types/classnames": "^2.2.11",
|
||||||
@ -55,5 +55,5 @@
|
|||||||
"type": "http",
|
"type": "http",
|
||||||
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/renderer-core"
|
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/renderer-core"
|
||||||
},
|
},
|
||||||
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6"
|
"gitHead": "fdb74f0aeb15a30f85387979f620e27dd1673b92"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -102,6 +102,9 @@ function initRerenderEvent({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
cache.event.get(schema.id)?.dispose.forEach((disposeFn: any) => disposeFn && disposeFn());
|
cache.event.get(schema.id)?.dispose.forEach((disposeFn: any) => disposeFn && disposeFn());
|
||||||
|
const debounceRerender = debounce(() => {
|
||||||
|
container.rerender();
|
||||||
|
}, 20);
|
||||||
cache.event.set(schema.id, {
|
cache.event.set(schema.id, {
|
||||||
clear: false,
|
clear: false,
|
||||||
leaf,
|
leaf,
|
||||||
@ -111,21 +114,21 @@ function initRerenderEvent({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
__debug(`${schema.componentName}[${schema.id}] leaf not render in SimulatorRendererView, leaf onPropsChange make rerender`);
|
__debug(`${schema.componentName}[${schema.id}] leaf not render in SimulatorRendererView, leaf onPropsChange make rerender`);
|
||||||
container.rerender();
|
debounceRerender();
|
||||||
}),
|
}),
|
||||||
leaf?.onChildrenChange?.(() => {
|
leaf?.onChildrenChange?.(() => {
|
||||||
if (!container.autoRepaintNode) {
|
if (!container.autoRepaintNode) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
__debug(`${schema.componentName}[${schema.id}] leaf not render in SimulatorRendererView, leaf onChildrenChange make rerender`);
|
__debug(`${schema.componentName}[${schema.id}] leaf not render in SimulatorRendererView, leaf onChildrenChange make rerender`);
|
||||||
container.rerender();
|
debounceRerender();
|
||||||
}) as Function,
|
}) as Function,
|
||||||
leaf?.onVisibleChange?.(() => {
|
leaf?.onVisibleChange?.(() => {
|
||||||
if (!container.autoRepaintNode) {
|
if (!container.autoRepaintNode) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
__debug(`${schema.componentName}[${schema.id}] leaf not render in SimulatorRendererView, leaf onVisibleChange make rerender`);
|
__debug(`${schema.componentName}[${schema.id}] leaf not render in SimulatorRendererView, leaf onVisibleChange make rerender`);
|
||||||
container.rerender();
|
debounceRerender();
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,6 +1,9 @@
|
|||||||
|
import { getLogger } from '@alilc/lowcode-utils';
|
||||||
import baseRendererFactory from './base';
|
import baseRendererFactory from './base';
|
||||||
import { IBaseRendererProps, IBaseRenderComponent } from '../types';
|
import { IBaseRendererProps, IBaseRenderComponent } from '../types';
|
||||||
|
|
||||||
|
const logger = getLogger({ level: 'warn', bizName: 'renderer-core:page' });
|
||||||
|
|
||||||
export default function pageRendererFactory(): IBaseRenderComponent {
|
export default function pageRendererFactory(): IBaseRenderComponent {
|
||||||
const BaseRenderer = baseRendererFactory();
|
const BaseRenderer = baseRendererFactory();
|
||||||
return class PageRenderer extends BaseRenderer {
|
return class PageRenderer extends BaseRenderer {
|
||||||
@ -29,6 +32,11 @@ export default function pageRendererFactory(): IBaseRenderComponent {
|
|||||||
super.componentDidUpdate?.(prevProps, _prevState, snapshot);
|
super.componentDidUpdate?.(prevProps, _prevState, snapshot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setState(state: any, callback?: () => void) {
|
||||||
|
logger.info('page set state', state);
|
||||||
|
super.setState(state, callback);
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { __schema, __components } = this.props;
|
const { __schema, __components } = this.props;
|
||||||
if (this.__checkSchema(__schema)) {
|
if (this.__checkSchema(__schema)) {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@alilc/lowcode-shell",
|
"name": "@alilc/lowcode-shell",
|
||||||
"version": "1.1.6",
|
"version": "1.1.7-beta.9",
|
||||||
"description": "Shell Layer for AliLowCodeEngine",
|
"description": "Shell Layer for AliLowCodeEngine",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"module": "es/index.js",
|
"module": "es/index.js",
|
||||||
@ -15,12 +15,12 @@
|
|||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@alilc/lowcode-designer": "1.1.6",
|
"@alilc/lowcode-designer": "1.1.7-beta.9",
|
||||||
"@alilc/lowcode-editor-core": "1.1.6",
|
"@alilc/lowcode-editor-core": "1.1.7-beta.9",
|
||||||
"@alilc/lowcode-editor-skeleton": "1.1.6",
|
"@alilc/lowcode-editor-skeleton": "1.1.7-beta.9",
|
||||||
"@alilc/lowcode-types": "1.1.6",
|
"@alilc/lowcode-types": "1.1.7-beta.9",
|
||||||
"@alilc/lowcode-utils": "1.1.6",
|
"@alilc/lowcode-utils": "1.1.7-beta.9",
|
||||||
"@alilc/lowcode-workspace": "1.1.6",
|
"@alilc/lowcode-workspace": "1.1.7-beta.9",
|
||||||
"classnames": "^2.2.6",
|
"classnames": "^2.2.6",
|
||||||
"enzyme": "^3.11.0",
|
"enzyme": "^3.11.0",
|
||||||
"enzyme-adapter-react-16": "^1.15.5",
|
"enzyme-adapter-react-16": "^1.15.5",
|
||||||
@ -50,5 +50,5 @@
|
|||||||
"type": "http",
|
"type": "http",
|
||||||
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/shell"
|
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/shell"
|
||||||
},
|
},
|
||||||
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6"
|
"gitHead": "fdb74f0aeb15a30f85387979f620e27dd1673b92"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { editorSymbol, skeletonSymbol, designerCabinSymbol, designerSymbol } from '../symbols';
|
import { editorSymbol, skeletonSymbol, designerCabinSymbol, designerSymbol, settingFieldSymbol } from '../symbols';
|
||||||
import {
|
import {
|
||||||
isFormEvent as innerIsFormEvent,
|
isFormEvent as innerIsFormEvent,
|
||||||
compatibleLegaoSchema as innerCompatibleLegaoSchema,
|
compatibleLegaoSchema as innerCompatibleLegaoSchema,
|
||||||
@ -25,6 +25,7 @@ import {
|
|||||||
IPublicTypeLocationDetailType as InnerLocationDetailType,
|
IPublicTypeLocationDetailType as InnerLocationDetailType,
|
||||||
IPublicApiCommonEditorCabin,
|
IPublicApiCommonEditorCabin,
|
||||||
IPublicModelDragon,
|
IPublicModelDragon,
|
||||||
|
IPublicModelSettingField,
|
||||||
} from '@alilc/lowcode-types';
|
} from '@alilc/lowcode-types';
|
||||||
import {
|
import {
|
||||||
SettingField as InnerSettingField,
|
SettingField as InnerSettingField,
|
||||||
@ -57,6 +58,9 @@ import {
|
|||||||
untracked as innerUntracked,
|
untracked as innerUntracked,
|
||||||
computed as innerComputed,
|
computed as innerComputed,
|
||||||
observer as innerObserver,
|
observer as innerObserver,
|
||||||
|
action as innerAction,
|
||||||
|
runInAction as innerRunInAction,
|
||||||
|
engineConfig as innerEngineConfig,
|
||||||
} from '@alilc/lowcode-editor-core';
|
} from '@alilc/lowcode-editor-core';
|
||||||
import { Dragon as ShellDragon } from '../model';
|
import { Dragon as ShellDragon } from '../model';
|
||||||
import { ReactNode } from 'react';
|
import { ReactNode } from 'react';
|
||||||
@ -168,8 +172,8 @@ class SkeletonCabin implements IPublicApiCommonSkeletonCabin {
|
|||||||
/**
|
/**
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
createSettingFieldView(item: any, field: any) {
|
createSettingFieldView(field: IPublicModelSettingField, fieldEntry: any) {
|
||||||
return innerCreateSettingFieldView(item, field);
|
return innerCreateSettingFieldView((field as any)[settingFieldSymbol] || field, fieldEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -301,6 +305,27 @@ class EditorCabin implements IPublicApiCommonEditorCabin {
|
|||||||
return innerObx;
|
return innerObx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
|
get action() {
|
||||||
|
return innerAction;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
|
get engineConfig() {
|
||||||
|
return innerEngineConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
|
get runInAction() {
|
||||||
|
return innerRunInAction;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -143,9 +143,16 @@ export class Material implements IPublicApiMaterial {
|
|||||||
* 在设计器辅助层增加一个扩展 action
|
* 在设计器辅助层增加一个扩展 action
|
||||||
* @param action
|
* @param action
|
||||||
*/
|
*/
|
||||||
addBuiltinComponentAction(action: IPublicTypeComponentAction) {
|
addBuiltinComponentAction = (action: IPublicTypeComponentAction) => {
|
||||||
this[designerSymbol].componentActions.addBuiltinComponentAction(action);
|
this[designerSymbol].componentActions.addBuiltinComponentAction(action);
|
||||||
}
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 刷新 componentMetasMap,可触发模拟器里的 components 重新构建
|
||||||
|
*/
|
||||||
|
refreshComponentMetasMap = () => {
|
||||||
|
this[designerSymbol].refreshComponentMetasMap();
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 移除设计器辅助层的指定 action
|
* 移除设计器辅助层的指定 action
|
||||||
|
|||||||
@ -18,6 +18,9 @@ import {
|
|||||||
import { DocumentModel as ShellDocumentModel } from '../model';
|
import { DocumentModel as ShellDocumentModel } from '../model';
|
||||||
import { SimulatorHost } from './simulator-host';
|
import { SimulatorHost } from './simulator-host';
|
||||||
import { editorSymbol, projectSymbol, simulatorHostSymbol, documentSymbol } from '../symbols';
|
import { editorSymbol, projectSymbol, simulatorHostSymbol, documentSymbol } from '../symbols';
|
||||||
|
import { getLogger } from '@alilc/lowcode-utils';
|
||||||
|
|
||||||
|
const logger = getLogger({ level: 'warn', bizName: 'shell-project' });
|
||||||
|
|
||||||
const innerProjectSymbol = Symbol('innerProject');
|
const innerProjectSymbol = Symbol('innerProject');
|
||||||
export class Project implements IPublicApiProject {
|
export class Project implements IPublicApiProject {
|
||||||
@ -29,6 +32,10 @@ export class Project implements IPublicApiProject {
|
|||||||
}
|
}
|
||||||
const workspace = globalContext.get('workspace');
|
const workspace = globalContext.get('workspace');
|
||||||
if (workspace.isActive) {
|
if (workspace.isActive) {
|
||||||
|
if (!workspace.window?.innerProject) {
|
||||||
|
logger.error('project api 调用时机出现问题,请检查');
|
||||||
|
return this[innerProjectSymbol];
|
||||||
|
}
|
||||||
return workspace.window.innerProject;
|
return workspace.window.innerProject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,8 +50,8 @@ export class Project implements IPublicApiProject {
|
|||||||
this[innerProjectSymbol] = project;
|
this[innerProjectSymbol] = project;
|
||||||
}
|
}
|
||||||
|
|
||||||
static create(project: InnerProject) {
|
static create(project: InnerProject, workspaceMode: boolean = false) {
|
||||||
return new Project(project);
|
return new Project(project, workspaceMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -231,9 +238,9 @@ export class Project implements IPublicApiProject {
|
|||||||
this[projectSymbol].set('config', {
|
this[projectSymbol].set('config', {
|
||||||
...oldConfig,
|
...oldConfig,
|
||||||
[params[0]]: params[1],
|
[params[0]]: params[1],
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
this[projectSymbol].set('config', params[0])
|
this[projectSymbol].set('config', params[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,10 +1,13 @@
|
|||||||
import { IPublicTypeCustomView, IPublicApiSetters, IPublicTypeRegisteredSetter } from '@alilc/lowcode-types';
|
import { IPublicTypeCustomView, IPublicApiSetters, IPublicTypeRegisteredSetter } from '@alilc/lowcode-types';
|
||||||
import { Setters as InnerSetters, globalContext } from '@alilc/lowcode-editor-core';
|
import { Setters as InnerSetters, globalContext } from '@alilc/lowcode-editor-core';
|
||||||
import { ReactNode } from 'react';
|
import { ReactNode } from 'react';
|
||||||
|
import { getLogger } from '@alilc/lowcode-utils';
|
||||||
|
|
||||||
const innerSettersSymbol = Symbol('setters');
|
const innerSettersSymbol = Symbol('setters');
|
||||||
const settersSymbol = Symbol('setters');
|
const settersSymbol = Symbol('setters');
|
||||||
|
|
||||||
|
const logger = getLogger({ level: 'warn', bizName: 'shell-setters' });
|
||||||
|
|
||||||
export class Setters implements IPublicApiSetters {
|
export class Setters implements IPublicApiSetters {
|
||||||
readonly [innerSettersSymbol]: InnerSetters;
|
readonly [innerSettersSymbol]: InnerSetters;
|
||||||
|
|
||||||
@ -15,6 +18,10 @@ export class Setters implements IPublicApiSetters {
|
|||||||
|
|
||||||
const workspace = globalContext.get('workspace');
|
const workspace = globalContext.get('workspace');
|
||||||
if (workspace.isActive) {
|
if (workspace.isActive) {
|
||||||
|
if (!workspace.window.innerSetters) {
|
||||||
|
logger.error('setter api 调用时机出现问题,请检查');
|
||||||
|
return this[innerSettersSymbol];
|
||||||
|
}
|
||||||
return workspace.window.innerSetters;
|
return workspace.window.innerSetters;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -5,9 +5,12 @@ import {
|
|||||||
} from '@alilc/lowcode-editor-skeleton';
|
} from '@alilc/lowcode-editor-skeleton';
|
||||||
import { skeletonSymbol } from '../symbols';
|
import { skeletonSymbol } from '../symbols';
|
||||||
import { IPublicApiSkeleton, IPublicTypeDisposable, IPublicTypeSkeletonConfig, IPublicTypeWidgetConfigArea } from '@alilc/lowcode-types';
|
import { IPublicApiSkeleton, IPublicTypeDisposable, IPublicTypeSkeletonConfig, IPublicTypeWidgetConfigArea } from '@alilc/lowcode-types';
|
||||||
|
import { getLogger } from '@alilc/lowcode-utils';
|
||||||
|
|
||||||
const innerSkeletonSymbol = Symbol('skeleton');
|
const innerSkeletonSymbol = Symbol('skeleton');
|
||||||
|
|
||||||
|
const logger = getLogger({ level: 'warn', bizName: 'shell-skeleton' });
|
||||||
|
|
||||||
export class Skeleton implements IPublicApiSkeleton {
|
export class Skeleton implements IPublicApiSkeleton {
|
||||||
private readonly [innerSkeletonSymbol]: ISkeleton;
|
private readonly [innerSkeletonSymbol]: ISkeleton;
|
||||||
private readonly pluginName: string;
|
private readonly pluginName: string;
|
||||||
@ -18,6 +21,10 @@ export class Skeleton implements IPublicApiSkeleton {
|
|||||||
}
|
}
|
||||||
const workspace = globalContext.get('workspace');
|
const workspace = globalContext.get('workspace');
|
||||||
if (workspace.isActive) {
|
if (workspace.isActive) {
|
||||||
|
if (!workspace.window.innerSkeleton) {
|
||||||
|
logger.error('skeleton api 调用时机出现问题,请检查');
|
||||||
|
return this[innerSkeletonSymbol];
|
||||||
|
}
|
||||||
return workspace.window.innerSkeleton;
|
return workspace.window.innerSkeleton;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -28,15 +28,22 @@ export class Workspace implements IPublicApiWorkspace {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get window() {
|
get window() {
|
||||||
|
if (!this[workspaceSymbol].window) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return new ShellWindow(this[workspaceSymbol].window);
|
return new ShellWindow(this[workspaceSymbol].window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onWindowRendererReady(fn: () => void): IPublicTypeDisposable {
|
||||||
|
return this[workspaceSymbol].onWindowRendererReady(fn);
|
||||||
|
}
|
||||||
|
|
||||||
registerResourceType(resourceTypeModel: IPublicTypeResourceType): void {
|
registerResourceType(resourceTypeModel: IPublicTypeResourceType): void {
|
||||||
this[workspaceSymbol].registerResourceType(resourceTypeModel);
|
this[workspaceSymbol].registerResourceType(resourceTypeModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
openEditorWindow(resourceName: string, title: string, extra: object, viewName?: string) {
|
openEditorWindow(resourceName: string, title: string, extra: object, viewName?: string, sleep?: boolean): void {
|
||||||
this[workspaceSymbol].openEditorWindow(resourceName, title, extra, viewName);
|
this[workspaceSymbol].openEditorWindow(resourceName, title, extra, viewName, sleep);
|
||||||
}
|
}
|
||||||
|
|
||||||
openEditorWindowById(id: string) {
|
openEditorWindowById(id: string) {
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import {
|
|||||||
SettingTopEntry,
|
SettingTopEntry,
|
||||||
Clipboard,
|
Clipboard,
|
||||||
SettingField,
|
SettingField,
|
||||||
|
Window,
|
||||||
} from './model';
|
} from './model';
|
||||||
import {
|
import {
|
||||||
Project,
|
Project,
|
||||||
@ -50,6 +51,7 @@ export {
|
|||||||
Selection,
|
Selection,
|
||||||
Setters,
|
Setters,
|
||||||
Hotkey,
|
Hotkey,
|
||||||
|
Window,
|
||||||
Skeleton,
|
Skeleton,
|
||||||
SettingField as SettingPropEntry,
|
SettingField as SettingPropEntry,
|
||||||
SettingTopEntry,
|
SettingTopEntry,
|
||||||
|
|||||||
@ -90,7 +90,7 @@ export class DocumentModel implements IPublicModelDocumentModel {
|
|||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
get project(): IPublicApiProject {
|
get project(): IPublicApiProject {
|
||||||
return ShellProject.create(this[documentSymbol].project);
|
return ShellProject.create(this[documentSymbol].project, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -41,4 +41,8 @@ export class Window implements IPublicModelWindow {
|
|||||||
async save() {
|
async save() {
|
||||||
return await this[windowSymbol].save();
|
return await this[windowSymbol].save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get plugins() {
|
||||||
|
return this[windowSymbol].plugins;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@alilc/lowcode-types",
|
"name": "@alilc/lowcode-types",
|
||||||
"version": "1.1.6",
|
"version": "1.1.7-beta.9",
|
||||||
"description": "Types for Ali lowCode engine",
|
"description": "Types for Ali lowCode engine",
|
||||||
"files": [
|
"files": [
|
||||||
"es",
|
"es",
|
||||||
@ -29,5 +29,5 @@
|
|||||||
"type": "http",
|
"type": "http",
|
||||||
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/types"
|
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/types"
|
||||||
},
|
},
|
||||||
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6"
|
"gitHead": "fdb74f0aeb15a30f85387979f620e27dd1673b92"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -122,4 +122,10 @@ export interface IPublicApiMaterial {
|
|||||||
* @param fn
|
* @param fn
|
||||||
*/
|
*/
|
||||||
onChangeAssets(fn: () => void): IPublicTypeDisposable;
|
onChangeAssets(fn: () => void): IPublicTypeDisposable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 刷新 componentMetasMap,可触发模拟器里的 components 重新构建
|
||||||
|
* @since v1.1.7
|
||||||
|
*/
|
||||||
|
refreshComponentMetasMap(): void;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,7 +10,7 @@ export interface IPublicApiWorkspace<
|
|||||||
isActive: boolean;
|
isActive: boolean;
|
||||||
|
|
||||||
/** 当前设计器窗口 */
|
/** 当前设计器窗口 */
|
||||||
window: ModelWindow;
|
window: ModelWindow | null;
|
||||||
|
|
||||||
plugins: Plugins;
|
plugins: Plugins;
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ export interface IPublicApiWorkspace<
|
|||||||
registerResourceType(resourceTypeModel: IPublicTypeResourceType): void;
|
registerResourceType(resourceTypeModel: IPublicTypeResourceType): void;
|
||||||
|
|
||||||
/** 打开视图窗口 */
|
/** 打开视图窗口 */
|
||||||
openEditorWindow(resourceName: string, title: string, extra: Object, viewName?: string): void;
|
openEditorWindow(resourceName: string, title: string, extra: Object, viewName?: string, sleep?: boolean): void;
|
||||||
|
|
||||||
/** 通过视图 id 打开窗口 */
|
/** 通过视图 id 打开窗口 */
|
||||||
openEditorWindowById(id: string): void;
|
openEditorWindowById(id: string): void;
|
||||||
@ -46,4 +46,10 @@ export interface IPublicApiWorkspace<
|
|||||||
|
|
||||||
/** active 窗口变更事件 */
|
/** active 窗口变更事件 */
|
||||||
onChangeActiveWindow(fn: () => void): IPublicTypeDisposable;
|
onChangeActiveWindow(fn: () => void): IPublicTypeDisposable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* window 下的所有视图 renderer ready 事件
|
||||||
|
* @since v1.1.7
|
||||||
|
*/
|
||||||
|
onWindowRendererReady(fn: () => void): IPublicTypeDisposable;
|
||||||
}
|
}
|
||||||
@ -2,6 +2,7 @@ import { RequestHandlersMap } from '@alilc/lowcode-datasource-types';
|
|||||||
import { ComponentType } from 'react';
|
import { ComponentType } from 'react';
|
||||||
|
|
||||||
export interface IPublicTypeEngineOptions {
|
export interface IPublicTypeEngineOptions {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否开启 condition 的能力,默认在设计器中不管 condition 是啥都正常展示
|
* 是否开启 condition 的能力,默认在设计器中不管 condition 是啥都正常展示
|
||||||
* when this is true, node that configured as conditional not renderring
|
* when this is true, node that configured as conditional not renderring
|
||||||
@ -136,8 +137,10 @@ export interface IPublicTypeEngineOptions {
|
|||||||
* 与 react-renderer 的 appHelper 一致,https://lowcode-engine.cn/site/docs/guide/expand/runtime/renderer#apphelper
|
* 与 react-renderer 的 appHelper 一致,https://lowcode-engine.cn/site/docs/guide/expand/runtime/renderer#apphelper
|
||||||
*/
|
*/
|
||||||
appHelper?: {
|
appHelper?: {
|
||||||
|
|
||||||
/** 全局公共函数 */
|
/** 全局公共函数 */
|
||||||
utils?: Record<string, any>;
|
utils?: Record<string, any>;
|
||||||
|
|
||||||
/** 全局常量 */
|
/** 全局常量 */
|
||||||
constants?: Record<string, any>;
|
constants?: Record<string, any>;
|
||||||
};
|
};
|
||||||
@ -168,6 +171,12 @@ export interface IPublicTypeEngineOptions {
|
|||||||
* 开启应用级设计模式
|
* 开启应用级设计模式
|
||||||
*/
|
*/
|
||||||
enableWorkspaceMode?: boolean;
|
enableWorkspaceMode?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @default true
|
||||||
|
* 应用级设计模式下,自动打开第一个窗口
|
||||||
|
*/
|
||||||
|
enableAutoOpenFirstWindow?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,9 +1,20 @@
|
|||||||
module.exports = {
|
const fs = require('fs');
|
||||||
|
const { join } = require('path');
|
||||||
|
const pkgNames = fs.readdirSync(join('..')).filter(pkgName => !pkgName.startsWith('.'));
|
||||||
|
|
||||||
|
const jestConfig = {
|
||||||
moduleFileExtensions: ['ts', 'tsx', 'js', 'json'],
|
moduleFileExtensions: ['ts', 'tsx', 'js', 'json'],
|
||||||
collectCoverage: true,
|
collectCoverage: false,
|
||||||
collectCoverageFrom: [
|
collectCoverageFrom: [
|
||||||
'src/**/*.{ts,tsx}',
|
'src/**/*.ts',
|
||||||
|
'!src/**/*.d.ts',
|
||||||
'!**/node_modules/**',
|
'!**/node_modules/**',
|
||||||
'!**/vendor/**',
|
'!**/vendor/**',
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 只对本仓库内的 pkg 做 mapping
|
||||||
|
jestConfig.moduleNameMapper = {};
|
||||||
|
jestConfig.moduleNameMapper[`^@alilc/lowcode\\-(${pkgNames.join('|')})$`] = '<rootDir>/../$1/src';
|
||||||
|
|
||||||
|
module.exports = jestConfig;
|
||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@alilc/lowcode-utils",
|
"name": "@alilc/lowcode-utils",
|
||||||
"version": "1.1.6",
|
"version": "1.1.7-beta.9",
|
||||||
"description": "Utils for Ali lowCode engine",
|
"description": "Utils for Ali lowCode engine",
|
||||||
"files": [
|
"files": [
|
||||||
"lib",
|
"lib",
|
||||||
@ -14,7 +14,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@alifd/next": "^1.19.16",
|
"@alifd/next": "^1.19.16",
|
||||||
"@alilc/lowcode-types": "1.1.6",
|
"@alilc/lowcode-types": "1.1.7-beta.9",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"mobx": "^6.3.0",
|
"mobx": "^6.3.0",
|
||||||
"react": "^16"
|
"react": "^16"
|
||||||
@ -32,5 +32,5 @@
|
|||||||
"type": "http",
|
"type": "http",
|
||||||
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/utils"
|
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/utils"
|
||||||
},
|
},
|
||||||
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6"
|
"gitHead": "fdb74f0aeb15a30f85387979f620e27dd1673b92"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import { cloneEnumerableProperty } from './clone-enumerable-property';
|
|||||||
|
|
||||||
const hasSymbol = typeof Symbol === 'function' && Symbol.for;
|
const hasSymbol = typeof Symbol === 'function' && Symbol.for;
|
||||||
const REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
const REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
||||||
|
const REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
||||||
|
|
||||||
export function isReactClass(obj: any): obj is ComponentClass<any> {
|
export function isReactClass(obj: any): obj is ComponentClass<any> {
|
||||||
return obj && obj.prototype && (obj.prototype.isReactComponent || obj.prototype instanceof Component);
|
return obj && obj.prototype && (obj.prototype.isReactComponent || obj.prototype instanceof Component);
|
||||||
@ -16,8 +17,16 @@ function isForwardRefType(obj: any): boolean {
|
|||||||
return obj?.$$typeof && obj?.$$typeof === REACT_FORWARD_REF_TYPE;
|
return obj?.$$typeof && obj?.$$typeof === REACT_FORWARD_REF_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isMemoType(obj: any): boolean {
|
||||||
|
return obj?.$$typeof && obj.$$typeof === REACT_MEMO_TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
export function isReactComponent(obj: any): obj is ComponentType<any> {
|
export function isReactComponent(obj: any): obj is ComponentType<any> {
|
||||||
return obj && (isReactClass(obj) || typeof obj === 'function' || isForwardRefType(obj));
|
if (!obj) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Boolean(isReactClass(obj) || typeof obj === 'function' || isForwardRefType(obj) || isMemoType(obj));
|
||||||
}
|
}
|
||||||
|
|
||||||
export function wrapReactClass(view: FunctionComponent) {
|
export function wrapReactClass(view: FunctionComponent) {
|
||||||
|
|||||||
@ -309,8 +309,14 @@ describe('build-component', () => {
|
|||||||
))
|
))
|
||||||
.toEqual({
|
.toEqual({
|
||||||
Button: {
|
Button: {
|
||||||
|
componentsMap: [],
|
||||||
|
componentsTree: [
|
||||||
|
{
|
||||||
componentName: 'Component',
|
componentName: 'Component',
|
||||||
schema: {},
|
schema: {},
|
||||||
|
}
|
||||||
|
],
|
||||||
|
version: "",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|||||||
38
packages/utils/test/src/is-react.test.ts
Normal file
38
packages/utils/test/src/is-react.test.ts
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
import React from "react";
|
||||||
|
import { isReactComponent, wrapReactClass } from "../../src/is-react";
|
||||||
|
|
||||||
|
class reactDemo extends React.Component {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
const reactMemo = React.memo(reactDemo);
|
||||||
|
|
||||||
|
const reactForwardRef = React.forwardRef((props, ref): any => {
|
||||||
|
return '';
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('is-react-ut', () => {
|
||||||
|
it('isReactComponent', () => {
|
||||||
|
expect(isReactComponent(null)).toBeFalsy();
|
||||||
|
expect(isReactComponent(() => {})).toBeTruthy();
|
||||||
|
expect(isReactComponent({
|
||||||
|
$$typeof: Symbol.for('react.memo')
|
||||||
|
})).toBeTruthy();
|
||||||
|
expect(isReactComponent({
|
||||||
|
$$typeof: Symbol.for('react.forward_ref')
|
||||||
|
})).toBeTruthy();
|
||||||
|
expect(isReactComponent(reactDemo)).toBeTruthy();
|
||||||
|
expect(isReactComponent(reactMemo)).toBeTruthy();
|
||||||
|
expect(isReactComponent(reactForwardRef)).toBeTruthy();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
it('wrapReactClass', () => {
|
||||||
|
const wrap = wrapReactClass(() => {});
|
||||||
|
expect(isReactComponent(wrap)).toBeTruthy();
|
||||||
|
|
||||||
|
const fun = () => {};
|
||||||
|
fun.displayName = 'mock';
|
||||||
|
expect(wrapReactClass(fun).displayName).toBe('mock');
|
||||||
|
})
|
||||||
|
})
|
||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@alilc/lowcode-workspace",
|
"name": "@alilc/lowcode-workspace",
|
||||||
"version": "1.1.6",
|
"version": "1.1.7-beta.9",
|
||||||
"description": "Shell Layer for AliLowCodeEngine",
|
"description": "Shell Layer for AliLowCodeEngine",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"module": "es/index.js",
|
"module": "es/index.js",
|
||||||
@ -15,11 +15,11 @@
|
|||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@alilc/lowcode-designer": "1.1.6",
|
"@alilc/lowcode-designer": "1.1.7-beta.9",
|
||||||
"@alilc/lowcode-editor-core": "1.1.6",
|
"@alilc/lowcode-editor-core": "1.1.7-beta.9",
|
||||||
"@alilc/lowcode-editor-skeleton": "1.1.6",
|
"@alilc/lowcode-editor-skeleton": "1.1.7-beta.9",
|
||||||
"@alilc/lowcode-types": "1.1.6",
|
"@alilc/lowcode-types": "1.1.7-beta.9",
|
||||||
"@alilc/lowcode-utils": "1.1.6",
|
"@alilc/lowcode-utils": "1.1.7-beta.9",
|
||||||
"classnames": "^2.2.6",
|
"classnames": "^2.2.6",
|
||||||
"enzyme": "^3.11.0",
|
"enzyme": "^3.11.0",
|
||||||
"enzyme-adapter-react-16": "^1.15.5",
|
"enzyme-adapter-react-16": "^1.15.5",
|
||||||
@ -49,5 +49,5 @@
|
|||||||
"type": "http",
|
"type": "http",
|
||||||
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/shell"
|
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/shell"
|
||||||
},
|
},
|
||||||
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6"
|
"gitHead": "fdb74f0aeb15a30f85387979f620e27dd1673b92"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -30,6 +30,7 @@ import {
|
|||||||
Common,
|
Common,
|
||||||
Logger,
|
Logger,
|
||||||
Workspace,
|
Workspace,
|
||||||
|
Window,
|
||||||
Canvas,
|
Canvas,
|
||||||
} from '@alilc/lowcode-shell';
|
} from '@alilc/lowcode-shell';
|
||||||
import {
|
import {
|
||||||
@ -164,6 +165,9 @@ export class BasicContext implements IBasicContext {
|
|||||||
context.plugins = plugins;
|
context.plugins = plugins;
|
||||||
context.logger = new Logger({ level: 'warn', bizName: `plugin:${pluginName}` });
|
context.logger = new Logger({ level: 'warn', bizName: `plugin:${pluginName}` });
|
||||||
context.canvas = canvas;
|
context.canvas = canvas;
|
||||||
|
if (editorWindow) {
|
||||||
|
context.editorWindow = new Window(editorWindow);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -17,10 +17,6 @@ export class Context extends BasicContext {
|
|||||||
|
|
||||||
@obx isInit: boolean = false;
|
@obx isInit: boolean = false;
|
||||||
|
|
||||||
@computed get active() {
|
|
||||||
return this._activate;
|
|
||||||
}
|
|
||||||
|
|
||||||
init = flow(function* (this: Context) {
|
init = flow(function* (this: Context) {
|
||||||
if (this.viewType === 'webview') {
|
if (this.viewType === 'webview') {
|
||||||
const url = yield this.instance?.url?.();
|
const url = yield this.instance?.url?.();
|
||||||
@ -43,6 +39,18 @@ export class Context extends BasicContext {
|
|||||||
makeObservable(this);
|
makeObservable(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@computed get active() {
|
||||||
|
return this._activate;
|
||||||
|
}
|
||||||
|
|
||||||
|
onSimulatorRendererReady = (): Promise<void> => {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
this.project.onSimulatorRendererReady(() => {
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
setActivate = (_activate: boolean) => {
|
setActivate = (_activate: boolean) => {
|
||||||
this._activate = _activate;
|
this._activate = _activate;
|
||||||
this.innerHotkey.activate(this._activate);
|
this.innerHotkey.activate(this._activate);
|
||||||
|
|||||||
@ -368,6 +368,9 @@ body {
|
|||||||
right: 0;
|
right: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
|
flex-direction: column;
|
||||||
|
display: flex;
|
||||||
|
align-content: stretch;
|
||||||
}
|
}
|
||||||
|
|
||||||
.engine-actionitem {
|
.engine-actionitem {
|
||||||
|
|||||||
@ -47,7 +47,7 @@ export class Workbench extends Component<{
|
|||||||
{
|
{
|
||||||
workspace.windows.map(d => (
|
workspace.windows.map(d => (
|
||||||
<WindowView
|
<WindowView
|
||||||
active={d.id === workspace.window.id}
|
active={d.id === workspace.window?.id}
|
||||||
window={d}
|
window={d}
|
||||||
key={d.id}
|
key={d.id}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@ -39,7 +39,7 @@ export class Resource implements IResource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get viewName() {
|
get viewName() {
|
||||||
return this.resourceData.viewName || (this.resourceData as any).viewType;
|
return this.resourceData.viewName || (this.resourceData as any).viewType || this.defaultViewType;
|
||||||
}
|
}
|
||||||
|
|
||||||
get description() {
|
get description() {
|
||||||
|
|||||||
@ -10,6 +10,7 @@ interface IWindowCOnfig {
|
|||||||
title: string | undefined;
|
title: string | undefined;
|
||||||
options?: Object;
|
options?: Object;
|
||||||
viewType?: string | undefined;
|
viewType?: string | undefined;
|
||||||
|
sleep?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IEditorWindow extends Omit<IPublicModelWindow<IResource>, 'changeViewType'> {
|
export interface IEditorWindow extends Omit<IPublicModelWindow<IResource>, 'changeViewType'> {
|
||||||
@ -18,6 +19,12 @@ export interface IEditorWindow extends Omit<IPublicModelWindow<IResource>, 'chan
|
|||||||
editorViews: Map<string, Context>;
|
editorViews: Map<string, Context>;
|
||||||
|
|
||||||
changeViewType: (name: string, ignoreEmit?: boolean) => void;
|
changeViewType: (name: string, ignoreEmit?: boolean) => void;
|
||||||
|
|
||||||
|
initReady: boolean;
|
||||||
|
|
||||||
|
sleep?: boolean;
|
||||||
|
|
||||||
|
init(): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class EditorWindow implements IEditorWindow {
|
export class EditorWindow implements IEditorWindow {
|
||||||
@ -36,11 +43,16 @@ export class EditorWindow implements IEditorWindow {
|
|||||||
|
|
||||||
@obx initReady = false;
|
@obx initReady = false;
|
||||||
|
|
||||||
|
sleep: boolean | undefined;
|
||||||
|
|
||||||
constructor(readonly resource: IResource, readonly workspace: IWorkspace, private config: IWindowCOnfig) {
|
constructor(readonly resource: IResource, readonly workspace: IWorkspace, private config: IWindowCOnfig) {
|
||||||
makeObservable(this);
|
makeObservable(this);
|
||||||
this.init();
|
|
||||||
this.title = config.title;
|
this.title = config.title;
|
||||||
this.icon = resource.icon;
|
this.icon = resource.icon;
|
||||||
|
this.sleep = config.sleep;
|
||||||
|
if (!config.sleep) {
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async importSchema(schema: any) {
|
async importSchema(schema: any) {
|
||||||
@ -70,9 +82,14 @@ export class EditorWindow implements IEditorWindow {
|
|||||||
async init() {
|
async init() {
|
||||||
await this.initViewTypes();
|
await this.initViewTypes();
|
||||||
await this.execViewTypesInit();
|
await this.execViewTypesInit();
|
||||||
|
Promise.all(Array.from(this.editorViews.values()).map((d) => d.onSimulatorRendererReady)).then(() => {
|
||||||
|
this.workspace.emitWindowRendererReady();
|
||||||
|
});
|
||||||
this.url = await this.resource.url();
|
this.url = await this.resource.url();
|
||||||
this.setDefaultViewType();
|
this.setDefaultViewType();
|
||||||
this.initReady = true;
|
this.initReady = true;
|
||||||
|
this.workspace.checkWindowQueue();
|
||||||
|
this.sleep = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
initViewTypes = async () => {
|
initViewTypes = async () => {
|
||||||
@ -168,6 +185,10 @@ export class EditorWindow implements IEditorWindow {
|
|||||||
return this.editorView?.designer;
|
return this.editorView?.designer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get plugins() {
|
||||||
|
return this.editorView?.plugins;
|
||||||
|
}
|
||||||
|
|
||||||
get innerPlugins() {
|
get innerPlugins() {
|
||||||
return this.editorView?.innerPlugins;
|
return this.editorView?.innerPlugins;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { IDesigner, ILowCodePluginManager, LowCodePluginManager } from '@alilc/lowcode-designer';
|
import { IDesigner, ILowCodePluginManager, LowCodePluginManager } from '@alilc/lowcode-designer';
|
||||||
import { createModuleEventBus, Editor, IEventBus, makeObservable, obx } from '@alilc/lowcode-editor-core';
|
import { createModuleEventBus, Editor, IEditor, IEventBus, makeObservable, obx } from '@alilc/lowcode-editor-core';
|
||||||
import { IPublicApiPlugins, IPublicApiWorkspace, IPublicResourceList, IPublicTypeResourceType, IShellModelFactory } from '@alilc/lowcode-types';
|
import { IPublicApiPlugins, IPublicApiWorkspace, IPublicResourceList, IPublicTypeDisposable, IPublicTypeResourceType, IShellModelFactory } from '@alilc/lowcode-types';
|
||||||
import { BasicContext } from './context/base-context';
|
import { BasicContext } from './context/base-context';
|
||||||
import { EditorWindow } from './window';
|
import { EditorWindow } from './window';
|
||||||
import type { IEditorWindow } from './window';
|
import type { IEditorWindow } from './window';
|
||||||
@ -11,6 +11,8 @@ enum EVENT {
|
|||||||
CHANGE_WINDOW = 'change_window',
|
CHANGE_WINDOW = 'change_window',
|
||||||
|
|
||||||
CHANGE_ACTIVE_WINDOW = 'change_active_window',
|
CHANGE_ACTIVE_WINDOW = 'change_active_window',
|
||||||
|
|
||||||
|
WINDOW_RENDER_READY = 'window_render_ready',
|
||||||
}
|
}
|
||||||
|
|
||||||
const CHANGE_EVENT = 'resource.list.change';
|
const CHANGE_EVENT = 'resource.list.change';
|
||||||
@ -19,10 +21,12 @@ export interface IWorkspace extends Omit<IPublicApiWorkspace<
|
|||||||
LowCodePluginManager,
|
LowCodePluginManager,
|
||||||
IEditorWindow
|
IEditorWindow
|
||||||
>, 'resourceList' | 'plugins'> {
|
>, 'resourceList' | 'plugins'> {
|
||||||
readonly registryInnerPlugin: (designer: IDesigner, editor: Editor, plugins: IPublicApiPlugins) => Promise<void>;
|
readonly registryInnerPlugin: (designer: IDesigner, editor: Editor, plugins: IPublicApiPlugins) => Promise<IPublicTypeDisposable>;
|
||||||
|
|
||||||
readonly shellModelFactory: IShellModelFactory;
|
readonly shellModelFactory: IShellModelFactory;
|
||||||
|
|
||||||
|
enableAutoOpenFirstWindow: boolean;
|
||||||
|
|
||||||
window: IEditorWindow;
|
window: IEditorWindow;
|
||||||
|
|
||||||
plugins: ILowCodePluginManager;
|
plugins: ILowCodePluginManager;
|
||||||
@ -30,11 +34,21 @@ export interface IWorkspace extends Omit<IPublicApiWorkspace<
|
|||||||
getResourceList(): IResource[];
|
getResourceList(): IResource[];
|
||||||
|
|
||||||
getResourceType(resourceName: string): IResourceType;
|
getResourceType(resourceName: string): IResourceType;
|
||||||
|
|
||||||
|
checkWindowQueue(): void;
|
||||||
|
|
||||||
|
emitWindowRendererReady(): void;
|
||||||
|
|
||||||
|
initWindow(): void;
|
||||||
|
|
||||||
|
setActive(active: boolean): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Workspace implements IWorkspace {
|
export class Workspace implements IWorkspace {
|
||||||
context: BasicContext;
|
context: BasicContext;
|
||||||
|
|
||||||
|
enableAutoOpenFirstWindow: boolean;
|
||||||
|
|
||||||
private emitter: IEventBus = createModuleEventBus('workspace');
|
private emitter: IEventBus = createModuleEventBus('workspace');
|
||||||
|
|
||||||
private _isActive = false;
|
private _isActive = false;
|
||||||
@ -69,30 +83,43 @@ export class Workspace implements IWorkspace {
|
|||||||
|
|
||||||
@obx.ref window: IEditorWindow;
|
@obx.ref window: IEditorWindow;
|
||||||
|
|
||||||
|
windowQueue: {
|
||||||
|
name: string;
|
||||||
|
title: string;
|
||||||
|
options: Object;
|
||||||
|
viewType?: string;
|
||||||
|
}[] = [];
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
readonly registryInnerPlugin: (designer: IDesigner, editor: Editor, plugins: IPublicApiPlugins) => Promise<void>,
|
readonly registryInnerPlugin: (designer: IDesigner, editor: IEditor, plugins: IPublicApiPlugins) => Promise<IPublicTypeDisposable>,
|
||||||
readonly shellModelFactory: any,
|
readonly shellModelFactory: any,
|
||||||
) {
|
) {
|
||||||
this.init();
|
this.context = new BasicContext(this, '');
|
||||||
makeObservable(this);
|
makeObservable(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
init() {
|
checkWindowQueue() {
|
||||||
this.initWindow();
|
if (!this.windowQueue || !this.windowQueue.length) {
|
||||||
this.context = new BasicContext(this, '');
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const windowInfo = this.windowQueue.shift();
|
||||||
|
if (windowInfo) {
|
||||||
|
this.openEditorWindow(windowInfo.name, windowInfo.title, windowInfo.options, windowInfo.viewType);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
initWindow() {
|
initWindow() {
|
||||||
if (!this.defaultResourceType) {
|
if (!this.defaultResourceType || this.enableAutoOpenFirstWindow === false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const title = this.defaultResourceType.name;
|
const resourceName = this.defaultResourceType.name;
|
||||||
const resource = new Resource({
|
const resource = new Resource({
|
||||||
resourceName: title,
|
resourceName,
|
||||||
options: {},
|
options: {},
|
||||||
}, this.defaultResourceType, this);
|
}, this.defaultResourceType, this);
|
||||||
this.window = new EditorWindow(resource, this, {
|
this.window = new EditorWindow(resource, this, {
|
||||||
title,
|
title: resource.title,
|
||||||
});
|
});
|
||||||
this.editorWindowMap.set(this.window.id, this.window);
|
this.editorWindowMap.set(this.window.id, this.window);
|
||||||
this.windows.push(this.window);
|
this.windows.push(this.window);
|
||||||
@ -108,7 +135,7 @@ export class Workspace implements IWorkspace {
|
|||||||
const resourceType = new ResourceType(resourceTypeModel);
|
const resourceType = new ResourceType(resourceTypeModel);
|
||||||
this.resourceTypeMap.set(resourceTypeModel.resourceName, resourceType);
|
this.resourceTypeMap.set(resourceTypeModel.resourceName, resourceType);
|
||||||
|
|
||||||
if (!this.window && this.defaultResourceType) {
|
if (!this.window && this.defaultResourceType && this._isActive) {
|
||||||
this.initWindow();
|
this.initWindow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -129,6 +156,17 @@ export class Workspace implements IWorkspace {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onWindowRendererReady(fn: () => void): IPublicTypeDisposable {
|
||||||
|
this.emitter.on(EVENT.WINDOW_RENDER_READY, fn);
|
||||||
|
return () => {
|
||||||
|
this.emitter.off(EVENT.WINDOW_RENDER_READY, fn);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
emitWindowRendererReady() {
|
||||||
|
this.emitter.emit(EVENT.WINDOW_RENDER_READY);
|
||||||
|
}
|
||||||
|
|
||||||
getResourceType(resourceName: string): IResourceType {
|
getResourceType(resourceName: string): IResourceType {
|
||||||
return this.resourceTypeMap.get(resourceName)!;
|
return this.resourceTypeMap.get(resourceName)!;
|
||||||
}
|
}
|
||||||
@ -167,7 +205,13 @@ export class Workspace implements IWorkspace {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
openEditorWindow(name: string, title: string, options: Object, viewType?: string) {
|
openEditorWindow(name: string, title: string, options: Object, viewType?: string, sleep?: boolean) {
|
||||||
|
if (this.window && !this.window?.initReady && !sleep) {
|
||||||
|
this.windowQueue.push({
|
||||||
|
name, title, options, viewType,
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
const resourceType = this.resourceTypeMap.get(name);
|
const resourceType = this.resourceTypeMap.get(name);
|
||||||
if (!resourceType) {
|
if (!resourceType) {
|
||||||
console.error(`${name} resourceType is not available`);
|
console.error(`${name} resourceType is not available`);
|
||||||
@ -176,6 +220,11 @@ export class Workspace implements IWorkspace {
|
|||||||
const filterWindows = this.windows.filter(d => (d.resource?.name === name && d.resource.title == title));
|
const filterWindows = this.windows.filter(d => (d.resource?.name === name && d.resource.title == title));
|
||||||
if (filterWindows && filterWindows.length) {
|
if (filterWindows && filterWindows.length) {
|
||||||
this.window = filterWindows[0];
|
this.window = filterWindows[0];
|
||||||
|
if (!sleep && this.window.sleep) {
|
||||||
|
this.window.init();
|
||||||
|
} else {
|
||||||
|
this.checkWindowQueue();
|
||||||
|
}
|
||||||
this.emitChangeActiveWindow();
|
this.emitChangeActiveWindow();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -184,13 +233,17 @@ export class Workspace implements IWorkspace {
|
|||||||
title,
|
title,
|
||||||
options,
|
options,
|
||||||
}, resourceType, this);
|
}, resourceType, this);
|
||||||
this.window = new EditorWindow(resource, this, {
|
const window = new EditorWindow(resource, this, {
|
||||||
title,
|
title,
|
||||||
options,
|
options,
|
||||||
viewType,
|
viewType,
|
||||||
|
sleep,
|
||||||
});
|
});
|
||||||
this.windows = [...this.windows, this.window];
|
this.windows = [...this.windows, window];
|
||||||
this.editorWindowMap.set(this.window.id, this.window);
|
this.editorWindowMap.set(window.id, window);
|
||||||
|
if (!sleep) {
|
||||||
|
this.window = window;
|
||||||
|
}
|
||||||
this.emitChangeWindow();
|
this.emitChangeWindow();
|
||||||
this.emitChangeActiveWindow();
|
this.emitChangeActiveWindow();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user