-
Notifications
You must be signed in to change notification settings - Fork 1
/
pf-calendar.html
171 lines (148 loc) · 7.75 KB
/
pf-calendar.html
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
<link rel="import" href="../polymer/polymer.html">
<link rel="import" href="../pf-calendar-events/pf-calendar-events.html">
<link rel="import" href="../pf-calendar-events-data/pf-calendar-events-data.html">
<!--
### Styling
The following custom properties and mixins are available for styling:
Custom property | Description | Default
----------------------------------------|-----------------------------------------|-------------------------
`--pf-calendar-bg-color` | Calendar background | #4A4A4A
`--pf-calendar-width` | Calendar Width | 420px
`--pf-calendar-height` | Calendar Height | 570px
`--pf-calendar-header-background` | Calendar Header Background | rgba(66, 66, 66, 1)
`--pf-calendar-header-height` | Calendar Header height | 50px
`--pf-calendar-month-title-font-size` | Font size of month on header | 20px
`--pf-calendar-month-title-line-height` | Calendar Header title line Height | rgba(66, 66, 66, 1)
`--pf-calendar-header-left-arrow-color` | Previous Month arrow color | rgba(160, 159, 160, 1)
`--pf-calendar-header-right-arrow-color`| Next Month arrow color | rgba(160, 159, 160, 1)
`--pf-calendar-month-title-color` | Month Title color | #000
`--pf-calendar-week-bg` | Background color of week | #4A4A4A
`--pf-calendar-day-bg` | Day Background | #4A4A4A
`--pf-calendar-day-color` | color of date | #000
`--pf-calendar-other-day-color` | color of previous and next month date | rgba(255, 255, 255, .3)
`--pf-calendar-today-color` | Current date Color | rgba(156` 202, 235, 1)
`--pf-calendar-selected-date-bg` | Selected Date Background color | #000
`--pf-calendar-selected-date-color` | Selected Date color | #fff
`--pf-calendar-day-name-color` | Name of Day color e.g(MON,TUE,WED) | rgba(255` 255, 255, .5)
`--pf-calendar-event-detail-bg` | Event box background | rgba(164, 164, 164, 1)
`--pf-calendar-event-color` | color of label "Event" | #000
`--pf-calendar-addevent-button-bg-color'| Add Event Button color | rgba(164, 164, 164, 1)
`--pf-calendar-addevent-button-text-color`| Add Event text color | #fff
`--pf-calendar-addevent-button-hover-color`| Add event button hover color | rgba(170, 170, 170, 1)
`--pf-calendar-addbutton-disply` | to hide button set "none" |inline-block
`--pf-calendar-deletebutton-disply` | to hide button set "none" |inline
`--pf-calendar-editbutton-disply` | to hide button set "none" |inline
`--pf-calendar-legend-bg` | Background color of legend bar | rgba(60, 60, 60, 1)
### CRUD operations
Our custom element provides a way to hook your CRUD operations into our calendar, it provides a number of API hooks/events to notify you about an operation that is performed on a certain event.
Custom Event | Description
---------------------------------|----------------------------------------
`event-add` | Add event retuns current selected date ('e.detail.date'), fired when user press add event button
`event-edit` | Edit event retuns event ('e.detail.event'),fired when user press edit event button
`event-delete` | Delete event retuns event ('e.detail.event'),fired when user press delete event button
`event-select` | Event Select retuns event ('e.detail.event'),fired when user click on any event
`date-select` | Date Select retuns seleted date and events of date ('e.detail.date'and'e.detail.events'),fired when user click on any event
### Methods
The following methods are available for crude events operation:
Methods | Description
----------------------------------------|--------------------------
`addNewEvent(event)` | Take event object and add as a into firebase
`updateEvent(key,event)` | Take firebase data ref key and updated event object , update the given ref key node
`deleteEvent(key)` | Take record ref key and delete that event
`pf-calendar`
@demo demo/index.html
-->
<dom-module id="pf-calendar">
<template>
<style>
:host {
display: block;
}
</style>
<style is="custom-style">
</style>
<pf-calendar-events-data
id="calEveData"
databasename="[[databasename]]"
databasepath="[[databasepath]]"
data="{{data}}"
filterAttr="[[filterAttr]]"
filterValue="[[filterValue]]"></pf-calendar-events-data>
<pf-calendar-events id="pfcalendar" data="[[data]]" calendarstyle="[[calendarstyle]]" data={{eventsdata}}
></pf-calendar-events>
</template>
<script src="js/moment.min.js"></script>
<script>
class PFcalendar extends Polymer.Element {
static get is() { return 'pf-calendar'; }
static get properties() {
return {
prop1: {
type: String,
value: 'pf-calendar'
},
date: {
type: Object
},
calendarstyle:{
type:String
},
evedata:{
type:Object,
notify:true
},
databasename:{
type:String
},
databasepath: {
type:String
},
filterAttr:{
type:String
},
filterValue:{
type:String
}
};
}
ready() {
super.ready();
this.$.pfcalendar.addEventListener('date-select', e => this._dateselect(e)
);
this.$.pfcalendar.addEventListener('event-select', e => this._eventselect(e)
);
this.$.pfcalendar.addEventListener('event-edit', e => this._eventedit(e)
);
this.$.pfcalendar.addEventListener('event-delete', e => this._eventdelete(e)
);
this.$.pfcalendar.addEventListener('event-add', e => this._eventadd(e)
);
}
_dateselect(e) {
this.dispatchEvent(new CustomEvent('date-select', { detail: { date: e.detail.date, events: e.detail.events} }));
}
_eventselect(e) {
this.dispatchEvent(new CustomEvent('event-select', { detail: { event: e.detail.event } }));
}
_eventedit(e) {
this.dispatchEvent(new CustomEvent('event-edit', { detail: { event: e.detail.event } }));
}
_eventdelete(e) {
this.dispatchEvent(new CustomEvent('event-delete', { detail: { event: e.detail.event } }));
}
_eventadd(e) {
this.dispatchEvent(new CustomEvent('event-add', { detail: { date: e.detail.date } }));
}
addNewEvent(event){
this.$.calEveData.addEvent(event)
}
updateEvent(key,event){
this.$.calEveData.updateEvent(key,event)
}
deleteEvent(key){
this.$.calEveData.deleteEvent(key)
}
}
window.customElements.define(PFcalendar.is, PFcalendar);
</script>
</dom-module>