feat(ivy): support inputs & outputs with aliases in component decorators (#27350)
PR Close #27350
This commit is contained in:

committed by
Igor Minar

parent
1279a503a1
commit
2bc39860bb
@ -30,7 +30,7 @@ import {typeWithParameters} from '../util';
|
||||
import {R3ComponentDef, R3ComponentMetadata, R3DirectiveDef, R3DirectiveMetadata, R3QueryMetadata} from './api';
|
||||
import {StylingBuilder, StylingInstruction} from './styling';
|
||||
import {BindingScope, TemplateDefinitionBuilder, ValueConverter, renderFlagCheckIfStmt} from './template';
|
||||
import {CONTEXT_NAME, DefinitionMap, RENDER_FLAGS, TEMPORARY_NAME, asLiteral, conditionallyCreateMapObjectLiteral, getQueryPredicate, mapToExpression, temporaryAllocator} from './util';
|
||||
import {CONTEXT_NAME, DefinitionMap, RENDER_FLAGS, TEMPORARY_NAME, asLiteral, conditionallyCreateMapObjectLiteral, getQueryPredicate, temporaryAllocator} from './util';
|
||||
|
||||
const EMPTY_ARRAY: any[] = [];
|
||||
|
||||
@ -864,4 +864,4 @@ function parseNamedProperty(name: string): {propertyName: string, unit: string}
|
||||
}
|
||||
}
|
||||
return {propertyName, unit};
|
||||
}
|
||||
}
|
||||
|
@ -8,8 +8,8 @@
|
||||
|
||||
import {ConstantPool} from '../../constant_pool';
|
||||
import * as o from '../../output/output_ast';
|
||||
import {splitAtColon} from '../../util';
|
||||
import * as t from '../r3_ast';
|
||||
|
||||
import {R3QueryMetadata} from './api';
|
||||
import {isI18nAttribute} from './i18n/util';
|
||||
|
||||
@ -75,9 +75,13 @@ export function conditionallyCreateMapObjectLiteral(keys: {[key: string]: string
|
||||
return null;
|
||||
}
|
||||
|
||||
export function mapToExpression(map: {[key: string]: any}, quoted = false): o.Expression {
|
||||
return o.literalMap(
|
||||
Object.getOwnPropertyNames(map).map(key => ({key, quoted, value: asLiteral(map[key])})));
|
||||
function mapToExpression(map: {[key: string]: any}): o.Expression {
|
||||
return o.literalMap(Object.getOwnPropertyNames(map).map(key => {
|
||||
// canonical syntax: `dirProp: elProp`
|
||||
// if there is no `:`, use dirProp = elProp
|
||||
const parts = splitAtColon(key, [key, map[key]]);
|
||||
return {key: parts[0], quoted: false, value: asLiteral(parts[1])};
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user