├── .gitignore ├── .npmignore ├── LICENSE ├── README.md ├── calendar.android.d.ts ├── calendar.android.ts ├── calendar.ios.d.ts ├── calendar.ios.ts ├── demo ├── app │ ├── App_Resources │ │ ├── Android │ │ │ ├── AndroidManifest.xml │ │ │ ├── app.gradle │ │ │ ├── drawable-hdpi │ │ │ │ ├── background.png │ │ │ │ ├── icon.png │ │ │ │ └── logo.png │ │ │ ├── drawable-ldpi │ │ │ │ ├── background.png │ │ │ │ ├── icon.png │ │ │ │ └── logo.png │ │ │ ├── drawable-mdpi │ │ │ │ ├── background.png │ │ │ │ ├── icon.png │ │ │ │ └── logo.png │ │ │ ├── drawable-nodpi │ │ │ │ └── splash_screen.xml │ │ │ ├── drawable-xhdpi │ │ │ │ ├── background.png │ │ │ │ ├── icon.png │ │ │ │ └── logo.png │ │ │ ├── drawable-xxhdpi │ │ │ │ ├── background.png │ │ │ │ ├── icon.png │ │ │ │ └── logo.png │ │ │ ├── drawable-xxxhdpi │ │ │ │ ├── background.png │ │ │ │ ├── icon.png │ │ │ │ └── logo.png │ │ │ ├── values-v21 │ │ │ │ ├── colors.xml │ │ │ │ └── styles.xml │ │ │ └── values │ │ │ │ ├── colors.xml │ │ │ │ └── styles.xml │ │ └── iOS │ │ │ ├── Assets.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ ├── Contents.json │ │ │ │ ├── icon-29.png │ │ │ │ ├── icon-29@2x.png │ │ │ │ ├── icon-29@3x.png │ │ │ │ ├── icon-40.png │ │ │ │ ├── icon-40@2x.png │ │ │ │ ├── icon-40@3x.png │ │ │ │ ├── icon-50.png │ │ │ │ ├── icon-50@2x.png │ │ │ │ ├── icon-57.png │ │ │ │ ├── icon-57@2x.png │ │ │ │ ├── icon-60@2x.png │ │ │ │ ├── icon-60@3x.png │ │ │ │ ├── icon-72.png │ │ │ │ ├── icon-72@2x.png │ │ │ │ ├── icon-76.png │ │ │ │ ├── icon-76@2x.png │ │ │ │ └── icon-83.5@2x.png │ │ │ ├── Contents.json │ │ │ ├── LaunchImage.launchimage │ │ │ │ ├── Contents.json │ │ │ │ ├── Default-568h@2x.png │ │ │ │ ├── Default-667h@2x.png │ │ │ │ ├── Default-736h@3x.png │ │ │ │ ├── Default-Landscape.png │ │ │ │ ├── Default-Landscape@2x.png │ │ │ │ ├── Default-Landscape@3x.png │ │ │ │ ├── Default-Portrait.png │ │ │ │ ├── Default-Portrait@2x.png │ │ │ │ ├── Default.png │ │ │ │ └── Default@2x.png │ │ │ ├── LaunchScreen.AspectFill.imageset │ │ │ │ ├── Contents.json │ │ │ │ ├── LaunchScreen-AspectFill.png │ │ │ │ └── LaunchScreen-AspectFill@2x.png │ │ │ └── LaunchScreen.Center.imageset │ │ │ │ ├── Contents.json │ │ │ │ ├── LaunchScreen-Center.png │ │ │ │ └── LaunchScreen-Center@2x.png │ │ │ ├── Info.plist │ │ │ ├── LaunchScreen.storyboard │ │ │ └── build.xcconfig │ ├── app.component.html │ ├── app.component.ts │ ├── app.css │ ├── app.module.ts │ ├── main.aot.ts │ ├── main.ts │ └── package.json ├── package.json ├── references.d.ts └── tsconfig.json ├── index.d.ts ├── package.json ├── platforms ├── android │ └── include.gradle └── ios │ └── Podfile ├── screenshots ├── sample_android.png └── sample_ios.png ├── src ├── android │ ├── calendar.d.ts │ └── calendar.ts ├── calendar-appearance.d.ts ├── calendar-appearance.ts ├── calendar-enums.d.ts ├── calendar-enums.ts ├── calendar-event.d.ts ├── calendar-event.ts ├── calendar-settings.d.ts ├── calendar-settings.ts ├── calendar.d.ts ├── calendar.ts ├── common.d.ts ├── common.ts └── ios │ ├── calendar.d.ts │ └── calendar.ts └── tsconfig.json /.gitignore: -------------------------------------------------------------------------------- 1 | *.js 2 | *.js.map 3 | *.log 4 | !scripts/*.js 5 | demo/app/*.js 6 | !demo/karma.conf.js 7 | !demo/app/tests/*.js 8 | demo/*.d.ts 9 | !demo/references.d.ts 10 | demo/lib 11 | demo/platforms 12 | demo/node_modules 13 | node_modules 14 | .vscode 15 | 16 | typingz-* -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | demo/ 2 | screenshots/ 3 | *.gif 4 | *.png 5 | *.log 6 | *.map 7 | *.ts 8 | !*.d.ts 9 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | nativescript-fancy-calendar 4 | Copyright (c) 2017, Jean-Baptiste Aniel 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy of 7 | this software and associated documentation files (the "Software"), to deal in 8 | the Software without restriction, including without limitation the rights to 9 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 10 | the Software, and to permit persons to whom the Software is furnished to do so, 11 | subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![npm](https://img.shields.io/npm/v/nativescript-fancy-calendar.svg)](https://www.npmjs.com/package/nativescript-fancy-calendar) 2 | [![npm](https://img.shields.io/npm/dt/nativescript-fancy-calendar.svg?label=npm%20downloads)](https://www.npmjs.com/package/nativescript-fancy-calendar) 3 | 4 | ## NativeScript Fancy Calendar 5 | 6 | NativeScript plugin for [iOS](https://github.com/WenchaoD/FSCalendar) and [Android](https://github.com/prolificinteractive/material-calendarview). 7 | 8 | This plugin is not production ready, and there is still a lots of work to do on it. That's why I advise you to use the [nativescript-pro-ui](https://www.npmjs.com/package/nativescript-pro-ui) calendar which is supported by Telerik itself :beers:. 9 | 10 | 11 | ### Screenshots 12 | 13 | 14 | iOS | Android 15 | -------- | --------- 16 | ![iOS](screenshots/sample_ios.png) | ![Android](screenshots/sample_android.png) 17 | 18 | 19 | 20 | ### Install 21 | 22 | ```bash 23 | tns plugin add nativescript-fancy-calendar 24 | ``` 25 | 26 | ### Documentation 27 | 28 | component.html 29 | ```xml 30 | 32 | 33 | ``` 34 | 35 | component.ts 36 | ``` typescript 37 | import { 38 | Calendar, 39 | SELECTION_MODE, // Multiple or single 40 | DISPLAY_MODE, // Week or month 41 | CalendarEvent, // little dots 42 | Appearance, // style customisation 43 | SCROLL_ORIENTATION, // scroll orientation for iOS 44 | CalendarSubtitle, // subtitles for iOS 45 | Settings // Settings interface 46 | } from 'nativescript-fancy-calendar'; 47 | 48 | registerElement('Calendar', () => Calendar); 49 | 50 | @Component({ 51 | selector: "ns-yourcomponent", 52 | templateUrl: "yourcomponent.component.html", 53 | }) 54 | export class YourComponent { 55 | settings: any; 56 | subtitles: CalendarSubtitle[]; 57 | events: CalendarEvent[]; 58 | public appearance: Appearance; 59 | private _calendar: Calendar; 60 | 61 | public calendarLoaded(event) { 62 | this.settings = { 63 | displayMode: DISPLAY_MODE.MONTH, 64 | scrollOrientation: SCROLL_ORIENTATION.HORIZONTAL, 65 | selectionMode: SELECTION_MODE.MULTIPLE, 66 | firstWeekday: 3, // SUN: O, MON: 1, TUES: 2 etc.. 67 | maximumDate: nextMonth, // Can't go further than this date 68 | minimumDate: lastMonth // can't go earlier than this date 69 | }; 70 | this.appearance = { 71 | weekdayTextColor: "white", //color of Tue, Wed, Thur.. (only iOS) 72 | headerTitleColor: "white", //color of the current Month (only iOS) 73 | eventColor: "white", // color of dots 74 | selectionColor: "#FF3366", // color of the circle when a date is clicked 75 | todayColor: "#831733", // the color of the current day 76 | hasBorder: true, // remove border (only iOS) 77 | todaySelectionColor: "#FF3366", // today color when seleted (only iOS) 78 | borderRadius: 25 // border radius of the selection marker 79 | }; 80 | } 81 | 82 | public dateSelected(event) { 83 | console.log('date selected'); 84 | } 85 | 86 | 87 | public monthChanged(event) { 88 | console.log('month selected'); 89 | } 90 | } 91 | 92 | ``` 93 | 94 | 95 | -------------------------------------------------------------------------------- /calendar.android.d.ts: -------------------------------------------------------------------------------- 1 | export * from './src/common'; 2 | export * from './src/android/calendar'; 3 | export declare enum DISPLAY_MODE { 4 | "WEEK", 5 | "MONTH", 6 | } 7 | export declare enum SCROLL_ORIENTATION { 8 | "VERTICAL", 9 | "HORIZONTAL", 10 | } 11 | -------------------------------------------------------------------------------- /calendar.android.ts: -------------------------------------------------------------------------------- 1 | export * from './src/common'; 2 | export * from './src/android/calendar'; 3 | 4 | declare const 5 | com; 6 | 7 | const 8 | MaterialCalendar = com.prolificinteractive.materialcalendarview, 9 | MaterialCalendarMode = MaterialCalendar.CalendarMode, 10 | MaterialCalendarView = MaterialCalendar.MaterialCalendarView; 11 | 12 | export enum DISPLAY_MODE { 13 | "WEEK" = MaterialCalendarMode.WEEKS, 14 | "MONTH" = MaterialCalendarMode.MONTHS 15 | } 16 | 17 | export enum SCROLL_ORIENTATION { 18 | "VERTICAL" = MaterialCalendarView.VERTICAL, 19 | "HORIZONTAL" = MaterialCalendarView.HORIZONTAL 20 | } -------------------------------------------------------------------------------- /calendar.ios.d.ts: -------------------------------------------------------------------------------- 1 | export * from './src/common'; 2 | export * from './src/ios/calendar'; 3 | export declare enum DISPLAY_MODE { 4 | "WEEK", 5 | "MONTH", 6 | } 7 | export declare enum SCROLL_ORIENTATION { 8 | "VERTICAL", 9 | "HORIZONTAL", 10 | } 11 | -------------------------------------------------------------------------------- /calendar.ios.ts: -------------------------------------------------------------------------------- 1 | export * from './src/common'; 2 | export * from './src/ios/calendar'; 3 | 4 | declare const 5 | FSCalendarScopeWeek, 6 | FSCalendarScopeMonth, 7 | FSCalendarScrollDirectionVertical, 8 | FSCalendarScrollDirectionHorizontal; 9 | 10 | export enum DISPLAY_MODE { 11 | "WEEK" = FSCalendarScopeWeek, 12 | "MONTH" = FSCalendarScopeMonth 13 | } 14 | 15 | export enum SCROLL_ORIENTATION { 16 | "VERTICAL" = FSCalendarScrollDirectionVertical, 17 | "HORIZONTAL" = FSCalendarScrollDirectionHorizontal 18 | } -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 27 | 28 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/app.gradle: -------------------------------------------------------------------------------- 1 | // Add your native dependencies here: 2 | 3 | // Uncomment to add recyclerview-v7 dependency 4 | //dependencies { 5 | // compile 'com.android.support:recyclerview-v7:+' 6 | //} 7 | 8 | android { 9 | defaultConfig { 10 | generatedDensities = [] 11 | applicationId = "org.nativescript.demo" 12 | } 13 | aaptOptions { 14 | additionalParameters "--no-version-vectors" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/drawable-hdpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhanb/nativescript-fancy-calendar/293057d467f9f16de704bdd38fe4dfce951fe32f/demo/app/App_Resources/Android/drawable-hdpi/background.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/drawable-hdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhanb/nativescript-fancy-calendar/293057d467f9f16de704bdd38fe4dfce951fe32f/demo/app/App_Resources/Android/drawable-hdpi/icon.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/drawable-hdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhanb/nativescript-fancy-calendar/293057d467f9f16de704bdd38fe4dfce951fe32f/demo/app/App_Resources/Android/drawable-hdpi/logo.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/drawable-ldpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhanb/nativescript-fancy-calendar/293057d467f9f16de704bdd38fe4dfce951fe32f/demo/app/App_Resources/Android/drawable-ldpi/background.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/drawable-ldpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhanb/nativescript-fancy-calendar/293057d467f9f16de704bdd38fe4dfce951fe32f/demo/app/App_Resources/Android/drawable-ldpi/icon.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/drawable-ldpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhanb/nativescript-fancy-calendar/293057d467f9f16de704bdd38fe4dfce951fe32f/demo/app/App_Resources/Android/drawable-ldpi/logo.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/drawable-mdpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhanb/nativescript-fancy-calendar/293057d467f9f16de704bdd38fe4dfce951fe32f/demo/app/App_Resources/Android/drawable-mdpi/background.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/drawable-mdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhanb/nativescript-fancy-calendar/293057d467f9f16de704bdd38fe4dfce951fe32f/demo/app/App_Resources/Android/drawable-mdpi/icon.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/drawable-mdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhanb/nativescript-fancy-calendar/293057d467f9f16de704bdd38fe4dfce951fe32f/demo/app/App_Resources/Android/drawable-mdpi/logo.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/drawable-nodpi/splash_screen.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/drawable-xhdpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhanb/nativescript-fancy-calendar/293057d467f9f16de704bdd38fe4dfce951fe32f/demo/app/App_Resources/Android/drawable-xhdpi/background.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/drawable-xhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhanb/nativescript-fancy-calendar/293057d467f9f16de704bdd38fe4dfce951fe32f/demo/app/App_Resources/Android/drawable-xhdpi/icon.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/drawable-xhdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhanb/nativescript-fancy-calendar/293057d467f9f16de704bdd38fe4dfce951fe32f/demo/app/App_Resources/Android/drawable-xhdpi/logo.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/drawable-xxhdpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhanb/nativescript-fancy-calendar/293057d467f9f16de704bdd38fe4dfce951fe32f/demo/app/App_Resources/Android/drawable-xxhdpi/background.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/drawable-xxhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhanb/nativescript-fancy-calendar/293057d467f9f16de704bdd38fe4dfce951fe32f/demo/app/App_Resources/Android/drawable-xxhdpi/icon.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/drawable-xxhdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhanb/nativescript-fancy-calendar/293057d467f9f16de704bdd38fe4dfce951fe32f/demo/app/App_Resources/Android/drawable-xxhdpi/logo.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/drawable-xxxhdpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhanb/nativescript-fancy-calendar/293057d467f9f16de704bdd38fe4dfce951fe32f/demo/app/App_Resources/Android/drawable-xxxhdpi/background.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/drawable-xxxhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhanb/nativescript-fancy-calendar/293057d467f9f16de704bdd38fe4dfce951fe32f/demo/app/App_Resources/Android/drawable-xxxhdpi/icon.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/drawable-xxxhdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhanb/nativescript-fancy-calendar/293057d467f9f16de704bdd38fe4dfce951fe32f/demo/app/App_Resources/Android/drawable-xxxhdpi/logo.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/values-v21/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3d5afe 4 | -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/values-v21/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 11 | 14 | 15 | 16 | 19 | 20 | 23 | -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #F5F5F5 4 | #757575 5 | #33B5E5 6 | #272734 7 | #272734 8 | -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 18 | 19 | 21 | 22 | 23 | 31 | 32 | 34 | 35 | 36 | 42 | 43 | 45 | 49 | 50 | -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "29x29", 5 | "idiom" : "iphone", 6 | "filename" : "icon-29.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "size" : "29x29", 11 | "idiom" : "iphone", 12 | "filename" : "icon-29@2x.png", 13 | "scale" : "2x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "icon-29@3x.png", 19 | "scale" : "3x" 20 | }, 21 | { 22 | "size" : "40x40", 23 | "idiom" : "iphone", 24 | "filename" : "icon-40@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "40x40", 29 | "idiom" : "iphone", 30 | "filename" : "icon-40@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "57x57", 35 | "idiom" : "iphone", 36 | "filename" : "icon-57.png", 37 | "scale" : "1x" 38 | }, 39 | { 40 | "size" : "57x57", 41 | "idiom" : "iphone", 42 | "filename" : "icon-57@2x.png", 43 | "scale" : "2x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "icon-60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "icon-60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "29x29", 59 | "idiom" : "ipad", 60 | "filename" : "icon-29.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "29x29", 65 | "idiom" : "ipad", 66 | "filename" : "icon-29@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "40x40", 71 | "idiom" : "ipad", 72 | "filename" : "icon-40.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "40x40", 77 | "idiom" : "ipad", 78 | "filename" : "icon-40@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "50x50", 83 | "idiom" : "ipad", 84 | "filename" : "icon-50.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "50x50", 89 | "idiom" : "ipad", 90 | "filename" : "icon-50@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "72x72", 95 | "idiom" : "ipad", 96 | "filename" : "icon-72.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "72x72", 101 | "idiom" : "ipad", 102 | "filename" : "icon-72@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "76x76", 107 | "idiom" : "ipad", 108 | "filename" : "icon-76.png", 109 | "scale" : "1x" 110 | }, 111 | { 112 | "size" : "76x76", 113 | "idiom" : "ipad", 114 | "filename" : "icon-76@2x.png", 115 | "scale" : "2x" 116 | }, 117 | { 118 | "size" : "83.5x83.5", 119 | "idiom" : "ipad", 120 | "filename" : "icon-83.5@2x.png", 121 | "scale" : "2x" 122 | } 123 | ], 124 | "info" : { 125 | "version" : 1, 126 | "author" : "xcode" 127 | } 128 | } -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhanb/nativescript-fancy-calendar/293057d467f9f16de704bdd38fe4dfce951fe32f/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhanb/nativescript-fancy-calendar/293057d467f9f16de704bdd38fe4dfce951fe32f/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhanb/nativescript-fancy-calendar/293057d467f9f16de704bdd38fe4dfce951fe32f/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhanb/nativescript-fancy-calendar/293057d467f9f16de704bdd38fe4dfce951fe32f/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhanb/nativescript-fancy-calendar/293057d467f9f16de704bdd38fe4dfce951fe32f/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhanb/nativescript-fancy-calendar/293057d467f9f16de704bdd38fe4dfce951fe32f/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhanb/nativescript-fancy-calendar/293057d467f9f16de704bdd38fe4dfce951fe32f/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhanb/nativescript-fancy-calendar/293057d467f9f16de704bdd38fe4dfce951fe32f/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhanb/nativescript-fancy-calendar/293057d467f9f16de704bdd38fe4dfce951fe32f/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhanb/nativescript-fancy-calendar/293057d467f9f16de704bdd38fe4dfce951fe32f/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhanb/nativescript-fancy-calendar/293057d467f9f16de704bdd38fe4dfce951fe32f/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhanb/nativescript-fancy-calendar/293057d467f9f16de704bdd38fe4dfce951fe32f/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhanb/nativescript-fancy-calendar/293057d467f9f16de704bdd38fe4dfce951fe32f/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhanb/nativescript-fancy-calendar/293057d467f9f16de704bdd38fe4dfce951fe32f/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhanb/nativescript-fancy-calendar/293057d467f9f16de704bdd38fe4dfce951fe32f/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhanb/nativescript-fancy-calendar/293057d467f9f16de704bdd38fe4dfce951fe32f/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhanb/nativescript-fancy-calendar/293057d467f9f16de704bdd38fe4dfce951fe32f/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "extent" : "full-screen", 5 | "idiom" : "iphone", 6 | "subtype" : "736h", 7 | "filename" : "Default-736h@3x.png", 8 | "minimum-system-version" : "8.0", 9 | "orientation" : "portrait", 10 | "scale" : "3x" 11 | }, 12 | { 13 | "extent" : "full-screen", 14 | "idiom" : "iphone", 15 | "subtype" : "736h", 16 | "filename" : "Default-Landscape@3x.png", 17 | "minimum-system-version" : "8.0", 18 | "orientation" : "landscape", 19 | "scale" : "3x" 20 | }, 21 | { 22 | "extent" : "full-screen", 23 | "idiom" : "iphone", 24 | "subtype" : "667h", 25 | "filename" : "Default-667h@2x.png", 26 | "minimum-system-version" : "8.0", 27 | "orientation" : "portrait", 28 | "scale" : "2x" 29 | }, 30 | { 31 | "orientation" : "portrait", 32 | "idiom" : "iphone", 33 | "filename" : "Default@2x.png", 34 | "extent" : "full-screen", 35 | "minimum-system-version" : "7.0", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "extent" : "full-screen", 40 | "idiom" : "iphone", 41 | "subtype" : "retina4", 42 | "filename" : "Default-568h@2x.png", 43 | "minimum-system-version" : "7.0", 44 | "orientation" : "portrait", 45 | "scale" : "2x" 46 | }, 47 | { 48 | "orientation" : "portrait", 49 | "idiom" : "ipad", 50 | "filename" : "Default-Portrait.png", 51 | "extent" : "full-screen", 52 | "minimum-system-version" : "7.0", 53 | "scale" : "1x" 54 | }, 55 | { 56 | "orientation" : "landscape", 57 | "idiom" : "ipad", 58 | "filename" : "Default-Landscape.png", 59 | "extent" : "full-screen", 60 | "minimum-system-version" : "7.0", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "orientation" : "portrait", 65 | "idiom" : "ipad", 66 | "filename" : "Default-Portrait@2x.png", 67 | "extent" : "full-screen", 68 | "minimum-system-version" : "7.0", 69 | "scale" : "2x" 70 | }, 71 | { 72 | "orientation" : "landscape", 73 | "idiom" : "ipad", 74 | "filename" : "Default-Landscape@2x.png", 75 | "extent" : "full-screen", 76 | "minimum-system-version" : "7.0", 77 | "scale" : "2x" 78 | }, 79 | { 80 | "orientation" : "portrait", 81 | "idiom" : "iphone", 82 | "filename" : "Default.png", 83 | "extent" : "full-screen", 84 | "scale" : "1x" 85 | }, 86 | { 87 | "orientation" : "portrait", 88 | "idiom" : "iphone", 89 | "filename" : "Default@2x.png", 90 | "extent" : "full-screen", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "orientation" : "portrait", 95 | "idiom" : "iphone", 96 | "filename" : "Default-568h@2x.png", 97 | "extent" : "full-screen", 98 | "subtype" : "retina4", 99 | "scale" : "2x" 100 | }, 101 | { 102 | "orientation" : "portrait", 103 | "idiom" : "ipad", 104 | "extent" : "to-status-bar", 105 | "scale" : "1x" 106 | }, 107 | { 108 | "orientation" : "portrait", 109 | "idiom" : "ipad", 110 | "filename" : "Default-Portrait.png", 111 | "extent" : "full-screen", 112 | "scale" : "1x" 113 | }, 114 | { 115 | "orientation" : "landscape", 116 | "idiom" : "ipad", 117 | "extent" : "to-status-bar", 118 | "scale" : "1x" 119 | }, 120 | { 121 | "orientation" : "landscape", 122 | "idiom" : "ipad", 123 | "filename" : "Default-Landscape.png", 124 | "extent" : "full-screen", 125 | "scale" : "1x" 126 | }, 127 | { 128 | "orientation" : "portrait", 129 | "idiom" : "ipad", 130 | "extent" : "to-status-bar", 131 | "scale" : "2x" 132 | }, 133 | { 134 | "orientation" : "portrait", 135 | "idiom" : "ipad", 136 | "filename" : "Default-Portrait@2x.png", 137 | "extent" : "full-screen", 138 | "scale" : "2x" 139 | }, 140 | { 141 | "orientation" : "landscape", 142 | "idiom" : "ipad", 143 | "extent" : "to-status-bar", 144 | "scale" : "2x" 145 | }, 146 | { 147 | "orientation" : "landscape", 148 | "idiom" : "ipad", 149 | "filename" : "Default-Landscape@2x.png", 150 | "extent" : "full-screen", 151 | "scale" : "2x" 152 | } 153 | ], 154 | "info" : { 155 | "version" : 1, 156 | "author" : "xcode" 157 | } 158 | } -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhanb/nativescript-fancy-calendar/293057d467f9f16de704bdd38fe4dfce951fe32f/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-568h@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-667h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhanb/nativescript-fancy-calendar/293057d467f9f16de704bdd38fe4dfce951fe32f/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-667h@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-736h@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhanb/nativescript-fancy-calendar/293057d467f9f16de704bdd38fe4dfce951fe32f/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-736h@3x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhanb/nativescript-fancy-calendar/293057d467f9f16de704bdd38fe4dfce951fe32f/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhanb/nativescript-fancy-calendar/293057d467f9f16de704bdd38fe4dfce951fe32f/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhanb/nativescript-fancy-calendar/293057d467f9f16de704bdd38fe4dfce951fe32f/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@3x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhanb/nativescript-fancy-calendar/293057d467f9f16de704bdd38fe4dfce951fe32f/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhanb/nativescript-fancy-calendar/293057d467f9f16de704bdd38fe4dfce951fe32f/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhanb/nativescript-fancy-calendar/293057d467f9f16de704bdd38fe4dfce951fe32f/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhanb/nativescript-fancy-calendar/293057d467f9f16de704bdd38fe4dfce951fe32f/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchScreen-AspectFill.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchScreen-AspectFill@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhanb/nativescript-fancy-calendar/293057d467f9f16de704bdd38fe4dfce951fe32f/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhanb/nativescript-fancy-calendar/293057d467f9f16de704bdd38fe4dfce951fe32f/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchScreen-Center.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchScreen-Center@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhanb/nativescript-fancy-calendar/293057d467f9f16de704bdd38fe4dfce951fe32f/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhanb/nativescript-fancy-calendar/293057d467f9f16de704bdd38fe4dfce951fe32f/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIRequiresFullScreen 28 | 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/build.xcconfig: -------------------------------------------------------------------------------- 1 | // You can add custom settings here 2 | // for example you can uncomment the following line to force distribution code signing 3 | // CODE_SIGN_IDENTITY = iPhone Distribution 4 | // 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 5 | // DEVELOPMENT_TEAM = YOUR_TEAM_ID; 6 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 7 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 8 | -------------------------------------------------------------------------------- /demo/app/app.component.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /demo/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, ElementRef, ViewChild } from "@angular/core"; 2 | import { 3 | Calendar, 4 | SELECTION_MODE, 5 | DISPLAY_MODE, 6 | CalendarEvent, 7 | Appearance, 8 | SCROLL_ORIENTATION, 9 | CalendarSubtitle, 10 | Settings 11 | } from 'nativescript-fancy-calendar'; 12 | import { registerElement } from 'nativescript-angular'; 13 | import { Color } from "color"; 14 | import { isIOS, isAndroid } from "platform"; 15 | import { AnimationCurve } from "ui/enums"; 16 | 17 | declare const NSDate, UIView, UIViewAnimationOptions; 18 | 19 | registerElement('Calendar', () => Calendar); 20 | @Component({ 21 | selector: "ns-app", 22 | templateUrl: "app.component.html", 23 | }) 24 | export class AppComponent { 25 | @ViewChild("layout") layout: ElementRef; 26 | @ViewChild("calendar") calendar: ElementRef; 27 | @ViewChild("container") container: ElementRef; 28 | 29 | appearanceOptions: Array; 30 | settings: Settings; 31 | subtitles: CalendarSubtitle[]; 32 | events: CalendarEvent[]; 33 | public appearance: Appearance; 34 | public dateProgrammaticallySelected: boolean; 35 | private _calendar: Calendar; 36 | private _layout: any; 37 | 38 | public calendarLoaded(event) { 39 | console.log("calendarLoaded"); 40 | this.appearanceOptions = new Array({ 41 | weekdayTextColor: "blue", 42 | headerTitleColor: "black", 43 | eventColor: "black", 44 | selectionColor: "blue", 45 | todayColor: "blue", 46 | todaySelectionColor: "white", 47 | borderRadius: 0, 48 | hasBorder: true 49 | }, { 50 | weekdayTextColor: "yellow", 51 | headerTitleColor: "black", 52 | eventColor: "black", 53 | selectionColor: "yellow", 54 | todayColor: "yellow", 55 | todaySelectionColor: "white", 56 | borderRadius: 10, 57 | hasBorder: true 58 | }, { 59 | weekdayTextColor: "pink", 60 | headerTitleColor: "black", 61 | eventColor: "black", 62 | selectionColor: "pink", 63 | todayColor: "pink", 64 | todaySelectionColor: "white", 65 | borderRadius: 15, 66 | hasBorder: false 67 | }); 68 | var lastMonth = new Date(); 69 | lastMonth.setMonth(lastMonth.getMonth() - 1); 70 | var nextMonth = new Date(); 71 | nextMonth.setMonth(nextMonth.getMonth() + 1); 72 | this.settings = { 73 | displayMode: DISPLAY_MODE.MONTH, 74 | scrollOrientation: SCROLL_ORIENTATION.HORIZONTAL, 75 | selectionMode: SELECTION_MODE.MULTIPLE, 76 | firstWeekday: 3, 77 | maximumDate: nextMonth, 78 | minimumDate: lastMonth 79 | }; 80 | this.appearance = { 81 | weekdayTextColor: "white", 82 | headerTitleColor: "white", 83 | eventColor: "white", 84 | selectionColor: "#FF3366", 85 | todayColor: "#831733", 86 | hasBorder: true, 87 | todaySelectionColor: "#FF3366", 88 | borderRadius: 50 89 | }; 90 | this._calendar = event.object; 91 | let temp = new Date(); 92 | let tommorow = new Date().getDate() + 1; 93 | temp.setDate(tommorow); 94 | this.events = new Array(new CalendarEvent(new Date()), new CalendarEvent(new Date()), new CalendarEvent(temp)); 95 | if (isIOS) { 96 | let calendarSubtitle = new CalendarSubtitle(new Date(), "lol"); 97 | this._calendar.subtitles = new Array(calendarSubtitle); 98 | } 99 | } 100 | 101 | public changeDisplayMode() { 102 | let newDisplayMode: DISPLAY_MODE; 103 | let displayModeValue; 104 | displayModeValue = this.settings.displayMode === DISPLAY_MODE.MONTH ? DISPLAY_MODE.WEEK : DISPLAY_MODE.MONTH; 105 | this.settings = { 106 | displayMode: displayModeValue, 107 | scrollOrientation: this.settings.scrollOrientation, 108 | selectionMode: this.settings.selectionMode, 109 | firstWeekday: this.settings.firstWeekday, 110 | maximumDate: this.settings.maximumDate, 111 | minimumDate: this.settings.minimumDate 112 | } 113 | 114 | //// this._calendar.reload(); 115 | } 116 | public layoutLoaded(event) { 117 | this._layout = event.object; 118 | } 119 | public displayModeChanged(event) { 120 | //let newHeight = this.container.nativeElement.nativeView.frame.size.height - event.data.size.height; 121 | //this.layout.nativeElement.height = newHeight; 122 | if (isIOS) { 123 | let newY = 0; 124 | if (this.settings.displayMode !== DISPLAY_MODE.MONTH) { 125 | newY = this.container.nativeElement.nativeView.frame.size.height - this._layout.nativeView.frame.size.height - event.data.size.height + 1; 126 | } 127 | this._layout.animate({ 128 | translate: { 129 | x: 0, 130 | y: - newY 131 | }, 132 | duration: 300, 133 | curve: AnimationCurve.easeInOut 134 | }); 135 | } 136 | 137 | //getRows 138 | } 139 | public changeOrientation() { 140 | let newOrientation: SCROLL_ORIENTATION; 141 | let orientationValue; 142 | orientationValue = this.settings.scrollOrientation === SCROLL_ORIENTATION.HORIZONTAL ? SCROLL_ORIENTATION.VERTICAL : SCROLL_ORIENTATION.HORIZONTAL; 143 | let newSettings = { 144 | displayMode: this.settings.displayMode, 145 | scrollOrientation: orientationValue, 146 | selectionMode: this.settings.selectionMode, 147 | firstWeekday: this.settings.firstWeekday, 148 | maximumDate: this.settings.maximumDate, 149 | minimumDate: this.settings.minimumDate 150 | } 151 | this.settings = newSettings; 152 | console.log('changeOrientation'); 153 | } 154 | 155 | public changeFirstWeekDay() { 156 | let newFirstWeekDay = Math.floor(Math.random() * (1 + 7 - 1)) + 1; 157 | this.settings = { 158 | displayMode: this.settings.displayMode, 159 | scrollOrientation: this.settings.scrollOrientation, 160 | selectionMode: this.settings.selectionMode, 161 | firstWeekday: newFirstWeekDay, 162 | maximumDate: this.settings.maximumDate, 163 | minimumDate: this.settings.minimumDate 164 | } 165 | console.log('changeFirstWeekDay'); 166 | } 167 | 168 | public changeSelectionMode() { 169 | let newSelectionMode: SELECTION_MODE; 170 | newSelectionMode = this.settings.selectionMode === SELECTION_MODE.MULTIPLE ? SELECTION_MODE.SINGLE : SELECTION_MODE.MULTIPLE; 171 | this.settings = { 172 | displayMode: this.settings.displayMode, 173 | scrollOrientation: this.settings.scrollOrientation, 174 | selectionMode: newSelectionMode, 175 | firstWeekday: this.settings.firstWeekday, 176 | maximumDate: this.settings.maximumDate, 177 | minimumDate: this.settings.minimumDate 178 | } 179 | } 180 | 181 | public changeAppearance() { 182 | let appearanceIndex = Math.floor(Math.random() * (1 + this.appearanceOptions.length - 1 - 0)) + 0; 183 | this.appearance = this.appearanceOptions[appearanceIndex]; 184 | } 185 | 186 | public changeEvents() { 187 | if (this.events.length > 1) { 188 | this.events = new Array(new CalendarEvent(new Date())); 189 | } else { 190 | let temp = new Date(); 191 | let tommorow = new Date().getDate() + 1; 192 | temp.setDate(tommorow); 193 | this.events = new Array(new CalendarEvent(new Date()), new CalendarEvent(temp)); 194 | } 195 | this._calendar.reload(); 196 | } 197 | 198 | 199 | 200 | 201 | public dateSelected(event) { 202 | console.log('date selected'); 203 | let date: Date; 204 | if (isIOS) { 205 | date = event.data; 206 | } else if (isAndroid) { 207 | date = event.data.date; 208 | } 209 | console.log('===> ' + date); 210 | } 211 | 212 | 213 | public monthChanged(event) { 214 | console.log('month selected'); 215 | } 216 | 217 | selectDate() { 218 | // select tomorrow 219 | let temp = new Date(); 220 | let tommorow = new Date().getDate() + 1; 221 | temp.setDate(tommorow); 222 | console.log('select tomorrow : ' + temp); 223 | this._calendar.selectDate(temp); 224 | this.dateProgrammaticallySelected = true; 225 | } 226 | 227 | deselectDate() { 228 | // select tomorrow 229 | let temp = new Date(); 230 | let tommorow = new Date().getDate() + 1; 231 | temp.setDate(tommorow); 232 | console.log('deselect tomorrow'); 233 | this._calendar.deselectDate(temp); 234 | this.dateProgrammaticallySelected = false; 235 | } 236 | } 237 | 238 | -------------------------------------------------------------------------------- /demo/app/app.css: -------------------------------------------------------------------------------- 1 | /* 2 | In NativeScript, the app.css file is where you place CSS rules that 3 | you would like to apply to your entire application. Check out 4 | http://docs.nativescript.org/ui/styling for a full list of the CSS 5 | selectors and properties you can use to style UI components. 6 | 7 | /* 8 | In many cases you may want to use the NativeScript core theme instead 9 | of writing your own CSS rules. For a full list of class names in the theme 10 | refer to http://docs.nativescript.org/ui/theme. 11 | */ 12 | @import 'nativescript-theme-core/css/core.light.css'; 13 | -------------------------------------------------------------------------------- /demo/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule, NO_ERRORS_SCHEMA } from "@angular/core"; 2 | import { NativeScriptModule } from "nativescript-angular/nativescript.module"; 3 | import { AppComponent } from "./app.component"; 4 | 5 | @NgModule({ 6 | bootstrap: [ 7 | AppComponent 8 | ], 9 | imports: [ 10 | NativeScriptModule 11 | ], 12 | declarations: [ 13 | AppComponent 14 | ], 15 | providers: [ 16 | ], 17 | schemas: [ 18 | NO_ERRORS_SCHEMA 19 | ] 20 | }) 21 | export class AppModule { } 22 | -------------------------------------------------------------------------------- /demo/app/main.aot.ts: -------------------------------------------------------------------------------- 1 | // this import should be first in order to load some required settings (like globals and reflect-metadata) 2 | import { platformNativeScript } from "nativescript-angular/platform-static"; 3 | 4 | import { AppModuleNgFactory } from "./app.module.ngfactory"; 5 | 6 | platformNativeScript().bootstrapModuleFactory(AppModuleNgFactory); 7 | -------------------------------------------------------------------------------- /demo/app/main.ts: -------------------------------------------------------------------------------- 1 | // this import should be first in order to load some required settings (like globals and reflect-metadata) 2 | import { platformNativeScriptDynamic } from "nativescript-angular/platform"; 3 | 4 | import { AppModule } from "./app.module"; 5 | 6 | platformNativeScriptDynamic().bootstrapModule(AppModule); 7 | -------------------------------------------------------------------------------- /demo/app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "android": { 3 | "v8Flags": "--expose_gc" 4 | }, 5 | "main": "main.js", 6 | "name": "tns-template-hello-world-ng", 7 | "version": "2.5.2" 8 | } -------------------------------------------------------------------------------- /demo/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "NativeScript Application", 3 | "license": "SEE LICENSE IN ", 4 | "readme": "NativeScript Application", 5 | "repository": "", 6 | "nativescript": { 7 | "id": "org.nativescript.demo", 8 | "tns-android": { 9 | "version": "3.2.0" 10 | }, 11 | "tns-ios": { 12 | "version": "3.2.0" 13 | } 14 | }, 15 | "dependencies": { 16 | "@angular/animations": "4.1.3", 17 | "@angular/common": "4.1.3", 18 | "@angular/compiler": "4.1.3", 19 | "@angular/core": "4.1.3", 20 | "@angular/forms": "4.1.3", 21 | "@angular/http": "4.1.3", 22 | "@angular/platform-browser": "4.1.3", 23 | "@angular/platform-browser-dynamic": "4.1.3", 24 | "@angular/router": "4.1.3", 25 | "nativescript-angular": "3.0.0", 26 | "nativescript-fancy-calendar": "file:///Users/rhanb/Documents/DevLove/NativeScript/Plugins/nativescript-fancy-calendar", 27 | "nativescript-theme-core": "~1.0.4", 28 | "reflect-metadata": "~0.1.8", 29 | "rxjs": "~5.2.0", 30 | "tns-core-modules": "^3.2.0", 31 | "zone.js": "^0.8.10" 32 | }, 33 | "devDependencies": { 34 | "babel-traverse": "6.24.1", 35 | "babel-types": "6.24.1", 36 | "babylon": "6.16.1", 37 | "lazy": "1.0.11", 38 | "nativescript-dev-android-snapshot": "^0.*.*", 39 | "nativescript-dev-typescript": "~0.4.5", 40 | "typescript": "~2.3.3" 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /demo/references.d.ts: -------------------------------------------------------------------------------- 1 | /// Needed for autocompletion and compilation. -------------------------------------------------------------------------------- /demo/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es5", 5 | "noImplicitAny": false, 6 | "removeComments": true, 7 | "preserveConstEnums": true, 8 | "declaration": false, 9 | "noLib": false, 10 | "noEmitHelpers": true, 11 | "experimentalDecorators": true, 12 | "lib": [ 13 | "es6", 14 | "dom" 15 | ], 16 | "baseUrl": ".", 17 | "paths": { 18 | "*": [ 19 | "./node_modules/tns-core-modules/*", 20 | "./node_modules/*" 21 | ] 22 | } 23 | }, 24 | "exclude": [ 25 | "node_modules", 26 | "platforms", 27 | "**/*.aot.ts" 28 | ] 29 | } -------------------------------------------------------------------------------- /index.d.ts: -------------------------------------------------------------------------------- 1 | import { View } from "ui/core/view"; 2 | import { Property, PropertyChangeData } from "ui/core/dependency-observable"; 3 | import { CalendarBase } from './src/common'; 4 | 5 | export * from './src/common'; 6 | 7 | export interface INSEvents { 8 | dateSelected: string; 9 | monthChanged: string; 10 | } 11 | 12 | export declare const NSEvents: INSEvents; 13 | 14 | export declare class CalendarEvent { 15 | private _date; 16 | private _source; 17 | constructor(eventDate: Date, eventSource?: string); 18 | date: Date; 19 | source: string; 20 | } 21 | 22 | export declare class CalendarSubtitle { 23 | private _date; 24 | private _text; 25 | constructor(subtitleDate: any, subtitleText: string); 26 | date: any; 27 | text: string; 28 | } 29 | 30 | export declare class Calendar extends CalendarBase { 31 | readonly android: any; 32 | createNativeView(): any; 33 | private addDecoratorToday(date, colorBackgroundValue, colorSelectionValue, borderRadiusValue); 34 | private addDecoratorDot(colorValue); 35 | dateHasEvent(date: any): any; 36 | private _subtitles; 37 | private _delegate; 38 | private _dataSource; 39 | private _calendarHeightConstraint; 40 | constructor(); 41 | readonly ios: any; 42 | onLoaded(): void; 43 | onUnloaded(): void; 44 | disposeNativeView(): void; 45 | readonly calendarHeightConstraint: any; 46 | setSalendarHeightConstraint(height: number): void; 47 | subtitles: Array; 48 | dateSelectedEvent(date: any): void; 49 | pageChanged(calendar: any): void; 50 | dateHasEventImage(date: any): string; 51 | dateHasSubtitle(date: any): string; 52 | private isSameDate(dateOne, dateTwo); 53 | reload(): void; 54 | displayModeChanged(bounds: any): void; 55 | selectDate(date: any): void; 56 | deselectDate(date: any): void; 57 | getDate(): any; 58 | } 59 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nativescript-fancy-calendar", 3 | "version": "3.0.2", 4 | "description": "Fancy calendar for NativeScript :smile: :beers:", 5 | "main": "calendar", 6 | "typings": "index.d.ts", 7 | "nativescript": { 8 | "platforms": { 9 | "ios": "3.2.0", 10 | "android": "3.2.0" 11 | } 12 | }, 13 | "repository": { 14 | "type": "git", 15 | "url": "https://github.com/rhanbIT/nativescript-fancy-calendar.git" 16 | }, 17 | "keywords": [ 18 | "NativeScript", 19 | "JavaScript", 20 | "TypeScript", 21 | "Angular", 22 | "Calendar", 23 | "iOS", 24 | "Material Design", 25 | "Android" 26 | ], 27 | "author": { 28 | "name": "rhanb", 29 | "email": "aniel.jeanbaptiste@gmail.com" 30 | }, 31 | "contributors": [ 32 | { 33 | "name": "rhanb", 34 | "email": "aniel.jeanbaptiste@gmail.com" 35 | }, 36 | { 37 | "name": "mickaeleuranie", 38 | "email": "mickaeleuranie@gmail.com", 39 | "url": "http://mickaeleuranie.com" 40 | } 41 | ], 42 | "bugs": { 43 | "url": "https://github.com/rhanb/nativescript-fancy-calendar/issues" 44 | }, 45 | "scripts": { 46 | "build": "tsc", 47 | "demo.ios": "npm run preparedemo && cd demo && tns run ios --emulator", 48 | "demo.ios.device": "npm run preparedemo && cd demo && tns run ios", 49 | "demo.android": "npm run preparedemo && cd demo && tns run android --emulator", 50 | "test.ios": "cd demo && tns test ios --emulator", 51 | "test.ios.device": "cd demo && tns test ios", 52 | "test.android": "cd demo && tns test android", 53 | "preparedemo": "npm run build && cd demo && tns plugin remove nativescript-fancy-calendar && tns plugin add .. && tns install", 54 | "save": "cd demo && TNS_TYPESCRIPT_DECLARATIONS_PATH='$(pwd)/typingz' tns build ios" 55 | }, 56 | "homepage": "https://github.com/rhanb/nativescript-fancy-calendar", 57 | "readmeFilename": "README.md", 58 | "devDependencies": { 59 | "tns-core-modules": "^3.2.0", 60 | "tns-platform-declarations": "^3.2.0", 61 | "typescript": "^2.5.3" 62 | }, 63 | "peerDependencies": { 64 | "tns-core-modules": "^3.2.0" 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /platforms/android/include.gradle: -------------------------------------------------------------------------------- 1 | //default elements 2 | android { 3 | productFlavors { 4 | "nativescript-fancy-calendar" { 5 | dimension "nativescript-fancy-calendar" 6 | } 7 | } 8 | } 9 | 10 | dependencies { 11 | compile 'com.prolificinteractive:material-calendarview:1.4.3' 12 | } 13 | -------------------------------------------------------------------------------- /platforms/ios/Podfile: -------------------------------------------------------------------------------- 1 | use_frameworks! 2 | platform :ios, '8.0' 3 | pod 'FSCalendar' 4 | post_install do |installer| 5 | installer.pods_project.targets.each do |target| 6 | target.build_configurations.each do |config| 7 | config.build_settings['SWIFT_VERSION'] = '3.0' 8 | end 9 | end 10 | end -------------------------------------------------------------------------------- /screenshots/sample_android.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhanb/nativescript-fancy-calendar/293057d467f9f16de704bdd38fe4dfce951fe32f/screenshots/sample_android.png -------------------------------------------------------------------------------- /screenshots/sample_ios.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhanb/nativescript-fancy-calendar/293057d467f9f16de704bdd38fe4dfce951fe32f/screenshots/sample_ios.png -------------------------------------------------------------------------------- /src/android/calendar.d.ts: -------------------------------------------------------------------------------- 1 | import { CalendarBase } from "../common"; 2 | export declare class Calendar extends CalendarBase { 3 | readonly android: any; 4 | createNativeView(): any; 5 | private addDecoratorToday(date, colorBackgroundValue, colorSelectionValue, borderRadiusValue); 6 | private addDecoratorDot(colorValue); 7 | dateHasEvent(date: any): boolean; 8 | private isSameDate(dateOne, dateTwo); 9 | selectDate(date: Date): void; 10 | deselectDate(date: Date): void; 11 | } 12 | -------------------------------------------------------------------------------- /src/android/calendar.ts: -------------------------------------------------------------------------------- 1 | import { 2 | CalendarEvent, 3 | CalendarBase, 4 | SELECTION_MODE, 5 | Appearance, 6 | NSEvents, 7 | eventsProperty, 8 | settingsProperty, 9 | Settings, 10 | appearanceProperty 11 | } from "../common"; 12 | import { Color } from "tns-core-modules/color"; 13 | import { isDefined } from "utils/types"; 14 | import { SCROLL_ORIENTATION } from "../../calendar.android"; 15 | 16 | declare const com, ColorDrawable, android, R; 17 | const MaterialCalendar = com.prolificinteractive.materialcalendarview, 18 | MaterialCalendarView = MaterialCalendar.MaterialCalendarView, 19 | MaterialCalendarOnDateSelectedListener = MaterialCalendar.OnDateSelectedListener, 20 | MaterialCalendarOnMonthChangedListener = MaterialCalendar.OnMonthChangedListener, 21 | MaterialCalendarMode = MaterialCalendar.CalendarMode, 22 | MaterialCalendarDecorator = MaterialCalendar.DayViewDecorator, 23 | MaterialCalendarDot = MaterialCalendar.spans.DotSpan, 24 | MaterialCalendarDay = MaterialCalendar.CalendarDay; 25 | 26 | 27 | 28 | export class Calendar extends CalendarBase { 29 | 30 | public get android() { 31 | return this.nativeView; 32 | } 33 | 34 | public createNativeView() { 35 | let nativeView = new MaterialCalendarView(this._context); 36 | 37 | this.appearance = { 38 | weekdayTextColor: "black", 39 | headerTitleColor: "black", 40 | eventColor: "red", 41 | selectionColor: "blue", 42 | todayColor: "yellow", 43 | todaySelectionColor: "orange", 44 | borderRadius: 25 45 | } 46 | 47 | nativeView.setHeaderTextAppearance(android.R.style.TextAppearance_AppCompat_Medium); 48 | nativeView.setWeekDayTextAppearance(android.R.style.TextAppearance_AppCompat_Medium); 49 | nativeView.setDateTextAppearance(android.R.style.CustomDayTextAppearance); 50 | 51 | let _that = new WeakRef(this); 52 | 53 | let selectedDateListener = new MaterialCalendarOnDateSelectedListener({ 54 | get owner(): Calendar { 55 | return _that.get(); 56 | }, 57 | onDateSelected: function (widget, date, selected) { 58 | let dateISO = new Date(date.getYear(), date.getMonth(), date.getDay()); 59 | this.owner.notify({ 60 | eventName: NSEvents.dateSelected, 61 | object: _that, 62 | data: { date: dateISO, selected: selected } 63 | }); 64 | } 65 | }); 66 | 67 | nativeView.setOnDateChangedListener(selectedDateListener); 68 | 69 | let selectedMonthListener = new MaterialCalendarOnMonthChangedListener({ 70 | get owner(): Calendar { 71 | return _that.get(); 72 | }, 73 | onMonthChanged: function (widget, date) { 74 | let dateISO = new Date(date.getYear(), date.getMonth(), date.getDay()); 75 | this.owner.notify({ 76 | eventName: NSEvents.monthChanged, 77 | object: _that, 78 | data: dateISO 79 | }); 80 | } 81 | }); 82 | 83 | nativeView.setOnMonthChangedListener(selectedMonthListener); 84 | 85 | return nativeView; 86 | } 87 | 88 | [appearanceProperty.setNative](newAppearanceValue: Appearance) { 89 | this.nativeView.setArrowColor(new Color(newAppearanceValue.headerTitleColor).android); 90 | //this.nativeView.setHeaderTextAppearance(android.R.style.android) 91 | 92 | this.nativeView.removeDecorators(); 93 | this.addDecoratorDot(newAppearanceValue.eventColor); 94 | 95 | this.nativeView.setSelectionColor(new Color(newAppearanceValue.selectionColor).android); 96 | 97 | if (!newAppearanceValue.todaySelectionColor) { 98 | newAppearanceValue.todaySelectionColor = newAppearanceValue.selectionColor; 99 | } 100 | if (!newAppearanceValue.borderRadius) { 101 | newAppearanceValue.borderRadius = 50; 102 | } 103 | this.nativeView.removeDecorators(); 104 | this.addDecoratorToday(new Date(), newAppearanceValue.todayColor, newAppearanceValue.todaySelectionColor, newAppearanceValue.borderRadius); 105 | this.addDecoratorDot(this.appearance.eventColor); 106 | /* 107 | if (!oldAppearanceValue || newAppearanceValue.weekdayTextColor !== oldAppearanceValue.weekdayTextColor) { 108 | this._ios.appearance.weekdayTextColor = new Color(newAppearanceValue.weekdayTextColor).ios; 109 | }*/ 110 | 111 | } 112 | 113 | [settingsProperty.setNative](newSettings: Settings) { 114 | let oldSettings = this.settings; 115 | this.nativeView.state().edit() 116 | .setCalendarDisplayMode(newSettings.displayMode) 117 | .commit() 118 | 119 | this.nativeView.setSelectionMode(newSettings.selectionMode); 120 | 121 | this.nativeView.setTitleAnimationOrientation(newSettings.scrollOrientation); 122 | 123 | let firstWeekdayTemp = newSettings.firstWeekday <= 7 && newSettings.firstWeekday > 0 ? newSettings.firstWeekday : 1; 124 | this.nativeView.state().edit() 125 | .setFirstDayOfWeek(firstWeekdayTemp) 126 | .commit(); 127 | 128 | let calendarMaxDate = newSettings.maximumDate; 129 | if (calendarMaxDate) { 130 | this.nativeView.state().edit() 131 | .setMaximumDate(new MaterialCalendarDay(calendarMaxDate.getFullYear(), calendarMaxDate.getMonth(), calendarMaxDate.getDate())) 132 | .commit(); 133 | } 134 | 135 | let calendarMinDate = newSettings.minimumDate; 136 | if (calendarMinDate) { 137 | this.nativeView.state().edit() 138 | .setMinimumDate(new MaterialCalendarDay(calendarMinDate.getFullYear(), calendarMinDate.getMonth(), calendarMinDate.getDate())) 139 | .commit(); 140 | } 141 | } 142 | 143 | [eventsProperty.setNative](newEvents: Array) { 144 | this.nativeView.removeDecorators(); 145 | this.addDecoratorDot(this.appearance.eventColor); 146 | } 147 | 148 | 149 | private addDecoratorToday(date: Date, colorBackgroundValue: string, colorSelectionValue: string, borderRadiusValue: number) { 150 | let _that = this; 151 | this.nativeView.addDecorator(new MaterialCalendarDecorator({ 152 | shouldDecorate: (day: any) => { 153 | let should = false; 154 | if (this.isSameDate(day, date)) { 155 | should = true; 156 | } 157 | return should; 158 | }, 159 | decorate: (view) => { 160 | let newBackgroundColor = colorBackgroundValue === "" ? new Color("red").android : new Color(colorBackgroundValue).android; 161 | let newSelectionColor = colorSelectionValue === "" ? new Color("blue").android : new Color(colorSelectionValue).android; 162 | let highlightDrawable = new android.graphics.drawable.GradientDrawable(); 163 | let setSelectionDrawable = new android.graphics.drawable.GradientDrawable(); 164 | 165 | highlightDrawable.setCornerRadius(borderRadiusValue * 2); 166 | highlightDrawable.setColor(newBackgroundColor); 167 | highlightDrawable.setSize(40, 40); 168 | highlightDrawable.getPadding(new android.graphics.Rect(10, 10, 10, 10)); 169 | 170 | setSelectionDrawable.setCornerRadius(borderRadiusValue * 2); 171 | setSelectionDrawable.setColor(newSelectionColor); 172 | setSelectionDrawable.setSize(40, 40); 173 | setSelectionDrawable.getPadding(new android.graphics.Rect(10, 10, 10, 10)); 174 | view.setBackgroundDrawable(highlightDrawable); 175 | view.setSelectionDrawable(setSelectionDrawable); 176 | } 177 | })); 178 | } 179 | 180 | private addDecoratorDot(colorValue: string) { 181 | let _that = this; 182 | this.nativeView.addDecorator( 183 | new MaterialCalendarDecorator({ 184 | shouldDecorate: (day: any) => { 185 | let should = false; 186 | if (this.events) { 187 | let i = 0; 188 | while (!should && i < this.events.length) { 189 | if (_that.isSameDate(day, this.events[i].date)) { 190 | should = true; 191 | } 192 | i++; 193 | } 194 | } 195 | return should; 196 | }, 197 | decorate: (view) => { 198 | let newColor; 199 | if (colorValue === "") { 200 | newColor = new Color("green").android; 201 | } else { 202 | newColor = new Color(colorValue).android; 203 | } 204 | view.addSpan(new MaterialCalendarDot(5, newColor)); 205 | } 206 | }) 207 | ); 208 | } 209 | 210 | public dateHasEvent(date): boolean { 211 | let i = 0, found = false; 212 | while (!found && i < this.events.length) { 213 | 214 | if (this.isSameDate(date, this.events[i].date)) { 215 | found = true; 216 | } 217 | i++; 218 | } 219 | return found; 220 | } 221 | 222 | private isSameDate(dateOne, dateTwo) { 223 | return dateOne.getMonth() === dateTwo.getMonth() && dateOne.getDay() === dateTwo.getDate(); 224 | } 225 | 226 | public selectDate(date: Date) { 227 | this.nativeView.setDateSelected(new MaterialCalendarDay(date.getFullYear(), date.getMonth(), date.getDate()), true); 228 | } 229 | 230 | public deselectDate(date: Date) { 231 | this.nativeView.setDateSelected(new MaterialCalendarDay(date.getFullYear(), date.getMonth(), date.getDate()), false); 232 | } 233 | } -------------------------------------------------------------------------------- /src/calendar-appearance.d.ts: -------------------------------------------------------------------------------- 1 | export interface Appearance { 2 | weekdayTextColor: string; 3 | headerTitleColor: string; 4 | eventColor: string; 5 | selectionColor: string; 6 | todayColor: string; 7 | todaySelectionColor: string; 8 | borderRadius: number; 9 | hasBorder: boolean; 10 | } 11 | -------------------------------------------------------------------------------- /src/calendar-appearance.ts: -------------------------------------------------------------------------------- 1 | export interface Appearance { 2 | weekdayTextColor: string, 3 | headerTitleColor: string, 4 | eventColor: string, 5 | selectionColor: string, 6 | todayColor: string, 7 | todaySelectionColor: string, 8 | borderRadius: number, 9 | hasBorder: boolean 10 | } -------------------------------------------------------------------------------- /src/calendar-enums.d.ts: -------------------------------------------------------------------------------- 1 | export declare enum SELECTION_MODE { 2 | "SINGLE" = 1, 3 | "MULTIPLE" = 2, 4 | } 5 | export declare enum SCROLL_ORIENTATION { 6 | "VERTICAL", 7 | "HORIZONTAL", 8 | } 9 | export declare enum DISPLAY_MODE { 10 | "WEEK", 11 | "MONTH", 12 | } 13 | -------------------------------------------------------------------------------- /src/calendar-enums.ts: -------------------------------------------------------------------------------- 1 | export enum SELECTION_MODE { 2 | "SINGLE" = 1, 3 | "MULTIPLE" = 2 4 | } 5 | 6 | export declare enum SCROLL_ORIENTATION { 7 | "VERTICAL", 8 | "HORIZONTAL" 9 | } 10 | 11 | export declare enum DISPLAY_MODE { 12 | "WEEK", 13 | "MONTH", 14 | } -------------------------------------------------------------------------------- /src/calendar-event.d.ts: -------------------------------------------------------------------------------- 1 | export declare class CalendarEvent { 2 | private _date; 3 | private _source; 4 | constructor(eventDate: Date, eventSource?: string); 5 | date: Date; 6 | source: string; 7 | } 8 | -------------------------------------------------------------------------------- /src/calendar-event.ts: -------------------------------------------------------------------------------- 1 | export class CalendarEvent { 2 | private _date: Date; 3 | private _source: string; 4 | 5 | constructor(eventDate: Date, eventSource?: string) { 6 | this._date = eventDate; 7 | if (eventSource) { 8 | this._source = eventSource; 9 | } 10 | } 11 | 12 | public get date(): Date { 13 | return this._date; 14 | } 15 | 16 | public set date(eventDate: Date) { 17 | this._date = eventDate; 18 | } 19 | public get source(): string { 20 | return this._source; 21 | } 22 | 23 | public set source(eventSource: string) { 24 | this._source = eventSource; 25 | } 26 | } -------------------------------------------------------------------------------- /src/calendar-settings.d.ts: -------------------------------------------------------------------------------- 1 | import { DISPLAY_MODE, SELECTION_MODE, SCROLL_ORIENTATION } from "./common"; 2 | export interface Settings { 3 | displayMode: DISPLAY_MODE; 4 | selectionMode: SELECTION_MODE; 5 | scrollOrientation: SCROLL_ORIENTATION; 6 | firstWeekday: number; 7 | minimumDate: Date; 8 | maximumDate: Date; 9 | } 10 | -------------------------------------------------------------------------------- /src/calendar-settings.ts: -------------------------------------------------------------------------------- 1 | import { DISPLAY_MODE, SELECTION_MODE, SCROLL_ORIENTATION } from "./common"; 2 | 3 | export interface Settings { 4 | displayMode: DISPLAY_MODE, 5 | selectionMode: SELECTION_MODE, 6 | scrollOrientation: SCROLL_ORIENTATION, 7 | firstWeekday: number, 8 | minimumDate: Date, 9 | maximumDate: Date 10 | } -------------------------------------------------------------------------------- /src/calendar.d.ts: -------------------------------------------------------------------------------- 1 | import { View } from "tns-core-modules/ui/core/view"; 2 | import { Property } from "tns-core-modules/ui/core/properties"; 3 | import { CalendarEvent, Settings, Appearance } from "./common"; 4 | export interface INSEvents { 5 | dateSelected: string; 6 | monthChanged: string; 7 | displayModeChanged: string; 8 | } 9 | export declare const NSEvents: INSEvents; 10 | export declare abstract class CalendarBase extends View { 11 | events: CalendarEvent[]; 12 | settings: Settings; 13 | appearance: Appearance; 14 | } 15 | export declare const settingsProperty: Property; 16 | export declare const appearanceProperty: Property; 17 | export declare const eventsProperty: Property; 18 | -------------------------------------------------------------------------------- /src/calendar.ts: -------------------------------------------------------------------------------- 1 | import { View } from "tns-core-modules/ui/core/view"; 2 | import { Property } from "tns-core-modules/ui/core/properties"; 3 | import { EventData } from "tns-core-modules/data/observable"; 4 | import { isDefined } from "utils/types"; 5 | import { CalendarEvent, Settings, Appearance } from "./common"; 6 | 7 | 8 | export interface INSEvents { 9 | dateSelected: string; 10 | monthChanged: string; 11 | displayModeChanged: string; 12 | } 13 | export const NSEvents: INSEvents = { 14 | dateSelected: "dateSelected", 15 | monthChanged: "monthChanged", 16 | displayModeChanged: "displayModeChanged" 17 | } 18 | 19 | export abstract class CalendarBase extends View { 20 | public events: CalendarEvent[]; 21 | public settings: Settings; 22 | public appearance: Appearance; 23 | } 24 | 25 | export const settingsProperty = new Property({ 26 | name: "settings", 27 | valueChanged: (target: CalendarBase, oldValue: Settings, newValue: Settings): void => { 28 | console.dir(oldValue); 29 | console.dir(newValue); 30 | }, 31 | valueConverter: (value: string): any => { 32 | console.dir(value); 33 | return value; 34 | } 35 | }); 36 | 37 | settingsProperty.register(CalendarBase); 38 | 39 | export const appearanceProperty = new Property({ 40 | name: "appearance" 41 | }); 42 | 43 | appearanceProperty.register(CalendarBase); 44 | 45 | export const eventsProperty = new Property({ 46 | name: "events" 47 | }); 48 | 49 | eventsProperty.register(CalendarBase); 50 | -------------------------------------------------------------------------------- /src/common.d.ts: -------------------------------------------------------------------------------- 1 | export * from './calendar-event'; 2 | export * from './calendar-appearance'; 3 | export * from './calendar-enums'; 4 | export * from './calendar-settings'; 5 | export * from './calendar'; 6 | -------------------------------------------------------------------------------- /src/common.ts: -------------------------------------------------------------------------------- 1 | export * from './calendar-event'; 2 | export * from './calendar-appearance'; 3 | export * from './calendar-enums'; 4 | export * from './calendar-settings'; 5 | export * from './calendar'; 6 | -------------------------------------------------------------------------------- /src/ios/calendar.d.ts: -------------------------------------------------------------------------------- 1 | import { CalendarBase } from "../common"; 2 | export declare enum SCROLL_ORIENTATION { 3 | "VERTICAL", 4 | "HORIZONTAL", 5 | } 6 | export declare enum DISPLAY_MODE { 7 | "WEEK", 8 | "MONTH", 9 | } 10 | export declare class CalendarSubtitle { 11 | private _date; 12 | private _text; 13 | constructor(subtitleDate: any, subtitleText: string); 14 | date: any; 15 | text: string; 16 | } 17 | export declare class Calendar extends CalendarBase { 18 | private _subtitles; 19 | private _delegate; 20 | private _dataSource; 21 | private _calendarHeightConstraint; 22 | constructor(); 23 | readonly ios: any; 24 | onLoaded(): void; 25 | onUnloaded(): void; 26 | disposeNativeView(): void; 27 | readonly calendarHeightConstraint: NSLayoutConstraint; 28 | setCalendarHeightConstraint(height: number): void; 29 | subtitles: Array; 30 | dateSelectedEvent(date: any): void; 31 | pageChanged(calendar: any, date: any): void; 32 | dateHasEvent(date: any): number; 33 | dateHasEventImage(date: any): string; 34 | dateHasSubtitle(date: any): string; 35 | private isSameDate(dateOne, dateTwo); 36 | reload(): void; 37 | displayModeChanged(bounds: any): void; 38 | selectDate(date: Date): void; 39 | deselectDate(date: Date): void; 40 | } 41 | -------------------------------------------------------------------------------- /src/ios/calendar.ts: -------------------------------------------------------------------------------- 1 | import { 2 | CalendarEvent, 3 | CalendarBase, 4 | SELECTION_MODE, 5 | Appearance, 6 | NSEvents, 7 | Settings, 8 | settingsProperty, 9 | appearanceProperty, 10 | eventsProperty 11 | } from "../common"; 12 | import { isDefined } from "utils/types"; 13 | import { Color } from "tns-core-modules/color"; 14 | 15 | declare const FSCalendar, 16 | FSCalendarScrollDirectionVertical, 17 | FSCalendarScrollDirectionHorizontal, 18 | FSCalendarScopeWeek, 19 | FSCalendarScopeMonth, 20 | FSCalendarDelegate, 21 | FSCalendarDataSource, 22 | CGRectMake; 23 | 24 | export enum SCROLL_ORIENTATION { 25 | "VERTICAL" = FSCalendarScrollDirectionVertical, 26 | "HORIZONTAL" = FSCalendarScrollDirectionHorizontal 27 | } 28 | 29 | export enum DISPLAY_MODE { 30 | "WEEK" = FSCalendarScopeWeek, 31 | "MONTH" = FSCalendarScopeMonth 32 | } 33 | 34 | export class CalendarSubtitle { 35 | private _date: any; 36 | private _text: string 37 | constructor(subtitleDate: any, subtitleText: string) { 38 | this._date = subtitleDate; 39 | this._text = subtitleText; 40 | } 41 | 42 | public get date() { 43 | return this._date; 44 | } 45 | 46 | public set date(subtitleDate: any) { 47 | this._date = subtitleDate; 48 | } 49 | 50 | public get text(): string { 51 | return this._text; 52 | } 53 | 54 | public set text(subtitleText: string) { 55 | this._text = subtitleText; 56 | } 57 | } 58 | 59 | class CalendarDelegate extends NSObject { 60 | public static ObjCProtocols = [FSCalendarDelegate]; 61 | private _owner: WeakRef; 62 | 63 | public static initWithOwner(owner: WeakRef): CalendarDelegate { 64 | let delegate = CalendarDelegate.new() as CalendarDelegate; 65 | delegate._owner = owner; 66 | return delegate; 67 | } 68 | 69 | public get owner(): WeakRef { 70 | return this._owner; 71 | } 72 | public calendarDidSelectDateAtMonthPosition?(calendar: any, date: Date, monthPosition: any): void { 73 | if (this._owner) { 74 | this._owner.get().dateSelectedEvent(date); 75 | } 76 | } 77 | public calendarDidDeselectDateAtMonthPosition(calendar: any, date: Date, monthPosition: any): void { 78 | if (this._owner) { 79 | this._owner.get().dateSelectedEvent(date); 80 | } 81 | } 82 | public calendarCurrentPageDidChange(calendar) { 83 | if (this._owner) { 84 | this._owner.get().pageChanged(calendar, calendar.currentPage); 85 | } 86 | } 87 | public calendarBoundingRectWillChangeAnimated(calendar: any, bounds: CGRect, animated: boolean): void { 88 | //this._owner.get().ios.frame.size.height = bounds.size.height; 89 | //this._owner.get().height = bounds.size.height; 90 | //this._owner.get().setSalendarHeightConstraint(bounds.size.height); 91 | /*let _that = new WeakRef(this); 92 | UIView.animateWithDurationDelayOptionsAnimationsCompletion(0.3, 0, UIViewAnimationOptions.CurveEaseInOut, () => { 93 | /*let view = _that.get()._owner.get().ios; 94 | let theView = new UIView({ frame: CGRectMake(0, 0, view.width, bounds.size.height) }); 95 | view = theView; 96 | let container = _that.get()._owner; 97 | container.get().height = bounds.size.height; 98 | _that.get()._owner = container; 99 | }, (bool) => { 100 | });*/ 101 | /* 102 | calendar.frame = (CGRect){calendar.frame.origin,bounds.size} 103 | */ 104 | console.log('is parent defined?'); 105 | 106 | let iosFrame = this._owner.get().ios.frame; 107 | //iosFrame.size.height = bounds.size.height 108 | calendar.frame = CGRectMake(0, 0, bounds.size.width, bounds.size.height); 109 | //this._owner.get().ios.frame = CGRectMake(0, 0, bounds.size.width, bounds.size.height); 110 | 111 | //parent.nativeView.frame = CGRectMake(0, 0, parent.nativeView.frame.size.width, parent.nativeView.frame.size.height - bounds.size.height); 112 | 113 | //this._owner.get().setCalendarHeightConstraint(bounds.size.height); 114 | /*console.dir(this._owner.get().nativeView.ios); 115 | this._owner.get().nativeView.layoutIfNeeded();*/ 116 | 117 | //this._owner.get().ios.layoutIfNeeded(); 118 | // parent.nativeView.layoutIfNeeded(); 119 | 120 | this._owner.get().displayModeChanged(bounds); 121 | } 122 | 123 | } 124 | 125 | class CalendarDataSource extends NSObject { 126 | public static ObjCProtocols = [FSCalendarDataSource]; 127 | private _owner: WeakRef; 128 | 129 | public static initWithOwner(owner: WeakRef): CalendarDataSource { 130 | let source = CalendarDataSource.new() as CalendarDataSource; 131 | source._owner = owner; 132 | return source; 133 | } 134 | 135 | public calendarSubtitleForDate(calendar, date: NSDate): string { 136 | if (this._owner) 137 | return this._owner.get().dateHasSubtitle(date); 138 | return undefined; 139 | } 140 | 141 | public maximumDateForCalendar(calendar: any): Date { 142 | let maximumDate = this._owner && this._owner.get().settings && isDefined(this._owner.get().settings.maximumDate) ? this._owner.get().settings.maximumDate : null; 143 | return maximumDate; 144 | } 145 | public minimumDateForCalendar(calendar: any): Date { 146 | let minimumDate = this._owner.get().settings && isDefined(this._owner.get().settings.minimumDate) ? this._owner.get().settings.minimumDate : null; 147 | return minimumDate; 148 | } 149 | 150 | public calendarNumberOfEventsForDate(calendar, date: Date): number { 151 | if (this._owner) 152 | return this._owner.get().dateHasEvent(date); 153 | return 0; 154 | } 155 | 156 | } 157 | export class Calendar extends CalendarBase { 158 | private _subtitles: Array; 159 | private _delegate: CalendarDelegate; 160 | private _dataSource: CalendarDataSource; 161 | private _calendarHeightConstraint: NSLayoutConstraint; 162 | 163 | constructor() { 164 | 165 | super(); 166 | this.nativeView = FSCalendar.alloc().initWithFrame(CGRectMake(0, 0, 320, 300)); 167 | this._delegate = CalendarDelegate.initWithOwner(new WeakRef(this)); 168 | this._dataSource = CalendarDataSource.initWithOwner(new WeakRef(this)); 169 | this._calendarHeightConstraint = new NSLayoutConstraint(); 170 | this.appearance = { 171 | weekdayTextColor: "black", 172 | headerTitleColor: "black", 173 | eventColor: "red", 174 | selectionColor: "blue", 175 | todayColor: "yellow", 176 | todaySelectionColor: "orange", 177 | borderRadius: 25 178 | } 179 | this.settings = { 180 | displayMode: DISPLAY_MODE.MONTH, 181 | scrollOrientation: SCROLL_ORIENTATION.HORIZONTAL, 182 | selectionMode: SELECTION_MODE.SINGLE, 183 | firstWeekday: 3, 184 | maximumDate: undefined, 185 | minimumDate: undefined 186 | }; 187 | } 188 | 189 | public get ios() { 190 | return this.nativeView; 191 | } 192 | 193 | public onLoaded() { 194 | super.onLoaded(); 195 | if (this.height) { 196 | this.nativeView.frame.size.height = this.getMeasuredHeight(); 197 | this.nativeView.frame.size.height = this.getMeasuredHeight(); 198 | this._calendarHeightConstraint.constant = this.getMeasuredHeight(); 199 | } 200 | if (this.width) { 201 | this.nativeView.frame.size.width = this.getMeasuredWidth(); 202 | this.nativeView.frame.size.width = this.getMeasuredWidth(); 203 | } 204 | this.nativeView.delegate = this._delegate; 205 | this.nativeView.dataSource = this._dataSource; 206 | } 207 | 208 | public onUnloaded() { 209 | this._delegate = null; 210 | this._dataSource = null; 211 | } 212 | 213 | public disposeNativeView() { 214 | this.nativeView.delegate = null; 215 | this.nativeView.dataSource = null; 216 | } 217 | 218 | public get calendarHeightConstraint(): NSLayoutConstraint { 219 | return this._calendarHeightConstraint 220 | } 221 | 222 | public setCalendarHeightConstraint(height: number) { 223 | this._calendarHeightConstraint.constant = height; 224 | } 225 | 226 | [settingsProperty.setNative](newSettings: Settings) { 227 | 228 | this.nativeView.setScopeAnimated(newSettings.displayMode, true); 229 | 230 | this.nativeView.allowsMultipleSelection = newSettings.selectionMode === SELECTION_MODE.MULTIPLE ? true : false; 231 | 232 | this.nativeView.scrollDirection = newSettings.scrollOrientation === 0 ? SCROLL_ORIENTATION.VERTICAL : SCROLL_ORIENTATION.HORIZONTAL; 233 | 234 | let firstWeekdayTemp = newSettings.firstWeekday <= 7 && newSettings.firstWeekday > 0 ? newSettings.firstWeekday : 1; 235 | 236 | this.nativeView.firstWeekday = firstWeekdayTemp; 237 | 238 | //maximumDate 239 | 240 | //minimumDate 241 | } 242 | 243 | [appearanceProperty.setNative](newAppearanceValue: Appearance) { 244 | 245 | this.nativeView.appearance.weekdayTextColor = new Color(newAppearanceValue.weekdayTextColor).ios; 246 | 247 | this.nativeView.appearance.headerTitleColor = new Color(newAppearanceValue.headerTitleColor).ios; 248 | 249 | this.nativeView.appearance.eventColor = new Color(newAppearanceValue.eventColor).ios; 250 | 251 | this.nativeView.appearance.selectionColor = new Color(newAppearanceValue.selectionColor).ios; 252 | 253 | this.nativeView.appearance.todayColor = new Color(newAppearanceValue.todayColor).ios; 254 | 255 | this.nativeView.appearance.todaySelectionColor = new Color(newAppearanceValue.todaySelectionColor).ios; 256 | 257 | this.nativeView.appearance.borderRadius = newAppearanceValue.borderRadius; 258 | 259 | this.nativeView.clipsToBounds = newAppearanceValue.hasBorder; 260 | 261 | } 262 | 263 | public set subtitles(calendarSubtitles: Array) { 264 | if (this._subtitles !== calendarSubtitles) { 265 | this._subtitles = calendarSubtitles; 266 | } 267 | } 268 | 269 | public dateSelectedEvent(date) { 270 | this.notify({ 271 | eventName: NSEvents.dateSelected, 272 | object: this, 273 | data: date 274 | }); 275 | } 276 | 277 | public pageChanged(calendar, date) { 278 | this.notify({ 279 | eventName: NSEvents.monthChanged, 280 | object: this, 281 | data: date 282 | }); 283 | } 284 | 285 | public dateHasEvent(date): number { 286 | let countEventsDate = 0; 287 | let _that = this; 288 | this.events.forEach(function (event) { 289 | if (_that.isSameDate(date, event.date)) { 290 | countEventsDate++; 291 | } 292 | }) 293 | return countEventsDate; 294 | } 295 | 296 | [eventsProperty.setNative](newEvents: CalendarEvent) { 297 | this.nativeView.dataSource = CalendarDataSource.initWithOwner(new WeakRef(this)); 298 | } 299 | 300 | public dateHasEventImage(date): string { 301 | let i = 0, found = undefined; 302 | while (!found && i < this.events.length) { 303 | if (this.isSameDate(date, this.events[i].date) && this.events[i].source) { 304 | found = this.events[i].source; 305 | } 306 | i++; 307 | } 308 | return found; 309 | } 310 | 311 | public dateHasSubtitle(date): string { 312 | let found = undefined; 313 | if (this._subtitles) { 314 | let i = 0; 315 | while (!found && i < this._subtitles.length) { 316 | if (this.isSameDate(date, this._subtitles[i].date)) { 317 | found = this._subtitles[i].text; 318 | } 319 | i++; 320 | } 321 | } 322 | return found; 323 | } 324 | 325 | private isSameDate(dateOne, dateTwo) { 326 | return dateOne.getMonth() === dateTwo.getMonth() && dateOne.getDay() === dateTwo.getDay() && dateOne.getYear() === dateTwo.getYear() && dateOne.getDate() === dateTwo.getDate(); 327 | } 328 | 329 | 330 | public reload() { 331 | this.nativeView.reloadData(); 332 | } 333 | 334 | public displayModeChanged(bounds) { 335 | this.notify({ 336 | eventName: NSEvents.displayModeChanged, 337 | object: this, 338 | data: bounds 339 | }); 340 | } 341 | public selectDate(date: Date) { 342 | this.nativeView.selectDate(date); 343 | } 344 | public deselectDate(date: Date) { 345 | this.nativeView.deselectDate(date); 346 | } 347 | } -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es5", 5 | "noImplicitAny": false, 6 | "removeComments": true, 7 | "preserveConstEnums": true, 8 | "sourceMap": false, 9 | "declaration": true, 10 | "noLib": false, 11 | "noEmitHelpers": true, 12 | "experimentalDecorators": true, 13 | "lib": [ 14 | "es6", 15 | "dom" 16 | ], 17 | "baseUrl": ".", 18 | "paths": { 19 | "*": [ 20 | "./node_modules/tns-core-modules/*", 21 | "./node_modules/*" 22 | ] 23 | } 24 | }, 25 | "exclude": [ 26 | "node_modules", 27 | "platforms", 28 | "demo" 29 | ] 30 | } --------------------------------------------------------------------------------