mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 19:26:42 +08:00
Fix TypeScript 1.8 compile errors. Get rid of "ui" imports.
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import {Page} from "ui";
|
||||
import {Page} from "ui/page";
|
||||
import {EventData as ObservableEventData} from "data/observable";
|
||||
|
||||
// Event handler for Page "navigatedTo" event attached in details-page.xml
|
||||
|
@ -1,5 +1,7 @@
|
||||
import {EventData as ObservableEventData} from "data/observable";
|
||||
import {Page, ItemEventData, topmost as topmostFrame, ItemEventData as ListViewItemEventData} from "ui";
|
||||
import {Page} from "ui/page";
|
||||
import {ItemEventData as ListViewItemEventData} from "ui/list-view";
|
||||
import {topmost as topmostFrame} from "ui/frame";
|
||||
import {AppViewModel} from "./reddit-app-view-model";
|
||||
|
||||
var appViewModel = new AppViewModel();
|
||||
|
@ -1,7 +1,8 @@
|
||||
import application = require("application");
|
||||
import navPageModule = require("../nav-page");
|
||||
import * as application from "application";
|
||||
import {NavPage} from "../nav-page";
|
||||
import {Page} from "ui/page";
|
||||
import * as trace from "trace";
|
||||
|
||||
import trace = require("trace");
|
||||
trace.enable();
|
||||
trace.setCategories(trace.categories.concat(
|
||||
trace.categories.NativeLifecycle,
|
||||
@ -11,18 +12,14 @@ trace.setCategories(trace.categories.concat(
|
||||
));
|
||||
|
||||
application.mainEntry = {
|
||||
create: function () {
|
||||
return new navPageModule.NavPage({
|
||||
index: 0,
|
||||
backStackVisible: true,
|
||||
clearHistory: false,
|
||||
animated: true,
|
||||
transition: 0,
|
||||
curve: 0,
|
||||
duration: 0,
|
||||
});
|
||||
}
|
||||
//backstackVisible: false,
|
||||
//clearHistory: true
|
||||
create: () => new NavPage({
|
||||
index: 0,
|
||||
backStackVisible: true,
|
||||
clearHistory: false,
|
||||
animated: true,
|
||||
transition: 0,
|
||||
curve: 0,
|
||||
duration: 0,
|
||||
})
|
||||
};
|
||||
application.start();
|
||||
|
@ -1,4 +1,5 @@
|
||||
import {Page, ListPicker} from "ui";
|
||||
import {Page} from "ui/page";
|
||||
import {ListPicker} from "ui/list-picker";
|
||||
|
||||
var closeCallback: Function;
|
||||
var page: Page;
|
||||
|
@ -1,7 +1,17 @@
|
||||
import definition = require("controls-page");
|
||||
import {View, Page, topmost as topmostFrame, NavigationTransition, Orientation, AnimationCurve, StackLayout, Button, Label, TextField, Switch, ListPicker, Slider} from "ui";
|
||||
import {View} from "ui/core/view";
|
||||
import {Page} from "ui/page";
|
||||
import {topmost as topmostFrame, NavigationTransition} from "ui/frame";
|
||||
import {Orientation, AnimationCurve} from "ui/enums";
|
||||
import {StackLayout} from "ui/layouts/stack-layout";
|
||||
import {Button} from "ui/button";
|
||||
import {Label} from "ui/label";
|
||||
import {TextField} from "ui/text-field";
|
||||
import {Switch} from "ui/switch";
|
||||
import {ListPicker} from "ui/list-picker";
|
||||
import {Slider} from "ui/slider";
|
||||
import {Color} from "color";
|
||||
import platform = require("platform");
|
||||
import * as platform from "platform";
|
||||
|
||||
var availableTransitions = ["default", "custom", "flip", "flipRight", "flipLeft", "slide", "slideLeft", "slideRight", "slideTop", "slideBottom", "fade"];
|
||||
if (platform.device.os === platform.platformNames.ios) {
|
||||
|
@ -1,15 +1,12 @@
|
||||
import TKUnit = require("../TKUnit");
|
||||
import platform = require("platform");
|
||||
import {Frame, Page, topmost as topmostFrame, NavigationEntry, NavigationTransition, AnimationCurve, WrapLayout, Button} from "ui";
|
||||
import color = require("color");
|
||||
import helper = require("../ui/helper");
|
||||
import utils = require("utils/utils");
|
||||
import trace = require("trace");
|
||||
import * as TKUnit from "../TKUnit";
|
||||
import {Page} from "ui/page";
|
||||
import {topmost as topmostFrame} from "ui/frame";
|
||||
import {Color} from "color";
|
||||
|
||||
// Creates a random colorful page full of meaningless stuff.
|
||||
var pageFactory = function(): Page {
|
||||
var page = new Page();
|
||||
page.style.backgroundColor = new color.Color(255, Math.round(Math.random() * 255), Math.round(Math.random() * 255), Math.round(Math.random() * 255));
|
||||
page.style.backgroundColor = new Color(255, Math.round(Math.random() * 255), Math.round(Math.random() * 255), Math.round(Math.random() * 255));
|
||||
return page;
|
||||
};
|
||||
|
||||
@ -112,4 +109,4 @@ export var test_ClearHistory = function () {
|
||||
|
||||
topmostFrame().navigate({ create: mainPageFactory });
|
||||
TKUnit.waitUntilReady(() => { return topmostFrame().currentPage === mainTestPage; });
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,12 @@
|
||||
import TKUnit = require("../TKUnit");
|
||||
import platform = require("platform");
|
||||
import transitionModule = require("ui/transition");
|
||||
import color = require("color");
|
||||
import helper = require("../ui/helper");
|
||||
import utils = require("utils/utils");
|
||||
import trace = require("trace");
|
||||
import {Frame, Page, topmost as topmostFrame, NavigationEntry, NavigationTransition, AnimationCurve, WrapLayout, Button} from "ui";
|
||||
import * as TKUnit from "../TKUnit";
|
||||
import * as helper from "../ui/helper";
|
||||
import * as platform from "platform";
|
||||
import * as trace from "trace";
|
||||
import {Color} from "color";
|
||||
import {GC} from "utils/utils";
|
||||
import {NavigationEntry, NavigationTransition} from "ui/frame";
|
||||
import {Page} from "ui/page";
|
||||
import {AnimationCurve} from "ui/enums"
|
||||
|
||||
function _testTransition(navigationTransition: NavigationTransition) {
|
||||
var testId = `Transition[${JSON.stringify(navigationTransition)}]`;
|
||||
@ -14,7 +15,7 @@ function _testTransition(navigationTransition: NavigationTransition) {
|
||||
create: function (): Page {
|
||||
var page = new Page();
|
||||
page.id = testId;
|
||||
page.style.backgroundColor = new color.Color(255, Math.round(Math.random() * 255), Math.round(Math.random() * 255), Math.round(Math.random() * 255));
|
||||
page.style.backgroundColor = new Color(255, Math.round(Math.random() * 255), Math.round(Math.random() * 255), Math.round(Math.random() * 255));
|
||||
return page;
|
||||
},
|
||||
animated: true,
|
||||
@ -25,7 +26,7 @@ function _testTransition(navigationTransition: NavigationTransition) {
|
||||
TKUnit.wait(0.100);
|
||||
helper.goBack();
|
||||
TKUnit.wait(0.100);
|
||||
utils.GC();
|
||||
GC();
|
||||
}
|
||||
|
||||
// Extremely slow. Run only if needed.
|
||||
@ -33,7 +34,7 @@ export var test_Transitions = function () {
|
||||
helper.navigate(() => {
|
||||
var page = new Page();
|
||||
page.id = "TransitionsTestPage_MAIN"
|
||||
page.style.backgroundColor = new color.Color(255, Math.round(Math.random() * 255), Math.round(Math.random() * 255), Math.round(Math.random() * 255));
|
||||
page.style.backgroundColor = new Color(255, Math.round(Math.random() * 255), Math.round(Math.random() * 255), Math.round(Math.random() * 255));
|
||||
return page;
|
||||
});
|
||||
|
||||
|
@ -27,19 +27,15 @@ export function getNativeTextAlignment(button: buttonModule.Button): string {
|
||||
switch (button.ios.titleLabel.textAlignment) {
|
||||
case NSTextAlignment.NSTextAlignmentLeft:
|
||||
return enums.TextAlignment.left;
|
||||
break;
|
||||
case NSTextAlignment.NSTextAlignmentCenter:
|
||||
return enums.TextAlignment.center;
|
||||
break;
|
||||
case NSTextAlignment.NSTextAlignmentRight:
|
||||
return enums.TextAlignment.right;
|
||||
break;
|
||||
default:
|
||||
return "unexpected value";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
export function performNativeClick(button: buttonModule.Button): void {
|
||||
button.ios.sendActionsForControlEvents(UIControlEvents.UIControlEventTouchUpInside);
|
||||
}
|
||||
}
|
||||
|
@ -7,16 +7,12 @@ export function getNativeTextAlignment(label: labelModule.Label): string {
|
||||
switch (label.ios.textAlignment) {
|
||||
case NSTextAlignment.NSTextAlignmentLeft:
|
||||
return enums.TextAlignment.left;
|
||||
break;
|
||||
case NSTextAlignment.NSTextAlignmentCenter:
|
||||
return enums.TextAlignment.center;
|
||||
break;
|
||||
case NSTextAlignment.NSTextAlignmentRight:
|
||||
return enums.TextAlignment.right;
|
||||
break;
|
||||
default:
|
||||
return "unexpected value";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,18 +1,20 @@
|
||||
import TKUnit = require("../../TKUnit");
|
||||
import helper = require("../helper");
|
||||
import viewModule = require("ui/core/view");
|
||||
import observable = require("data/observable");
|
||||
import color = require("color");
|
||||
import platform = require("platform");
|
||||
|
||||
import * as TKUnit from "../../TKUnit";
|
||||
import * as helper from "../helper";
|
||||
import {View} from "ui/core/view";
|
||||
import {Button} from "ui/button";
|
||||
import {Page} from "ui/page";
|
||||
import {ScrollView} from "ui/scroll-view";
|
||||
import {TabView, TabViewItem} from "ui/tab-view";
|
||||
import {LayoutBase} from "ui/layouts/layout-base"
|
||||
import {StackLayout} from "ui/layouts/stack-layout"
|
||||
import {GridLayout} from "ui/layouts/grid-layout"
|
||||
import {ProxyViewContainer} from "ui/proxy-view-container";
|
||||
import {View, Button, LayoutBase, StackLayout, GridLayout, Page, ScrollView, TabView, TabViewItem} from "ui";
|
||||
|
||||
export function test_add_children_to_attached_proxy() {
|
||||
var outer = new StackLayout();
|
||||
var proxy = new ProxyViewContainer();
|
||||
|
||||
function testAction(views: Array<viewModule.View>) {
|
||||
function testAction(views: Array<View>) {
|
||||
outer.addChild(createBtn("1"));
|
||||
outer.addChild(proxy);
|
||||
proxy.addChild(createBtn("2"));
|
||||
@ -31,7 +33,7 @@ export function test_children_immediately_registered_in_parent_grid_layout() {
|
||||
var outer = new GridLayout();
|
||||
var proxy = new ProxyViewContainer();
|
||||
|
||||
function testAction(views: Array<viewModule.View>) {
|
||||
function testAction(views: Array<View>) {
|
||||
outer.addChild(proxy);
|
||||
proxy.addChild(createBtn("1"));
|
||||
|
||||
@ -45,7 +47,7 @@ export function test_children_registered_in_parent_grid_layout_on_attach() {
|
||||
var outer = new GridLayout();
|
||||
var proxy = new ProxyViewContainer();
|
||||
|
||||
function testAction(views: Array<viewModule.View>) {
|
||||
function testAction(views: Array<View>) {
|
||||
proxy.addChild(createBtn("1"));
|
||||
outer.addChild(proxy);
|
||||
|
||||
@ -59,7 +61,7 @@ export function test_add_children_to_detached_proxy() {
|
||||
var outer = new StackLayout();
|
||||
var proxy = new ProxyViewContainer();
|
||||
|
||||
function testAction(views: Array<viewModule.View>) {
|
||||
function testAction(views: Array<View>) {
|
||||
outer.addChild(createBtn("1"));
|
||||
|
||||
proxy.addChild(createBtn("2"));
|
||||
@ -88,7 +90,7 @@ export function test_remove_proxy() {
|
||||
|
||||
outer.addChild(createBtn("5"));
|
||||
|
||||
function testAction(views: Array<viewModule.View>) {
|
||||
function testAction(views: Array<View>) {
|
||||
assertNativeChildren(outer, ["1", "2", "3", "4", "5"]);
|
||||
outer.removeChild(proxy);
|
||||
assertNativeChildren(outer, ["1", "5"]);
|
||||
@ -111,7 +113,7 @@ export function test_remove_child_of_attached_proxy() {
|
||||
|
||||
outer.addChild(createBtn("5"));
|
||||
|
||||
function testAction(views: Array<viewModule.View>) {
|
||||
function testAction(views: Array<View>) {
|
||||
assertNativeChildren(outer, ["1", "2", "3", "4", "5"]);
|
||||
proxy.removeChild(testBtn);
|
||||
assertNativeChildren(outer, ["1", "2", "4", "5"]);
|
||||
@ -132,7 +134,7 @@ export function test_insert_inside_porxy() {
|
||||
|
||||
outer.addChild(createBtn("5"));
|
||||
|
||||
function testAction(views: Array<viewModule.View>) {
|
||||
function testAction(views: Array<View>) {
|
||||
assertNativeChildren(outer, ["1", "2", "4", "5"]);
|
||||
proxy.insertChild(createBtn("3"), 1);
|
||||
assertNativeChildren(outer, ["1", "2", "3", "4", "5"]);
|
||||
@ -152,7 +154,7 @@ export function test_insert_after_porxy() {
|
||||
proxy.addChild(createBtn("3"));
|
||||
proxy.addChild(createBtn("4"));
|
||||
|
||||
function testAction(views: Array<viewModule.View>) {
|
||||
function testAction(views: Array<View>) {
|
||||
assertNativeChildren(outer, ["1", "2", "3", "4"]);
|
||||
outer.insertChild(createBtn("5"), 2);
|
||||
assertNativeChildren(outer, ["1", "2", "3", "4", "5"]);
|
||||
@ -170,7 +172,7 @@ export function test_proxy_does_not_stop_request_layout_bubble() {
|
||||
var btn = createBtn("2");
|
||||
proxy.addChild(btn);
|
||||
|
||||
function testAction(views: Array<viewModule.View>) {
|
||||
function testAction(views: Array<View>) {
|
||||
assertNativeChildren(outer, ["1", "2"]);
|
||||
waitUntilElementLayoutIsValid(outer);
|
||||
TKUnit.assert(outer.isLayoutValid, "outer container isLayoutValid should be true");
|
||||
@ -185,7 +187,7 @@ export function test_proxy_iniside_page() {
|
||||
var proxy = new ProxyViewContainer();
|
||||
proxy.addChild(createBtn("1"));
|
||||
|
||||
function testAction(views: Array<viewModule.View>) {
|
||||
function testAction(views: Array<View>) {
|
||||
var page = <Page>views[1];
|
||||
waitUntilElementLayoutIsValid(page);
|
||||
};
|
||||
@ -200,7 +202,7 @@ export function test_proxy_iniside_scroll_view() {
|
||||
var proxy = new ProxyViewContainer();
|
||||
proxy.addChild(createBtn("1"));
|
||||
|
||||
function testAction(views: Array<viewModule.View>) {
|
||||
function testAction(views: Array<View>) {
|
||||
var page = <Page>views[1];
|
||||
waitUntilElementLayoutIsValid(page);
|
||||
};
|
||||
@ -215,7 +217,7 @@ export function test_proxy_iniside_border() {
|
||||
var proxy = new ProxyViewContainer();
|
||||
proxy.addChild(createBtn("1"));
|
||||
|
||||
function testAction(views: Array<viewModule.View>) {
|
||||
function testAction(views: Array<View>) {
|
||||
var page = <Page>views[1];
|
||||
waitUntilElementLayoutIsValid(page);
|
||||
};
|
||||
@ -233,7 +235,7 @@ export function test_proxy_iniside_border() {
|
||||
// items.push(new TabViewItem({ title: "tab with proxy", view: proxy }));
|
||||
// tab.items = items;
|
||||
|
||||
// function testAction(views: Array<viewModule.View>) {
|
||||
// function testAction(views: Array<View>) {
|
||||
// var page = <Page>views[1];
|
||||
// waitUntilElementLayoutIsValid(page);
|
||||
// };
|
||||
@ -243,7 +245,7 @@ export function test_proxy_iniside_border() {
|
||||
|
||||
// TODO: Proxy as a direct child to of ActionBar is not supported. Not sure if we want to support it.
|
||||
//export function test_proxy_iniside_actionBar() {
|
||||
// function testAction(views: Array<viewModule.View>) {
|
||||
// function testAction(views: Array<View>) {
|
||||
// var page = <Page>views[1];
|
||||
// var proxy = new ProxyViewContainer();
|
||||
// proxy.addChild(createBtn("1"));
|
||||
|
@ -67,8 +67,7 @@ var _clickHandlerFactory = function (index: number) {
|
||||
}
|
||||
|
||||
export function testWhenNavigatingBackToANonCachedPageContainingATabViewWithAListViewTheListViewIsThere() {
|
||||
return;
|
||||
|
||||
/*
|
||||
var topFrame = frameModule.topmost();
|
||||
var oldChache;
|
||||
|
||||
@ -126,6 +125,7 @@ export function testWhenNavigatingBackToANonCachedPageContainingATabViewWithALis
|
||||
var listView = mainPage.getViewById<ListView>("ListView");
|
||||
|
||||
TKUnit.assert(listView !== undefined, "ListView should be created when navigating back to the main page.");
|
||||
*/
|
||||
}
|
||||
/*
|
||||
export function testLoadedAndUnloadedAreFired_WhenNavigatingAwayAndBack_NoPageCaching() {
|
||||
@ -224,4 +224,4 @@ function _clickTheFirstButtonInTheListViewNatively(tabView: TabView) {
|
||||
else {
|
||||
(<UIButton>(<UITableView>tabView.ios.viewControllers[0].view.subviews[0]).cellForRowAtIndexPath(NSIndexPath.indexPathForItemInSection(0, 0)).contentView.subviews[0]).sendActionsForControlEvents(UIControlEvents.UIControlEventTouchUpInside);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,16 +31,12 @@ export function getNativeTextAlignment(textField: textFieldModule.TextField): st
|
||||
switch (textField.ios.textAlignment) {
|
||||
case NSTextAlignment.NSTextAlignmentLeft:
|
||||
return enums.TextAlignment.left;
|
||||
break;
|
||||
case NSTextAlignment.NSTextAlignmentCenter:
|
||||
return enums.TextAlignment.center;
|
||||
break;
|
||||
case NSTextAlignment.NSTextAlignmentRight:
|
||||
return enums.TextAlignment.right;
|
||||
break;
|
||||
default:
|
||||
return "unexpected value";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -49,4 +45,4 @@ export function typeTextNatively(textField: textFieldModule.TextField, text: str
|
||||
|
||||
// Setting the text will not trigger the delegate method, so we have to do it by hand.
|
||||
textField.ios.delegate.textFieldDidEndEditing(textField.ios);
|
||||
}
|
||||
}
|
||||
|
@ -36,16 +36,12 @@ export function getNativeTextAlignment(textView: textViewModule.TextView): strin
|
||||
switch (textView.ios.textAlignment) {
|
||||
case NSTextAlignment.NSTextAlignmentLeft:
|
||||
return enums.TextAlignment.left;
|
||||
break;
|
||||
case NSTextAlignment.NSTextAlignmentCenter:
|
||||
return enums.TextAlignment.center;
|
||||
break;
|
||||
case NSTextAlignment.NSTextAlignmentRight:
|
||||
return enums.TextAlignment.right;
|
||||
break;
|
||||
default:
|
||||
return "unexpected value";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -54,4 +50,4 @@ export function typeTextNatively(textView: textViewModule.TextView, text: string
|
||||
|
||||
// Setting the text will not trigger the delegate method, so we have to do it by hand.
|
||||
textView.ios.delegate.textViewDidEndEditing(textView.ios);
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,6 @@
|
||||
import { Page, View, TextView } from "ui";
|
||||
import {View} from "ui/core/view";
|
||||
import {Page} from "ui/page";
|
||||
import {TextView} from "ui/text-view";
|
||||
import gestures = require("ui/gestures");
|
||||
|
||||
export function onTouch(args: gestures.TouchGestureEventData) {
|
||||
|
@ -264,7 +264,6 @@ export class Animation extends common.Animation implements definition.Animation
|
||||
|
||||
default:
|
||||
throw new Error("Cannot animate " + propertyAnimation.property);
|
||||
break;
|
||||
}
|
||||
|
||||
var i = 0;
|
||||
|
@ -57,7 +57,6 @@ export class EditableTextBase extends common.EditableTextBase {
|
||||
break;
|
||||
default:
|
||||
throw new Error("Invalid updateTextTrigger: " + owner.updateTextTrigger);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -228,7 +228,6 @@ class CssCompositeSelector extends CssSelector {
|
||||
}
|
||||
if (!result) {
|
||||
break;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@ -282,11 +281,9 @@ function matchesAttr(attrExpression: string, view: view.View): boolean {
|
||||
break;
|
||||
}
|
||||
return !types.isNullOrUndefined(view[attrName]) && attrCheckRegex.test(view[attrName]+"");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return !types.isNullOrUndefined(view[attrExpression]);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
export class CssVisualStateSelector extends CssSelector {
|
||||
|
Reference in New Issue
Block a user