mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-19 22:58:15 +00:00
Merge branch fix/component-pane-locale into release/1.0.0
Title: fix: 修复组件面板 i18n 警告 修复组件面板 i18n 警告 Link: https://code.aone.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/codereview/3822792
This commit is contained in:
commit
c10e11f96a
@ -1,4 +1,4 @@
|
|||||||
export default {
|
module.exports = {
|
||||||
'en-US': require('./en-US.json'),
|
'en-US': require('./en-US.json'),
|
||||||
'zh-CN': require('./zh-CN.json'),
|
'zh-CN': require('./zh-CN.json'),
|
||||||
};
|
};
|
||||||
|
|||||||
@ -34,7 +34,7 @@ export default class ComponentListPlugin extends Component<PluginProps, IState>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
transformMetaData(componentList: any): any {
|
transformMetaData(componentList: any, scope: string): any {
|
||||||
const metaData: Array<Record<string, unknown>> = [];
|
const metaData: Array<Record<string, unknown>> = [];
|
||||||
if (!componentList || !Array.isArray(componentList) || !componentList.length) {
|
if (!componentList || !Array.isArray(componentList) || !componentList.length) {
|
||||||
return metaData;
|
return metaData;
|
||||||
@ -43,13 +43,13 @@ export default class ComponentListPlugin extends Component<PluginProps, IState>
|
|||||||
if (Array.isArray(category?.children)) {
|
if (Array.isArray(category?.children)) {
|
||||||
category.children.forEach((comp: any, compId: number) => {
|
category.children.forEach((comp: any, compId: number) => {
|
||||||
metaData.push({
|
metaData.push({
|
||||||
id: `${categoryId}-${compId}`,
|
id: `${scope}-${categoryId}-${compId}`,
|
||||||
componentName: comp.componentName,
|
componentName: comp.componentName,
|
||||||
title: comp.title,
|
title: comp.title,
|
||||||
category: category.title,
|
category: category.title,
|
||||||
snippets: comp.snippets.map((snippet: any, snippetId: number) => {
|
snippets: comp.snippets.map((snippet: any, snippetId: number) => {
|
||||||
const item = {
|
const item = {
|
||||||
id: `${categoryId}-${compId}-${snippetId}`,
|
id: `${scope}-${categoryId}-${compId}-${snippetId}`,
|
||||||
description: snippet.title,
|
description: snippet.title,
|
||||||
thumbnail: snippet.screenshot,
|
thumbnail: snippet.screenshot,
|
||||||
schema: snippet.schema,
|
schema: snippet.schema,
|
||||||
@ -67,8 +67,8 @@ export default class ComponentListPlugin extends Component<PluginProps, IState>
|
|||||||
initComponentList = (): void => {
|
initComponentList = (): void => {
|
||||||
const { editor } = this.props;
|
const { editor } = this.props;
|
||||||
const assets = editor.get('assets') || {};
|
const assets = editor.get('assets') || {};
|
||||||
const metaData = this.transformMetaData(assets.componentList);
|
const metaData = this.transformMetaData(assets.componentList, 'basic');
|
||||||
const bizComponents = this.transformMetaData(assets.bizComponentList);
|
const bizComponents = this.transformMetaData(assets.bizComponentList, 'biz');
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
metaData,
|
metaData,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user