es6-class-extend.html 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset='utf-8' />
  5. <link href='../../dist/fullcalendar.css' rel='stylesheet' />
  6. <link href='../../dist/fullcalendar.print.css' rel='stylesheet' media='print' />
  7. <script src='../../node_modules/moment/moment.js'></script>
  8. <script src='../../node_modules/jquery/dist/jquery.js'></script>
  9. <script src='../../dist/fullcalendar.js'></script>
  10. <script>
  11. let { AgendaView, TimeGrid } = $.fullCalendar;
  12. class CustomTimeGrid extends TimeGrid {
  13. constructor(...args) {
  14. super(...args);
  15. console.log('custom time grid!')
  16. }
  17. }
  18. class CustomView extends AgendaView {
  19. constructor(...args) {
  20. super(...args);
  21. console.log('custom agenda view!')
  22. }
  23. get timeGridClass() {
  24. return CustomTimeGrid;
  25. }
  26. }
  27. // ugly, because of https://github.com/fullcalendar/fullcalendar/issues/3657
  28. $.fullCalendar.views.custom = {
  29. class: CustomView,
  30. defaults: $.fullCalendar.views.agenda.defaults
  31. };
  32. $(document).ready(function() {
  33. $('#calendar').fullCalendar({
  34. header: {
  35. left: 'prev,next today',
  36. center: 'title',
  37. right: 'month,agendaWeek,agendaDay,listWeek'
  38. },
  39. defaultDate: '2017-12-12',
  40. defaultView: 'custom',
  41. navLinks: true, // can click day/week names to navigate views
  42. editable: true,
  43. eventLimit: true, // allow "more" link when too many events
  44. events: [
  45. {
  46. title: 'All Day Event',
  47. start: '2017-12-01',
  48. },
  49. {
  50. title: 'Long Event',
  51. start: '2017-12-07',
  52. end: '2017-12-10'
  53. },
  54. {
  55. id: 999,
  56. title: 'Repeating Event',
  57. start: '2017-12-09T16:00:00'
  58. },
  59. {
  60. id: 999,
  61. title: 'Repeating Event',
  62. start: '2017-12-16T16:00:00'
  63. },
  64. {
  65. title: 'Conference',
  66. start: '2017-12-11',
  67. end: '2017-12-13'
  68. },
  69. {
  70. title: 'Meeting',
  71. start: '2017-12-12T10:30:00',
  72. end: '2017-12-12T12:30:00'
  73. },
  74. {
  75. title: 'Lunch',
  76. start: '2017-12-12T12:00:00'
  77. },
  78. {
  79. title: 'Meeting',
  80. start: '2017-12-12T14:30:00'
  81. },
  82. {
  83. title: 'Happy Hour',
  84. start: '2017-12-12T17:30:00'
  85. },
  86. {
  87. title: 'Dinner',
  88. start: '2017-12-12T20:00:00'
  89. },
  90. {
  91. title: 'Birthday Party',
  92. start: '2017-12-13T07:00:00'
  93. },
  94. {
  95. title: 'Click for Google',
  96. url: 'http://google.com/',
  97. start: '2017-12-28'
  98. }
  99. ]
  100. });
  101. });
  102. </script>
  103. <style>
  104. body {
  105. margin: 40px 10px;
  106. padding: 0;
  107. font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
  108. font-size: 14px;
  109. }
  110. #calendar {
  111. max-width: 900px;
  112. margin: 0 auto;
  113. }
  114. </style>
  115. </head>
  116. <body>
  117. <div id='calendar'></div>
  118. </body>
  119. </html>