Skip to content
This repository was archived by the owner on Mar 4, 2023. It is now read-only.

Commit ffdf093

Browse files
author
eksrvb
committed
more docs
1 parent c9a6da4 commit ffdf093

File tree

1 file changed

+48
-73
lines changed

1 file changed

+48
-73
lines changed

docs/api.md

Lines changed: 48 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -25,90 +25,65 @@ The first and most common is the [monthly](https://eksrvb.github.io/material-cal
2525

2626
In addition to this modes, there is also a basic configuration, as shown below.
2727

28-
## Bacis Installation of material-calendar
28+
## API reference for material-calendar
2929

3030
import the `MaterialCalendarModule` and optional provide your location.<br>
3131
In my case: `{provide: LOCALE_ID, useValue: 'de-DE' }`
3232

3333
File: app.module.ts
3434

3535
```typescript
36-
import { BrowserModule } from '@angular/platform-browser';
37-
import { NgModule, LOCALE_ID } from '@angular/core';
38-
39-
import { AppComponent } from './app.component';
4036
import { MaterialCalendarModule } from 'material-calendar'; // <-- add this line
37+
```
4138

42-
@NgModule({
43-
declarations: [
44-
AppComponent
45-
],
46-
imports: [
47-
BrowserModule,
48-
MaterialCalendarModule // <-- add this line
49-
],
39+
Optionally provide your location:
40+
```typescript
41+
[...]
5042
providers: [
5143
{provide: LOCALE_ID, useValue: 'de-DE' } // <-- add this line (depending on your location)
5244
],
53-
bootstrap: [AppComponent]
54-
})
55-
export class AppModule { }
45+
[...]
5646
```
5747

58-
In your html:
59-
60-
```html
61-
<calendar-panel></calendar-panel>
62-
```
63-
64-
and you are good to go ; )
65-
66-
All options are shown here:
67-
68-
```html
69-
<calendar-panel [placeholderDay]="placeholder" [dataSource]="dataSource" year="2021" month="5" [monthsBefore]="monthsBefore" [monthsAfter]="monthsAfter" [config]="calendarConfig" (clickDate)="testMethod($event)">
70-
</calendar-panel>
71-
<!--
72-
default placeholderDay = false
73-
default year = current year
74-
default month = current month
75-
default monthsBefore = 0
76-
default monthsAfter = 0
77-
-->
78-
```
79-
80-
> Note: the values entered here are default values
81-
82-
```typescript
83-
import { CalendarConfig } from 'material-calendar';
84-
85-
placeholder = false // boolean ...can be hardcoded in html
86-
87-
calendarConfig: CalendarConfig = {
88-
renderMode: 'monthly', // 'annual' | 'monthly'
89-
selectMode: 'click', // 'click' | 'range'
90-
displayYear: true,
91-
firstDayOfWeekMonday: true,
92-
calendarWeek: false,
93-
switches: true,
94-
bluredDays: false,
95-
markWeekend: true,
96-
panelWidth: '350px'
97-
};
98-
```
99-
100-
The interface for CalendarConfig:
101-
102-
```typescript
103-
/**
104-
* @param {string} renderMode choose render mode ('annual' or 'monthly')
105-
* @param {string} selectMode choose select mode ('click' or 'range')
106-
* @param {boolean} calendarWeek display the calendar week
107-
* @param {boolean} displayYear displays the year next to the Month name
108-
* @param {boolean} switches show arrows to navigate an month forward or backwards
109-
* @param {boolean} bluredDays make an circle around the number of the day
110-
* @param {boolean} markWeekend highlight weekends
111-
* @param {boolean} firstDayOfWeekMonday set first day of week (monday or sunday)
112-
* @param {string} panelWidth set a with for an single panel
113-
*/
114-
```
48+
## selectors
49+
50+
### calendar-panel
51+
52+
| Name | Default | Description |
53+
| ---- | ------- | ----------- |
54+
| placeholderDay: boolean | false | |
55+
| dataSource: DayC[] | null | |
56+
| year: number | current year | |
57+
| month: number | current month | |
58+
| monthsBefore: number | 0 | |
59+
| monthsAfter: number | 0 | |
60+
| config: CalendarConfig | null | |
61+
| (clickDate) | - | |
62+
63+
## interfaces
64+
65+
### CalendarConfig
66+
67+
| Name | Default | Description |
68+
| ---- | ------- | ----------- |
69+
| {string} renderMode | monthly | choose render mode ('annual' or 'monthly') |
70+
| {string} selectMode | click | choose select mode ('click' or 'range') |
71+
| {boolean} calendarWeek | false | display the calendar week |
72+
| {boolean} displayYear | true | displays the year next to the Month name |
73+
| {boolean} switches | true | show arrows to navigate an month forward or backwards |
74+
| {boolean} bluredDays | false | make an circle around the number of the day |
75+
| {boolean} markWeekend | true | highlight weekends |
76+
| {boolean} firstDayOfWeekMonday | true | set first day of week (monday or sunday) |
77+
| {string} panelWidth | 350px | set a with for an single panel |
78+
79+
### DayC
80+
81+
| Name | Default | Description |
82+
| ---- | ------- | ----------- |
83+
| {Date} date | null | Date to match |
84+
| {string} color | null | set a custom color (hex, string, or var) |
85+
| {string} backgroundColor | null | set a custom Background Color (hex, string, or var) |
86+
| {string} badgeMode | null | badgeMode options: 'Int' or 'Icon' |
87+
| {number} badgeInt | null | if badgeMode == 'Int', set our Number here |
88+
| {string} badgeIcon | null | if badgeMode == 'Icon', set Icon (Matireal-Icons) |
89+
| {string} toolTip | null | if set, this displays a mat-tooltip |

0 commit comments

Comments
 (0)