fix(compiler): support dotted property binding
fixes angular/flex-layout#34
This commit is contained in:
parent
95f48292b1
commit
3bee521aa4
@ -245,18 +245,12 @@ export class BindingParser {
|
|||||||
|
|
||||||
let unit: string = null;
|
let unit: string = null;
|
||||||
let bindingType: PropertyBindingType;
|
let bindingType: PropertyBindingType;
|
||||||
let boundPropertyName: string;
|
let boundPropertyName: string = null;
|
||||||
const parts = boundProp.name.split(PROPERTY_PARTS_SEPARATOR);
|
const parts = boundProp.name.split(PROPERTY_PARTS_SEPARATOR);
|
||||||
let securityContexts: SecurityContext[];
|
let securityContexts: SecurityContext[];
|
||||||
|
|
||||||
if (parts.length === 1) {
|
// Check check for special cases (prefix style, attr, class)
|
||||||
const partValue = parts[0];
|
if (parts.length > 1) {
|
||||||
boundPropertyName = this._schemaRegistry.getMappedPropName(partValue);
|
|
||||||
securityContexts = calcPossibleSecurityContexts(
|
|
||||||
this._schemaRegistry, elementSelector, boundPropertyName, false);
|
|
||||||
bindingType = PropertyBindingType.Property;
|
|
||||||
this._validatePropertyOrAttributeName(boundPropertyName, boundProp.sourceSpan, false);
|
|
||||||
} else {
|
|
||||||
if (parts[0] == ATTRIBUTE_PREFIX) {
|
if (parts[0] == ATTRIBUTE_PREFIX) {
|
||||||
boundPropertyName = parts[1];
|
boundPropertyName = parts[1];
|
||||||
this._validatePropertyOrAttributeName(boundPropertyName, boundProp.sourceSpan, true);
|
this._validatePropertyOrAttributeName(boundPropertyName, boundProp.sourceSpan, true);
|
||||||
@ -280,12 +274,18 @@ export class BindingParser {
|
|||||||
boundPropertyName = parts[1];
|
boundPropertyName = parts[1];
|
||||||
bindingType = PropertyBindingType.Style;
|
bindingType = PropertyBindingType.Style;
|
||||||
securityContexts = [SecurityContext.STYLE];
|
securityContexts = [SecurityContext.STYLE];
|
||||||
} else {
|
|
||||||
this._reportError(`Invalid property name '${boundProp.name}'`, boundProp.sourceSpan);
|
|
||||||
bindingType = null;
|
|
||||||
securityContexts = [];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If not a special case, use the full property name
|
||||||
|
if (boundPropertyName === null) {
|
||||||
|
boundPropertyName = this._schemaRegistry.getMappedPropName(boundProp.name);
|
||||||
|
securityContexts = calcPossibleSecurityContexts(
|
||||||
|
this._schemaRegistry, elementSelector, boundPropertyName, false);
|
||||||
|
bindingType = PropertyBindingType.Property;
|
||||||
|
this._validatePropertyOrAttributeName(boundPropertyName, boundProp.sourceSpan, false);
|
||||||
|
}
|
||||||
|
|
||||||
return new BoundElementPropertyAst(
|
return new BoundElementPropertyAst(
|
||||||
boundPropertyName, bindingType, securityContexts.length === 1 ? securityContexts[0] : null,
|
boundPropertyName, bindingType, securityContexts.length === 1 ? securityContexts[0] : null,
|
||||||
securityContexts.length > 1, boundProp.expression, unit, boundProp.sourceSpan);
|
securityContexts.length > 1, boundProp.expression, unit, boundProp.sourceSpan);
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user