|
823 | 823 | if (current) { |
824 | 824 | var self = this; |
825 | 825 | window.setTimeout(function () { |
826 | | - self.openDay(current); |
| 826 | + self._openDay(current); |
827 | 827 | }, 500); |
828 | 828 | } |
829 | 829 | } |
|
887 | 887 | this.oldMonth.addEventListener('webkitAnimationEnd', function () { |
888 | 888 | self.oldMonth.parentNode.removeChild(self.oldMonth); |
889 | 889 | self.month = self._createElement('div', 'month'); |
890 | | - self.backFill(); |
891 | | - self.currentMonth(); |
892 | | - self.fowardFill(); |
| 890 | + self._backFill(); |
| 891 | + self._currentMonth(); |
| 892 | + self._fowardFill(); |
893 | 893 | self.el.appendChild(self.month); |
894 | 894 | window.setTimeout(function () { |
895 | 895 | self.month.className = 'month in ' + (self.next ? 'next' : 'prev'); |
|
898 | 898 | } else { |
899 | 899 | this.month = this._createElement('div', 'month'); |
900 | 900 | this.el.appendChild(this.month); |
901 | | - this.backFill(); |
902 | | - this.currentMonth(); |
903 | | - this.fowardFill(); |
| 901 | + this._backFill(); |
| 902 | + this._currentMonth(); |
| 903 | + this._fowardFill(); |
904 | 904 | this.month.className = 'month new'; |
905 | 905 | } |
906 | 906 | } |
907 | 907 |
|
908 | 908 |
|
909 | | - backFill() { |
| 909 | + _backFill() { |
910 | 910 |
|
911 | 911 | var clone = this.current.clone(); |
912 | 912 | var dayOfWeek = clone.day(); |
|
918 | 918 | clone.subtract('days', dayOfWeek + 1); |
919 | 919 |
|
920 | 920 | for (var i = dayOfWeek; i > 0; i--) { |
921 | | - this.drawDay(clone.add('days', 1)); |
| 921 | + this._drawDay(clone.add('days', 1)); |
922 | 922 | } |
923 | 923 | } |
924 | 924 |
|
925 | | - fowardFill() { |
| 925 | + _fowardFill() { |
926 | 926 |
|
927 | 927 | var clone = this.current.clone().add('months', 1).subtract('days', 1); |
928 | 928 | var dayOfWeek = clone.day(); |
|
932 | 932 | } |
933 | 933 |
|
934 | 934 | for (var i = dayOfWeek; i < 6; i++) { |
935 | | - this.drawDay(clone.add('days', 1)); |
| 935 | + this._drawDay(clone.add('days', 1)); |
936 | 936 | } |
937 | 937 | } |
938 | 938 |
|
939 | 939 |
|
940 | | - currentMonth() { |
| 940 | + _currentMonth() { |
941 | 941 |
|
942 | 942 | var clone = this.current.clone(); |
943 | 943 |
|
944 | 944 | while (clone.month() === this.current.month()) { |
945 | | - this.drawDay(clone); |
| 945 | + this._drawDay(clone); |
946 | 946 | clone.add('days', 1); |
947 | 947 | } |
948 | 948 | } |
949 | 949 |
|
950 | 950 |
|
951 | | - getWeek(day) { |
| 951 | + _getWeek(day) { |
952 | 952 |
|
953 | 953 | if (!this.week || day.day() === 0) { |
954 | 954 | this.week = this._createElement('div', 'week'); |
|
957 | 957 | } |
958 | 958 |
|
959 | 959 |
|
960 | | - drawDay(day) { |
| 960 | + _drawDay(day) { |
961 | 961 |
|
962 | 962 | var self = this; |
963 | | - this.getWeek(day); |
| 963 | + this._getWeek(day); |
964 | 964 |
|
965 | 965 | //Outer Day |
966 | | - var outer = this._createElement('div', this.getDayClass(day)); |
| 966 | + var outer = this._createElement('div', this._getDayClass(day)); |
967 | 967 | if (day.month() == this.current.month()) { |
968 | 968 | outer.addEventListener('click', function () { |
969 | | - self.openDay(this); |
| 969 | + self._openDay(this); |
970 | 970 | var currentSelected = self.shadowRoot.querySelector('.numberCircle'); |
971 | 971 | if(currentSelected) { |
972 | 972 | currentSelected.className = "day-number" |
|
985 | 985 |
|
986 | 986 | //Events |
987 | 987 | var events = this._createElement('div', 'day-events'); |
988 | | - this.drawEvents(day, events); |
| 988 | + this._drawEvents(day, events); |
989 | 989 |
|
990 | 990 | outer.appendChild(name); |
991 | 991 | outer.appendChild(number); |
992 | 992 | outer.appendChild(events); |
993 | 993 | this.week.appendChild(outer); |
994 | 994 | } |
995 | 995 |
|
996 | | - drawEvents(day, element) { |
| 996 | + _drawEvents(day, element) { |
997 | 997 | var self = this; |
998 | 998 | if (day.month() === this.current.month()) { |
999 | 999 | var todaysEvents = this.events.reduce(function (memo, ev) { |
|
1022 | 1022 | } |
1023 | 1023 | } |
1024 | 1024 |
|
1025 | | - getDayClass(day,newClass) { |
| 1025 | + _getDayClass(day,newClass) { |
1026 | 1026 | var classes = ['day']; |
1027 | 1027 | if (day.month() !== this.current.month()) { |
1028 | 1028 | classes.push('other'); |
|
1039 | 1039 | var mevent = event |
1040 | 1040 | this.dispatchEvent(new CustomEvent('date-select', { detail: { date: d, events: eve } })); |
1041 | 1041 | } |
1042 | | - openDay(el) { |
| 1042 | + _openDay(el) { |
1043 | 1043 | var details, arrow; |
1044 | 1044 | var dayNumber = +el.querySelectorAll('.day-number')[0].innerText || +el.querySelectorAll('.day-number')[0].textContent; |
1045 | 1045 | var day = this.current.clone().date(dayNumber); |
|
1086 | 1086 | return memo; |
1087 | 1087 | }, []); |
1088 | 1088 | this._daySelected(day, todaysEvents); |
1089 | | - this.renderEvents(day, todaysEvents, details); |
| 1089 | + this._renderEvents(day, todaysEvents, details); |
1090 | 1090 |
|
1091 | 1091 | arrow.style.left = el.offsetLeft - el.parentNode.offsetLeft + 27 + 'px'; |
1092 | 1092 | } |
|
1108 | 1108 | var mEv = date; |
1109 | 1109 | this.dispatchEvent(new CustomEvent('event-add', { detail: { date: date } })); |
1110 | 1110 | } |
1111 | | - renderEvents(day, events, ele) { |
| 1111 | + _renderEvents(day, events, ele) { |
1112 | 1112 | var self = this; |
1113 | 1113 | //Remove any events in the current details element |
1114 | 1114 | var currentWrapper = ele.querySelector('.events'); |
|
1268 | 1268 | var eve = e.detail.events; |
1269 | 1269 | } |
1270 | 1270 | connectedCallback() { |
1271 | | - /* |
1272 | | - var data= [ |
1273 | | - { eventName: 'Lunch Meeting', calendar: 'Work', color: 'orange',date:'1491322091394' }, |
1274 | | - { eventName: 'Physio Appointment', calendar: 'health', color: 'blue',date:'1499185140000' }, |
1275 | | - { eventName: 'Appointment with Dr. John', calendar: 'health', color: 'blue',date:'1491581940000' }, |
1276 | | - { eventName: 'Public Holiday', calendar: 'holiday', color: 'green',date:'1494173940000' } |
1277 | | -
|
1278 | | - { eventName: 'Polymer Interview - Jr. Web Developer', calendar: 'Work', color: 'orange' }, |
1279 | | - { eventName: 'Demo New App to the Board', calendar: 'Work', color: 'orange' }, |
1280 | | - { eventName: 'Dinner w/ Marketing', calendar: 'Work', color: 'orange' }, |
1281 | | - { eventName: 'Game vs Portalnd', calendar: 'Sports', color: 'blue' }, |
1282 | | - { eventName: 'Game vs Houston', calendar: 'Sports', color: 'blue' }, |
1283 | | - { eventName: 'Game vs Denver', calendar: 'Sports', color: 'blue' }, |
1284 | | - { eventName: 'Game vs San Degio', calendar: 'Sports', color: 'blue' }, |
1285 | | - { eventName: 'School Play', calendar: 'Kids', color: 'yellow' }, |
1286 | | - { eventName: 'Parent/Teacher Conference', calendar: 'Kids', color: 'yellow' }, |
1287 | | - { eventName: 'Pick up from Soccer Practice', calendar: 'Kids', color: 'yellow' }, |
1288 | | - { eventName: 'Ice Cream Night', calendar: 'Kids', color: 'yellow' }, |
1289 | | - { eventName: 'Free Tamale Night', calendar: 'Other', color: 'green' }, |
1290 | | - { eventName: 'Bowling Team', calendar: 'Other', color: 'green' }, |
1291 | | - { eventName: 'Teach Kids to Code', calendar: 'Other', color: 'green' }, |
1292 | | - { eventName: 'Startup Weekend', calendar: 'Other', color: 'green' } |
1293 | | -
|
1294 | | - ];*/ |
1295 | | - this._drawCalendar(); |
1296 | 1271 |
|
1297 | | - // window.Calendar = Calendar; |
1298 | | - // drawCal(this.$.calendar,this); |
1299 | | - // var el2 = new PfCalendar(this.$.calendar,data); |
1300 | | - // var ele3="aa" |
1301 | 1272 | super.connectedCallback(); |
| 1273 | + this._drawCalendar(); |
| 1274 | + |
| 1275 | + |
1302 | 1276 |
|
1303 | 1277 |
|
1304 | 1278 | } |
|
0 commit comments