feat: init

This commit is contained in:
liujuping 2022-12-10 10:28:25 +08:00
parent 1fa525d64a
commit f509dc6301
5 changed files with 36 additions and 11 deletions

View File

@ -115,24 +115,43 @@ export class Editor extends (EventEmitter as any) implements IEditor {
remoteComponentDescriptions.map(async (component: any) => { remoteComponentDescriptions.map(async (component: any) => {
const { exportName, url, npm } = component; const { exportName, url, npm } = component;
await (new AssetLoader()).load(url); await (new AssetLoader()).load(url);
if (window[exportName]) { function setAssetsComponent(component: any, extraNpmInfo: any = {}) {
if (Array.isArray(window[exportName])) { const components = component.components;
(window[exportName] as any).forEach((d: any, i: number) => { if (Array.isArray(components)) {
components.forEach(d => {
assets.components = assets.components.concat({ assets.components = assets.components.concat({
npm: { npm: {
...npm, ...npm,
exportName: i.toString(), ...extraNpmInfo,
subName: i.toString(),
}, },
...d.components, ...d,
} || []); } || []);
}); });
return;
} }
assets.components = assets.components.concat({ assets.components = assets.components.concat({
npm, npm: {
...window[exportName].components, ...npm,
...extraNpmInfo,
},
...component.components,
} || []); } || []);
assets.componentList = assets.componentList.concat(window[exportName].componentList || []); // assets.componentList = assets.componentList.concat(component.componentList || []);
}
function setArrayAssets(value: any[]) {
value.forEach((d: any, i: number) => {
Array.isArray(d) ? setArrayAssets(d) : setAssetsComponent(d, {
exportName: i.toString(),
subName: i.toString(),
});
});
}
if (window[exportName]) {
if (Array.isArray(window[exportName])) {
setArrayAssets(window[exportName] as any);
} else {
setAssetsComponent(window[exportName] as any);
}
} }
return window[exportName]; return window[exportName];
}), }),

View File

@ -198,7 +198,6 @@ class SettingFieldView extends Component<SettingFieldViewProps, SettingFieldView
setterProps = {}, setterProps = {},
setterType, setterType,
initialValue = null, initialValue = null,
} = this.setterInfo; } = this.setterInfo;
const value = this.value; const value = this.value;

View File

@ -363,6 +363,12 @@ export class Skeleton {
...this.parseConfig(config), ...this.parseConfig(config),
...extraConfig, ...extraConfig,
}; };
parsedConfig.contentProps = {
context: this.editor.get('plugins')?._getLowCodePluginContext({
pluginName: 'any',
}),
...(parsedConfig.contentProps || {}),
};
let { area } = parsedConfig; let { area } = parsedConfig;
if (!area) { if (!area) {
if (parsedConfig.type === 'Panel') { if (parsedConfig.type === 'Panel') {

View File

@ -104,6 +104,7 @@ export default class ComponentMeta {
return this[componentMetaSymbol].getMetadata(); return this[componentMetaSymbol].getMetadata();
} }
isComponentMeta = true;
/** /**
* check if the current node could be placed in parent node * check if the current node could be placed in parent node
* @param my * @param my

View File

@ -62,7 +62,7 @@ export default class SettingPropEntry {
* setter * setter
*/ */
get setter() { get setter() {
return this[settingPropEntrySymbol].innerSetters; return this[settingPropEntrySymbol].setter;
} }
/** /**