mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-06-06 15:40:59 +00:00
Compare commits
28 Commits
main
...
v1.1.8-bet
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
578b28a704 | ||
|
|
e09c928fe2 | ||
|
|
b95b471388 | ||
|
|
d8acd2c953 | ||
|
|
1c06c31ecb | ||
|
|
642fc8393e | ||
|
|
800c84608e | ||
|
|
ed922bea3d | ||
|
|
f8c503b8bf | ||
|
|
4aea299aa9 | ||
|
|
7952c1c87a | ||
|
|
8eb536bd21 | ||
|
|
3df03b6f80 | ||
|
|
b5070a2721 | ||
|
|
469c7844b2 | ||
|
|
ba4b3110e7 | ||
|
|
19b886d2a7 | ||
|
|
60bf22a367 | ||
|
|
4b43ca67fa | ||
|
|
124f91d546 | ||
|
|
40164ea27d | ||
|
|
4cb43210a5 | ||
|
|
34eec71c42 | ||
|
|
64db350216 | ||
|
|
cb0b9771f4 | ||
|
|
a95bd10f62 | ||
|
|
fe8169f182 | ||
|
|
d7b4fe2e3c |
@ -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
|
||||
增加一个属性的管道处理函数
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@ sidebar_position: 4
|
||||
|
||||

|
||||
|
||||
- 协议层:基于《低代码引擎搭建协议规范》](/site/docs/specs/lowcode-spec) 产出的 Schema 作为我们的规范协议。
|
||||
- 协议层:基于[《低代码引擎搭建协议规范》](/site/docs/specs/lowcode-spec) 产出的 Schema 作为我们的规范协议。
|
||||
- 能力层:提供组件、区块、页面等渲染所需的核心能力,包括 Props 解析、样式注入、条件渲染等。
|
||||
- 适配层:由于我们使用的运行时框架不是统一的,所以统一使用适配层将不同运行框架的差异部分,通过接口对外,让渲染层注册/适配对应所需的方法。能保障渲染层和能力层直接通过适配层连接起来,能起到独立可扩展的作用。
|
||||
- 渲染层:提供核心的渲染方法,由于不同运行时框架提供的渲染方法是不同的,所以其通过适配层进行注入,只需要提供适配层所需的接口,即可实现渲染。
|
||||
|
||||
@ -32,7 +32,7 @@ sidebar_position: 6
|
||||
|
||||
### SettingTarget 抽象
|
||||
|
||||
如果不是多选,可以直接暴露 `Node` 给到这,但涉及多选编辑的时候,大家的值时通常是不一样的,设置的时候需要批量设置进去,这里主要封装这些逻辑,把多选编辑的复杂性屏蔽掉。
|
||||
如果不是多选,可以直接暴露 `Node` 给到这,但涉及多选编辑的时候,大家的值通常是不一样的,设置的时候需要批量设置进去,这里主要封装这些逻辑,把多选编辑的复杂性屏蔽掉。
|
||||
|
||||
所选节点所构成的**设置对象**抽象如下:
|
||||
|
||||
|
||||
@ -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');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-engine-docs",
|
||||
"version": "1.0.30",
|
||||
"version": "1.0.32",
|
||||
"description": "低代码引擎版本化文档",
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"lerna": "4.0.0",
|
||||
"version": "1.1.7",
|
||||
"version": "1.1.8-beta.5",
|
||||
"npmClient": "yarn",
|
||||
"useWorkspaces": true,
|
||||
"packages": [
|
||||
|
||||
@ -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"
|
||||
}
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -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));
|
||||
}
|
||||
|
||||
|
||||
@ -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",
|
||||
},
|
||||
}
|
||||
`;
|
||||
|
||||
@ -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();
|
||||
})
|
||||
});
|
||||
|
||||
@ -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"
|
||||
}
|
||||
|
||||
@ -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})/`,
|
||||
],
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-designer",
|
||||
"version": "1.1.7",
|
||||
"version": "1.1.8-beta.5",
|
||||
"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.5",
|
||||
"@alilc/lowcode-types": "1.1.8-beta.5",
|
||||
"@alilc/lowcode-utils": "1.1.8-beta.5",
|
||||
"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"
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 选择当前节点
|
||||
*/
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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 方法 - 选中的节点没有被删除的', () => {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-editor-core",
|
||||
"version": "1.1.7",
|
||||
"version": "1.1.8-beta.5",
|
||||
"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.5",
|
||||
"@alilc/lowcode-utils": "1.1.8-beta.5",
|
||||
"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"
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-editor-skeleton",
|
||||
"version": "1.1.7",
|
||||
"version": "1.1.8-beta.5",
|
||||
"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.5",
|
||||
"@alilc/lowcode-editor-core": "1.1.8-beta.5",
|
||||
"@alilc/lowcode-types": "1.1.8-beta.5",
|
||||
"@alilc/lowcode-utils": "1.1.8-beta.5",
|
||||
"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"
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-engine",
|
||||
"version": "1.1.7",
|
||||
"version": "1.1.8-beta.5",
|
||||
"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.5",
|
||||
"@alilc/lowcode-editor-core": "1.1.8-beta.5",
|
||||
"@alilc/lowcode-editor-skeleton": "1.1.8-beta.5",
|
||||
"@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.5",
|
||||
"@alilc/lowcode-plugin-outline-pane": "1.1.8-beta.5",
|
||||
"@alilc/lowcode-shell": "1.1.8-beta.5",
|
||||
"@alilc/lowcode-utils": "1.1.8-beta.5",
|
||||
"@alilc/lowcode-workspace": "1.1.8-beta.5",
|
||||
"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"
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-ignitor",
|
||||
"version": "1.1.7",
|
||||
"version": "1.1.8-beta.5",
|
||||
"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"
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-plugin-designer",
|
||||
"version": "1.1.7",
|
||||
"version": "1.1.8-beta.5",
|
||||
"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.5",
|
||||
"@alilc/lowcode-editor-core": "1.1.8-beta.5",
|
||||
"@alilc/lowcode-utils": "1.1.8-beta.5",
|
||||
"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"
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-plugin-outline-pane",
|
||||
"version": "1.1.7",
|
||||
"version": "1.1.8-beta.5",
|
||||
"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.5",
|
||||
"@alilc/lowcode-utils": "1.1.8-beta.5",
|
||||
"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"
|
||||
}
|
||||
|
||||
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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>
|
||||
);
|
||||
|
||||
@ -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}
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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() {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-rax-renderer",
|
||||
"version": "1.1.7",
|
||||
"version": "1.1.8-beta.5",
|
||||
"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.5",
|
||||
"@alilc/lowcode-utils": "1.1.8-beta.5",
|
||||
"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"
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-rax-simulator-renderer",
|
||||
"version": "1.1.7",
|
||||
"version": "1.1.8-beta.5",
|
||||
"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.5",
|
||||
"@alilc/lowcode-rax-renderer": "1.1.8-beta.5",
|
||||
"@alilc/lowcode-types": "1.1.8-beta.5",
|
||||
"@alilc/lowcode-utils": "1.1.8-beta.5",
|
||||
"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"
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-react-renderer",
|
||||
"version": "1.1.7",
|
||||
"version": "1.1.8-beta.5",
|
||||
"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.5"
|
||||
},
|
||||
"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"
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-react-simulator-renderer",
|
||||
"version": "1.1.7",
|
||||
"version": "1.1.8-beta.5",
|
||||
"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.5",
|
||||
"@alilc/lowcode-react-renderer": "1.1.8-beta.5",
|
||||
"@alilc/lowcode-types": "1.1.8-beta.5",
|
||||
"@alilc/lowcode-utils": "1.1.8-beta.5",
|
||||
"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"
|
||||
}
|
||||
|
||||
@ -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})/`,
|
||||
],
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-renderer-core",
|
||||
"version": "1.1.7",
|
||||
"version": "1.1.8-beta.5",
|
||||
"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.5",
|
||||
"@alilc/lowcode-utils": "1.1.8-beta.5",
|
||||
"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.5",
|
||||
"@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"
|
||||
}
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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();
|
||||
});
|
||||
});
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-shell",
|
||||
"version": "1.1.7",
|
||||
"version": "1.1.8-beta.5",
|
||||
"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.5",
|
||||
"@alilc/lowcode-editor-core": "1.1.8-beta.5",
|
||||
"@alilc/lowcode-editor-skeleton": "1.1.8-beta.5",
|
||||
"@alilc/lowcode-types": "1.1.8-beta.5",
|
||||
"@alilc/lowcode-utils": "1.1.8-beta.5",
|
||||
"@alilc/lowcode-workspace": "1.1.8-beta.5",
|
||||
"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"
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -24,4 +24,12 @@ export class EditorView {
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
get viewName() {
|
||||
return this[editorViewSymbol].viewName;
|
||||
}
|
||||
|
||||
get viewType() {
|
||||
return this[editorViewSymbol].viewType;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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));
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-types",
|
||||
"version": "1.1.7",
|
||||
"version": "1.1.8-beta.5",
|
||||
"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"
|
||||
}
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
import { IPublicModelPluginContext } from './plugin-context';
|
||||
|
||||
export interface IPublicModelEditorView extends IPublicModelPluginContext {}
|
||||
export interface IPublicModelEditorView extends IPublicModelPluginContext {
|
||||
viewName: string;
|
||||
|
||||
viewType: 'editor' | 'webview';
|
||||
}
|
||||
@ -19,6 +19,8 @@ export interface IBaseModelResource<
|
||||
|
||||
get viewName(): string | undefined;
|
||||
|
||||
get description(): string | undefined;
|
||||
|
||||
get config(): {
|
||||
disableBehaviors?: ('copy' | 'remove')[];
|
||||
} | undefined;
|
||||
|
||||
@ -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';
|
||||
|
||||
@ -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
|
||||
|
||||
32
packages/types/src/shell/type/simulator-renderer.ts
Normal file
32
packages/types/src/shell/type/simulator-renderer.ts
Normal 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>;
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-utils",
|
||||
"version": "1.1.7",
|
||||
"version": "1.1.8-beta.5",
|
||||
"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.5",
|
||||
"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"
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-workspace",
|
||||
"version": "1.1.7",
|
||||
"version": "1.1.8-beta.5",
|
||||
"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.5",
|
||||
"@alilc/lowcode-editor-core": "1.1.8-beta.5",
|
||||
"@alilc/lowcode-editor-skeleton": "1.1.8-beta.5",
|
||||
"@alilc/lowcode-types": "1.1.8-beta.5",
|
||||
"@alilc/lowcode-utils": "1.1.8-beta.5",
|
||||
"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"
|
||||
}
|
||||
|
||||
@ -10,6 +10,8 @@ export interface IViewContext extends IBasicContext {
|
||||
editorWindow: IEditorWindow;
|
||||
|
||||
viewName: string;
|
||||
|
||||
viewType: 'editor' | 'webview';
|
||||
}
|
||||
|
||||
export class Context extends BasicContext implements IViewContext {
|
||||
|
||||
@ -12,6 +12,8 @@ export interface IBaseResource<T> extends IBaseModelResource<T> {
|
||||
|
||||
skeleton: ISkeleton;
|
||||
|
||||
description?: string;
|
||||
|
||||
get editorViews(): IPublicTypeEditorView[];
|
||||
|
||||
get defaultViewType(): string;
|
||||
|
||||
@ -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
45
scripts/set-repo.js
Normal 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}`);
|
||||
}
|
||||
}
|
||||
})();
|
||||
Loading…
x
Reference in New Issue
Block a user