fix(editor-skeleton): fix missing i18n

This commit is contained in:
haoziqaq 2023-01-19 10:41:15 +08:00 committed by 林熠
parent 5c6572e302
commit be309cba01

View File

@ -1,8 +1,14 @@
import { IPublicTypeTransformedComponentMetadata, IPublicTypeFieldConfig, IPublicModelSettingTarget } from '@alilc/lowcode-types'; import {
IPublicTypeTransformedComponentMetadata,
IPublicTypeFieldConfig,
IPublicModelSettingTarget,
} from '@alilc/lowcode-types';
import { IconSlot } from '../icons/slot'; import { IconSlot } from '../icons/slot';
import { getConvertedExtraKey } from '@alilc/lowcode-designer'; import { getConvertedExtraKey } from '@alilc/lowcode-designer';
export default function (metadata: IPublicTypeTransformedComponentMetadata): IPublicTypeTransformedComponentMetadata { export default function (
metadata: IPublicTypeTransformedComponentMetadata,
): IPublicTypeTransformedComponentMetadata {
const { componentName, configure = {} } = metadata; const { componentName, configure = {} } = metadata;
// 如果已经处理过,不再重新执行一遍 // 如果已经处理过,不再重新执行一遍
@ -111,35 +117,33 @@ export default function (metadata: IPublicTypeTransformedComponentMetadata): IPu
}, },
]; ];
} }
/* // propsGroup.push({
propsGroup.push({ // name: '#generals',
name: '#generals', // title: { type: 'i18n', 'zh-CN': '通用', 'en-US': 'General' },
title: { type: 'i18n', 'zh-CN': '通用', 'en-US': 'General' }, // items: [
items: [ // {
{ // name: 'id',
name: 'id', // title: 'ID',
title: 'ID', // setter: 'StringSetter',
setter: 'StringSetter', // },
}, // {
{ // name: 'key',
name: 'key', // title: 'Key',
title: 'Key', // // todo: use Mixin
// todo: use Mixin // setter: 'StringSetter',
setter: 'StringSetter', // },
}, // {
{ // name: 'ref',
name: 'ref', // title: 'Ref',
title: 'Ref', // setter: 'StringSetter',
setter: 'StringSetter', // },
}, // {
{ // name: '!more',
name: '!more', // title: '更多',
title: '更多', // setter: 'PropertiesSetter',
setter: 'PropertiesSetter', // },
}, // ],
], // });
});
*/
const stylesGroup: IPublicTypeFieldConfig[] = []; const stylesGroup: IPublicTypeFieldConfig[] = [];
const advancedGroup: IPublicTypeFieldConfig[] = []; const advancedGroup: IPublicTypeFieldConfig[] = [];
if (propsGroup) { if (propsGroup) {
@ -216,15 +220,21 @@ export default function (metadata: IPublicTypeTransformedComponentMetadata): IPu
setValue(field: IPublicModelSettingTarget, eventData) { setValue(field: IPublicModelSettingTarget, eventData) {
const { eventDataList, eventList } = eventData; const { eventDataList, eventList } = eventData;
Array.isArray(eventList) && eventList.map((item) => { Array.isArray(eventList) &&
eventList.map((item) => {
field.parent.clearPropValue(item.name); field.parent.clearPropValue(item.name);
return item; return item;
}); });
Array.isArray(eventDataList) && eventDataList.map((item) => { Array.isArray(eventDataList) &&
eventDataList.map((item) => {
field.parent.setPropValue(item.name, { field.parent.setPropValue(item.name, {
type: 'JSFunction', type: 'JSFunction',
// 需要传下入参 // 需要传下入参
value: `function(){return this.${item.relatedEventName}.apply(this,Array.prototype.slice.call(arguments).concat([${item.paramStr ? item.paramStr : ''}])) }`, value: `function(){return this.${
item.relatedEventName
}.apply(this,Array.prototype.slice.call(arguments).concat([${
item.paramStr ? item.paramStr : ''
}])) }`,
}); });
return item; return item;
}); });
@ -296,7 +306,7 @@ export default function (metadata: IPublicTypeTransformedComponentMetadata): IPu
}, },
{ {
name: 'key', name: 'key',
title: '循环 Key', title: { type: 'i18n', 'zh-CN': '循环 Key', 'en-US': 'Loop Key' },
setter: [ setter: [
{ {
componentName: 'StringSetter', componentName: 'StringSetter',
@ -317,8 +327,16 @@ export default function (metadata: IPublicTypeTransformedComponentMetadata): IPu
advancedGroup.push({ advancedGroup.push({
name: 'key', name: 'key',
title: { title: {
label: '渲染唯一标识key', label: {
tip: '搭配「条件渲染」或「循环渲染」时使用,和 react 组件中的 key 原理相同,点击查看帮助', type: 'i18n',
'zh-CN': '渲染唯一标识 (key)',
'en-US': 'Render unique identifier (key)',
},
tip: {
type: 'i18n',
'zh-CN': '搭配「条件渲染」或「循环渲染」时使用,和 react 组件中的 key 原理相同,点击查看帮助',
'en-US': 'Used with 「Conditional Rendering」or「Cycle Rendering」, the same principle as the key in the react component, click to view the help',
},
docUrl: 'https://www.yuque.com/lce/doc/qm75w3', docUrl: 'https://www.yuque.com/lce/doc/qm75w3',
}, },
setter: [ setter: [