Files
angular-docs-cn/modules/@angular/core/src/metadata.dart
T

220 lines
5.9 KiB
Dart
Raw Normal View History

2015-08-14 10:03:45 -07:00
library angular2.src.core.metadata;
2015-11-06 17:34:07 -08:00
import 'package:angular2/src/facade/collection.dart' show List;
import 'package:angular2/src/core/change_detection/change_detection.dart';
2015-09-14 15:59:09 -07:00
import './metadata/di.dart';
import './metadata/directives.dart';
import './metadata/view.dart';
2015-08-14 10:03:45 -07:00
2015-09-14 15:59:09 -07:00
export './metadata/di.dart';
export './metadata/directives.dart';
export './metadata/view.dart' hide VIEW_ENCAPSULATION_VALUES;
export './metadata/lifecycle_hooks.dart' show
AfterContentInit,
AfterContentChecked,
AfterViewInit,
AfterViewChecked,
OnChanges,
OnDestroy,
OnInit,
DoCheck;
2015-08-14 10:03:45 -07:00
/**
* See: [DirectiveMetadata] for docs.
*/
class Directive extends DirectiveMetadata {
2015-10-20 09:38:14 -07:00
const Directive(
{String selector,
List<String> inputs,
List<String> outputs,
@Deprecated('Use `inputs` or `@Input` instead')
List<String> properties,
@Deprecated('Use `outputs` or `@Output` instead')
List<String> events,
2015-10-20 09:38:14 -07:00
Map<String, String> host,
@Deprecated('Use `providers` instead')
List bindings,
2015-10-20 09:38:14 -07:00
List providers,
String exportAs,
Map<String, dynamic> queries})
: super(
selector: selector,
inputs: inputs,
outputs: outputs,
properties: properties,
events: events,
host: host,
bindings: bindings,
providers: providers,
exportAs: exportAs,
queries: queries);
2015-08-14 10:03:45 -07:00
}
/**
* See: [ComponentMetadata] for docs.
*/
class Component extends ComponentMetadata {
2015-10-20 09:38:14 -07:00
const Component(
{String selector,
List<String> inputs,
List<String> outputs,
@Deprecated('Use `inputs` or `@Input` instead')
List<String> properties,
@Deprecated('Use `outputs` or `@Output` instead')
List<String> events,
2015-10-20 09:38:14 -07:00
Map<String, String> host,
@Deprecated('Use `providers` instead')
List bindings,
2015-10-20 09:38:14 -07:00
List providers,
String exportAs,
String moduleId,
Map<String, dynamic> queries,
@Deprecated('Use `viewProviders` instead')
List viewBindings,
2015-10-20 09:38:14 -07:00
List viewProviders,
ChangeDetectionStrategy changeDetection,
String templateUrl,
String template,
dynamic directives,
dynamic pipes,
ViewEncapsulation encapsulation,
List<String> styles,
List<String> styleUrls})
: super(
selector: selector,
inputs: inputs,
outputs: outputs,
properties: properties,
events: events,
host: host,
bindings: bindings,
providers: providers,
exportAs: exportAs,
moduleId: moduleId,
viewBindings: viewBindings,
viewProviders: viewProviders,
queries: queries,
changeDetection: changeDetection,
templateUrl: templateUrl,
template: template,
directives: directives,
pipes: pipes,
encapsulation: encapsulation,
styles: styles,
styleUrls: styleUrls);
2015-08-14 10:03:45 -07:00
}
/**
* See: [ViewMetadata] for docs.
*/
class View extends ViewMetadata {
2015-10-20 09:38:14 -07:00
const View(
{String templateUrl,
String template,
dynamic directives,
dynamic pipes,
ViewEncapsulation encapsulation,
List<String> styles,
List<String> styleUrls})
: super(
templateUrl: templateUrl,
template: template,
directives: directives,
pipes: pipes,
encapsulation: encapsulation,
styles: styles,
styleUrls: styleUrls);
2015-08-14 10:03:45 -07:00
}
/**
* See: [PipeMetadata] for docs.
*/
class Pipe extends PipeMetadata {
2015-09-08 09:17:58 -07:00
const Pipe({name, pure}) : super(name: name, pure: pure);
2015-08-14 10:03:45 -07:00
}
/**
* See: [AttributeMetadata] for docs.
*/
class Attribute extends AttributeMetadata {
const Attribute(String attributeName) : super(attributeName);
}
/**
* See: [QueryMetadata] for docs.
*/
2015-10-26 15:45:44 -07:00
@Deprecated("Use ContentChildren/ContentChild instead")
2015-08-14 10:03:45 -07:00
class Query extends QueryMetadata {
const Query(dynamic /*Type | string*/ selector,
{bool descendants: false, dynamic read: null})
: super(selector, descendants: descendants, read: read);
2015-08-14 10:03:45 -07:00
}
/**
* See: [ContentChildrenMetadata] for docs.
*/
class ContentChildren extends ContentChildrenMetadata {
2015-10-20 09:38:14 -07:00
const ContentChildren(dynamic /*Type | string*/ selector,
{bool descendants: false, dynamic read: null})
: super(selector, descendants: descendants, read: read);
}
/**
* See: [ContentChildMetadata] for docs.
*/
class ContentChild extends ContentChildMetadata {
const ContentChild(dynamic /*Type | string*/ selector, {dynamic read: null}) : super(selector, read: read);
}
2015-08-14 10:03:45 -07:00
/**
* See: [ViewQueryMetadata] for docs.
*/
2015-10-26 15:45:44 -07:00
@Deprecated("Use ViewChildren/ViewChild instead")
2015-08-14 10:03:45 -07:00
class ViewQuery extends ViewQueryMetadata {
const ViewQuery(dynamic /*Type | string*/ selector, {dynamic read: null})
: super(selector, descendants: true, read: read);
2015-08-14 10:03:45 -07:00
}
/**
* See: [ViewChildrenMetadata] for docs.
*/
class ViewChildren extends ViewChildrenMetadata {
const ViewChildren(dynamic /*Type | string*/ selector, {dynamic read: null}) : super(selector, read: read);
}
/**
* See: [ViewChildMetadata] for docs.
*/
class ViewChild extends ViewChildMetadata {
const ViewChild(dynamic /*Type | string*/ selector, {dynamic read: null}) : super(selector, read: read);
}
/**
* See: [InputMetadata] for docs.
*/
class Input extends InputMetadata {
2015-10-20 09:38:14 -07:00
const Input([String bindingPropertyName]) : super(bindingPropertyName);
}
/**
* See: [OutputMetadata] for docs.
*/
class Output extends OutputMetadata {
2015-10-20 09:38:14 -07:00
const Output([String bindingPropertyName]) : super(bindingPropertyName);
}
/**
* See: [HostBindingMetadata] for docs.
*/
class HostBinding extends HostBindingMetadata {
2015-10-20 09:38:14 -07:00
const HostBinding([String hostPropertyName]) : super(hostPropertyName);
}
/**
* See: [HostListenerMetadata] for docs.
*/
class HostListener extends HostListenerMetadata {
const HostListener(String eventName, [List<String> args])
2015-10-20 09:38:14 -07:00
: super(eventName, args);
}