mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
restore properties deleted with merge
This commit is contained in:
committed by
Hristo Hristov
parent
befb494a50
commit
07e2102c5d
@@ -16,6 +16,9 @@ export abstract class EditableTextBase extends TextBase implements EditableTextB
|
||||
public abstract dismissSoftInput();
|
||||
}
|
||||
|
||||
// TODO: Why not name it - hintColor property??
|
||||
// TODO: Or rename hintProperty to 'placeholder' and make it CSSProperty??
|
||||
// https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-placeholder
|
||||
export const placeholderColorProperty = new CssProperty<Style, Color>({ name: "placeholderColor", cssName: "placeholder-color", equalityComparer: Color.equals, valueConverter: (v) => new Color(v) });
|
||||
placeholderColorProperty.register(Style);
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
EditableTextBase as EditableTextBaseCommon, keyboardTypeProperty,
|
||||
returnKeyTypeProperty, editableProperty, updateTextTriggerProperty,
|
||||
autocapitalizationTypeProperty, autocorrectProperty, hintProperty,
|
||||
textProperty
|
||||
textProperty, placeholderColorProperty
|
||||
} from "./editable-text-base-common";
|
||||
|
||||
import { ad } from "utils/utils";
|
||||
@@ -418,4 +418,15 @@ export abstract class EditableTextBase extends EditableTextBaseCommon {
|
||||
set [hintProperty.native](value: string) {
|
||||
this.nativeView.setHint(value + '');
|
||||
}
|
||||
|
||||
get [placeholderColorProperty.native](): android.content.res.ColorStateList {
|
||||
return this.nativeView.getHintTextColors();
|
||||
}
|
||||
set [placeholderColorProperty.native](value: Color | android.content.res.ColorStateList) {
|
||||
if (value instanceof Color) {
|
||||
this.nativeView.setHintTextColor(value.android);
|
||||
} else {
|
||||
this.nativeView.setHintTextColor(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ListView as ListViewDefinition, ItemsSource } from "ui/list-view";
|
||||
import { Bindable, EventData, Observable, View, Template, KeyedTemplate, Length, layout, Property, Color, lengthComparer } from "ui/core/view";
|
||||
import { CoercibleProperty, CssProperty, Style, Bindable, EventData, Observable, View, Template, KeyedTemplate, Length, layout, Property, Color, lengthComparer } from "ui/core/view";
|
||||
import { parse, parseMultipleTemplates } from "ui/builder";
|
||||
import { Label } from "ui/label";
|
||||
import { ObservableArray, ChangedData } from "data/observable-array";
|
||||
@@ -47,7 +47,7 @@ export abstract class ListViewBase extends View implements ListViewDefinition {
|
||||
}
|
||||
|
||||
public _itemTemplatesInternal = new Array<KeyedTemplate>(this._defaultTemplate);
|
||||
public _effectiveRowHeight: number;
|
||||
public _effectiveRowHeight: number = -1;
|
||||
public rowHeight: Length;
|
||||
public separatorColor: Color;
|
||||
public items: any[] | ItemsSource;
|
||||
@@ -129,7 +129,7 @@ export abstract class ListViewBase extends View implements ListViewDefinition {
|
||||
}
|
||||
|
||||
protected updateEffectiveRowHeight(): void {
|
||||
this._effectiveRowHeight = getLengthEffectiveValue(this.rowHeight);
|
||||
rowHeightProperty.coerce(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,20 +175,22 @@ export const itemTemplatesProperty = new Property<ListViewBase, string | Array<K
|
||||
})
|
||||
itemTemplatesProperty.register(ListViewBase);
|
||||
|
||||
/**
|
||||
* Represents the separator color backing property.
|
||||
*/
|
||||
export const separatorColor = new Property<ListViewBase, Color>({ name: "separatorColor", equalityComparer: Color.equals, valueConverter: (value) => new Color(value) });
|
||||
separatorColor.register(ListViewBase);
|
||||
|
||||
const defaultRowHeight: Length = { value: -1, unit: "px" };
|
||||
/**
|
||||
* Represents the observable property backing the rowHeight property of each ListView instance.
|
||||
*/
|
||||
export const rowHeightProperty = new Property<ListViewBase, Length>({
|
||||
name: "rowHeight", defaultValue: { value: -1, unit: "px" }, equalityComparer: lengthComparer,
|
||||
export const rowHeightProperty = new CoercibleProperty<ListViewBase, Length>({
|
||||
name: "rowHeight", defaultValue: defaultRowHeight, equalityComparer: lengthComparer,
|
||||
coerceValue: (target, value) => {
|
||||
// We coerce to default value if we don't have display density.
|
||||
return target._nativeView ? value : defaultRowHeight;
|
||||
},
|
||||
valueChanged: (target, oldValue, newValue) => {
|
||||
target._effectiveRowHeight = getLengthEffectiveValue(newValue);
|
||||
target._onRowHeightPropertyChanged(oldValue, newValue);
|
||||
}, valueConverter: Length.parse
|
||||
});
|
||||
rowHeightProperty.register(ListViewBase);
|
||||
|
||||
export const separatorColorProperty = new CssProperty<Style, Color>({ name: "separatorColor", cssName: "separator-color", equalityComparer: Color.equals, valueConverter: (v) => new Color(v) });
|
||||
separatorColorProperty.register(Style);
|
||||
@@ -34,12 +34,11 @@ export class ListView extends ListViewBase {
|
||||
private _itemClickListener: android.widget.AdapterView.OnItemClickListener;
|
||||
public _realizedItems = new Map<android.view.View, View>();
|
||||
public _realizedTemplates = new Map<string, Map<android.view.View, View>>();
|
||||
public _effectiveRowHeight: number;
|
||||
|
||||
public _createUI() {
|
||||
this.updateEffectiveRowHeight();
|
||||
this._android = new android.widget.ListView(this._context);
|
||||
this._android.setDescendantFocusability(android.view.ViewGroup.FOCUS_AFTER_DESCENDANTS);
|
||||
this.updateEffectiveRowHeight();
|
||||
|
||||
// Fixes issue with black random black items when scrolling
|
||||
this._android.setCacheColorHint(android.graphics.Color.TRANSPARENT);
|
||||
|
||||
@@ -71,7 +71,7 @@ class DataSource extends NSObject implements UITableViewDataSource {
|
||||
// Arrange cell views. We do it here instead of _layoutCell because _layoutCell is called
|
||||
// from 'tableViewHeightForRowAtIndexPath' method too (in iOS 7.1) and we don't want to arrange the fake cell.
|
||||
let width = layout.getMeasureSpecSize(owner.widthMeasureSpec);
|
||||
let rowHeight = owner._nativeView.rowHeight;
|
||||
let rowHeight = owner._effectiveRowHeight;
|
||||
let cellHeight = rowHeight > 0 ? rowHeight : owner.getHeight(indexPath.row);
|
||||
View.layoutChild(owner, cellView, 0, 0, width, cellHeight);
|
||||
}
|
||||
@@ -91,22 +91,22 @@ class UITableViewDelegateImpl extends NSObject implements UITableViewDelegate {
|
||||
private _measureCellMap: Map<string, ListViewCell>;
|
||||
|
||||
public static initWithOwner(owner: WeakRef<ListView>): UITableViewDelegateImpl {
|
||||
let delegate = <UITableViewDelegateImpl>UITableViewDelegateImpl.new();
|
||||
const delegate = <UITableViewDelegateImpl>UITableViewDelegateImpl.new();
|
||||
delegate._owner = owner;
|
||||
delegate._measureCellMap = new Map<string, ListViewCell>();
|
||||
return delegate;
|
||||
}
|
||||
|
||||
public tableViewWillDisplayCellForRowAtIndexPath(tableView: UITableView, cell: UITableViewCell, indexPath: NSIndexPath) {
|
||||
let owner = this._owner.get();
|
||||
const owner = this._owner.get();
|
||||
if (owner && (indexPath.row === owner.items.length - 1)) {
|
||||
owner.notify(<EventData>{ eventName: LOADMOREITEMS, object: owner });
|
||||
}
|
||||
}
|
||||
|
||||
public tableViewWillSelectRowAtIndexPath(tableView: UITableView, indexPath: NSIndexPath): NSIndexPath {
|
||||
let cell = <ListViewCell>tableView.cellForRowAtIndexPath(indexPath);
|
||||
let owner = this._owner.get();
|
||||
const cell = <ListViewCell>tableView.cellForRowAtIndexPath(indexPath);
|
||||
const owner = this._owner.get();
|
||||
if (owner) {
|
||||
notifyForItemAtIndex(owner, cell, cell.view, ITEMTAP, indexPath);
|
||||
}
|
||||
@@ -120,19 +120,19 @@ class UITableViewDelegateImpl extends NSObject implements UITableViewDelegate {
|
||||
}
|
||||
|
||||
public tableViewHeightForRowAtIndexPath(tableView: UITableView, indexPath: NSIndexPath): number {
|
||||
let owner = this._owner.get();
|
||||
const owner = this._owner.get();
|
||||
if (!owner) {
|
||||
return DEFAULT_HEIGHT;
|
||||
}
|
||||
|
||||
let height = undefined;
|
||||
let height: number;
|
||||
if (ios.MajorVersion >= 8) {
|
||||
height = owner.getHeight(indexPath.row);
|
||||
}
|
||||
|
||||
if (ios.MajorVersion < 8 || height === undefined) {
|
||||
// in iOS 7.1 (or iOS8+ after call to scrollToRowAtIndexPath:atScrollPosition:animated:) this method is called before tableViewCellForRowAtIndexPath so we need fake cell to measure its content.
|
||||
let template = owner._getItemTemplate(indexPath.row);
|
||||
const template = owner._getItemTemplate(indexPath.row);
|
||||
let cell = this._measureCellMap.get(template.key);
|
||||
if (!cell) {
|
||||
cell = (<any>tableView.dequeueReusableCellWithIdentifier(template.key)) || ListViewCell.new();
|
||||
@@ -184,7 +184,7 @@ class UITableViewRowHeightDelegateImpl extends NSObject implements UITableViewDe
|
||||
}
|
||||
|
||||
export class ListView extends ListViewBase {
|
||||
private _ios: UITableView;
|
||||
public _ios: UITableView;
|
||||
private _dataSource;
|
||||
private _delegate;
|
||||
private _heights: Array<number>;
|
||||
@@ -266,8 +266,8 @@ export class ListView extends ListViewBase {
|
||||
}
|
||||
|
||||
public _onRowHeightPropertyChanged(oldValue: Length, newValue: Length) {
|
||||
let value = this._effectiveRowHeight;
|
||||
let nativeView = this._ios;
|
||||
const value = this._effectiveRowHeight;
|
||||
const nativeView = this._ios;
|
||||
if (value < 0) {
|
||||
nativeView.rowHeight = UITableViewAutomaticDimension;
|
||||
nativeView.estimatedRowHeight = DEFAULT_HEIGHT;
|
||||
@@ -304,9 +304,10 @@ export class ListView extends ListViewBase {
|
||||
|
||||
private _layoutCell(cellView: View, indexPath: NSIndexPath): number {
|
||||
if (cellView) {
|
||||
let rowHeight = this._effectiveRowHeight;
|
||||
let measuredSize = View.measureChild(this, cellView, this.widthMeasureSpec, rowHeight >= 0 ? rowHeight : infinity);
|
||||
let height = measuredSize.measuredHeight;
|
||||
const rowHeight = this._effectiveRowHeight;
|
||||
const heightMeasureSpec: number = rowHeight >= 0 ? layout.makeMeasureSpec(rowHeight, layout.EXACTLY) : infinity;
|
||||
const measuredSize = View.measureChild(this, cellView, this.widthMeasureSpec, heightMeasureSpec);
|
||||
const height = measuredSize.measuredHeight;
|
||||
this.setHeight(indexPath.row, height);
|
||||
return height;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { SegmentedBar as SegmentedBarDefinition, SegmentedBarItem as SegmentedBarItemDefinition, SelectedIndexChangedEventData } from "ui/segmented-bar";
|
||||
import {
|
||||
ViewBase, View, AddChildFromBuilder, AddArrayFromBuilder,
|
||||
Property, CoercibleProperty, EventData, Color
|
||||
Property, CoercibleProperty, CssProperty, EventData, Color, Style
|
||||
} from "ui/core/view";
|
||||
|
||||
export * from "ui/core/view";
|
||||
@@ -49,17 +49,6 @@ export abstract class SegmentedBarBase extends View implements SegmentedBarDefin
|
||||
}
|
||||
}
|
||||
|
||||
// public _onBindingContextChanged(oldValue: any, newValue: any) {
|
||||
// super._onBindingContextChanged(oldValue, newValue);
|
||||
// if (this.items && this.items.length > 0) {
|
||||
// var i = 0;
|
||||
// var length = this.items.length;
|
||||
// for (; i < length; i++) {
|
||||
// this.items[i].bindingContext = newValue;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
public onItemsChanged(oldItems: SegmentedBarItemDefinition[], newItems: SegmentedBarItemDefinition[]): void {
|
||||
if (oldItems) {
|
||||
for (let i = 0, count = oldItems.length; i < count; i++) {
|
||||
@@ -73,6 +62,15 @@ export abstract class SegmentedBarBase extends View implements SegmentedBarDefin
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Make _addView to keep its children so this method is not needed!
|
||||
public _eachChildView(callback: (child: ViewBase) => boolean): void {
|
||||
let items = this.items;
|
||||
if (items) {
|
||||
items.forEach((item, i) => {
|
||||
callback(item);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -101,8 +99,8 @@ selectedIndexProperty.register(SegmentedBarBase);
|
||||
/**
|
||||
* Gets or sets the selected background color property of the SegmentedBar.
|
||||
*/
|
||||
export const selectedBackgroundColorProperty = new Property<SegmentedBarBase, Color>({ name: "selectedBackgroundColor", equalityComparer: Color.equals, valueConverter: (v) => new Color(v) })
|
||||
selectedBackgroundColorProperty.register(SegmentedBarBase);
|
||||
export const selectedBackgroundColorProperty = new CssProperty<Style, Color>({ name: "selectedBackgroundColor", cssName: "selected-background-color", equalityComparer: Color.equals, valueConverter: (v) => new Color(v) })
|
||||
selectedBackgroundColorProperty.register(Style);
|
||||
|
||||
/**
|
||||
* Gets or sets the items dependency property of the SegmentedBar.
|
||||
|
||||
@@ -9,12 +9,6 @@ const R_ID_TABS = 0x01020013;
|
||||
const R_ID_TABCONTENT = 0x01020011;
|
||||
const R_ATTR_STATE_SELECTED = 0x010100a1;
|
||||
|
||||
// TODO: Make SegmentedBarItem inherit from ViewBase and use ._addView.
|
||||
// TODO: Move colorProperty.native get/set from SegmentedBar to SegmentedBarItem.
|
||||
// TODO: Fix selectedIndex coerce implementation.
|
||||
// TODO: Use addView instead of _parent property. This way
|
||||
// bindingContext and style propagation will work out fo the box.
|
||||
|
||||
let apiLevel: number;
|
||||
// TODO: Move this into widgets.
|
||||
let SegmentedBarColorDrawableClass;
|
||||
@@ -75,7 +69,9 @@ export class SegmentedBarItem extends SegmentedBarItemBase {
|
||||
|
||||
let tv = this._nativeView;
|
||||
if (tv) {
|
||||
tv.setText(this.title || "");
|
||||
let title = this.title;
|
||||
title = (title === null || title === undefined) ? "" : title;
|
||||
tv.setText(title);
|
||||
this.titleDirty = false;
|
||||
} else {
|
||||
this.titleDirty = true;
|
||||
@@ -188,10 +184,7 @@ export class SegmentedBar extends SegmentedBarBase {
|
||||
|
||||
let weakRef = new WeakRef(this);
|
||||
this._android = new TabHostClass(this._context, null);
|
||||
// We don't have native tabs here.
|
||||
// if (typeof this.selectedIndex === "number" && this._android.getCurrentTab() !== this.selectedIndex) {
|
||||
// this._android.setCurrentTab(this.selectedIndex);
|
||||
// }
|
||||
|
||||
this.listener = this.listener || new TabChangeListener(weakRef);
|
||||
this.tabContentFactory = this.tabContentFactory || new TabContentFactory(weakRef);
|
||||
|
||||
@@ -215,7 +208,7 @@ export class SegmentedBar extends SegmentedBarBase {
|
||||
return this._android;
|
||||
}
|
||||
|
||||
public insertTab(tabItem: SegmentedBarItem, index: number): void {
|
||||
private insertTab(tabItem: SegmentedBarItem, index: number): void {
|
||||
const tab = this.android.newTabSpec(index + "");
|
||||
tab.setIndicator(tabItem.title);
|
||||
tab.setContent(this.tabContentFactory);
|
||||
@@ -224,7 +217,7 @@ export class SegmentedBar extends SegmentedBarBase {
|
||||
tabHost.addTab(tab);
|
||||
|
||||
// TODO: Why do we need to call this for every added tab?
|
||||
this.resetNativeListener();
|
||||
// this.resetNativeListener();
|
||||
}
|
||||
|
||||
private resetNativeListener() {
|
||||
@@ -247,10 +240,8 @@ export class SegmentedBar extends SegmentedBarBase {
|
||||
|
||||
const newItems = value;
|
||||
let tabHost = this._android;
|
||||
if (newItems && newItems.length) {
|
||||
for (let i = 0; i < newItems.length; i++) {
|
||||
this.insertTab(newItems[i], i);
|
||||
}
|
||||
if (newItems) {
|
||||
newItems.forEach((item, i,arr) => this.insertTab(item, i));
|
||||
|
||||
if (this.selectedIndex < 0) {
|
||||
this.selectedIndex = tabHost.getCurrentTab();
|
||||
|
||||
@@ -11,7 +11,9 @@ export class SegmentedBarItem extends SegmentedBarItemBase {
|
||||
public _update() {
|
||||
if (this._parent) {
|
||||
let tabIndex = this._parent.items.indexOf(this);
|
||||
this._parent.ios.setTitleForSegmentAtIndex(this.title || "", tabIndex);
|
||||
let title = this.title;
|
||||
title = (title === null || title === undefined) ? "" : title;
|
||||
this._parent.ios.setTitleForSegmentAtIndex(title, tabIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,50 +34,34 @@ export class SegmentedBar extends SegmentedBarBase {
|
||||
return this._ios;
|
||||
}
|
||||
|
||||
public insertTab(tabItem: SegmentedBarItem, index: number): void {
|
||||
tabItem._parent = this;
|
||||
this.ios.insertSegmentWithTitleAtIndexAnimated(tabItem.title, index, false);
|
||||
private insertTab(tabItem: SegmentedBarItem, index: number): void {
|
||||
|
||||
}
|
||||
|
||||
get [selectedIndexProperty.native](): number {
|
||||
return -1;
|
||||
}
|
||||
set [selectedIndexProperty.native](value: number) {
|
||||
let items = this.items;
|
||||
if (!items) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (value >= 0 && value <= (items.length - 1)) {
|
||||
this._ios.selectedSegmentIndex = value;
|
||||
this.notify({ eventName: SegmentedBar.selectedIndexChangedEvent, object: this, oldIndex: this.previousSelectedIndex, newIndex: value });
|
||||
}
|
||||
this._ios.selectedSegmentIndex = value;
|
||||
}
|
||||
|
||||
private previousItems: SegmentedBarItem[];
|
||||
get [itemsProperty.native](): SegmentedBarItem[] {
|
||||
return null;
|
||||
}
|
||||
set [itemsProperty.native](value: SegmentedBarItem[]) {
|
||||
const oldItems = this.previousItems;
|
||||
if (oldItems) {
|
||||
for (let i = 0, length = oldItems.length; i < length; i++) {
|
||||
oldItems[i]._parent = null;
|
||||
}
|
||||
}
|
||||
|
||||
let segmentedControl = this._ios;
|
||||
const segmentedControl = this._ios;
|
||||
segmentedControl.removeAllSegments();
|
||||
const newItems = value;
|
||||
this._adjustSelectedIndex(newItems);
|
||||
|
||||
if (newItems && newItems.length) {
|
||||
for (let i = 0; i < newItems.length; i++) {
|
||||
this.insertTab(newItems[i], i);
|
||||
}
|
||||
newItems.forEach((item, index, arr) => {
|
||||
let title = item.title;
|
||||
title = (title === null || title === undefined) ? "" : title;
|
||||
segmentedControl.insertSegmentWithTitleAtIndexAnimated(title, index, false);
|
||||
})
|
||||
|
||||
if (segmentedControl.selectedSegmentIndex !== this.selectedIndex) {
|
||||
segmentedControl.selectedSegmentIndex = this.selectedIndex;
|
||||
if (this.selectedIndex < 0) {
|
||||
this.selectedIndex = segmentedControl.selectedSegmentIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Slider as SliderDefinition } from "ui/slider";
|
||||
import { View, Property } from "ui/core/view";
|
||||
import { View, Property, CoercibleProperty, isIOS } from "ui/core/view";
|
||||
|
||||
export * from "ui/core/view";
|
||||
|
||||
@@ -13,13 +13,12 @@ export class SliderBase extends View implements SliderDefinition {
|
||||
/**
|
||||
* Represents the observable property backing the value property of each Slider instance.
|
||||
*/
|
||||
export const valueProperty = new Property<SliderBase, number>({
|
||||
name: "value", defaultValue: 0, valueChanged: (target, oldValue, newValue) => {
|
||||
newValue = Math.max(newValue, this.minValue);
|
||||
newValue = Math.min(newValue, this.maxValue);
|
||||
|
||||
target.value = newValue;
|
||||
}
|
||||
export const valueProperty = new CoercibleProperty<SliderBase, number>({
|
||||
name: "value", defaultValue: 0, coerceValue: (target, value) => {
|
||||
value = Math.max(value, this.minValue);
|
||||
value = Math.min(value, this.maxValue);
|
||||
return value;
|
||||
}, valueConverter: (v) => isIOS ? parseFloat(v) : parseInt(v)
|
||||
});
|
||||
valueProperty.register(SliderBase);
|
||||
|
||||
@@ -28,29 +27,25 @@ valueProperty.register(SliderBase);
|
||||
*/
|
||||
export const minValueProperty = new Property<SliderBase, number>({
|
||||
name: "minValue", defaultValue: 0, valueChanged: (target, oldValue, newValue) => {
|
||||
if (newValue > target.maxValue) {
|
||||
target.maxValue = newValue;
|
||||
}
|
||||
|
||||
if (newValue > target.value) {
|
||||
target.value = newValue;
|
||||
}
|
||||
}
|
||||
maxValueProperty.coerce(target);
|
||||
valueProperty.coerce(target);
|
||||
}, valueConverter: (v) => isIOS ? parseFloat(v) : parseInt(v)
|
||||
});
|
||||
minValueProperty.register(SliderBase);
|
||||
|
||||
/**
|
||||
* Represents the observable property backing the maxValue property of each Slider instance.
|
||||
*/
|
||||
export const maxValueProperty = new Property<SliderBase, number>({
|
||||
name: "maxValue", defaultValue: 100, valueChanged: (target, oldValue, newValue) => {
|
||||
if (newValue < target.minValue) {
|
||||
target.minValue = newValue;
|
||||
export const maxValueProperty = new CoercibleProperty<SliderBase, number>({
|
||||
name: "maxValue", defaultValue: 100, coerceValue: (target, value) => {
|
||||
let minValue = target.minValue;
|
||||
if (value < minValue) {
|
||||
value = minValue;
|
||||
}
|
||||
|
||||
if (newValue < target.value) {
|
||||
target.value = newValue;
|
||||
}
|
||||
}
|
||||
return value;
|
||||
},
|
||||
valueChanged: (target, oldValue, newValue) => valueProperty.coerce(target),
|
||||
valueConverter: (v) => isIOS ? parseFloat(v) : parseInt(v)
|
||||
});
|
||||
maxValueProperty.register(SliderBase);
|
||||
6
tns-core-modules/ui/slider/slider.d.ts
vendored
6
tns-core-modules/ui/slider/slider.d.ts
vendored
@@ -2,7 +2,7 @@
|
||||
* Contains the Slider class, which represents a standard slider component.
|
||||
*/
|
||||
declare module "ui/slider" {
|
||||
import { View, Property } from "ui/core/view";
|
||||
import { View, CoercibleProperty } from "ui/core/view";
|
||||
|
||||
/**
|
||||
* Represents a slider component.
|
||||
@@ -42,10 +42,10 @@ declare module "ui/slider" {
|
||||
/**
|
||||
* Represents the observable property backing the minValue property of each Slider instance.
|
||||
*/
|
||||
export const minValueProperty: Property<Slider, number>;
|
||||
export const minValueProperty: CoercibleProperty<Slider, number>;
|
||||
|
||||
/**
|
||||
* Represents the observable property backing the maxValue property of each Slider instance.
|
||||
*/
|
||||
export const maxValueProperty: Property<Slider, number>;
|
||||
export const maxValueProperty: CoercibleProperty<Slider, number>;
|
||||
}
|
||||
7
tns-core-modules/ui/styling/style.d.ts
vendored
7
tns-core-modules/ui/styling/style.d.ts
vendored
@@ -113,9 +113,16 @@ declare module "ui/styling/style" {
|
||||
public selectedTabTextColor: Color;
|
||||
public androidSelectedTabHighlightColor: Color;
|
||||
|
||||
// ListView-specific props
|
||||
public separatorColor: Color;
|
||||
|
||||
//SegmentedBar-specific props
|
||||
public selectedBackgroundColor: Color;
|
||||
|
||||
// Page-specific props
|
||||
public statusBarStyle: string;
|
||||
public androidStatusBarBackground: Color;
|
||||
|
||||
constructor(ownerView: ViewBase);
|
||||
public view: ViewBase;
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { Style as StyleDefinition } from "ui/styling/style";
|
||||
import { Length, PercentLength, Color, Background, Font, ViewBase } from "ui/core/view";
|
||||
import { Observable } from "data/observable";
|
||||
import { Length, PercentLength, Color, Background, Font, ViewBase, Observable } from "ui/core/view";
|
||||
|
||||
export class Style extends Observable implements StyleDefinition {
|
||||
constructor(public view: ViewBase) {
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import { TabView as TabViewDefinition, TabViewItem as TabViewItemDefinition } from "ui/tab-view";
|
||||
import { View, Bindable, Property, CoercibleProperty, EventData, Color, isIOS, AddArrayFromBuilder } from "ui/core/view";
|
||||
import {
|
||||
View, Style, Bindable, Property, CssProperty, CoercibleProperty,
|
||||
EventData, Color, isIOS, AddArrayFromBuilder
|
||||
} from "ui/core/view";
|
||||
|
||||
export * from "ui/core/view";
|
||||
export * from "ui/core/view";
|
||||
|
||||
export const traceCategory = "TabView";
|
||||
|
||||
@@ -154,11 +157,11 @@ export const itemsProperty = new Property<TabViewBase, TabViewItemBase[]>({
|
||||
itemsProperty.register(TabViewBase);
|
||||
|
||||
export const selectedIndexProperty = new CoercibleProperty<TabViewBase, number>({
|
||||
name: "selectedIndex", defaultValue: -1, affectsLayout: isIOS,
|
||||
name: "selectedIndex", defaultValue: -1, affectsLayout: isIOS,
|
||||
valueChanged: (target, oldValue, newValue) => {
|
||||
let args = { eventName: TabViewBase.selectedIndexChangedEvent, object: this, oldIndex: oldValue, newIndex: newValue };
|
||||
target.notify(args);
|
||||
},
|
||||
},
|
||||
coerceValue: (target, value) => {
|
||||
let items = target.items;
|
||||
if (items) {
|
||||
@@ -176,8 +179,14 @@ export const selectedIndexProperty = new CoercibleProperty<TabViewBase, number>(
|
||||
});
|
||||
selectedIndexProperty.register(TabViewBase);
|
||||
|
||||
export const selectedColorProperty = new Property<TabViewBase, Color>({ name: "selectedColor", equalityComparer: Color.equals, valueConverter: (v) => new Color(v) });
|
||||
selectedColorProperty.register(TabViewBase);
|
||||
export const tabTextColorProperty = new CssProperty<Style, Color>({ name: "tabTextColor", cssName: "tab-text-color", equalityComparer: Color.equals, valueConverter: (v) => new Color(v) });
|
||||
tabTextColorProperty.register(Style);
|
||||
|
||||
export const tabsBackgroundColorProperty = new Property<TabViewBase, Color>({ name: "tabsBackgroundColor", equalityComparer: Color.equals, valueConverter: (v) => new Color(v) });
|
||||
tabsBackgroundColorProperty.register(TabViewBase);
|
||||
export const tabBackgroundColorProperty = new CssProperty<Style, Color>({ name: "tabBackgroundColor", cssName: "tab-background-color", equalityComparer: Color.equals, valueConverter: (v) => new Color(v) });
|
||||
tabBackgroundColorProperty.register(Style);
|
||||
|
||||
export const selectedTabTextColorProperty = new CssProperty<Style, Color>({ name: "selectedTabTextColor", cssName: "selected-tab-text-color", equalityComparer: Color.equals, valueConverter: (v) => new Color(v) });
|
||||
selectedTabTextColorProperty.register(Style);
|
||||
|
||||
export const androidSelectedTabHighlightColorProperty = new CssProperty<Style, Color>({ name: "androidSelectedTabHighlightColor", cssName: "android-selected-tab-highlight-color", equalityComparer: Color.equals, valueConverter: (v) => new Color(v) });
|
||||
androidSelectedTabHighlightColorProperty.register(Style);
|
||||
@@ -423,9 +423,6 @@ export class TabView extends TabViewBase {
|
||||
if (value > -1) {
|
||||
this._ios.selectedIndex = value;
|
||||
}
|
||||
|
||||
// We will need to measure and arrange what became this._selectedView
|
||||
this.requestLayout();
|
||||
}
|
||||
|
||||
get [itemsProperty.native](): TabViewItemBase[] {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import {
|
||||
TextBaseCommon, textProperty, formattedTextProperty, textAlignmentProperty, textDecorationProperty,
|
||||
textTransformProperty, letterSpacingProperty, colorProperty, fontInternalProperty, whiteSpaceProperty, Font, Color, FormattedString
|
||||
textTransformProperty, letterSpacingProperty, colorProperty, fontInternalProperty, whiteSpaceProperty,
|
||||
Font, Color, FormattedString
|
||||
} from "./text-base-common";
|
||||
|
||||
export * from "./text-base-common";
|
||||
@@ -94,13 +95,15 @@ export class TextBase extends TextBaseCommon {
|
||||
this._setFormattedTextPropertyToNative(value);
|
||||
}
|
||||
|
||||
get [colorProperty.native](): number {
|
||||
// .getTextColors().getDefaultColor();
|
||||
return this.nativeView.getCurrentTextColor();
|
||||
get [colorProperty.native](): android.content.res.ColorStateList {
|
||||
return this.nativeView.getTextColors();
|
||||
}
|
||||
set [colorProperty.native](value: number | Color) {
|
||||
let color = value instanceof Color ? value.android : value;
|
||||
this.nativeView.setTextColor(color);
|
||||
set [colorProperty.native](value: Color | android.content.res.ColorStateList) {
|
||||
if (value instanceof Color) {
|
||||
this.nativeView.setTextColor(value.android);
|
||||
} else {
|
||||
this.nativeView.setTextColor(value);
|
||||
}
|
||||
}
|
||||
|
||||
get [fontInternalProperty.native](): { typeface: android.graphics.Typeface, fontSize: number } {
|
||||
|
||||
@@ -130,12 +130,12 @@ export class TextField extends TextFieldBase {
|
||||
this._delegate = UITextFieldDelegateImpl.initWithOwner(weakRef);
|
||||
}
|
||||
|
||||
public onLoaded() {
|
||||
protected onLoaded() {
|
||||
super.onLoaded();
|
||||
this._ios.delegate = this._delegate;
|
||||
}
|
||||
|
||||
public onUnloaded() {
|
||||
protected onUnloaded() {
|
||||
this._ios.delegate = null;
|
||||
super.onUnloaded();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user