From 2269c68450c61509f75dcb4dc14c80832e71acdf Mon Sep 17 00:00:00 2001 From: Benjamin Grand Date: Tue, 17 Dec 2019 19:40:46 +0100 Subject: [PATCH] Release v0.2.0 --- LICENSE | 0 README.md | 19 ++ .../src/main/res/values-v21/styles.xml | 9 +- .../Android/src/main/res/values/styles.xml | 4 +- demo-ng/package.json | 16 +- demo-ng/src/app.css | 73 ++++- demo-ng/src/app/home/home.component.html | 90 ++++-- demo-ng/src/app/home/home.component.ts | 198 ++++++++++-- demo-ng/tsconfig.json | 7 +- demo-ng/webpack.config.js | 26 +- .../src/main/res/values-v21/styles.xml | 9 +- .../Android/src/main/res/values/styles.xml | 4 +- demo-ts/app/app.css | 75 ++++- demo-ts/app/app.ts | 4 +- demo-ts/app/home/home-page.ts | 201 ++++++++++-- demo-ts/app/home/home-page.xml | 101 ++++-- demo-ts/app/home/home-view-model.ts | 7 - demo-ts/package.json | 16 +- demo-ts/webpack.config.js | 20 +- .../src/main/res/values-v21/styles.xml | 9 +- .../Android/src/main/res/values/styles.xml | 4 +- demo-vue/app/_app-common.scss | 7 - demo-vue/app/_app-variables.scss | 78 ----- demo-vue/app/app.scss | 9 - demo-vue/app/components/Home.vue | 295 ++++++++++++++---- demo-vue/app/fonts/FontAwesome.ttf | Bin 165548 -> 0 bytes demo-vue/package.json | 18 +- demo-vue/webpack.config.js | 39 ++- .../src/main/res/values-v21/styles.xml | 9 +- .../Android/src/main/res/values/styles.xml | 4 +- demo/app/app.css | 75 ++++- demo/app/home/home-page.js | 182 +++++++++-- demo/app/home/home-page.xml | 99 ++++-- demo/app/home/home-view-model.js | 11 - demo/app/references.d.ts | 2 +- demo/package.json | 14 +- demo/webpack.config.js | 15 +- publish/package.json | 0 src/.npmignore | 16 +- src/README.md | 19 ++ src/getters.ts | 98 +++--- src/methods/_utilities.method.d.ts | 4 +- src/methods/_utilities.method.ts | 16 +- src/methods/classes.method.d.ts | 2 +- src/methods/classes.method.ts | 15 +- src/methods/identifiers.method.d.ts | 2 +- src/methods/identifiers.method.ts | 12 +- src/methods/properties.method.d.ts | 2 +- src/methods/properties.method.ts | 11 +- src/methods/tags.method.d.ts | 2 +- src/methods/tags.method.ts | 12 +- src/methods/types.method.d.ts | 2 +- src/methods/types.method.ts | 22 +- src/methods/value-pairs.method.d.ts | 4 +- src/methods/value-pairs.method.ts | 17 +- src/models/getters-methods.model.d.ts | 93 +++++- src/models/getters-methods.model.ts | 9 +- src/models/value-pairs.model.d.ts | 6 + src/package.json | 13 +- src/tsconfig.json | 21 +- src/typings/extended-frame.d.ts | 7 +- src/typings/extended-layouts.d.ts | 7 +- src/typings/extended-page.d.ts | 7 +- src/typings/extended-tabs.d.ts | 7 +- src/typings/extended-texts.d.ts | 7 +- 65 files changed, 1636 insertions(+), 546 deletions(-) mode change 100644 => 100755 LICENSE mode change 100644 => 100755 README.md delete mode 100644 demo-ts/app/home/home-view-model.ts delete mode 100644 demo-vue/app/_app-common.scss delete mode 100644 demo-vue/app/_app-variables.scss delete mode 100644 demo-vue/app/app.scss delete mode 100644 demo-vue/app/fonts/FontAwesome.ttf delete mode 100644 demo/app/home/home-view-model.js mode change 100644 => 100755 publish/package.json mode change 100644 => 100755 src/.npmignore mode change 100644 => 100755 src/README.md mode change 100644 => 100755 src/methods/_utilities.method.ts mode change 100644 => 100755 src/methods/classes.method.ts mode change 100644 => 100755 src/methods/identifiers.method.ts mode change 100644 => 100755 src/methods/properties.method.ts mode change 100644 => 100755 src/methods/tags.method.ts mode change 100644 => 100755 src/methods/types.method.ts mode change 100644 => 100755 src/methods/value-pairs.method.ts diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 index 113abee..386bee1 --- a/README.md +++ b/README.md @@ -59,6 +59,25 @@ import "nativescript-getters"; > New methods have been added in the Frame, Page, tabs, layouts and texts classes. (see all [methods](#methods)) +### Vue.js + +The plugin may not work properly with these symlinked. It is because webpack resolves symlinks to their real locations by default. + +A workaround for this issue is to manually disable symlinks resolution in webpack: + +```javascript +const config = { + // ... + resolve: { + // ... + // resolve symlinks to symlinked modules + symlinks: false, // default: true + // ... + } + // ... +}; +``` + ### Examples #### Get views by tags diff --git a/demo-ng/App_Resources/Android/src/main/res/values-v21/styles.xml b/demo-ng/App_Resources/Android/src/main/res/values-v21/styles.xml index acff7c9..1917ea1 100644 --- a/demo-ng/App_Resources/Android/src/main/res/values-v21/styles.xml +++ b/demo-ng/App_Resources/Android/src/main/res/values-v21/styles.xml @@ -1,12 +1,16 @@ - + - + + \ No newline at end of file diff --git a/demo-ng/App_Resources/Android/src/main/res/values/styles.xml b/demo-ng/App_Resources/Android/src/main/res/values/styles.xml index 20a82f4..4f91b61 100644 --- a/demo-ng/App_Resources/Android/src/main/res/values/styles.xml +++ b/demo-ng/App_Resources/Android/src/main/res/values/styles.xml @@ -10,8 +10,8 @@ @color/ns_accent @drawable/splash_screen - - true + + true true diff --git a/demo-ng/package.json b/demo-ng/package.json index 98de4db..77bb6e4 100644 --- a/demo-ng/package.json +++ b/demo-ng/package.json @@ -2,10 +2,10 @@ "nativescript": { "id": "org.nativescript.demong", "tns-android": { - "version": "6.1.2" + "version": "6.2.0" }, "tns-ios": { - "version": "6.1.0" + "version": "6.2.0" } }, "description": "NativeScript Application", @@ -20,20 +20,20 @@ "@angular/platform-browser": "~8.2.0", "@angular/platform-browser-dynamic": "~8.2.0", "@angular/router": "~8.2.0", - "nativescript-angular": "~8.2.0", - "nativescript-getters": "^0.1.2", - "nativescript-theme-core": "~1.0.6", + "@nativescript/theme": "~2.2.0", + "nativescript-angular": "~8.20.0", + "nativescript-getters": "file:../src", "reflect-metadata": "~0.1.12", "rxjs": "^6.4.0", - "tns-core-modules": "~6.1.0", + "tns-core-modules": "~6.2.3", "zone.js": "~0.9.1" }, "devDependencies": { "@angular/compiler-cli": "~8.2.0", "@ngtools/webpack": "~8.2.0", - "nativescript-dev-webpack": "~1.2.0", + "nativescript-dev-webpack": "~1.3.0", "typescript": "~3.5.3" }, - "gitHead": "1964ea9e8ca1a0518e0d6370781eedcf6c23db42", + "gitHead": "a6fec076a20f898feabb4466a2c411158c18a100", "readme": "NativeScript Application" } diff --git a/demo-ng/src/app.css b/demo-ng/src/app.css index 4a4fdb0..72e5a47 100644 --- a/demo-ng/src/app.css +++ b/demo-ng/src/app.css @@ -1,20 +1,69 @@ +@import "~@nativescript/theme/css/core.css"; +@import "~@nativescript/theme/css/default.css"; + +/* + ICONS FONT +*/ + +.fas { + font-family: "Font Awesome 5 Free", "fa-solid-900"; + font-weight: 900; +} + /* -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. + LAYOUTS +*/ + +StackLayout, +WrapLayout { + horizontal-align: center; +} /* -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. + IMAGES */ -@import '~nativescript-theme-core/css/core.light.css'; + +Image { + width: 50; + height: 50; + load-mode: async; +} + +Image + Image { + margin-left: 10; +} /* -For example, the following CSS rule changes the font size of all UI -components that have the btn class name. + PICKERS */ -.btn { - font-size: 18; + +DatePicker, +TimePicker { + height: 80; +} + +DatePicker + TimePicker { + margin-left: 10; +} + +/* + TEXTS +*/ + +TextField, +TextView { + padding: 10; + border-width: 1; + border-style: solid; + border-color: black; + border-radius: 10; + placeholder-color: gray; +} + +/* + SLIDER +*/ + +Slider { + width: 100%; } diff --git a/demo-ng/src/app/home/home.component.html b/demo-ng/src/app/home/home.component.html index eb0430f..4ed4f86 100644 --- a/demo-ng/src/app/home/home.component.html +++ b/demo-ng/src/app/home/home.component.html @@ -1,40 +1,80 @@ - - + + + + + + + - - + + + - - + + - - + + + + + + - - + - + + + - - + - - + + - + + + + - - + + - - + + + + + + - + + - + + + + + + - - + - + + + + + + + + + + + + + + + + + + + diff --git a/demo-ng/src/app/home/home.component.ts b/demo-ng/src/app/home/home.component.ts index ae2f533..42b3938 100644 --- a/demo-ng/src/app/home/home.component.ts +++ b/demo-ng/src/app/home/home.component.ts @@ -1,40 +1,196 @@ -import { Component, AfterViewChecked } from "@angular/core"; - +import { Component, AfterContentInit } from "@angular/core"; import { Page } from "tns-core-modules/ui/page"; -import { View } from "tns-core-modules/ui/core/view"; -import { StackLayout } from "tns-core-modules/ui/layouts/stack-layout"; +import { ScrollView } from "tns-core-modules/ui/scroll-view"; +import { LayoutBase, StackLayout, WrapLayout, FlexboxLayout } from "tns-core-modules/ui/layouts"; +import { ActionBar, ActionItem } from "tns-core-modules/ui/action-bar"; +import { Label } from "tns-core-modules/ui/label"; +import { isIOS } from "tns-core-modules/platform"; +import { Switch } from "tns-core-modules/ui/switch"; +import { Image } from "tns-core-modules/ui/image"; +import { Slider } from "tns-core-modules/ui/slider"; +import { EventData } from "tns-core-modules/data/observable"; +import { TextBase } from "tns-core-modules/ui/text-base"; +import { DatePicker } from "tns-core-modules/ui/date-picker"; +import { TimePicker } from "tns-core-modules/ui/time-picker"; +import { AnimationCurve } from "tns-core-modules/ui/enums"; @Component({ selector: "Home", templateUrl: "./home.component.html" }) -export class HomeComponent implements AfterViewChecked { +export class HomeComponent implements AfterContentInit { - constructor(private _page: Page) { + constructor(private page: Page) { // Use the component constructor to inject providers. } - ngAfterViewChecked(): void { - // Init your component properties here. + ngAfterContentInit(): void { + + const scrollView = this.page.layoutView as ScrollView; + const mainLayout = scrollView.content as LayoutBase; + + /* + GET VIEWS BY TAG + */ + + const actionBar = this.page.getViewsByTag("ActionBar")[0] as ActionBar; + const actionItems = actionBar.actionItems.getItems() as Array; + + console.log("-#########-- GET VIEWS BY TAG -> ACTION BAR --#########-", actionBar); + console.log("-#########-- ACTION BAR -> ACTION ITEMS --#########-", actionItems); + + actionItems.map((actionItem: ActionItem) => { + + actionItem.className = "fas"; + + }); + + /* + GET VIEWS BY TAGS + */ + + const wsLayouts = mainLayout.getViewsByTags("WrapLayout", "StackLayout") as Array; + + console.log("-#########-- GET VIEWS BY TAGS -> WRAP & STACK LAYOUTS --#########-", wsLayouts); + + wsLayouts.map((wsLayout: WrapLayout|StackLayout) => { + + wsLayout.orientation = "horizontal"; + + }); + + /* + GET VIEWS BY TYPE + */ + + const layouts = mainLayout.getViewsByType("layout") as Array; + + console.log("-#########-- GET VIEWS BY TYPE -> ALL LAYOUTS --#########-", layouts); + + layouts.map((layout: LayoutBase) => { + + layout.marginTop = 20; + + }); + + /* + GET VIEWS BY PROPERTY & CLASS + */ + + const flexboxLayout = mainLayout.getViewsByProperty("flexDirection")[0] as FlexboxLayout; + const titles = flexboxLayout.getViewsByClass("h1") as Array