mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[AAE-7100] ESLint support for ADF Core and DemoShell projects (#7481)
* remove tsconfig.base as per eslint schematics * add schematics * upgrade demoshell to eslint * fix eslint issues for demoshell * integrate eslint for ADF core and fix some issues * turn into warn * fix code * workaround for Chrome clipboard issue * exclude e2e tests * exclude e2e
This commit is contained in:
@@ -18,17 +18,17 @@
|
||||
import { Type } from '@angular/core';
|
||||
import { getType } from './get-type';
|
||||
|
||||
export interface DynamicComponentModel { type: string; }
|
||||
export type DynamicComponentResolveFunction = (model: DynamicComponentModel) => Type<{}>;
|
||||
export interface DynamicComponentModel { type: string }
|
||||
export type DynamicComponentResolveFunction = (model: DynamicComponentModel) => Type<any>;
|
||||
export class DynamicComponentResolver {
|
||||
static fromType(type: Type<{}>): DynamicComponentResolveFunction {
|
||||
static fromType(type: Type<any>): DynamicComponentResolveFunction {
|
||||
return getType(type);
|
||||
}
|
||||
}
|
||||
|
||||
export abstract class DynamicComponentMapper {
|
||||
|
||||
protected defaultValue: Type<{}> = undefined;
|
||||
protected defaultValue: Type<any> = undefined;
|
||||
protected types: { [key: string]: DynamicComponentResolveFunction } = {};
|
||||
|
||||
/**
|
||||
@@ -37,7 +37,7 @@ export abstract class DynamicComponentMapper {
|
||||
* @param defaultValue Default type returned for types that are not yet mapped
|
||||
* @returns Resolver function
|
||||
*/
|
||||
getComponentTypeResolver(type: string, defaultValue: Type<{}> = this.defaultValue): DynamicComponentResolveFunction {
|
||||
getComponentTypeResolver(type: string, defaultValue: Type<any> = this.defaultValue): DynamicComponentResolveFunction {
|
||||
if (type) {
|
||||
return this.types[type] || DynamicComponentResolver.fromType(defaultValue);
|
||||
}
|
||||
@@ -84,7 +84,7 @@ export abstract class DynamicComponentMapper {
|
||||
* @param defaultValue Default type returned for field types that are not yet mapped.
|
||||
* @returns Component type
|
||||
*/
|
||||
resolveComponentType(model: DynamicComponentModel, defaultValue: Type<{}> = this.defaultValue): Type<{}> {
|
||||
resolveComponentType(model: DynamicComponentModel, defaultValue: Type<any> = this.defaultValue): Type<any> {
|
||||
if (model) {
|
||||
const resolver = this.getComponentTypeResolver(model.type, defaultValue);
|
||||
return resolver(model);
|
||||
|
Reference in New Issue
Block a user