Compare commits

...

34 Commits

Author SHA1 Message Date
JackLian
285f9e0eb4 chore(release): publish 1.1.8-beta.6 2023-07-04 10:36:03 +08:00
eightHundreds
f82d04a4e6 fix: change the return result type to Promise 2023-07-04 10:20:51 +08:00
Rainke
c5dac6e0b5 fix: the selectionDispose function is never executed 2023-07-04 10:20:51 +08:00
liujuping
924092119a fix: lerna version to 4.0.0 2023-07-04 10:20:51 +08:00
Rainke
eeb406c36a remove duplicate code 2023-07-04 10:20:51 +08:00
LiGuangNian
7329c8ed5e Update material.md
loadIncrementalAssets返回的应当是Promise<void>
2023-07-04 10:20:51 +08:00
JackLian
578b28a704 chore(release): publish 1.1.8-beta.5 2023-06-15 10:14:13 +08:00
eightHundreds
e09c928fe2 feat: make appHelper observable (#2186)
* feat: make appHelper observable
2023-06-15 10:05:44 +08:00
JackLian
b95b471388 chore(docs): publish 1.0.32 2023-06-15 10:05:44 +08:00
JackLian
d8acd2c953 chore(release): publish 1.1.8-beta.4 2023-06-13 11:31:38 +08:00
liujuping
1c06c31ecb fix(render-core): fix when designMode is false & loop is null, isUseLoop should return true 2023-06-13 11:29:31 +08:00
liujuping
642fc8393e feat(workspace): add editorViews to resourceTypeList api 2023-06-13 11:29:30 +08:00
stefan-ysh
800c84608e fix: Corrected a misspelling in the docs 2023-06-13 11:29:30 +08:00
LeoYuan 袁力皓
ed922bea3d chore(release): code-generator - 1.1.4 2023-06-13 11:29:30 +08:00
eternalsky
f8c503b8bf fix(code-generator): upgrade prettier parser from babel to babel-ts, fix some ts parse error (#2166) 2023-06-13 11:29:30 +08:00
ChiZng
4aea299aa9 doc(projectapi): 删除重复的getCurrentDocument方法 2023-06-13 11:29:30 +08:00
yifanwww
7952c1c87a fix(lowcode-types): allow template field in supports.events 2023-06-13 11:29:29 +08:00
JackLian
8eb536bd21 chore(release): publish 1.1.8-beta.3 2023-06-08 13:25:55 +08:00
liujuping
3df03b6f80 fix: fix the problem caused by props.children is [] by default in leaf 2023-06-08 13:23:37 +08:00
JackLian
b5070a2721 chore(release): publish 1.1.8-beta.2 2023-06-08 09:58:49 +08:00
liujuping
469c7844b2 fix(outline-pane): tree does not change when doc.importSchema call 2023-06-08 09:55:02 +08:00
xiaohuoni
ba4b3110e7 chore: set repo 2023-06-08 09:55:01 +08:00
JackLian
19b886d2a7 chore(docs): publish 1.0.31 2023-06-08 09:55:01 +08:00
JackLian
60bf22a367 chore(release): publish 1.1.8-beta.1 2023-06-07 17:25:21 +08:00
刘菊萍(絮黎)
4b43ca67fa feat(workspace): add resourceTypeList api (#2148) 2023-06-07 17:22:27 +08:00
刘菊萍(絮黎)
124f91d546 feat: add config.customPluginTransducer to debugger plugins (#2147) 2023-06-07 17:22:27 +08:00
林轩
40164ea27d docs: fix link issue
markdown语法少了个[
2023-06-07 17:22:26 +08:00
LeoYuan 袁力皓
4cb43210a5 chore(release): code-generator - 1.1.3 2023-06-07 17:22:26 +08:00
eternalsky
34eec71c42 fix: invalid jsx attr name error (#2131) 2023-06-07 17:22:26 +08:00
LeoYuan 袁力皓
64db350216 fix(code-gen): fix types error 2023-06-07 17:22:26 +08:00
liujuping
cb0b9771f4 feat: add componentMeta?.advanced?.callbacks?.onSelectHook api 2023-06-07 17:22:26 +08:00
Cai HongYuan
a95bd10f62 Update pluginContextMenu.md (#2108)
* update pluginContextMenu.md
2023-06-07 17:22:25 +08:00
knight.chen
fe8169f182 feat: extract simulator type 2023-06-07 17:22:25 +08:00
JackLian
d7b4fe2e3c chore(release): publish 1.1.8-beta.0 2023-06-01 14:14:29 +08:00
65 changed files with 475 additions and 190 deletions

View File

@ -102,7 +102,7 @@ material.getAssets();
* @param incrementalAssets
* @returns
*/
loadIncrementalAssets(incrementalAssets: IPublicTypeAssetsJson): void;
loadIncrementalAssets(incrementalAssets: IPublicTypeAssetsJson): Promise<void>;
```
相关类型:[IPublicTypeAssetsJson](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/assets-json.ts)

View File

@ -182,19 +182,6 @@ importSchema(schema?: IPublicTypeProjectSchema): void;
```
相关类型:[IPublicTypeProjectSchema](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/project-schema.ts)
### getCurrentDocument
获取当前的 document
```typescript
/**
* 获取当前的 document
* get current document
* @returns
*/
getCurrentDocument(): IPublicModelDocumentModel | null;
```
相关类型:[IPublicModelDocumentModel](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/document-model.ts)
### addPropsTransducer
增加一个属性的管道处理函数

View File

@ -22,7 +22,7 @@ sidebar_position: 4
![image.png](https://img.alicdn.com/imgextra/i1/O1CN01i4IiSR1cMtUFXaWQq_!!6000000003587-2-tps-1686-1062.png)
- 协议层:基于《低代码引擎搭建协议规范》](/site/docs/specs/lowcode-spec) 产出的 Schema 作为我们的规范协议。
- 协议层:基于[《低代码引擎搭建协议规范》](/site/docs/specs/lowcode-spec) 产出的 Schema 作为我们的规范协议。
- 能力层:提供组件、区块、页面等渲染所需的核心能力,包括 Props 解析、样式注入、条件渲染等。
- 适配层:由于我们使用的运行时框架不是统一的,所以统一使用适配层将不同运行框架的差异部分,通过接口对外,让渲染层注册/适配对应所需的方法。能保障渲染层和能力层直接通过适配层连接起来,能起到独立可扩展的作用。
- 渲染层:提供核心的渲染方法,由于不同运行时框架提供的渲染方法是不同的,所以其通过适配层进行注入,只需要提供适配层所需的接口,即可实现渲染。

View File

@ -32,7 +32,7 @@ sidebar_position: 6
### SettingTarget 抽象
如果不是多选,可以直接暴露 `Node` 给到这,但涉及多选编辑的时候,大家的值通常是不一样的,设置的时候需要批量设置进去,这里主要封装这些逻辑,把多选编辑的复杂性屏蔽掉。
如果不是多选,可以直接暴露 `Node` 给到这,但涉及多选编辑的时候,大家的值通常是不一样的,设置的时候需要批量设置进去,这里主要封装这些逻辑,把多选编辑的复杂性屏蔽掉。
所选节点所构成的**设置对象**抽象如下:

View File

@ -18,8 +18,7 @@ import { Icon, Message } from '@alifd/next';
const addHelloAction = (ctx: IPublicModelPluginContext) => {
return {
async init() {
const { addBuiltinComponentAction } = ctx.material;
addBuiltinComponentAction({
ctx.material.addBuiltinComponentAction({
name: 'hello',
content: {
icon: <Icon type="atm" />,
@ -54,8 +53,7 @@ import { IPublicModelPluginContext } from '@alilc/lowcode-types';
const removeCopyAction = (ctx: IPublicModelPluginContext) => {
return {
async init() {
const { removeBuiltinComponentAction } = ctx.material;
removeBuiltinComponentAction('copy');
ctx.material.removeBuiltinComponentAction('copy');
}
}
};

View File

@ -1,6 +1,6 @@
{
"name": "@alilc/lowcode-engine-docs",
"version": "1.0.30",
"version": "1.0.32",
"description": "低代码引擎版本化文档",
"license": "MIT",
"files": [

View File

@ -1,6 +1,6 @@
{
"lerna": "4.0.0",
"version": "1.1.7",
"version": "1.1.8-beta.6",
"npmClient": "yarn",
"useWorkspaces": true,
"packages": [

View File

@ -1,6 +1,6 @@
{
"name": "@alilc/lowcode-code-generator",
"version": "1.1.2",
"version": "1.1.4",
"description": "出码引擎 for LowCode Engine",
"license": "MIT",
"main": "lib/index.js",
@ -144,5 +144,10 @@
"access": "public",
"registry": "https://registry.npmjs.org/"
},
"repository": "git@github.com:alibaba/lowcode-engine.git"
"repository": {
"type": "http",
"url": "https://github.com/alibaba/lowcode-engine/tree/main/modules/code-generator"
},
"bugs": "https://github.com/alibaba/lowcode-engine/issues",
"homepage": "https://github.com/alibaba/lowcode-engine/#readme"
}

View File

@ -21,7 +21,7 @@ const factory: PostProcessorFactory<ProcessorConfig> = (config?: ProcessorConfig
const codePrettier: PostProcessor = (content: string, fileType: string) => {
let parser: prettier.BuiltInParserName | any;
if (fileType === 'js' || fileType === 'jsx' || fileType === 'ts' || fileType === 'tsx') {
parser = 'babel';
parser = 'babel-ts';
} else if (fileType === 'json') {
parser = 'json-stringify';
} else if (PARSERS.indexOf(fileType) >= 0) {

View File

@ -167,7 +167,7 @@ export function parseExpressionGetKeywords(expr: string | null | undefined): str
],
});
const addIdentifierIfNeeded = (x: Record<string, unknown> | number | null | undefined) => {
const addIdentifierIfNeeded = (x: Node | null | undefined) => {
if (typeof x === 'object' && isIdentifier(x) && JS_KEYWORDS.includes(x.name)) {
keywordVars.add(x.name);
}
@ -189,7 +189,7 @@ export function parseExpressionGetKeywords(expr: string | null | undefined): str
addIdentifierIfNeeded(item);
});
} else {
addIdentifierIfNeeded(fieldValue as Record<string, unknown> | null);
addIdentifierIfNeeded(fieldValue as any);
}
}
});
@ -217,7 +217,7 @@ export function parseExpressionGetGlobalVariables(
const ast = parser.parse(`!(${expr});`);
const addUndeclaredIdentifierIfNeeded = (
x: Record<string, unknown> | number | null | undefined,
x: Node | null | undefined,
path: NodePath<Node>,
) => {
if (typeof x === 'object' && isIdentifier(x) && !path.scope.hasBinding(x.name)) {
@ -241,7 +241,7 @@ export function parseExpressionGetGlobalVariables(
addUndeclaredIdentifierIfNeeded(item, path);
});
} else {
addUndeclaredIdentifierIfNeeded(fieldValue as Record<string, unknown> | null, path);
addUndeclaredIdentifierIfNeeded(fieldValue as any, path);
}
}
});

View File

@ -19,6 +19,7 @@ import { executeFunctionStack } from './aopHelper';
import { encodeJsxStringNode } from './encodeJsxAttrString';
import { unwrapJsExprQuoteInJsx } from './jsxHelpers';
import { transformThis2Context } from '../core/jsx/handlers/transformThis2Context';
import { isValidIdentifier } from './validate';
function mergeNodeGeneratorConfig(
cfg1: NodeGeneratorConfig,
@ -126,11 +127,13 @@ function generateAttrs(
if (props) {
if (!Array.isArray(props)) {
Object.keys(props).forEach((propName: string) => {
pieces = pieces.concat(generateAttr(propName, props[propName] as IPublicTypeCompositeValue, scope, config));
if (isValidIdentifier(propName)) {
pieces = pieces.concat(generateAttr(propName, props[propName] as IPublicTypeCompositeValue, scope, config));
}
});
} else {
props.forEach((prop) => {
if (prop.name && !prop.spread) {
if (prop.name && isValidIdentifier(prop.name) && !prop.spread) {
pieces = pieces.concat(generateAttr(prop.name, prop.value, scope, config));
}

View File

@ -281,3 +281,75 @@ Object {
},
}
`;
exports[`condition at root invalid attr name should not be generated 1`] = `
Object {
"chunks": Array [
Object {
"content": "
const __$$context = this._context || this;
const { state } = __$$context;
return <Page><Text a={1}>Hello world!</Text></Page>;
",
"fileType": "jsx",
"linkAfter": Array [
"ReactComponentClassRenderStart",
"ReactComponentClassRenderPre",
],
"name": "ReactComponentClassRenderJSX",
"type": "string",
},
Object {
"content": "
function __$$eval(expr) {
try {
return expr();
} catch (error) {
}
}
function __$$evalArray(expr) {
const res = __$$eval(expr);
return Array.isArray(res) ? res : [];
}
function __$$createChildContext(oldContext, ext) {
const childContext = {
...oldContext,
...ext,
};
childContext.__proto__ = oldContext;
return childContext;
}
",
"fileType": "jsx",
"linkAfter": Array [
"CommonFileExport",
],
"name": "CommonCustomContent",
"type": "string",
},
],
"contextData": Object {},
"depNames": Array [],
"ir": Object {
"children": Array [
Object {
"children": "Hello world!",
"componentName": "Text",
"props": Object {
"a": 1,
"a.b": 2,
},
},
],
"componentName": "Page",
"condition": null,
"containerType": "Page",
"fileName": "test",
"moduleName": "test",
},
}
`;

View File

@ -83,4 +83,22 @@ describe('condition at root', () => {
});
expect(result).toMatchSnapshot();
});
test('invalid attr name should not be generated', async () => {
const containerIr: IContainerInfo = {
containerType: 'Page',
moduleName: 'test',
componentName: 'Page',
fileName: 'test',
condition: null,
children: [{ componentName: 'Text', children: 'Hello world!', props: { 'a': 1, 'a.b': 2 } }],
};
const result = await jsx()({
ir: containerIr,
contextData: {},
chunks: [],
depNames: [],
});
expect(result).toMatchSnapshot();
})
});

View File

@ -66,5 +66,11 @@
},
"engines": {
"node": ">=10.0.0"
}
},
"repository": {
"type": "http",
"url": "https://github.com/alibaba/lowcode-engine/tree/main/modules/material-parser"
},
"bugs": "https://github.com/alibaba/lowcode-engine/issues",
"homepage": "https://github.com/alibaba/lowcode-engine/#readme"
}

View File

@ -19,6 +19,7 @@ const jestConfig = {
// testMatch: ['**/setting-field.test.ts'],
// testMatch: ['**/node.test.ts'],
// testMatch: ['**/builtin-hotkey.test.ts'],
// testMatch: ['**/selection.test.ts'],
transformIgnorePatterns: [
`/node_modules/(?!${esModules})/`,
],

View File

@ -1,6 +1,6 @@
{
"name": "@alilc/lowcode-designer",
"version": "1.1.7",
"version": "1.1.8-beta.6",
"description": "Designer for Ali LowCode Engine",
"main": "lib/index.js",
"module": "es/index.js",
@ -16,9 +16,9 @@
"license": "MIT",
"dependencies": {
"@alilc/build-plugin-lce": "^0.0.4-beta.2",
"@alilc/lowcode-editor-core": "1.1.7",
"@alilc/lowcode-types": "1.1.7",
"@alilc/lowcode-utils": "1.1.7",
"@alilc/lowcode-editor-core": "1.1.8-beta.6",
"@alilc/lowcode-types": "1.1.8-beta.6",
"@alilc/lowcode-utils": "1.1.8-beta.6",
"classnames": "^2.2.6",
"react": "^16",
"react-dom": "^16.7.0",
@ -53,5 +53,7 @@
"type": "http",
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/designer"
},
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6"
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6",
"bugs": "https://github.com/alibaba/lowcode-engine/issues",
"homepage": "https://github.com/alibaba/lowcode-engine/#readme"
}

View File

@ -14,6 +14,7 @@ import {
createModuleEventBus,
IEventBus,
} from '@alilc/lowcode-editor-core';
import {
ISimulatorHost,
Component,
@ -265,6 +266,8 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
@obx.ref private _contentDocument?: Document;
@obx.ref private _appHelper?: any;
get contentDocument() {
return this._contentDocument;
}
@ -310,13 +313,19 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
this.designer = designer;
this.scroller = this.designer.createScroller(this.viewport);
this.autoRender = !engineConfig.get('disableAutoRender', false);
this._appHelper = engineConfig.get('appHelper');
this.componentsConsumer = new ResourceConsumer<Asset | undefined>(() => this.componentsAsset);
this.injectionConsumer = new ResourceConsumer(() => {
return {
appHelper: engineConfig.get('appHelper'),
appHelper: this._appHelper,
};
});
engineConfig.onGot('appHelper', (data) => {
// appHelper被config.set修改后触发injectionConsumer.consume回调
this._appHelper = data;
});
this.i18nConsumer = new ResourceConsumer(() => this.project.i18n);
transactionManager.onStartTransaction(() => {
@ -384,6 +393,7 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
purge(): void {
// todo
}
mountViewport(viewport: HTMLElement | null) {
@ -494,7 +504,7 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
if (Object.keys(this.asyncLibraryMap).length > 0) {
// 加载异步 Library
await renderer.loadAsyncLibrary(this.asyncLibraryMap);
Object.keys(this.asyncLibraryMap).forEach(key => {
Object.keys(this.asyncLibraryMap).forEach((key) => {
delete this.asyncLibraryMap[key];
});
}
@ -521,7 +531,7 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
if (Object.keys(this.asyncLibraryMap).length > 0) {
// 加载异步 Library
await this.renderer?.loadAsyncLibrary(this.asyncLibraryMap);
Object.keys(this.asyncLibraryMap).forEach(key => {
Object.keys(this.asyncLibraryMap).forEach((key) => {
delete this.asyncLibraryMap[key];
});
}
@ -680,7 +690,7 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
const x = new Event('click');
x.initEvent('click', true);
this._iframe?.dispatchEvent(x);
const target = e.target;
const { target } = e;
const customizeIgnoreSelectors = engineConfig.get('customizeIgnoreSelectors');
// TODO: need more elegant solution to ignore click events of components in designer
@ -1497,7 +1507,7 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
handleAccept({ container }: DropContainer, e: ILocateEvent): boolean {
const { dragObject } = e;
const document = this.currentDocument!;
const focusNode = document.focusNode;
const { focusNode } = document;
if (isRootNode(container) || container.contains(focusNode)) {
return document.checkNesting(focusNode!, dragObject as any);
}

View File

@ -1,29 +1,7 @@
import { Component } from '../simulator';
import { IPublicTypeComponentInstance, IPublicTypeNodeInstance, Asset, IPublicTypeComponentSchema, IPublicTypeProjectSchema, IPublicTypeLowCodeComponent } from '@alilc/lowcode-types';
import { IPublicTypeComponentInstance, IPublicTypeSimulatorRenderer } from '@alilc/lowcode-types';
export interface BuiltinSimulatorRenderer {
readonly isSimulatorRenderer: true;
autoRepaintNode?: boolean;
components: Record<string, Component>;
rerender: () => void;
createComponent(schema: IPublicTypeProjectSchema<IPublicTypeComponentSchema>): Component | null;
getComponent(componentName: string): Component;
getClosestNodeInstance(
from: IPublicTypeComponentInstance,
nodeId?: string,
): IPublicTypeNodeInstance<IPublicTypeComponentInstance> | null;
findDOMNodes(instance: IPublicTypeComponentInstance): Array<Element | Text> | null;
getClientRects(element: Element | Text): DOMRect[];
setNativeSelection(enableFlag: boolean): void;
setDraggingState(state: boolean): void;
setCopyState(state: boolean): void;
loadAsyncLibrary(asyncMap: { [index: string]: any }): void;
clearState(): void;
stopAutoRepaintNode(): void;
enableAutoRepaintNode(): void;
run(): void;
load(asset: Asset): Promise<any>;
}
export type BuiltinSimulatorRenderer = IPublicTypeSimulatorRenderer<Component, IPublicTypeComponentInstance>;
export function isSimulatorRenderer(obj: any): obj is BuiltinSimulatorRenderer {
return obj && obj.isSimulatorRenderer;

View File

@ -144,6 +144,8 @@ export class Designer implements IDesigner {
private oobxList: OffsetObserver[] = [];
private selectionDispose: undefined | (() => void);
@obx.ref private _componentMetasMap = new Map<string, IComponentMeta>();
@obx.ref private _simulatorComponent?: ComponentType<any>;
@ -265,10 +267,9 @@ export class Designer implements IDesigner {
}
setupSelection = () => {
let selectionDispose: undefined | (() => void);
if (selectionDispose) {
selectionDispose();
selectionDispose = undefined;
if (this.selectionDispose) {
this.selectionDispose();
this.selectionDispose = undefined;
}
const { currentSelection } = this;
// TODO: 避免选中 Page 组件,默认选中第一个子节点;新增规则 或 判断 Live 模式
@ -284,7 +285,7 @@ export class Designer implements IDesigner {
}
this.postEvent('selection.change', currentSelection);
if (currentSelection) {
selectionDispose = currentSelection.onSelectionChange(() => {
this.selectionDispose = currentSelection.onSelectionChange(() => {
this.postEvent('selection.change', currentSelection);
});
}

View File

@ -159,6 +159,9 @@ export interface IBaseNode<Schema extends IPublicTypeNodeSchema = IPublicTypeNod
setProps(props?: IPublicTypePropsMap | IPublicTypePropsList | Props | null): void;
mergeProps(props: IPublicTypePropsMap): void;
/** 是否可以选中 */
canSelect(): boolean;
}
/**
@ -644,6 +647,12 @@ export class Node<Schema extends IPublicTypeNodeSchema = IPublicTypeNodeSchema>
return !!this.getExtraProp('isLocked')?.getValue();
}
canSelect(): boolean {
const onSelectHook = this.componentMeta?.advanced?.callbacks?.onSelectHook;
const canSelect = typeof onSelectHook === 'function' ? onSelectHook(this.internalToShellNode()!) : true;
return canSelect;
}
/**
*
*/

View File

@ -32,6 +32,12 @@ export class Selection implements ISelection {
return;
}
const node = this.doc.getNode(id);
if (!node?.canSelect()) {
return;
}
this._selected = [id];
this.emitter.emit('selectionchange', this._selected);
}
@ -40,7 +46,18 @@ export class Selection implements ISelection {
*
*/
selectAll(ids: string[]) {
this._selected = ids;
const selectIds: string[] = [];
ids.forEach(d => {
const node = this.doc.getNode(d);
if (node?.canSelect()) {
selectIds.push(d);
}
});
this._selected = selectIds;
this.emitter.emit('selectionchange', this._selected);
}

View File

@ -83,7 +83,10 @@ export class LowCodePluginManager implements ILowCodePluginManager {
}
const ctx = this._getLowCodePluginContext({ pluginName, meta });
const customFilterValidOptions = engineConfig.get('customPluginFilterOptions', filterValidOptions);
const config = pluginModel(ctx, customFilterValidOptions(options, preferenceDeclaration!));
const pluginTransducer = engineConfig.get('customPluginTransducer', null);
const newOptions = customFilterValidOptions(options, preferenceDeclaration!);
const newPluginModel = pluginTransducer ? await pluginTransducer(pluginModel, ctx, newOptions) : pluginModel;
const config = newPluginModel(ctx, newOptions);
// compat the legacy way to declare pluginName
// @ts-ignore
pluginName = pluginName || config.name;

View File

@ -122,7 +122,7 @@ describe('选择区测试', () => {
selectionChangeHandler.mockClear();
});
it('dispose 方法', () => {
it('selectAll 包含不存在的 id', () => {
const project = new Project(designer, {
componentsTree: [
formSchema,
@ -135,14 +135,7 @@ describe('选择区测试', () => {
selection.selectAll(['form', 'node_k1ow3cbj', 'form2']);
const selectionChangeHandler = jest.fn();
selection.onSelectionChange(selectionChangeHandler);
selection.dispose();
expect(selectionChangeHandler).toHaveBeenCalledTimes(1);
expect(selectionChangeHandler.mock.calls[0][0]).toEqual(['form', 'node_k1ow3cbj']);
expect(selection.selected).toEqual(['form', 'node_k1ow3cbj']);
selectionChangeHandler.mockClear();
});
it('dispose 方法 - 选中的节点没有被删除的', () => {

View File

@ -1,6 +1,6 @@
{
"name": "@alilc/lowcode-editor-core",
"version": "1.1.7",
"version": "1.1.8-beta.6",
"description": "Core Api for Ali lowCode engine",
"license": "MIT",
"main": "lib/index.js",
@ -14,8 +14,8 @@
},
"dependencies": {
"@alifd/next": "^1.19.16",
"@alilc/lowcode-types": "1.1.7",
"@alilc/lowcode-utils": "1.1.7",
"@alilc/lowcode-types": "1.1.8-beta.6",
"@alilc/lowcode-utils": "1.1.8-beta.6",
"classnames": "^2.2.6",
"debug": "^4.1.1",
"intl-messageformat": "^9.3.1",
@ -47,5 +47,7 @@
"type": "http",
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/editor-core"
},
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6"
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6",
"bugs": "https://github.com/alibaba/lowcode-engine/issues",
"homepage": "https://github.com/alibaba/lowcode-engine/#readme"
}

View File

@ -1,6 +1,6 @@
{
"name": "@alilc/lowcode-editor-skeleton",
"version": "1.1.7",
"version": "1.1.8-beta.6",
"description": "alibaba lowcode editor skeleton",
"main": "lib/index.js",
"module": "es/index.js",
@ -19,10 +19,10 @@
],
"dependencies": {
"@alifd/next": "^1.20.12",
"@alilc/lowcode-designer": "1.1.7",
"@alilc/lowcode-editor-core": "1.1.7",
"@alilc/lowcode-types": "1.1.7",
"@alilc/lowcode-utils": "1.1.7",
"@alilc/lowcode-designer": "1.1.8-beta.6",
"@alilc/lowcode-editor-core": "1.1.8-beta.6",
"@alilc/lowcode-types": "1.1.8-beta.6",
"@alilc/lowcode-utils": "1.1.8-beta.6",
"classnames": "^2.2.6",
"react": "^16.8.1",
"react-dom": "^16.8.1"
@ -42,5 +42,7 @@
"type": "http",
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/editor-skeleton"
},
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6"
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6",
"bugs": "https://github.com/alibaba/lowcode-engine/issues",
"homepage": "https://github.com/alibaba/lowcode-engine/#readme"
}

View File

@ -1,6 +1,6 @@
{
"name": "@alilc/lowcode-engine",
"version": "1.1.7",
"version": "1.1.8-beta.6",
"description": "An enterprise-class low-code technology stack with scale-out design / 一套面向扩展设计的企业级低代码技术体系",
"main": "lib/engine-core.js",
"module": "es/engine-core.js",
@ -19,15 +19,15 @@
"license": "MIT",
"dependencies": {
"@alifd/next": "^1.19.12",
"@alilc/lowcode-designer": "1.1.7",
"@alilc/lowcode-editor-core": "1.1.7",
"@alilc/lowcode-editor-skeleton": "1.1.7",
"@alilc/lowcode-designer": "1.1.8-beta.6",
"@alilc/lowcode-editor-core": "1.1.8-beta.6",
"@alilc/lowcode-editor-skeleton": "1.1.8-beta.6",
"@alilc/lowcode-engine-ext": "^1.0.0",
"@alilc/lowcode-plugin-designer": "1.1.7",
"@alilc/lowcode-plugin-outline-pane": "1.1.7",
"@alilc/lowcode-shell": "1.1.7",
"@alilc/lowcode-utils": "1.1.7",
"@alilc/lowcode-workspace": "1.1.7",
"@alilc/lowcode-plugin-designer": "1.1.8-beta.6",
"@alilc/lowcode-plugin-outline-pane": "1.1.8-beta.6",
"@alilc/lowcode-shell": "1.1.8-beta.6",
"@alilc/lowcode-utils": "1.1.8-beta.6",
"@alilc/lowcode-workspace": "1.1.8-beta.6",
"react": "^16.8.1",
"react-dom": "^16.8.1"
},
@ -53,5 +53,7 @@
"type": "http",
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/engine"
},
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6"
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6",
"bugs": "https://github.com/alibaba/lowcode-engine/issues",
"homepage": "https://github.com/alibaba/lowcode-engine/#readme"
}

View File

@ -83,7 +83,6 @@ async function registryInnerPlugin(designer: IDesigner, editor: IEditor, plugins
plugins.delete(componentMetaParserPlugin.pluginName);
plugins.delete(setterRegistry.pluginName);
plugins.delete(defaultPanelRegistryPlugin.pluginName);
plugins.delete(defaultPanelRegistryPlugin.pluginName);
plugins.delete(builtinHotkey.pluginName);
plugins.delete(registerDefaults.pluginName);
};

View File

@ -1,6 +1,6 @@
{
"name": "@alilc/lowcode-ignitor",
"version": "1.1.7",
"version": "1.1.8-beta.6",
"description": "点火器bootstrap lce project",
"main": "lib/index.js",
"private": true,
@ -16,5 +16,11 @@
"devDependencies": {
"@alib/build-scripts": "^0.1.18",
"fs-extra": "^10.0.0"
}
},
"repository": {
"type": "http",
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/ignitor"
},
"bugs": "https://github.com/alibaba/lowcode-engine/issues",
"homepage": "https://github.com/alibaba/lowcode-engine/#readme"
}

View File

@ -1,6 +1,6 @@
{
"name": "@alilc/lowcode-plugin-designer",
"version": "1.1.7",
"version": "1.1.8-beta.6",
"description": "alibaba lowcode editor designer plugin",
"files": [
"es",
@ -18,9 +18,9 @@
],
"author": "xiayang.xy",
"dependencies": {
"@alilc/lowcode-designer": "1.1.7",
"@alilc/lowcode-editor-core": "1.1.7",
"@alilc/lowcode-utils": "1.1.7",
"@alilc/lowcode-designer": "1.1.8-beta.6",
"@alilc/lowcode-editor-core": "1.1.8-beta.6",
"@alilc/lowcode-utils": "1.1.8-beta.6",
"react": "^16.8.1",
"react-dom": "^16.8.1"
},
@ -37,5 +37,7 @@
"type": "http",
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/plugin-designer"
},
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6"
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6",
"bugs": "https://github.com/alibaba/lowcode-engine/issues",
"homepage": "https://github.com/alibaba/lowcode-engine/#readme"
}

View File

@ -1,6 +1,6 @@
{
"name": "@alilc/lowcode-plugin-outline-pane",
"version": "1.1.7",
"version": "1.1.8-beta.6",
"description": "Outline pane for Ali lowCode engine",
"files": [
"es",
@ -13,8 +13,8 @@
},
"dependencies": {
"@alifd/next": "^1.19.16",
"@alilc/lowcode-types": "1.1.7",
"@alilc/lowcode-utils": "1.1.7",
"@alilc/lowcode-types": "1.1.8-beta.6",
"@alilc/lowcode-utils": "1.1.8-beta.6",
"classnames": "^2.2.6",
"react": "^16",
"react-dom": "^16.7.0",
@ -38,5 +38,7 @@
"type": "http",
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/plugin-outline-pane"
},
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6"
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6",
"bugs": "https://github.com/alibaba/lowcode-engine/issues",
"homepage": "https://github.com/alibaba/lowcode-engine/#readme"
}

View File

@ -593,7 +593,7 @@ export class PaneController implements IPublicModelSensor, ITreeBoard, IPublicTy
// at this moment, it is possible that pane is not ready yet, so
// put ui related operations to the next loop
setTimeout(() => {
tree.setNodeSelected(treeNode.id);
tree.setNodeSelected(treeNode.nodeId);
this.scrollToNode(treeNode, null, 4);
}, 0);
}
@ -615,21 +615,21 @@ export class PaneController implements IPublicModelSensor, ITreeBoard, IPublicTy
if (!this._shell) {
return undefined;
}
return this._shell.querySelector(`.tree-node[data-id="${treeNode.id}"]`)?.getBoundingClientRect();
return this._shell.querySelector(`.tree-node[data-id="${treeNode.nodeId}"]`)?.getBoundingClientRect();
}
private getTreeTitleRect(treeNode: TreeNode): DOMRect | undefined {
if (!this._shell) {
return undefined;
}
return this._shell.querySelector(`.tree-node-title[data-id="${treeNode.id}"]`)?.getBoundingClientRect();
return this._shell.querySelector(`.tree-node-title[data-id="${treeNode.nodeId}"]`)?.getBoundingClientRect();
}
private getTreeSlotsRect(treeNode: TreeNode): DOMRect | undefined {
if (!this._shell) {
return undefined;
}
return this._shell.querySelector(`.tree-node-slots[data-id="${treeNode.id}"]`)?.getBoundingClientRect();
return this._shell.querySelector(`.tree-node-slots[data-id="${treeNode.nodeId}"]`)?.getBoundingClientRect();
}
}

View File

@ -4,7 +4,7 @@ import {
IPublicModelNode,
IPublicTypeDisposable,
} from '@alilc/lowcode-types';
import { isI18nData, isLocationChildrenDetail } from '@alilc/lowcode-utils';
import { isI18nData, isLocationChildrenDetail, uniqueId } from '@alilc/lowcode-utils';
import EventEmitter from 'events';
import { Tree } from './tree';
import { IOutlinePanelPluginContext } from './tree-master';
@ -60,7 +60,9 @@ export default class TreeNode {
*/
private _expanded = false;
get id(): string {
id = uniqueId('treeNode');
get nodeId(): string {
return this.node.id;
}
@ -256,7 +258,7 @@ export default class TreeNode {
return false;
}
return (
isLocationChildrenDetail(loc.detail) && loc.detail.focus?.type === 'node' && loc.detail?.focus?.node.id === this.id
isLocationChildrenDetail(loc.detail) && loc.detail.focus?.type === 'node' && loc.detail?.focus?.node.id === this.nodeId
);
}
@ -278,7 +280,7 @@ export default class TreeNode {
if (!loc) {
return false;
}
return loc.target?.id === this.id;
return loc.target?.id === this.nodeId;
}
setTitleLabel(label: string) {

View File

@ -45,6 +45,10 @@ export class Tree {
const treeNode = this.getTreeNodeById(node.id);
treeNode?.setHidden(!visible);
});
doc?.onImportSchema(() => {
this.treeNodesMap = new Map<string, TreeNode>();
});
}
setNodeSelected(nodeId: string): void {

View File

@ -169,12 +169,12 @@ class TreeNodeChildren extends PureComponent<{
children.push(insertion);
}
}
groupContents.push(<TreeNodeView key={child.id} treeNode={child} isModal={isModal} />);
groupContents.push(<TreeNodeView key={child.nodeId} treeNode={child} isModal={isModal} />);
} else {
if (index === dropIndex) {
children.push(insertion);
}
children.push(<TreeNodeView key={child.id} treeNode={child} isModal={isModal} />);
children.push(<TreeNodeView key={child.nodeId} treeNode={child} isModal={isModal} />);
}
});
endGroup();
@ -201,14 +201,14 @@ class TreeNodeSlots extends PureComponent<{
className={classNames('tree-node-slots', {
'insertion-at-slots': treeNode.dropDetail?.focus?.type === 'slots',
})}
data-id={treeNode.id}
data-id={treeNode.nodeId}
>
<div className="tree-node-slots-title">
{/* @ts-ignore */}
<Title title={{ type: 'i18n', intl: this.props.treeNode.pluginContext.intlNode('Slots') }} />
</div>
{treeNode.slots.map(tnode => (
<TreeNodeView key={tnode.id} treeNode={tnode} />
<TreeNodeView key={tnode.nodeId} treeNode={tnode} />
))}
</div>
);

View File

@ -225,7 +225,7 @@ export default class TreeNodeView extends PureComponent<{
return (
<div
className={className}
data-id={treeNode.id}
data-id={treeNode.nodeId}
>
<TreeTitle
treeNode={treeNode}

View File

@ -135,7 +135,7 @@ export default class TreeTitle extends PureComponent<{
<div
className={classNames('tree-node-title', { editing })}
style={style}
data-id={treeNode.id}
data-id={treeNode.nodeId}
onClick={() => {
if (isModal) {
if (this.state.visible) {

View File

@ -91,7 +91,7 @@ export default class TreeView extends PureComponent<{
private onDoubleClick = (e: ReactMouseEvent) => {
e.preventDefault();
const treeNode = this.getTreeNodeFromEvent(e);
if (treeNode?.id === this.state.root?.id) {
if (treeNode?.nodeId === this.state.root?.nodeId) {
return;
}
if (!treeNode?.expanded) {
@ -188,6 +188,11 @@ export default class TreeView extends PureComponent<{
root: tree.root,
});
});
doc?.onImportSchema(() => {
this.setState({
root: tree.root,
});
});
}
render() {

View File

@ -1,6 +1,6 @@
{
"name": "@alilc/lowcode-rax-renderer",
"version": "1.1.7",
"version": "1.1.8-beta.6",
"description": "Rax renderer for Ali lowCode engine",
"main": "lib/index.js",
"module": "es/index.js",
@ -30,8 +30,8 @@
"build": "build-scripts build"
},
"dependencies": {
"@alilc/lowcode-renderer-core": "1.1.7",
"@alilc/lowcode-utils": "1.1.7",
"@alilc/lowcode-renderer-core": "1.1.8-beta.6",
"@alilc/lowcode-utils": "1.1.8-beta.6",
"rax-find-dom-node": "^1.0.1"
},
"devDependencies": {
@ -48,6 +48,7 @@
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/rax-renderer"
},
"license": "MIT",
"homepage": "https://unpkg.alibaba-inc.com/@alilc/lowcode-rax-renderer@0.1.2/build/index.html",
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6"
"homepage": "https://github.com/alibaba/lowcode-engine/#readme",
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6",
"bugs": "https://github.com/alibaba/lowcode-engine/issues"
}

View File

@ -1,6 +1,6 @@
{
"name": "@alilc/lowcode-rax-simulator-renderer",
"version": "1.1.7",
"version": "1.1.8-beta.6",
"description": "rax simulator renderer for alibaba lowcode designer",
"main": "lib/index.js",
"module": "es/index.js",
@ -13,10 +13,10 @@
"build:umd": "build-scripts build --config build.umd.json"
},
"dependencies": {
"@alilc/lowcode-designer": "1.1.7",
"@alilc/lowcode-rax-renderer": "1.1.7",
"@alilc/lowcode-types": "1.1.7",
"@alilc/lowcode-utils": "1.1.7",
"@alilc/lowcode-designer": "1.1.8-beta.6",
"@alilc/lowcode-rax-renderer": "1.1.8-beta.6",
"@alilc/lowcode-types": "1.1.8-beta.6",
"@alilc/lowcode-utils": "1.1.8-beta.6",
"classnames": "^2.2.6",
"driver-universal": "^3.1.3",
"history": "^5.0.0",
@ -49,6 +49,7 @@
"type": "http",
"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",
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6"
"homepage": "https://github.com/alibaba/lowcode-engine/#readme",
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6",
"bugs": "https://github.com/alibaba/lowcode-engine/issues"
}

View File

@ -1,6 +1,6 @@
{
"name": "@alilc/lowcode-react-renderer",
"version": "1.1.7",
"version": "1.1.8-beta.6",
"description": "react renderer for ali lowcode engine",
"main": "lib/index.js",
"module": "es/index.js",
@ -22,7 +22,7 @@
],
"dependencies": {
"@alifd/next": "^1.21.16",
"@alilc/lowcode-renderer-core": "1.1.7"
"@alilc/lowcode-renderer-core": "1.1.8-beta.6"
},
"devDependencies": {
"@alib/build-scripts": "^0.1.18",
@ -41,6 +41,7 @@
"type": "http",
"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",
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6"
"homepage": "https://github.com/alibaba/lowcode-engine/#readme",
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6",
"bugs": "https://github.com/alibaba/lowcode-engine/issues"
}

View File

@ -1,6 +1,6 @@
{
"name": "@alilc/lowcode-react-simulator-renderer",
"version": "1.1.7",
"version": "1.1.8-beta.6",
"description": "react simulator renderer for alibaba lowcode designer",
"main": "lib/index.js",
"module": "es/index.js",
@ -17,10 +17,10 @@
"test:cov": "build-scripts test --config build.test.json --jest-coverage"
},
"dependencies": {
"@alilc/lowcode-designer": "1.1.7",
"@alilc/lowcode-react-renderer": "1.1.7",
"@alilc/lowcode-types": "1.1.7",
"@alilc/lowcode-utils": "1.1.7",
"@alilc/lowcode-designer": "1.1.8-beta.6",
"@alilc/lowcode-react-renderer": "1.1.8-beta.6",
"@alilc/lowcode-types": "1.1.8-beta.6",
"@alilc/lowcode-utils": "1.1.8-beta.6",
"classnames": "^2.2.6",
"mobx": "^6.3.0",
"mobx-react": "^7.2.0",
@ -43,5 +43,7 @@
"type": "http",
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/react-simulator-renderer"
},
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6"
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6",
"bugs": "https://github.com/alibaba/lowcode-engine/issues",
"homepage": "https://github.com/alibaba/lowcode-engine/#readme"
}

View File

@ -13,6 +13,7 @@ const jestConfig = {
// testMatch: ['**/*/base.test.tsx'],
// testMatch: ['**/utils/common.test.ts'],
// testMatch: ['**/*/leaf.test.tsx'],
// testMatch: ['**/*/is-use-loop.test.ts'],
transformIgnorePatterns: [
`/node_modules/(?!${esModules})/`,
],

View File

@ -1,6 +1,6 @@
{
"name": "@alilc/lowcode-renderer-core",
"version": "1.1.7",
"version": "1.1.8-beta.6",
"description": "renderer core",
"license": "MIT",
"main": "lib/index.js",
@ -16,8 +16,8 @@
},
"dependencies": {
"@alilc/lowcode-datasource-engine": "^1.0.0",
"@alilc/lowcode-types": "1.1.7",
"@alilc/lowcode-utils": "1.1.7",
"@alilc/lowcode-types": "1.1.8-beta.6",
"@alilc/lowcode-utils": "1.1.8-beta.6",
"classnames": "^2.2.6",
"debug": "^4.1.1",
"fetch-jsonp": "^1.1.3",
@ -32,7 +32,7 @@
"devDependencies": {
"@alib/build-scripts": "^0.1.18",
"@alifd/next": "^1.26.0",
"@alilc/lowcode-designer": "1.1.7",
"@alilc/lowcode-designer": "1.1.8-beta.6",
"@babel/plugin-transform-typescript": "^7.16.8",
"@testing-library/react": "^11.2.2",
"@types/classnames": "^2.2.11",
@ -55,5 +55,7 @@
"type": "http",
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/renderer-core"
},
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6"
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6",
"bugs": "https://github.com/alibaba/lowcode-engine/issues",
"homepage": "https://github.com/alibaba/lowcode-engine/#readme"
}

View File

@ -538,7 +538,7 @@ export function leafWrapper(Comp: types.IBaseRenderComponent, {
if (this.props.children && this.props.children.length) {
return this.props.children;
}
return [];
return this.props.children;
}
get leaf(): INode | undefined {

View File

@ -8,13 +8,13 @@ export default function isUseLoop(loop: null | any[] | IPublicTypeJSExpression,
return true;
}
if (!Array.isArray(loop)) {
return false;
}
if (!isDesignMode) {
return true;
}
if (!Array.isArray(loop)) {
return false;
}
return loop.length > 0;
}

View File

@ -5,6 +5,9 @@ describe('base test', () => {
it('designMode is true', () => {
expect(isUseLoop([], true)).toBeFalsy();
expect(isUseLoop([{}], true)).toBeTruthy();
expect(isUseLoop(null, true)).toBeFalsy();
expect(isUseLoop(undefined, true)).toBeFalsy();
expect(isUseLoop(0, true)).toBeFalsy();
});
it('loop is expression', () => {
@ -21,5 +24,8 @@ describe('base test', () => {
it('designMode is false', () => {
expect(isUseLoop([], false)).toBeTruthy();
expect(isUseLoop([{}], false)).toBeTruthy();
expect(isUseLoop(null, false)).toBeTruthy();
expect(isUseLoop(undefined, false)).toBeTruthy();
expect(isUseLoop(0, false)).toBeTruthy();
});
});

View File

@ -1,6 +1,6 @@
{
"name": "@alilc/lowcode-shell",
"version": "1.1.7",
"version": "1.1.8-beta.6",
"description": "Shell Layer for AliLowCodeEngine",
"main": "lib/index.js",
"module": "es/index.js",
@ -13,12 +13,12 @@
},
"license": "MIT",
"dependencies": {
"@alilc/lowcode-designer": "1.1.7",
"@alilc/lowcode-editor-core": "1.1.7",
"@alilc/lowcode-editor-skeleton": "1.1.7",
"@alilc/lowcode-types": "1.1.7",
"@alilc/lowcode-utils": "1.1.7",
"@alilc/lowcode-workspace": "1.1.7",
"@alilc/lowcode-designer": "1.1.8-beta.6",
"@alilc/lowcode-editor-core": "1.1.8-beta.6",
"@alilc/lowcode-editor-skeleton": "1.1.8-beta.6",
"@alilc/lowcode-types": "1.1.8-beta.6",
"@alilc/lowcode-utils": "1.1.8-beta.6",
"@alilc/lowcode-workspace": "1.1.8-beta.6",
"classnames": "^2.2.6",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.5",
@ -48,5 +48,7 @@
"type": "http",
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/shell"
},
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6"
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6",
"bugs": "https://github.com/alibaba/lowcode-engine/issues",
"homepage": "https://github.com/alibaba/lowcode-engine/#readme"
}

View File

@ -34,6 +34,28 @@ export class Workspace implements IPublicApiWorkspace {
return new ShellWindow(this[workspaceSymbol].window);
}
get resourceTypeList() {
return Array.from(this[workspaceSymbol].resourceTypeMap.values()).map((d) => {
const { name: resourceName, type: resourceType } = d;
const {
description,
editorViews,
} = d.resourceTypeModel({} as any, {});
return {
resourceName,
resourceType,
description,
editorViews: editorViews.map(d => (
{
viewName: d.viewName,
viewType: d.viewType || 'editor',
}
)),
};
});
}
onWindowRendererReady(fn: () => void): IPublicTypeDisposable {
return this[workspaceSymbol].onWindowRendererReady(fn);
}

View File

@ -24,4 +24,12 @@ export class EditorView {
},
});
}
get viewName() {
return this[editorViewSymbol].viewName;
}
get viewType() {
return this[editorViewSymbol].viewType;
}
}

View File

@ -37,6 +37,10 @@ export class Resource implements IPublicModelResource {
return this[resourceSymbol].category;
}
get description() {
return this[resourceSymbol].description;
}
get children() {
return this[resourceSymbol].children.map((child) => new Resource(child));
}

View File

@ -1,6 +1,6 @@
{
"name": "@alilc/lowcode-types",
"version": "1.1.7",
"version": "1.1.8-beta.6",
"description": "Types for Ali lowCode engine",
"files": [
"es",
@ -29,5 +29,7 @@
"type": "http",
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/types"
},
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6"
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6",
"bugs": "https://github.com/alibaba/lowcode-engine/issues",
"homepage": "https://github.com/alibaba/lowcode-engine/#readme"
}

View File

@ -1,3 +1,7 @@
import { IPublicModelPluginContext } from './plugin-context';
export interface IPublicModelEditorView extends IPublicModelPluginContext {}
export interface IPublicModelEditorView extends IPublicModelPluginContext {
viewName: string;
viewType: 'editor' | 'webview';
}

View File

@ -19,6 +19,8 @@ export interface IBaseModelResource<
get viewName(): string | undefined;
get description(): string | undefined;
get config(): {
disableBehaviors?: ('copy' | 'remove')[];
} | undefined;

View File

@ -90,3 +90,4 @@ export * from './editor-view-config';
export * from './hotkey-callback-config';
export * from './hotkey-callbacks';
export * from './scrollable';
export * from './simulator-renderer';

View File

@ -139,6 +139,7 @@ export interface ConfigureSupportEventConfig {
name: string;
propType?: IPublicTypePropType;
description?: string;
template?: string;
}
/**
@ -195,6 +196,9 @@ export interface IPublicTypeCallbacks {
onMoveHook?: (currentNode: IPublicModelNode) => boolean;
// thinkof 限制性拖拽
onHoverHook?: (currentNode: IPublicModelNode) => boolean;
/** 选中 hook如果返回值是 false可以控制组件不可被选中 */
onSelectHook?: (currentNode: IPublicModelNode) => boolean;
onChildMoveHook?: (childNode: IPublicModelNode, currentNode: IPublicModelNode) => boolean;
// events

View File

@ -5,11 +5,14 @@ import { IPublicTypeCompositeValue, IPublicTypePropsMap, IPublicTypeNodeData } f
* -
*/
export interface IPublicTypeNodeSchema {
id?: string;
/**
*
*/
componentName: string;
/**
*
*/
@ -17,26 +20,26 @@ export interface IPublicTypeNodeSchema {
children?: IPublicTypeNodeData | IPublicTypeNodeData[];
} & IPublicTypePropsMap; // | PropsList;
/**
*
*/
leadingComponents?: string;
/**
*
*/
condition?: IPublicTypeCompositeValue;
/**
*
*/
loop?: IPublicTypeCompositeValue;
/**
* ["item", "index"]
*/
loopArgs?: [string, string];
/**
*
*/
children?: IPublicTypeNodeData | IPublicTypeNodeData[];
/**
*
*/

View File

@ -1,5 +1,5 @@
export interface IPublicTypePluginConfig {
init(): void;
destroy?(): void;
init(): Promise<void>;
destroy?(): Promise<void>;
exports?(): any;
}

View File

@ -0,0 +1,32 @@
import { Asset } from '../../assets';
import {
IPublicTypeNodeInstance,
IPublicTypeProjectSchema,
IPublicTypeComponentSchema,
} from './';
export interface IPublicTypeSimulatorRenderer<Component, ComponentInstance> {
readonly isSimulatorRenderer: true;
autoRepaintNode?: boolean;
components: Record<string, Component>;
rerender: () => void;
createComponent(
schema: IPublicTypeProjectSchema<IPublicTypeComponentSchema>,
): Component | null;
getComponent(componentName: string): Component;
getClosestNodeInstance(
from: ComponentInstance,
nodeId?: string,
): IPublicTypeNodeInstance<ComponentInstance> | null;
findDOMNodes(instance: ComponentInstance): Array<Element | Text> | null;
getClientRects(element: Element | Text): DOMRect[];
setNativeSelection(enableFlag: boolean): void;
setDraggingState(state: boolean): void;
setCopyState(state: boolean): void;
loadAsyncLibrary(asyncMap: { [index: string]: any }): void;
clearState(): void;
stopAutoRepaintNode(): void;
enableAutoRepaintNode(): void;
run(): void;
load(asset: Asset): Promise<any>;
}

View File

@ -1,6 +1,6 @@
{
"name": "@alilc/lowcode-utils",
"version": "1.1.7",
"version": "1.1.8-beta.6",
"description": "Utils for Ali lowCode engine",
"files": [
"lib",
@ -14,7 +14,7 @@
},
"dependencies": {
"@alifd/next": "^1.19.16",
"@alilc/lowcode-types": "1.1.7",
"@alilc/lowcode-types": "1.1.8-beta.6",
"lodash": "^4.17.21",
"mobx": "^6.3.0",
"react": "^16"
@ -32,5 +32,7 @@
"type": "http",
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/utils"
},
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6"
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6",
"bugs": "https://github.com/alibaba/lowcode-engine/issues",
"homepage": "https://github.com/alibaba/lowcode-engine/#readme"
}

View File

@ -1,6 +1,6 @@
{
"name": "@alilc/lowcode-workspace",
"version": "1.1.7",
"version": "1.1.8-beta.6",
"description": "Shell Layer for AliLowCodeEngine",
"main": "lib/index.js",
"module": "es/index.js",
@ -15,11 +15,11 @@
},
"license": "MIT",
"dependencies": {
"@alilc/lowcode-designer": "1.1.7",
"@alilc/lowcode-editor-core": "1.1.7",
"@alilc/lowcode-editor-skeleton": "1.1.7",
"@alilc/lowcode-types": "1.1.7",
"@alilc/lowcode-utils": "1.1.7",
"@alilc/lowcode-designer": "1.1.8-beta.6",
"@alilc/lowcode-editor-core": "1.1.8-beta.6",
"@alilc/lowcode-editor-skeleton": "1.1.8-beta.6",
"@alilc/lowcode-types": "1.1.8-beta.6",
"@alilc/lowcode-utils": "1.1.8-beta.6",
"classnames": "^2.2.6",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.5",
@ -47,7 +47,9 @@
},
"repository": {
"type": "http",
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/shell"
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/workspace"
},
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6"
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6",
"bugs": "https://github.com/alibaba/lowcode-engine/issues",
"homepage": "https://github.com/alibaba/lowcode-engine/#readme"
}

View File

@ -10,6 +10,8 @@ export interface IViewContext extends IBasicContext {
editorWindow: IEditorWindow;
viewName: string;
viewType: 'editor' | 'webview';
}
export class Context extends BasicContext implements IViewContext {

View File

@ -12,6 +12,8 @@ export interface IBaseResource<T> extends IBaseModelResource<T> {
skeleton: ISkeleton;
description?: string;
get editorViews(): IPublicTypeEditorView[];
get defaultViewType(): string;

View File

@ -33,6 +33,8 @@ export interface IWorkspace extends Omit<IPublicApiWorkspace<
plugins: ILowCodePluginManager;
resourceTypeMap: Map<string, ResourceType>;
getResourceList(): IResource[];
getResourceType(resourceName: string): IResourceType;
@ -55,12 +57,12 @@ export class Workspace implements IWorkspace {
enableAutoOpenFirstWindow: boolean;
resourceTypeMap: Map<string, ResourceType> = new Map();
private emitter: IEventBus = createModuleEventBus('workspace');
private _isActive = false;
private resourceTypeMap: Map<string, ResourceType> = new Map();
private resourceList: IResource[] = [];
get skeleton() {

45
scripts/set-repo.js Normal file
View File

@ -0,0 +1,45 @@
#!/usr/bin/env node
const path = require('path');
const fs = require('fs-extra');
(async () => {
const root = path.join(__dirname, '../');
const workspaces = ['modules', 'packages'];
for (const workspace of workspaces) {
const pkgDir = path.join(root, workspace);
const pkgs = await fs.readdir(pkgDir);
for (const pkg of pkgs) {
if (pkg.charAt(0) === '.') continue;
if (!(await fs.statSync(path.join(pkgDir, pkg))).isDirectory()) continue;
await setRepo({
workspace,
pkgDir,
pkg,
});
}
}
async function setRepo(opts) {
const pkgDir = path.join(opts.pkgDir, opts.pkg);
const pkgPkgJSONPath = path.join(pkgDir, 'package.json');
if (!fs.existsSync(pkgPkgJSONPath)) {
console.log(`${opts.pkg} exists`);
} else {
const pkgPkgJSON = require(pkgPkgJSONPath);
fs.writeJSONSync(
pkgPkgJSONPath,
Object.assign(pkgPkgJSON, {
repository: {
type: 'http',
url: `https://github.com/alibaba/lowcode-engine/tree/main/${opts.workspace}/${opts.pkg}`,
},
bugs: 'https://github.com/alibaba/lowcode-engine/issues',
homepage: 'https://github.com/alibaba/lowcode-engine/#readme',
}),
{ spaces: ' ' },
);
console.log(`[Write] ${opts.pkg}`);
}
}
})();

View File

@ -1,6 +1,9 @@
#!/usr/bin/env bash
rm -rf node_modules package-lock.json yarn.lock
npm i lerna@4.0.0
lerna clean -y
find ./packages -type f -name "package-lock.json" -exec rm -f {} \;