diff --git a/.gitignore b/.gitignore index bdd585d..be143dc 100644 --- a/.gitignore +++ b/.gitignore @@ -5,8 +5,15 @@ demo/app/*.js demo/*.d.ts demo/lib +demo/hooks demo/platforms demo/node_modules +demo-ng/app/*.js +demo-ng/*.d.ts +demo-ng/hooks +demo-ng/lib +demo-ng/platforms +demo-ng/node_modules node_modules .vscode .idea \ No newline at end of file diff --git a/.npmignore b/.npmignore index 2df3b83..ef1050e 100644 --- a/.npmignore +++ b/.npmignore @@ -1,4 +1,5 @@ demo/ +demo-ng/ *.png *.log *.map diff --git a/angular/index.ts b/angular/index.ts index fc0c11b..8558c27 100644 --- a/angular/index.ts +++ b/angular/index.ts @@ -1,6 +1,7 @@ import { Component, NgModule } from "@angular/core"; -import { Pager, PagerAdapter } from ".."; +import { Pager, PagerAdapter } from "../"; import { registerElement, ViewClassMeta, NgView, TEMPLATE } from "nativescript-angular/element-registry"; +import { NativeScriptFormsModule } from "nativescript-angular/forms"; import { View } from "ui/core/view"; import { Placeholder } from "ui/placeholder"; @@ -21,7 +22,7 @@ const pagerMeta: ViewClassMeta = { let items = (pager.views || []).concat([childView]); items.forEach((item) => { pager.items.push(item); - }) + }); } }, removeChild(parent: any, child: NgView) { @@ -29,7 +30,7 @@ const pagerMeta: ViewClassMeta = { const childView = child; } }; -registerElement("Pager", () => require("..").Pager, pagerMeta); +registerElement("Pager", () => require("../").Pager, pagerMeta); @Component({ selector: 'Pager', @@ -40,6 +41,7 @@ class PagerComponent { @NgModule({ declarations: [PagerComponent], + imports: [NativeScriptFormsModule], exports: [PagerComponent] }) export class PagerModule { diff --git a/angular/package.json b/angular/package.json index 1f4546b..6688abd 100644 --- a/angular/package.json +++ b/angular/package.json @@ -1,3 +1,3 @@ { - "main": "index.js" + "main": "index" } \ No newline at end of file diff --git a/demo-ng/app/App_Resources/Android/AndroidManifest.xml b/demo-ng/app/App_Resources/Android/AndroidManifest.xml new file mode 100644 index 0000000..9db8321 --- /dev/null +++ b/demo-ng/app/App_Resources/Android/AndroidManifest.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/demo-ng/app/App_Resources/Android/app.gradle b/demo-ng/app/App_Resources/Android/app.gradle new file mode 100644 index 0000000..f56d913 --- /dev/null +++ b/demo-ng/app/App_Resources/Android/app.gradle @@ -0,0 +1,16 @@ +// Add your native dependencies here: + +// Uncomment to add recyclerview-v7 dependency +//dependencies { +// compile 'com.android.support:recyclerview-v7:+' +//} + +android { + defaultConfig { + generatedDensities = [] + applicationId = "org.nativescript.demong" + } + aaptOptions { + additionalParameters "--no-version-vectors" + } +} diff --git a/demo-ng/app/App_Resources/Android/drawable-hdpi/background.png b/demo-ng/app/App_Resources/Android/drawable-hdpi/background.png new file mode 100644 index 0000000..eb381c2 Binary files /dev/null and b/demo-ng/app/App_Resources/Android/drawable-hdpi/background.png differ diff --git a/demo-ng/app/App_Resources/Android/drawable-hdpi/icon.png b/demo-ng/app/App_Resources/Android/drawable-hdpi/icon.png new file mode 100755 index 0000000..1034356 Binary files /dev/null and b/demo-ng/app/App_Resources/Android/drawable-hdpi/icon.png differ diff --git a/demo-ng/app/App_Resources/Android/drawable-hdpi/logo.png b/demo-ng/app/App_Resources/Android/drawable-hdpi/logo.png new file mode 100644 index 0000000..5218f4c Binary files /dev/null and b/demo-ng/app/App_Resources/Android/drawable-hdpi/logo.png differ diff --git a/demo-ng/app/App_Resources/Android/drawable-ldpi/background.png b/demo-ng/app/App_Resources/Android/drawable-ldpi/background.png new file mode 100644 index 0000000..748b2ad Binary files /dev/null and b/demo-ng/app/App_Resources/Android/drawable-ldpi/background.png differ diff --git a/demo-ng/app/App_Resources/Android/drawable-ldpi/icon.png b/demo-ng/app/App_Resources/Android/drawable-ldpi/icon.png new file mode 100755 index 0000000..ddfc17a Binary files /dev/null and b/demo-ng/app/App_Resources/Android/drawable-ldpi/icon.png differ diff --git a/demo-ng/app/App_Resources/Android/drawable-ldpi/logo.png b/demo-ng/app/App_Resources/Android/drawable-ldpi/logo.png new file mode 100644 index 0000000..b9e102a Binary files /dev/null and b/demo-ng/app/App_Resources/Android/drawable-ldpi/logo.png differ diff --git a/demo-ng/app/App_Resources/Android/drawable-mdpi/background.png b/demo-ng/app/App_Resources/Android/drawable-mdpi/background.png new file mode 100644 index 0000000..efeaf29 Binary files /dev/null and b/demo-ng/app/App_Resources/Android/drawable-mdpi/background.png differ diff --git a/demo-ng/app/App_Resources/Android/drawable-mdpi/icon.png b/demo-ng/app/App_Resources/Android/drawable-mdpi/icon.png new file mode 100755 index 0000000..486e410 Binary files /dev/null and b/demo-ng/app/App_Resources/Android/drawable-mdpi/icon.png differ diff --git a/demo-ng/app/App_Resources/Android/drawable-mdpi/logo.png b/demo-ng/app/App_Resources/Android/drawable-mdpi/logo.png new file mode 100644 index 0000000..6263387 Binary files /dev/null and b/demo-ng/app/App_Resources/Android/drawable-mdpi/logo.png differ diff --git a/demo-ng/app/App_Resources/Android/drawable-nodpi/splash_screen.xml b/demo-ng/app/App_Resources/Android/drawable-nodpi/splash_screen.xml new file mode 100644 index 0000000..ada77f9 --- /dev/null +++ b/demo-ng/app/App_Resources/Android/drawable-nodpi/splash_screen.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/demo-ng/app/App_Resources/Android/drawable-xhdpi/background.png b/demo-ng/app/App_Resources/Android/drawable-xhdpi/background.png new file mode 100644 index 0000000..612bbd0 Binary files /dev/null and b/demo-ng/app/App_Resources/Android/drawable-xhdpi/background.png differ diff --git a/demo-ng/app/App_Resources/Android/drawable-xhdpi/icon.png b/demo-ng/app/App_Resources/Android/drawable-xhdpi/icon.png new file mode 100644 index 0000000..f291882 Binary files /dev/null and b/demo-ng/app/App_Resources/Android/drawable-xhdpi/icon.png differ diff --git a/demo-ng/app/App_Resources/Android/drawable-xhdpi/logo.png b/demo-ng/app/App_Resources/Android/drawable-xhdpi/logo.png new file mode 100644 index 0000000..ad8ee2f Binary files /dev/null and b/demo-ng/app/App_Resources/Android/drawable-xhdpi/logo.png differ diff --git a/demo-ng/app/App_Resources/Android/drawable-xxhdpi/background.png b/demo-ng/app/App_Resources/Android/drawable-xxhdpi/background.png new file mode 100644 index 0000000..0fa88e2 Binary files /dev/null and b/demo-ng/app/App_Resources/Android/drawable-xxhdpi/background.png differ diff --git a/demo-ng/app/App_Resources/Android/drawable-xxhdpi/icon.png b/demo-ng/app/App_Resources/Android/drawable-xxhdpi/icon.png new file mode 100644 index 0000000..4f69cb2 Binary files /dev/null and b/demo-ng/app/App_Resources/Android/drawable-xxhdpi/icon.png differ diff --git a/demo-ng/app/App_Resources/Android/drawable-xxhdpi/logo.png b/demo-ng/app/App_Resources/Android/drawable-xxhdpi/logo.png new file mode 100644 index 0000000..6683278 Binary files /dev/null and b/demo-ng/app/App_Resources/Android/drawable-xxhdpi/logo.png differ diff --git a/demo-ng/app/App_Resources/Android/drawable-xxxhdpi/background.png b/demo-ng/app/App_Resources/Android/drawable-xxxhdpi/background.png new file mode 100644 index 0000000..c650f64 Binary files /dev/null and b/demo-ng/app/App_Resources/Android/drawable-xxxhdpi/background.png differ diff --git a/demo-ng/app/App_Resources/Android/drawable-xxxhdpi/icon.png b/demo-ng/app/App_Resources/Android/drawable-xxxhdpi/icon.png new file mode 100644 index 0000000..50887a8 Binary files /dev/null and b/demo-ng/app/App_Resources/Android/drawable-xxxhdpi/icon.png differ diff --git a/demo-ng/app/App_Resources/Android/drawable-xxxhdpi/logo.png b/demo-ng/app/App_Resources/Android/drawable-xxxhdpi/logo.png new file mode 100644 index 0000000..fa6331c Binary files /dev/null and b/demo-ng/app/App_Resources/Android/drawable-xxxhdpi/logo.png differ diff --git a/demo-ng/app/App_Resources/Android/values-v21/colors.xml b/demo-ng/app/App_Resources/Android/values-v21/colors.xml new file mode 100644 index 0000000..a64641a --- /dev/null +++ b/demo-ng/app/App_Resources/Android/values-v21/colors.xml @@ -0,0 +1,4 @@ + + + #3d5afe + \ No newline at end of file diff --git a/demo-ng/app/App_Resources/Android/values-v21/styles.xml b/demo-ng/app/App_Resources/Android/values-v21/styles.xml new file mode 100644 index 0000000..dac8727 --- /dev/null +++ b/demo-ng/app/App_Resources/Android/values-v21/styles.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/demo-ng/app/App_Resources/Android/values/colors.xml b/demo-ng/app/App_Resources/Android/values/colors.xml new file mode 100644 index 0000000..74ad882 --- /dev/null +++ b/demo-ng/app/App_Resources/Android/values/colors.xml @@ -0,0 +1,7 @@ + + + #F5F5F5 + #757575 + #33B5E5 + #272734 + \ No newline at end of file diff --git a/demo-ng/app/App_Resources/Android/values/styles.xml b/demo-ng/app/App_Resources/Android/values/styles.xml new file mode 100644 index 0000000..1e8c7f2 --- /dev/null +++ b/demo-ng/app/App_Resources/Android/values/styles.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + diff --git a/demo-ng/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/Contents.json b/demo-ng/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..5f53593 --- /dev/null +++ b/demo-ng/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,128 @@ +{ + "images" : [ + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "icon-29.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "icon-29@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "icon-29@3x.png", + "scale" : "3x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "icon-40@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "icon-40@3x.png", + "scale" : "3x" + }, + { + "size" : "57x57", + "idiom" : "iphone", + "filename" : "icon-57.png", + "scale" : "1x" + }, + { + "size" : "57x57", + "idiom" : "iphone", + "filename" : "icon-57@2x.png", + "scale" : "2x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "icon-60@2x.png", + "scale" : "2x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "icon-60@3x.png", + "scale" : "3x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "icon-29.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "icon-29@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "icon-40.png", + "scale" : "1x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "icon-40@2x.png", + "scale" : "2x" + }, + { + "size" : "50x50", + "idiom" : "ipad", + "filename" : "icon-50.png", + "scale" : "1x" + }, + { + "size" : "50x50", + "idiom" : "ipad", + "filename" : "icon-50@2x.png", + "scale" : "2x" + }, + { + "size" : "72x72", + "idiom" : "ipad", + "filename" : "icon-72.png", + "scale" : "1x" + }, + { + "size" : "72x72", + "idiom" : "ipad", + "filename" : "icon-72@2x.png", + "scale" : "2x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "icon-76.png", + "scale" : "1x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "icon-76@2x.png", + "scale" : "2x" + }, + { + "size" : "83.5x83.5", + "idiom" : "ipad", + "filename" : "icon-83.5@2x.png", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/demo-ng/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png b/demo-ng/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png new file mode 100644 index 0000000..9e15af0 Binary files /dev/null and b/demo-ng/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png differ diff --git a/demo-ng/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png b/demo-ng/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png new file mode 100644 index 0000000..7b9e555 Binary files /dev/null and b/demo-ng/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png differ diff --git a/demo-ng/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png b/demo-ng/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png new file mode 100644 index 0000000..76f61ec Binary files /dev/null and b/demo-ng/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png differ diff --git a/demo-ng/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png b/demo-ng/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png new file mode 100644 index 0000000..15b06db Binary files /dev/null and b/demo-ng/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png differ diff --git a/demo-ng/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png b/demo-ng/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png new file mode 100644 index 0000000..585065f Binary files /dev/null and b/demo-ng/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png differ diff --git a/demo-ng/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png b/demo-ng/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png new file mode 100644 index 0000000..a450c42 Binary files /dev/null and b/demo-ng/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png differ diff --git a/demo-ng/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50.png b/demo-ng/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50.png new file mode 100755 index 0000000..4a62478 Binary files /dev/null and b/demo-ng/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50.png differ diff --git a/demo-ng/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50@2x.png b/demo-ng/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50@2x.png new file mode 100755 index 0000000..01ff7c1 Binary files /dev/null and b/demo-ng/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50@2x.png differ diff --git a/demo-ng/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57.png b/demo-ng/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57.png new file mode 100755 index 0000000..beea819 Binary files /dev/null and b/demo-ng/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57.png differ diff --git a/demo-ng/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57@2x.png b/demo-ng/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57@2x.png new file mode 100755 index 0000000..c3dc7b0 Binary files /dev/null and b/demo-ng/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57@2x.png differ diff --git a/demo-ng/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png b/demo-ng/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png new file mode 100644 index 0000000..457b6d9 Binary files /dev/null and b/demo-ng/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png differ diff --git a/demo-ng/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png b/demo-ng/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png new file mode 100644 index 0000000..fa5a6ac Binary files /dev/null and b/demo-ng/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png differ diff --git a/demo-ng/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72.png b/demo-ng/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72.png new file mode 100755 index 0000000..556bdd6 Binary files /dev/null and b/demo-ng/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72.png differ diff --git a/demo-ng/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72@2x.png b/demo-ng/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72@2x.png new file mode 100755 index 0000000..4f69cb2 Binary files /dev/null and b/demo-ng/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72@2x.png differ diff --git a/demo-ng/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png b/demo-ng/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png new file mode 100644 index 0000000..94abcf7 Binary files /dev/null and b/demo-ng/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png differ diff --git a/demo-ng/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png b/demo-ng/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png new file mode 100644 index 0000000..2e71dd3 Binary files /dev/null and b/demo-ng/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png differ diff --git a/demo-ng/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png b/demo-ng/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png new file mode 100644 index 0000000..4abc9ec Binary files /dev/null and b/demo-ng/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png differ diff --git a/demo-ng/app/App_Resources/iOS/Assets.xcassets/Contents.json b/demo-ng/app/App_Resources/iOS/Assets.xcassets/Contents.json new file mode 100644 index 0000000..da4a164 --- /dev/null +++ b/demo-ng/app/App_Resources/iOS/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/demo-ng/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Contents.json b/demo-ng/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Contents.json new file mode 100644 index 0000000..4414bad --- /dev/null +++ b/demo-ng/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Contents.json @@ -0,0 +1,158 @@ +{ + "images" : [ + { + "extent" : "full-screen", + "idiom" : "iphone", + "subtype" : "736h", + "filename" : "Default-736h@3x.png", + "minimum-system-version" : "8.0", + "orientation" : "portrait", + "scale" : "3x" + }, + { + "extent" : "full-screen", + "idiom" : "iphone", + "subtype" : "736h", + "filename" : "Default-Landscape@3x.png", + "minimum-system-version" : "8.0", + "orientation" : "landscape", + "scale" : "3x" + }, + { + "extent" : "full-screen", + "idiom" : "iphone", + "subtype" : "667h", + "filename" : "Default-667h@2x.png", + "minimum-system-version" : "8.0", + "orientation" : "portrait", + "scale" : "2x" + }, + { + "orientation" : "portrait", + "idiom" : "iphone", + "filename" : "Default@2x.png", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "2x" + }, + { + "extent" : "full-screen", + "idiom" : "iphone", + "subtype" : "retina4", + "filename" : "Default-568h@2x.png", + "minimum-system-version" : "7.0", + "orientation" : "portrait", + "scale" : "2x" + }, + { + "orientation" : "portrait", + "idiom" : "ipad", + "filename" : "Default-Portrait.png", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "1x" + }, + { + "orientation" : "landscape", + "idiom" : "ipad", + "filename" : "Default-Landscape.png", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "1x" + }, + { + "orientation" : "portrait", + "idiom" : "ipad", + "filename" : "Default-Portrait@2x.png", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "2x" + }, + { + "orientation" : "landscape", + "idiom" : "ipad", + "filename" : "Default-Landscape@2x.png", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "2x" + }, + { + "orientation" : "portrait", + "idiom" : "iphone", + "filename" : "Default.png", + "extent" : "full-screen", + "scale" : "1x" + }, + { + "orientation" : "portrait", + "idiom" : "iphone", + "filename" : "Default@2x.png", + "extent" : "full-screen", + "scale" : "2x" + }, + { + "orientation" : "portrait", + "idiom" : "iphone", + "filename" : "Default-568h@2x.png", + "extent" : "full-screen", + "subtype" : "retina4", + "scale" : "2x" + }, + { + "orientation" : "portrait", + "idiom" : "ipad", + "extent" : "to-status-bar", + "scale" : "1x" + }, + { + "orientation" : "portrait", + "idiom" : "ipad", + "filename" : "Default-Portrait.png", + "extent" : "full-screen", + "scale" : "1x" + }, + { + "orientation" : "landscape", + "idiom" : "ipad", + "extent" : "to-status-bar", + "scale" : "1x" + }, + { + "orientation" : "landscape", + "idiom" : "ipad", + "filename" : "Default-Landscape.png", + "extent" : "full-screen", + "scale" : "1x" + }, + { + "orientation" : "portrait", + "idiom" : "ipad", + "extent" : "to-status-bar", + "scale" : "2x" + }, + { + "orientation" : "portrait", + "idiom" : "ipad", + "filename" : "Default-Portrait@2x.png", + "extent" : "full-screen", + "scale" : "2x" + }, + { + "orientation" : "landscape", + "idiom" : "ipad", + "extent" : "to-status-bar", + "scale" : "2x" + }, + { + "orientation" : "landscape", + "idiom" : "ipad", + "filename" : "Default-Landscape@2x.png", + "extent" : "full-screen", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/demo-ng/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-568h@2x.png b/demo-ng/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-568h@2x.png new file mode 100644 index 0000000..d7f17fc Binary files /dev/null and b/demo-ng/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-568h@2x.png differ diff --git a/demo-ng/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-667h@2x.png b/demo-ng/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-667h@2x.png new file mode 100644 index 0000000..b884154 Binary files /dev/null and b/demo-ng/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-667h@2x.png differ diff --git a/demo-ng/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-736h@3x.png b/demo-ng/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-736h@3x.png new file mode 100644 index 0000000..faab4b6 Binary files /dev/null and b/demo-ng/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-736h@3x.png differ diff --git a/demo-ng/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape.png b/demo-ng/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape.png new file mode 100644 index 0000000..3365ba3 Binary files /dev/null and b/demo-ng/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape.png differ diff --git a/demo-ng/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@2x.png b/demo-ng/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@2x.png new file mode 100644 index 0000000..a44945c Binary files /dev/null and b/demo-ng/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@2x.png differ diff --git a/demo-ng/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@3x.png b/demo-ng/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@3x.png new file mode 100644 index 0000000..e6dca62 Binary files /dev/null and b/demo-ng/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@3x.png differ diff --git a/demo-ng/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait.png b/demo-ng/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait.png new file mode 100644 index 0000000..1a50079 Binary files /dev/null and b/demo-ng/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait.png differ diff --git a/demo-ng/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait@2x.png b/demo-ng/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait@2x.png new file mode 100644 index 0000000..73d8b92 Binary files /dev/null and b/demo-ng/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait@2x.png differ diff --git a/demo-ng/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default.png b/demo-ng/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default.png new file mode 100644 index 0000000..9f1f6ce Binary files /dev/null and b/demo-ng/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default.png differ diff --git a/demo-ng/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default@2x.png b/demo-ng/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default@2x.png new file mode 100644 index 0000000..514fc5c Binary files /dev/null and b/demo-ng/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default@2x.png differ diff --git a/demo-ng/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/Contents.json b/demo-ng/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/Contents.json new file mode 100644 index 0000000..4f4e9c5 --- /dev/null +++ b/demo-ng/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "LaunchScreen-AspectFill.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "LaunchScreen-AspectFill@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/demo-ng/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill.png b/demo-ng/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill.png new file mode 100644 index 0000000..c293f9c Binary files /dev/null and b/demo-ng/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill.png differ diff --git a/demo-ng/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@2x.png b/demo-ng/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@2x.png new file mode 100644 index 0000000..233693a Binary files /dev/null and b/demo-ng/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@2x.png differ diff --git a/demo-ng/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/Contents.json b/demo-ng/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/Contents.json new file mode 100644 index 0000000..23c0ffd --- /dev/null +++ b/demo-ng/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "LaunchScreen-Center.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "LaunchScreen-Center@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/demo-ng/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center.png b/demo-ng/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center.png new file mode 100644 index 0000000..a5a775a Binary files /dev/null and b/demo-ng/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center.png differ diff --git a/demo-ng/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@2x.png b/demo-ng/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@2x.png new file mode 100644 index 0000000..154c193 Binary files /dev/null and b/demo-ng/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@2x.png differ diff --git a/demo-ng/app/App_Resources/iOS/Info.plist b/demo-ng/app/App_Resources/iOS/Info.plist new file mode 100644 index 0000000..4a9a750 --- /dev/null +++ b/demo-ng/app/App_Resources/iOS/Info.plist @@ -0,0 +1,53 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleDisplayName + ${PRODUCT_NAME} + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIRequiresFullScreen + + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + NSAppTransportSecurity + + + NSAllowsArbitraryLoads + + + + diff --git a/demo-ng/app/App_Resources/iOS/LaunchScreen.storyboard b/demo-ng/app/App_Resources/iOS/LaunchScreen.storyboard new file mode 100644 index 0000000..2ad9471 --- /dev/null +++ b/demo-ng/app/App_Resources/iOS/LaunchScreen.storyboard @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/demo-ng/app/App_Resources/iOS/build.xcconfig b/demo-ng/app/App_Resources/iOS/build.xcconfig new file mode 100644 index 0000000..0481c51 --- /dev/null +++ b/demo-ng/app/App_Resources/iOS/build.xcconfig @@ -0,0 +1,9 @@ +// You can add custom settings here +// for example you can uncomment the following line to force distribution code signing +// CODE_SIGN_IDENTITY = iPhone Distribution +// To build for device with XCode 8 you need to specify your development team. More info: https://developer.apple.com/library/prerelease/content/releasenotes/DeveloperTools/RN-Xcode/Introduction.html +// DEVELOPMENT_TEAM = YOUR_TEAM_ID; +ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; +ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; + +DEVELOPMENT_TEAM = JVX5SR538Q diff --git a/demo-ng/app/app.component.html b/demo-ng/app/app.component.html new file mode 100644 index 0000000..41b82cc --- /dev/null +++ b/demo-ng/app/app.component.html @@ -0,0 +1 @@ + diff --git a/demo-ng/app/app.component.ts b/demo-ng/app/app.component.ts new file mode 100644 index 0000000..ed6521c --- /dev/null +++ b/demo-ng/app/app.component.ts @@ -0,0 +1,7 @@ +import { Component } from "@angular/core"; + +@Component({ + selector: "ns-app", + templateUrl: "app.component.html", +}) +export class AppComponent { } diff --git a/demo-ng/app/app.css b/demo-ng/app/app.css new file mode 100644 index 0000000..1e3ad0f --- /dev/null +++ b/demo-ng/app/app.css @@ -0,0 +1,16 @@ +/* +In NativeScript, the app.css file is where you place CSS rules that +you would like to apply to your entire application. Check out +http://docs.nativescript.org/ui/styling for a full list of the CSS +selectors and properties you can use to style UI components. + +/* +In many cases you may want to use the NativeScript core theme instead +of writing your own CSS rules. For a full list of class names in the theme +refer to http://docs.nativescript.org/ui/theme. +*/ +@import 'nativescript-theme-core/css/core.light.css'; + +.btn { + font-size: 24; +} \ No newline at end of file diff --git a/demo-ng/app/app.module.ts b/demo-ng/app/app.module.ts new file mode 100644 index 0000000..dfee611 --- /dev/null +++ b/demo-ng/app/app.module.ts @@ -0,0 +1,32 @@ +import { NgModule, NO_ERRORS_SCHEMA } from "@angular/core"; +import { NativeScriptModule } from "nativescript-angular/nativescript.module"; +import { NativeScriptFormsModule } from "nativescript-angular/forms"; + +import { PagerModule } from "nativescript-pager/angular"; + +import { AppRoutingModule } from "./app.routing"; +import { AppComponent } from "./app.component"; + +import { TestComponent } from "./test/test.component"; + +@NgModule({ + bootstrap: [ + AppComponent + ], + imports: [ + NativeScriptModule, + NativeScriptFormsModule, + AppRoutingModule, + PagerModule, + ], + declarations: [ + AppComponent, + TestComponent, + ], + providers: [ + ], + schemas: [ + NO_ERRORS_SCHEMA + ] +}) +export class AppModule { } diff --git a/demo-ng/app/app.routing.ts b/demo-ng/app/app.routing.ts new file mode 100644 index 0000000..8b15fe3 --- /dev/null +++ b/demo-ng/app/app.routing.ts @@ -0,0 +1,16 @@ +import { NgModule } from "@angular/core"; +import { NativeScriptRouterModule } from "nativescript-angular/router"; +import { Routes } from "@angular/router"; + +import { TestComponent } from "./test/test.component"; + +const routes: Routes = [ + { path: "", redirectTo: "/test", pathMatch: "full" }, + { path: "test", component: TestComponent }, +]; + +@NgModule({ + imports: [NativeScriptRouterModule.forRoot(routes)], + exports: [NativeScriptRouterModule] +}) +export class AppRoutingModule { } \ No newline at end of file diff --git a/demo-ng/app/main.aot.ts b/demo-ng/app/main.aot.ts new file mode 100644 index 0000000..8f033e9 --- /dev/null +++ b/demo-ng/app/main.aot.ts @@ -0,0 +1,6 @@ +// this import should be first in order to load some required settings (like globals and reflect-metadata) +import { platformNativeScript } from "nativescript-angular/platform-static"; + +import { AppModuleNgFactory } from "./app.module.ngfactory"; + +platformNativeScript().bootstrapModuleFactory(AppModuleNgFactory); diff --git a/demo-ng/app/main.ts b/demo-ng/app/main.ts new file mode 100644 index 0000000..1057aef --- /dev/null +++ b/demo-ng/app/main.ts @@ -0,0 +1,6 @@ +// this import should be first in order to load some required settings (like globals and reflect-metadata) +import { platformNativeScriptDynamic } from "nativescript-angular/platform"; + +import { AppModule } from "./app.module"; + +platformNativeScriptDynamic().bootstrapModule(AppModule); diff --git a/demo-ng/app/package.json b/demo-ng/app/package.json new file mode 100644 index 0000000..8f5374a --- /dev/null +++ b/demo-ng/app/package.json @@ -0,0 +1,8 @@ +{ + "android": { + "v8Flags": "--expose_gc" + }, + "main": "main.js", + "name": "tns-template-hello-world-ng", + "version": "2.5.0" +} \ No newline at end of file diff --git a/demo-ng/app/test/test.component.html b/demo-ng/app/test/test.component.html new file mode 100644 index 0000000..63746d5 --- /dev/null +++ b/demo-ng/app/test/test.component.html @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/demo-ng/app/test/test.component.ts b/demo-ng/app/test/test.component.ts new file mode 100644 index 0000000..082e98f --- /dev/null +++ b/demo-ng/app/test/test.component.ts @@ -0,0 +1,53 @@ +import { Component, OnInit, ViewChild, ElementRef } from "@angular/core"; + +@Component({ + selector: "ns-test", + moduleId: module.id, + templateUrl: "./test.component.html", +}) +export class TestComponent implements OnInit { + + numItems = 10; + currentPagerIndex = 0; + latestReceivedIndex = 0; + + @ViewChild('pager') pager: any; + + constructor() { } + + ngOnInit(): void { + } + + loadedImage($event) { + console.log(`loaded image ${JSON.stringify($event)}`); + } + + prevPage() { + // this.debugObj(this.pager); + const newIndex = Math.max(0, this.latestReceivedIndex - 1); + this.currentPagerIndex = newIndex; + this.latestReceivedIndex = newIndex; + } + + nextPage() { + const newIndex = Math.min(this.numItems - 1, this.latestReceivedIndex + 1); + this.currentPagerIndex = newIndex; + this.latestReceivedIndex = newIndex; + } + + onIndexChanged($event) { + debugObj($event); + this.latestReceivedIndex = $event.newIndex; + } + + pageChanged(index: number) { + console.log(`pageChanged ${JSON.stringify(index)}`); + debugObj(index); + } +} + +function debugObj(obj: any) { + for (const key of Object.keys(obj)) { + console.log(`${key} = ${obj[key]}`); + } +} diff --git a/demo-ng/package.json b/demo-ng/package.json new file mode 100644 index 0000000..a41e9cb --- /dev/null +++ b/demo-ng/package.json @@ -0,0 +1,41 @@ +{ + "description": "NativeScript Application", + "license": "SEE LICENSE IN ", + "readme": "NativeScript Application", + "repository": "", + "nativescript": { + "id": "org.nativescript.demong", + "tns-ios": { + "version": "2.5.0" + }, + "tns-android": { + "version": "2.5.0" + } + }, + "dependencies": { + "@angular/common": "2.4.3", + "@angular/compiler": "2.4.3", + "@angular/core": "2.4.3", + "@angular/forms": "2.4.3", + "@angular/http": "2.4.3", + "@angular/platform-browser": "2.4.3", + "@angular/platform-browser-dynamic": "2.4.3", + "@angular/router": "3.4.3", + "nativescript-angular": "1.4.0", + "nativescript-pager": "..", + "nativescript-theme-core": "~1.0.2", + "reflect-metadata": "~0.1.8", + "rxjs": "~5.0.1", + "tns-core-modules": "2.5.0" + }, + "devDependencies": { + "babel-traverse": "6.23.1", + "babel-types": "6.23.0", + "babylon": "6.15.0", + "lazy": "1.0.11", + "nativescript-dev-android-snapshot": "^0.*.*", + "nativescript-dev-typescript": "~0.3.7", + "typescript": "^2.1.6", + "zone.js": "~0.7.2" + } +} diff --git a/demo-ng/tsconfig.json b/demo-ng/tsconfig.json new file mode 100644 index 0000000..5dab2b0 --- /dev/null +++ b/demo-ng/tsconfig.json @@ -0,0 +1,15 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es5", + "experimentalDecorators": true, + "emitDecoratorMetadata": true, + "noEmitHelpers": true, + "noEmitOnError": false + }, + "exclude": [ + "node_modules", + "platforms", + "**/*.aot.ts" + ] +} \ No newline at end of file diff --git a/package.json b/package.json index 69d563f..b6f509c 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,11 @@ "demo.android": "npm run preparedemo && cd demo && tns run android", "preparedemo": "npm run build && npm run reload", "reload": "cd demo && tns plugin remove nativescript-pager && tns plugin add .. && tns install", + "ng.preparedemo": "npm run build && npm run ng.reload", + "ng.reload": "cd demo-ng && tns plugin remove nativescript-pager && tns plugin add ..", + "ng.demo.ios": "npm run ng.preparedemo && cd demo-ng && tns emulate ios", + "ng.demo.ios.device": "npm run ng.preparedemo && cd demo-ng && tns run ios", + "ng.demo.android": "npm run ng.preparedemo && cd demo-ng && tns run android", "setup": "npm i && cd demo && npm i && cd .. && npm run build && cd demo && tns plugin add .. && cd ..", "postclone": "npm i && node scripts/postclone.js" },