django-advanced-report-builder 1.2.9__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (360) hide show
  1. advanced_report_builder/.DS_Store +0 -0
  2. advanced_report_builder/.ruff_cache/.gitignore +2 -0
  3. advanced_report_builder/.ruff_cache/0.11.9/16555798982502606642 +0 -0
  4. advanced_report_builder/.ruff_cache/CACHEDIR.TAG +1 -0
  5. advanced_report_builder/__init__.py +0 -0
  6. advanced_report_builder/admin.py +264 -0
  7. advanced_report_builder/apps.py +7 -0
  8. advanced_report_builder/column_types.py +26 -0
  9. advanced_report_builder/columns.py +296 -0
  10. advanced_report_builder/customise.py +2 -0
  11. advanced_report_builder/data_merge/__init__.py +0 -0
  12. advanced_report_builder/data_merge/utils.py +112 -0
  13. advanced_report_builder/data_merge/widget.py +30 -0
  14. advanced_report_builder/duplicate.py +171 -0
  15. advanced_report_builder/exceptions.py +9 -0
  16. advanced_report_builder/field_types.py +466 -0
  17. advanced_report_builder/field_utils.py +401 -0
  18. advanced_report_builder/filter_query.py +862 -0
  19. advanced_report_builder/form_utils.py +12 -0
  20. advanced_report_builder/generate_series.py +14 -0
  21. advanced_report_builder/globals.py +276 -0
  22. advanced_report_builder/includes.py +72 -0
  23. advanced_report_builder/migrations/0001_initial.py +246 -0
  24. advanced_report_builder/migrations/0002_auto_20220209_1657.py +23 -0
  25. advanced_report_builder/migrations/0003_auto_20220215_1219.py +42 -0
  26. advanced_report_builder/migrations/0004_customreport.py +27 -0
  27. advanced_report_builder/migrations/0005_auto_20220303_0958.py +84 -0
  28. advanced_report_builder/migrations/0006_auto_20220310_1147.py +32 -0
  29. advanced_report_builder/migrations/0007_auto_20220322_1939.py +23 -0
  30. advanced_report_builder/migrations/0008_auto_20220404_1144.py +28 -0
  31. advanced_report_builder/migrations/0009_auto_20230428_1554.py +53 -0
  32. advanced_report_builder/migrations/0010_auto_20230428_2033.py +23 -0
  33. advanced_report_builder/migrations/0011_auto_20230620_1449.py +23 -0
  34. advanced_report_builder/migrations/0012_auto_20230718_1642.py +24 -0
  35. advanced_report_builder/migrations/0013_reportqueryorder.py +30 -0
  36. advanced_report_builder/migrations/0014_auto_20240706_2207.py +24 -0
  37. advanced_report_builder/migrations/0015_report_user_created_report_user_updated.py +26 -0
  38. advanced_report_builder/migrations/0016_calendarreport_dashboardreport_options_and_more.py +74 -0
  39. advanced_report_builder/migrations/0017_alter_barchartreport_options_and_more.py +57 -0
  40. advanced_report_builder/migrations/0018_reportquery_target_target_period_type.py +24 -0
  41. advanced_report_builder/migrations/0019_multicellstyle_and_more.py +107 -0
  42. advanced_report_builder/migrations/0020_alter_multicellstyle_font_size.py +18 -0
  43. advanced_report_builder/migrations/0021_multivalueheldquery_and_more.py +36 -0
  44. advanced_report_builder/migrations/0022_dashboardreport_show_options_report_template_style_and_more.py +44 -0
  45. advanced_report_builder/migrations/0023_rename_colour_target_default_colour_and_more.py +41 -0
  46. advanced_report_builder/migrations/0024_alter_target_period_type.py +18 -0
  47. advanced_report_builder/migrations/__init__.py +0 -0
  48. advanced_report_builder/models.py +954 -0
  49. advanced_report_builder/report_builder.py +28 -0
  50. advanced_report_builder/signals.py +3 -0
  51. advanced_report_builder/static/.DS_Store +0 -0
  52. advanced_report_builder/static/advanced_report_builder/.DS_Store +0 -0
  53. advanced_report_builder/static/advanced_report_builder/chart-js/js/chart.esm.js +10553 -0
  54. advanced_report_builder/static/advanced_report_builder/chart-js/js/chart.js +13190 -0
  55. advanced_report_builder/static/advanced_report_builder/chart-js/js/chart.min.js +13 -0
  56. advanced_report_builder/static/advanced_report_builder/chart-js/js/chartjs-adapter-moment.min.js +8 -0
  57. advanced_report_builder/static/advanced_report_builder/chart-js/js/chartjs-plugin-datalabels.min.js +7 -0
  58. advanced_report_builder/static/advanced_report_builder/chart-js/js/chunks/helpers.segment.js +2499 -0
  59. advanced_report_builder/static/advanced_report_builder/chart-js/js/helpers.esm.js +7 -0
  60. advanced_report_builder/static/advanced_report_builder/d3/js/d3.js +20196 -0
  61. advanced_report_builder/static/advanced_report_builder/d3/js/d3.min.js +2 -0
  62. advanced_report_builder/static/advanced_report_builder/d3-funnel/js/d3-funnel.js +6087 -0
  63. advanced_report_builder/static/advanced_report_builder/d3-funnel/js/d3-funnel.min.js +2 -0
  64. advanced_report_builder/static/advanced_report_builder/dashboard/js/dashboard.js +19 -0
  65. advanced_report_builder/static/advanced_report_builder/dot/js/.gitignore +31 -0
  66. advanced_report_builder/static/advanced_report_builder/dot/js/.travis.yml +9 -0
  67. advanced_report_builder/static/advanced_report_builder/dot/js/LICENSE-DOT.txt +24 -0
  68. advanced_report_builder/static/advanced_report_builder/dot/js/README.md +90 -0
  69. advanced_report_builder/static/advanced_report_builder/dot/js/bin/dot-packer +52 -0
  70. advanced_report_builder/static/advanced_report_builder/dot/js/bower.json +21 -0
  71. advanced_report_builder/static/advanced_report_builder/dot/js/doT.js +141 -0
  72. advanced_report_builder/static/advanced_report_builder/dot/js/doT.min.js +8 -0
  73. advanced_report_builder/static/advanced_report_builder/dot/js/doU.js +56 -0
  74. advanced_report_builder/static/advanced_report_builder/dot/js/index.js +143 -0
  75. advanced_report_builder/static/advanced_report_builder/dot/js/package.json +46 -0
  76. advanced_report_builder/static/advanced_report_builder/fullcalendar/.DS_Store +0 -0
  77. advanced_report_builder/static/advanced_report_builder/fullcalendar/LICENSE.txt +20 -0
  78. advanced_report_builder/static/advanced_report_builder/fullcalendar/README.md +10 -0
  79. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/LICENSE.txt +20 -0
  80. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/README.md +8 -0
  81. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/af.js +30 -0
  82. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/ar-dz.js +31 -0
  83. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/ar-kw.js +31 -0
  84. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/ar-ly.js +31 -0
  85. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/ar-ma.js +31 -0
  86. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/ar-sa.js +31 -0
  87. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/ar-tn.js +31 -0
  88. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/ar.js +31 -0
  89. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/bg.js +31 -0
  90. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/bs.js +32 -0
  91. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/ca.js +30 -0
  92. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/cs.js +32 -0
  93. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/da.js +30 -0
  94. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/de.js +33 -0
  95. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/el.js +30 -0
  96. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/en-au.js +17 -0
  97. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/en-gb.js +17 -0
  98. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/en-nz.js +17 -0
  99. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/es-us.js +30 -0
  100. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/es.js +30 -0
  101. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/et.js +32 -0
  102. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/eu.js +30 -0
  103. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/fa.js +33 -0
  104. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/fi.js +30 -0
  105. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/fr-ca.js +27 -0
  106. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/fr-ch.js +31 -0
  107. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/fr.js +31 -0
  108. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/gl.js +30 -0
  109. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/he.js +27 -0
  110. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/hi.js +32 -0
  111. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/hr.js +32 -0
  112. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/hu.js +30 -0
  113. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/id.js +30 -0
  114. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/is.js +30 -0
  115. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/it.js +32 -0
  116. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/ja.js +28 -0
  117. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/ka.js +32 -0
  118. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/kk.js +32 -0
  119. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/ko.js +26 -0
  120. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/lb.js +30 -0
  121. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/lt.js +30 -0
  122. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/lv.js +32 -0
  123. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/mk.js +28 -0
  124. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/ms.js +32 -0
  125. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/nb.js +30 -0
  126. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/nl.js +30 -0
  127. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/nn.js +30 -0
  128. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/pl.js +30 -0
  129. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/pt-br.js +28 -0
  130. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/pt.js +30 -0
  131. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/ro.js +32 -0
  132. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/ru.js +32 -0
  133. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/sk.js +32 -0
  134. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/sl.js +30 -0
  135. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/sq.js +32 -0
  136. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/sr-cyrl.js +32 -0
  137. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/sr.js +32 -0
  138. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/sv.js +30 -0
  139. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/th.js +25 -0
  140. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/tr.js +30 -0
  141. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/uk.js +32 -0
  142. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/vi.js +32 -0
  143. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/zh-cn.js +33 -0
  144. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/zh-tw.js +26 -0
  145. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales-all.js +1348 -0
  146. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales-all.min.js +1 -0
  147. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/main.css +1052 -0
  148. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/main.d.ts +2730 -0
  149. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/main.esm.js +8558 -0
  150. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/main.js +8717 -0
  151. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/main.min.css +1 -0
  152. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/main.min.js +6 -0
  153. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/package.json +30 -0
  154. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/daygrid/LICENSE.txt +20 -0
  155. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/daygrid/README.md +8 -0
  156. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/daygrid/main.css +78 -0
  157. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/daygrid/main.d.ts +310 -0
  158. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/daygrid/main.esm.js +1627 -0
  159. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/daygrid/main.js +1641 -0
  160. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/daygrid/main.min.css +1 -0
  161. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/daygrid/main.min.js +6 -0
  162. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/daygrid/package.json +33 -0
  163. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/fullcalendar-yearview/LICENSE +21 -0
  164. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/fullcalendar-yearview/css/main.css +85 -0
  165. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/fullcalendar-yearview/js/main.js +2018 -0
  166. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/google-calendar/LICENSE.txt +20 -0
  167. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/google-calendar/README.md +8 -0
  168. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/google-calendar/main.d.ts +20 -0
  169. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/google-calendar/main.esm.js +162 -0
  170. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/google-calendar/main.js +170 -0
  171. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/google-calendar/main.min.js +6 -0
  172. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/google-calendar/package.json +33 -0
  173. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/interaction/LICENSE.txt +20 -0
  174. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/interaction/README.md +8 -0
  175. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/interaction/main.d.ts +323 -0
  176. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/interaction/main.esm.js +2132 -0
  177. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/interaction/main.js +2143 -0
  178. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/interaction/main.min.js +6 -0
  179. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/interaction/package.json +33 -0
  180. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/list/LICENSE.txt +20 -0
  181. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/list/README.md +8 -0
  182. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/list/main.css +118 -0
  183. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/list/main.d.ts +33 -0
  184. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/list/main.esm.js +335 -0
  185. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/list/main.js +343 -0
  186. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/list/main.min.css +1 -0
  187. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/list/main.min.js +6 -0
  188. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/list/package.json +33 -0
  189. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/luxon/LICENSE.txt +20 -0
  190. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/luxon/README.md +8 -0
  191. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/luxon/main.d.ts +14 -0
  192. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/luxon/main.esm.js +162 -0
  193. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/luxon/main.js +170 -0
  194. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/luxon/main.min.js +6 -0
  195. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/luxon/package.json +34 -0
  196. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/moment/LICENSE.txt +20 -0
  197. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/moment/README.md +8 -0
  198. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/moment/main.d.ts +14 -0
  199. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/moment/main.esm.js +102 -0
  200. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/moment/main.js +110 -0
  201. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/moment/main.min.js +6 -0
  202. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/moment/package.json +34 -0
  203. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/moment-timezone/LICENSE.txt +20 -0
  204. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/moment-timezone/README.md +8 -0
  205. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/moment-timezone/main.d.ts +11 -0
  206. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/moment-timezone/main.esm.js +58 -0
  207. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/moment-timezone/main.js +64 -0
  208. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/moment-timezone/main.min.js +6 -0
  209. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/moment-timezone/package.json +35 -0
  210. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/rrule/LICENSE.txt +20 -0
  211. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/rrule/README.md +8 -0
  212. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/rrule/main.d.ts +9 -0
  213. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/rrule/main.esm.js +121 -0
  214. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/rrule/main.js +128 -0
  215. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/rrule/main.min.js +6 -0
  216. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/rrule/package.json +34 -0
  217. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/timegrid/LICENSE.txt +20 -0
  218. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/timegrid/README.md +8 -0
  219. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/timegrid/main.css +309 -0
  220. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/timegrid/main.d.ts +220 -0
  221. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/timegrid/main.esm.js +1345 -0
  222. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/timegrid/main.js +1357 -0
  223. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/timegrid/main.min.css +1 -0
  224. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/timegrid/main.min.js +6 -0
  225. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/timegrid/package.json +36 -0
  226. advanced_report_builder/static/advanced_report_builder/fullcalendar/vendor/rrule.js +3782 -0
  227. advanced_report_builder/static/advanced_report_builder/jquery_extendext/js/jQuery.extendext.js +132 -0
  228. advanced_report_builder/static/advanced_report_builder/jquery_extendext/js/jQuery.extendext.min.js +9 -0
  229. advanced_report_builder/static/advanced_report_builder/moment/locales.js +9769 -0
  230. advanced_report_builder/static/advanced_report_builder/moment/locales.min.js +1 -0
  231. advanced_report_builder/static/advanced_report_builder/moment/moment-with-locales.js +14289 -0
  232. advanced_report_builder/static/advanced_report_builder/moment/moment-with-locales.min.js +1 -0
  233. advanced_report_builder/static/advanced_report_builder/moment/moment.min.js +1 -0
  234. advanced_report_builder/static/advanced_report_builder/query_builder/.DS_Store +0 -0
  235. advanced_report_builder/static/advanced_report_builder/query_builder/css/.DS_Store +0 -0
  236. advanced_report_builder/static/advanced_report_builder/query_builder/css/query-builder.dark.css +173 -0
  237. advanced_report_builder/static/advanced_report_builder/query_builder/css/query-builder.dark.min.css +6 -0
  238. advanced_report_builder/static/advanced_report_builder/query_builder/css/query-builder.default.css +173 -0
  239. advanced_report_builder/static/advanced_report_builder/query_builder/css/query-builder.default.min.css +6 -0
  240. advanced_report_builder/static/advanced_report_builder/query_builder/i18n/query-builder.ar.js +80 -0
  241. advanced_report_builder/static/advanced_report_builder/query_builder/i18n/query-builder.az.js +79 -0
  242. advanced_report_builder/static/advanced_report_builder/query_builder/i18n/query-builder.bg.js +79 -0
  243. advanced_report_builder/static/advanced_report_builder/query_builder/i18n/query-builder.cs.js +79 -0
  244. advanced_report_builder/static/advanced_report_builder/query_builder/i18n/query-builder.da.js +56 -0
  245. advanced_report_builder/static/advanced_report_builder/query_builder/i18n/query-builder.de.js +76 -0
  246. advanced_report_builder/static/advanced_report_builder/query_builder/i18n/query-builder.el.js +80 -0
  247. advanced_report_builder/static/advanced_report_builder/query_builder/i18n/query-builder.en.js +83 -0
  248. advanced_report_builder/static/advanced_report_builder/query_builder/i18n/query-builder.es.js +81 -0
  249. advanced_report_builder/static/advanced_report_builder/query_builder/i18n/query-builder.fa-IR.js +79 -0
  250. advanced_report_builder/static/advanced_report_builder/query_builder/i18n/query-builder.fr.js +83 -0
  251. advanced_report_builder/static/advanced_report_builder/query_builder/i18n/query-builder.he.js +81 -0
  252. advanced_report_builder/static/advanced_report_builder/query_builder/i18n/query-builder.it.js +79 -0
  253. advanced_report_builder/static/advanced_report_builder/query_builder/i18n/query-builder.nl.js +76 -0
  254. advanced_report_builder/static/advanced_report_builder/query_builder/i18n/query-builder.no.js +54 -0
  255. advanced_report_builder/static/advanced_report_builder/query_builder/i18n/query-builder.pl.js +80 -0
  256. advanced_report_builder/static/advanced_report_builder/query_builder/i18n/query-builder.pt-BR.js +80 -0
  257. advanced_report_builder/static/advanced_report_builder/query_builder/i18n/query-builder.pt-PT.js +75 -0
  258. advanced_report_builder/static/advanced_report_builder/query_builder/i18n/query-builder.ro.js +54 -0
  259. advanced_report_builder/static/advanced_report_builder/query_builder/i18n/query-builder.ru.js +77 -0
  260. advanced_report_builder/static/advanced_report_builder/query_builder/i18n/query-builder.sq.js +78 -0
  261. advanced_report_builder/static/advanced_report_builder/query_builder/i18n/query-builder.tr.js +82 -0
  262. advanced_report_builder/static/advanced_report_builder/query_builder/i18n/query-builder.ua.js +79 -0
  263. advanced_report_builder/static/advanced_report_builder/query_builder/i18n/query-builder.zh-CN.js +80 -0
  264. advanced_report_builder/static/advanced_report_builder/query_builder/js/.DS_Store +0 -0
  265. advanced_report_builder/static/advanced_report_builder/query_builder/js/plugins/.DS_Store +0 -0
  266. advanced_report_builder/static/advanced_report_builder/query_builder/js/plugins/currency/plugin.js +30 -0
  267. advanced_report_builder/static/advanced_report_builder/query_builder/js/query-builder.js +6200 -0
  268. advanced_report_builder/static/advanced_report_builder/query_builder/js/query-builder.min.js +7 -0
  269. advanced_report_builder/static/advanced_report_builder/query_builder/js/query-builder.standalone.js +6477 -0
  270. advanced_report_builder/static/advanced_report_builder/query_builder/js/query-builder.standalone.min.js +7 -0
  271. advanced_report_builder/static/advanced_report_builder/query_builder/scss/.DS_Store +0 -0
  272. advanced_report_builder/static/advanced_report_builder/query_builder/scss/dark.scss +19 -0
  273. advanced_report_builder/static/advanced_report_builder/query_builder/scss/default.scss +186 -0
  274. advanced_report_builder/static/advanced_report_builder/query_builder/scss/plugins/_bt-checkbox.scss +12 -0
  275. advanced_report_builder/static/advanced_report_builder/query_builder/scss/plugins/_bt-tooltip-errors.scss +9 -0
  276. advanced_report_builder/static/advanced_report_builder/query_builder/scss/plugins/_filter-description.scss +21 -0
  277. advanced_report_builder/static/advanced_report_builder/query_builder/scss/plugins/_invert.scss +5 -0
  278. advanced_report_builder/static/advanced_report_builder/query_builder/scss/plugins/_sortable.scss +28 -0
  279. advanced_report_builder/static/advanced_report_builder/query_builder/scss/plugins/bt-tooltip-errors.scss +9 -0
  280. advanced_report_builder/static/advanced_report_builder/query_builder/scss/plugins/filter-description.scss +21 -0
  281. advanced_report_builder/static/advanced_report_builder/query_builder/scss/plugins/invert.scss +5 -0
  282. advanced_report_builder/static/advanced_report_builder/query_builder/scss/plugins/sortable.scss +27 -0
  283. advanced_report_builder/template_types.py +34 -0
  284. advanced_report_builder/templates/advanced_report_builder/calendar/description_modal.html +12 -0
  285. advanced_report_builder/templates/advanced_report_builder/calendar/middle.html +33 -0
  286. advanced_report_builder/templates/advanced_report_builder/calendar/modal.html +10 -0
  287. advanced_report_builder/templates/advanced_report_builder/calendar/report.html +80 -0
  288. advanced_report_builder/templates/advanced_report_builder/charts/bar/middle.html +122 -0
  289. advanced_report_builder/templates/advanced_report_builder/charts/funnel/middle.html +46 -0
  290. advanced_report_builder/templates/advanced_report_builder/charts/funnel/report.html +34 -0
  291. advanced_report_builder/templates/advanced_report_builder/charts/line/middle.html +119 -0
  292. advanced_report_builder/templates/advanced_report_builder/charts/modal.html +12 -0
  293. advanced_report_builder/templates/advanced_report_builder/charts/modal_field.html +13 -0
  294. advanced_report_builder/templates/advanced_report_builder/charts/pie/middle.html +58 -0
  295. advanced_report_builder/templates/advanced_report_builder/charts/report.html +33 -0
  296. advanced_report_builder/templates/advanced_report_builder/data_merge/data_merge.html +144 -0
  297. advanced_report_builder/templates/advanced_report_builder/datatables/fields/modal.html +13 -0
  298. advanced_report_builder/templates/advanced_report_builder/datatables/fields/single_query_builder.html +87 -0
  299. advanced_report_builder/templates/advanced_report_builder/datatables/modal.html +13 -0
  300. advanced_report_builder/templates/advanced_report_builder/datatables/onclick_menu.html +14 -0
  301. advanced_report_builder/templates/advanced_report_builder/datatables/report.html +37 -0
  302. advanced_report_builder/templates/advanced_report_builder/datatables/select_pivot.html +199 -0
  303. advanced_report_builder/templates/advanced_report_builder/error.html +21 -0
  304. advanced_report_builder/templates/advanced_report_builder/extra_query_modal.html +13 -0
  305. advanced_report_builder/templates/advanced_report_builder/kanban/description_modal.html +12 -0
  306. advanced_report_builder/templates/advanced_report_builder/kanban/middle.html +63 -0
  307. advanced_report_builder/templates/advanced_report_builder/kanban/modal.html +10 -0
  308. advanced_report_builder/templates/advanced_report_builder/kanban/report.html +71 -0
  309. advanced_report_builder/templates/advanced_report_builder/multi_values/held_modal.html +14 -0
  310. advanced_report_builder/templates/advanced_report_builder/multi_values/middle.html +61 -0
  311. advanced_report_builder/templates/advanced_report_builder/multi_values/modal.html +15 -0
  312. advanced_report_builder/templates/advanced_report_builder/multi_values/report.html +19 -0
  313. advanced_report_builder/templates/advanced_report_builder/query_builder.html +88 -0
  314. advanced_report_builder/templates/advanced_report_builder/query_modal.html +12 -0
  315. advanced_report_builder/templates/advanced_report_builder/select_column.html +230 -0
  316. advanced_report_builder/templates/advanced_report_builder/single_values/gauge_middle.html +143 -0
  317. advanced_report_builder/templates/advanced_report_builder/single_values/middle.html +63 -0
  318. advanced_report_builder/templates/advanced_report_builder/single_values/modal.html +13 -0
  319. advanced_report_builder/templates/advanced_report_builder/single_values/report.html +56 -0
  320. advanced_report_builder/toggle.py +9 -0
  321. advanced_report_builder/urls.py +237 -0
  322. advanced_report_builder/utils.py +171 -0
  323. advanced_report_builder/variable_date.py +670 -0
  324. advanced_report_builder/view_types.py +27 -0
  325. advanced_report_builder/views/.DS_Store +0 -0
  326. advanced_report_builder/views/__init__.py +0 -0
  327. advanced_report_builder/views/bar_charts.py +746 -0
  328. advanced_report_builder/views/calendar.py +745 -0
  329. advanced_report_builder/views/charts_base.py +625 -0
  330. advanced_report_builder/views/custom.py +147 -0
  331. advanced_report_builder/views/dashboard.py +357 -0
  332. advanced_report_builder/views/datatables/__init__.py +0 -0
  333. advanced_report_builder/views/datatables/datatables.py +151 -0
  334. advanced_report_builder/views/datatables/modal.py +1151 -0
  335. advanced_report_builder/views/datatables/utils.py +701 -0
  336. advanced_report_builder/views/error_pod.py +50 -0
  337. advanced_report_builder/views/funnel_charts.py +289 -0
  338. advanced_report_builder/views/helpers.py +22 -0
  339. advanced_report_builder/views/kanban.py +868 -0
  340. advanced_report_builder/views/line_charts.py +415 -0
  341. advanced_report_builder/views/modals_base.py +213 -0
  342. advanced_report_builder/views/multi_value.py +1160 -0
  343. advanced_report_builder/views/pie_charts.py +290 -0
  344. advanced_report_builder/views/query_modal/__init__.py +0 -0
  345. advanced_report_builder/views/query_modal/mixin.py +161 -0
  346. advanced_report_builder/views/query_modal/modal.py +274 -0
  347. advanced_report_builder/views/report.py +241 -0
  348. advanced_report_builder/views/report_utils_mixin.py +312 -0
  349. advanced_report_builder/views/reports.py +154 -0
  350. advanced_report_builder/views/single_values.py +792 -0
  351. advanced_report_builder/views/targets/__init__.py +0 -0
  352. advanced_report_builder/views/targets/utils.py +251 -0
  353. advanced_report_builder/views/targets/views.py +139 -0
  354. advanced_report_builder/views/value_base.py +198 -0
  355. advanced_report_builder/widgets.py +5 -0
  356. django_advanced_report_builder-1.2.9.dist-info/METADATA +35 -0
  357. django_advanced_report_builder-1.2.9.dist-info/RECORD +360 -0
  358. django_advanced_report_builder-1.2.9.dist-info/WHEEL +5 -0
  359. django_advanced_report_builder-1.2.9.dist-info/licenses/LICENSE +21 -0
  360. django_advanced_report_builder-1.2.9.dist-info/top_level.txt +1 -0
@@ -0,0 +1,1627 @@
1
+ /*!
2
+ FullCalendar Day Grid Plugin v4.3.0
3
+ Docs & License: https://fullcalendar.io/
4
+ (c) 2019 Adam Shaw
5
+ */
6
+
7
+ import { addWeeks, diffWeeks, DateProfileGenerator, createElement, listenBySelector, removeElement, computeRect, computeClippingRect, applyStyle, cssToStr, htmlEscape, FgEventRenderer, appendToElement, prependToElement, htmlToElement, FillRenderer, memoizeRendering, createFormatter, addDays, DateComponent, rangeContainsMarker, getDayClasses, findElements, PositionCache, buildGotoAnchorHtml, findChildren, insertAfterElement, intersectRanges, ScrollComponent, matchCellWidths, uncompensateScroll, compensateScroll, subtractInnerElHeight, distributeHeight, undistributeHeight, View, Slicer, memoize, DayHeader, DaySeries, DayTable, createPlugin } from '@fullcalendar/core';
8
+
9
+ /*! *****************************************************************************
10
+ Copyright (c) Microsoft Corporation. All rights reserved.
11
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
12
+ this file except in compliance with the License. You may obtain a copy of the
13
+ License at http://www.apache.org/licenses/LICENSE-2.0
14
+
15
+ THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
+ KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
17
+ WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
18
+ MERCHANTABLITY OR NON-INFRINGEMENT.
19
+
20
+ See the Apache Version 2.0 License for specific language governing permissions
21
+ and limitations under the License.
22
+ ***************************************************************************** */
23
+ /* global Reflect, Promise */
24
+
25
+ var extendStatics = function(d, b) {
26
+ extendStatics = Object.setPrototypeOf ||
27
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
28
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
29
+ return extendStatics(d, b);
30
+ };
31
+
32
+ function __extends(d, b) {
33
+ extendStatics(d, b);
34
+ function __() { this.constructor = d; }
35
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
36
+ }
37
+
38
+ var __assign = function() {
39
+ __assign = Object.assign || function __assign(t) {
40
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
41
+ s = arguments[i];
42
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
43
+ }
44
+ return t;
45
+ };
46
+ return __assign.apply(this, arguments);
47
+ };
48
+
49
+ var DayGridDateProfileGenerator = /** @class */ (function (_super) {
50
+ __extends(DayGridDateProfileGenerator, _super);
51
+ function DayGridDateProfileGenerator() {
52
+ return _super !== null && _super.apply(this, arguments) || this;
53
+ }
54
+ // Computes the date range that will be rendered.
55
+ DayGridDateProfileGenerator.prototype.buildRenderRange = function (currentRange, currentRangeUnit, isRangeAllDay) {
56
+ var dateEnv = this.dateEnv;
57
+ var renderRange = _super.prototype.buildRenderRange.call(this, currentRange, currentRangeUnit, isRangeAllDay);
58
+ var start = renderRange.start;
59
+ var end = renderRange.end;
60
+ var endOfWeek;
61
+ // year and month views should be aligned with weeks. this is already done for week
62
+ if (/^(year|month)$/.test(currentRangeUnit)) {
63
+ start = dateEnv.startOfWeek(start);
64
+ // make end-of-week if not already
65
+ endOfWeek = dateEnv.startOfWeek(end);
66
+ if (endOfWeek.valueOf() !== end.valueOf()) {
67
+ end = addWeeks(endOfWeek, 1);
68
+ }
69
+ }
70
+ // ensure 6 weeks
71
+ if (this.options.monthMode &&
72
+ this.options.fixedWeekCount) {
73
+ var rowCnt = Math.ceil(// could be partial weeks due to hiddenDays
74
+ diffWeeks(start, end));
75
+ end = addWeeks(end, 6 - rowCnt);
76
+ }
77
+ return { start: start, end: end };
78
+ };
79
+ return DayGridDateProfileGenerator;
80
+ }(DateProfileGenerator));
81
+
82
+ /* A rectangular panel that is absolutely positioned over other content
83
+ ------------------------------------------------------------------------------------------------------------------------
84
+ Options:
85
+ - className (string)
86
+ - content (HTML string, element, or element array)
87
+ - parentEl
88
+ - top
89
+ - left
90
+ - right (the x coord of where the right edge should be. not a "CSS" right)
91
+ - autoHide (boolean)
92
+ - show (callback)
93
+ - hide (callback)
94
+ */
95
+ var Popover = /** @class */ (function () {
96
+ function Popover(options) {
97
+ var _this = this;
98
+ this.isHidden = true;
99
+ this.margin = 10; // the space required between the popover and the edges of the scroll container
100
+ // Triggered when the user clicks *anywhere* in the document, for the autoHide feature
101
+ this.documentMousedown = function (ev) {
102
+ // only hide the popover if the click happened outside the popover
103
+ if (_this.el && !_this.el.contains(ev.target)) {
104
+ _this.hide();
105
+ }
106
+ };
107
+ this.options = options;
108
+ }
109
+ // Shows the popover on the specified position. Renders it if not already
110
+ Popover.prototype.show = function () {
111
+ if (this.isHidden) {
112
+ if (!this.el) {
113
+ this.render();
114
+ }
115
+ this.el.style.display = '';
116
+ this.position();
117
+ this.isHidden = false;
118
+ this.trigger('show');
119
+ }
120
+ };
121
+ // Hides the popover, through CSS, but does not remove it from the DOM
122
+ Popover.prototype.hide = function () {
123
+ if (!this.isHidden) {
124
+ this.el.style.display = 'none';
125
+ this.isHidden = true;
126
+ this.trigger('hide');
127
+ }
128
+ };
129
+ // Creates `this.el` and renders content inside of it
130
+ Popover.prototype.render = function () {
131
+ var _this = this;
132
+ var options = this.options;
133
+ var el = this.el = createElement('div', {
134
+ className: 'fc-popover ' + (options.className || ''),
135
+ style: {
136
+ top: '0',
137
+ left: '0'
138
+ }
139
+ });
140
+ if (typeof options.content === 'function') {
141
+ options.content(el);
142
+ }
143
+ options.parentEl.appendChild(el);
144
+ // when a click happens on anything inside with a 'fc-close' className, hide the popover
145
+ listenBySelector(el, 'click', '.fc-close', function (ev) {
146
+ _this.hide();
147
+ });
148
+ if (options.autoHide) {
149
+ document.addEventListener('mousedown', this.documentMousedown);
150
+ }
151
+ };
152
+ // Hides and unregisters any handlers
153
+ Popover.prototype.destroy = function () {
154
+ this.hide();
155
+ if (this.el) {
156
+ removeElement(this.el);
157
+ this.el = null;
158
+ }
159
+ document.removeEventListener('mousedown', this.documentMousedown);
160
+ };
161
+ // Positions the popover optimally, using the top/left/right options
162
+ Popover.prototype.position = function () {
163
+ var options = this.options;
164
+ var el = this.el;
165
+ var elDims = el.getBoundingClientRect(); // only used for width,height
166
+ var origin = computeRect(el.offsetParent);
167
+ var clippingRect = computeClippingRect(options.parentEl);
168
+ var top; // the "position" (not "offset") values for the popover
169
+ var left; //
170
+ // compute top and left
171
+ top = options.top || 0;
172
+ if (options.left !== undefined) {
173
+ left = options.left;
174
+ }
175
+ else if (options.right !== undefined) {
176
+ left = options.right - elDims.width; // derive the left value from the right value
177
+ }
178
+ else {
179
+ left = 0;
180
+ }
181
+ // constrain to the view port. if constrained by two edges, give precedence to top/left
182
+ top = Math.min(top, clippingRect.bottom - elDims.height - this.margin);
183
+ top = Math.max(top, clippingRect.top + this.margin);
184
+ left = Math.min(left, clippingRect.right - elDims.width - this.margin);
185
+ left = Math.max(left, clippingRect.left + this.margin);
186
+ applyStyle(el, {
187
+ top: top - origin.top,
188
+ left: left - origin.left
189
+ });
190
+ };
191
+ // Triggers a callback. Calls a function in the option hash of the same name.
192
+ // Arguments beyond the first `name` are forwarded on.
193
+ // TODO: better code reuse for this. Repeat code
194
+ // can kill this???
195
+ Popover.prototype.trigger = function (name) {
196
+ if (this.options[name]) {
197
+ this.options[name].apply(this, Array.prototype.slice.call(arguments, 1));
198
+ }
199
+ };
200
+ return Popover;
201
+ }());
202
+
203
+ /* Event-rendering methods for the DayGrid class
204
+ ----------------------------------------------------------------------------------------------------------------------*/
205
+ // "Simple" is bad a name. has nothing to do with SimpleDayGrid
206
+ var SimpleDayGridEventRenderer = /** @class */ (function (_super) {
207
+ __extends(SimpleDayGridEventRenderer, _super);
208
+ function SimpleDayGridEventRenderer() {
209
+ return _super !== null && _super.apply(this, arguments) || this;
210
+ }
211
+ // Builds the HTML to be used for the default element for an individual segment
212
+ SimpleDayGridEventRenderer.prototype.renderSegHtml = function (seg, mirrorInfo) {
213
+ var _a = this.context, view = _a.view, options = _a.options;
214
+ var eventRange = seg.eventRange;
215
+ var eventDef = eventRange.def;
216
+ var eventUi = eventRange.ui;
217
+ var allDay = eventDef.allDay;
218
+ var isDraggable = view.computeEventDraggable(eventDef, eventUi);
219
+ var isResizableFromStart = allDay && seg.isStart && view.computeEventStartResizable(eventDef, eventUi);
220
+ var isResizableFromEnd = allDay && seg.isEnd && view.computeEventEndResizable(eventDef, eventUi);
221
+ var classes = this.getSegClasses(seg, isDraggable, isResizableFromStart || isResizableFromEnd, mirrorInfo);
222
+ var skinCss = cssToStr(this.getSkinCss(eventUi));
223
+ var timeHtml = '';
224
+ var timeText;
225
+ var titleHtml;
226
+ classes.unshift('fc-day-grid-event', 'fc-h-event');
227
+ // Only display a timed events time if it is the starting segment
228
+ if (seg.isStart) {
229
+ timeText = this.getTimeText(eventRange);
230
+ if (timeText) {
231
+ timeHtml = '<span class="fc-time">' + htmlEscape(timeText) + '</span>';
232
+ }
233
+ }
234
+ titleHtml =
235
+ '<span class="fc-title">' +
236
+ (htmlEscape(eventDef.title || '') || '&nbsp;') + // we always want one line of height
237
+ '</span>';
238
+ return '<a class="' + classes.join(' ') + '"' +
239
+ (eventDef.url ?
240
+ ' href="' + htmlEscape(eventDef.url) + '"' :
241
+ '') +
242
+ (skinCss ?
243
+ ' style="' + skinCss + '"' :
244
+ '') +
245
+ '>' +
246
+ '<div class="fc-content">' +
247
+ (options.dir === 'rtl' ?
248
+ titleHtml + ' ' + timeHtml : // put a natural space in between
249
+ timeHtml + ' ' + titleHtml //
250
+ ) +
251
+ '</div>' +
252
+ (isResizableFromStart ?
253
+ '<div class="fc-resizer fc-start-resizer"></div>' :
254
+ '') +
255
+ (isResizableFromEnd ?
256
+ '<div class="fc-resizer fc-end-resizer"></div>' :
257
+ '') +
258
+ '</a>';
259
+ };
260
+ // Computes a default event time formatting string if `eventTimeFormat` is not explicitly defined
261
+ SimpleDayGridEventRenderer.prototype.computeEventTimeFormat = function () {
262
+ return {
263
+ hour: 'numeric',
264
+ minute: '2-digit',
265
+ omitZeroMinute: true,
266
+ meridiem: 'narrow'
267
+ };
268
+ };
269
+ SimpleDayGridEventRenderer.prototype.computeDisplayEventEnd = function () {
270
+ return false; // TODO: somehow consider the originating DayGrid's column count
271
+ };
272
+ return SimpleDayGridEventRenderer;
273
+ }(FgEventRenderer));
274
+
275
+ /* Event-rendering methods for the DayGrid class
276
+ ----------------------------------------------------------------------------------------------------------------------*/
277
+ var DayGridEventRenderer = /** @class */ (function (_super) {
278
+ __extends(DayGridEventRenderer, _super);
279
+ function DayGridEventRenderer(dayGrid) {
280
+ var _this = _super.call(this, dayGrid.context) || this;
281
+ _this.dayGrid = dayGrid;
282
+ return _this;
283
+ }
284
+ // Renders the given foreground event segments onto the grid
285
+ DayGridEventRenderer.prototype.attachSegs = function (segs, mirrorInfo) {
286
+ var rowStructs = this.rowStructs = this.renderSegRows(segs);
287
+ // append to each row's content skeleton
288
+ this.dayGrid.rowEls.forEach(function (rowNode, i) {
289
+ rowNode.querySelector('.fc-content-skeleton > table').appendChild(rowStructs[i].tbodyEl);
290
+ });
291
+ // removes the "more.." events popover
292
+ if (!mirrorInfo) {
293
+ this.dayGrid.removeSegPopover();
294
+ }
295
+ };
296
+ // Unrenders all currently rendered foreground event segments
297
+ DayGridEventRenderer.prototype.detachSegs = function () {
298
+ var rowStructs = this.rowStructs || [];
299
+ var rowStruct;
300
+ while ((rowStruct = rowStructs.pop())) {
301
+ removeElement(rowStruct.tbodyEl);
302
+ }
303
+ this.rowStructs = null;
304
+ };
305
+ // Uses the given events array to generate <tbody> elements that should be appended to each row's content skeleton.
306
+ // Returns an array of rowStruct objects (see the bottom of `renderSegRow`).
307
+ // PRECONDITION: each segment shoud already have a rendered and assigned `.el`
308
+ DayGridEventRenderer.prototype.renderSegRows = function (segs) {
309
+ var rowStructs = [];
310
+ var segRows;
311
+ var row;
312
+ segRows = this.groupSegRows(segs); // group into nested arrays
313
+ // iterate each row of segment groupings
314
+ for (row = 0; row < segRows.length; row++) {
315
+ rowStructs.push(this.renderSegRow(row, segRows[row]));
316
+ }
317
+ return rowStructs;
318
+ };
319
+ // Given a row # and an array of segments all in the same row, render a <tbody> element, a skeleton that contains
320
+ // the segments. Returns object with a bunch of internal data about how the render was calculated.
321
+ // NOTE: modifies rowSegs
322
+ DayGridEventRenderer.prototype.renderSegRow = function (row, rowSegs) {
323
+ var dayGrid = this.dayGrid;
324
+ var colCnt = dayGrid.colCnt, isRtl = dayGrid.isRtl;
325
+ var segLevels = this.buildSegLevels(rowSegs); // group into sub-arrays of levels
326
+ var levelCnt = Math.max(1, segLevels.length); // ensure at least one level
327
+ var tbody = document.createElement('tbody');
328
+ var segMatrix = []; // lookup for which segments are rendered into which level+col cells
329
+ var cellMatrix = []; // lookup for all <td> elements of the level+col matrix
330
+ var loneCellMatrix = []; // lookup for <td> elements that only take up a single column
331
+ var i;
332
+ var levelSegs;
333
+ var col;
334
+ var tr;
335
+ var j;
336
+ var seg;
337
+ var td;
338
+ // populates empty cells from the current column (`col`) to `endCol`
339
+ function emptyCellsUntil(endCol) {
340
+ while (col < endCol) {
341
+ // try to grab a cell from the level above and extend its rowspan. otherwise, create a fresh cell
342
+ td = (loneCellMatrix[i - 1] || [])[col];
343
+ if (td) {
344
+ td.rowSpan = (td.rowSpan || 1) + 1;
345
+ }
346
+ else {
347
+ td = document.createElement('td');
348
+ tr.appendChild(td);
349
+ }
350
+ cellMatrix[i][col] = td;
351
+ loneCellMatrix[i][col] = td;
352
+ col++;
353
+ }
354
+ }
355
+ for (i = 0; i < levelCnt; i++) { // iterate through all levels
356
+ levelSegs = segLevels[i];
357
+ col = 0;
358
+ tr = document.createElement('tr');
359
+ segMatrix.push([]);
360
+ cellMatrix.push([]);
361
+ loneCellMatrix.push([]);
362
+ // levelCnt might be 1 even though there are no actual levels. protect against this.
363
+ // this single empty row is useful for styling.
364
+ if (levelSegs) {
365
+ for (j = 0; j < levelSegs.length; j++) { // iterate through segments in level
366
+ seg = levelSegs[j];
367
+ var leftCol = isRtl ? (colCnt - 1 - seg.lastCol) : seg.firstCol;
368
+ var rightCol = isRtl ? (colCnt - 1 - seg.firstCol) : seg.lastCol;
369
+ emptyCellsUntil(leftCol);
370
+ // create a container that occupies or more columns. append the event element.
371
+ td = createElement('td', { className: 'fc-event-container' }, seg.el);
372
+ if (leftCol !== rightCol) {
373
+ td.colSpan = rightCol - leftCol + 1;
374
+ }
375
+ else { // a single-column segment
376
+ loneCellMatrix[i][col] = td;
377
+ }
378
+ while (col <= rightCol) {
379
+ cellMatrix[i][col] = td;
380
+ segMatrix[i][col] = seg;
381
+ col++;
382
+ }
383
+ tr.appendChild(td);
384
+ }
385
+ }
386
+ emptyCellsUntil(colCnt); // finish off the row
387
+ var introHtml = dayGrid.renderProps.renderIntroHtml();
388
+ if (introHtml) {
389
+ if (dayGrid.isRtl) {
390
+ appendToElement(tr, introHtml);
391
+ }
392
+ else {
393
+ prependToElement(tr, introHtml);
394
+ }
395
+ }
396
+ tbody.appendChild(tr);
397
+ }
398
+ return {
399
+ row: row,
400
+ tbodyEl: tbody,
401
+ cellMatrix: cellMatrix,
402
+ segMatrix: segMatrix,
403
+ segLevels: segLevels,
404
+ segs: rowSegs
405
+ };
406
+ };
407
+ // Stacks a flat array of segments, which are all assumed to be in the same row, into subarrays of vertical levels.
408
+ // NOTE: modifies segs
409
+ DayGridEventRenderer.prototype.buildSegLevels = function (segs) {
410
+ var _a = this.dayGrid, isRtl = _a.isRtl, colCnt = _a.colCnt;
411
+ var levels = [];
412
+ var i;
413
+ var seg;
414
+ var j;
415
+ // Give preference to elements with certain criteria, so they have
416
+ // a chance to be closer to the top.
417
+ segs = this.sortEventSegs(segs);
418
+ for (i = 0; i < segs.length; i++) {
419
+ seg = segs[i];
420
+ // loop through levels, starting with the topmost, until the segment doesn't collide with other segments
421
+ for (j = 0; j < levels.length; j++) {
422
+ if (!isDaySegCollision(seg, levels[j])) {
423
+ break;
424
+ }
425
+ }
426
+ // `j` now holds the desired subrow index
427
+ seg.level = j;
428
+ seg.leftCol = isRtl ? (colCnt - 1 - seg.lastCol) : seg.firstCol; // for sorting only
429
+ seg.rightCol = isRtl ? (colCnt - 1 - seg.firstCol) : seg.lastCol // for sorting only
430
+ ;
431
+ (levels[j] || (levels[j] = [])).push(seg);
432
+ }
433
+ // order segments left-to-right. very important if calendar is RTL
434
+ for (j = 0; j < levels.length; j++) {
435
+ levels[j].sort(compareDaySegCols);
436
+ }
437
+ return levels;
438
+ };
439
+ // Given a flat array of segments, return an array of sub-arrays, grouped by each segment's row
440
+ DayGridEventRenderer.prototype.groupSegRows = function (segs) {
441
+ var segRows = [];
442
+ var i;
443
+ for (i = 0; i < this.dayGrid.rowCnt; i++) {
444
+ segRows.push([]);
445
+ }
446
+ for (i = 0; i < segs.length; i++) {
447
+ segRows[segs[i].row].push(segs[i]);
448
+ }
449
+ return segRows;
450
+ };
451
+ // Computes a default `displayEventEnd` value if one is not expliclty defined
452
+ DayGridEventRenderer.prototype.computeDisplayEventEnd = function () {
453
+ return this.dayGrid.colCnt === 1; // we'll likely have space if there's only one day
454
+ };
455
+ return DayGridEventRenderer;
456
+ }(SimpleDayGridEventRenderer));
457
+ // Computes whether two segments' columns collide. They are assumed to be in the same row.
458
+ function isDaySegCollision(seg, otherSegs) {
459
+ var i;
460
+ var otherSeg;
461
+ for (i = 0; i < otherSegs.length; i++) {
462
+ otherSeg = otherSegs[i];
463
+ if (otherSeg.firstCol <= seg.lastCol &&
464
+ otherSeg.lastCol >= seg.firstCol) {
465
+ return true;
466
+ }
467
+ }
468
+ return false;
469
+ }
470
+ // A cmp function for determining the leftmost event
471
+ function compareDaySegCols(a, b) {
472
+ return a.leftCol - b.leftCol;
473
+ }
474
+
475
+ var DayGridMirrorRenderer = /** @class */ (function (_super) {
476
+ __extends(DayGridMirrorRenderer, _super);
477
+ function DayGridMirrorRenderer() {
478
+ return _super !== null && _super.apply(this, arguments) || this;
479
+ }
480
+ DayGridMirrorRenderer.prototype.attachSegs = function (segs, mirrorInfo) {
481
+ var sourceSeg = mirrorInfo.sourceSeg;
482
+ var rowStructs = this.rowStructs = this.renderSegRows(segs);
483
+ // inject each new event skeleton into each associated row
484
+ this.dayGrid.rowEls.forEach(function (rowNode, row) {
485
+ var skeletonEl = htmlToElement('<div class="fc-mirror-skeleton"><table></table></div>'); // will be absolutely positioned
486
+ var skeletonTopEl;
487
+ var skeletonTop;
488
+ // If there is an original segment, match the top position. Otherwise, put it at the row's top level
489
+ if (sourceSeg && sourceSeg.row === row) {
490
+ skeletonTopEl = sourceSeg.el;
491
+ }
492
+ else {
493
+ skeletonTopEl = rowNode.querySelector('.fc-content-skeleton tbody');
494
+ if (!skeletonTopEl) { // when no events
495
+ skeletonTopEl = rowNode.querySelector('.fc-content-skeleton table');
496
+ }
497
+ }
498
+ skeletonTop = skeletonTopEl.getBoundingClientRect().top -
499
+ rowNode.getBoundingClientRect().top; // the offsetParent origin
500
+ skeletonEl.style.top = skeletonTop + 'px';
501
+ skeletonEl.querySelector('table').appendChild(rowStructs[row].tbodyEl);
502
+ rowNode.appendChild(skeletonEl);
503
+ });
504
+ };
505
+ return DayGridMirrorRenderer;
506
+ }(DayGridEventRenderer));
507
+
508
+ var EMPTY_CELL_HTML = '<td style="pointer-events:none"></td>';
509
+ var DayGridFillRenderer = /** @class */ (function (_super) {
510
+ __extends(DayGridFillRenderer, _super);
511
+ function DayGridFillRenderer(dayGrid) {
512
+ var _this = _super.call(this, dayGrid.context) || this;
513
+ _this.fillSegTag = 'td'; // override the default tag name
514
+ _this.dayGrid = dayGrid;
515
+ return _this;
516
+ }
517
+ DayGridFillRenderer.prototype.renderSegs = function (type, segs) {
518
+ // don't render timed background events
519
+ if (type === 'bgEvent') {
520
+ segs = segs.filter(function (seg) {
521
+ return seg.eventRange.def.allDay;
522
+ });
523
+ }
524
+ _super.prototype.renderSegs.call(this, type, segs);
525
+ };
526
+ DayGridFillRenderer.prototype.attachSegs = function (type, segs) {
527
+ var els = [];
528
+ var i;
529
+ var seg;
530
+ var skeletonEl;
531
+ for (i = 0; i < segs.length; i++) {
532
+ seg = segs[i];
533
+ skeletonEl = this.renderFillRow(type, seg);
534
+ this.dayGrid.rowEls[seg.row].appendChild(skeletonEl);
535
+ els.push(skeletonEl);
536
+ }
537
+ return els;
538
+ };
539
+ // Generates the HTML needed for one row of a fill. Requires the seg's el to be rendered.
540
+ DayGridFillRenderer.prototype.renderFillRow = function (type, seg) {
541
+ var dayGrid = this.dayGrid;
542
+ var colCnt = dayGrid.colCnt, isRtl = dayGrid.isRtl;
543
+ var leftCol = isRtl ? (colCnt - 1 - seg.lastCol) : seg.firstCol;
544
+ var rightCol = isRtl ? (colCnt - 1 - seg.firstCol) : seg.lastCol;
545
+ var startCol = leftCol;
546
+ var endCol = rightCol + 1;
547
+ var className;
548
+ var skeletonEl;
549
+ var trEl;
550
+ if (type === 'businessHours') {
551
+ className = 'bgevent';
552
+ }
553
+ else {
554
+ className = type.toLowerCase();
555
+ }
556
+ skeletonEl = htmlToElement('<div class="fc-' + className + '-skeleton">' +
557
+ '<table><tr></tr></table>' +
558
+ '</div>');
559
+ trEl = skeletonEl.getElementsByTagName('tr')[0];
560
+ if (startCol > 0) {
561
+ appendToElement(trEl,
562
+ // will create (startCol + 1) td's
563
+ new Array(startCol + 1).join(EMPTY_CELL_HTML));
564
+ }
565
+ seg.el.colSpan = endCol - startCol;
566
+ trEl.appendChild(seg.el);
567
+ if (endCol < colCnt) {
568
+ appendToElement(trEl,
569
+ // will create (colCnt - endCol) td's
570
+ new Array(colCnt - endCol + 1).join(EMPTY_CELL_HTML));
571
+ }
572
+ var introHtml = dayGrid.renderProps.renderIntroHtml();
573
+ if (introHtml) {
574
+ if (dayGrid.isRtl) {
575
+ appendToElement(trEl, introHtml);
576
+ }
577
+ else {
578
+ prependToElement(trEl, introHtml);
579
+ }
580
+ }
581
+ return skeletonEl;
582
+ };
583
+ return DayGridFillRenderer;
584
+ }(FillRenderer));
585
+
586
+ var DayTile = /** @class */ (function (_super) {
587
+ __extends(DayTile, _super);
588
+ function DayTile(context, el) {
589
+ var _this = _super.call(this, context, el) || this;
590
+ var eventRenderer = _this.eventRenderer = new DayTileEventRenderer(_this);
591
+ var renderFrame = _this.renderFrame = memoizeRendering(_this._renderFrame);
592
+ _this.renderFgEvents = memoizeRendering(eventRenderer.renderSegs.bind(eventRenderer), eventRenderer.unrender.bind(eventRenderer), [renderFrame]);
593
+ _this.renderEventSelection = memoizeRendering(eventRenderer.selectByInstanceId.bind(eventRenderer), eventRenderer.unselectByInstanceId.bind(eventRenderer), [_this.renderFgEvents]);
594
+ _this.renderEventDrag = memoizeRendering(eventRenderer.hideByHash.bind(eventRenderer), eventRenderer.showByHash.bind(eventRenderer), [renderFrame]);
595
+ _this.renderEventResize = memoizeRendering(eventRenderer.hideByHash.bind(eventRenderer), eventRenderer.showByHash.bind(eventRenderer), [renderFrame]);
596
+ context.calendar.registerInteractiveComponent(_this, {
597
+ el: _this.el,
598
+ useEventCenter: false
599
+ });
600
+ return _this;
601
+ }
602
+ DayTile.prototype.render = function (props) {
603
+ this.renderFrame(props.date);
604
+ this.renderFgEvents(props.fgSegs);
605
+ this.renderEventSelection(props.eventSelection);
606
+ this.renderEventDrag(props.eventDragInstances);
607
+ this.renderEventResize(props.eventResizeInstances);
608
+ };
609
+ DayTile.prototype.destroy = function () {
610
+ _super.prototype.destroy.call(this);
611
+ this.renderFrame.unrender(); // should unrender everything else
612
+ this.calendar.unregisterInteractiveComponent(this);
613
+ };
614
+ DayTile.prototype._renderFrame = function (date) {
615
+ var _a = this, theme = _a.theme, dateEnv = _a.dateEnv;
616
+ var title = dateEnv.format(date, createFormatter(this.opt('dayPopoverFormat')) // TODO: cache
617
+ );
618
+ this.el.innerHTML =
619
+ '<div class="fc-header ' + theme.getClass('popoverHeader') + '">' +
620
+ '<span class="fc-title">' +
621
+ htmlEscape(title) +
622
+ '</span>' +
623
+ '<span class="fc-close ' + theme.getIconClass('close') + '"></span>' +
624
+ '</div>' +
625
+ '<div class="fc-body ' + theme.getClass('popoverContent') + '">' +
626
+ '<div class="fc-event-container"></div>' +
627
+ '</div>';
628
+ this.segContainerEl = this.el.querySelector('.fc-event-container');
629
+ };
630
+ DayTile.prototype.queryHit = function (positionLeft, positionTop, elWidth, elHeight) {
631
+ var date = this.props.date; // HACK
632
+ if (positionLeft < elWidth && positionTop < elHeight) {
633
+ return {
634
+ component: this,
635
+ dateSpan: {
636
+ allDay: true,
637
+ range: { start: date, end: addDays(date, 1) }
638
+ },
639
+ dayEl: this.el,
640
+ rect: {
641
+ left: 0,
642
+ top: 0,
643
+ right: elWidth,
644
+ bottom: elHeight
645
+ },
646
+ layer: 1
647
+ };
648
+ }
649
+ };
650
+ return DayTile;
651
+ }(DateComponent));
652
+ var DayTileEventRenderer = /** @class */ (function (_super) {
653
+ __extends(DayTileEventRenderer, _super);
654
+ function DayTileEventRenderer(dayTile) {
655
+ var _this = _super.call(this, dayTile.context) || this;
656
+ _this.dayTile = dayTile;
657
+ return _this;
658
+ }
659
+ DayTileEventRenderer.prototype.attachSegs = function (segs) {
660
+ for (var _i = 0, segs_1 = segs; _i < segs_1.length; _i++) {
661
+ var seg = segs_1[_i];
662
+ this.dayTile.segContainerEl.appendChild(seg.el);
663
+ }
664
+ };
665
+ DayTileEventRenderer.prototype.detachSegs = function (segs) {
666
+ for (var _i = 0, segs_2 = segs; _i < segs_2.length; _i++) {
667
+ var seg = segs_2[_i];
668
+ removeElement(seg.el);
669
+ }
670
+ };
671
+ return DayTileEventRenderer;
672
+ }(SimpleDayGridEventRenderer));
673
+
674
+ var DayBgRow = /** @class */ (function () {
675
+ function DayBgRow(context) {
676
+ this.context = context;
677
+ }
678
+ DayBgRow.prototype.renderHtml = function (props) {
679
+ var parts = [];
680
+ if (props.renderIntroHtml) {
681
+ parts.push(props.renderIntroHtml());
682
+ }
683
+ for (var _i = 0, _a = props.cells; _i < _a.length; _i++) {
684
+ var cell = _a[_i];
685
+ parts.push(renderCellHtml(cell.date, props.dateProfile, this.context, cell.htmlAttrs));
686
+ }
687
+ if (!props.cells.length) {
688
+ parts.push('<td class="fc-day ' + this.context.theme.getClass('widgetContent') + '"></td>');
689
+ }
690
+ if (this.context.options.dir === 'rtl') {
691
+ parts.reverse();
692
+ }
693
+ return '<tr>' + parts.join('') + '</tr>';
694
+ };
695
+ return DayBgRow;
696
+ }());
697
+ function renderCellHtml(date, dateProfile, context, otherAttrs) {
698
+ var dateEnv = context.dateEnv, theme = context.theme;
699
+ var isDateValid = rangeContainsMarker(dateProfile.activeRange, date); // TODO: called too frequently. cache somehow.
700
+ var classes = getDayClasses(date, dateProfile, context);
701
+ classes.unshift('fc-day', theme.getClass('widgetContent'));
702
+ return '<td class="' + classes.join(' ') + '"' +
703
+ (isDateValid ?
704
+ ' data-date="' + dateEnv.formatIso(date, { omitTime: true }) + '"' :
705
+ '') +
706
+ (otherAttrs ?
707
+ ' ' + otherAttrs :
708
+ '') +
709
+ '></td>';
710
+ }
711
+
712
+ var DAY_NUM_FORMAT = createFormatter({ day: 'numeric' });
713
+ var WEEK_NUM_FORMAT = createFormatter({ week: 'numeric' });
714
+ var DayGrid = /** @class */ (function (_super) {
715
+ __extends(DayGrid, _super);
716
+ function DayGrid(context, el, renderProps) {
717
+ var _this = _super.call(this, context, el) || this;
718
+ _this.bottomCoordPadding = 0; // hack for extending the hit area for the last row of the coordinate grid
719
+ _this.isCellSizesDirty = false;
720
+ var eventRenderer = _this.eventRenderer = new DayGridEventRenderer(_this);
721
+ var fillRenderer = _this.fillRenderer = new DayGridFillRenderer(_this);
722
+ _this.mirrorRenderer = new DayGridMirrorRenderer(_this);
723
+ var renderCells = _this.renderCells = memoizeRendering(_this._renderCells, _this._unrenderCells);
724
+ _this.renderBusinessHours = memoizeRendering(fillRenderer.renderSegs.bind(fillRenderer, 'businessHours'), fillRenderer.unrender.bind(fillRenderer, 'businessHours'), [renderCells]);
725
+ _this.renderDateSelection = memoizeRendering(fillRenderer.renderSegs.bind(fillRenderer, 'highlight'), fillRenderer.unrender.bind(fillRenderer, 'highlight'), [renderCells]);
726
+ _this.renderBgEvents = memoizeRendering(fillRenderer.renderSegs.bind(fillRenderer, 'bgEvent'), fillRenderer.unrender.bind(fillRenderer, 'bgEvent'), [renderCells]);
727
+ _this.renderFgEvents = memoizeRendering(eventRenderer.renderSegs.bind(eventRenderer), eventRenderer.unrender.bind(eventRenderer), [renderCells]);
728
+ _this.renderEventSelection = memoizeRendering(eventRenderer.selectByInstanceId.bind(eventRenderer), eventRenderer.unselectByInstanceId.bind(eventRenderer), [_this.renderFgEvents]);
729
+ _this.renderEventDrag = memoizeRendering(_this._renderEventDrag, _this._unrenderEventDrag, [renderCells]);
730
+ _this.renderEventResize = memoizeRendering(_this._renderEventResize, _this._unrenderEventResize, [renderCells]);
731
+ _this.renderProps = renderProps;
732
+ return _this;
733
+ }
734
+ DayGrid.prototype.render = function (props) {
735
+ var cells = props.cells;
736
+ this.rowCnt = cells.length;
737
+ this.colCnt = cells[0].length;
738
+ this.renderCells(cells, props.isRigid);
739
+ this.renderBusinessHours(props.businessHourSegs);
740
+ this.renderDateSelection(props.dateSelectionSegs);
741
+ this.renderBgEvents(props.bgEventSegs);
742
+ this.renderFgEvents(props.fgEventSegs);
743
+ this.renderEventSelection(props.eventSelection);
744
+ this.renderEventDrag(props.eventDrag);
745
+ this.renderEventResize(props.eventResize);
746
+ if (this.segPopoverTile) {
747
+ this.updateSegPopoverTile();
748
+ }
749
+ };
750
+ DayGrid.prototype.destroy = function () {
751
+ _super.prototype.destroy.call(this);
752
+ this.renderCells.unrender(); // will unrender everything else
753
+ };
754
+ DayGrid.prototype.getCellRange = function (row, col) {
755
+ var start = this.props.cells[row][col].date;
756
+ var end = addDays(start, 1);
757
+ return { start: start, end: end };
758
+ };
759
+ DayGrid.prototype.updateSegPopoverTile = function (date, segs) {
760
+ var ownProps = this.props;
761
+ this.segPopoverTile.receiveProps({
762
+ date: date || this.segPopoverTile.props.date,
763
+ fgSegs: segs || this.segPopoverTile.props.fgSegs,
764
+ eventSelection: ownProps.eventSelection,
765
+ eventDragInstances: ownProps.eventDrag ? ownProps.eventDrag.affectedInstances : null,
766
+ eventResizeInstances: ownProps.eventResize ? ownProps.eventResize.affectedInstances : null
767
+ });
768
+ };
769
+ /* Date Rendering
770
+ ------------------------------------------------------------------------------------------------------------------*/
771
+ DayGrid.prototype._renderCells = function (cells, isRigid) {
772
+ var _a = this, view = _a.view, dateEnv = _a.dateEnv;
773
+ var _b = this, rowCnt = _b.rowCnt, colCnt = _b.colCnt;
774
+ var html = '';
775
+ var row;
776
+ var col;
777
+ for (row = 0; row < rowCnt; row++) {
778
+ html += this.renderDayRowHtml(row, isRigid);
779
+ }
780
+ this.el.innerHTML = html;
781
+ this.rowEls = findElements(this.el, '.fc-row');
782
+ this.cellEls = findElements(this.el, '.fc-day, .fc-disabled-day');
783
+ if (this.isRtl) {
784
+ this.cellEls.reverse();
785
+ }
786
+ this.rowPositions = new PositionCache(this.el, this.rowEls, false, true // vertical
787
+ );
788
+ this.colPositions = new PositionCache(this.el, this.cellEls.slice(0, colCnt), // only the first row
789
+ true, false // horizontal
790
+ );
791
+ // trigger dayRender with each cell's element
792
+ for (row = 0; row < rowCnt; row++) {
793
+ for (col = 0; col < colCnt; col++) {
794
+ this.publiclyTrigger('dayRender', [
795
+ {
796
+ date: dateEnv.toDate(cells[row][col].date),
797
+ el: this.getCellEl(row, col),
798
+ view: view
799
+ }
800
+ ]);
801
+ }
802
+ }
803
+ this.isCellSizesDirty = true;
804
+ };
805
+ DayGrid.prototype._unrenderCells = function () {
806
+ this.removeSegPopover();
807
+ };
808
+ // Generates the HTML for a single row, which is a div that wraps a table.
809
+ // `row` is the row number.
810
+ DayGrid.prototype.renderDayRowHtml = function (row, isRigid) {
811
+ var theme = this.theme;
812
+ var classes = ['fc-row', 'fc-week', theme.getClass('dayRow')];
813
+ if (isRigid) {
814
+ classes.push('fc-rigid');
815
+ }
816
+ var bgRow = new DayBgRow(this.context);
817
+ return '' +
818
+ '<div class="' + classes.join(' ') + '">' +
819
+ '<div class="fc-bg">' +
820
+ '<table class="' + theme.getClass('tableGrid') + '">' +
821
+ bgRow.renderHtml({
822
+ cells: this.props.cells[row],
823
+ dateProfile: this.props.dateProfile,
824
+ renderIntroHtml: this.renderProps.renderBgIntroHtml
825
+ }) +
826
+ '</table>' +
827
+ '</div>' +
828
+ '<div class="fc-content-skeleton">' +
829
+ '<table>' +
830
+ (this.getIsNumbersVisible() ?
831
+ '<thead>' +
832
+ this.renderNumberTrHtml(row) +
833
+ '</thead>' :
834
+ '') +
835
+ '</table>' +
836
+ '</div>' +
837
+ '</div>';
838
+ };
839
+ DayGrid.prototype.getIsNumbersVisible = function () {
840
+ return this.getIsDayNumbersVisible() ||
841
+ this.renderProps.cellWeekNumbersVisible ||
842
+ this.renderProps.colWeekNumbersVisible;
843
+ };
844
+ DayGrid.prototype.getIsDayNumbersVisible = function () {
845
+ return this.rowCnt > 1;
846
+ };
847
+ /* Grid Number Rendering
848
+ ------------------------------------------------------------------------------------------------------------------*/
849
+ DayGrid.prototype.renderNumberTrHtml = function (row) {
850
+ var intro = this.renderProps.renderNumberIntroHtml(row, this);
851
+ return '' +
852
+ '<tr>' +
853
+ (this.isRtl ? '' : intro) +
854
+ this.renderNumberCellsHtml(row) +
855
+ (this.isRtl ? intro : '') +
856
+ '</tr>';
857
+ };
858
+ DayGrid.prototype.renderNumberCellsHtml = function (row) {
859
+ var htmls = [];
860
+ var col;
861
+ var date;
862
+ for (col = 0; col < this.colCnt; col++) {
863
+ date = this.props.cells[row][col].date;
864
+ htmls.push(this.renderNumberCellHtml(date));
865
+ }
866
+ if (this.isRtl) {
867
+ htmls.reverse();
868
+ }
869
+ return htmls.join('');
870
+ };
871
+ // Generates the HTML for the <td>s of the "number" row in the DayGrid's content skeleton.
872
+ // The number row will only exist if either day numbers or week numbers are turned on.
873
+ DayGrid.prototype.renderNumberCellHtml = function (date) {
874
+ var _a = this, view = _a.view, dateEnv = _a.dateEnv;
875
+ var html = '';
876
+ var isDateValid = rangeContainsMarker(this.props.dateProfile.activeRange, date); // TODO: called too frequently. cache somehow.
877
+ var isDayNumberVisible = this.getIsDayNumbersVisible() && isDateValid;
878
+ var classes;
879
+ var weekCalcFirstDow;
880
+ if (!isDayNumberVisible && !this.renderProps.cellWeekNumbersVisible) {
881
+ // no numbers in day cell (week number must be along the side)
882
+ return '<td></td>'; // will create an empty space above events :(
883
+ }
884
+ classes = getDayClasses(date, this.props.dateProfile, this.context);
885
+ classes.unshift('fc-day-top');
886
+ if (this.renderProps.cellWeekNumbersVisible) {
887
+ weekCalcFirstDow = dateEnv.weekDow;
888
+ }
889
+ html += '<td class="' + classes.join(' ') + '"' +
890
+ (isDateValid ?
891
+ ' data-date="' + dateEnv.formatIso(date, { omitTime: true }) + '"' :
892
+ '') +
893
+ '>';
894
+ if (this.renderProps.cellWeekNumbersVisible && (date.getUTCDay() === weekCalcFirstDow)) {
895
+ html += buildGotoAnchorHtml(view, { date: date, type: 'week' }, { 'class': 'fc-week-number' }, dateEnv.format(date, WEEK_NUM_FORMAT) // inner HTML
896
+ );
897
+ }
898
+ if (isDayNumberVisible) {
899
+ html += buildGotoAnchorHtml(view, date, { 'class': 'fc-day-number' }, dateEnv.format(date, DAY_NUM_FORMAT) // inner HTML
900
+ );
901
+ }
902
+ html += '</td>';
903
+ return html;
904
+ };
905
+ /* Sizing
906
+ ------------------------------------------------------------------------------------------------------------------*/
907
+ DayGrid.prototype.updateSize = function (isResize) {
908
+ var _a = this, fillRenderer = _a.fillRenderer, eventRenderer = _a.eventRenderer, mirrorRenderer = _a.mirrorRenderer;
909
+ if (isResize ||
910
+ this.isCellSizesDirty ||
911
+ this.view.calendar.isEventsUpdated // hack
912
+ ) {
913
+ this.buildPositionCaches();
914
+ this.isCellSizesDirty = false;
915
+ }
916
+ fillRenderer.computeSizes(isResize);
917
+ eventRenderer.computeSizes(isResize);
918
+ mirrorRenderer.computeSizes(isResize);
919
+ fillRenderer.assignSizes(isResize);
920
+ eventRenderer.assignSizes(isResize);
921
+ mirrorRenderer.assignSizes(isResize);
922
+ };
923
+ DayGrid.prototype.buildPositionCaches = function () {
924
+ this.buildColPositions();
925
+ this.buildRowPositions();
926
+ };
927
+ DayGrid.prototype.buildColPositions = function () {
928
+ this.colPositions.build();
929
+ };
930
+ DayGrid.prototype.buildRowPositions = function () {
931
+ this.rowPositions.build();
932
+ this.rowPositions.bottoms[this.rowCnt - 1] += this.bottomCoordPadding; // hack
933
+ };
934
+ /* Hit System
935
+ ------------------------------------------------------------------------------------------------------------------*/
936
+ DayGrid.prototype.positionToHit = function (leftPosition, topPosition) {
937
+ var _a = this, colPositions = _a.colPositions, rowPositions = _a.rowPositions;
938
+ var col = colPositions.leftToIndex(leftPosition);
939
+ var row = rowPositions.topToIndex(topPosition);
940
+ if (row != null && col != null) {
941
+ return {
942
+ row: row,
943
+ col: col,
944
+ dateSpan: {
945
+ range: this.getCellRange(row, col),
946
+ allDay: true
947
+ },
948
+ dayEl: this.getCellEl(row, col),
949
+ relativeRect: {
950
+ left: colPositions.lefts[col],
951
+ right: colPositions.rights[col],
952
+ top: rowPositions.tops[row],
953
+ bottom: rowPositions.bottoms[row]
954
+ }
955
+ };
956
+ }
957
+ };
958
+ /* Cell System
959
+ ------------------------------------------------------------------------------------------------------------------*/
960
+ // FYI: the first column is the leftmost column, regardless of date
961
+ DayGrid.prototype.getCellEl = function (row, col) {
962
+ return this.cellEls[row * this.colCnt + col];
963
+ };
964
+ /* Event Drag Visualization
965
+ ------------------------------------------------------------------------------------------------------------------*/
966
+ DayGrid.prototype._renderEventDrag = function (state) {
967
+ if (state) {
968
+ this.eventRenderer.hideByHash(state.affectedInstances);
969
+ this.fillRenderer.renderSegs('highlight', state.segs);
970
+ }
971
+ };
972
+ DayGrid.prototype._unrenderEventDrag = function (state) {
973
+ if (state) {
974
+ this.eventRenderer.showByHash(state.affectedInstances);
975
+ this.fillRenderer.unrender('highlight');
976
+ }
977
+ };
978
+ /* Event Resize Visualization
979
+ ------------------------------------------------------------------------------------------------------------------*/
980
+ DayGrid.prototype._renderEventResize = function (state) {
981
+ if (state) {
982
+ this.eventRenderer.hideByHash(state.affectedInstances);
983
+ this.fillRenderer.renderSegs('highlight', state.segs);
984
+ this.mirrorRenderer.renderSegs(state.segs, { isResizing: true, sourceSeg: state.sourceSeg });
985
+ }
986
+ };
987
+ DayGrid.prototype._unrenderEventResize = function (state) {
988
+ if (state) {
989
+ this.eventRenderer.showByHash(state.affectedInstances);
990
+ this.fillRenderer.unrender('highlight');
991
+ this.mirrorRenderer.unrender(state.segs, { isResizing: true, sourceSeg: state.sourceSeg });
992
+ }
993
+ };
994
+ /* More+ Link Popover
995
+ ------------------------------------------------------------------------------------------------------------------*/
996
+ DayGrid.prototype.removeSegPopover = function () {
997
+ if (this.segPopover) {
998
+ this.segPopover.hide(); // in handler, will call segPopover's removeElement
999
+ }
1000
+ };
1001
+ // Limits the number of "levels" (vertically stacking layers of events) for each row of the grid.
1002
+ // `levelLimit` can be false (don't limit), a number, or true (should be computed).
1003
+ DayGrid.prototype.limitRows = function (levelLimit) {
1004
+ var rowStructs = this.eventRenderer.rowStructs || [];
1005
+ var row; // row #
1006
+ var rowLevelLimit;
1007
+ for (row = 0; row < rowStructs.length; row++) {
1008
+ this.unlimitRow(row);
1009
+ if (!levelLimit) {
1010
+ rowLevelLimit = false;
1011
+ }
1012
+ else if (typeof levelLimit === 'number') {
1013
+ rowLevelLimit = levelLimit;
1014
+ }
1015
+ else {
1016
+ rowLevelLimit = this.computeRowLevelLimit(row);
1017
+ }
1018
+ if (rowLevelLimit !== false) {
1019
+ this.limitRow(row, rowLevelLimit);
1020
+ }
1021
+ }
1022
+ };
1023
+ // Computes the number of levels a row will accomodate without going outside its bounds.
1024
+ // Assumes the row is "rigid" (maintains a constant height regardless of what is inside).
1025
+ // `row` is the row number.
1026
+ DayGrid.prototype.computeRowLevelLimit = function (row) {
1027
+ var rowEl = this.rowEls[row]; // the containing "fake" row div
1028
+ var rowBottom = rowEl.getBoundingClientRect().bottom; // relative to viewport!
1029
+ var trEls = findChildren(this.eventRenderer.rowStructs[row].tbodyEl);
1030
+ var i;
1031
+ var trEl;
1032
+ // Reveal one level <tr> at a time and stop when we find one out of bounds
1033
+ for (i = 0; i < trEls.length; i++) {
1034
+ trEl = trEls[i];
1035
+ trEl.classList.remove('fc-limited'); // reset to original state (reveal)
1036
+ if (trEl.getBoundingClientRect().bottom > rowBottom) {
1037
+ return i;
1038
+ }
1039
+ }
1040
+ return false; // should not limit at all
1041
+ };
1042
+ // Limits the given grid row to the maximum number of levels and injects "more" links if necessary.
1043
+ // `row` is the row number.
1044
+ // `levelLimit` is a number for the maximum (inclusive) number of levels allowed.
1045
+ DayGrid.prototype.limitRow = function (row, levelLimit) {
1046
+ var _this = this;
1047
+ var _a = this, colCnt = _a.colCnt, isRtl = _a.isRtl;
1048
+ var rowStruct = this.eventRenderer.rowStructs[row];
1049
+ var moreNodes = []; // array of "more" <a> links and <td> DOM nodes
1050
+ var col = 0; // col #, left-to-right (not chronologically)
1051
+ var levelSegs; // array of segment objects in the last allowable level, ordered left-to-right
1052
+ var cellMatrix; // a matrix (by level, then column) of all <td> elements in the row
1053
+ var limitedNodes; // array of temporarily hidden level <tr> and segment <td> DOM nodes
1054
+ var i;
1055
+ var seg;
1056
+ var segsBelow; // array of segment objects below `seg` in the current `col`
1057
+ var totalSegsBelow; // total number of segments below `seg` in any of the columns `seg` occupies
1058
+ var colSegsBelow; // array of segment arrays, below seg, one for each column (offset from segs's first column)
1059
+ var td;
1060
+ var rowSpan;
1061
+ var segMoreNodes; // array of "more" <td> cells that will stand-in for the current seg's cell
1062
+ var j;
1063
+ var moreTd;
1064
+ var moreWrap;
1065
+ var moreLink;
1066
+ // Iterates through empty level cells and places "more" links inside if need be
1067
+ var emptyCellsUntil = function (endCol) {
1068
+ while (col < endCol) {
1069
+ segsBelow = _this.getCellSegs(row, col, levelLimit);
1070
+ if (segsBelow.length) {
1071
+ td = cellMatrix[levelLimit - 1][col];
1072
+ moreLink = _this.renderMoreLink(row, col, segsBelow);
1073
+ moreWrap = createElement('div', null, moreLink);
1074
+ td.appendChild(moreWrap);
1075
+ moreNodes.push(moreWrap);
1076
+ }
1077
+ col++;
1078
+ }
1079
+ };
1080
+ if (levelLimit && levelLimit < rowStruct.segLevels.length) { // is it actually over the limit?
1081
+ levelSegs = rowStruct.segLevels[levelLimit - 1];
1082
+ cellMatrix = rowStruct.cellMatrix;
1083
+ limitedNodes = findChildren(rowStruct.tbodyEl).slice(levelLimit); // get level <tr> elements past the limit
1084
+ limitedNodes.forEach(function (node) {
1085
+ node.classList.add('fc-limited'); // hide elements and get a simple DOM-nodes array
1086
+ });
1087
+ // iterate though segments in the last allowable level
1088
+ for (i = 0; i < levelSegs.length; i++) {
1089
+ seg = levelSegs[i];
1090
+ var leftCol = isRtl ? (colCnt - 1 - seg.lastCol) : seg.firstCol;
1091
+ var rightCol = isRtl ? (colCnt - 1 - seg.firstCol) : seg.lastCol;
1092
+ emptyCellsUntil(leftCol); // process empty cells before the segment
1093
+ // determine *all* segments below `seg` that occupy the same columns
1094
+ colSegsBelow = [];
1095
+ totalSegsBelow = 0;
1096
+ while (col <= rightCol) {
1097
+ segsBelow = this.getCellSegs(row, col, levelLimit);
1098
+ colSegsBelow.push(segsBelow);
1099
+ totalSegsBelow += segsBelow.length;
1100
+ col++;
1101
+ }
1102
+ if (totalSegsBelow) { // do we need to replace this segment with one or many "more" links?
1103
+ td = cellMatrix[levelLimit - 1][leftCol]; // the segment's parent cell
1104
+ rowSpan = td.rowSpan || 1;
1105
+ segMoreNodes = [];
1106
+ // make a replacement <td> for each column the segment occupies. will be one for each colspan
1107
+ for (j = 0; j < colSegsBelow.length; j++) {
1108
+ moreTd = createElement('td', { className: 'fc-more-cell', rowSpan: rowSpan });
1109
+ segsBelow = colSegsBelow[j];
1110
+ moreLink = this.renderMoreLink(row, leftCol + j, [seg].concat(segsBelow) // count seg as hidden too
1111
+ );
1112
+ moreWrap = createElement('div', null, moreLink);
1113
+ moreTd.appendChild(moreWrap);
1114
+ segMoreNodes.push(moreTd);
1115
+ moreNodes.push(moreTd);
1116
+ }
1117
+ td.classList.add('fc-limited');
1118
+ insertAfterElement(td, segMoreNodes);
1119
+ limitedNodes.push(td);
1120
+ }
1121
+ }
1122
+ emptyCellsUntil(this.colCnt); // finish off the level
1123
+ rowStruct.moreEls = moreNodes; // for easy undoing later
1124
+ rowStruct.limitedEls = limitedNodes; // for easy undoing later
1125
+ }
1126
+ };
1127
+ // Reveals all levels and removes all "more"-related elements for a grid's row.
1128
+ // `row` is a row number.
1129
+ DayGrid.prototype.unlimitRow = function (row) {
1130
+ var rowStruct = this.eventRenderer.rowStructs[row];
1131
+ if (rowStruct.moreEls) {
1132
+ rowStruct.moreEls.forEach(removeElement);
1133
+ rowStruct.moreEls = null;
1134
+ }
1135
+ if (rowStruct.limitedEls) {
1136
+ rowStruct.limitedEls.forEach(function (limitedEl) {
1137
+ limitedEl.classList.remove('fc-limited');
1138
+ });
1139
+ rowStruct.limitedEls = null;
1140
+ }
1141
+ };
1142
+ // Renders an <a> element that represents hidden event element for a cell.
1143
+ // Responsible for attaching click handler as well.
1144
+ DayGrid.prototype.renderMoreLink = function (row, col, hiddenSegs) {
1145
+ var _this = this;
1146
+ var _a = this, view = _a.view, dateEnv = _a.dateEnv;
1147
+ var a = createElement('a', { className: 'fc-more' });
1148
+ a.innerText = this.getMoreLinkText(hiddenSegs.length);
1149
+ a.addEventListener('click', function (ev) {
1150
+ var clickOption = _this.opt('eventLimitClick');
1151
+ var _col = _this.isRtl ? _this.colCnt - col - 1 : col; // HACK: props.cells has different dir system?
1152
+ var date = _this.props.cells[row][_col].date;
1153
+ var moreEl = ev.currentTarget;
1154
+ var dayEl = _this.getCellEl(row, col);
1155
+ var allSegs = _this.getCellSegs(row, col);
1156
+ // rescope the segments to be within the cell's date
1157
+ var reslicedAllSegs = _this.resliceDaySegs(allSegs, date);
1158
+ var reslicedHiddenSegs = _this.resliceDaySegs(hiddenSegs, date);
1159
+ if (typeof clickOption === 'function') {
1160
+ // the returned value can be an atomic option
1161
+ clickOption = _this.publiclyTrigger('eventLimitClick', [
1162
+ {
1163
+ date: dateEnv.toDate(date),
1164
+ allDay: true,
1165
+ dayEl: dayEl,
1166
+ moreEl: moreEl,
1167
+ segs: reslicedAllSegs,
1168
+ hiddenSegs: reslicedHiddenSegs,
1169
+ jsEvent: ev,
1170
+ view: view
1171
+ }
1172
+ ]);
1173
+ }
1174
+ if (clickOption === 'popover') {
1175
+ _this.showSegPopover(row, col, moreEl, reslicedAllSegs);
1176
+ }
1177
+ else if (typeof clickOption === 'string') { // a view name
1178
+ view.calendar.zoomTo(date, clickOption);
1179
+ }
1180
+ });
1181
+ return a;
1182
+ };
1183
+ // Reveals the popover that displays all events within a cell
1184
+ DayGrid.prototype.showSegPopover = function (row, col, moreLink, segs) {
1185
+ var _this = this;
1186
+ var _a = this, calendar = _a.calendar, view = _a.view, theme = _a.theme;
1187
+ var _col = this.isRtl ? this.colCnt - col - 1 : col; // HACK: props.cells has different dir system?
1188
+ var moreWrap = moreLink.parentNode; // the <div> wrapper around the <a>
1189
+ var topEl; // the element we want to match the top coordinate of
1190
+ var options;
1191
+ if (this.rowCnt === 1) {
1192
+ topEl = view.el; // will cause the popover to cover any sort of header
1193
+ }
1194
+ else {
1195
+ topEl = this.rowEls[row]; // will align with top of row
1196
+ }
1197
+ options = {
1198
+ className: 'fc-more-popover ' + theme.getClass('popover'),
1199
+ parentEl: view.el,
1200
+ top: computeRect(topEl).top,
1201
+ autoHide: true,
1202
+ content: function (el) {
1203
+ _this.segPopoverTile = new DayTile(_this.context, el);
1204
+ _this.updateSegPopoverTile(_this.props.cells[row][_col].date, segs);
1205
+ },
1206
+ hide: function () {
1207
+ _this.segPopoverTile.destroy();
1208
+ _this.segPopoverTile = null;
1209
+ _this.segPopover.destroy();
1210
+ _this.segPopover = null;
1211
+ }
1212
+ };
1213
+ // Determine horizontal coordinate.
1214
+ // We use the moreWrap instead of the <td> to avoid border confusion.
1215
+ if (this.isRtl) {
1216
+ options.right = computeRect(moreWrap).right + 1; // +1 to be over cell border
1217
+ }
1218
+ else {
1219
+ options.left = computeRect(moreWrap).left - 1; // -1 to be over cell border
1220
+ }
1221
+ this.segPopover = new Popover(options);
1222
+ this.segPopover.show();
1223
+ calendar.releaseAfterSizingTriggers(); // hack for eventPositioned
1224
+ };
1225
+ // Given the events within an array of segment objects, reslice them to be in a single day
1226
+ DayGrid.prototype.resliceDaySegs = function (segs, dayDate) {
1227
+ var dayStart = dayDate;
1228
+ var dayEnd = addDays(dayStart, 1);
1229
+ var dayRange = { start: dayStart, end: dayEnd };
1230
+ var newSegs = [];
1231
+ for (var _i = 0, segs_1 = segs; _i < segs_1.length; _i++) {
1232
+ var seg = segs_1[_i];
1233
+ var eventRange = seg.eventRange;
1234
+ var origRange = eventRange.range;
1235
+ var slicedRange = intersectRanges(origRange, dayRange);
1236
+ if (slicedRange) {
1237
+ newSegs.push(__assign({}, seg, { eventRange: {
1238
+ def: eventRange.def,
1239
+ ui: __assign({}, eventRange.ui, { durationEditable: false }),
1240
+ instance: eventRange.instance,
1241
+ range: slicedRange
1242
+ }, isStart: seg.isStart && slicedRange.start.valueOf() === origRange.start.valueOf(), isEnd: seg.isEnd && slicedRange.end.valueOf() === origRange.end.valueOf() }));
1243
+ }
1244
+ }
1245
+ return newSegs;
1246
+ };
1247
+ // Generates the text that should be inside a "more" link, given the number of events it represents
1248
+ DayGrid.prototype.getMoreLinkText = function (num) {
1249
+ var opt = this.opt('eventLimitText');
1250
+ if (typeof opt === 'function') {
1251
+ return opt(num);
1252
+ }
1253
+ else {
1254
+ return '+' + num + ' ' + opt;
1255
+ }
1256
+ };
1257
+ // Returns segments within a given cell.
1258
+ // If `startLevel` is specified, returns only events including and below that level. Otherwise returns all segs.
1259
+ DayGrid.prototype.getCellSegs = function (row, col, startLevel) {
1260
+ var segMatrix = this.eventRenderer.rowStructs[row].segMatrix;
1261
+ var level = startLevel || 0;
1262
+ var segs = [];
1263
+ var seg;
1264
+ while (level < segMatrix.length) {
1265
+ seg = segMatrix[level][col];
1266
+ if (seg) {
1267
+ segs.push(seg);
1268
+ }
1269
+ level++;
1270
+ }
1271
+ return segs;
1272
+ };
1273
+ return DayGrid;
1274
+ }(DateComponent));
1275
+
1276
+ var WEEK_NUM_FORMAT$1 = createFormatter({ week: 'numeric' });
1277
+ /* An abstract class for the daygrid views, as well as month view. Renders one or more rows of day cells.
1278
+ ----------------------------------------------------------------------------------------------------------------------*/
1279
+ // It is a manager for a DayGrid subcomponent, which does most of the heavy lifting.
1280
+ // It is responsible for managing width/height.
1281
+ var DayGridView = /** @class */ (function (_super) {
1282
+ __extends(DayGridView, _super);
1283
+ function DayGridView(context, viewSpec, dateProfileGenerator, parentEl) {
1284
+ var _this = _super.call(this, context, viewSpec, dateProfileGenerator, parentEl) || this;
1285
+ /* Header Rendering
1286
+ ------------------------------------------------------------------------------------------------------------------*/
1287
+ // Generates the HTML that will go before the day-of week header cells
1288
+ _this.renderHeadIntroHtml = function () {
1289
+ var theme = _this.theme;
1290
+ if (_this.colWeekNumbersVisible) {
1291
+ return '' +
1292
+ '<th class="fc-week-number ' + theme.getClass('widgetHeader') + '" ' + _this.weekNumberStyleAttr() + '>' +
1293
+ '<span>' + // needed for matchCellWidths
1294
+ htmlEscape(_this.opt('weekLabel')) +
1295
+ '</span>' +
1296
+ '</th>';
1297
+ }
1298
+ return '';
1299
+ };
1300
+ /* Day Grid Rendering
1301
+ ------------------------------------------------------------------------------------------------------------------*/
1302
+ // Generates the HTML that will go before content-skeleton cells that display the day/week numbers
1303
+ _this.renderDayGridNumberIntroHtml = function (row, dayGrid) {
1304
+ var dateEnv = _this.dateEnv;
1305
+ var weekStart = dayGrid.props.cells[row][0].date;
1306
+ if (_this.colWeekNumbersVisible) {
1307
+ return '' +
1308
+ '<td class="fc-week-number" ' + _this.weekNumberStyleAttr() + '>' +
1309
+ buildGotoAnchorHtml(// aside from link, important for matchCellWidths
1310
+ _this, { date: weekStart, type: 'week', forceOff: dayGrid.colCnt === 1 }, dateEnv.format(weekStart, WEEK_NUM_FORMAT$1) // inner HTML
1311
+ ) +
1312
+ '</td>';
1313
+ }
1314
+ return '';
1315
+ };
1316
+ // Generates the HTML that goes before the day bg cells for each day-row
1317
+ _this.renderDayGridBgIntroHtml = function () {
1318
+ var theme = _this.theme;
1319
+ if (_this.colWeekNumbersVisible) {
1320
+ return '<td class="fc-week-number ' + theme.getClass('widgetContent') + '" ' + _this.weekNumberStyleAttr() + '></td>';
1321
+ }
1322
+ return '';
1323
+ };
1324
+ // Generates the HTML that goes before every other type of row generated by DayGrid.
1325
+ // Affects mirror-skeleton and highlight-skeleton rows.
1326
+ _this.renderDayGridIntroHtml = function () {
1327
+ if (_this.colWeekNumbersVisible) {
1328
+ return '<td class="fc-week-number" ' + _this.weekNumberStyleAttr() + '></td>';
1329
+ }
1330
+ return '';
1331
+ };
1332
+ _this.el.classList.add('fc-dayGrid-view');
1333
+ _this.el.innerHTML = _this.renderSkeletonHtml();
1334
+ _this.scroller = new ScrollComponent('hidden', // overflow x
1335
+ 'auto' // overflow y
1336
+ );
1337
+ var dayGridContainerEl = _this.scroller.el;
1338
+ _this.el.querySelector('.fc-body > tr > td').appendChild(dayGridContainerEl);
1339
+ dayGridContainerEl.classList.add('fc-day-grid-container');
1340
+ var dayGridEl = createElement('div', { className: 'fc-day-grid' });
1341
+ dayGridContainerEl.appendChild(dayGridEl);
1342
+ var cellWeekNumbersVisible;
1343
+ if (_this.opt('weekNumbers')) {
1344
+ if (_this.opt('weekNumbersWithinDays')) {
1345
+ cellWeekNumbersVisible = true;
1346
+ _this.colWeekNumbersVisible = false;
1347
+ }
1348
+ else {
1349
+ cellWeekNumbersVisible = false;
1350
+ _this.colWeekNumbersVisible = true;
1351
+ }
1352
+ }
1353
+ else {
1354
+ _this.colWeekNumbersVisible = false;
1355
+ cellWeekNumbersVisible = false;
1356
+ }
1357
+ _this.dayGrid = new DayGrid(_this.context, dayGridEl, {
1358
+ renderNumberIntroHtml: _this.renderDayGridNumberIntroHtml,
1359
+ renderBgIntroHtml: _this.renderDayGridBgIntroHtml,
1360
+ renderIntroHtml: _this.renderDayGridIntroHtml,
1361
+ colWeekNumbersVisible: _this.colWeekNumbersVisible,
1362
+ cellWeekNumbersVisible: cellWeekNumbersVisible
1363
+ });
1364
+ return _this;
1365
+ }
1366
+ DayGridView.prototype.destroy = function () {
1367
+ _super.prototype.destroy.call(this);
1368
+ this.dayGrid.destroy();
1369
+ this.scroller.destroy();
1370
+ };
1371
+ // Builds the HTML skeleton for the view.
1372
+ // The day-grid component will render inside of a container defined by this HTML.
1373
+ DayGridView.prototype.renderSkeletonHtml = function () {
1374
+ var theme = this.theme;
1375
+ return '' +
1376
+ '<table class="' + theme.getClass('tableGrid') + '">' +
1377
+ (this.opt('columnHeader') ?
1378
+ '<thead class="fc-head">' +
1379
+ '<tr>' +
1380
+ '<td class="fc-head-container ' + theme.getClass('widgetHeader') + '">&nbsp;</td>' +
1381
+ '</tr>' +
1382
+ '</thead>' :
1383
+ '') +
1384
+ '<tbody class="fc-body">' +
1385
+ '<tr>' +
1386
+ '<td class="' + theme.getClass('widgetContent') + '"></td>' +
1387
+ '</tr>' +
1388
+ '</tbody>' +
1389
+ '</table>';
1390
+ };
1391
+ // Generates an HTML attribute string for setting the width of the week number column, if it is known
1392
+ DayGridView.prototype.weekNumberStyleAttr = function () {
1393
+ if (this.weekNumberWidth != null) {
1394
+ return 'style="width:' + this.weekNumberWidth + 'px"';
1395
+ }
1396
+ return '';
1397
+ };
1398
+ // Determines whether each row should have a constant height
1399
+ DayGridView.prototype.hasRigidRows = function () {
1400
+ var eventLimit = this.opt('eventLimit');
1401
+ return eventLimit && typeof eventLimit !== 'number';
1402
+ };
1403
+ /* Dimensions
1404
+ ------------------------------------------------------------------------------------------------------------------*/
1405
+ DayGridView.prototype.updateSize = function (isResize, viewHeight, isAuto) {
1406
+ _super.prototype.updateSize.call(this, isResize, viewHeight, isAuto); // will call updateBaseSize. important that executes first
1407
+ this.dayGrid.updateSize(isResize);
1408
+ };
1409
+ // Refreshes the horizontal dimensions of the view
1410
+ DayGridView.prototype.updateBaseSize = function (isResize, viewHeight, isAuto) {
1411
+ var dayGrid = this.dayGrid;
1412
+ var eventLimit = this.opt('eventLimit');
1413
+ var headRowEl = this.header ? this.header.el : null; // HACK
1414
+ var scrollerHeight;
1415
+ var scrollbarWidths;
1416
+ // hack to give the view some height prior to dayGrid's columns being rendered
1417
+ // TODO: separate setting height from scroller VS dayGrid.
1418
+ if (!dayGrid.rowEls) {
1419
+ if (!isAuto) {
1420
+ scrollerHeight = this.computeScrollerHeight(viewHeight);
1421
+ this.scroller.setHeight(scrollerHeight);
1422
+ }
1423
+ return;
1424
+ }
1425
+ if (this.colWeekNumbersVisible) {
1426
+ // Make sure all week number cells running down the side have the same width.
1427
+ this.weekNumberWidth = matchCellWidths(findElements(this.el, '.fc-week-number'));
1428
+ }
1429
+ // reset all heights to be natural
1430
+ this.scroller.clear();
1431
+ if (headRowEl) {
1432
+ uncompensateScroll(headRowEl);
1433
+ }
1434
+ dayGrid.removeSegPopover(); // kill the "more" popover if displayed
1435
+ // is the event limit a constant level number?
1436
+ if (eventLimit && typeof eventLimit === 'number') {
1437
+ dayGrid.limitRows(eventLimit); // limit the levels first so the height can redistribute after
1438
+ }
1439
+ // distribute the height to the rows
1440
+ // (viewHeight is a "recommended" value if isAuto)
1441
+ scrollerHeight = this.computeScrollerHeight(viewHeight);
1442
+ this.setGridHeight(scrollerHeight, isAuto);
1443
+ // is the event limit dynamically calculated?
1444
+ if (eventLimit && typeof eventLimit !== 'number') {
1445
+ dayGrid.limitRows(eventLimit); // limit the levels after the grid's row heights have been set
1446
+ }
1447
+ if (!isAuto) { // should we force dimensions of the scroll container?
1448
+ this.scroller.setHeight(scrollerHeight);
1449
+ scrollbarWidths = this.scroller.getScrollbarWidths();
1450
+ if (scrollbarWidths.left || scrollbarWidths.right) { // using scrollbars?
1451
+ if (headRowEl) {
1452
+ compensateScroll(headRowEl, scrollbarWidths);
1453
+ }
1454
+ // doing the scrollbar compensation might have created text overflow which created more height. redo
1455
+ scrollerHeight = this.computeScrollerHeight(viewHeight);
1456
+ this.scroller.setHeight(scrollerHeight);
1457
+ }
1458
+ // guarantees the same scrollbar widths
1459
+ this.scroller.lockOverflow(scrollbarWidths);
1460
+ }
1461
+ };
1462
+ // given a desired total height of the view, returns what the height of the scroller should be
1463
+ DayGridView.prototype.computeScrollerHeight = function (viewHeight) {
1464
+ return viewHeight -
1465
+ subtractInnerElHeight(this.el, this.scroller.el); // everything that's NOT the scroller
1466
+ };
1467
+ // Sets the height of just the DayGrid component in this view
1468
+ DayGridView.prototype.setGridHeight = function (height, isAuto) {
1469
+ if (this.opt('monthMode')) {
1470
+ // if auto, make the height of each row the height that it would be if there were 6 weeks
1471
+ if (isAuto) {
1472
+ height *= this.dayGrid.rowCnt / 6;
1473
+ }
1474
+ distributeHeight(this.dayGrid.rowEls, height, !isAuto); // if auto, don't compensate for height-hogging rows
1475
+ }
1476
+ else {
1477
+ if (isAuto) {
1478
+ undistributeHeight(this.dayGrid.rowEls); // let the rows be their natural height with no expanding
1479
+ }
1480
+ else {
1481
+ distributeHeight(this.dayGrid.rowEls, height, true); // true = compensate for height-hogging rows
1482
+ }
1483
+ }
1484
+ };
1485
+ /* Scroll
1486
+ ------------------------------------------------------------------------------------------------------------------*/
1487
+ DayGridView.prototype.computeDateScroll = function (duration) {
1488
+ return { top: 0 };
1489
+ };
1490
+ DayGridView.prototype.queryDateScroll = function () {
1491
+ return { top: this.scroller.getScrollTop() };
1492
+ };
1493
+ DayGridView.prototype.applyDateScroll = function (scroll) {
1494
+ if (scroll.top !== undefined) {
1495
+ this.scroller.setScrollTop(scroll.top);
1496
+ }
1497
+ };
1498
+ return DayGridView;
1499
+ }(View));
1500
+ DayGridView.prototype.dateProfileGeneratorClass = DayGridDateProfileGenerator;
1501
+
1502
+ var SimpleDayGrid = /** @class */ (function (_super) {
1503
+ __extends(SimpleDayGrid, _super);
1504
+ function SimpleDayGrid(context, dayGrid) {
1505
+ var _this = _super.call(this, context, dayGrid.el) || this;
1506
+ _this.slicer = new DayGridSlicer();
1507
+ _this.dayGrid = dayGrid;
1508
+ context.calendar.registerInteractiveComponent(_this, { el: _this.dayGrid.el });
1509
+ return _this;
1510
+ }
1511
+ SimpleDayGrid.prototype.destroy = function () {
1512
+ _super.prototype.destroy.call(this);
1513
+ this.calendar.unregisterInteractiveComponent(this);
1514
+ };
1515
+ SimpleDayGrid.prototype.render = function (props) {
1516
+ var dayGrid = this.dayGrid;
1517
+ var dateProfile = props.dateProfile, dayTable = props.dayTable;
1518
+ dayGrid.receiveProps(__assign({}, this.slicer.sliceProps(props, dateProfile, props.nextDayThreshold, dayGrid, dayTable), { dateProfile: dateProfile, cells: dayTable.cells, isRigid: props.isRigid }));
1519
+ };
1520
+ SimpleDayGrid.prototype.buildPositionCaches = function () {
1521
+ this.dayGrid.buildPositionCaches();
1522
+ };
1523
+ SimpleDayGrid.prototype.queryHit = function (positionLeft, positionTop) {
1524
+ var rawHit = this.dayGrid.positionToHit(positionLeft, positionTop);
1525
+ if (rawHit) {
1526
+ return {
1527
+ component: this.dayGrid,
1528
+ dateSpan: rawHit.dateSpan,
1529
+ dayEl: rawHit.dayEl,
1530
+ rect: {
1531
+ left: rawHit.relativeRect.left,
1532
+ right: rawHit.relativeRect.right,
1533
+ top: rawHit.relativeRect.top,
1534
+ bottom: rawHit.relativeRect.bottom
1535
+ },
1536
+ layer: 0
1537
+ };
1538
+ }
1539
+ };
1540
+ return SimpleDayGrid;
1541
+ }(DateComponent));
1542
+ var DayGridSlicer = /** @class */ (function (_super) {
1543
+ __extends(DayGridSlicer, _super);
1544
+ function DayGridSlicer() {
1545
+ return _super !== null && _super.apply(this, arguments) || this;
1546
+ }
1547
+ DayGridSlicer.prototype.sliceRange = function (dateRange, dayTable) {
1548
+ return dayTable.sliceRange(dateRange);
1549
+ };
1550
+ return DayGridSlicer;
1551
+ }(Slicer));
1552
+
1553
+ var DayGridView$1 = /** @class */ (function (_super) {
1554
+ __extends(DayGridView, _super);
1555
+ function DayGridView(_context, viewSpec, dateProfileGenerator, parentEl) {
1556
+ var _this = _super.call(this, _context, viewSpec, dateProfileGenerator, parentEl) || this;
1557
+ _this.buildDayTable = memoize(buildDayTable);
1558
+ if (_this.opt('columnHeader')) {
1559
+ _this.header = new DayHeader(_this.context, _this.el.querySelector('.fc-head-container'));
1560
+ }
1561
+ _this.simpleDayGrid = new SimpleDayGrid(_this.context, _this.dayGrid);
1562
+ return _this;
1563
+ }
1564
+ DayGridView.prototype.destroy = function () {
1565
+ _super.prototype.destroy.call(this);
1566
+ if (this.header) {
1567
+ this.header.destroy();
1568
+ }
1569
+ this.simpleDayGrid.destroy();
1570
+ };
1571
+ DayGridView.prototype.render = function (props) {
1572
+ _super.prototype.render.call(this, props);
1573
+ var dateProfile = this.props.dateProfile;
1574
+ var dayTable = this.dayTable =
1575
+ this.buildDayTable(dateProfile, this.dateProfileGenerator);
1576
+ if (this.header) {
1577
+ this.header.receiveProps({
1578
+ dateProfile: dateProfile,
1579
+ dates: dayTable.headerDates,
1580
+ datesRepDistinctDays: dayTable.rowCnt === 1,
1581
+ renderIntroHtml: this.renderHeadIntroHtml
1582
+ });
1583
+ }
1584
+ this.simpleDayGrid.receiveProps({
1585
+ dateProfile: dateProfile,
1586
+ dayTable: dayTable,
1587
+ businessHours: props.businessHours,
1588
+ dateSelection: props.dateSelection,
1589
+ eventStore: props.eventStore,
1590
+ eventUiBases: props.eventUiBases,
1591
+ eventSelection: props.eventSelection,
1592
+ eventDrag: props.eventDrag,
1593
+ eventResize: props.eventResize,
1594
+ isRigid: this.hasRigidRows(),
1595
+ nextDayThreshold: this.nextDayThreshold
1596
+ });
1597
+ };
1598
+ return DayGridView;
1599
+ }(DayGridView));
1600
+ function buildDayTable(dateProfile, dateProfileGenerator) {
1601
+ var daySeries = new DaySeries(dateProfile.renderRange, dateProfileGenerator);
1602
+ return new DayTable(daySeries, /year|month|week/.test(dateProfile.currentRangeUnit));
1603
+ }
1604
+
1605
+ var main = createPlugin({
1606
+ defaultView: 'dayGridMonth',
1607
+ views: {
1608
+ dayGrid: DayGridView$1,
1609
+ dayGridDay: {
1610
+ type: 'dayGrid',
1611
+ duration: { days: 1 }
1612
+ },
1613
+ dayGridWeek: {
1614
+ type: 'dayGrid',
1615
+ duration: { weeks: 1 }
1616
+ },
1617
+ dayGridMonth: {
1618
+ type: 'dayGrid',
1619
+ duration: { months: 1 },
1620
+ monthMode: true,
1621
+ fixedWeekCount: true
1622
+ }
1623
+ }
1624
+ });
1625
+
1626
+ export default main;
1627
+ export { DayGridView as AbstractDayGridView, DayBgRow, DayGrid, DayGridSlicer, DayGridView$1 as DayGridView, SimpleDayGrid, buildDayTable as buildBasicDayTable };