mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-12 17:08:14 +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-core": "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,
|
||||
"outputAssetsPath": {
|
||||
"js": "", "css": ""
|
||||
|
||||
@ -328,23 +328,27 @@ function getKeyInfo(combination: string, action?: string): KeyInfo {
|
||||
* convention - prevent default and stop propogation on the event
|
||||
*/
|
||||
function fireCallback(callback: HotkeyCallback, e: KeyboardEvent, combo?: string, sequence?: string): void {
|
||||
const editor = globalContext.get(Editor);
|
||||
const designer = editor.get('designer');
|
||||
const node = designer?.currentSelection?.getNodes()?.[0];
|
||||
const npm = node?.componentMeta?.npm;
|
||||
const selected =
|
||||
[npm?.package, npm?.componentName].filter((item) => !!item).join('-') || node?.componentMeta?.componentName || '';
|
||||
if (callback(e, combo) === false) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
try {
|
||||
const editor = globalContext.get(Editor);
|
||||
const designer = editor.get('designer');
|
||||
const node = designer?.currentSelection?.getNodes()?.[0];
|
||||
const npm = node?.componentMeta?.npm;
|
||||
const selected =
|
||||
[npm?.package, npm?.componentName].filter((item) => !!item).join('-') || node?.componentMeta?.componentName || '';
|
||||
if (callback(e, combo) === false) {
|
||||
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 {
|
||||
|
||||
@ -9,7 +9,8 @@
|
||||
"externals": {
|
||||
"react": "var window.React",
|
||||
"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',
|
||||
title: (val.value.props as any)?.slotTitle,
|
||||
name: (val.value.props as any)?.slotName,
|
||||
value: val.value.children
|
||||
value: val.value.children,
|
||||
};
|
||||
} else {
|
||||
val = val.value;
|
||||
@ -130,7 +130,6 @@ designer.addPropsReducer((props, node) => {
|
||||
return props;
|
||||
}, TransformStage.Init);
|
||||
|
||||
|
||||
function filterReducer(props: any, node: Node): any {
|
||||
const filters = node.componentMeta.getMetadata().experimental?.filters;
|
||||
if (filters && filters.length) {
|
||||
@ -173,7 +172,7 @@ function compatiableReducer(props: any) {
|
||||
slotName: val.name,
|
||||
},
|
||||
},
|
||||
}
|
||||
};
|
||||
}
|
||||
// 为了能降级到老版本,建议在后期版本去掉以下代码
|
||||
if (isJSExpression(val) && !val.events) {
|
||||
@ -268,7 +267,7 @@ skeleton.add({
|
||||
props: {
|
||||
condition: () => {
|
||||
return designer.dragon.dragging && !getTreeMaster(designer).hasVisibleTreeBoard();
|
||||
}
|
||||
},
|
||||
},
|
||||
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 classNames from 'classnames';
|
||||
import { Title, observer, Tip, globalContext, Editor } from '@ali/lowcode-editor-core';
|
||||
import { DockProps } from '../types';
|
||||
import PanelDock from '../widget/panel-dock';
|
||||
import { composeTitle } from '../widget/utils';
|
||||
import WidgetContainer from '../widget/widget-container';
|
||||
import Panel from '../widget/panel';
|
||||
import { IWidget } from '../widget/widget';
|
||||
import { SkeletonEvents } from '../skeleton';
|
||||
import { DockProps } from '../../types';
|
||||
import PanelDock from '../../widget/panel-dock';
|
||||
import { composeTitle } from '../../widget/utils';
|
||||
import WidgetContainer from '../../widget/widget-container';
|
||||
import Panel from '../../widget/panel';
|
||||
import { IWidget } from '../../widget/widget';
|
||||
import { SkeletonEvents } from '../../skeleton';
|
||||
|
||||
import './index.less';
|
||||
|
||||
export function DockView({ title, icon, description, size, className, onClick }: DockProps) {
|
||||
return (
|
||||
@ -262,9 +264,6 @@ export class WidgetView extends Component<{ widget: IWidget }> {
|
||||
}
|
||||
render() {
|
||||
const { widget } = this.props;
|
||||
if (!widget.visible) {
|
||||
return null;
|
||||
}
|
||||
return widget.body;
|
||||
return <div className={classNames('lc-widget-view-container', { hidden: !widget.visible })}>{widget.body}</div>;
|
||||
}
|
||||
}
|
||||
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",
|
||||
"library": "SimulatorRenderer",
|
||||
"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"
|
||||
|
||||
@ -30,6 +30,8 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@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/node": "^13.7.1",
|
||||
"@types/rax": "^1.0.0",
|
||||
|
||||
@ -386,35 +386,34 @@ function getClosestNodeInstance(from: any, specId?: string): NodeInstance<any> |
|
||||
return null;
|
||||
}
|
||||
|
||||
function matcher(parent: any) {
|
||||
return parent.__isReactiveComponent && parent.props.componentId;
|
||||
function isValidDesignModeRaxComponentInstance(
|
||||
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 {
|
||||
const INTERNAL = '_internal';
|
||||
|
||||
let instance = Instance.get(dom);
|
||||
let node;
|
||||
while (instance && instance[INTERNAL]) {
|
||||
if (matcher(instance)) {
|
||||
node = instance;
|
||||
break;
|
||||
if (isValidDesignModeRaxComponentInstance(instance)) {
|
||||
return {
|
||||
nodeId: instance.props._leaf.getId(),
|
||||
instance: instance,
|
||||
node: instance.props._leaf,
|
||||
};
|
||||
}
|
||||
|
||||
instance = instance[INTERNAL].__parentInstance;
|
||||
}
|
||||
if (!node) {
|
||||
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;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function checkInstanceMounted(instance: any): boolean {
|
||||
|
||||
@ -30,8 +30,8 @@ lerna bootstrap
|
||||
lerna run cloud-build --stream
|
||||
|
||||
cd $WORK_DIR
|
||||
mv deploy-space/packages/demo/build $BUILD_DEST
|
||||
mv deploy-space/packages/react-simulator-renderer/dist/* $BUILD_DEST
|
||||
# mv deploy-space/packages/demo/build $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/editor-preset-vision/dist/* $BUILD_DEST
|
||||
# mv deploy-space/packages/editor-preset-general/dist/* $BUILD_DEST
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user