MCPcopy Index your code
hub / github.com/alibaba/lowcode-engine / DesignerPlugin

Class DesignerPlugin

packages/plugin-designer/src/index.tsx:27–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25}
26
27export default class DesignerPlugin extends PureComponent<PluginProps, DesignerPluginState> {
28 static displayName: 'LowcodePluginDesigner';
29
30 state: DesignerPluginState = {
31 componentMetadatas: null,
32 library: null,
33 extraEnvironment: null,
34 renderEnv: 'default',
35 device: 'default',
36 locale: '',
37 designMode: 'live',
38 deviceClassName: '',
39 simulatorUrl: null,
40 requestHandlersMap: null,
41 };
42
43 private _mounted = true;
44
45 constructor(props: any) {
46 super(props);
47 this.setupAssets();
48 }
49
50 private async setupAssets() {
51 const editor = this.props.engineEditor;
52 try {
53 const assets = await editor.onceGot('assets');
54 const renderEnv = engineConfig.get('renderEnv') || editor.get('renderEnv');
55 const device = engineConfig.get('device') || editor.get('device');
56 const locale = engineConfig.get('locale') || editor.get('locale');
57 const designMode = engineConfig.get('designMode') || editor.get('designMode');
58 const deviceClassName = engineConfig.get('deviceClassName') || editor.get('deviceClassName');
59 const simulatorUrl = engineConfig.get('simulatorUrl') || editor.get('simulatorUrl');
60 // @TODO setupAssets 里设置 requestHandlersMap 不太合适
61 const requestHandlersMap = engineConfig.get('requestHandlersMap') || editor.get('requestHandlersMap');
62 if (!this._mounted) {
63 return;
64 }
65 engineConfig.onGot('locale', (locale) => {
66 this.setState({
67 locale,
68 });
69 });
70 engineConfig.onGot('requestHandlersMap', (requestHandlersMap) => {
71 this.setState({
72 requestHandlersMap,
73 });
74 });
75 engineConfig.onGot('device', (device) => {
76 this.setState({
77 device,
78 });
79 });
80 const { components, packages, extraEnvironment, utils } = assets;
81 const state = {
82 componentMetadatas: components || [],
83 library: packages || [],
84 utilsMetadata: utils || [],

Callers

nothing calls this directly

Calls 4

setMethod · 0.65
emitMethod · 0.65
onGotMethod · 0.65
openMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…