feat(core): renames Property into Input and Event into Output
BREACKING CHANGE: Before: @Directive({properties: ['one'], events: ['two']}) After: @Directive({inputs: ['one'], outputs: ['two']}) Before: @Component({properties: ['one'], events: ['two']}) After: @Componet({inputs: ['one'], outputs: ['two']}) Before: class A {@Property() one; @Event() two;} After: class A {@Input() one; @Output() two;}
This commit is contained in:
@ -123,7 +123,7 @@ List<String> _generateSetters(Map<String, String> bindMap) {
|
||||
/// the bind properties and the values are either the one and only type
|
||||
/// binding to that property or the empty string.
|
||||
Map<String, String> _createPropertiesMap(NgDeps ngDeps) {
|
||||
var visitor = new ExtractNamedExpressionVisitor('properties');
|
||||
var visitor = new ExtractNamedExpressionVisitor('inputs');
|
||||
var bindMap = {};
|
||||
ngDeps.registeredTypes.forEach((RegisteredType t) {
|
||||
visitor.bindConfig.clear();
|
||||
@ -167,7 +167,7 @@ List<String> _generateGetters(List<String> eventProperties) {
|
||||
/// Collapses all `events` in {@link ngDeps} into a list of corresponding
|
||||
/// property names.
|
||||
List<String> _createEventPropertiesList(NgDeps ngDeps) {
|
||||
var visitor = new ExtractNamedExpressionVisitor('events');
|
||||
var visitor = new ExtractNamedExpressionVisitor('outputs');
|
||||
var propertyNames = [];
|
||||
ngDeps.registeredTypes.forEach((RegisteredType t) {
|
||||
visitor.bindConfig.clear();
|
||||
|
@ -19,7 +19,7 @@ Map<String, dynamic> directiveMetadataToMap(RenderDirectiveMetadata meta) {
|
||||
["hostProperties", _cloneIfPresent(meta.hostProperties)],
|
||||
["hostListeners", _cloneIfPresent(meta.hostListeners)],
|
||||
["hostAttributes", _cloneIfPresent(meta.hostAttributes)],
|
||||
["properties", _cloneIfPresent(meta.properties)],
|
||||
["inputs", _cloneIfPresent(meta.inputs)],
|
||||
["readAttributes", _cloneIfPresent(meta.readAttributes)],
|
||||
["type", meta.type],
|
||||
["exportAs", meta.exportAs],
|
||||
@ -31,7 +31,7 @@ Map<String, dynamic> directiveMetadataToMap(RenderDirectiveMetadata meta) {
|
||||
["callAfterContentChecked", meta.callAfterContentChecked],
|
||||
["callAfterViewInit", meta.callAfterViewInit],
|
||||
["callAfterViewChecked", meta.callAfterViewChecked],
|
||||
["events", meta.events],
|
||||
["outputs", meta.outputs],
|
||||
["changeDetection", meta.changeDetection == null ? null : meta.changeDetection.index],
|
||||
["version", 1]
|
||||
]);
|
||||
@ -52,7 +52,7 @@ RenderDirectiveMetadata directiveMetadataFromMap(Map<String, dynamic> map) {
|
||||
map["hostListeners"]) as Map<String, String>),
|
||||
hostAttributes: (_cloneIfPresent(
|
||||
map["hostAttributes"]) as Map<String, String>),
|
||||
properties: (_cloneIfPresent(map["properties"]) as List<String>),
|
||||
inputs: (_cloneIfPresent(map["inputs"]) as List<String>),
|
||||
readAttributes: (_cloneIfPresent(map["readAttributes"]) as List<String>),
|
||||
type: (map["type"] as num),
|
||||
exportAs: (map["exportAs"] as String),
|
||||
@ -64,7 +64,7 @@ RenderDirectiveMetadata directiveMetadataFromMap(Map<String, dynamic> map) {
|
||||
callAfterContentChecked: (map["callAfterContentChecked"] as bool),
|
||||
callAfterViewInit: (map["callAfterViewInit"] as bool),
|
||||
callAfterViewChecked: (map["callAfterViewChecked"] as bool),
|
||||
events: (_cloneIfPresent(map["events"]) as List<String>),
|
||||
outputs: (_cloneIfPresent(map["outputs"]) as List<String>),
|
||||
changeDetection: map["changeDetection"] == null ? null
|
||||
: ChangeDetectionStrategy.values[map["changeDetection"] as int]);
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ class _DirectiveMetadataVisitor extends Object
|
||||
num _type;
|
||||
String _selector;
|
||||
bool _compileChildren;
|
||||
List<String> _properties;
|
||||
List<String> _inputs;
|
||||
Map<String, String> _host;
|
||||
List<String> _readAttributes;
|
||||
String _exportAs;
|
||||
@ -145,7 +145,7 @@ class _DirectiveMetadataVisitor extends Object
|
||||
bool _callAfterViewInit;
|
||||
bool _callAfterViewChecked;
|
||||
ChangeDetectionStrategy _changeDetection;
|
||||
List<String> _events;
|
||||
List<String> _outputs;
|
||||
|
||||
final ConstantEvaluator _evaluator = new ConstantEvaluator();
|
||||
|
||||
@ -155,7 +155,7 @@ class _DirectiveMetadataVisitor extends Object
|
||||
_type = directiveType;
|
||||
_selector = '';
|
||||
_compileChildren = true;
|
||||
_properties = [];
|
||||
_inputs = [];
|
||||
_host = {};
|
||||
_readAttributes = [];
|
||||
_exportAs = null;
|
||||
@ -168,14 +168,14 @@ class _DirectiveMetadataVisitor extends Object
|
||||
_callAfterViewInit = false;
|
||||
_callAfterViewChecked = false;
|
||||
_changeDetection = null;
|
||||
_events = [];
|
||||
_outputs = [];
|
||||
}
|
||||
|
||||
RenderDirectiveMetadata get meta => RenderDirectiveMetadata.create(
|
||||
type: _type,
|
||||
selector: _selector,
|
||||
compileChildren: _compileChildren,
|
||||
properties: _properties,
|
||||
inputs: _inputs,
|
||||
host: _host,
|
||||
readAttributes: _readAttributes,
|
||||
exportAs: _exportAs,
|
||||
@ -188,7 +188,7 @@ class _DirectiveMetadataVisitor extends Object
|
||||
callAfterViewInit: _callAfterViewInit,
|
||||
callAfterViewChecked: _callAfterViewChecked,
|
||||
changeDetection: _changeDetection,
|
||||
events: _events);
|
||||
outputs: _outputs);
|
||||
|
||||
@override
|
||||
Object visitAnnotation(Annotation node) {
|
||||
@ -223,7 +223,7 @@ class _DirectiveMetadataVisitor extends Object
|
||||
case 'compileChildren':
|
||||
_populateCompileChildren(node.expression);
|
||||
break;
|
||||
case 'properties':
|
||||
case 'inputs':
|
||||
_populateProperties(node.expression);
|
||||
break;
|
||||
case 'host':
|
||||
@ -235,7 +235,7 @@ class _DirectiveMetadataVisitor extends Object
|
||||
case 'changeDetection':
|
||||
_populateChangeDetection(node.expression);
|
||||
break;
|
||||
case 'events':
|
||||
case 'outputs':
|
||||
_populateEvents(node.expression);
|
||||
break;
|
||||
}
|
||||
@ -312,7 +312,7 @@ class _DirectiveMetadataVisitor extends Object
|
||||
|
||||
void _populateProperties(Expression propertiesValue) {
|
||||
_checkMeta();
|
||||
_populateList(propertiesValue, _properties, 'Directive#properties');
|
||||
_populateList(propertiesValue, _inputs, 'Directive#properties');
|
||||
}
|
||||
|
||||
void _populateHost(Expression hostValue) {
|
||||
@ -342,7 +342,7 @@ class _DirectiveMetadataVisitor extends Object
|
||||
|
||||
void _populateEvents(Expression eventsValue) {
|
||||
_checkMeta();
|
||||
_populateList(eventsValue, _events, 'Directive#events');
|
||||
_populateList(eventsValue, _outputs, 'Directive#events');
|
||||
}
|
||||
|
||||
void _populateChangeDetection(Expression value) {
|
||||
|
@ -32,8 +32,8 @@ class Processor implements CodegenModel {
|
||||
void _processViewDefinition(ViewDefinitionEntry viewDefEntry) {
|
||||
// These are necessary even with generated change detectors.
|
||||
if (viewDefEntry.hostMetadata != null &&
|
||||
viewDefEntry.hostMetadata.events != null) {
|
||||
viewDefEntry.hostMetadata.events.forEach((eventName) {
|
||||
viewDefEntry.hostMetadata.outputs != null) {
|
||||
viewDefEntry.hostMetadata.outputs.forEach((eventName) {
|
||||
getterNames.add(
|
||||
new ReflectiveAccessor(eventName, isStaticallyNecessary: true));
|
||||
});
|
||||
|
Reference in New Issue
Block a user