mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-18 07:42:54 +00:00
21 lines
614 B
TypeScript
21 lines
614 B
TypeScript
import { cloneEnumerableProperty } from '@alilc/lowcode-utils';
|
|
import adapter from '../adapter';
|
|
|
|
export function compWrapper(Comp: any) {
|
|
const { createElement, Component, forwardRef } = adapter.getRuntime();
|
|
class Wrapper extends Component {
|
|
// constructor(props: any, context: any) {
|
|
// super(props, context);
|
|
// }
|
|
|
|
render() {
|
|
return createElement(Comp, this.props);
|
|
}
|
|
}
|
|
(Wrapper as any).displayName = Comp.displayName;
|
|
|
|
return cloneEnumerableProperty(forwardRef((props: any, ref: any) => {
|
|
return createElement(Wrapper, { ...props, forwardRef: ref });
|
|
}), Comp);
|
|
}
|