@fullcalendar_vue3.js 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. import "./chunk-MKUMB4YM.js";
  2. import "./chunk-S6VK5PVK.js";
  3. import "./chunk-DAAU2ANU.js";
  4. import {
  5. Calendar,
  6. CustomRenderingStore
  7. } from "./chunk-QH2VTIUN.js";
  8. import "./chunk-PTVH4XAB.js";
  9. import {
  10. Fragment,
  11. Teleport,
  12. defineComponent,
  13. h
  14. } from "./chunk-YVHZHMSQ.js";
  15. import "./chunk-VNBICN6T.js";
  16. import "./chunk-2LSFTFF7.js";
  17. // node_modules/.pnpm/@fullcalendar+vue3@6.1.14_@fullcalendar+core@6.1.14_vue@3.4.27/node_modules/@fullcalendar/vue3/dist/options.js
  18. var OPTION_IS_COMPLEX = {
  19. headerToolbar: true,
  20. footerToolbar: true,
  21. events: true,
  22. eventSources: true,
  23. resources: true
  24. };
  25. // node_modules/.pnpm/@fullcalendar+vue3@6.1.14_@fullcalendar+core@6.1.14_vue@3.4.27/node_modules/@fullcalendar/vue3/dist/FullCalendar.js
  26. var FullCalendar = defineComponent({
  27. props: {
  28. options: Object
  29. },
  30. data() {
  31. return {
  32. renderId: 0,
  33. customRenderingMap: /* @__PURE__ */ new Map()
  34. };
  35. },
  36. methods: {
  37. getApi() {
  38. return getSecret(this).calendar;
  39. },
  40. buildOptions(suppliedOptions) {
  41. return {
  42. ...suppliedOptions,
  43. customRenderingMetaMap: kebabToCamelKeys(this.$slots),
  44. handleCustomRendering: getSecret(this).handleCustomRendering
  45. };
  46. }
  47. },
  48. render() {
  49. const customRenderingNodes = [];
  50. for (const customRendering of this.customRenderingMap.values()) {
  51. customRenderingNodes.push(h(CustomRenderingComponent, {
  52. key: customRendering.id,
  53. customRendering
  54. }));
  55. }
  56. return h("div", {
  57. // when renderId is changed, Vue will trigger a real-DOM async rerender, calling beforeUpdate/updated
  58. attrs: { "data-fc-render-id": this.renderId }
  59. }, h(Fragment, customRenderingNodes));
  60. },
  61. mounted() {
  62. const customRenderingStore = new CustomRenderingStore();
  63. getSecret(this).handleCustomRendering = customRenderingStore.handle.bind(customRenderingStore);
  64. const calendarOptions = this.buildOptions(this.options);
  65. const calendar = new Calendar(this.$el, calendarOptions);
  66. getSecret(this).calendar = calendar;
  67. calendar.render();
  68. customRenderingStore.subscribe((customRenderingMap) => {
  69. this.customRenderingMap = customRenderingMap;
  70. this.renderId++;
  71. getSecret(this).needCustomRenderingResize = true;
  72. });
  73. },
  74. beforeUpdate() {
  75. this.getApi().resumeRendering();
  76. },
  77. updated() {
  78. if (getSecret(this).needCustomRenderingResize) {
  79. getSecret(this).needCustomRenderingResize = false;
  80. this.getApi().updateSize();
  81. }
  82. },
  83. beforeUnmount() {
  84. this.getApi().destroy();
  85. },
  86. watch: buildWatchers()
  87. });
  88. var FullCalendar_default = FullCalendar;
  89. var CustomRenderingComponent = defineComponent({
  90. props: {
  91. customRendering: Object
  92. },
  93. render() {
  94. const customRendering = this.customRendering;
  95. const innerContent = typeof customRendering.generatorMeta === "function" ? customRendering.generatorMeta(customRendering.renderProps) : (
  96. // vue-normalized slot function
  97. customRendering.generatorMeta
  98. );
  99. return h(Teleport, { to: customRendering.containerEl }, innerContent);
  100. }
  101. });
  102. function getSecret(inst) {
  103. return inst;
  104. }
  105. function buildWatchers() {
  106. let watchers = {
  107. // watches changes of ALL options and their nested objects,
  108. // but this is only a means to be notified of top-level non-complex options changes.
  109. options: {
  110. deep: true,
  111. handler(options) {
  112. let calendar = this.getApi();
  113. calendar.pauseRendering();
  114. let calendarOptions = this.buildOptions(options);
  115. calendar.resetOptions(calendarOptions);
  116. this.renderId++;
  117. }
  118. }
  119. };
  120. for (let complexOptionName in OPTION_IS_COMPLEX) {
  121. watchers[`options.${complexOptionName}`] = {
  122. deep: true,
  123. handler(val) {
  124. if (val !== void 0) {
  125. let calendar = this.getApi();
  126. calendar.pauseRendering();
  127. calendar.resetOptions({
  128. [complexOptionName]: val
  129. }, [complexOptionName]);
  130. this.renderId++;
  131. }
  132. }
  133. };
  134. }
  135. return watchers;
  136. }
  137. function kebabToCamelKeys(map) {
  138. const newMap = {};
  139. for (const key in map) {
  140. newMap[kebabToCamel(key)] = map[key];
  141. }
  142. return newMap;
  143. }
  144. function kebabToCamel(s) {
  145. return s.split("-").map((word, index) => index ? capitalize(word) : word).join("");
  146. }
  147. function capitalize(s) {
  148. return s.charAt(0).toUpperCase() + s.slice(1);
  149. }
  150. // node_modules/.pnpm/@fullcalendar+vue3@6.1.14_@fullcalendar+core@6.1.14_vue@3.4.27/node_modules/@fullcalendar/vue3/dist/index.js
  151. var dist_default = FullCalendar_default;
  152. export {
  153. dist_default as default
  154. };
  155. //# sourceMappingURL=@fullcalendar_vue3.js.map