|
1 | | -# MaterialCalendar |
| 1 | +# Material Calendar |
| 2 | +Please read this **before** usage! |
| 3 | +This material calendar is just beginning. As in the angular material components, a beautiful calendar is to be generated by simple integration. Cooperation is welcome. |
2 | 4 |
|
3 | | -This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 9.1.9. |
| 5 | +### Live demo |
| 6 | +comming soon... |
| 7 | + |
| 8 | +## Installing |
| 9 | +`npm i material-calendar` |
| 10 | + |
| 11 | +## Usage |
| 12 | +app.module.ts |
| 13 | +``` typescript |
| 14 | +import { BrowserModule } from '@angular/platform-browser'; |
| 15 | +import { NgModule, LOCALE_ID } from '@angular/core'; |
| 16 | + |
| 17 | +import { AppComponent } from './app.component'; |
| 18 | +import { MaterialCalendarModule } from 'material-calendar'; |
| 19 | + |
| 20 | +@NgModule({ |
| 21 | + declarations: [ |
| 22 | + AppComponent |
| 23 | + ], |
| 24 | + imports: [ |
| 25 | + BrowserModule, |
| 26 | + MaterialCalendarModule |
| 27 | + ], |
| 28 | + providers: [ |
| 29 | + {provide: LOCALE_ID, useValue: 'de-DE' } |
| 30 | + ], |
| 31 | + bootstrap: [AppComponent] |
| 32 | +}) |
| 33 | +export class AppModule { } |
| 34 | +``` |
| 35 | +import the `MaterialCalendarModule` and optional provide your location. |
| 36 | +In my case: `{provide: LOCALE_ID, useValue: 'de-DE' }` |
| 37 | + |
| 38 | +In your html: |
| 39 | +``` html |
| 40 | +<calendar-panels></calendar-panels> |
| 41 | +``` |
| 42 | +and you are good to go ;) |
| 43 | + |
| 44 | +All options are shown here: |
| 45 | + |
| 46 | +``` html |
| 47 | +<calendar-panels |
| 48 | + [mode]="mode" |
| 49 | + [placeholderDay]="placeholder" |
| 50 | + year="2020" |
| 51 | + month="3" |
| 52 | + monthsBefore="1" |
| 53 | + monthsAfter="1" |
| 54 | + [config]="calendarConfig"> |
| 55 | +</calendar-panels> |
| 56 | +<!-- |
| 57 | + default placeholderDay = false |
| 58 | + default year = current year |
| 59 | + default month = current month |
| 60 | + default monthsBefore = 1 |
| 61 | + default monthsAfter = 1 |
| 62 | +--> |
| 63 | +``` |
| 64 | +``` typescript |
| 65 | +import { CalendarConfig } from 'material-calendar'; |
| 66 | + |
| 67 | +placeholder = false // boolean |
| 68 | +mode = 'monthly' // 'annual' | 'monthly' |
| 69 | + |
| 70 | +calendarConfig: CalendarConfig = { |
| 71 | + panelBgColor: '#00677f', // use only hex or rbg colors |
| 72 | + autoTextColor: true, |
| 73 | + textColor: '#fff', // use only hex or rbg colors |
| 74 | + useHolidays: false, |
| 75 | + holidayColor: 'rgb(253, 173, 0)', // use only hex or rbg colors |
| 76 | + holidayTextColor: 'rgb(253, 173, 0)', // use only hex or rbg colors |
| 77 | + displayYear: true, |
| 78 | + calendarWeek: true, |
| 79 | + switches: false, |
| 80 | +} |
| 81 | +``` |
| 82 | +``` javascript |
| 83 | +/** |
| 84 | +* @param {boolean} autoTextColor Sets the text color automatically, based on the backgroud colors |
| 85 | +* @param {boolean} calendarWeek display the calendar week |
| 86 | +* @param {boolean} useHolidays use holidays, only german (for now) |
| 87 | +* @param {boolean} displayYear displays the year next to the Month name |
| 88 | +* @param {boolean} switches not fullt implemented! |
| 89 | +* @param {string} panelBgColor sets the background color of the panel |
| 90 | +* @param {string} textColor if autoTextColor false this must be set to a custom color |
| 91 | +* @param {string} holidayColor sets the background color of the holiday field |
| 92 | +* @param {string} holidayTextColor sets the text color of the holiday field |
| 93 | +* |
| 94 | +*/ |
| 95 | +``` |
| 96 | + |
| 97 | +## Planned features |
| 98 | + |
| 99 | +- insert your own calendar data and render the new template |
| 100 | +- multiselect days optional (returns the daily span) |
| 101 | + |
| 102 | +and many more... |
4 | 103 |
|
5 | 104 | ## Code scaffolding |
6 | 105 |
|
7 | | -Run `ng generate component component-name --project material-calendar` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project material-calendar`. |
8 | | -> Note: Don't forget to add `--project material-calendar` or else it will be added to the default project in your `angular.json` file. |
| 106 | +For code scaffolding, the project can be checked out from the public repository and pull requests can be made. |
| 107 | + |
9 | 108 |
|
10 | 109 | ## Build |
11 | 110 |
|
| 111 | + |
12 | 112 | Run `ng build material-calendar` to build the project. The build artifacts will be stored in the `dist/` directory. |
13 | 113 |
|
14 | 114 | ## Publishing |
15 | 115 |
|
16 | 116 | After building your library with `ng build material-calendar`, go to the dist folder `cd dist/material-calendar` and run `npm publish`. |
17 | 117 |
|
| 118 | + |
| 119 | + |
18 | 120 | ## Running unit tests |
19 | 121 |
|
| 122 | + |
| 123 | + |
20 | 124 | Run `ng test material-calendar` to execute the unit tests via [Karma](https://karma-runner.github.io). |
21 | 125 |
|
22 | | -## Further help |
| 126 | + |
23 | 127 |
|
24 | | -To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md). |
| 128 | +## Further help |
| 129 | +For feature requests or problems, please open a ticket in the issue tracker. |
0 commit comments