className property added cssClass deprecated

This commit is contained in:
Vladimir Enchev
2015-09-18 13:31:08 +03:00
parent 744de9670e
commit d39913b6e6
8 changed files with 61 additions and 28 deletions

View File

@@ -17,7 +17,7 @@ import observable = require("data/observable");
import {registerSpecialProperty} from "ui/builder/special-properties";
registerSpecialProperty("class", (instance: definition.View, propertyValue: string) => {
instance.cssClass = propertyValue;
instance.className = propertyValue;
});
export function isEventOrGesture(name: string, view: View): boolean {
@@ -112,7 +112,13 @@ var cssClassProperty = new dependencyObservable.Property(
"cssClass",
"View",
new proxy.PropertyMetadata(undefined, dependencyObservable.PropertyMetadataSettings.AffectsStyle, onCssClassPropertyChanged)
);
);
var classNameProperty = new dependencyObservable.Property(
"className",
"View",
new proxy.PropertyMetadata(undefined, dependencyObservable.PropertyMetadataSettings.AffectsStyle, onCssClassPropertyChanged)
);
var translateXProperty = new dependencyObservable.Property(
"translateX",
@@ -162,6 +168,7 @@ export class View extends proxy.ProxyObject implements definition.View {
public static idProperty = idProperty;
public static cssClassProperty = cssClassProperty;
public static classNameProperty = classNameProperty;
public static translateXProperty = translateXProperty;
public static translateYProperty = translateYProperty;
public static scaleXProperty = scaleXProperty;
@@ -496,6 +503,13 @@ export class View extends proxy.ProxyObject implements definition.View {
this._setValue(View.cssClassProperty, value);
}
get className(): string {
return this._getValue(View.cssClassProperty);
}
set className(value: string) {
this._setValue(View.cssClassProperty, value);
}
get style(): style.Style {
return this._style;
}

21
ui/core/view.d.ts vendored
View File

@@ -84,9 +84,14 @@ declare module "ui/core/view" {
*/
visibility?: string;
/**
* Gets or sets the CSS class of this view.
* [Deprecated. Please use className instead] Gets or sets the CSS class of this view.
*/
cssClass?: string;
/**
* Gets or sets the CSS class name of this view.
*/
className?: string;
/**
* Gets or sets the id of this view.
*/
@@ -129,10 +134,15 @@ declare module "ui/core/view" {
public static idProperty: dependencyObservable.Property;
/**
* Represents the observable property backing the cssClass property of each View.
* [Deprecated. Please use className instead.] Represents the observable property backing the cssClass property of each View.
*/
public static cssClassProperty: dependencyObservable.Property;
/**
* Represents the observable property backing the className property of each View.
*/
public static classNameProperty: dependencyObservable.Property;
/**
* Represents the observable property backing the isEnabled property of each View.
*/
@@ -270,10 +280,15 @@ declare module "ui/core/view" {
id: string;
/**
* Gets or sets the CSS class for this view.
* [Deprecated. Please use className instead.] Gets or sets the CSS class for this view.
*/
cssClass: string;
/**
* Gets or sets the CSS class name for this view.
*/
className: string;
/**
* Gets the style object associated to this view.
*/