mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-13 01:21:58 +00:00
feat: rax render
This commit is contained in:
parent
a42f7cc5fe
commit
038d74e955
@ -61,5 +61,6 @@
|
||||
"publishConfig": {
|
||||
"registry": "https://registry.npm.alibaba-inc.com"
|
||||
},
|
||||
"license": "MIT"
|
||||
"license": "MIT",
|
||||
"homepage": "https://unpkg.alibaba-inc.com/@ali/lowcode-rax-renderer@0.1.2/build/index.html"
|
||||
}
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
/* eslint-disable */
|
||||
import { Component, createElement as raxCreateElement } from 'rax';
|
||||
import { Component, createElement } from 'rax';
|
||||
import PropTypes from 'prop-types';
|
||||
import Debug from 'debug';
|
||||
import * as isEmpty from 'lodash/isEmpty';
|
||||
import isEmpty from 'lodash/isEmpty';
|
||||
import findDOMNode from 'rax-find-dom-node';
|
||||
import { isFileSchema, goldlog } from '../utils';
|
||||
import AppContext from '../context/appContext';
|
||||
@ -21,6 +21,8 @@ const ENGINE_COMPS = {
|
||||
TempEngine,
|
||||
};
|
||||
|
||||
const raxCreateElement = createElement;
|
||||
|
||||
class FaultComponent extends Component {
|
||||
render() {
|
||||
// FIXME: errorlog
|
||||
@ -169,9 +171,10 @@ export default class Engine extends Component {
|
||||
Comp = ENGINE_COMPS[`${componentName}Engine`];
|
||||
}
|
||||
}
|
||||
if (Comp) {
|
||||
return (
|
||||
<AppContext.Provider
|
||||
|
||||
return (
|
||||
Comp
|
||||
? <AppContext.Provider
|
||||
value={{
|
||||
appHelper,
|
||||
components: allComponents,
|
||||
@ -189,9 +192,8 @@ export default class Engine extends Component {
|
||||
{...this.props}
|
||||
/>
|
||||
</AppContext.Provider>
|
||||
);
|
||||
}
|
||||
return null;
|
||||
: null
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
"license": "MIT",
|
||||
"files": [],
|
||||
"scripts": {
|
||||
"build": "build-scripts build",
|
||||
"cloud-build": "build-scripts build --skip-demo",
|
||||
"test": "ava",
|
||||
"test:snapshot": "ava --update-snapshots"
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import { Fragment, Component, createElement } from 'rax';
|
||||
// import { observer } from './obx-rax/observer';
|
||||
import RaxEngine from '@ali/lowcode-rax-renderer';
|
||||
// import RaxEngine from '@ali/lowcode-rax-renderer/lib/index';
|
||||
import RaxEngine from '../../rax-render/lib/index';
|
||||
import { SimulatorRenderer } from './renderer';
|
||||
import { host } from './host';
|
||||
|
||||
|
||||
@ -393,20 +393,20 @@ function matcher(parent: any) {
|
||||
function getNodeInstance(dom: HTMLElement): NodeInstance<any> | null {
|
||||
const INTERNAL = '_internal';
|
||||
let instance = Instance.get(dom);
|
||||
let parent;
|
||||
let node;
|
||||
while (instance && instance[INTERNAL]) {
|
||||
if (matcher(instance)) {
|
||||
parent = instance;
|
||||
node = instance;
|
||||
break;
|
||||
}
|
||||
instance = instance[INTERNAL].__parentInstance;
|
||||
}
|
||||
if (!parent) {
|
||||
if (!node) {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
nodeId: parent.props.componentId,
|
||||
instance: parent
|
||||
nodeId: node.props.componentId,
|
||||
instance: node
|
||||
}
|
||||
// return parent;
|
||||
// const instance = fiberNode.stateNode;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user