Skip to content

Commit 7674098

Browse files
committed
renaming properties in value item
1 parent 2391c95 commit 7674098

9 files changed

+17
-20
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,8 @@ Then you can set the `items` property of the DropDown to an instance of ValueLis
194194
```TypeScript
195195
let dd = page.getViewById<DropDown>("dd");
196196
let itemSource = new ValueList<string>([
197-
{ ValueMember: "FL", DisplayMember:"Florida" },
198-
{ ValueMember: "MI", DisplayMember:"Michigan" }
197+
{ value: "FL", display: "Florida" },
198+
{ value: "MI", display: "Michigan" }
199199
]);
200200
dd.items = itemSource;
201201
```

demo-ng/app/dropdown/dropdown.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export class DropDownComponent implements OnInit {
1515
public ngOnInit() {
1616
this.items = new ValueList<string>();
1717
for (let loop = 0; loop < 200; loop++) {
18-
this.items.push({ ValueMember: `I${loop}`, DisplayMember: `Item ${loop}`});
18+
this.items.push({ value: `I${loop}`, display: `Item ${loop}`});
1919
}
2020
}
2121

demo/app/main-page.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export function pageLoaded(args: EventData) {
1919
page.bindingContext = viewModel;
2020

2121
for (let loop = 0; loop < 200; loop++) {
22-
items.push({ ValueMember: `I${loop}`, DisplayMember: `Item ${loop}`});
22+
items.push({ value: `I${loop}`, display: `Item ${loop}`});
2323
}
2424
}
2525

drop-down-common.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export abstract class DropDownBase extends View implements DropDownDefinition {
4646
}
4747

4848
if (this.isValueListIn) {
49-
return (items as ValueList<any>).getText(index);
49+
return (items as ValueList<any>).getDisplay(index);
5050
}
5151

5252
const item = this.isItemsSourceIn ? (this.items as ItemsSource).getItem(index) : this.items[index];
@@ -57,7 +57,7 @@ export abstract class DropDownBase extends View implements DropDownDefinition {
5757
export class ValueList<T> extends ObservableArray<ValueItem<T>> implements ValueListDefinition<T> {
5858
private _array: Array<ValueItem<T>>;
5959

60-
public getText(index: number): string {
60+
public getDisplay(index: number): string {
6161
if (types.isNullOrUndefined(index)) {
6262
return null;
6363
}
@@ -66,15 +66,15 @@ export class ValueList<T> extends ObservableArray<ValueItem<T>> implements Value
6666
return "";
6767
}
6868

69-
return this._array[index].DisplayMember;
69+
return this._array[index].display;
7070
}
7171

7272
public getValue(index: number): T {
7373
if (types.isNullOrUndefined(index) || index < 0 || index >= this.length) {
7474
return null;
7575
}
7676

77-
return this._array[index].ValueMember;
77+
return this._array[index].value;
7878
}
7979

8080
public getIndex(value: T): number {
@@ -124,10 +124,10 @@ export const itemsProperty = new Property<DropDownBase, any[] | ItemsSource>({
124124
name: "items",
125125
valueChanged: (target, oldValue, newValue) => {
126126
const getItem = newValue && (newValue as ItemsSource).getItem;
127-
const getText = newValue && (newValue as ValueList<any>).getText;
127+
const getDisplay = newValue && (newValue as ValueList<any>).getDisplay;
128128

129129
target.isItemsSourceIn = typeof getItem === "function";
130-
target.isValueListIn = typeof getText === "function";
130+
target.isValueListIn = typeof getDisplay === "function";
131131
}
132132
});
133133
itemsProperty.register(DropDownBase);

drop-down.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ export interface SelectedIndexChangedEventData extends EventData {
2424
}
2525

2626
export interface ValueItem<T> {
27-
ValueMember: T;
28-
DisplayMember: string;
27+
value: T;
28+
display: string;
2929
}
3030

3131
export class DropDown extends View {
@@ -52,7 +52,7 @@ export class DropDown extends View {
5252
}
5353

5454
export class ValueList<T> extends ObservableArray<ValueItem<T>> {
55-
public getText(index: number): string;
55+
public getDisplay(index: number): string;
5656
public getValue(index: number): T;
5757
public getIndex(value: T): number;
5858
}

drop-down.ios.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,7 @@ class TNSDropDownLabel extends TNSLabel {
450450

451451
if (!this._hasText) {
452452
this.text = value;
453+
this._owner.get()._setTextAttributes();
453454
}
454455
}
455456

gruntfile.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
module.exports = function (grunt) {
22
var localConfig = {
3-
typeScriptSrc: [
4-
"**/*.ts",
5-
"!node_modules/**/*.*",
6-
"!demo/**/*.*",
7-
"!bin/**/*.*"
8-
],
93
typeScriptDeclarations: [
104
"**/*.d.ts",
115
"!references.d.ts",
126
"!node_modules/**/*.*",
137
"!demo/**/*.*",
8+
"!demo-ng/**/*.*",
149
"!bin/**/*.*"
1510
],
1611
outDir: "bin/dist/"

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nativescript-drop-down",
3-
"version": "3.0.0-rc.2",
3+
"version": "3.0.0-rc.3",
44
"description": "A NativeScript DropDown widget.",
55
"main": "drop-down",
66
"typings": "drop-down.d.ts",

tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"exclude": [
2323
"node_modules",
2424
"demo",
25+
"demo-ng",
2526
"bin"
2627
]
2728
}

0 commit comments

Comments
 (0)