mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-03-04 17:27:09 +00:00
Merge branch 'master' into release/0.9.0
This commit is contained in:
commit
76847ee74d
@ -12,9 +12,9 @@
|
|||||||
"@ali/lowcode-editor-preset-general": "window.LowcodeEditor",
|
"@ali/lowcode-editor-preset-general": "window.LowcodeEditor",
|
||||||
"@ali/lowcode-editor-core": "window.LowcodeEditor",
|
"@ali/lowcode-editor-core": "window.LowcodeEditor",
|
||||||
"@ali/lowcode-editor-skeleton": "window.LowcodeEditor",
|
"@ali/lowcode-editor-skeleton": "window.LowcodeEditor",
|
||||||
"@ali/lowcode-designer": "window.LowcodeEditor"
|
"@ali/lowcode-designer": "window.LowcodeEditor",
|
||||||
|
"rax": "var window.Rax"
|
||||||
},
|
},
|
||||||
"minify": false,
|
|
||||||
"sourcemap": true,
|
"sourcemap": true,
|
||||||
"outputAssetsPath": {
|
"outputAssetsPath": {
|
||||||
"js": "", "css": ""
|
"js": "", "css": ""
|
||||||
|
|||||||
@ -328,23 +328,27 @@ function getKeyInfo(combination: string, action?: string): KeyInfo {
|
|||||||
* convention - prevent default and stop propogation on the event
|
* convention - prevent default and stop propogation on the event
|
||||||
*/
|
*/
|
||||||
function fireCallback(callback: HotkeyCallback, e: KeyboardEvent, combo?: string, sequence?: string): void {
|
function fireCallback(callback: HotkeyCallback, e: KeyboardEvent, combo?: string, sequence?: string): void {
|
||||||
const editor = globalContext.get(Editor);
|
try {
|
||||||
const designer = editor.get('designer');
|
const editor = globalContext.get(Editor);
|
||||||
const node = designer?.currentSelection?.getNodes()?.[0];
|
const designer = editor.get('designer');
|
||||||
const npm = node?.componentMeta?.npm;
|
const node = designer?.currentSelection?.getNodes()?.[0];
|
||||||
const selected =
|
const npm = node?.componentMeta?.npm;
|
||||||
[npm?.package, npm?.componentName].filter((item) => !!item).join('-') || node?.componentMeta?.componentName || '';
|
const selected =
|
||||||
if (callback(e, combo) === false) {
|
[npm?.package, npm?.componentName].filter((item) => !!item).join('-') || node?.componentMeta?.componentName || '';
|
||||||
e.preventDefault();
|
if (callback(e, combo) === false) {
|
||||||
e.stopPropagation();
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
}
|
||||||
|
editor?.emit('hotkey.callback.call', {
|
||||||
|
callback,
|
||||||
|
e,
|
||||||
|
combo,
|
||||||
|
sequence,
|
||||||
|
selected,
|
||||||
|
});
|
||||||
|
} catch(err) {
|
||||||
|
console.error(err.message);
|
||||||
}
|
}
|
||||||
editor?.emit('hotkey.callback.call', {
|
|
||||||
callback,
|
|
||||||
e,
|
|
||||||
combo,
|
|
||||||
sequence,
|
|
||||||
selected,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Hotkey {
|
export class Hotkey {
|
||||||
|
|||||||
@ -9,7 +9,8 @@
|
|||||||
"externals": {
|
"externals": {
|
||||||
"react": "var window.React",
|
"react": "var window.React",
|
||||||
"react-dom": "var window.ReactDOM",
|
"react-dom": "var window.ReactDOM",
|
||||||
"prop-types": "var window.PropTypes"
|
"prop-types": "var window.PropTypes",
|
||||||
|
"rax": "var window.Rax"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|||||||
@ -56,7 +56,7 @@ function upgradePropsReducer(props: any) {
|
|||||||
type: 'JSSlot',
|
type: 'JSSlot',
|
||||||
title: (val.value.props as any)?.slotTitle,
|
title: (val.value.props as any)?.slotTitle,
|
||||||
name: (val.value.props as any)?.slotName,
|
name: (val.value.props as any)?.slotName,
|
||||||
value: val.value.children
|
value: val.value.children,
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
val = val.value;
|
val = val.value;
|
||||||
@ -130,7 +130,6 @@ designer.addPropsReducer((props, node) => {
|
|||||||
return props;
|
return props;
|
||||||
}, TransformStage.Init);
|
}, TransformStage.Init);
|
||||||
|
|
||||||
|
|
||||||
function filterReducer(props: any, node: Node): any {
|
function filterReducer(props: any, node: Node): any {
|
||||||
const filters = node.componentMeta.getMetadata().experimental?.filters;
|
const filters = node.componentMeta.getMetadata().experimental?.filters;
|
||||||
if (filters && filters.length) {
|
if (filters && filters.length) {
|
||||||
@ -173,7 +172,7 @@ function compatiableReducer(props: any) {
|
|||||||
slotName: val.name,
|
slotName: val.name,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
// 为了能降级到老版本,建议在后期版本去掉以下代码
|
// 为了能降级到老版本,建议在后期版本去掉以下代码
|
||||||
if (isJSExpression(val) && !val.events) {
|
if (isJSExpression(val) && !val.events) {
|
||||||
@ -268,7 +267,7 @@ skeleton.add({
|
|||||||
props: {
|
props: {
|
||||||
condition: () => {
|
condition: () => {
|
||||||
return designer.dragon.dragging && !getTreeMaster(designer).hasVisibleTreeBoard();
|
return designer.dragon.dragging && !getTreeMaster(designer).hasVisibleTreeBoard();
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
content: OutlineBackupPane,
|
content: OutlineBackupPane,
|
||||||
});
|
});
|
||||||
|
|||||||
@ -0,0 +1,8 @@
|
|||||||
|
.lc-widget-view-container {
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
&.hidden {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -2,13 +2,15 @@ import { Component, ReactElement } from 'react';
|
|||||||
import { Icon } from '@alifd/next';
|
import { Icon } from '@alifd/next';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { Title, observer, Tip, globalContext, Editor } from '@ali/lowcode-editor-core';
|
import { Title, observer, Tip, globalContext, Editor } from '@ali/lowcode-editor-core';
|
||||||
import { DockProps } from '../types';
|
import { DockProps } from '../../types';
|
||||||
import PanelDock from '../widget/panel-dock';
|
import PanelDock from '../../widget/panel-dock';
|
||||||
import { composeTitle } from '../widget/utils';
|
import { composeTitle } from '../../widget/utils';
|
||||||
import WidgetContainer from '../widget/widget-container';
|
import WidgetContainer from '../../widget/widget-container';
|
||||||
import Panel from '../widget/panel';
|
import Panel from '../../widget/panel';
|
||||||
import { IWidget } from '../widget/widget';
|
import { IWidget } from '../../widget/widget';
|
||||||
import { SkeletonEvents } from '../skeleton';
|
import { SkeletonEvents } from '../../skeleton';
|
||||||
|
|
||||||
|
import './index.less';
|
||||||
|
|
||||||
export function DockView({ title, icon, description, size, className, onClick }: DockProps) {
|
export function DockView({ title, icon, description, size, className, onClick }: DockProps) {
|
||||||
return (
|
return (
|
||||||
@ -262,9 +264,6 @@ export class WidgetView extends Component<{ widget: IWidget }> {
|
|||||||
}
|
}
|
||||||
render() {
|
render() {
|
||||||
const { widget } = this.props;
|
const { widget } = this.props;
|
||||||
if (!widget.visible) {
|
return <div className={classNames('lc-widget-view-container', { hidden: !widget.visible })}>{widget.body}</div>;
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return widget.body;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
9
packages/rax-simulator-renderer/.babelrc
Normal file
9
packages/rax-simulator-renderer/.babelrc
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"plugins": [
|
||||||
|
["@babel/plugin-transform-react-jsx", {
|
||||||
|
"pragma": "createElement", // default pragma is React.createElement
|
||||||
|
"pragmaFrag": "createFragment", // default is React.Fragment
|
||||||
|
"throwIfNamespace": false // defaults to true
|
||||||
|
}]
|
||||||
|
]
|
||||||
|
}
|
||||||
@ -6,7 +6,13 @@
|
|||||||
"filename": "rax-simulator-renderer",
|
"filename": "rax-simulator-renderer",
|
||||||
"library": "SimulatorRenderer",
|
"library": "SimulatorRenderer",
|
||||||
"libraryExport": "default",
|
"libraryExport": "default",
|
||||||
"libraryTarget": "umd"
|
"libraryTarget": "umd",
|
||||||
|
"externals": {
|
||||||
|
"react": "var window.React",
|
||||||
|
"react-dom": "var window.ReactDOM",
|
||||||
|
"prop-types": "var window.PropTypes",
|
||||||
|
"rax": "var window.Rax"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"./build.plugin.js"
|
"./build.plugin.js"
|
||||||
|
|||||||
@ -30,6 +30,8 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@alib/build-scripts": "^0.1.18",
|
"@alib/build-scripts": "^0.1.18",
|
||||||
|
"@babel/plugin-transform-react-jsx": "^7.10.4",
|
||||||
|
"@recore/obx": "^1.0.8",
|
||||||
"@types/classnames": "^2.2.7",
|
"@types/classnames": "^2.2.7",
|
||||||
"@types/node": "^13.7.1",
|
"@types/node": "^13.7.1",
|
||||||
"@types/rax": "^1.0.0",
|
"@types/rax": "^1.0.0",
|
||||||
|
|||||||
@ -386,35 +386,34 @@ function getClosestNodeInstance(from: any, specId?: string): NodeInstance<any> |
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function matcher(parent: any) {
|
function isValidDesignModeRaxComponentInstance(
|
||||||
return parent.__isReactiveComponent && parent.props.componentId;
|
raxComponentInst: any,
|
||||||
|
): raxComponentInst is {
|
||||||
|
props: {
|
||||||
|
_leaf: Exclude<NodeInstance<any>['node'], null | undefined>;
|
||||||
|
};
|
||||||
|
} {
|
||||||
|
const leaf = raxComponentInst?.props?._leaf;
|
||||||
|
return leaf && typeof leaf === 'object' && leaf.isNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getNodeInstance(dom: HTMLElement): NodeInstance<any> | null {
|
function getNodeInstance(dom: HTMLElement): NodeInstance<any> | null {
|
||||||
const INTERNAL = '_internal';
|
const INTERNAL = '_internal';
|
||||||
|
|
||||||
let instance = Instance.get(dom);
|
let instance = Instance.get(dom);
|
||||||
let node;
|
|
||||||
while (instance && instance[INTERNAL]) {
|
while (instance && instance[INTERNAL]) {
|
||||||
if (matcher(instance)) {
|
if (isValidDesignModeRaxComponentInstance(instance)) {
|
||||||
node = instance;
|
return {
|
||||||
break;
|
nodeId: instance.props._leaf.getId(),
|
||||||
|
instance: instance,
|
||||||
|
node: instance.props._leaf,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
instance = instance[INTERNAL].__parentInstance;
|
instance = instance[INTERNAL].__parentInstance;
|
||||||
}
|
}
|
||||||
if (!node) {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
|
||||||
return {
|
|
||||||
nodeId: node.props.componentId,
|
|
||||||
instance: node
|
|
||||||
}
|
|
||||||
// return parent;
|
|
||||||
// const instance = fiberNode.stateNode;
|
|
||||||
// if (instance) {
|
|
||||||
// console.log(instance);
|
|
||||||
// }
|
|
||||||
// return getNodeInstance(fiberNode.return);
|
|
||||||
// return instance;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkInstanceMounted(instance: any): boolean {
|
function checkInstanceMounted(instance: any): boolean {
|
||||||
|
|||||||
@ -30,8 +30,8 @@ lerna bootstrap
|
|||||||
lerna run cloud-build --stream
|
lerna run cloud-build --stream
|
||||||
|
|
||||||
cd $WORK_DIR
|
cd $WORK_DIR
|
||||||
mv deploy-space/packages/demo/build $BUILD_DEST
|
# mv deploy-space/packages/demo/build $BUILD_DEST
|
||||||
mv deploy-space/packages/react-simulator-renderer/dist/* $BUILD_DEST
|
mv deploy-space/packages/react-simulator-renderer/dist $BUILD_DEST
|
||||||
mv deploy-space/packages/rax-simulator-renderer/dist/* $BUILD_DEST
|
mv deploy-space/packages/rax-simulator-renderer/dist/* $BUILD_DEST
|
||||||
mv deploy-space/packages/editor-preset-vision/dist/* $BUILD_DEST
|
mv deploy-space/packages/editor-preset-vision/dist/* $BUILD_DEST
|
||||||
# mv deploy-space/packages/editor-preset-general/dist/* $BUILD_DEST
|
# mv deploy-space/packages/editor-preset-general/dist/* $BUILD_DEST
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user