diff --git a/.gitignore b/.gitignore index adedb08..f4d0fdc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ .vscode/ .idea/ node_modules/ +hooks/ *.js *.js.map *.esm.json @@ -19,4 +20,6 @@ demo-vue/platforms/ /src/*.tgz /publish/package/*.tgz /publish/package/**/* -/publish/src/**/* \ No newline at end of file +/publish/src/**/* + +!webpack.config.js diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..b57da5f --- /dev/null +++ b/.prettierrc @@ -0,0 +1,6 @@ +{ + "singleQuote": true, + "semi": true, + "arrowParens": "avoid", + "trailingComma": "none" +} diff --git a/demo-angular/angular.json b/demo-angular/angular.json index ef95d52..24738ec 100644 --- a/demo-angular/angular.json +++ b/demo-angular/angular.json @@ -14,4 +14,4 @@ } }, "defaultProject": "blank" -} \ No newline at end of file +} diff --git a/demo-angular/nativescript.config.ts b/demo-angular/nativescript.config.ts new file mode 100644 index 0000000..f9e4414 --- /dev/null +++ b/demo-angular/nativescript.config.ts @@ -0,0 +1,14 @@ +import { NativeScriptConfig } from '@nativescript/core'; + +export default { + id: 'org.nativescript.datetimepicker.demong', + appResourcesPath: 'App_Resources', + android: { + v8Flags: '--expose_gc', + markingMode: 'none', + requireModules: { + 0: 'nativescript-datetimepicker' + } + }, + appPath: 'src' +} as NativeScriptConfig; diff --git a/demo-angular/nsconfig.json b/demo-angular/nsconfig.json deleted file mode 100644 index b38346b..0000000 --- a/demo-angular/nsconfig.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "appResourcesPath": "App_Resources", - "appPath": "src" -} \ No newline at end of file diff --git a/demo-angular/package.json b/demo-angular/package.json index 821ee23..513863b 100644 --- a/demo-angular/package.json +++ b/demo-angular/package.json @@ -1,13 +1,4 @@ { - "nativescript": { - "id": "org.nativescript.datetimepicker.demong", - "tns-android": { - "version": "6.2.0" - }, - "tns-ios": { - "version": "6.2.0" - } - }, "description": "NativeScript DateTimePicker Demo NG", "license": "SEE LICENSE IN LICENSE FILE", "repository": "https://github.com/NativeScript/nativescript-datetimepicker", @@ -18,29 +9,32 @@ "e2e-watch": "tsc -p e2e --watch" }, "dependencies": { - "@angular/animations": "~8.2.0", - "@angular/common": "~8.2.0", - "@angular/compiler": "~8.2.0", - "@angular/core": "~8.2.0", - "@angular/forms": "~8.2.0", - "@angular/platform-browser": "~8.2.0", - "@angular/platform-browser-dynamic": "~8.2.0", - "@angular/router": "~8.2.0", - "nativescript-angular": "~8.20.0", + "@angular/animations": "~10.1.0", + "@angular/common": "~10.1.0", + "@angular/compiler": "~10.1.0", + "@angular/core": "~10.1.0", + "@angular/forms": "~10.1.0", + "@angular/platform-browser": "~10.1.0", + "@angular/platform-browser-dynamic": "~10.1.0", + "@angular/router": "~10.1.0", "nativescript-datetimepicker": "file:../src", "nativescript-theme-core": "~1.0.4", "reflect-metadata": "~0.1.10", "rxjs": "^6.4.0", - "tns-core-modules": "^6.0.0", - "zone.js": "^0.9.1" + "zone.js": "^0.9.1", + "@nativescript/core": "~7.0.13", + "@nativescript/angular": "~10.1.7" }, "devDependencies": { - "@angular/compiler-cli": "~8.2.0", - "@ngtools/webpack": "~8.2.0", + "@angular/compiler-cli": "~10.1.0", + "@nativescript/android": "7.0.1", + "@nativescript/ios": "7.0.5", + "@nativescript/webpack": "~3.0.8", + "@ngtools/webpack": "~10.1.0", "@types/node": "~10.12.18", - "nativescript-dev-webpack": "^1.3.0", - "tslint": "~5.11.0", - "typescript": "~3.5.3" + "tslint": "~6.1.3", + "typescript": "3.9.7" }, - "readme": "NativeScript DateTimePicker Demo NG" + "readme": "NativeScript DateTimePicker Demo NG", + "main": "main.js" } diff --git a/demo-angular/src/app.css b/demo-angular/src/app.css index 7835add..2c1256e 100644 --- a/demo-angular/src/app.css +++ b/demo-angular/src/app.css @@ -16,5 +16,5 @@ For example, the following CSS rule changes the font size of all UI components that have the btn class name. */ .btn { - font-size: 18; -} \ No newline at end of file + font-size: 18; +} diff --git a/demo-angular/src/app/app-routing.module.ts b/demo-angular/src/app/app-routing.module.ts index 8317fd8..22b769f 100644 --- a/demo-angular/src/app/app-routing.module.ts +++ b/demo-angular/src/app/app-routing.module.ts @@ -1,14 +1,14 @@ -import { NgModule } from "@angular/core"; -import { Routes } from "@angular/router"; -import { NativeScriptRouterModule } from "nativescript-angular/router"; +import { NgModule } from '@angular/core'; +import { Routes } from '@angular/router'; +import { NativeScriptRouterModule } from '@nativescript/angular'; const routes: Routes = [ - { path: "", redirectTo: "/home", pathMatch: "full" }, - { path: "home", loadChildren: "~/app/home/home.module#HomeModule" } + { path: '', redirectTo: '/home', pathMatch: 'full' }, + { path: 'home', loadChildren: '~/app/home/home.module#HomeModule' } ]; @NgModule({ - imports: [NativeScriptRouterModule.forRoot(routes)], - exports: [NativeScriptRouterModule] + imports: [NativeScriptRouterModule.forRoot(routes)], + exports: [NativeScriptRouterModule] }) -export class AppRoutingModule { } +export class AppRoutingModule {} diff --git a/demo-angular/src/app/app.component.ts b/demo-angular/src/app/app.component.ts index 395b442..3428f92 100644 --- a/demo-angular/src/app/app.component.ts +++ b/demo-angular/src/app/app.component.ts @@ -1,8 +1,8 @@ -import { Component } from "@angular/core"; +import { Component } from '@angular/core'; @Component({ - moduleId: module.id, - selector: "ns-app", - templateUrl: "app.component.html" + moduleId: module.id, + selector: 'ns-app', + templateUrl: 'app.component.html' }) -export class AppComponent { } +export class AppComponent {} diff --git a/demo-angular/src/app/app.module.ts b/demo-angular/src/app/app.module.ts index e531604..1411b35 100644 --- a/demo-angular/src/app/app.module.ts +++ b/demo-angular/src/app/app.module.ts @@ -1,22 +1,12 @@ -import { NgModule, NO_ERRORS_SCHEMA } from "@angular/core"; -import { NativeScriptModule } from "nativescript-angular/nativescript.module"; - -import { AppRoutingModule } from "./app-routing.module"; -import { AppComponent } from "./app.component"; +import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core'; +import { NativeScriptModule } from '@nativescript/angular'; +import { AppRoutingModule } from './app-routing.module'; +import { AppComponent } from './app.component'; @NgModule({ - bootstrap: [ - AppComponent - ], - imports: [ - NativeScriptModule, - AppRoutingModule - ], - declarations: [ - AppComponent - ], - schemas: [ - NO_ERRORS_SCHEMA - ] + bootstrap: [AppComponent], + imports: [NativeScriptModule, AppRoutingModule], + declarations: [AppComponent], + schemas: [NO_ERRORS_SCHEMA] }) -export class AppModule { } +export class AppModule {} diff --git a/demo-angular/src/app/home/home-routing.module.ts b/demo-angular/src/app/home/home-routing.module.ts index a697bdb..43d76c1 100644 --- a/demo-angular/src/app/home/home-routing.module.ts +++ b/demo-angular/src/app/home/home-routing.module.ts @@ -1,15 +1,12 @@ -import { NgModule } from "@angular/core"; -import { Routes } from "@angular/router"; -import { NativeScriptRouterModule } from "nativescript-angular/router"; +import { NgModule } from '@angular/core'; +import { Routes } from '@angular/router'; +import { NativeScriptRouterModule } from '@nativescript/angular'; +import { HomeComponent } from './home.component'; -import { HomeComponent } from "./home.component"; - -const routes: Routes = [ - { path: "", component: HomeComponent } -]; +const routes: Routes = [{ path: '', component: HomeComponent }]; @NgModule({ - imports: [NativeScriptRouterModule.forChild(routes)], - exports: [NativeScriptRouterModule] + imports: [NativeScriptRouterModule.forChild(routes)], + exports: [NativeScriptRouterModule] }) -export class HomeRoutingModule { } +export class HomeRoutingModule {} diff --git a/demo-angular/src/app/home/home.component.css b/demo-angular/src/app/home/home.component.css index c33ffc6..3e0b0e2 100644 --- a/demo-angular/src/app/home/home.component.css +++ b/demo-angular/src/app/home/home.component.css @@ -1,48 +1,48 @@ .content { - font-size: 16; - font-weight: bold; - margin-top: 12; - margin-bottom: 6; - color: #303F9F; + font-size: 16; + font-weight: bold; + margin-top: 12; + margin-bottom: 6; + color: #303f9f; } .header { - font-size: 16; - margin-top: 12; - margin-bottom: 6; - color: white; - background-color: #2196F3; - text-align: center; + font-size: 16; + margin-top: 12; + margin-bottom: 6; + color: white; + background-color: #2196f3; + text-align: center; } label { - padding: 6 4; + padding: 6 4; } timepickerfield, datepickerfield { - padding: 12 4; + padding: 12 4; } timepickerfield.apply-css, datepickerfield.apply-css { - color: #CDDC39; - background-color: #00796B; - font-size: 20; - font-weight: bold; - padding: 20; + color: #cddc39; + background-color: #00796b; + font-size: 20; + font-weight: bold; + padding: 20; } .date-time-picker.apply-css { - color: #00796B; - background-color: #CDDC39; + color: #00796b; + background-color: #cddc39; } .date-time-picker-spinners.apply-css { - color: #CDDC39; - background-color: #00796B; + color: #cddc39; + background-color: #00796b; } .date-time-picker-buttons.apply-css { - color: #00796B; -} \ No newline at end of file + color: #00796b; +} diff --git a/demo-angular/src/app/home/home.component.html b/demo-angular/src/app/home/home.component.html index 5bd5be4..8cae03e 100644 --- a/demo-angular/src/app/home/home.component.html +++ b/demo-angular/src/app/home/home.component.html @@ -1,168 +1,385 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/demo-angular/src/app/home/home.component.ts b/demo-angular/src/app/home/home.component.ts index 8f4e9e2..ada7c7f 100644 --- a/demo-angular/src/app/home/home.component.ts +++ b/demo-angular/src/app/home/home.component.ts @@ -1,142 +1,156 @@ -import { Component, OnInit, ViewChild, ElementRef } from "@angular/core"; -import { DateTimePicker } from "nativescript-datetimepicker"; -import { EventData } from "tns-core-modules/data/observable"; -import { Button } from "tns-core-modules/ui/button"; +import { Component, ElementRef, OnInit, ViewChild } from '@angular/core'; +import { Button, EventData } from '@nativescript/core'; +import { DateTimePicker } from 'nativescript-datetimepicker'; @Component({ - selector: "Home", - moduleId: module.id, - templateUrl: "./home.component.html", - styleUrls: ['home.component.css'] + selector: 'Home', + moduleId: module.id, + templateUrl: './home.component.html', + styleUrls: ['home.component.css'] }) export class HomeComponent implements OnInit { - public dateText: string = "tap to select date"; - public timeText: string = "tap to select time"; - public dateTimeText: string = "tap to select date and time"; - public dateTime1: Date = new Date(); - public dateTime2: Date = new Date(); - public dateTime3: Date = new Date(); - public dateOpacity: number; - public timeOpacity: number; - public dateTimeOpacity: number; - public customOpacity: number; - public dateVisibility: string; - public timeVisibility: string; - public dateTimeVisibility: string; - public customVisibility: string; - private _expandedId: string; + public dateText: string = 'tap to select date'; + public timeText: string = 'tap to select time'; + public dateTimeText: string = 'tap to select date and time'; + public dateTime1: Date = new Date(); + public dateTime2: Date = new Date(); + public dateTime3: Date = new Date(); + public dateOpacity: number; + public timeOpacity: number; + public dateTimeOpacity: number; + public customOpacity: number; + public dateVisibility: string; + public timeVisibility: string; + public dateTimeVisibility: string; + public customVisibility: string; + private _expandedId: string; - @ViewChild("scrollView", { static: false }) scrollView: ElementRef; + @ViewChild('scrollView', { static: false }) scrollView: ElementRef; - constructor() { - // Use the component constructor to inject providers. - this.expandCollapse(null); - } + constructor() { + // Use the component constructor to inject providers. + this.expandCollapse(null); + } - ngOnInit(): void { - // Init your component properties here. - } + ngOnInit(): void { + // Init your component properties here. + } - onPickDateTap(args: EventData): void { - const dateToday = new Date(); - const dateTomorrow = new Date(dateToday.getFullYear(), dateToday.getMonth(), dateToday.getDate() + 1); - const dateNextWeek = new Date(dateToday.getFullYear(), dateToday.getMonth(), dateToday.getDate() + 7); - DateTimePicker.pickDate({ - context: (