mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-06-11 09:52:33 +00:00
Compare commits
8 Commits
main
...
v1.1.4-bet
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
904a687573 | ||
|
|
b7b0366de5 | ||
|
|
7eae3562a0 | ||
|
|
d2b6bc7565 | ||
|
|
1e95f1d0d0 | ||
|
|
e6f1a34c2b | ||
|
|
43d618dbc6 | ||
|
|
f295278bfb |
@ -172,19 +172,16 @@ skeleton.add({
|
|||||||
area: 'leftArea',
|
area: 'leftArea',
|
||||||
type: 'Dock',
|
type: 'Dock',
|
||||||
name: 'opener',
|
name: 'opener',
|
||||||
content: Opener, // Widget 组件实例
|
|
||||||
contentProps: { // Widget 插件 props
|
|
||||||
xxx: '1',
|
|
||||||
},
|
|
||||||
props: {
|
props: {
|
||||||
|
icon: Icon, // Icon 组件实例
|
||||||
align: 'bottom',
|
align: 'bottom',
|
||||||
},
|
onClick: function () {
|
||||||
onClick: function () {
|
// 打开外部链接
|
||||||
// 打开外部链接
|
window.open('https://lowcode-engine.cn');
|
||||||
window.open('https://lowcode-engine.cn');
|
// 显示 widget
|
||||||
// 显示 widget
|
skeleton.showWidget('xxx');
|
||||||
skeleton.showWidget('xxx');
|
}
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@alilc/lowcode-engine-docs",
|
"name": "@alilc/lowcode-engine-docs",
|
||||||
"version": "1.0.20",
|
"version": "1.0.21",
|
||||||
"description": "低代码引擎版本化文档",
|
"description": "低代码引擎版本化文档",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"files": [
|
"files": [
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"lerna": "4.0.0",
|
"lerna": "4.0.0",
|
||||||
"version": "1.1.3",
|
"version": "1.1.4-beta.2",
|
||||||
"npmClient": "yarn",
|
"npmClient": "yarn",
|
||||||
"useWorkspaces": true,
|
"useWorkspaces": true,
|
||||||
"packages": [
|
"packages": [
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@alilc/lowcode-designer",
|
"name": "@alilc/lowcode-designer",
|
||||||
"version": "1.1.3",
|
"version": "1.1.4-beta.2",
|
||||||
"description": "Designer for Ali LowCode Engine",
|
"description": "Designer for Ali LowCode Engine",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"module": "es/index.js",
|
"module": "es/index.js",
|
||||||
@ -15,9 +15,9 @@
|
|||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@alilc/lowcode-editor-core": "1.1.3",
|
"@alilc/lowcode-editor-core": "1.1.4-beta.2",
|
||||||
"@alilc/lowcode-types": "1.1.3",
|
"@alilc/lowcode-types": "1.1.4-beta.2",
|
||||||
"@alilc/lowcode-utils": "1.1.3",
|
"@alilc/lowcode-utils": "1.1.4-beta.2",
|
||||||
"classnames": "^2.2.6",
|
"classnames": "^2.2.6",
|
||||||
"react": "^16",
|
"react": "^16",
|
||||||
"react-dom": "^16.7.0",
|
"react-dom": "^16.7.0",
|
||||||
|
|||||||
@ -1,12 +1,12 @@
|
|||||||
import { Component } from '../simulator';
|
import { Component } from '../simulator';
|
||||||
import { IPublicTypeNodeSchema, IPublicTypeComponentInstance, IPublicTypeNodeInstance, Asset } from '@alilc/lowcode-types';
|
import { IPublicTypeComponentInstance, IPublicTypeNodeInstance, Asset, IPublicTypeComponentSchema, IPublicTypeProjectSchema, IPublicTypeLowCodeComponent } from '@alilc/lowcode-types';
|
||||||
|
|
||||||
export interface BuiltinSimulatorRenderer {
|
export interface BuiltinSimulatorRenderer {
|
||||||
readonly isSimulatorRenderer: true;
|
readonly isSimulatorRenderer: true;
|
||||||
autoRepaintNode?: boolean;
|
autoRepaintNode?: boolean;
|
||||||
components: Record<string, Component>;
|
components: Record<string, Component>;
|
||||||
rerender: () => void;
|
rerender: () => void;
|
||||||
createComponent(schema: IPublicTypeNodeSchema): Component | null;
|
createComponent(schema: IPublicTypeProjectSchema<IPublicTypeComponentSchema>): Component | null;
|
||||||
getComponent(componentName: string): Component;
|
getComponent(componentName: string): Component;
|
||||||
getClosestNodeInstance(
|
getClosestNodeInstance(
|
||||||
from: IPublicTypeComponentInstance,
|
from: IPublicTypeComponentInstance,
|
||||||
|
|||||||
@ -73,7 +73,7 @@ INode
|
|||||||
|
|
||||||
onEffect(action: () => void): IPublicTypeDisposable;
|
onEffect(action: () => void): IPublicTypeDisposable;
|
||||||
|
|
||||||
internalToShell(): IPublicModelSettingField;
|
internalToShellField(): IPublicModelSettingField;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SettingField extends SettingPropEntry implements ISettingField {
|
export class SettingField extends SettingPropEntry implements ISettingField {
|
||||||
@ -143,7 +143,7 @@ export class SettingField extends SettingPropEntry implements ISettingField {
|
|||||||
}
|
}
|
||||||
if (isDynamicSetter(this._setter)) {
|
if (isDynamicSetter(this._setter)) {
|
||||||
return untracked(() => {
|
return untracked(() => {
|
||||||
const shellThis = this.internalToShell();
|
const shellThis = this.internalToShellField();
|
||||||
return (this._setter as IPublicTypeDynamicSetter)?.call(shellThis, shellThis!);
|
return (this._setter as IPublicTypeDynamicSetter)?.call(shellThis, shellThis!);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -296,7 +296,7 @@ export class SettingField extends SettingPropEntry implements ISettingField {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
internalToShell() {
|
internalToShellField() {
|
||||||
return this.designer!.shellModelFactory.createSettingField(this);
|
return this.designer!.shellModelFactory.createSettingField(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,7 +35,7 @@ export interface ISettingPropEntry extends ISettingEntry {
|
|||||||
|
|
||||||
setValue(val: any, isHotValue?: boolean, force?: boolean, extraOptions?: IPublicTypeSetValueOptions): void;
|
setValue(val: any, isHotValue?: boolean, force?: boolean, extraOptions?: IPublicTypeSetValueOptions): void;
|
||||||
|
|
||||||
internalToShell(): IPublicModelSettingField;
|
internalToShellField(): IPublicModelSettingField;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SettingPropEntry implements ISettingPropEntry {
|
export class SettingPropEntry implements ISettingPropEntry {
|
||||||
@ -157,7 +157,7 @@ export class SettingPropEntry implements ISettingPropEntry {
|
|||||||
if (this.type !== 'field') {
|
if (this.type !== 'field') {
|
||||||
const { getValue } = this.extraProps;
|
const { getValue } = this.extraProps;
|
||||||
return getValue
|
return getValue
|
||||||
? getValue(this.internalToShell()!, undefined) === undefined
|
? getValue(this.internalToShellField()!, undefined) === undefined
|
||||||
? 0
|
? 0
|
||||||
: 1
|
: 1
|
||||||
: 0;
|
: 0;
|
||||||
@ -196,7 +196,7 @@ export class SettingPropEntry implements ISettingPropEntry {
|
|||||||
}
|
}
|
||||||
const { getValue } = this.extraProps;
|
const { getValue } = this.extraProps;
|
||||||
try {
|
try {
|
||||||
return getValue ? getValue(this.internalToShell()!, val) : val;
|
return getValue ? getValue(this.internalToShellField()!, val) : val;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.warn(e);
|
console.warn(e);
|
||||||
return val;
|
return val;
|
||||||
@ -215,7 +215,7 @@ export class SettingPropEntry implements ISettingPropEntry {
|
|||||||
const { setValue } = this.extraProps;
|
const { setValue } = this.extraProps;
|
||||||
if (setValue && !extraOptions?.disableMutator) {
|
if (setValue && !extraOptions?.disableMutator) {
|
||||||
try {
|
try {
|
||||||
setValue(this.internalToShell()!, val);
|
setValue(this.internalToShellField()!, val);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
/* istanbul ignore next */
|
/* istanbul ignore next */
|
||||||
console.warn(e);
|
console.warn(e);
|
||||||
@ -238,7 +238,7 @@ export class SettingPropEntry implements ISettingPropEntry {
|
|||||||
const { setValue } = this.extraProps;
|
const { setValue } = this.extraProps;
|
||||||
if (setValue) {
|
if (setValue) {
|
||||||
try {
|
try {
|
||||||
setValue(this.internalToShell()!, undefined);
|
setValue(this.internalToShellField()!, undefined);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
/* istanbul ignore next */
|
/* istanbul ignore next */
|
||||||
console.warn(e);
|
console.warn(e);
|
||||||
@ -394,7 +394,7 @@ export class SettingPropEntry implements ISettingPropEntry {
|
|||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
internalToShell(): IPublicModelSettingField {
|
internalToShellField(): IPublicModelSettingField {
|
||||||
return this.designer!.shellModelFactory.createSettingField(this);;
|
return this.designer!.shellModelFactory.createSettingField(this);;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@alilc/lowcode-editor-core",
|
"name": "@alilc/lowcode-editor-core",
|
||||||
"version": "1.1.3",
|
"version": "1.1.4-beta.2",
|
||||||
"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.3",
|
"@alilc/lowcode-types": "1.1.4-beta.2",
|
||||||
"@alilc/lowcode-utils": "1.1.3",
|
"@alilc/lowcode-utils": "1.1.4-beta.2",
|
||||||
"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",
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@alilc/lowcode-editor-skeleton",
|
"name": "@alilc/lowcode-editor-skeleton",
|
||||||
"version": "1.1.3",
|
"version": "1.1.4-beta.2",
|
||||||
"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",
|
||||||
@ -18,10 +18,10 @@
|
|||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@alifd/next": "^1.20.12",
|
"@alifd/next": "^1.20.12",
|
||||||
"@alilc/lowcode-designer": "1.1.3",
|
"@alilc/lowcode-designer": "1.1.4-beta.2",
|
||||||
"@alilc/lowcode-editor-core": "1.1.3",
|
"@alilc/lowcode-editor-core": "1.1.4-beta.2",
|
||||||
"@alilc/lowcode-types": "1.1.3",
|
"@alilc/lowcode-types": "1.1.4-beta.2",
|
||||||
"@alilc/lowcode-utils": "1.1.3",
|
"@alilc/lowcode-utils": "1.1.4-beta.2",
|
||||||
"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"
|
||||||
|
|||||||
@ -80,7 +80,7 @@ class SettingFieldView extends Component<SettingFieldViewProps, SettingFieldView
|
|||||||
const { extraProps } = this.field;
|
const { extraProps } = this.field;
|
||||||
const { condition } = extraProps;
|
const { condition } = extraProps;
|
||||||
try {
|
try {
|
||||||
return typeof condition === 'function' ? condition(this.field.internalToShell()) !== false : true;
|
return typeof condition === 'function' ? condition(this.field.internalToShellField()) !== false : true;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('exception when condition (hidden) is excuted', error);
|
console.error('exception when condition (hidden) is excuted', error);
|
||||||
}
|
}
|
||||||
@ -123,7 +123,7 @@ class SettingFieldView extends Component<SettingFieldViewProps, SettingFieldView
|
|||||||
if (setter.props) {
|
if (setter.props) {
|
||||||
setterProps = setter.props;
|
setterProps = setter.props;
|
||||||
if (typeof setterProps === 'function') {
|
if (typeof setterProps === 'function') {
|
||||||
setterProps = setterProps(this.field.internalToShell());
|
setterProps = setterProps(this.field.internalToShellField());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (setter.initialValue != null) {
|
if (setter.initialValue != null) {
|
||||||
@ -190,7 +190,7 @@ class SettingFieldView extends Component<SettingFieldViewProps, SettingFieldView
|
|||||||
}
|
}
|
||||||
// 当前 field 没有 value 值时,将 initialValue 写入 field
|
// 当前 field 没有 value 值时,将 initialValue 写入 field
|
||||||
// 之所以用 initialValue,而不是 defaultValue 是为了保持跟 props.onInitial 的逻辑一致
|
// 之所以用 initialValue,而不是 defaultValue 是为了保持跟 props.onInitial 的逻辑一致
|
||||||
const _initialValue = typeof initialValue === 'function' ? initialValue(this.field.internalToShell()) : initialValue;
|
const _initialValue = typeof initialValue === 'function' ? initialValue(this.field.internalToShellField()) : initialValue;
|
||||||
this.field.setValue(_initialValue);
|
this.field.setValue(_initialValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,9 +238,9 @@ class SettingFieldView extends Component<SettingFieldViewProps, SettingFieldView
|
|||||||
forceInline: extraProps.forceInline,
|
forceInline: extraProps.forceInline,
|
||||||
key: field.id,
|
key: field.id,
|
||||||
// === injection
|
// === injection
|
||||||
prop: field.internalToShell(), // for compatible vision
|
prop: field.internalToShellField(), // for compatible vision
|
||||||
selected: field.top?.getNode()?.internalToShellNode(),
|
selected: field.top?.getNode()?.internalToShellNode(),
|
||||||
field: field.internalToShell(),
|
field: field.internalToShellField(),
|
||||||
// === IO
|
// === IO
|
||||||
value, // reaction point
|
value, // reaction point
|
||||||
initialValue,
|
initialValue,
|
||||||
@ -257,7 +257,7 @@ class SettingFieldView extends Component<SettingFieldViewProps, SettingFieldView
|
|||||||
if (initialValue == null) {
|
if (initialValue == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const value = typeof initialValue === 'function' ? initialValue(field.internalToShell()) : initialValue;
|
const value = typeof initialValue === 'function' ? initialValue(field.internalToShellField()) : initialValue;
|
||||||
this.setState({
|
this.setState({
|
||||||
// eslint-disable-next-line react/no-unused-state
|
// eslint-disable-next-line react/no-unused-state
|
||||||
value,
|
value,
|
||||||
@ -316,7 +316,7 @@ class SettingGroupView extends Component<SettingGroupViewProps> {
|
|||||||
const { field } = this.props;
|
const { field } = this.props;
|
||||||
const { extraProps } = field;
|
const { extraProps } = field;
|
||||||
const { condition, display } = extraProps;
|
const { condition, display } = extraProps;
|
||||||
const visible = field.isSingle && typeof condition === 'function' ? condition(field.internalToShell()) !== false : true;
|
const visible = field.isSingle && typeof condition === 'function' ? condition(field.internalToShellField()) !== false : true;
|
||||||
|
|
||||||
if (!visible) {
|
if (!visible) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@alilc/lowcode-engine",
|
"name": "@alilc/lowcode-engine",
|
||||||
"version": "1.1.3",
|
"version": "1.1.4-beta.2",
|
||||||
"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.3",
|
"@alilc/lowcode-designer": "1.1.4-beta.2",
|
||||||
"@alilc/lowcode-editor-core": "1.1.3",
|
"@alilc/lowcode-editor-core": "1.1.4-beta.2",
|
||||||
"@alilc/lowcode-editor-skeleton": "1.1.3",
|
"@alilc/lowcode-editor-skeleton": "1.1.4-beta.2",
|
||||||
"@alilc/lowcode-engine-ext": "^1.0.0",
|
"@alilc/lowcode-engine-ext": "^1.0.0",
|
||||||
"@alilc/lowcode-plugin-designer": "1.1.3",
|
"@alilc/lowcode-plugin-designer": "1.1.4-beta.2",
|
||||||
"@alilc/lowcode-plugin-outline-pane": "1.1.3",
|
"@alilc/lowcode-plugin-outline-pane": "1.1.4-beta.2",
|
||||||
"@alilc/lowcode-shell": "1.1.3",
|
"@alilc/lowcode-shell": "1.1.4-beta.2",
|
||||||
"@alilc/lowcode-utils": "1.1.3",
|
"@alilc/lowcode-utils": "1.1.4-beta.2",
|
||||||
"@alilc/lowcode-workspace": "1.1.3",
|
"@alilc/lowcode-workspace": "1.1.4-beta.2",
|
||||||
"react": "^16.8.1",
|
"react": "^16.8.1",
|
||||||
"react-dom": "^16.8.1"
|
"react-dom": "^16.8.1"
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@alilc/lowcode-ignitor",
|
"name": "@alilc/lowcode-ignitor",
|
||||||
"version": "1.1.3",
|
"version": "1.1.4-beta.2",
|
||||||
"description": "点火器,bootstrap lce project",
|
"description": "点火器,bootstrap lce project",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"private": true,
|
"private": true,
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@alilc/lowcode-plugin-designer",
|
"name": "@alilc/lowcode-plugin-designer",
|
||||||
"version": "1.1.3",
|
"version": "1.1.4-beta.2",
|
||||||
"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.3",
|
"@alilc/lowcode-designer": "1.1.4-beta.2",
|
||||||
"@alilc/lowcode-editor-core": "1.1.3",
|
"@alilc/lowcode-editor-core": "1.1.4-beta.2",
|
||||||
"@alilc/lowcode-utils": "1.1.3",
|
"@alilc/lowcode-utils": "1.1.4-beta.2",
|
||||||
"react": "^16.8.1",
|
"react": "^16.8.1",
|
||||||
"react-dom": "^16.8.1"
|
"react-dom": "^16.8.1"
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@alilc/lowcode-plugin-outline-pane",
|
"name": "@alilc/lowcode-plugin-outline-pane",
|
||||||
"version": "1.1.3",
|
"version": "1.1.4-beta.2",
|
||||||
"description": "Outline pane for Ali lowCode engine",
|
"description": "Outline pane for Ali lowCode engine",
|
||||||
"files": [
|
"files": [
|
||||||
"es",
|
"es",
|
||||||
@ -13,10 +13,10 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@alifd/next": "^1.19.16",
|
"@alifd/next": "^1.19.16",
|
||||||
"@alilc/lowcode-designer": "1.1.3",
|
"@alilc/lowcode-designer": "1.1.4-beta.2",
|
||||||
"@alilc/lowcode-editor-core": "1.1.3",
|
"@alilc/lowcode-editor-core": "1.1.4-beta.2",
|
||||||
"@alilc/lowcode-types": "1.1.3",
|
"@alilc/lowcode-types": "1.1.4-beta.2",
|
||||||
"@alilc/lowcode-utils": "1.1.3",
|
"@alilc/lowcode-utils": "1.1.4-beta.2",
|
||||||
"classnames": "^2.2.6",
|
"classnames": "^2.2.6",
|
||||||
"react": "^16",
|
"react": "^16",
|
||||||
"react-dom": "^16.7.0",
|
"react-dom": "^16.7.0",
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@alilc/lowcode-rax-renderer",
|
"name": "@alilc/lowcode-rax-renderer",
|
||||||
"version": "1.1.3",
|
"version": "1.1.4-beta.2",
|
||||||
"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.3",
|
"@alilc/lowcode-renderer-core": "1.1.4-beta.2",
|
||||||
"@alilc/lowcode-utils": "1.1.3",
|
"@alilc/lowcode-utils": "1.1.4-beta.2",
|
||||||
"rax-find-dom-node": "^1.0.1"
|
"rax-find-dom-node": "^1.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@alilc/lowcode-rax-simulator-renderer",
|
"name": "@alilc/lowcode-rax-simulator-renderer",
|
||||||
"version": "1.1.3",
|
"version": "1.1.4-beta.2",
|
||||||
"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.3",
|
"@alilc/lowcode-designer": "1.1.4-beta.2",
|
||||||
"@alilc/lowcode-rax-renderer": "1.1.3",
|
"@alilc/lowcode-rax-renderer": "1.1.4-beta.2",
|
||||||
"@alilc/lowcode-types": "1.1.3",
|
"@alilc/lowcode-types": "1.1.4-beta.2",
|
||||||
"@alilc/lowcode-utils": "1.1.3",
|
"@alilc/lowcode-utils": "1.1.4-beta.2",
|
||||||
"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",
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { BuiltinSimulatorRenderer, Component, DocumentModel, Node } from '@alilc/lowcode-designer';
|
import { BuiltinSimulatorRenderer, Component, IBaseNode, IDocumentModel } from '@alilc/lowcode-designer';
|
||||||
import { IPublicTypeComponentSchema, IPublicTypeNodeSchema, IPublicTypeNpmInfo, IPublicEnumTransformStage, IPublicTypeNodeInstance } from '@alilc/lowcode-types';
|
import { IPublicTypeComponentSchema, IPublicTypeNodeSchema, IPublicTypeNpmInfo, IPublicEnumTransformStage, IPublicTypeNodeInstance, IPublicTypeProjectSchema } from '@alilc/lowcode-types';
|
||||||
import { Asset, compatibleLegaoSchema, cursor, isElement, isESModule, isPlainObject, isReactComponent, setNativeSelection } from '@alilc/lowcode-utils';
|
import { Asset, compatibleLegaoSchema, cursor, isElement, isESModule, isLowcodeProjectSchema, isComponentSchema, isPlainObject, isReactComponent, setNativeSelection } from '@alilc/lowcode-utils';
|
||||||
import LowCodeRenderer from '@alilc/lowcode-rax-renderer';
|
import LowCodeRenderer from '@alilc/lowcode-rax-renderer';
|
||||||
import { computed, observable as obx, makeObservable, configure } from 'mobx';
|
import { computed, observable as obx, makeObservable, configure } from 'mobx';
|
||||||
import DriverUniversal from 'driver-universal';
|
import DriverUniversal from 'driver-universal';
|
||||||
@ -47,15 +47,23 @@ const builtinComponents = {
|
|||||||
function buildComponents(
|
function buildComponents(
|
||||||
libraryMap: LibraryMap,
|
libraryMap: LibraryMap,
|
||||||
componentsMap: { [componentName: string]: IPublicTypeNpmInfo | ComponentType<any> | IPublicTypeComponentSchema },
|
componentsMap: { [componentName: string]: IPublicTypeNpmInfo | ComponentType<any> | IPublicTypeComponentSchema },
|
||||||
createComponent: (schema: IPublicTypeComponentSchema) => Component | null,
|
createComponent: (schema: IPublicTypeProjectSchema<IPublicTypeComponentSchema>) => Component | null,
|
||||||
) {
|
) {
|
||||||
const components: any = {
|
const components: any = {
|
||||||
...builtinComponents,
|
...builtinComponents,
|
||||||
};
|
};
|
||||||
Object.keys(componentsMap).forEach((componentName) => {
|
Object.keys(componentsMap).forEach((componentName) => {
|
||||||
let component = componentsMap[componentName];
|
let component = componentsMap[componentName];
|
||||||
if (component && (component as IPublicTypeComponentSchema).componentName === 'Component') {
|
if (component && (isLowcodeProjectSchema(component) || isComponentSchema(component))) {
|
||||||
components[componentName] = createComponent(component as IPublicTypeComponentSchema);
|
if (isComponentSchema(component)) {
|
||||||
|
components[componentName] = createComponent({
|
||||||
|
version: '',
|
||||||
|
componentsMap: [],
|
||||||
|
componentsTree: [component],
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
components[componentName] = createComponent(component);
|
||||||
|
}
|
||||||
} else if (isReactComponent(component)) {
|
} else if (isReactComponent(component)) {
|
||||||
components[componentName] = component;
|
components[componentName] = component;
|
||||||
} else {
|
} else {
|
||||||
@ -110,7 +118,7 @@ export class DocumentInstance {
|
|||||||
return this.document.export(IPublicEnumTransformStage.Render);
|
return this.document.export(IPublicEnumTransformStage.Render);
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(readonly container: SimulatorRendererContainer, readonly document: DocumentModel) {
|
constructor(readonly container: SimulatorRendererContainer, readonly document: IDocumentModel) {
|
||||||
makeObservable(this);
|
makeObservable(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -221,7 +229,7 @@ export class DocumentInstance {
|
|||||||
return this.instancesMap.get(id) || null;
|
return this.instancesMap.get(id) || null;
|
||||||
}
|
}
|
||||||
|
|
||||||
getNode(id: string): Node<IPublicTypeNodeSchema> | null {
|
getNode(id: string): IBaseNode<IPublicTypeNodeSchema> | null {
|
||||||
return this.document.getNode(id);
|
return this.document.getNode(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -256,6 +264,8 @@ export class SimulatorRendererContainer implements BuiltinSimulatorRenderer {
|
|||||||
// sync designMode
|
// sync designMode
|
||||||
this._designMode = host.designMode;
|
this._designMode = host.designMode;
|
||||||
|
|
||||||
|
this._locale = host.locale;
|
||||||
|
|
||||||
// sync requestHandlersMap
|
// sync requestHandlersMap
|
||||||
this._requestHandlersMap = host.requestHandlersMap;
|
this._requestHandlersMap = host.requestHandlersMap;
|
||||||
|
|
||||||
@ -343,11 +353,11 @@ export class SimulatorRendererContainer implements BuiltinSimulatorRenderer {
|
|||||||
// TODO: remove this.createComponent
|
// TODO: remove this.createComponent
|
||||||
this._components = buildComponents(this._libraryMap, this._componentsMap, this.createComponent.bind(this));
|
this._components = buildComponents(this._libraryMap, this._componentsMap, this.createComponent.bind(this));
|
||||||
}
|
}
|
||||||
@obx.ref private _components: any = {};
|
@obx.ref private _components: Record<string, React.FC | React.ComponentClass> | null = {};
|
||||||
@computed get components(): object {
|
@computed get components(): Record<string, React.FC | React.ComponentClass> {
|
||||||
// 根据 device 选择不同组件,进行响应式
|
// 根据 device 选择不同组件,进行响应式
|
||||||
// 更好的做法是,根据 device 选择加载不同的组件资源,甚至是 simulatorUrl
|
// 更好的做法是,根据 device 选择加载不同的组件资源,甚至是 simulatorUrl
|
||||||
return this._components;
|
return this._components || {};
|
||||||
}
|
}
|
||||||
// context from: utils、constants、history、location、match
|
// context from: utils、constants、history、location、match
|
||||||
@obx.ref private _appContext = {};
|
@obx.ref private _appContext = {};
|
||||||
@ -362,6 +372,10 @@ export class SimulatorRendererContainer implements BuiltinSimulatorRenderer {
|
|||||||
@computed get device() {
|
@computed get device() {
|
||||||
return this._device;
|
return this._device;
|
||||||
}
|
}
|
||||||
|
@obx.ref private _locale: string | undefined = undefined;
|
||||||
|
@computed get locale() {
|
||||||
|
return this._locale;
|
||||||
|
}
|
||||||
@obx.ref private _requestHandlersMap = null;
|
@obx.ref private _requestHandlersMap = null;
|
||||||
@computed get requestHandlersMap(): any {
|
@computed get requestHandlersMap(): any {
|
||||||
return this._requestHandlersMap;
|
return this._requestHandlersMap;
|
||||||
@ -378,12 +392,15 @@ export class SimulatorRendererContainer implements BuiltinSimulatorRenderer {
|
|||||||
return loader.load(asset);
|
return loader.load(asset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async loadAsyncLibrary(asyncLibraryMap: Record<string, any>) {
|
||||||
|
}
|
||||||
|
|
||||||
getComponent(componentName: string) {
|
getComponent(componentName: string) {
|
||||||
const paths = componentName.split('.');
|
const paths = componentName.split('.');
|
||||||
const subs: string[] = [];
|
const subs: string[] = [];
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
const component = this._components[componentName];
|
const component = this._components?.[componentName];
|
||||||
if (component) {
|
if (component) {
|
||||||
return getSubComponent(component, subs);
|
return getSubComponent(component, subs);
|
||||||
}
|
}
|
||||||
@ -416,7 +433,7 @@ export class SimulatorRendererContainer implements BuiltinSimulatorRenderer {
|
|||||||
// if (instance && SYMBOL_VNID in instance) {
|
// if (instance && SYMBOL_VNID in instance) {
|
||||||
// const docId = (instance.props as any).schema.docId;
|
// const docId = (instance.props as any).schema.docId;
|
||||||
return {
|
return {
|
||||||
docId: instance.props._leaf.document.id,
|
docId: instance.props._leaf.document?.id || '',
|
||||||
nodeId: instance.props._leaf.getId(),
|
nodeId: instance.props._leaf.getId(),
|
||||||
instance,
|
instance,
|
||||||
node: instance.props._leaf,
|
node: instance.props._leaf,
|
||||||
@ -497,17 +514,26 @@ export class SimulatorRendererContainer implements BuiltinSimulatorRenderer {
|
|||||||
this.currentDocumentInstance?.refresh();
|
this.currentDocumentInstance?.refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
createComponent(schema: IPublicTypeNodeSchema): Component | null {
|
stopAutoRepaintNode() {
|
||||||
const _schema: any = {
|
}
|
||||||
...compatibleLegaoSchema(schema),
|
|
||||||
|
enableAutoRepaintNode() {
|
||||||
|
}
|
||||||
|
|
||||||
|
createComponent(schema: IPublicTypeProjectSchema<IPublicTypeComponentSchema>): Component | null {
|
||||||
|
const _schema: IPublicTypeProjectSchema<IPublicTypeComponentSchema> = {
|
||||||
|
...schema,
|
||||||
|
componentsTree: schema.componentsTree.map(compatibleLegaoSchema),
|
||||||
};
|
};
|
||||||
|
|
||||||
if (schema.componentName === 'Component' && (schema as IPublicTypeComponentSchema).css) {
|
const componentsTreeSchema = _schema.componentsTree[0];
|
||||||
|
|
||||||
|
if (componentsTreeSchema.componentName === 'Component' && componentsTreeSchema.css) {
|
||||||
const doc = window.document;
|
const doc = window.document;
|
||||||
const s = doc.createElement('style');
|
const s = doc.createElement('style');
|
||||||
s.setAttribute('type', 'text/css');
|
s.setAttribute('type', 'text/css');
|
||||||
s.setAttribute('id', `Component-${schema.id || ''}`);
|
s.setAttribute('id', `Component-${componentsTreeSchema.id || ''}`);
|
||||||
s.appendChild(doc.createTextNode((schema as IPublicTypeComponentSchema).css || ''));
|
s.appendChild(doc.createTextNode(componentsTreeSchema.css || ''));
|
||||||
doc.getElementsByTagName('head')[0].appendChild(s);
|
doc.getElementsByTagName('head')[0].appendChild(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -520,9 +546,11 @@ export class SimulatorRendererContainer implements BuiltinSimulatorRenderer {
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
return createElement(LowCodeRenderer, {
|
return createElement(LowCodeRenderer, {
|
||||||
...extraProps,
|
...extraProps,
|
||||||
schema: _schema,
|
schema: componentsTreeSchema,
|
||||||
components,
|
components,
|
||||||
designMode: '',
|
designMode: '',
|
||||||
|
locale: renderer.locale,
|
||||||
|
messages: _schema.i18n || {},
|
||||||
device: renderer.device,
|
device: renderer.device,
|
||||||
appHelper: renderer.context,
|
appHelper: renderer.context,
|
||||||
rendererName: 'LowCodeRenderer',
|
rendererName: 'LowCodeRenderer',
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@alilc/lowcode-react-renderer",
|
"name": "@alilc/lowcode-react-renderer",
|
||||||
"version": "1.1.3",
|
"version": "1.1.4-beta.2",
|
||||||
"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.3"
|
"@alilc/lowcode-renderer-core": "1.1.4-beta.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@alib/build-scripts": "^0.1.18",
|
"@alib/build-scripts": "^0.1.18",
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@alilc/lowcode-react-simulator-renderer",
|
"name": "@alilc/lowcode-react-simulator-renderer",
|
||||||
"version": "1.1.3",
|
"version": "1.1.4-beta.2",
|
||||||
"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.3",
|
"@alilc/lowcode-designer": "1.1.4-beta.2",
|
||||||
"@alilc/lowcode-react-renderer": "1.1.3",
|
"@alilc/lowcode-react-renderer": "1.1.4-beta.2",
|
||||||
"@alilc/lowcode-types": "1.1.3",
|
"@alilc/lowcode-types": "1.1.4-beta.2",
|
||||||
"@alilc/lowcode-utils": "1.1.3",
|
"@alilc/lowcode-utils": "1.1.4-beta.2",
|
||||||
"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",
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import { host } from './host';
|
|||||||
import SimulatorRendererView from './renderer-view';
|
import SimulatorRendererView from './renderer-view';
|
||||||
import { computed, observable as obx, untracked, makeObservable, configure } from 'mobx';
|
import { computed, observable as obx, untracked, makeObservable, configure } from 'mobx';
|
||||||
import { getClientRects } from './utils/get-client-rects';
|
import { getClientRects } from './utils/get-client-rects';
|
||||||
import { reactFindDOMNodes, FIBER_KEY } from './utils/react-find-dom-nodes';
|
import { reactFindDOMNodes, getReactInternalFiber } from './utils/react-find-dom-nodes';
|
||||||
import {
|
import {
|
||||||
Asset,
|
Asset,
|
||||||
isElement,
|
isElement,
|
||||||
@ -17,9 +17,9 @@ import {
|
|||||||
AssetLoader,
|
AssetLoader,
|
||||||
getProjectUtils,
|
getProjectUtils,
|
||||||
} from '@alilc/lowcode-utils';
|
} from '@alilc/lowcode-utils';
|
||||||
import { IPublicTypeComponentSchema, IPublicEnumTransformStage, IPublicTypeNodeSchema, IPublicTypeNodeInstance } from '@alilc/lowcode-types';
|
import { IPublicTypeComponentSchema, IPublicEnumTransformStage, IPublicTypeNodeInstance, IPublicTypeProjectSchema } from '@alilc/lowcode-types';
|
||||||
// just use types
|
// just use types
|
||||||
import { BuiltinSimulatorRenderer, Component, DocumentModel, Node } from '@alilc/lowcode-designer';
|
import { BuiltinSimulatorRenderer, Component, IDocumentModel, INode } from '@alilc/lowcode-designer';
|
||||||
import LowCodeRenderer from '@alilc/lowcode-react-renderer';
|
import LowCodeRenderer from '@alilc/lowcode-react-renderer';
|
||||||
import { createMemoryHistory, MemoryHistory } from 'history';
|
import { createMemoryHistory, MemoryHistory } from 'history';
|
||||||
import Slot from './builtin-components/slot';
|
import Slot from './builtin-components/slot';
|
||||||
@ -94,7 +94,7 @@ export class DocumentInstance {
|
|||||||
return this.document.id;
|
return this.document.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(readonly container: SimulatorRendererContainer, readonly document: DocumentModel) {
|
constructor(readonly container: SimulatorRendererContainer, readonly document: IDocumentModel) {
|
||||||
makeObservable(this);
|
makeObservable(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -173,7 +173,7 @@ export class DocumentInstance {
|
|||||||
mountContext() {
|
mountContext() {
|
||||||
}
|
}
|
||||||
|
|
||||||
getNode(id: string): Node | null {
|
getNode(id: string): INode | null {
|
||||||
return this.document.getNode(id);
|
return this.document.getNode(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,12 +207,12 @@ export class SimulatorRendererContainer implements BuiltinSimulatorRenderer {
|
|||||||
|
|
||||||
private _libraryMap: { [key: string]: string } = {};
|
private _libraryMap: { [key: string]: string } = {};
|
||||||
|
|
||||||
private _components: any = {};
|
private _components: Record<string, React.FC | React.ComponentClass> | null = {};
|
||||||
|
|
||||||
get components(): object {
|
get components(): Record<string, React.FC | React.ComponentClass> {
|
||||||
// 根据 device 选择不同组件,进行响应式
|
// 根据 device 选择不同组件,进行响应式
|
||||||
// 更好的做法是,根据 device 选择加载不同的组件资源,甚至是 simulatorUrl
|
// 更好的做法是,根据 device 选择加载不同的组件资源,甚至是 simulatorUrl
|
||||||
return this._components;
|
return this._components || {};
|
||||||
}
|
}
|
||||||
// context from: utils、constants、history、location、match
|
// context from: utils、constants、history、location、match
|
||||||
@obx.ref private _appContext: any = {};
|
@obx.ref private _appContext: any = {};
|
||||||
@ -388,7 +388,7 @@ export class SimulatorRendererContainer implements BuiltinSimulatorRenderer {
|
|||||||
const subs: string[] = [];
|
const subs: string[] = [];
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
const component = this._components[componentName];
|
const component = this._components?.[componentName];
|
||||||
if (component) {
|
if (component) {
|
||||||
return getSubComponent(component, subs);
|
return getSubComponent(component, subs);
|
||||||
}
|
}
|
||||||
@ -430,17 +430,20 @@ export class SimulatorRendererContainer implements BuiltinSimulatorRenderer {
|
|||||||
cursor.release();
|
cursor.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
createComponent(schema: IPublicTypeNodeSchema): Component | null {
|
createComponent(schema: IPublicTypeProjectSchema<IPublicTypeComponentSchema>): Component | null {
|
||||||
const _schema: any = {
|
const _schema: IPublicTypeProjectSchema<IPublicTypeComponentSchema> = {
|
||||||
...compatibleLegaoSchema(schema),
|
...schema,
|
||||||
|
componentsTree: schema.componentsTree.map(compatibleLegaoSchema),
|
||||||
};
|
};
|
||||||
|
|
||||||
if (schema.componentName === 'Component' && (schema as IPublicTypeComponentSchema).css) {
|
const componentsTreeSchema = _schema.componentsTree[0];
|
||||||
|
|
||||||
|
if (componentsTreeSchema.componentName === 'Component' && componentsTreeSchema.css) {
|
||||||
const doc = window.document;
|
const doc = window.document;
|
||||||
const s = doc.createElement('style');
|
const s = doc.createElement('style');
|
||||||
s.setAttribute('type', 'text/css');
|
s.setAttribute('type', 'text/css');
|
||||||
s.setAttribute('id', `Component-${schema.id || ''}`);
|
s.setAttribute('id', `Component-${componentsTreeSchema.id || ''}`);
|
||||||
s.appendChild(doc.createTextNode((schema as IPublicTypeComponentSchema).css || ''));
|
s.appendChild(doc.createTextNode(componentsTreeSchema.css || ''));
|
||||||
doc.getElementsByTagName('head')[0].appendChild(s);
|
doc.getElementsByTagName('head')[0].appendChild(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -452,9 +455,11 @@ export class SimulatorRendererContainer implements BuiltinSimulatorRenderer {
|
|||||||
return createElement(LowCodeRenderer, {
|
return createElement(LowCodeRenderer, {
|
||||||
...extraProps, // 防止覆盖下面内置属性
|
...extraProps, // 防止覆盖下面内置属性
|
||||||
// 使用 _schema 为了使低代码组件在页面设计中使用变量,同 react 组件使用效果一致
|
// 使用 _schema 为了使低代码组件在页面设计中使用变量,同 react 组件使用效果一致
|
||||||
schema: _schema,
|
schema: componentsTreeSchema,
|
||||||
components: renderer.components,
|
components: renderer.components,
|
||||||
designMode: '',
|
designMode: '',
|
||||||
|
locale: renderer.locale,
|
||||||
|
messages: _schema.i18n || {},
|
||||||
device: renderer.device,
|
device: renderer.device,
|
||||||
appHelper: renderer.context,
|
appHelper: renderer.context,
|
||||||
rendererName: 'LowCodeRenderer',
|
rendererName: 'LowCodeRenderer',
|
||||||
@ -565,7 +570,7 @@ function getClosestNodeInstance(
|
|||||||
if (isElement(el)) {
|
if (isElement(el)) {
|
||||||
el = cacheReactKey(el);
|
el = cacheReactKey(el);
|
||||||
} else {
|
} else {
|
||||||
return getNodeInstance(el[FIBER_KEY], specId);
|
return getNodeInstance(getReactInternalFiber(el), specId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (el) {
|
while (el) {
|
||||||
|
|||||||
@ -3,7 +3,9 @@ import { findDOMNode } from 'react-dom';
|
|||||||
import { isElement } from '@alilc/lowcode-utils';
|
import { isElement } from '@alilc/lowcode-utils';
|
||||||
import { isDOMNode } from './is-dom-node';
|
import { isDOMNode } from './is-dom-node';
|
||||||
|
|
||||||
export const FIBER_KEY = '_reactInternalFiber';
|
export const getReactInternalFiber = (el: any) => {
|
||||||
|
return el._reactInternals || el._reactInternalFiber;
|
||||||
|
};
|
||||||
|
|
||||||
function elementsFromFiber(fiber: any, elements: Array<Element | Text>) {
|
function elementsFromFiber(fiber: any, elements: Array<Element | Text>) {
|
||||||
if (fiber) {
|
if (fiber) {
|
||||||
@ -28,7 +30,7 @@ export function reactFindDOMNodes(elem: ReactInstance | null): Array<Element | T
|
|||||||
return [elem];
|
return [elem];
|
||||||
}
|
}
|
||||||
const elements: Array<Element | Text> = [];
|
const elements: Array<Element | Text> = [];
|
||||||
const fiberNode = (elem as any)[FIBER_KEY];
|
const fiberNode = getReactInternalFiber(elem);
|
||||||
elementsFromFiber(fiberNode?.child, elements);
|
elementsFromFiber(fiberNode?.child, elements);
|
||||||
if (elements.length > 0) return elements;
|
if (elements.length > 0) return elements;
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@alilc/lowcode-renderer-core",
|
"name": "@alilc/lowcode-renderer-core",
|
||||||
"version": "1.1.3",
|
"version": "1.1.4-beta.2",
|
||||||
"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.3",
|
"@alilc/lowcode-types": "1.1.4-beta.2",
|
||||||
"@alilc/lowcode-utils": "1.1.3",
|
"@alilc/lowcode-utils": "1.1.4-beta.2",
|
||||||
"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.3",
|
"@alilc/lowcode-designer": "1.1.4-beta.2",
|
||||||
"@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",
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@alilc/lowcode-shell",
|
"name": "@alilc/lowcode-shell",
|
||||||
"version": "1.1.3",
|
"version": "1.1.4-beta.2",
|
||||||
"description": "Shell Layer for AliLowCodeEngine",
|
"description": "Shell Layer for AliLowCodeEngine",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"module": "es/index.js",
|
"module": "es/index.js",
|
||||||
@ -15,12 +15,12 @@
|
|||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@alilc/lowcode-designer": "1.1.3",
|
"@alilc/lowcode-designer": "1.1.4-beta.2",
|
||||||
"@alilc/lowcode-editor-core": "1.1.3",
|
"@alilc/lowcode-editor-core": "1.1.4-beta.2",
|
||||||
"@alilc/lowcode-editor-skeleton": "1.1.3",
|
"@alilc/lowcode-editor-skeleton": "1.1.4-beta.2",
|
||||||
"@alilc/lowcode-types": "1.1.3",
|
"@alilc/lowcode-types": "1.1.4-beta.2",
|
||||||
"@alilc/lowcode-utils": "1.1.3",
|
"@alilc/lowcode-utils": "1.1.4-beta.2",
|
||||||
"@alilc/lowcode-workspace": "1.1.3",
|
"@alilc/lowcode-workspace": "1.1.4-beta.2",
|
||||||
"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",
|
||||||
|
|||||||
@ -143,7 +143,7 @@ export class SettingField implements IPublicModelSettingField {
|
|||||||
if (isCustomView(item)) {
|
if (isCustomView(item)) {
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
return item.internalToShell();
|
return item.internalToShellField();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@alilc/lowcode-types",
|
"name": "@alilc/lowcode-types",
|
||||||
"version": "1.1.3",
|
"version": "1.1.4-beta.2",
|
||||||
"description": "Types for Ali lowCode engine",
|
"description": "Types for Ali lowCode engine",
|
||||||
"files": [
|
"files": [
|
||||||
"es",
|
"es",
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { EitherOr } from '../../utils';
|
import { EitherOr } from '../../utils';
|
||||||
import { IPublicTypeComponentSchema } from './';
|
import { IPublicTypeComponentSchema, IPublicTypeProjectSchema } from './';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 定义组件大包及 external 资源的信息
|
* 定义组件大包及 external 资源的信息
|
||||||
@ -51,5 +51,5 @@ export type IPublicTypePackage = EitherOr<{
|
|||||||
/**
|
/**
|
||||||
* 低代码组件 schema 内容
|
* 低代码组件 schema 内容
|
||||||
*/
|
*/
|
||||||
schema?: IPublicTypeComponentSchema;
|
schema?: IPublicTypeProjectSchema<IPublicTypeComponentSchema>;
|
||||||
}, 'package', 'id'>;
|
}, 'package', 'id'>;
|
||||||
|
|||||||
@ -19,7 +19,7 @@ export type IPublicTypeUtilsMap = IPublicTypeUtilItem[];
|
|||||||
* 应用描述
|
* 应用描述
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export interface IPublicTypeProjectSchema {
|
export interface IPublicTypeProjectSchema<T = IPublicTypeRootSchema> {
|
||||||
id?: string;
|
id?: string;
|
||||||
/**
|
/**
|
||||||
* 当前应用协议版本号
|
* 当前应用协议版本号
|
||||||
@ -34,7 +34,7 @@ export interface IPublicTypeProjectSchema {
|
|||||||
* 低代码业务组件树描述
|
* 低代码业务组件树描述
|
||||||
* 是长度固定为 1 的数组,即数组内仅包含根容器的描述(低代码业务组件容器类型)
|
* 是长度固定为 1 的数组,即数组内仅包含根容器的描述(低代码业务组件容器类型)
|
||||||
*/
|
*/
|
||||||
componentsTree: IPublicTypeRootSchema[];
|
componentsTree: T[];
|
||||||
/**
|
/**
|
||||||
* 国际化语料
|
* 国际化语料
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@alilc/lowcode-utils",
|
"name": "@alilc/lowcode-utils",
|
||||||
"version": "1.1.3",
|
"version": "1.1.4-beta.2",
|
||||||
"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.3",
|
"@alilc/lowcode-types": "1.1.4-beta.2",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"mobx": "^6.3.0",
|
"mobx": "^6.3.0",
|
||||||
"react": "^16"
|
"react": "^16"
|
||||||
|
|||||||
@ -1,8 +1,10 @@
|
|||||||
import { ComponentType, forwardRef, createElement, FunctionComponent } from 'react';
|
import { ComponentType, forwardRef, createElement, FunctionComponent } from 'react';
|
||||||
import { IPublicTypeNpmInfo, IPublicTypeComponentSchema } from '@alilc/lowcode-types';
|
import { IPublicTypeNpmInfo, IPublicTypeComponentSchema, IPublicTypeProjectSchema } from '@alilc/lowcode-types';
|
||||||
import { isESModule } from './is-es-module';
|
import { isESModule } from './is-es-module';
|
||||||
import { isReactComponent, acceptsRef, wrapReactClass } from './is-react';
|
import { isReactComponent, acceptsRef, wrapReactClass } from './is-react';
|
||||||
import { isObject } from './is-object';
|
import { isObject } from './is-object';
|
||||||
|
import { isLowcodeProjectSchema } from './check-types';
|
||||||
|
import { isComponentSchema } from './check-types/is-component-schema';
|
||||||
|
|
||||||
type Component = ComponentType<any> | object;
|
type Component = ComponentType<any> | object;
|
||||||
interface LibraryMap {
|
interface LibraryMap {
|
||||||
@ -95,12 +97,20 @@ function isMixinComponent(components: any) {
|
|||||||
|
|
||||||
export function buildComponents(libraryMap: LibraryMap,
|
export function buildComponents(libraryMap: LibraryMap,
|
||||||
componentsMap: { [componentName: string]: IPublicTypeNpmInfo | ComponentType<any> | IPublicTypeComponentSchema },
|
componentsMap: { [componentName: string]: IPublicTypeNpmInfo | ComponentType<any> | IPublicTypeComponentSchema },
|
||||||
createComponent: (schema: IPublicTypeComponentSchema) => Component | null) {
|
createComponent: (schema: IPublicTypeProjectSchema<IPublicTypeComponentSchema>) => Component | null) {
|
||||||
const components: any = {};
|
const components: any = {};
|
||||||
Object.keys(componentsMap).forEach((componentName) => {
|
Object.keys(componentsMap).forEach((componentName) => {
|
||||||
let component = componentsMap[componentName];
|
let component = componentsMap[componentName];
|
||||||
if (component && (component as IPublicTypeComponentSchema).componentName === 'Component') {
|
if (component && (isLowcodeProjectSchema(component) || isComponentSchema(component))) {
|
||||||
components[componentName] = createComponent(component as IPublicTypeComponentSchema);
|
if (isComponentSchema(component)) {
|
||||||
|
components[componentName] = createComponent({
|
||||||
|
version: '',
|
||||||
|
componentsMap: [],
|
||||||
|
componentsTree: [component],
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
components[componentName] = createComponent(component);
|
||||||
|
}
|
||||||
} else if (isReactComponent(component)) {
|
} else if (isReactComponent(component)) {
|
||||||
if (!acceptsRef(component)) {
|
if (!acceptsRef(component)) {
|
||||||
component = wrapReactClass(component as FunctionComponent);
|
component = wrapReactClass(component as FunctionComponent);
|
||||||
|
|||||||
@ -21,3 +21,6 @@ export * from './is-location-children-detail';
|
|||||||
export * from './is-node';
|
export * from './is-node';
|
||||||
export * from './is-location-data';
|
export * from './is-location-data';
|
||||||
export * from './is-setting-field';
|
export * from './is-setting-field';
|
||||||
|
export * from './is-lowcode-component-type';
|
||||||
|
export * from './is-lowcode-project-schema';
|
||||||
|
export * from './is-component-schema';
|
||||||
8
packages/utils/src/check-types/is-component-schema.ts
Normal file
8
packages/utils/src/check-types/is-component-schema.ts
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
import { IPublicTypeComponentSchema } from "@alilc/lowcode-types";
|
||||||
|
|
||||||
|
export function isComponentSchema(schema: any): schema is IPublicTypeComponentSchema {
|
||||||
|
if (typeof schema === 'object') {
|
||||||
|
return schema.componentName === 'Component';
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
@ -1,7 +1,7 @@
|
|||||||
import { isProCodeComponentType } from './is-procode-component-type';
|
import { isProCodeComponentType } from './is-procode-component-type';
|
||||||
import { IPublicTypeComponentMap } from '@alilc/lowcode-types';
|
import { IPublicTypeComponentMap, IPublicTypeLowCodeComponent } from '@alilc/lowcode-types';
|
||||||
|
|
||||||
|
|
||||||
export function isLowCodeComponentType(desc: IPublicTypeComponentMap): boolean {
|
export function isLowCodeComponentType(desc: IPublicTypeComponentMap): desc is IPublicTypeLowCodeComponent {
|
||||||
return !isProCodeComponentType(desc);
|
return !isProCodeComponentType(desc);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,6 @@
|
|||||||
|
import { IPublicTypeComponentSchema, IPublicTypeProjectSchema } from "@alilc/lowcode-types";
|
||||||
|
import { isComponentSchema } from "./is-component-schema";
|
||||||
|
|
||||||
|
export function isLowcodeProjectSchema(data: any): data is IPublicTypeProjectSchema<IPublicTypeComponentSchema> {
|
||||||
|
return data && data.componentsTree && data.componentsTree.length && isComponentSchema(data.componentsTree[0]);
|
||||||
|
}
|
||||||
@ -1,3 +1,5 @@
|
|||||||
export function isProjectSchema(data: any): boolean {
|
import { IPublicTypeProjectSchema } from "@alilc/lowcode-types";
|
||||||
|
|
||||||
|
export function isProjectSchema(data: any): data is IPublicTypeProjectSchema {
|
||||||
return data && data.componentsTree;
|
return data && data.componentsTree;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@alilc/lowcode-workspace",
|
"name": "@alilc/lowcode-workspace",
|
||||||
"version": "1.1.3",
|
"version": "1.1.4-beta.2",
|
||||||
"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.3",
|
"@alilc/lowcode-designer": "1.1.4-beta.2",
|
||||||
"@alilc/lowcode-editor-core": "1.1.3",
|
"@alilc/lowcode-editor-core": "1.1.4-beta.2",
|
||||||
"@alilc/lowcode-editor-skeleton": "1.1.3",
|
"@alilc/lowcode-editor-skeleton": "1.1.4-beta.2",
|
||||||
"@alilc/lowcode-types": "1.1.3",
|
"@alilc/lowcode-types": "1.1.4-beta.2",
|
||||||
"@alilc/lowcode-utils": "1.1.3",
|
"@alilc/lowcode-utils": "1.1.4-beta.2",
|
||||||
"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",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user