| 30 | export type IResource = IBaseResource<IResource>; |
| 31 | |
| 32 | export class Resource implements IResource { |
| 33 | private context: IBasicContext; |
| 34 | |
| 35 | resourceTypeInstance: IPublicResourceTypeConfig; |
| 36 | |
| 37 | editorViewMap: Map<string, IPublicTypeEditorView> = new Map<string, IPublicTypeEditorView>(); |
| 38 | |
| 39 | get name() { |
| 40 | return this.resourceType.name; |
| 41 | } |
| 42 | |
| 43 | get viewName() { |
| 44 | return this.resourceData.viewName || (this.resourceData as any).viewType || this.defaultViewName; |
| 45 | } |
| 46 | |
| 47 | get description() { |
| 48 | return this.resourceTypeInstance?.description; |
| 49 | } |
| 50 | |
| 51 | get icon() { |
| 52 | return this.resourceData.icon || this.resourceTypeInstance?.icon; |
| 53 | } |
| 54 | |
| 55 | get type() { |
| 56 | return this.resourceType.type; |
| 57 | } |
| 58 | |
| 59 | get title(): string | undefined { |
| 60 | return this.resourceData.title || this.resourceTypeInstance.defaultTitle; |
| 61 | } |
| 62 | |
| 63 | get id(): string | undefined { |
| 64 | return this.resourceData.id; |
| 65 | } |
| 66 | |
| 67 | get options() { |
| 68 | return this.resourceData.options; |
| 69 | } |
| 70 | |
| 71 | get category() { |
| 72 | return this.resourceData?.category; |
| 73 | } |
| 74 | |
| 75 | get skeleton() { |
| 76 | return this.context.innerSkeleton; |
| 77 | } |
| 78 | |
| 79 | children: IResource[]; |
| 80 | |
| 81 | get config() { |
| 82 | return this.resourceData.config; |
| 83 | } |
| 84 | |
| 85 | constructor(readonly resourceData: IPublicResourceData, readonly resourceType: IResourceType, readonly workspace: IWorkspace) { |
| 86 | this.context = new BasicContext(workspace, `resource-${resourceData.resourceName || resourceType.name}`, IPublicEnumPluginRegisterLevel.Resource); |
| 87 | this.resourceTypeInstance = resourceType.resourceTypeModel(this.context.innerPlugins._getLowCodePluginContext({ |
| 88 | pluginName: '', |
| 89 | }), this.options); |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…