Compare commits

...

25 Commits

Author SHA1 Message Date
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
58 changed files with 441 additions and 172 deletions

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) 相关类型:[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 ### 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) ![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 解析、样式注入、条件渲染等。 - 能力层:提供组件、区块、页面等渲染所需的核心能力,包括 Props 解析、样式注入、条件渲染等。
- 适配层:由于我们使用的运行时框架不是统一的,所以统一使用适配层将不同运行框架的差异部分,通过接口对外,让渲染层注册/适配对应所需的方法。能保障渲染层和能力层直接通过适配层连接起来,能起到独立可扩展的作用。 - 适配层:由于我们使用的运行时框架不是统一的,所以统一使用适配层将不同运行框架的差异部分,通过接口对外,让渲染层注册/适配对应所需的方法。能保障渲染层和能力层直接通过适配层连接起来,能起到独立可扩展的作用。
- 渲染层:提供核心的渲染方法,由于不同运行时框架提供的渲染方法是不同的,所以其通过适配层进行注入,只需要提供适配层所需的接口,即可实现渲染。 - 渲染层:提供核心的渲染方法,由于不同运行时框架提供的渲染方法是不同的,所以其通过适配层进行注入,只需要提供适配层所需的接口,即可实现渲染。

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
{ {
"name": "@alilc/lowcode-code-generator", "name": "@alilc/lowcode-code-generator",
"version": "1.1.2", "version": "1.1.4",
"description": "出码引擎 for LowCode Engine", "description": "出码引擎 for LowCode Engine",
"license": "MIT", "license": "MIT",
"main": "lib/index.js", "main": "lib/index.js",
@ -144,5 +144,10 @@
"access": "public", "access": "public",
"registry": "https://registry.npmjs.org/" "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) => { const codePrettier: PostProcessor = (content: string, fileType: string) => {
let parser: prettier.BuiltInParserName | any; let parser: prettier.BuiltInParserName | any;
if (fileType === 'js' || fileType === 'jsx' || fileType === 'ts' || fileType === 'tsx') { if (fileType === 'js' || fileType === 'jsx' || fileType === 'ts' || fileType === 'tsx') {
parser = 'babel'; parser = 'babel-ts';
} else if (fileType === 'json') { } else if (fileType === 'json') {
parser = 'json-stringify'; parser = 'json-stringify';
} else if (PARSERS.indexOf(fileType) >= 0) { } 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)) { if (typeof x === 'object' && isIdentifier(x) && JS_KEYWORDS.includes(x.name)) {
keywordVars.add(x.name); keywordVars.add(x.name);
} }
@ -189,7 +189,7 @@ export function parseExpressionGetKeywords(expr: string | null | undefined): str
addIdentifierIfNeeded(item); addIdentifierIfNeeded(item);
}); });
} else { } 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 ast = parser.parse(`!(${expr});`);
const addUndeclaredIdentifierIfNeeded = ( const addUndeclaredIdentifierIfNeeded = (
x: Record<string, unknown> | number | null | undefined, x: Node | null | undefined,
path: NodePath<Node>, path: NodePath<Node>,
) => { ) => {
if (typeof x === 'object' && isIdentifier(x) && !path.scope.hasBinding(x.name)) { if (typeof x === 'object' && isIdentifier(x) && !path.scope.hasBinding(x.name)) {
@ -241,7 +241,7 @@ export function parseExpressionGetGlobalVariables(
addUndeclaredIdentifierIfNeeded(item, path); addUndeclaredIdentifierIfNeeded(item, path);
}); });
} else { } 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 { encodeJsxStringNode } from './encodeJsxAttrString';
import { unwrapJsExprQuoteInJsx } from './jsxHelpers'; import { unwrapJsExprQuoteInJsx } from './jsxHelpers';
import { transformThis2Context } from '../core/jsx/handlers/transformThis2Context'; import { transformThis2Context } from '../core/jsx/handlers/transformThis2Context';
import { isValidIdentifier } from './validate';
function mergeNodeGeneratorConfig( function mergeNodeGeneratorConfig(
cfg1: NodeGeneratorConfig, cfg1: NodeGeneratorConfig,
@ -126,11 +127,13 @@ function generateAttrs(
if (props) { if (props) {
if (!Array.isArray(props)) { if (!Array.isArray(props)) {
Object.keys(props).forEach((propName: string) => { 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 { } else {
props.forEach((prop) => { 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)); 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(); 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": { "engines": {
"node": ">=10.0.0" "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: ['**/setting-field.test.ts'],
// testMatch: ['**/node.test.ts'], // testMatch: ['**/node.test.ts'],
// testMatch: ['**/builtin-hotkey.test.ts'], // testMatch: ['**/builtin-hotkey.test.ts'],
// testMatch: ['**/selection.test.ts'],
transformIgnorePatterns: [ transformIgnorePatterns: [
`/node_modules/(?!${esModules})/`, `/node_modules/(?!${esModules})/`,
], ],

View File

@ -1,6 +1,6 @@
{ {
"name": "@alilc/lowcode-designer", "name": "@alilc/lowcode-designer",
"version": "1.1.7", "version": "1.1.8-beta.4",
"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",
@ -16,9 +16,9 @@
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@alilc/build-plugin-lce": "^0.0.4-beta.2", "@alilc/build-plugin-lce": "^0.0.4-beta.2",
"@alilc/lowcode-editor-core": "1.1.7", "@alilc/lowcode-editor-core": "1.1.8-beta.4",
"@alilc/lowcode-types": "1.1.7", "@alilc/lowcode-types": "1.1.8-beta.4",
"@alilc/lowcode-utils": "1.1.7", "@alilc/lowcode-utils": "1.1.8-beta.4",
"classnames": "^2.2.6", "classnames": "^2.2.6",
"react": "^16", "react": "^16",
"react-dom": "^16.7.0", "react-dom": "^16.7.0",
@ -53,5 +53,7 @@
"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": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6",
"bugs": "https://github.com/alibaba/lowcode-engine/issues",
"homepage": "https://github.com/alibaba/lowcode-engine/#readme"
} }

View File

@ -1,29 +1,7 @@
import { Component } from '../simulator'; 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 { export type BuiltinSimulatorRenderer = IPublicTypeSimulatorRenderer<Component, IPublicTypeComponentInstance>;
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 function isSimulatorRenderer(obj: any): obj is BuiltinSimulatorRenderer { export function isSimulatorRenderer(obj: any): obj is BuiltinSimulatorRenderer {
return obj && obj.isSimulatorRenderer; return obj && obj.isSimulatorRenderer;

View File

@ -159,6 +159,9 @@ export interface IBaseNode<Schema extends IPublicTypeNodeSchema = IPublicTypeNod
setProps(props?: IPublicTypePropsMap | IPublicTypePropsList | Props | null): void; setProps(props?: IPublicTypePropsMap | IPublicTypePropsList | Props | null): void;
mergeProps(props: IPublicTypePropsMap): void; mergeProps(props: IPublicTypePropsMap): void;
/** 是否可以选中 */
canSelect(): boolean;
} }
/** /**
@ -644,6 +647,12 @@ export class Node<Schema extends IPublicTypeNodeSchema = IPublicTypeNodeSchema>
return !!this.getExtraProp('isLocked')?.getValue(); 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; return;
} }
const node = this.doc.getNode(id);
if (!node?.canSelect()) {
return;
}
this._selected = [id]; this._selected = [id];
this.emitter.emit('selectionchange', this._selected); this.emitter.emit('selectionchange', this._selected);
} }
@ -40,7 +46,18 @@ export class Selection implements ISelection {
* *
*/ */
selectAll(ids: string[]) { 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); this.emitter.emit('selectionchange', this._selected);
} }

View File

@ -83,7 +83,10 @@ export class LowCodePluginManager implements ILowCodePluginManager {
} }
const ctx = this._getLowCodePluginContext({ pluginName, meta }); const ctx = this._getLowCodePluginContext({ pluginName, meta });
const customFilterValidOptions = engineConfig.get('customPluginFilterOptions', filterValidOptions); 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 // compat the legacy way to declare pluginName
// @ts-ignore // @ts-ignore
pluginName = pluginName || config.name; pluginName = pluginName || config.name;

View File

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

View File

@ -1,6 +1,6 @@
{ {
"name": "@alilc/lowcode-editor-core", "name": "@alilc/lowcode-editor-core",
"version": "1.1.7", "version": "1.1.8-beta.4",
"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.7", "@alilc/lowcode-types": "1.1.8-beta.4",
"@alilc/lowcode-utils": "1.1.7", "@alilc/lowcode-utils": "1.1.8-beta.4",
"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,7 @@
"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": "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", "name": "@alilc/lowcode-editor-skeleton",
"version": "1.1.7", "version": "1.1.8-beta.4",
"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.7", "@alilc/lowcode-designer": "1.1.8-beta.4",
"@alilc/lowcode-editor-core": "1.1.7", "@alilc/lowcode-editor-core": "1.1.8-beta.4",
"@alilc/lowcode-types": "1.1.7", "@alilc/lowcode-types": "1.1.8-beta.4",
"@alilc/lowcode-utils": "1.1.7", "@alilc/lowcode-utils": "1.1.8-beta.4",
"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,7 @@
"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": "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", "name": "@alilc/lowcode-engine",
"version": "1.1.7", "version": "1.1.8-beta.4",
"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.7", "@alilc/lowcode-designer": "1.1.8-beta.4",
"@alilc/lowcode-editor-core": "1.1.7", "@alilc/lowcode-editor-core": "1.1.8-beta.4",
"@alilc/lowcode-editor-skeleton": "1.1.7", "@alilc/lowcode-editor-skeleton": "1.1.8-beta.4",
"@alilc/lowcode-engine-ext": "^1.0.0", "@alilc/lowcode-engine-ext": "^1.0.0",
"@alilc/lowcode-plugin-designer": "1.1.7", "@alilc/lowcode-plugin-designer": "1.1.8-beta.4",
"@alilc/lowcode-plugin-outline-pane": "1.1.7", "@alilc/lowcode-plugin-outline-pane": "1.1.8-beta.4",
"@alilc/lowcode-shell": "1.1.7", "@alilc/lowcode-shell": "1.1.8-beta.4",
"@alilc/lowcode-utils": "1.1.7", "@alilc/lowcode-utils": "1.1.8-beta.4",
"@alilc/lowcode-workspace": "1.1.7", "@alilc/lowcode-workspace": "1.1.8-beta.4",
"react": "^16.8.1", "react": "^16.8.1",
"react-dom": "^16.8.1" "react-dom": "^16.8.1"
}, },
@ -53,5 +53,7 @@
"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": "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-ignitor", "name": "@alilc/lowcode-ignitor",
"version": "1.1.7", "version": "1.1.8-beta.4",
"description": "点火器bootstrap lce project", "description": "点火器bootstrap lce project",
"main": "lib/index.js", "main": "lib/index.js",
"private": true, "private": true,
@ -16,5 +16,11 @@
"devDependencies": { "devDependencies": {
"@alib/build-scripts": "^0.1.18", "@alib/build-scripts": "^0.1.18",
"fs-extra": "^10.0.0" "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", "name": "@alilc/lowcode-plugin-designer",
"version": "1.1.7", "version": "1.1.8-beta.4",
"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.7", "@alilc/lowcode-designer": "1.1.8-beta.4",
"@alilc/lowcode-editor-core": "1.1.7", "@alilc/lowcode-editor-core": "1.1.8-beta.4",
"@alilc/lowcode-utils": "1.1.7", "@alilc/lowcode-utils": "1.1.8-beta.4",
"react": "^16.8.1", "react": "^16.8.1",
"react-dom": "^16.8.1" "react-dom": "^16.8.1"
}, },
@ -37,5 +37,7 @@
"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": "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", "name": "@alilc/lowcode-plugin-outline-pane",
"version": "1.1.7", "version": "1.1.8-beta.4",
"description": "Outline pane for Ali lowCode engine", "description": "Outline pane for Ali lowCode engine",
"files": [ "files": [
"es", "es",
@ -13,8 +13,8 @@
}, },
"dependencies": { "dependencies": {
"@alifd/next": "^1.19.16", "@alifd/next": "^1.19.16",
"@alilc/lowcode-types": "1.1.7", "@alilc/lowcode-types": "1.1.8-beta.4",
"@alilc/lowcode-utils": "1.1.7", "@alilc/lowcode-utils": "1.1.8-beta.4",
"classnames": "^2.2.6", "classnames": "^2.2.6",
"react": "^16", "react": "^16",
"react-dom": "^16.7.0", "react-dom": "^16.7.0",
@ -38,5 +38,7 @@
"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": "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 // at this moment, it is possible that pane is not ready yet, so
// put ui related operations to the next loop // put ui related operations to the next loop
setTimeout(() => { setTimeout(() => {
tree.setNodeSelected(treeNode.id); tree.setNodeSelected(treeNode.nodeId);
this.scrollToNode(treeNode, null, 4); this.scrollToNode(treeNode, null, 4);
}, 0); }, 0);
} }
@ -615,21 +615,21 @@ export class PaneController implements IPublicModelSensor, ITreeBoard, IPublicTy
if (!this._shell) { if (!this._shell) {
return undefined; 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 { private getTreeTitleRect(treeNode: TreeNode): DOMRect | undefined {
if (!this._shell) { if (!this._shell) {
return undefined; 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 { private getTreeSlotsRect(treeNode: TreeNode): DOMRect | undefined {
if (!this._shell) { if (!this._shell) {
return undefined; 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, IPublicModelNode,
IPublicTypeDisposable, IPublicTypeDisposable,
} from '@alilc/lowcode-types'; } from '@alilc/lowcode-types';
import { isI18nData, isLocationChildrenDetail } from '@alilc/lowcode-utils'; import { isI18nData, isLocationChildrenDetail, uniqueId } from '@alilc/lowcode-utils';
import EventEmitter from 'events'; import EventEmitter from 'events';
import { Tree } from './tree'; import { Tree } from './tree';
import { IOutlinePanelPluginContext } from './tree-master'; import { IOutlinePanelPluginContext } from './tree-master';
@ -60,7 +60,9 @@ export default class TreeNode {
*/ */
private _expanded = false; private _expanded = false;
get id(): string { id = uniqueId('treeNode');
get nodeId(): string {
return this.node.id; return this.node.id;
} }
@ -256,7 +258,7 @@ export default class TreeNode {
return false; return false;
} }
return ( 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) { if (!loc) {
return false; return false;
} }
return loc.target?.id === this.id; return loc.target?.id === this.nodeId;
} }
setTitleLabel(label: string) { setTitleLabel(label: string) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
{ {
"name": "@alilc/lowcode-rax-renderer", "name": "@alilc/lowcode-rax-renderer",
"version": "1.1.7", "version": "1.1.8-beta.4",
"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.7", "@alilc/lowcode-renderer-core": "1.1.8-beta.4",
"@alilc/lowcode-utils": "1.1.7", "@alilc/lowcode-utils": "1.1.8-beta.4",
"rax-find-dom-node": "^1.0.1" "rax-find-dom-node": "^1.0.1"
}, },
"devDependencies": { "devDependencies": {
@ -48,6 +48,7 @@
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/rax-renderer" "url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/rax-renderer"
}, },
"license": "MIT", "license": "MIT",
"homepage": "https://unpkg.alibaba-inc.com/@alilc/lowcode-rax-renderer@0.1.2/build/index.html", "homepage": "https://github.com/alibaba/lowcode-engine/#readme",
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6" "gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6",
"bugs": "https://github.com/alibaba/lowcode-engine/issues"
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "@alilc/lowcode-rax-simulator-renderer", "name": "@alilc/lowcode-rax-simulator-renderer",
"version": "1.1.7", "version": "1.1.8-beta.4",
"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.7", "@alilc/lowcode-designer": "1.1.8-beta.4",
"@alilc/lowcode-rax-renderer": "1.1.7", "@alilc/lowcode-rax-renderer": "1.1.8-beta.4",
"@alilc/lowcode-types": "1.1.7", "@alilc/lowcode-types": "1.1.8-beta.4",
"@alilc/lowcode-utils": "1.1.7", "@alilc/lowcode-utils": "1.1.8-beta.4",
"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",
@ -49,6 +49,7 @@
"type": "http", "type": "http",
"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://github.com/alibaba/lowcode-engine/#readme",
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6" "gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6",
"bugs": "https://github.com/alibaba/lowcode-engine/issues"
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "@alilc/lowcode-react-renderer", "name": "@alilc/lowcode-react-renderer",
"version": "1.1.7", "version": "1.1.8-beta.4",
"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.7" "@alilc/lowcode-renderer-core": "1.1.8-beta.4"
}, },
"devDependencies": { "devDependencies": {
"@alib/build-scripts": "^0.1.18", "@alib/build-scripts": "^0.1.18",
@ -41,6 +41,7 @@
"type": "http", "type": "http",
"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://github.com/alibaba/lowcode-engine/#readme",
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6" "gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6",
"bugs": "https://github.com/alibaba/lowcode-engine/issues"
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "@alilc/lowcode-react-simulator-renderer", "name": "@alilc/lowcode-react-simulator-renderer",
"version": "1.1.7", "version": "1.1.8-beta.4",
"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.7", "@alilc/lowcode-designer": "1.1.8-beta.4",
"@alilc/lowcode-react-renderer": "1.1.7", "@alilc/lowcode-react-renderer": "1.1.8-beta.4",
"@alilc/lowcode-types": "1.1.7", "@alilc/lowcode-types": "1.1.8-beta.4",
"@alilc/lowcode-utils": "1.1.7", "@alilc/lowcode-utils": "1.1.8-beta.4",
"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,7 @@
"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": "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: ['**/*/base.test.tsx'],
// testMatch: ['**/utils/common.test.ts'], // testMatch: ['**/utils/common.test.ts'],
// testMatch: ['**/*/leaf.test.tsx'], // testMatch: ['**/*/leaf.test.tsx'],
// testMatch: ['**/*/is-use-loop.test.ts'],
transformIgnorePatterns: [ transformIgnorePatterns: [
`/node_modules/(?!${esModules})/`, `/node_modules/(?!${esModules})/`,
], ],

View File

@ -1,6 +1,6 @@
{ {
"name": "@alilc/lowcode-renderer-core", "name": "@alilc/lowcode-renderer-core",
"version": "1.1.7", "version": "1.1.8-beta.4",
"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.7", "@alilc/lowcode-types": "1.1.8-beta.4",
"@alilc/lowcode-utils": "1.1.7", "@alilc/lowcode-utils": "1.1.8-beta.4",
"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.7", "@alilc/lowcode-designer": "1.1.8-beta.4",
"@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,7 @@
"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": "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) { if (this.props.children && this.props.children.length) {
return this.props.children; return this.props.children;
} }
return []; return this.props.children;
} }
get leaf(): INode | undefined { get leaf(): INode | undefined {

View File

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

View File

@ -5,6 +5,9 @@ describe('base test', () => {
it('designMode is true', () => { it('designMode is true', () => {
expect(isUseLoop([], true)).toBeFalsy(); expect(isUseLoop([], true)).toBeFalsy();
expect(isUseLoop([{}], true)).toBeTruthy(); expect(isUseLoop([{}], true)).toBeTruthy();
expect(isUseLoop(null, true)).toBeFalsy();
expect(isUseLoop(undefined, true)).toBeFalsy();
expect(isUseLoop(0, true)).toBeFalsy();
}); });
it('loop is expression', () => { it('loop is expression', () => {
@ -21,5 +24,8 @@ describe('base test', () => {
it('designMode is false', () => { it('designMode is false', () => {
expect(isUseLoop([], false)).toBeTruthy(); expect(isUseLoop([], false)).toBeTruthy();
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", "name": "@alilc/lowcode-shell",
"version": "1.1.7", "version": "1.1.8-beta.4",
"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",
@ -13,12 +13,12 @@
}, },
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@alilc/lowcode-designer": "1.1.7", "@alilc/lowcode-designer": "1.1.8-beta.4",
"@alilc/lowcode-editor-core": "1.1.7", "@alilc/lowcode-editor-core": "1.1.8-beta.4",
"@alilc/lowcode-editor-skeleton": "1.1.7", "@alilc/lowcode-editor-skeleton": "1.1.8-beta.4",
"@alilc/lowcode-types": "1.1.7", "@alilc/lowcode-types": "1.1.8-beta.4",
"@alilc/lowcode-utils": "1.1.7", "@alilc/lowcode-utils": "1.1.8-beta.4",
"@alilc/lowcode-workspace": "1.1.7", "@alilc/lowcode-workspace": "1.1.8-beta.4",
"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",
@ -48,5 +48,7 @@
"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": "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); 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 { onWindowRendererReady(fn: () => void): IPublicTypeDisposable {
return this[workspaceSymbol].onWindowRendererReady(fn); 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; return this[resourceSymbol].category;
} }
get description() {
return this[resourceSymbol].description;
}
get children() { get children() {
return this[resourceSymbol].children.map((child) => new Resource(child)); return this[resourceSymbol].children.map((child) => new Resource(child));
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "@alilc/lowcode-types", "name": "@alilc/lowcode-types",
"version": "1.1.7", "version": "1.1.8-beta.4",
"description": "Types for Ali lowCode engine", "description": "Types for Ali lowCode engine",
"files": [ "files": [
"es", "es",
@ -29,5 +29,7 @@
"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": "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'; 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 viewName(): string | undefined;
get description(): string | undefined;
get config(): { get config(): {
disableBehaviors?: ('copy' | 'remove')[]; disableBehaviors?: ('copy' | 'remove')[];
} | undefined; } | undefined;

View File

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

View File

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

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", "name": "@alilc/lowcode-utils",
"version": "1.1.7", "version": "1.1.8-beta.4",
"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.7", "@alilc/lowcode-types": "1.1.8-beta.4",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"mobx": "^6.3.0", "mobx": "^6.3.0",
"react": "^16" "react": "^16"
@ -32,5 +32,7 @@
"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": "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", "name": "@alilc/lowcode-workspace",
"version": "1.1.7", "version": "1.1.8-beta.4",
"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.7", "@alilc/lowcode-designer": "1.1.8-beta.4",
"@alilc/lowcode-editor-core": "1.1.7", "@alilc/lowcode-editor-core": "1.1.8-beta.4",
"@alilc/lowcode-editor-skeleton": "1.1.7", "@alilc/lowcode-editor-skeleton": "1.1.8-beta.4",
"@alilc/lowcode-types": "1.1.7", "@alilc/lowcode-types": "1.1.8-beta.4",
"@alilc/lowcode-utils": "1.1.7", "@alilc/lowcode-utils": "1.1.8-beta.4",
"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",
@ -47,7 +47,9 @@
}, },
"repository": { "repository": {
"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/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; editorWindow: IEditorWindow;
viewName: string; viewName: string;
viewType: 'editor' | 'webview';
} }
export class Context extends BasicContext implements IViewContext { export class Context extends BasicContext implements IViewContext {

View File

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

View File

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