mirror of
https://github.com/angular/angular.git
synced 2026-11-27 00:47:50 -05:00
This affects the dynamic version of `upgrade` and makes it more consistent with the static version, while removing an artificial limitation. This commit also refactors the file layout and code, in order to share code wrt to dowgrading components between the dynamic and static versions.
48 lines
1.3 KiB
TypeScript
48 lines
1.3 KiB
TypeScript
/**
|
|
* @license
|
|
* Copyright Google Inc. All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
* found in the LICENSE file at https://angular.io/license
|
|
*/
|
|
|
|
import {Type} from '@angular/core';
|
|
|
|
export interface ComponentInfo {
|
|
component: Type<any>;
|
|
inputs?: string[];
|
|
outputs?: string[];
|
|
}
|
|
|
|
/**
|
|
* A `PropertyBinding` represents a mapping between a property name
|
|
* and an attribute name. It is parsed from a string of the form
|
|
* `"prop: attr"`; or simply `"propAndAttr" where the property
|
|
* and attribute have the same identifier.
|
|
*/
|
|
export class PropertyBinding {
|
|
prop: string;
|
|
attr: string;
|
|
bracketAttr: string;
|
|
bracketParenAttr: string;
|
|
parenAttr: string;
|
|
onAttr: string;
|
|
bindAttr: string;
|
|
bindonAttr: string;
|
|
|
|
constructor(public binding: string) { this.parseBinding(); }
|
|
|
|
private parseBinding() {
|
|
const parts = this.binding.split(':');
|
|
this.prop = parts[0].trim();
|
|
this.attr = (parts[1] || this.prop).trim();
|
|
this.bracketAttr = `[${this.attr}]`;
|
|
this.parenAttr = `(${this.attr})`;
|
|
this.bracketParenAttr = `[(${this.attr})]`;
|
|
const capitalAttr = this.attr.charAt(0).toUpperCase() + this.attr.substr(1);
|
|
this.onAttr = `on${capitalAttr}`;
|
|
this.bindAttr = `bind${capitalAttr}`;
|
|
this.bindonAttr = `bindon${capitalAttr}`;
|
|
}
|
|
}
|