mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-18 05:08:20 +00:00
feat: 🎸 增加icon获取api
This commit is contained in:
parent
f04204162e
commit
f1a082369d
@ -7,6 +7,7 @@ import {
|
|||||||
PropsList,
|
PropsList,
|
||||||
NodeData,
|
NodeData,
|
||||||
TitleContent,
|
TitleContent,
|
||||||
|
I18nData,
|
||||||
SlotSchema,
|
SlotSchema,
|
||||||
PageSchema,
|
PageSchema,
|
||||||
ComponentSchema,
|
ComponentSchema,
|
||||||
@ -19,6 +20,7 @@ import { Prop } from './props/prop';
|
|||||||
import { ComponentMeta } from '../../component-meta';
|
import { ComponentMeta } from '../../component-meta';
|
||||||
import { ExclusiveGroup, isExclusiveGroup } from './exclusive-group';
|
import { ExclusiveGroup, isExclusiveGroup } from './exclusive-group';
|
||||||
import { TransformStage } from './transform-stage';
|
import { TransformStage } from './transform-stage';
|
||||||
|
import { ReactElement } from 'react';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 基础节点
|
* 基础节点
|
||||||
@ -122,7 +124,7 @@ export class Node<Schema extends NodeSchema = NodeSchema> {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@computed get title(): TitleContent {
|
@computed get title(): string | I18nData | ReactElement {
|
||||||
let t = this.getExtraProp('title');
|
let t = this.getExtraProp('title');
|
||||||
if (!t && this.componentMeta.descriptor) {
|
if (!t && this.componentMeta.descriptor) {
|
||||||
t = this.getProp(this.componentMeta.descriptor, false);
|
t = this.getProp(this.componentMeta.descriptor, false);
|
||||||
@ -136,6 +138,10 @@ export class Node<Schema extends NodeSchema = NodeSchema> {
|
|||||||
return this.componentMeta.title;
|
return this.componentMeta.title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get icon() {
|
||||||
|
return this.componentMeta.icon;
|
||||||
|
}
|
||||||
|
|
||||||
constructor(readonly document: DocumentModel, nodeSchema: Schema) {
|
constructor(readonly document: DocumentModel, nodeSchema: Schema) {
|
||||||
const { componentName, id, children, props, ...extras } = nodeSchema;
|
const { componentName, id, children, props, ...extras } = nodeSchema;
|
||||||
this.id = id || `node$${document.nextId()}`;
|
this.id = id || `node$${document.nextId()}`;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user