mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-06-12 18:32:20 +00:00
Compare commits
11 Commits
main
...
v1.1.8-bet
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
60bf22a367 | ||
|
|
4b43ca67fa | ||
|
|
124f91d546 | ||
|
|
40164ea27d | ||
|
|
4cb43210a5 | ||
|
|
34eec71c42 | ||
|
|
64db350216 | ||
|
|
cb0b9771f4 | ||
|
|
a95bd10f62 | ||
|
|
fe8169f182 | ||
|
|
d7b4fe2e3c |
@ -22,7 +22,7 @@ sidebar_position: 4
|
||||
|
||||

|
||||
|
||||
- 协议层:基于《低代码引擎搭建协议规范》](/site/docs/specs/lowcode-spec) 产出的 Schema 作为我们的规范协议。
|
||||
- 协议层:基于[《低代码引擎搭建协议规范》](/site/docs/specs/lowcode-spec) 产出的 Schema 作为我们的规范协议。
|
||||
- 能力层:提供组件、区块、页面等渲染所需的核心能力,包括 Props 解析、样式注入、条件渲染等。
|
||||
- 适配层:由于我们使用的运行时框架不是统一的,所以统一使用适配层将不同运行框架的差异部分,通过接口对外,让渲染层注册/适配对应所需的方法。能保障渲染层和能力层直接通过适配层连接起来,能起到独立可扩展的作用。
|
||||
- 渲染层:提供核心的渲染方法,由于不同运行时框架提供的渲染方法是不同的,所以其通过适配层进行注入,只需要提供适配层所需的接口,即可实现渲染。
|
||||
|
||||
@ -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 @@
|
||||
{
|
||||
"lerna": "4.0.0",
|
||||
"version": "1.1.7",
|
||||
"version": "1.1.8-beta.1",
|
||||
"npmClient": "yarn",
|
||||
"useWorkspaces": true,
|
||||
"packages": [
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-code-generator",
|
||||
"version": "1.1.2",
|
||||
"version": "1.1.3",
|
||||
"description": "出码引擎 for LowCode Engine",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
|
||||
@ -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();
|
||||
})
|
||||
});
|
||||
|
||||
@ -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.1",
|
||||
"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.1",
|
||||
"@alilc/lowcode-types": "1.1.8-beta.1",
|
||||
"@alilc/lowcode-utils": "1.1.8-beta.1",
|
||||
"classnames": "^2.2.6",
|
||||
"react": "^16",
|
||||
"react-dom": "^16.7.0",
|
||||
|
||||
@ -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.1",
|
||||
"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.1",
|
||||
"@alilc/lowcode-utils": "1.1.8-beta.1",
|
||||
"classnames": "^2.2.6",
|
||||
"debug": "^4.1.1",
|
||||
"intl-messageformat": "^9.3.1",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-editor-skeleton",
|
||||
"version": "1.1.7",
|
||||
"version": "1.1.8-beta.1",
|
||||
"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.1",
|
||||
"@alilc/lowcode-editor-core": "1.1.8-beta.1",
|
||||
"@alilc/lowcode-types": "1.1.8-beta.1",
|
||||
"@alilc/lowcode-utils": "1.1.8-beta.1",
|
||||
"classnames": "^2.2.6",
|
||||
"react": "^16.8.1",
|
||||
"react-dom": "^16.8.1"
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-engine",
|
||||
"version": "1.1.7",
|
||||
"version": "1.1.8-beta.1",
|
||||
"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.1",
|
||||
"@alilc/lowcode-editor-core": "1.1.8-beta.1",
|
||||
"@alilc/lowcode-editor-skeleton": "1.1.8-beta.1",
|
||||
"@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.1",
|
||||
"@alilc/lowcode-plugin-outline-pane": "1.1.8-beta.1",
|
||||
"@alilc/lowcode-shell": "1.1.8-beta.1",
|
||||
"@alilc/lowcode-utils": "1.1.8-beta.1",
|
||||
"@alilc/lowcode-workspace": "1.1.8-beta.1",
|
||||
"react": "^16.8.1",
|
||||
"react-dom": "^16.8.1"
|
||||
},
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-ignitor",
|
||||
"version": "1.1.7",
|
||||
"version": "1.1.8-beta.1",
|
||||
"description": "点火器,bootstrap lce project",
|
||||
"main": "lib/index.js",
|
||||
"private": true,
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-plugin-designer",
|
||||
"version": "1.1.7",
|
||||
"version": "1.1.8-beta.1",
|
||||
"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.1",
|
||||
"@alilc/lowcode-editor-core": "1.1.8-beta.1",
|
||||
"@alilc/lowcode-utils": "1.1.8-beta.1",
|
||||
"react": "^16.8.1",
|
||||
"react-dom": "^16.8.1"
|
||||
},
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-plugin-outline-pane",
|
||||
"version": "1.1.7",
|
||||
"version": "1.1.8-beta.1",
|
||||
"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.1",
|
||||
"@alilc/lowcode-utils": "1.1.8-beta.1",
|
||||
"classnames": "^2.2.6",
|
||||
"react": "^16",
|
||||
"react-dom": "^16.7.0",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-rax-renderer",
|
||||
"version": "1.1.7",
|
||||
"version": "1.1.8-beta.1",
|
||||
"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.1",
|
||||
"@alilc/lowcode-utils": "1.1.8-beta.1",
|
||||
"rax-find-dom-node": "^1.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-rax-simulator-renderer",
|
||||
"version": "1.1.7",
|
||||
"version": "1.1.8-beta.1",
|
||||
"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.1",
|
||||
"@alilc/lowcode-rax-renderer": "1.1.8-beta.1",
|
||||
"@alilc/lowcode-types": "1.1.8-beta.1",
|
||||
"@alilc/lowcode-utils": "1.1.8-beta.1",
|
||||
"classnames": "^2.2.6",
|
||||
"driver-universal": "^3.1.3",
|
||||
"history": "^5.0.0",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-react-renderer",
|
||||
"version": "1.1.7",
|
||||
"version": "1.1.8-beta.1",
|
||||
"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.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@alib/build-scripts": "^0.1.18",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-react-simulator-renderer",
|
||||
"version": "1.1.7",
|
||||
"version": "1.1.8-beta.1",
|
||||
"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.1",
|
||||
"@alilc/lowcode-react-renderer": "1.1.8-beta.1",
|
||||
"@alilc/lowcode-types": "1.1.8-beta.1",
|
||||
"@alilc/lowcode-utils": "1.1.8-beta.1",
|
||||
"classnames": "^2.2.6",
|
||||
"mobx": "^6.3.0",
|
||||
"mobx-react": "^7.2.0",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-renderer-core",
|
||||
"version": "1.1.7",
|
||||
"version": "1.1.8-beta.1",
|
||||
"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.1",
|
||||
"@alilc/lowcode-utils": "1.1.8-beta.1",
|
||||
"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.1",
|
||||
"@babel/plugin-transform-typescript": "^7.16.8",
|
||||
"@testing-library/react": "^11.2.2",
|
||||
"@types/classnames": "^2.2.11",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-shell",
|
||||
"version": "1.1.7",
|
||||
"version": "1.1.8-beta.1",
|
||||
"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.1",
|
||||
"@alilc/lowcode-editor-core": "1.1.8-beta.1",
|
||||
"@alilc/lowcode-editor-skeleton": "1.1.8-beta.1",
|
||||
"@alilc/lowcode-types": "1.1.8-beta.1",
|
||||
"@alilc/lowcode-utils": "1.1.8-beta.1",
|
||||
"@alilc/lowcode-workspace": "1.1.8-beta.1",
|
||||
"classnames": "^2.2.6",
|
||||
"enzyme": "^3.11.0",
|
||||
"enzyme-adapter-react-16": "^1.15.5",
|
||||
|
||||
@ -34,6 +34,21 @@ 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,
|
||||
} = d.resourceTypeModel({} as any, {});
|
||||
|
||||
return {
|
||||
resourceName,
|
||||
resourceType,
|
||||
description,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
onWindowRendererReady(fn: () => void): IPublicTypeDisposable {
|
||||
return this[workspaceSymbol].onWindowRendererReady(fn);
|
||||
}
|
||||
|
||||
@ -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.1",
|
||||
"description": "Types for Ali lowCode engine",
|
||||
"files": [
|
||||
"es",
|
||||
|
||||
@ -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';
|
||||
|
||||
@ -195,6 +195,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.1",
|
||||
"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.1",
|
||||
"lodash": "^4.17.21",
|
||||
"mobx": "^6.3.0",
|
||||
"react": "^16"
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-workspace",
|
||||
"version": "1.1.7",
|
||||
"version": "1.1.8-beta.1",
|
||||
"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.1",
|
||||
"@alilc/lowcode-editor-core": "1.1.8-beta.1",
|
||||
"@alilc/lowcode-editor-skeleton": "1.1.8-beta.1",
|
||||
"@alilc/lowcode-types": "1.1.8-beta.1",
|
||||
"@alilc/lowcode-utils": "1.1.8-beta.1",
|
||||
"classnames": "^2.2.6",
|
||||
"enzyme": "^3.11.0",
|
||||
"enzyme-adapter-react-16": "^1.15.5",
|
||||
|
||||
@ -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() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user