2024-03-29 17:29:25 +08:00

55 lines
1.1 KiB
TypeScript

import { IPublicModelResource } from '@alilc/lowcode-types';
import { IResource } from '../../workspace';
import { resourceSymbol } from '../symbols';
export class Resource implements IPublicModelResource {
readonly [resourceSymbol]: IResource;
constructor(resource: IResource) {
this[resourceSymbol] = resource;
}
get title() {
return this[resourceSymbol].title;
}
get id() {
return this[resourceSymbol].id;
}
get icon() {
return this[resourceSymbol].icon;
}
get options() {
return this[resourceSymbol].options;
}
get name() {
return this[resourceSymbol].resourceType.name;
}
get config() {
return this[resourceSymbol].config;
}
get type() {
return this[resourceSymbol].resourceType.type;
}
get category() {
return this[resourceSymbol].category;
}
get description() {
return this[resourceSymbol].description;
}
get children() {
return this[resourceSymbol].children.map((child) => new Resource(child) as IPublicModelResource);
}
get viewName() {
return this[resourceSymbol].viewName;
}
}