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

Commit e07ef16

Browse files
author
eksrvb
committed
unification-github-gitlab
1 parent df2bdb8 commit e07ef16

File tree

15 files changed

+641
-477
lines changed

15 files changed

+641
-477
lines changed

README.md

Lines changed: 45 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ From version 3.0.0 onwards there will be a stable API with extensive features an
1010
### Working demo
1111
[demo github project](https://github.com/eksrvb/material-calendar-demo)
1212

13+
If you want to give me feedback and don't want to open an issue on github, please fill out the [form](https://forms.gle/W9TygXf65Yru3VHi7)
14+
1315
![material-calendar-single-month](https://github.com/eksrvb/material-calendar/raw/main/docs/material-calendar-single-month.png)
1416
![material-calendar-three-months](https://github.com/eksrvb/material-calendar/raw/main/docs/material-calendar-three-months.png)
1517
![material-calendar-two-months-with-placeholder](https://github.com/eksrvb/material-calendar/raw/main/docs/material-calendar-two-months-with-placeholder.png)
@@ -46,78 +48,71 @@ In my case: `{provide: LOCALE_ID, useValue: 'de-DE' }`
4648

4749
In your html:
4850
``` html
49-
<calendar-panels></calendar-panels>
50-
```
51-
and you are good to go ;)
52-
53-
All options are shown here:
54-
55-
``` html
56-
<calendar-panels
57-
[mode]="mode"
58-
[placeholderDay]="placeholder"
51+
<calendar-panel
52+
placeholderDay="true"
5953
year="2020"
60-
month="3"
54+
month="10"
6155
monthsBefore="1"
62-
monthsAfter="1"
56+
monthsAfter="2"
57+
[dataSource]="dataSource"
6358
[config]="calendarConfig"
64-
(clickDate)="yourMethod($event)">
65-
</calendar-panels>
66-
<!--
67-
default mode = monthly
68-
default placeholderDay = false
69-
default year = current year
70-
default month = current month
71-
default monthsBefore = 1
72-
default monthsAfter = 1
73-
-->
59+
(clickDate)="testMethod($event)">
60+
</calendar-panel>
61+
<!--
62+
default placeholderDay = false override: boolean
63+
default year = current year override: year to start (number)
64+
default month = current month override: month to start (number)
65+
default monthsBefore = 0
66+
default monthsAfter = 0
67+
dataSource your custom dataSource
68+
config insert your configuration
69+
clickDate recive an click event from the component
70+
-->
7471
```
72+
7573
``` typescript
76-
import { CalendarConfig } from 'material-calendar';
74+
import { CalendarConfig, DayC } from 'material-calendar';
7775

78-
placeholder = false // boolean ...can be hardcoded in html
79-
mode = 'monthly' // 'annual' | 'monthly' ...can be hardcoded in html
76+
placeholder = false // boolean
8077

8178
calendarConfig: CalendarConfig = {
82-
panelBgColor: '#00677f', // use only hex or rbg colors
83-
autoTextColor: true,
84-
textColor: '#fff', // use only hex or rbg colors
85-
displayYear: true,
79+
calendarConfig: CalendarConfig = {
80+
renderMode: 'monthly', // 'annual' | 'monthly'
81+
selectMode: 'range', // 'click' | 'range'
82+
displayYear: false,
8683
firstDayOfWeekMonday: true,
87-
todayColor: '#fff',
88-
panelWidth: '100%', // can also be fix values such as 350px
8984
calendarWeek: true,
90-
switches: false,
85+
switches: true,
86+
}
9187
}
92-
```
93-
``` javascript
94-
/**
95-
* @param {boolean} autoTextColor Sets the text color automatically, based on the backgroud colors
96-
* @param {boolean} calendarWeek display the calendar week
97-
* @param {boolean} displayYear displays the year next to the Month name
98-
* @param {boolean} switches display switches in calendar component or not
99-
* @param {string} panelBgColor sets the background color of the panel
100-
* @param {string} textColor if autoTextColor false this must be set to a custom color
101-
*
102-
*/
103-
```
10488

105-
## Planned features
106-
107-
- insert your own calendar data and render the new template
108-
- multiselect days optional (returns the daily span)
89+
dataSource: DayC[] = [
90+
{
91+
date: 1604185200000,
92+
backgroundColor: 'rgba(0, 0, 255, 0.5)',
93+
toolTip: 'Test ToolTip',
94+
badgeMode: 'Icon',
95+
badgeInt: 5,
96+
badgeIcon: 'edit'
97+
},
98+
{
99+
date: 1604199900000,
100+
backgroundColor: 'blue'
101+
}
102+
]
103+
```
109104

110-
and many more...
111105

112106
## Features
113107

114108
- generate a nice calendar in material design
115109
- get a date back with the annotation "clickDate" (see example)
110+
- insert your own calendar data and render the new template
111+
- multiselect days optional (returns the daily span)
116112

117113
## Code scaffolding
118114

119115
For code scaffolding, the project can be checked out from the public repository and pull requests can be made.
120-
121116

122117
## Build
123118

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,7 @@
11
<div class="selection">
2-
<mat-form-field>
3-
<mat-label>Select Mode</mat-label>
4-
<mat-select [(ngModel)]="mode" name="mode">
5-
<mat-option value="monthly">monthly</mat-option>
6-
<mat-option value="annual">annual</mat-option>
7-
</mat-select>
8-
</mat-form-field>
9-
102
<mat-slide-toggle [(ngModel)]="placeholder">
113
Days placeholder
124
</mat-slide-toggle>
13-
<!-- <mat-slide-toggle [(ngModel)]="calendarConfig.calendarWeek">
14-
Calendar week
15-
</mat-slide-toggle> -->
165

176
<mat-form-field>
187
<mat-label>Months before</mat-label>
@@ -28,15 +17,14 @@
2817
</mat-select>
2918
</mat-form-field>
3019

20+
<div>
21+
Events: {{ latestEvent | json }}
22+
</div>
23+
3124
</div>
3225

3326
<div>
34-
<calendar-panels [mode]="mode" [placeholderDay]="placeholder" year="2021" month="5" [monthsBefore]="monthsBefore"
27+
<calendar-panel [placeholderDay]="placeholder" [dataSource]="dataSource" year="2021" month="5" [monthsBefore]="monthsBefore"
3528
[monthsAfter]="monthsAfter" [config]="calendarConfig" (clickDate)="testMethod($event)">
36-
</calendar-panels>
37-
</div>
38-
39-
<!-- <div style="width: 600px;">
40-
<calendar-panel [placeholderDay]="placeholder" year="2020" month="5" [config]="calendarConfig" (clickDate)="testMethod($event)">
4129
</calendar-panel>
42-
</div> -->
30+
</div>

projects/lib-workspace/src/app/app.component.scss

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
1+
/* .selection {
2+
width: 100%;
3+
} */
4+
15
.selection {
26
width: 100%;
7+
align-items: center;
8+
display: flex;
9+
justify-content: center;
310
}
411

512
.selection > * {
Lines changed: 42 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Component, OnInit } from '@angular/core';
2-
import { CalendarConfig } from 'projects/material-calendar/src/public-api';
2+
import { CalendarConfig, DayC } from 'projects/material-calendar/src/public-api';
33

44
@Component({
55
selector: 'app-root',
@@ -10,35 +10,64 @@ export class AppComponent implements OnInit {
1010
title = 'Material Calendar Demo';
1111

1212
placeholder = false // boolean
13-
mode = 'monthly' // 'annual' | 'monthly'
13+
isLoading = true
14+
latestEvent = ""
1415

15-
monthsAfterBefore = Array(11).fill(0).map((x, i) => i);
16+
monthsAfterBefore = Array(5).fill(0).map((x, i) => i);
1617
monthsBefore = 0;
1718
monthsAfter = 0;
1819

1920
calendarConfig: CalendarConfig = {
20-
panelBgColor: '#ffffff',
21-
autoTextColor: true,
22-
textColor: '#fff',
21+
renderMode: 'monthly', // 'annual' | 'monthly'
22+
selectMode: 'click', // 'click' | 'range'
2323
displayYear: true,
2424
firstDayOfWeekMonday: true,
25-
calendarWeek: true,
26-
todayColor: '#000000',
27-
panelWidth: '300px',
25+
calendarWeek: false,
2826
switches: true,
27+
panelWidth: '300px'
2928
}
3029

30+
dataSource: DayC[] = [
31+
{
32+
date: 1624312800000,
33+
backgroundColor: '#0167c7',
34+
toolTip: 'Test ToolTip',
35+
badgeMode: 'Icon',
36+
badgeInt: 5,
37+
badgeIcon: 'edit'
38+
},
39+
{
40+
date: 1624312800000,
41+
backgroundColor: 'rgb(6, 182, 0)',
42+
toolTip: 'Test ToolTip',
43+
badgeMode: 'Icon',
44+
badgeInt: 5,
45+
badgeIcon: 'edit'
46+
},
47+
{
48+
date: 1624658400000,
49+
backgroundColor: 'rgb(6, 182, 0)',
50+
toolTip: 'Test ToolTip 2',
51+
/* badgeMode: 'Icon',
52+
badgeInt: 5,
53+
badgeIcon: 'edit' */
54+
},
55+
{
56+
date: 1604199900000,
57+
backgroundColor: 'blue'
58+
}
59+
]
60+
3161
constructor() {
3262
}
3363

3464
ngOnInit() {
65+
console.log(this.dataSource)
66+
this.isLoading = false
3567
}
3668

3769
testMethod(event) {
70+
this.latestEvent = event;
3871
console.log(event)
3972
}
40-
41-
switchMode() {
42-
this.mode = (this.mode === 'monthly') ? 'annual' : 'monthly'
43-
}
4473
}

projects/lib-workspace/src/app/app.module.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ import { NgModule, LOCALE_ID } from '@angular/core';
44
import { AppComponent } from './app.component';
55
import { MaterialCalendarModule } from 'projects/material-calendar/src/public-api';
66
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
7-
import { MaterialModule } from './material';
87
import { FormsModule } from '@angular/forms';
8+
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
9+
import { MatFormFieldModule } from '@angular/material/form-field';
10+
import { MatSelectModule } from '@angular/material/select';
911

1012
@NgModule({
1113
declarations: [
@@ -14,8 +16,10 @@ import { FormsModule } from '@angular/forms';
1416
imports: [
1517
BrowserModule,
1618
BrowserAnimationsModule,
17-
MaterialModule,
1819
FormsModule,
20+
MatSlideToggleModule,
21+
MatFormFieldModule,
22+
MatSelectModule,
1923
MaterialCalendarModule
2024
],
2125
providers: [

projects/lib-workspace/src/app/material.ts

Lines changed: 0 additions & 88 deletions
This file was deleted.

0 commit comments

Comments
 (0)