feat: support decorator chaining and class creation in ES5
Closes #2534
This commit is contained in:
@@ -787,16 +787,7 @@ export class Directive extends Injectable {
|
||||
constructor({
|
||||
selector, properties, events, host, lifecycle, hostInjector, exportAs,
|
||||
compileChildren = true,
|
||||
}: {
|
||||
selector?: string,
|
||||
properties?: List<string>,
|
||||
events?: List<string>,
|
||||
host?: StringMap<string, string>,
|
||||
lifecycle?: List<LifecycleEvent>,
|
||||
hostInjector?: List<any>,
|
||||
exportAs?: string,
|
||||
compileChildren?: boolean
|
||||
} = {}) {
|
||||
}: ComponentArgs = {}) {
|
||||
super();
|
||||
this.selector = selector;
|
||||
this.properties = properties;
|
||||
@@ -809,6 +800,17 @@ export class Directive extends Injectable {
|
||||
}
|
||||
}
|
||||
|
||||
export interface ComponentArgs {
|
||||
selector?: string;
|
||||
properties?: List<string>;
|
||||
events?: List<string>;
|
||||
host?: StringMap<string, string>;
|
||||
lifecycle?: List<LifecycleEvent>;
|
||||
hostInjector?: List<any>;
|
||||
exportAs?: string;
|
||||
compileChildren?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Declare reusable UI building blocks for an application.
|
||||
*
|
||||
@@ -1007,19 +1009,8 @@ export class Component extends Directive {
|
||||
viewInjector: List<any>;
|
||||
|
||||
constructor({selector, properties, events, host, exportAs, appInjector, lifecycle, hostInjector,
|
||||
viewInjector, changeDetection = DEFAULT, compileChildren = true}: {
|
||||
selector?: string,
|
||||
properties?: List<string>,
|
||||
events?: List<string>,
|
||||
host?: StringMap<string, string>,
|
||||
exportAs?: string,
|
||||
appInjector?: List<any>,
|
||||
lifecycle?: List<LifecycleEvent>,
|
||||
hostInjector?: List<any>,
|
||||
viewInjector?: List<any>,
|
||||
changeDetection?: string,
|
||||
compileChildren?: boolean
|
||||
} = {}) {
|
||||
viewInjector, changeDetection = DEFAULT,
|
||||
compileChildren = true}: DirectiveArgs = {}) {
|
||||
super({
|
||||
selector: selector,
|
||||
properties: properties,
|
||||
@@ -1036,6 +1027,20 @@ export class Component extends Directive {
|
||||
this.viewInjector = viewInjector;
|
||||
}
|
||||
}
|
||||
export interface DirectiveArgs {
|
||||
selector?: string;
|
||||
properties?: List<string>;
|
||||
events?: List<string>;
|
||||
host?: StringMap<string, string>;
|
||||
exportAs?: string;
|
||||
appInjector?: List<any>;
|
||||
lifecycle?: List<LifecycleEvent>;
|
||||
hostInjector?: List<any>;
|
||||
viewInjector?: List<any>;
|
||||
changeDetection?: string;
|
||||
compileChildren?: boolean;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Lifecycle events are guaranteed to be called in the following order:
|
||||
|
||||
@@ -82,15 +82,16 @@ export class View {
|
||||
*/
|
||||
renderer: string;
|
||||
|
||||
constructor({templateUrl, template, directives, renderer}: {
|
||||
templateUrl?: string,
|
||||
template?: string,
|
||||
directives?: List<Type | any | List<any>>,
|
||||
renderer?: string
|
||||
} = {}) {
|
||||
constructor({templateUrl, template, directives, renderer}: ViewArgs = {}) {
|
||||
this.templateUrl = templateUrl;
|
||||
this.template = template;
|
||||
this.directives = directives;
|
||||
this.renderer = renderer;
|
||||
}
|
||||
}
|
||||
export interface ViewArgs {
|
||||
templateUrl?: string;
|
||||
template?: string;
|
||||
directives?: List<Type | any | List<any>>;
|
||||
renderer?: string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user