mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-15 10:48:17 +00:00
fix: 🐛 title缺少icon字段,临时转接一下
需要后续相关同学增加api,已经标注
This commit is contained in:
parent
89064f5c29
commit
2f9bb2567c
@ -7,6 +7,8 @@ import {
|
|||||||
TitleContent,
|
TitleContent,
|
||||||
TransformedComponentMetadata,
|
TransformedComponentMetadata,
|
||||||
NestingFilter,
|
NestingFilter,
|
||||||
|
isTitleConfig,
|
||||||
|
I18nData,
|
||||||
} from '@ali/lowcode-types';
|
} from '@ali/lowcode-types';
|
||||||
import { computed } from '@ali/lowcode-editor-core';
|
import { computed } from '@ali/lowcode-editor-core';
|
||||||
import { Node, ParentalNode } from './document';
|
import { Node, ParentalNode } from './document';
|
||||||
@ -17,6 +19,7 @@ import { IconPage } from './icons/page';
|
|||||||
import { IconComponent } from './icons/component';
|
import { IconComponent } from './icons/component';
|
||||||
import { IconRemove } from './icons/remove';
|
import { IconRemove } from './icons/remove';
|
||||||
import { IconClone } from './icons/clone';
|
import { IconClone } from './icons/clone';
|
||||||
|
import { ReactElement } from 'react';
|
||||||
|
|
||||||
function ensureAList(list?: string | string[]): string[] | null {
|
function ensureAList(list?: string | string[]): string[] | null {
|
||||||
if (!list) {
|
if (!list) {
|
||||||
@ -91,12 +94,20 @@ export class ComponentMeta {
|
|||||||
private childWhitelist?: NestingFilter | null;
|
private childWhitelist?: NestingFilter | null;
|
||||||
|
|
||||||
private _title?: TitleContent;
|
private _title?: TitleContent;
|
||||||
get title() {
|
get title(): string | I18nData | ReactElement {
|
||||||
|
// TODO: 标记下。这块需要康师傅加一下API,页面正常渲染。
|
||||||
|
// string | i18nData | ReactElement
|
||||||
|
// TitleConfig title.label
|
||||||
|
if (isTitleConfig(this._title)) {
|
||||||
|
return (this._title.label as any) || this.componentName;
|
||||||
|
}
|
||||||
return this._title || this.componentName;
|
return this._title || this.componentName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@computed get icon() {
|
@computed get icon() {
|
||||||
|
// TODO: 标记下。这块需要康师傅加一下API,页面正常渲染。
|
||||||
// give Slot default icon
|
// give Slot default icon
|
||||||
|
// if _title is TitleConfig get _title.icon
|
||||||
return (
|
return (
|
||||||
this._transformedMetadata?.icon ||
|
this._transformedMetadata?.icon ||
|
||||||
(this.componentName === 'Page' ? IconPage : this.isContainer ? IconContainer : IconComponent)
|
(this.componentName === 'Page' ? IconPage : this.isContainer ? IconContainer : IconComponent)
|
||||||
@ -131,10 +142,10 @@ export class ComponentMeta {
|
|||||||
this._title =
|
this._title =
|
||||||
typeof title === 'string'
|
typeof title === 'string'
|
||||||
? {
|
? {
|
||||||
type: 'i18n',
|
type: 'i18n',
|
||||||
'en-US': this.componentName,
|
'en-US': this.componentName,
|
||||||
'zh-CN': title,
|
'zh-CN': title,
|
||||||
}
|
}
|
||||||
: title;
|
: title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user