Skip to content

Commit 7d0434f

Browse files
committed
Merge remote-tracking branch 'upstream/master' into lazy-load-then-open-modal
2 parents 6a525c7 + 1c7cbce commit 7d0434f

28 files changed

+823
-247
lines changed

.travis.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ jdk:
99
android:
1010
components:
1111
- platform-tools
12-
- build-tools-23.0.1
12+
- build-tools-23.0.2
1313
- android-23
1414
- extra-android-m2repository
15-
- sys-img-armeabi-v7a-android-19
15+
- sys-img-armeabi-v7a-android-23
1616
before_cache:
1717
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
1818
cache:
@@ -33,20 +33,20 @@ install:
3333
- npm install
3434
- tns platform add android
3535
before_script:
36-
- echo no | android create avd --force -n test -t android-19 -b armeabi-v7a
36+
- echo no | android create avd --force -n test -t android-23 -abi armeabi-v7a
3737
- emulator -memory 1024 -avd test -no-audio -no-window &
3838
script:
3939
-
4040
-
4141
- tns build android
4242
- android-wait-for-emulator
43-
- npm run run-appium-android
43+
- npm run appium --runtype=android23
4444
before_deploy:
4545
- cd ../nativescript-angular
4646
- npm install -g nativescript --ignore-scripts
4747
- tns usage-reporting disable
4848
- tns error-reporting disable
49-
- node ../build/travis-scripts/add-publishConfig.js internal-preview $PACKAGE_VERSION
49+
- node ../build/travis-scripts/add-publishConfig.js next $PACKAGE_VERSION
5050
deploy:
5151
provider: npm
5252
email: nativescript@telerik.com

CHANGELOG.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,57 @@
1+
<a name="3.0.0"></a>
2+
# [3.0.0](https://github.com/NativeScript/nativescript-angular/compare/v1.5.2..v3.0.0) (2017-05-03)
3+
4+
5+
### Bug Fixes
6+
7+
* **action-bar:** Don't remove action items twice. ([b96b61f](https://github.com/NativeScript/nativescript-angular/commit/b96b61f))
8+
* **animations:** add onDestroy method to NativeScriptAnimationPlayer ([ec07ec3](https://github.com/NativeScript/nativescript-angular/commit/ec07ec3))
9+
* **animations:** set nodeType 'element' to newly created views ([#720](https://github.com/NativeScript/nativescript-angular/issues/720)) ([8af20ad](https://github.com/NativeScript/nativescript-angular/commit/8af20ad))
10+
* **gitignore:** Add editor files into gitignore ([9beea98](https://github.com/NativeScript/nativescript-angular/commit/9beea98))
11+
* **init:** Bootstrap Angular on page "navigatingTo" event. ([85b9d01](https://github.com/NativeScript/nativescript-angular/commit/85b9d01))
12+
* **list-view:** Destroy item views on unload ([71301aa](https://github.com/NativeScript/nativescript-angular/commit/71301aa))
13+
* **list-view:** Do not access destroyed items' ng views. ([c6f7549](https://github.com/NativeScript/nativescript-angular/commit/c6f7549))
14+
* **list-view-comp:** IterableDiffer is now parameterized on <KeyedTemplate> ([f692c5f](https://github.com/NativeScript/nativescript-angular/commit/f692c5f))
15+
* **ns-http:** make defaultOptions of type RequestOptions ([073c95d](https://github.com/NativeScript/nativescript-angular/commit/073c95d))
16+
* **action bar:** attach #comment nodes with _addView ([#729](https://github.com/NativeScript/nativescript-angular/issues/729)) ([0490605](https://github.com/NativeScript/nativescript-angular/commit/0490605)), closes [#725](https://github.com/NativeScript/nativescript-angular/issues/725)
17+
* **ns-router-link:** navigate with urlTree ([#728](https://github.com/NativeScript/nativescript-angular/issues/728)) ([3c6f5ab](https://github.com/NativeScript/nativescript-angular/commit/3c6f5ab)), closes [#724](https://github.com/NativeScript/nativescript-angular/issues/724)
18+
* use providers' map for injectors in page-router-outlet ([#744](https://github.com/NativeScript/nativescript-angular/issues/744)) ([07fe66c](https://github.com/NativeScript/nativescript-angular/commit/07fe66c)), closes [#741](https://github.com/NativeScript/nativescript-angular/issues/741)
19+
20+
21+
### Code Refactoring
22+
23+
* stop exporting NativeScriptModule from platform ([#701](https://github.com/NativeScript/nativescript-angular/issues/701)) ([0bd2ba5](https://github.com/NativeScript/nativescript-angular/commit/0bd2ba5))
24+
25+
26+
### Features
27+
28+
* **animations:** introduce NativeScriptAnimationsModule ([#704](https://github.com/NativeScript/nativescript-angular/issues/704)) ([f9ad6a5](https://github.com/NativeScript/nativescript-angular/commit/f9ad6a5))
29+
* **renderer:** use EmulatedRenderer to scope component styles ([70603c4](https://github.com/NativeScript/nativescript-angular/commit/70603c4))
30+
* **renderer:** implement createComment and createText methods using ([0f128ad](https://github.com/NativeScript/nativescript-angular/commit/0f128ad))
31+
* **renderer:** support namespaced attributes ([#719](https://github.com/NativeScript/nativescript-angular/issues/719)) ([9b5b413](https://github.com/NativeScript/nativescript-angular/commit/9b5b413))
32+
33+
34+
### BREAKING CHANGES
35+
36+
* **animations:** To use animations, you need to import the
37+
NativeScriptAnimationsModule from "nativescript-angular/animations" in
38+
your root NgModule.
39+
* User applications cannot import NativeScriptModule from
40+
"nativescript-angular/platform" anymore.
41+
Migration:
42+
Before:
43+
```
44+
import { NativeScriptModule } from "nativescript-angular/platform";
45+
```
46+
After
47+
```
48+
import { NativeScriptModule } from
49+
"nativescript-angular/nativescript.module";
50+
```
51+
52+
53+
54+
155
<a name="1.5.2"></a>
256
## [1.5.2](https://github.com/NativeScript/nativescript-angular/compare/v1.5.1...v1.5.2) (2017-04-18)
357

nativescript-angular/animations/animation-driver.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { AnimationPlayer } from "@angular/animations";
2-
import { NgView } from "../element-registry";
32

3+
import { NgView } from "../element-types";
44
import { NativeScriptAnimationPlayer } from "./animation-player";
55
import { Keyframe } from "./utils";
66

nativescript-angular/animations/animation-engine.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ɵDomAnimationEngine as DomAnimationEngine } from "@angular/animations/browser";
22
import { AnimationEvent, AnimationPlayer } from "@angular/animations";
33

4-
import { NgView } from "../element-registry";
4+
import { NgView } from "../element-types";
55
import {
66
copyArray,
77
cssClasses,

nativescript-angular/animations/animation-player.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
KeyframeAnimationInfo,
55
} from "tns-core-modules/ui/animation/keyframe-animation";
66

7-
import { NgView } from "../element-registry";
7+
import { NgView } from "../element-types";
88
import { Keyframe, getAnimationCurve, parseAnimationKeyframe } from "./utils";
99

1010
export class NativeScriptAnimationPlayer implements AnimationPlayer {

nativescript-angular/animations/dom-utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
} from "@angular/animations";
88
import { unsetValue } from "tns-core-modules/ui/core/view";
99

10-
import { NgView } from "../element-registry";
10+
import { NgView } from "../element-types";
1111

1212
// overriden to use the default 'unsetValue'
1313
// instead of empty string ''

nativescript-angular/bin/update-app-ng-deps

Lines changed: 50 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,57 @@
11
#!/usr/bin/env node
22

3-
var path = require("path");
4-
var fs = require("fs");
5-
6-
var binPath = __dirname;
7-
var pluginPath = path.dirname(binPath);
8-
var pluginPackageJsonPath = path.join(pluginPath, "package.json");
9-
var projectPath = path.dirname(path.dirname(pluginPath));
10-
var appPackageJsonPath = path.join(projectPath, "package.json");
11-
12-
var appPackageJson = JSON.parse(fs.readFileSync(appPackageJsonPath, "utf8"));
13-
var pluginPackageJson = JSON.parse(fs.readFileSync(pluginPackageJsonPath, "utf8"));
14-
15-
Object.keys(pluginPackageJson.dependencies).forEach(function(dependencyName) {
16-
var version = pluginPackageJson.dependencies[dependencyName];
17-
if (dependencyName.startsWith("@angular") || dependencyName === "rxjs") {
18-
appPackageJson.dependencies[dependencyName] = version;
19-
console.log("Updated dependency '" + dependencyName + "' to version: " + version + ".");
20-
}
21-
});
3+
const path = require("path");
4+
const fs = require("fs");
5+
6+
const browserDynamicDependency = "@angular/platform-browser-dynamic";
7+
const binPath = __dirname;
8+
const pluginPath = path.dirname(binPath);
9+
const pluginPackageJsonPath = path.join(pluginPath, "package.json");
10+
const pluginPackageJson = JSON.parse(fs.readFileSync(pluginPackageJsonPath, "utf8"));
2211

23-
Object.keys(pluginPackageJson.devDependencies).forEach(function(dependencyName) {
24-
var version = pluginPackageJson.devDependencies[dependencyName];
25-
if (dependencyName.startsWith("@angular") || dependencyName === "zone.js") {
26-
appPackageJson.devDependencies[dependencyName] = version;
27-
console.log("Updated dev dependency '" + dependencyName + "' to version: " + version + ".");
12+
const isNgDependency = name => name.startsWith("@angular") ||
13+
name === "rxjs" ||
14+
name === "zone.js";
15+
16+
function updateDeps(deps, newDeps) {
17+
// set app dependencies to ones required from plugin
18+
Object.keys(newDeps)
19+
.filter(isNgDependency)
20+
.filter(dependencyName => deps.hasOwnProperty(dependencyName))
21+
.map(dependencyName => ({
22+
dependencyName,
23+
version: pluginPackageJson.peerDependencies[dependencyName]
24+
}))
25+
.filter(({ dependencyName, version }) => deps[dependencyName] !== version)
26+
.forEach(({ dependencyName, version }) => {
27+
deps[dependencyName] = version;
28+
console.log(`Updated dependency ${dependencyName} to version: ${version}.`);
29+
});
30+
31+
// remove platform-browser-dynamic if present
32+
if (deps.hasOwnProperty(browserDynamicDependency)) {
33+
delete deps[browserDynamicDependency];
34+
console.log(`Removed ${browserDynamicDependency}`);
2835
}
29-
});
36+
37+
38+
return deps;
39+
}
40+
41+
let pluginDeps = pluginPackageJson.peerDependencies;
42+
Object.keys(pluginPackageJson.devDependencies)
43+
.filter(isNgDependency)
44+
.filter(depName => !pluginDeps.hasOwnProperty(depName))
45+
.forEach(depName => {
46+
pluginDeps[depName] = pluginPackageJson.devDependencies[depName];
47+
});
48+
49+
const projectPath = path.dirname(path.dirname(pluginPath));
50+
const appPackageJsonPath = path.join(projectPath, "package.json");
51+
const appPackageJson = JSON.parse(fs.readFileSync(appPackageJsonPath, "utf8"));
52+
53+
appPackageJson.dependencies = updateDeps(appPackageJson.dependencies, pluginDeps);
54+
appPackageJson.devDependencies = updateDeps(appPackageJson.devDependencies, pluginDeps);
3055

3156
fs.writeFileSync(appPackageJsonPath, JSON.stringify(appPackageJson, null, 2));
3257

nativescript-angular/directives/action-bar.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
import { Directive, Component, ElementRef, Optional, OnDestroy } from "@angular/core";
22
import { ActionItem, ActionBar, NavigationButton } from "tns-core-modules/ui/action-bar";
3-
import { isBlank } from "../lang-facade";
43
import { Page } from "tns-core-modules/ui/page";
54
import { View } from "tns-core-modules/ui/core/view";
6-
import { registerElement, ViewClassMeta, NgView } from "../element-registry";
5+
6+
import { isBlank } from "../lang-facade";
7+
import { registerElement } from "../element-registry";
8+
import { ViewClassMeta, NgView } from "../element-types";
79

810
const actionBarMeta: ViewClassMeta = {
911
skipAddToDom: true,
10-
insertChild: (parent: NgView, child: NgView, atIndex: number) => {
12+
insertChild: (parent: NgView, child: NgView) => {
1113
const bar = <ActionBar>(<any>parent);
1214
const childView = <any>child;
1315

@@ -17,8 +19,6 @@ const actionBarMeta: ViewClassMeta = {
1719
} else if (child instanceof ActionItem) {
1820
bar.actionItems.addItem(childView);
1921
childView.parent = bar;
20-
} else if (child.nodeName === "#comment") {
21-
bar._addView(childView, atIndex);
2222
} else if (child instanceof View) {
2323
bar.titleView = childView;
2424
}

nativescript-angular/directives/list-view-comp.ts

Lines changed: 35 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,31 @@
11
import {
2+
AfterContentInit,
3+
ChangeDetectionStrategy,
4+
ChangeDetectorRef,
25
Component,
6+
ContentChild,
37
Directive,
4-
Input,
58
DoCheck,
6-
OnDestroy,
7-
AfterContentInit,
89
ElementRef,
9-
ViewContainerRef,
10-
TemplateRef,
11-
ContentChild,
1210
EmbeddedViewRef,
13-
IterableDiffers,
14-
IterableDiffer,
15-
ChangeDetectorRef,
1611
EventEmitter,
17-
ViewChild,
18-
Output,
1912
Host,
20-
ChangeDetectionStrategy
13+
Input,
14+
IterableDiffer,
15+
IterableDiffers,
16+
OnDestroy,
17+
Output,
18+
TemplateRef,
19+
ViewChild,
20+
ViewContainerRef,
2121
} from "@angular/core";
22-
import { isListLikeIterable } from "../collection-facade";
2322
import { ListView, ItemEventData } from "tns-core-modules/ui/list-view";
2423
import { View, KeyedTemplate } from "tns-core-modules/ui/core/view";
2524
import { ObservableArray } from "tns-core-modules/data/observable-array";
2625
import { LayoutBase } from "tns-core-modules/ui/layouts/layout-base";
26+
27+
import { CommentNode } from "../element-types";
28+
import { isListLikeIterable } from "../collection-facade";
2729
import { listViewLog, listViewError } from "../trace";
2830

2931
const NG_VIEW = "_ngViewRef";
@@ -168,7 +170,7 @@ export class ListViewComponent implements DoCheck, OnDestroy, AfterContentInit {
168170
if (!viewRef) {
169171
listViewError("ViewReference not found for item " + index + ". View recycling is not working");
170172
}
171-
};
173+
}
172174

173175
if (!viewRef) {
174176
listViewLog("onItemLoading: " + index + " - Creating view from template");
@@ -212,29 +214,34 @@ export class ListViewComponent implements DoCheck, OnDestroy, AfterContentInit {
212214
}
213215

214216
function getSingleViewRecursive(nodes: Array<any>, nestLevel: number): View {
215-
const actualNodes = nodes.filter((n) => !!n && n.nodeName !== "#text");
217+
const actualNodes = nodes.filter(node => !(node instanceof CommentNode));
216218

217219
if (actualNodes.length === 0) {
218-
throw new Error("No suitable views found in list template! Nesting level: " + nestLevel);
220+
throw new Error(`No suitable views found in list template! ` +
221+
`Nesting level: ${nestLevel}`);
219222
} else if (actualNodes.length > 1) {
220-
throw new Error("More than one view found in list template! Nesting level: " + nestLevel);
221-
} else {
222-
if (actualNodes[0]) {
223-
let parentLayout = actualNodes[0].parent;
224-
if (parentLayout instanceof LayoutBase) {
225-
parentLayout.removeChild(actualNodes[0]);
226-
}
227-
return actualNodes[0];
228-
} else {
229-
return getSingleViewRecursive(actualNodes[0].children, nestLevel + 1);
230-
}
223+
throw new Error(`More than one view found in list template!` +
224+
`Nesting level: ${nestLevel}`);
231225
}
226+
227+
const rootLayout = actualNodes[0];
228+
if (!rootLayout) {
229+
return getSingleViewRecursive(rootLayout.children, nestLevel + 1);
230+
}
231+
232+
let parentLayout = rootLayout.parent;
233+
if (parentLayout instanceof LayoutBase) {
234+
parentLayout.removeChild(rootLayout);
235+
}
236+
237+
return rootLayout;
232238
}
233239

234240
export interface ComponentView {
235241
rootNodes: Array<any>;
236242
destroy(): void;
237-
};
243+
}
244+
238245
export type RootLocator = (nodes: Array<any>, nestLevel: number) => View;
239246

240247
export function getItemViewRoot(viewRef: ComponentView, rootLocator: RootLocator = getSingleViewRecursive): View {

nativescript-angular/directives/tab-view.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
1-
import { ElementRef, Directive, Input, TemplateRef, ViewContainerRef, OnInit, AfterViewInit } from "@angular/core";
1+
import {
2+
AfterViewInit,
3+
Directive,
4+
ElementRef,
5+
Input,
6+
OnInit,
7+
TemplateRef,
8+
ViewContainerRef,
9+
} from "@angular/core";
210
import { TabView, TabViewItem } from "tns-core-modules/ui/tab-view";
11+
12+
import { CommentNode } from "../element-types";
313
import { convertToInt } from "../common/utils";
414
import { rendererLog } from "../trace";
515
import { isBlank } from "../lang-facade";
@@ -94,9 +104,9 @@ export class TabViewItemDirective implements OnInit {
94104
}
95105

96106
const viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
97-
// Filter out text nodes, etc
98-
const realViews = viewRef.rootNodes.filter((node) =>
99-
node.nodeName && node.nodeName !== "#text");
107+
// Filter out text nodes and comments
108+
const realViews = viewRef.rootNodes.filter(node =>
109+
!(node instanceof CommentNode));
100110

101111
if (realViews.length > 0) {
102112
this.item.view = realViews[0];

0 commit comments

Comments
 (0)