web-component.html 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset='utf-8' />
  5. <script src='../../packages/core/dist/index.global.js'></script>
  6. <script src='../../packages/web-component/dist/index.global.js'></script>
  7. <script src='../../packages/interaction/dist/index.global.js'></script>
  8. <script src='../../packages/daygrid/dist/index.global.js'></script>
  9. <script src='../../packages/timegrid/dist/index.global.js'></script>
  10. <script src='../../packages/list/dist/index.global.js'></script>
  11. <style>
  12. body {
  13. margin: 0;
  14. padding: 0;
  15. font-family: Arial, Helvetica Neue, Helvetica, sans-serif;
  16. font-size: 14px;
  17. }
  18. #calendar-container {
  19. max-width: 1100px;
  20. margin: 40px auto;
  21. padding: 0 10px;
  22. }
  23. </style>
  24. <script>
  25. document.addEventListener('DOMContentLoaded', () => {
  26. const el = document.querySelector('full-calendar')
  27. const api = el.getApi()
  28. api.on('dateClick', (info) => {
  29. console.log('dateClick', info)
  30. })
  31. api.on('select', (info) => {
  32. console.log('selected', info)
  33. })
  34. })
  35. </script>
  36. </head>
  37. <body>
  38. <div id='calendar-container'>
  39. <full-calendar shadow options='{
  40. "headerToolbar": {
  41. "left": "prev,next today",
  42. "center": "title",
  43. "right": "dayGridMonth,timeGridWeek,timeGridDay,listWeek"
  44. },
  45. "initialDate": "2023-01-12",
  46. "editable": true,
  47. "selectable": true,
  48. "businessHours": true,
  49. "dayMaxEvents": true,
  50. "events": [
  51. {
  52. "title": "All Day Event",
  53. "start": "2023-01-01"
  54. },
  55. {
  56. "title": "Long Event",
  57. "start": "2023-01-07",
  58. "end": "2023-01-10"
  59. },
  60. {
  61. "groupId": 999,
  62. "title": "Repeating Event",
  63. "start": "2023-01-09T16:00:00"
  64. },
  65. {
  66. "groupId": 999,
  67. "title": "Repeating Event",
  68. "start": "2023-01-16T16:00:00"
  69. },
  70. {
  71. "title": "Conference",
  72. "start": "2023-01-11",
  73. "end": "2023-01-13"
  74. },
  75. {
  76. "title": "Meeting",
  77. "start": "2023-01-12T10:30:00",
  78. "end": "2023-01-12T12:30:00"
  79. },
  80. {
  81. "title": "Lunch",
  82. "start": "2023-01-12T12:00:00"
  83. },
  84. {
  85. "title": "Meeting",
  86. "start": "2023-01-12T14:30:00"
  87. },
  88. {
  89. "title": "Happy Hour",
  90. "start": "2023-01-12T17:30:00"
  91. },
  92. {
  93. "title": "Dinner",
  94. "start": "2023-01-12T20:00:00"
  95. },
  96. {
  97. "title": "Birthday Party",
  98. "start": "2023-01-13T07:00:00"
  99. },
  100. {
  101. "title": "Click for Google",
  102. "url": "http://google.com/",
  103. "start": "2023-01-28"
  104. }
  105. ]
  106. }' />
  107. </div>
  108. </body>
  109. </html>