This commit is contained in:
kangwei 2020-05-19 23:45:34 +08:00
parent 5b0d030367
commit 31ac73238e
6 changed files with 37 additions and 2 deletions

View File

@ -48,5 +48,9 @@
},
"engines": {
"node": ">=10.0.0"
},
"tnpm": {
"mode": "yarn",
"lockfile": "enable"
}
}

View File

@ -1,6 +1,5 @@
{
"entry": {
"index": "src/index.ts",
"editor-preset-vision": "../editor-preset-vision/src/index.ts",
"react-simulator-renderer": "../react-simulator-renderer/src/index.ts"
},

View File

@ -9,6 +9,9 @@ import './title.less';
export class Title extends Component<{ title: TitleContent; className?: string; onClick?: () => void }> {
render() {
let { title, className, onClick } = this.props;
if (title == null) {
return null;
}
if (isValidElement(title)) {
return title;
}

View File

@ -41,6 +41,34 @@ export class Trunk {
return this.metaBundle.getFromMeta(name);
}
listByCategory() {
const categories: any[] = [];
const categoryMap: any = {};
const categoryItems: any[] = [];
const defaultCategory = {
items: categoryItems,
name: '*',
};
categories.push(defaultCategory);
categoryMap['*'] = defaultCategory;
this.getList().forEach((prototype) => {
const cat = prototype.getCategory();
if (!cat) {
return;
}
if (!categoryMap.hasOwnProperty(cat)) {
const categoryMapItems: any[] = [];
categoryMap[cat] = {
items: categoryMapItems,
name: cat,
};
categories.push(categoryMap[cat]);
}
categoryMap[cat].items.push(prototype);
});
return categories;
}
getPrototypeView(componentName: string) {
return this.getPrototype(componentName)?.getView();
}

View File

@ -29,6 +29,7 @@ const pages = Object.assign(project, {
componentsTree: pages[0].componentsTree,
}, true);
},
// FIXME:
addPage(data: OldPageData) {
return project.open(data.layout);
},

View File

@ -1,5 +1,5 @@
#!/usr/bin/env bash
#lerna run build --stream
lerna run build --stream
cp -R ./packages/react-simulator-renderer/dist/* ./packages/editor-preset-general/dist
cp -R ./packages/react-simulator-renderer/dist/* ./packages/editor-preset-vision/dist