mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[APM-419] Adding data input to dynamic component (#4084)
* Extract ComponentRegisterService from ExtensionService * Make DynamicExtensionComponent smarter * Add component existence safeguards * hasComponentById * Fixing spell check for the sake of mankind * Add more proper tests and remove double ngOnDestroy call * Remove lifecycle patches
This commit is contained in:
@@ -22,6 +22,7 @@ import { ExtensionLoaderService } from './extension-loader.service';
|
||||
import { RouteRef } from '../config/routing.extensions';
|
||||
import { ActionRef } from '../config/action.extensions';
|
||||
import * as core from '../evaluators/core.evaluators';
|
||||
import { ComponentRegisterService } from './component-register.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -35,10 +36,12 @@ export class ExtensionService {
|
||||
actions: Array<ActionRef> = [];
|
||||
|
||||
authGuards: { [key: string]: Type<{}> } = {};
|
||||
components: { [key: string]: Type<{}> } = {};
|
||||
evaluators: { [key: string]: RuleEvaluator } = {};
|
||||
|
||||
constructor(private loader: ExtensionLoaderService) {}
|
||||
constructor(
|
||||
private loader: ExtensionLoaderService,
|
||||
private componentRegister: ComponentRegisterService
|
||||
) {}
|
||||
|
||||
async load(): Promise<ExtensionConfig> {
|
||||
const config = await this.loader.load(
|
||||
@@ -79,9 +82,7 @@ export class ExtensionService {
|
||||
}
|
||||
|
||||
setComponents(values: { [key: string]: Type<{}> }) {
|
||||
if (values) {
|
||||
this.components = Object.assign({}, this.components, values);
|
||||
}
|
||||
this.componentRegister.setComponents(values);
|
||||
}
|
||||
|
||||
getRouteById(id: string): RouteRef {
|
||||
@@ -125,8 +126,8 @@ export class ExtensionService {
|
||||
return false;
|
||||
}
|
||||
|
||||
getComponentById(id: string): Type<{}> {
|
||||
return this.components[id];
|
||||
getComponentById<T>(id: string) {
|
||||
return this.componentRegister.getComponentById<T>(id);
|
||||
}
|
||||
|
||||
getRuleById(id: string): RuleRef {
|
||||
|
Reference in New Issue
Block a user