@sneat/extensions-schedulus-shared 0.3.0

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 (194) hide show
  1. package/esm2022/index.js +2 -0
  2. package/esm2022/index.js.map +1 -0
  3. package/esm2022/lib/components/calendar/calendar-base.component.js +83 -0
  4. package/esm2022/lib/components/calendar/calendar-base.component.js.map +1 -0
  5. package/esm2022/lib/components/calendar/calendar-brief.component.js +57 -0
  6. package/esm2022/lib/components/calendar/calendar-brief.component.js.map +1 -0
  7. package/esm2022/lib/components/calendar/calendar-component-types.js +2 -0
  8. package/esm2022/lib/components/calendar/calendar-component-types.js.map +1 -0
  9. package/esm2022/lib/components/calendar/calendar-state.service.js +90 -0
  10. package/esm2022/lib/components/calendar/calendar-state.service.js.map +1 -0
  11. package/esm2022/lib/components/calendar/calendar.component.js +284 -0
  12. package/esm2022/lib/components/calendar/calendar.component.js.map +1 -0
  13. package/esm2022/lib/components/calendar/components/calendar-add-buttons/calendar-add-buttons.component.js +45 -0
  14. package/esm2022/lib/components/calendar/components/calendar-add-buttons/calendar-add-buttons.component.js.map +1 -0
  15. package/esm2022/lib/components/calendar/components/calendar-day/calendar-day-base.component.js +26 -0
  16. package/esm2022/lib/components/calendar/components/calendar-day/calendar-day-base.component.js.map +1 -0
  17. package/esm2022/lib/components/calendar/components/calendar-day/calendar-day-card.component.js +67 -0
  18. package/esm2022/lib/components/calendar/components/calendar-day/calendar-day-card.component.js.map +1 -0
  19. package/esm2022/lib/components/calendar/components/calendar-day/calendar-day-tab.component.js +74 -0
  20. package/esm2022/lib/components/calendar/components/calendar-day/calendar-day-tab.component.js.map +1 -0
  21. package/esm2022/lib/components/calendar/components/calendar-day/calendar-day-title.component.js +27 -0
  22. package/esm2022/lib/components/calendar/components/calendar-day/calendar-day-title.component.js.map +1 -0
  23. package/esm2022/lib/components/calendar/components/calendar-day/calendar-day.component.js +129 -0
  24. package/esm2022/lib/components/calendar/components/calendar-day/calendar-day.component.js.map +1 -0
  25. package/esm2022/lib/components/calendar/components/calendar-filter/calendar-filter.component.js +162 -0
  26. package/esm2022/lib/components/calendar/components/calendar-filter/calendar-filter.component.js.map +1 -0
  27. package/esm2022/lib/components/calendar/components/calendar-filter/calendar-filter.js +17 -0
  28. package/esm2022/lib/components/calendar/components/calendar-filter/calendar-filter.js.map +1 -0
  29. package/esm2022/lib/components/calendar/components/calendar-filter/contacts-filter.component.js +95 -0
  30. package/esm2022/lib/components/calendar/components/calendar-filter/contacts-filter.component.js.map +1 -0
  31. package/esm2022/lib/components/calendar/components/calendar-week/calendar-week-card.component.js +50 -0
  32. package/esm2022/lib/components/calendar/components/calendar-week/calendar-week-card.component.js.map +1 -0
  33. package/esm2022/lib/components/calendar/components/calendar-week/calendar-week-tab.component.js +18 -0
  34. package/esm2022/lib/components/calendar/components/calendar-week/calendar-week-tab.component.js.map +1 -0
  35. package/esm2022/lib/components/calendar/components/calendar-week/calendar-week-title.component.js +15 -0
  36. package/esm2022/lib/components/calendar/components/calendar-week/calendar-week-title.component.js.map +1 -0
  37. package/esm2022/lib/components/calendar/components/calendar-week/calendar-week.component.js +78 -0
  38. package/esm2022/lib/components/calendar/components/calendar-week/calendar-week.component.js.map +1 -0
  39. package/esm2022/lib/components/calendar/components/calendar-weekday/calendar-weekday.component.js +66 -0
  40. package/esm2022/lib/components/calendar/components/calendar-weekday/calendar-weekday.component.js.map +1 -0
  41. package/esm2022/lib/components/calendar/components/day-slot-item/day-slot-item.component.js +93 -0
  42. package/esm2022/lib/components/calendar/components/day-slot-item/day-slot-item.component.js.map +1 -0
  43. package/esm2022/lib/components/calendar/components/day-slot-item/slot-context-menu.component.js +324 -0
  44. package/esm2022/lib/components/calendar/components/day-slot-item/slot-context-menu.component.js.map +1 -0
  45. package/esm2022/lib/components/calendar/components/recurrings-tab/recurrings-tab.component.js +36 -0
  46. package/esm2022/lib/components/calendar/components/recurrings-tab/recurrings-tab.component.js.map +1 -0
  47. package/esm2022/lib/components/calendar/components/singles-tab/single-happenings-list.component.js +65 -0
  48. package/esm2022/lib/components/calendar/components/singles-tab/single-happenings-list.component.js.map +1 -0
  49. package/esm2022/lib/components/calendar/components/singles-tab/singles-tab.component.js +106 -0
  50. package/esm2022/lib/components/calendar/components/singles-tab/singles-tab.component.js.map +1 -0
  51. package/esm2022/lib/components/calendar/components/timing-badge/timing-badge.component.js +25 -0
  52. package/esm2022/lib/components/calendar/components/timing-badge/timing-badge.component.js.map +1 -0
  53. package/esm2022/lib/components/calendar/weekday.js +2 -0
  54. package/esm2022/lib/components/calendar/weekday.js.map +1 -0
  55. package/esm2022/lib/components/calendar-core.js +64 -0
  56. package/esm2022/lib/components/calendar-core.js.map +1 -0
  57. package/esm2022/lib/components/calendar-filter.service.js +28 -0
  58. package/esm2022/lib/components/calendar-filter.service.js.map +1 -0
  59. package/esm2022/lib/components/calendar-slots.js +30 -0
  60. package/esm2022/lib/components/calendar-slots.js.map +1 -0
  61. package/esm2022/lib/components/happening-base.component.js +188 -0
  62. package/esm2022/lib/components/happening-base.component.js.map +1 -0
  63. package/esm2022/lib/components/happening-card/happening-card.component.js +69 -0
  64. package/esm2022/lib/components/happening-card/happening-card.component.js.map +1 -0
  65. package/esm2022/lib/components/happening-component-base-params.js +37 -0
  66. package/esm2022/lib/components/happening-component-base-params.js.map +1 -0
  67. package/esm2022/lib/components/happening-form/happening-form.component.js +348 -0
  68. package/esm2022/lib/components/happening-form/happening-form.component.js.map +1 -0
  69. package/esm2022/lib/components/happening-form/happening-price-form/happening-price-modal.component.js +161 -0
  70. package/esm2022/lib/components/happening-form/happening-price-form/happening-price-modal.component.js.map +1 -0
  71. package/esm2022/lib/components/happening-form/happening-prices/happening-prices.component.js +142 -0
  72. package/esm2022/lib/components/happening-form/happening-prices/happening-prices.component.js.map +1 -0
  73. package/esm2022/lib/components/happening-participants/happening-participants.component.js +195 -0
  74. package/esm2022/lib/components/happening-participants/happening-participants.component.js.map +1 -0
  75. package/esm2022/lib/components/happening-slot-form/happening-slot-form.component.js +505 -0
  76. package/esm2022/lib/components/happening-slot-form/happening-slot-form.component.js.map +1 -0
  77. package/esm2022/lib/components/happening-slot-form/happening-slot-modal.component.js +140 -0
  78. package/esm2022/lib/components/happening-slot-form/happening-slot-modal.component.js.map +1 -0
  79. package/esm2022/lib/components/happening-slot-form/happening-slot-modal.service.js +47 -0
  80. package/esm2022/lib/components/happening-slot-form/happening-slot-modal.service.js.map +1 -0
  81. package/esm2022/lib/components/happening-slot-participants/happening-slot-participants.component.js +74 -0
  82. package/esm2022/lib/components/happening-slot-participants/happening-slot-participants.component.js.map +1 -0
  83. package/esm2022/lib/components/happening-slots/happening-slots.component.js +130 -0
  84. package/esm2022/lib/components/happening-slots/happening-slots.component.js.map +1 -0
  85. package/esm2022/lib/components/index.js +20 -0
  86. package/esm2022/lib/components/index.js.map +1 -0
  87. package/esm2022/lib/components/start-end-dates-range-form/start-end-dates-range-form.component.js +68 -0
  88. package/esm2022/lib/components/start-end-dates-range-form/start-end-dates-range-form.component.js.map +1 -0
  89. package/esm2022/lib/components/start-end-datetime-form/start-end-datetime-form.component.js +377 -0
  90. package/esm2022/lib/components/start-end-datetime-form/start-end-datetime-form.component.js.map +1 -0
  91. package/esm2022/lib/components/start-end-datetime-form/time-selector.component.js +92 -0
  92. package/esm2022/lib/components/start-end-datetime-form/time-selector.component.js.map +1 -0
  93. package/esm2022/lib/components/swipeable-base.component.js +112 -0
  94. package/esm2022/lib/components/swipeable-base.component.js.map +1 -0
  95. package/esm2022/lib/components/swipeable-ui.js +64 -0
  96. package/esm2022/lib/components/swipeable-ui.js.map +1 -0
  97. package/esm2022/lib/components/week.js +2 -0
  98. package/esm2022/lib/components/week.js.map +1 -0
  99. package/esm2022/lib/components/weekday-functions.js +13 -0
  100. package/esm2022/lib/components/weekday-functions.js.map +1 -0
  101. package/esm2022/lib/components/weekdays/weekdays-form-base.js +72 -0
  102. package/esm2022/lib/components/weekdays/weekdays-form-base.js.map +1 -0
  103. package/esm2022/lib/index.js +3 -0
  104. package/esm2022/lib/index.js.map +1 -0
  105. package/esm2022/lib/modals/happening-title-modal/happening-title-modal.component.js +87 -0
  106. package/esm2022/lib/modals/happening-title-modal/happening-title-modal.component.js.map +1 -0
  107. package/esm2022/lib/services/calendar-data-provider.js +271 -0
  108. package/esm2022/lib/services/calendar-data-provider.js.map +1 -0
  109. package/esm2022/lib/services/calendar-day.js +179 -0
  110. package/esm2022/lib/services/calendar-day.js.map +1 -0
  111. package/esm2022/lib/services/calendar-day.service.js +37 -0
  112. package/esm2022/lib/services/calendar-day.service.js.map +1 -0
  113. package/esm2022/lib/services/calendar-nav.service.js +36 -0
  114. package/esm2022/lib/services/calendar-nav.service.js.map +1 -0
  115. package/esm2022/lib/services/calendar-space.js +152 -0
  116. package/esm2022/lib/services/calendar-space.js.map +1 -0
  117. package/esm2022/lib/services/calendar-types.js +52 -0
  118. package/esm2022/lib/services/calendar-types.js.map +1 -0
  119. package/esm2022/lib/services/calendarium-services.module.js +16 -0
  120. package/esm2022/lib/services/calendarium-services.module.js.map +1 -0
  121. package/esm2022/lib/services/calendarium-space.service.js +16 -0
  122. package/esm2022/lib/services/calendarium-space.service.js.map +1 -0
  123. package/esm2022/lib/services/happening.service.js +225 -0
  124. package/esm2022/lib/services/happening.service.js.map +1 -0
  125. package/esm2022/lib/services/index.js +6 -0
  126. package/esm2022/lib/services/index.js.map +1 -0
  127. package/esm2022/sneat-extensions-schedulus-shared.js +5 -0
  128. package/esm2022/sneat-extensions-schedulus-shared.js.map +1 -0
  129. package/index.d.ts +1 -0
  130. package/lib/components/calendar/calendar-base.component.d.ts +23 -0
  131. package/lib/components/calendar/calendar-brief.component.d.ts +11 -0
  132. package/lib/components/calendar/calendar-component-types.d.ts +1 -0
  133. package/lib/components/calendar/calendar-state.service.d.ts +15 -0
  134. package/lib/components/calendar/calendar.component.d.ts +32 -0
  135. package/lib/components/calendar/components/calendar-add-buttons/calendar-add-buttons.component.d.ts +13 -0
  136. package/lib/components/calendar/components/calendar-day/calendar-day-base.component.d.ts +10 -0
  137. package/lib/components/calendar/components/calendar-day/calendar-day-card.component.d.ts +17 -0
  138. package/lib/components/calendar/components/calendar-day/calendar-day-tab.component.d.ts +19 -0
  139. package/lib/components/calendar/components/calendar-day/calendar-day-title.component.d.ts +10 -0
  140. package/lib/components/calendar/components/calendar-day/calendar-day.component.d.ts +30 -0
  141. package/lib/components/calendar/components/calendar-filter/calendar-filter.component.d.ts +39 -0
  142. package/lib/components/calendar/components/calendar-filter/calendar-filter.d.ts +10 -0
  143. package/lib/components/calendar/components/calendar-filter/contacts-filter.component.d.ts +20 -0
  144. package/lib/components/calendar/components/calendar-week/calendar-week-card.component.d.ts +15 -0
  145. package/lib/components/calendar/components/calendar-week/calendar-week-tab.component.d.ts +9 -0
  146. package/lib/components/calendar/components/calendar-week/calendar-week-title.component.d.ts +7 -0
  147. package/lib/components/calendar/components/calendar-week/calendar-week.component.d.ts +20 -0
  148. package/lib/components/calendar/components/calendar-weekday/calendar-weekday.component.d.ts +23 -0
  149. package/lib/components/calendar/components/day-slot-item/day-slot-item.component.d.ts +19 -0
  150. package/lib/components/calendar/components/day-slot-item/slot-context-menu.component.d.ts +40 -0
  151. package/lib/components/calendar/components/recurrings-tab/recurrings-tab.component.d.ts +15 -0
  152. package/lib/components/calendar/components/singles-tab/single-happenings-list.component.d.ts +22 -0
  153. package/lib/components/calendar/components/singles-tab/singles-tab.component.d.ts +29 -0
  154. package/lib/components/calendar/components/timing-badge/timing-badge.component.d.ts +17 -0
  155. package/lib/components/calendar/weekday.d.ts +7 -0
  156. package/lib/components/calendar-core.d.ts +10 -0
  157. package/lib/components/calendar-filter.service.d.ts +8 -0
  158. package/lib/components/calendar-slots.d.ts +5 -0
  159. package/lib/components/happening-base.component.d.ts +46 -0
  160. package/lib/components/happening-card/happening-card.component.d.ts +11 -0
  161. package/lib/components/happening-component-base-params.d.ts +16 -0
  162. package/lib/components/happening-form/happening-form.component.d.ts +52 -0
  163. package/lib/components/happening-form/happening-price-form/happening-price-modal.component.d.ts +29 -0
  164. package/lib/components/happening-form/happening-prices/happening-prices.component.d.ts +16 -0
  165. package/lib/components/happening-participants/happening-participants.component.d.ts +24 -0
  166. package/lib/components/happening-slot-form/happening-slot-form.component.d.ts +76 -0
  167. package/lib/components/happening-slot-form/happening-slot-modal.component.d.ts +26 -0
  168. package/lib/components/happening-slot-form/happening-slot-modal.service.d.ts +18 -0
  169. package/lib/components/happening-slot-participants/happening-slot-participants.component.d.ts +19 -0
  170. package/lib/components/happening-slots/happening-slots.component.d.ts +28 -0
  171. package/lib/components/index.d.ts +5 -0
  172. package/lib/components/start-end-dates-range-form/start-end-dates-range-form.component.d.ts +16 -0
  173. package/lib/components/start-end-datetime-form/start-end-datetime-form.component.d.ts +53 -0
  174. package/lib/components/start-end-datetime-form/time-selector.component.d.ts +15 -0
  175. package/lib/components/swipeable-base.component.d.ts +25 -0
  176. package/lib/components/swipeable-ui.d.ts +24 -0
  177. package/lib/components/week.d.ts +4 -0
  178. package/lib/components/weekday-functions.d.ts +3 -0
  179. package/lib/components/weekdays/weekdays-form-base.d.ts +31 -0
  180. package/lib/index.d.ts +2 -0
  181. package/lib/modals/happening-title-modal/happening-title-modal.component.d.ts +24 -0
  182. package/lib/services/calendar-data-provider.d.ts +33 -0
  183. package/lib/services/calendar-day.d.ts +45 -0
  184. package/lib/services/calendar-day.service.d.ts +18 -0
  185. package/lib/services/calendar-nav.service.d.ts +14 -0
  186. package/lib/services/calendar-space.d.ts +23 -0
  187. package/lib/services/calendar-types.d.ts +10 -0
  188. package/lib/services/calendarium-services.module.d.ts +6 -0
  189. package/lib/services/calendarium-space.service.d.ts +8 -0
  190. package/lib/services/happening.service.d.ts +99 -0
  191. package/lib/services/index.d.ts +5 -0
  192. package/package.json +26 -0
  193. package/sneat-extensions-schedulus-shared.d.ts +5 -0
  194. package/tsconfig.lib.prod.tsbuildinfo +1 -0
@@ -0,0 +1,2 @@
1
+ export * from './lib';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../libs/extensions/schedulus/shared/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC","sourcesContent":["export * from './lib';\n"]}
@@ -0,0 +1,83 @@
1
+ import { Directive, Injector, inject, signal, computed, } from '@angular/core';
2
+ import { ContactusSpaceService } from '@sneat/contactus-services';
3
+ import { WithSpaceInput } from '@sneat/space-services';
4
+ import { takeUntil, filter } from 'rxjs';
5
+ import { CalendarDayService } from '../../services/calendar-day.service';
6
+ import { CalendariumSpaceService } from '../../services/calendarium-space.service';
7
+ import { HappeningService } from '../../services/happening.service';
8
+ import { zipMapBriefsWithIDs } from '@sneat/space-models';
9
+ import { CalendarDataProvider } from '../../services/calendar-data-provider';
10
+ import { isToday } from '../calendar-core';
11
+ import * as i0 from "@angular/core";
12
+ const emptyUiState = {};
13
+ export class CalendarBaseComponent extends WithSpaceInput {
14
+ constructor() {
15
+ super();
16
+ this.$date = signal(new Date(), ...(ngDevMode ? [{ debugName: "$date" }] : []));
17
+ this.$isToday = computed(() => isToday(this.$date()), ...(ngDevMode ? [{ debugName: "$isToday" }] : []));
18
+ // private readonly $calendariumSpaceDbo = signal<
19
+ // ICalendariumSpaceDbo | null | undefined
20
+ // >(undefined);
21
+ this.$contactusSpace = signal(undefined, ...(ngDevMode ? [{ debugName: "$contactusSpace" }] : []));
22
+ this.$recurringStates = signal({}, ...(ngDevMode ? [{ debugName: "$recurringStates" }] : []));
23
+ this.$allRecurrings = computed(() => {
24
+ const recurringsBySpaceID = this.spaceDaysProvider.$recurringsBySpaceID();
25
+ if (Object.keys(recurringsBySpaceID).length === 0) {
26
+ return undefined;
27
+ }
28
+ const allRecurrings = [];
29
+ // We are not updating $recurringStates here so there us no circular dependency
30
+ const recurringStates = this.$recurringStates();
31
+ Object.entries(recurringsBySpaceID).forEach(([spaceId, recurringBriefs]) => {
32
+ const spaceRecurrings = zipMapBriefsWithIDs(recurringBriefs || {})?.map((rh) => {
33
+ const { id } = rh;
34
+ const prevState = recurringStates[id + '@' + spaceId];
35
+ const result = {
36
+ id,
37
+ brief: rh.brief,
38
+ state: prevState || emptyUiState,
39
+ space: { id: spaceId },
40
+ };
41
+ return result;
42
+ }) || [];
43
+ allRecurrings.push(...spaceRecurrings);
44
+ });
45
+ return allRecurrings;
46
+ }, ...(ngDevMode ? [{ debugName: "$allRecurrings" }] : []));
47
+ this.injector = inject(Injector);
48
+ this.contactusSpaceService = inject(ContactusSpaceService);
49
+ const calendariumSpaceService = inject(CalendariumSpaceService);
50
+ const happeningService = inject(HappeningService);
51
+ const calendarDayService = inject(CalendarDayService);
52
+ this.spaceDaysProvider = new CalendarDataProvider(this.injector, this.$spaceID, this.errorLogger, happeningService, calendarDayService, calendariumSpaceService);
53
+ this.spaceID$.subscribe({
54
+ next: (spaceID) => {
55
+ if (!spaceID) {
56
+ return;
57
+ }
58
+ this.contactusSpaceService
59
+ .watchSpaceModuleRecord(spaceID)
60
+ .pipe(this.takeUntilDestroyed(), takeUntil(this.spaceID$.pipe(filter((id) => id !== spaceID))))
61
+ .subscribe((contactusSpace) => {
62
+ this.$contactusSpace.set(contactusSpace);
63
+ });
64
+ },
65
+ });
66
+ }
67
+ ngOnDestroy() {
68
+ super.ngOnDestroy();
69
+ this.spaceDaysProvider.destroy();
70
+ }
71
+ setDay(source, d) {
72
+ if (!d) {
73
+ return;
74
+ }
75
+ this.onDayChanged(d);
76
+ }
77
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: CalendarBaseComponent, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
78
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.0", type: CalendarBaseComponent, isStandalone: true, usesInheritance: true, ngImport: i0 }); }
79
+ }
80
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: CalendarBaseComponent, decorators: [{
81
+ type: Directive
82
+ }], ctorParameters: () => [] });
83
+ //# sourceMappingURL=calendar-base.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calendar-base.component.js","sourceRoot":"","sources":["../../../../../../../../../libs/extensions/schedulus/shared/src/lib/components/calendar/calendar-base.component.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAET,QAAQ,EACR,MAAM,EACN,MAAM,EACN,QAAQ,GACT,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAElE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AACnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAEpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;;AAE3C,MAAM,YAAY,GAAY,EAAE,CAAC;AAGjC,MAAM,OAAgB,qBACpB,SAAQ,cAAc;IAqDtB;QACE,KAAK,EAAE,CAAC;QAnDA,UAAK,GAAG,MAAM,CAAC,IAAI,IAAI,EAAE,iDAAC,CAAC;QAClB,aAAQ,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,oDAAC,CAAC;QAEpE,kDAAkD;QAClD,2CAA2C;QAC3C,gBAAgB;QAEA,oBAAe,GAAG,MAAM,CACtC,SAAS,2DACV,CAAC;QAEiB,qBAAgB,GAAG,MAAM,CAE1C,EAAE,4DAAC,CAAC;QAEa,mBAAc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core';\nimport { IContactusSpaceDboAndID } from '@sneat/contactus-core';\nimport { ContactusSpaceService } from '@sneat/contactus-services';\nimport { UiState } from '@sneat/dto';\nimport { WithSpaceInput } from '@sneat/space-services';\nimport { takeUntil, filter } from 'rxjs';\nimport { CalendarDayService } from '../../services/calendar-day.service';\nimport { CalendariumSpaceService } from '../../services/calendarium-space.service';\nimport { HappeningService } from '../../services/happening.service';\nimport { IHappeningWithUiState } from '@sneat/mod-schedulus-core';\nimport { zipMapBriefsWithIDs } from '@sneat/space-models';\nimport { CalendarDataProvider } from '../../services/calendar-data-provider';\nimport { isToday } from '../calendar-core';\n\nconst emptyUiState: UiState = {};\n\n@Directive()\nexport abstract class CalendarBaseComponent\n extends WithSpaceInput\n implements OnDestroy\n{\n protected $date = signal(new Date());\n protected readonly $isToday = computed(() => isToday(this.$date()));\n\n // private readonly $calendariumSpaceDbo = signal<\n // \tICalendariumSpaceDbo | null | undefined\n // >(undefined);\n\n public readonly $contactusSpace = signal<IContactusSpaceDboAndID | undefined>(\n undefined,\n );\n\n protected readonly $recurringStates = signal<\n Readonly<Record<string, UiState>>\n >({});\n\n protected readonly $allRecurrings = computed<\n readonly IHappeningWithUiState[] | undefined\n >(() => {\n const recurringsBySpaceID = this.spaceDaysProvider.$recurringsBySpaceID();\n if (Object.keys(recurringsBySpaceID).length === 0) {\n return undefined;\n }\n const allRecurrings: IHappeningWithUiState[] = [];\n // We are not updating $recurringStates here so there us no circular dependency\n const recurringStates = this.$recurringStates();\n Object.entries(recurringsBySpaceID).forEach(\n ([spaceId, recurringBriefs]) => {\n const spaceRecurrings =\n zipMapBriefsWithIDs(recurringBriefs || {})?.map((rh) => {\n const { id } = rh;\n const prevState = recurringStates[id + '@' + spaceId];\n const result: IHappeningWithUiState = {\n id,\n brief: rh.brief,\n state: prevState || emptyUiState,\n space: { id: spaceId },\n };\n return result;\n }) || [];\n allRecurrings.push(...spaceRecurrings);\n },\n );\n return allRecurrings;\n });\n\n protected readonly spaceDaysProvider: CalendarDataProvider;\n protected readonly injector = inject(Injector);\n\n private readonly contactusSpaceService = inject(ContactusSpaceService);\n\n protected constructor() {\n super();\n const calendariumSpaceService = inject(CalendariumSpaceService);\n const happeningService = inject(HappeningService);\n const calendarDayService = inject(CalendarDayService);\n\n this.spaceDaysProvider = new CalendarDataProvider(\n this.injector,\n this.$spaceID,\n this.errorLogger,\n happeningService,\n calendarDayService,\n calendariumSpaceService,\n );\n this.spaceID$.subscribe({\n next: (spaceID) => {\n if (!spaceID) {\n return;\n }\n\n this.contactusSpaceService\n .watchSpaceModuleRecord(spaceID)\n .pipe(\n this.takeUntilDestroyed(),\n takeUntil(this.spaceID$.pipe(filter((id) => id !== spaceID))),\n )\n .subscribe((contactusSpace) => {\n this.$contactusSpace.set(contactusSpace);\n });\n },\n });\n }\n\n override ngOnDestroy(): void {\n super.ngOnDestroy();\n this.spaceDaysProvider.destroy();\n }\n\n protected setDay(source: string, d: Date): void {\n if (!d) {\n return;\n }\n this.onDayChanged(d);\n }\n\n protected abstract onDayChanged(d: Date): void;\n}\n"]}
@@ -0,0 +1,57 @@
1
+ import { ChangeDetectionStrategy, Component, signal } from '@angular/core';
2
+ import { RouterLink } from '@angular/router';
3
+ import { IonCard, IonIcon, IonItem, IonLabel } from '@ionic/angular/standalone';
4
+ import { ClassName } from '@sneat/ui';
5
+ import { CalendarDayServiceModule } from '../../services/calendar-day.service';
6
+ import { HappeningServiceModule } from '../../services/happening.service';
7
+ import { CalendariumServicesModule } from '../../services/calendarium-services.module';
8
+ import { CalendarFilterService } from '../calendar-filter.service';
9
+ import { createWeekday } from '../weekday-functions';
10
+ import { CalendarBaseComponent } from './calendar-base.component';
11
+ import { CalendarAddButtonsComponent } from './components/calendar-add-buttons/calendar-add-buttons.component';
12
+ import { CalendarDayTitleComponent } from './components/calendar-day/calendar-day-title.component';
13
+ import { CalendarDayComponent } from './components/calendar-day/calendar-day.component';
14
+ import * as i0 from "@angular/core";
15
+ export class CalendarBriefComponent extends CalendarBaseComponent {
16
+ constructor() {
17
+ super();
18
+ this.$today = signal(undefined, ...(ngDevMode ? [{ debugName: "$today" }] : []));
19
+ this.$tomorrow = signal(undefined, ...(ngDevMode ? [{ debugName: "$tomorrow" }] : []));
20
+ const todayDate = new Date();
21
+ const today = createWeekday(todayDate, this.spaceDaysProvider);
22
+ this.$today.set(today);
23
+ const tomorrowDate = new Date();
24
+ tomorrowDate.setDate(todayDate.getDate() + 1);
25
+ const tomorrow = createWeekday(tomorrowDate, this.spaceDaysProvider);
26
+ this.$tomorrow.set(tomorrow);
27
+ }
28
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
29
+ onDayChanged(d) {
30
+ // do nothing
31
+ }
32
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: CalendarBriefComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
33
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.0", type: CalendarBriefComponent, isStandalone: true, selector: "sneat-calendar-brief", providers: [
34
+ CalendarFilterService,
35
+ { provide: ClassName, useValue: 'CalendarBriefComponent' },
36
+ ], usesInheritance: true, ngImport: i0, template: "<ion-card>\n <ion-item\n color=\"divider\"\n tappable=\"true\"\n routerLink=\"./calendar\"\n lines=\"full\"\n class=\"sneat-tiny-end-padding\"\n >\n <ion-icon name=\"calendar-outline\" slot=\"start\" color=\"primary\"></ion-icon>\n <ion-label style=\"font-weight: bold\" color=\"primary\">Calendar</ion-label>\n <sneat-calendar-add-buttons\n [$space]=\"$space()\"\n [dateID]=\"undefined\"\n [weekdayID]=\"undefined\"\n />\n </ion-item>\n\n <ion-item color=\"light\" lines=\"full\" class=\"sneat-tiny-end-padding\">\n <ion-label color=\"medium\">\n <sneat-calendar-day-title [weekday]=\"$today()\" />\n </ion-label>\n <sneat-calendar-add-buttons\n [$space]=\"$space()\"\n [dateID]=\"$today()?.day?.dateID\"\n [weekdayID]=\"$today()?.id\"\n />\n </ion-item>\n <sneat-calendar-day\n [$space]=\"$space()\"\n [$weekday]=\"$today()\"\n [hideAddButtons]=\"true\"\n />\n <ion-item color=\"light\" lines=\"full\" class=\"sneat-tiny-end-padding\">\n <ion-label color=\"medium\">\n <sneat-calendar-day-title [weekday]=\"$tomorrow()\" />\n </ion-label>\n <sneat-calendar-add-buttons\n [$space]=\"$space()\"\n [dateID]=\"$tomorrow()?.day?.dateID\"\n [weekdayID]=\"$tomorrow()?.id\"\n />\n </ion-item>\n <sneat-calendar-day\n [$space]=\"$space()\"\n [$weekday]=\"$tomorrow()\"\n [hideAddButtons]=\"true\"\n [hideLastBorder]=\"true\"\n />\n</ion-card>\n", dependencies: [{ kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "component", type: CalendarAddButtonsComponent, selector: "sneat-calendar-add-buttons", inputs: ["dateID", "weekdayID"] }, { kind: "ngmodule", type: CalendariumServicesModule }, { kind: "component", type: CalendarDayTitleComponent, selector: "sneat-calendar-day-title", inputs: ["weekday"] }, { kind: "ngmodule", type: HappeningServiceModule }, { kind: "ngmodule", type: CalendarDayServiceModule }, { kind: "component", type: CalendarDayComponent, selector: "sneat-calendar-day", inputs: ["$weekday", "hideAddButtons", "hideLastBorder"] }, { kind: "component", type: IonCard, selector: "ion-card", inputs: ["button", "color", "disabled", "download", "href", "mode", "rel", "routerAnimation", "routerDirection", "target", "type"] }, { kind: "component", type: IonItem, selector: "ion-item", inputs: ["button", "color", "detail", "detailIcon", "disabled", "download", "href", "lines", "mode", "rel", "routerAnimation", "routerDirection", "target", "type"] }, { kind: "component", type: IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }, { kind: "component", type: IonLabel, selector: "ion-label", inputs: ["color", "mode", "position"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
37
+ }
38
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: CalendarBriefComponent, decorators: [{
39
+ type: Component,
40
+ args: [{ imports: [
41
+ RouterLink,
42
+ CalendarAddButtonsComponent,
43
+ CalendariumServicesModule,
44
+ CalendarDayTitleComponent,
45
+ HappeningServiceModule,
46
+ CalendarDayServiceModule,
47
+ CalendarDayComponent,
48
+ IonCard,
49
+ IonItem,
50
+ IonIcon,
51
+ IonLabel,
52
+ ], providers: [
53
+ CalendarFilterService,
54
+ { provide: ClassName, useValue: 'CalendarBriefComponent' },
55
+ ], changeDetection: ChangeDetectionStrategy.OnPush, selector: 'sneat-calendar-brief', template: "<ion-card>\n <ion-item\n color=\"divider\"\n tappable=\"true\"\n routerLink=\"./calendar\"\n lines=\"full\"\n class=\"sneat-tiny-end-padding\"\n >\n <ion-icon name=\"calendar-outline\" slot=\"start\" color=\"primary\"></ion-icon>\n <ion-label style=\"font-weight: bold\" color=\"primary\">Calendar</ion-label>\n <sneat-calendar-add-buttons\n [$space]=\"$space()\"\n [dateID]=\"undefined\"\n [weekdayID]=\"undefined\"\n />\n </ion-item>\n\n <ion-item color=\"light\" lines=\"full\" class=\"sneat-tiny-end-padding\">\n <ion-label color=\"medium\">\n <sneat-calendar-day-title [weekday]=\"$today()\" />\n </ion-label>\n <sneat-calendar-add-buttons\n [$space]=\"$space()\"\n [dateID]=\"$today()?.day?.dateID\"\n [weekdayID]=\"$today()?.id\"\n />\n </ion-item>\n <sneat-calendar-day\n [$space]=\"$space()\"\n [$weekday]=\"$today()\"\n [hideAddButtons]=\"true\"\n />\n <ion-item color=\"light\" lines=\"full\" class=\"sneat-tiny-end-padding\">\n <ion-label color=\"medium\">\n <sneat-calendar-day-title [weekday]=\"$tomorrow()\" />\n </ion-label>\n <sneat-calendar-add-buttons\n [$space]=\"$space()\"\n [dateID]=\"$tomorrow()?.day?.dateID\"\n [weekdayID]=\"$tomorrow()?.id\"\n />\n </ion-item>\n <sneat-calendar-day\n [$space]=\"$space()\"\n [$weekday]=\"$tomorrow()\"\n [hideAddButtons]=\"true\"\n [hideLastBorder]=\"true\"\n />\n</ion-card>\n" }]
56
+ }], ctorParameters: () => [] });
57
+ //# sourceMappingURL=calendar-brief.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calendar-brief.component.js","sourceRoot":"","sources":["../../../../../../../../../libs/extensions/schedulus/shared/src/lib/components/calendar/calendar-brief.component.ts","../../../../../../../../../libs/extensions/schedulus/shared/src/lib/components/calendar/calendar-brief.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAC/E,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,EAAE,yBAAyB,EAAE,MAAM,4CAA4C,CAAC;AACvF,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,2BAA2B,EAAE,MAAM,kEAAkE,CAAC;AAC/G,OAAO,EAAE,yBAAyB,EAAE,MAAM,wDAAwD,CAAC;AACnG,OAAO,EAAE,oBAAoB,EAAE,MAAM,kDAAkD,CAAC;;AAyBxF,MAAM,OAAO,sBAAuB,SAAQ,qBAAqB;IAI/D;QACE,KAAK,EAAE,CAAC;QAJS,WAAM,GAAG,MAAM,CAAsB,SAAS,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AAsB","sourcesContent":["import { ChangeDetectionStrategy, Component, signal } from '@angular/core';\nimport { RouterLink } from '@angular/router';\nimport { IonCard, IonIcon, IonItem, IonLabel } from '@ionic/angular/standalone';\nimport { ClassName } from '@sneat/ui';\nimport { CalendarDayServiceModule } from '../../services/calendar-day.service';\nimport { HappeningServiceModule } from '../../services/happening.service';\nimport { CalendariumServicesModule } from '../../services/calendarium-services.module';\nimport { CalendarFilterService } from '../calendar-filter.service';\nimport { createWeekday } from '../weekday-functions';\nimport { CalendarBaseComponent } from './calendar-base.component';\nimport { CalendarAddButtonsComponent } from './components/calendar-add-buttons/calendar-add-buttons.component';\nimport { CalendarDayTitleComponent } from './components/calendar-day/calendar-day-title.component';\nimport { CalendarDayComponent } from './components/calendar-day/calendar-day.component';\nimport { Weekday } from './weekday';\n\n@Component({\n imports: [\n RouterLink,\n CalendarAddButtonsComponent,\n CalendariumServicesModule,\n CalendarDayTitleComponent,\n HappeningServiceModule,\n CalendarDayServiceModule,\n CalendarDayComponent,\n IonCard,\n IonItem,\n IonIcon,\n IonLabel,\n ],\n providers: [\n CalendarFilterService,\n { provide: ClassName, useValue: 'CalendarBriefComponent' },\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n selector: 'sneat-calendar-brief',\n templateUrl: './calendar-brief.component.html',\n})\nexport class CalendarBriefComponent extends CalendarBaseComponent {\n protected readonly $today = signal<Weekday | undefined>(undefined);\n protected readonly $tomorrow = signal<Weekday | undefined>(undefined);\n\n public constructor() {\n super();\n\n const todayDate = new Date();\n const today = createWeekday(todayDate, this.spaceDaysProvider);\n this.$today.set(today);\n\n const tomorrowDate = new Date();\n tomorrowDate.setDate(todayDate.getDate() + 1);\n const tomorrow = createWeekday(tomorrowDate, this.spaceDaysProvider);\n this.$tomorrow.set(tomorrow);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n protected onDayChanged(d: Date): void {\n // do nothing\n }\n}\n","<ion-card>\n <ion-item\n color=\"divider\"\n tappable=\"true\"\n routerLink=\"./calendar\"\n lines=\"full\"\n class=\"sneat-tiny-end-padding\"\n >\n <ion-icon name=\"calendar-outline\" slot=\"start\" color=\"primary\"></ion-icon>\n <ion-label style=\"font-weight: bold\" color=\"primary\">Calendar</ion-label>\n <sneat-calendar-add-buttons\n [$space]=\"$space()\"\n [dateID]=\"undefined\"\n [weekdayID]=\"undefined\"\n />\n </ion-item>\n\n <ion-item color=\"light\" lines=\"full\" class=\"sneat-tiny-end-padding\">\n <ion-label color=\"medium\">\n <sneat-calendar-day-title [weekday]=\"$today()\" />\n </ion-label>\n <sneat-calendar-add-buttons\n [$space]=\"$space()\"\n [dateID]=\"$today()?.day?.dateID\"\n [weekdayID]=\"$today()?.id\"\n />\n </ion-item>\n <sneat-calendar-day\n [$space]=\"$space()\"\n [$weekday]=\"$today()\"\n [hideAddButtons]=\"true\"\n />\n <ion-item color=\"light\" lines=\"full\" class=\"sneat-tiny-end-padding\">\n <ion-label color=\"medium\">\n <sneat-calendar-day-title [weekday]=\"$tomorrow()\" />\n </ion-label>\n <sneat-calendar-add-buttons\n [$space]=\"$space()\"\n [dateID]=\"$tomorrow()?.day?.dateID\"\n [weekdayID]=\"$tomorrow()?.id\"\n />\n </ion-item>\n <sneat-calendar-day\n [$space]=\"$space()\"\n [$weekday]=\"$tomorrow()\"\n [hideAddButtons]=\"true\"\n [hideLastBorder]=\"true\"\n />\n</ion-card>\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=calendar-component-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calendar-component-types.js","sourceRoot":"","sources":["../../../../../../../../../libs/extensions/schedulus/shared/src/lib/components/calendar/calendar-component-types.ts"],"names":[],"mappings":"","sourcesContent":["export type CalendarTab = 'day' | 'week' | 'recurrings' | 'singles';\n"]}
@@ -0,0 +1,90 @@
1
+ import { BehaviorSubject } from 'rxjs';
2
+ function diffInDays(date1, date2) {
3
+ const timeDiff = date1.getTime() - date2.getTime();
4
+ return timeDiff / (1000 * 3600 * 24);
5
+ }
6
+ export function getToday() {
7
+ const d = new Date();
8
+ d.setHours(0, 0, 0, 0);
9
+ return d;
10
+ }
11
+ export function addDays(d, daysToAdd) {
12
+ return daysToAdd
13
+ ? new Date(d.getFullYear(), d.getMonth(), d.getDate() + daysToAdd)
14
+ : d;
15
+ }
16
+ export class CalendarStateService {
17
+ constructor() {
18
+ this.date = getToday();
19
+ this.dateChanged$ = new BehaviorSubject({
20
+ date: this.date,
21
+ shiftDirection: '',
22
+ });
23
+ this.dateChanged = this.dateChanged$.asObservable();
24
+ // console.log('ScheduleStateService.constructor()');
25
+ }
26
+ shiftDays(shiftDays) {
27
+ // console.log('ScheduleStateService.shiftDays()', shiftDays);
28
+ const date = addDays(this.date, shiftDays);
29
+ this.setActiveDate(date);
30
+ return date;
31
+ }
32
+ setActiveDate(date) {
33
+ date.setHours(0, 0, 0, 0);
34
+ const dayDifference = diffInDays(date, this.date);
35
+ const shiftDirection = dayDifference == 0 ? '' : dayDifference > 0 ? 'forward' : 'back';
36
+ this.date = date;
37
+ this.dateChanged$.next({ date, shiftDirection });
38
+ }
39
+ // changeDay(shiftDays: number): void {
40
+ // const d = this.date;
41
+ // console.log(`changeDay(${shiftDays}) => segment=${this.tab}, activeDay.date:`, d);
42
+ // if (!d) {
43
+ // throw new Error('!this.activeDay.date');
44
+ // }
45
+ // switch (this.tab) {
46
+ // case 'day':
47
+ // this.activeDayParity = this.activeDayParity === 'odd' ? 'even' : 'odd';
48
+ // this.dayAnimationState = animationState(this.activeDayParity, shiftDays);
49
+ // break;
50
+ // case 'week':
51
+ // this.activeWeekParity = this.activeWeekParity === 'odd' ? 'even' : 'odd';
52
+ // this.weekAnimationState = animationState(this.activeWeekParity, shiftDays);
53
+ // break;
54
+ // default:
55
+ // return;
56
+ // }
57
+ // this.setDay('changeDay', new Date(d.getFullYear(), d.getMonth(), d.getDate() + shiftDays));
58
+ // }
59
+ setToday() {
60
+ // console.log('ScheduleComponent.setToday()');
61
+ this.setActiveDate(getToday());
62
+ // if (!this.activeDay.date) {
63
+ // this.errorLogger.logError('!this.activeDay.date');
64
+ // return;
65
+ // }
66
+ // const activeTime = this.activeDay.date.getTime();
67
+ // switch (this.tab) {
68
+ // case 'day':
69
+ // this.activeDayParity = this.activeDayParity === 'odd' ? 'even' : 'odd';
70
+ // if (today.getTime() > activeTime) {
71
+ // this.dayAnimationState = animationState(this.activeDayParity, +1);
72
+ // } else if (today.getTime() < activeTime) {
73
+ // this.dayAnimationState = animationState(this.activeDayParity, -1);
74
+ // }
75
+ // break;
76
+ // case 'week':
77
+ // this.activeWeekParity = this.activeWeekParity === 'odd' ? 'even' : 'odd';
78
+ // if (today.getTime() > activeTime) {
79
+ // this.weekAnimationState = animationState(this.activeWeekParity, +1);
80
+ // } else if (today.getTime() < activeTime) {
81
+ // this.weekAnimationState = animationState(this.activeWeekParity, -1);
82
+ // }
83
+ // break;
84
+ // default:
85
+ // break;
86
+ // }
87
+ // this.setDay('today', today);
88
+ }
89
+ }
90
+ //# sourceMappingURL=calendar-state.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calendar-state.service.js","sourceRoot":"","sources":["../../../../../../../../../libs/extensions/schedulus/shared/src/lib/components/calendar/calendar-state.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AAOvC,SAAS,UAAU,CAAC,KAAW,EAAE,KAAW;IAC1C,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,EAAE,GAAG,KAAK,CAAC,OAAO,EAAE,CAAC;IACnD,OAAO,QAAQ,GAAG,CAAC,IAAI,GAAG,IAAI,GAAG,EAAE,CAAC,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,QAAQ;IACtB,MAAM,CAAC,GAAG,IAAI,IAAI,EAAE,CAAC;IACrB,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IACvB,OAAO,CAAC,C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uC;IACvC,wBAAwB;IACxB,sFAAsF;IACtF,aAAa;IACb,6CAA6C;IAC7C,KAAK;IACL,uBAAuB;IACvB,gBAAgB;IAChB,6EAA6E;IAC7E,+EAA+E;IAC/E,YAAY;IACZ,iBAAiB;IACjB,+EAA+E;IAC/E,iFAAiF;IACjF,YAAY;IACZ,aAAa;IACb,aAAa;IACb,KAAK;IACL,+FAA+F;IAC/F,IAAI;IAEJ,QAAQ;QACN,+CAA+C;QAC/C,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC/B,8BAA8B;QAC9B,sDAAsD;QACtD,WAAW;QACX,IAAI;QACJ,oDAAoD;QACpD,sBAAsB;QACtB,eAAe;QACf,4EAA4E;QAC5E,wCAAwC;QACxC,wEAAwE;QACxE,+CAA+C;QAC/C,wEAAwE;QACxE,MAAM;QACN,WAAW;QACX,gBAAgB;QAChB,8EAA8E;QAC9E,wCAAwC;QACxC,0EAA0E;QAC1E,+CAA+C;QAC/C,0EAA0E;QAC1E,MAAM;QACN,WAAW;QACX,YAAY;QACZ,WAAW;QACX,IAAI;QACJ,+BAA+B;IACjC,CAAC;CACF","sourcesContent":["import { BehaviorSubject } from 'rxjs';\n\nexport interface IDateChanged {\n readonly date: Date;\n readonly shiftDirection: '' | 'back' | 'forward';\n}\n\nfunction diffInDays(date1: Date, date2: Date): number {\n const timeDiff = date1.getTime() - date2.getTime();\n return timeDiff / (1000 * 3600 * 24);\n}\n\nexport function getToday(): Date {\n const d = new Date();\n d.setHours(0, 0, 0, 0);\n return d;\n}\n\nexport function addDays(d: Date, daysToAdd: number): Date {\n return daysToAdd\n ? new Date(d.getFullYear(), d.getMonth(), d.getDate() + daysToAdd)\n : d;\n}\n\nexport class CalendarStateService {\n private date = getToday();\n private readonly dateChanged$ = new BehaviorSubject<IDateChanged>({\n date: this.date,\n shiftDirection: '',\n });\n public readonly dateChanged = this.dateChanged$.asObservable();\n\n constructor() {\n // console.log('ScheduleStateService.constructor()');\n }\n\n public shiftDays(shiftDays: number): Date {\n // console.log('ScheduleStateService.shiftDays()', shiftDays);\n const date = addDays(this.date, shiftDays);\n this.setActiveDate(date);\n return date;\n }\n\n public setActiveDate(date: Date): void {\n date.setHours(0, 0, 0, 0);\n const dayDifference = diffInDays(date, this.date);\n const shiftDirection =\n dayDifference == 0 ? '' : dayDifference > 0 ? 'forward' : 'back';\n this.date = date;\n this.dateChanged$.next({ date, shiftDirection });\n }\n\n // changeDay(shiftDays: number): void {\n // \tconst d = this.date;\n // \tconsole.log(`changeDay(${shiftDays}) => segment=${this.tab}, activeDay.date:`, d);\n // \tif (!d) {\n // \t\tthrow new Error('!this.activeDay.date');\n // \t}\n // \tswitch (this.tab) {\n // \t\tcase 'day':\n // \t\t\tthis.activeDayParity = this.activeDayParity === 'odd' ? 'even' : 'odd';\n // \t\t\tthis.dayAnimationState = animationState(this.activeDayParity, shiftDays);\n // \t\t\tbreak;\n // \t\tcase 'week':\n // \t\t\tthis.activeWeekParity = this.activeWeekParity === 'odd' ? 'even' : 'odd';\n // \t\t\tthis.weekAnimationState = animationState(this.activeWeekParity, shiftDays);\n // \t\t\tbreak;\n // \t\tdefault:\n // \t\t\treturn;\n // \t}\n // \tthis.setDay('changeDay', new Date(d.getFullYear(), d.getMonth(), d.getDate() + shiftDays));\n // }\n\n setToday(): void {\n // console.log('ScheduleComponent.setToday()');\n this.setActiveDate(getToday());\n // if (!this.activeDay.date) {\n // \tthis.errorLogger.logError('!this.activeDay.date');\n // \treturn;\n // }\n // const activeTime = this.activeDay.date.getTime();\n // switch (this.tab) {\n // \tcase 'day':\n // \t\tthis.activeDayParity = this.activeDayParity === 'odd' ? 'even' : 'odd';\n // \t\tif (today.getTime() > activeTime) {\n // \t\t\tthis.dayAnimationState = animationState(this.activeDayParity, +1);\n // \t\t} else if (today.getTime() < activeTime) {\n // \t\t\tthis.dayAnimationState = animationState(this.activeDayParity, -1);\n // \t\t}\n // \t\tbreak;\n // \tcase 'week':\n // \t\tthis.activeWeekParity = this.activeWeekParity === 'odd' ? 'even' : 'odd';\n // \t\tif (today.getTime() > activeTime) {\n // \t\t\tthis.weekAnimationState = animationState(this.activeWeekParity, +1);\n // \t\t} else if (today.getTime() < activeTime) {\n // \t\t\tthis.weekAnimationState = animationState(this.activeWeekParity, -1);\n // \t\t}\n // \t\tbreak;\n // \tdefault:\n // \t\tbreak;\n // }\n // this.setDay('today', today);\n }\n}\n"]}
@@ -0,0 +1,284 @@
1
+ import { ChangeDetectionStrategy, Component, computed, EventEmitter, Input, Output, signal, ViewChild, inject, } from '@angular/core';
2
+ import { FormsModule } from '@angular/forms';
3
+ import { IonLabel, IonSegment, IonSegmentButton, } from '@ionic/angular/standalone';
4
+ import { ContactusSpaceService } from '@sneat/contactus-services';
5
+ import { localDateToIso } from '@sneat/core';
6
+ import { ClassName } from '@sneat/ui';
7
+ import { takeUntil } from 'rxjs';
8
+ import { CalendarDayServiceModule } from '../../services/calendar-day.service';
9
+ import { CalendariumSpaceService } from '../../services/calendarium-space.service';
10
+ import { emptyCalendarFilter, CalendarFilterService, } from '../calendar-filter.service';
11
+ import { hasContact } from '../calendar-slots';
12
+ import { CalendarBaseComponent } from './calendar-base.component';
13
+ import { CalendarDayTabComponent } from './components/calendar-day/calendar-day-tab.component';
14
+ import { CalendarFilterComponent } from './components/calendar-filter/calendar-filter.component';
15
+ import { CalendarStateService } from './calendar-state.service';
16
+ import { CalendarWeekTabComponent } from './components/calendar-week/calendar-week-tab.component';
17
+ import { RecurringsTabComponent } from './components/recurrings-tab/recurrings-tab.component';
18
+ import { SinglesTabComponent } from './components/singles-tab/singles-tab.component';
19
+ import * as i0 from "@angular/core";
20
+ import * as i1 from "@angular/forms";
21
+ export class CalendarComponent extends CalendarBaseComponent {
22
+ constructor() {
23
+ super();
24
+ this.filterService = inject(CalendarFilterService);
25
+ this.calendarStateService = inject(CalendarStateService);
26
+ this.$filter = signal(emptyCalendarFilter, ...(ngDevMode ? [{ debugName: "$filter" }] : []));
27
+ this.tab = 'day';
28
+ this.tabChanged = new EventEmitter();
29
+ this.dateChanged = new EventEmitter();
30
+ this.$isWeekTabActivated = signal(false, ...(ngDevMode ? [{ debugName: "$isWeekTabActivated" }] : []));
31
+ this.$recurrings = computed(() => this.filterRecurrings(this.$filter(), this.$allRecurrings()), ...(ngDevMode ? [{ debugName: "$recurrings" }] : []));
32
+ // readonly goNewHappening = (params: NewHappeningParams): void => {
33
+ // const { type, wd, date } = params;
34
+ //
35
+ // const state: { type?: HappeningType; date?: string; wd?: WeekdayCode2 } = { type };
36
+ //
37
+ // if (date) {
38
+ // // tslint:disable-next-line:no-non-null-assertion
39
+ // state.date = date;
40
+ // } else if (wd) {
41
+ // state.wd = wd;
42
+ // } else if (this.tab === 'day') {
43
+ // state.date = dateToIso(this.date);
44
+ // }
45
+ // if (!this.team) {
46
+ // this.errorLogger.logError('!this.team');
47
+ // return;
48
+ // }
49
+ // this.params.teamNavService
50
+ // .navigateForwardToSpacePage(this.space, 'new-happening', {
51
+ // queryParams: params,
52
+ // })
53
+ // .catch(this.errorLogger.logErrorHandler('failed to navigate to new happening page'));
54
+ // };
55
+ this.onDateSelected = (date) => {
56
+ this.tab = 'day';
57
+ this.setDay('onDateSelected', date);
58
+ };
59
+ // setTimeout(() => {
60
+ // // TODO: Fix this dirty workaround for initial animations
61
+ // this.setToday();
62
+ // }, 10);
63
+ }
64
+ ngOnInit() {
65
+ this.filterService.filter.pipe(takeUntil(this.destroyed$)).subscribe({
66
+ next: (filter) => {
67
+ this.$filter.set(filter);
68
+ },
69
+ error: this.errorLogger.logErrorHandler('failed to get calendar filter'),
70
+ });
71
+ this.calendarStateService.dateChanged.subscribe({
72
+ next: (changed) => {
73
+ const { date } = changed;
74
+ this.$date.set(date);
75
+ },
76
+ });
77
+ setTimeout(() => this.$isWeekTabActivated.set(true), 500);
78
+ }
79
+ ngAfterViewInit() {
80
+ this.tabChanged.emit(this.tab);
81
+ }
82
+ segmentChanged(_event) {
83
+ this.$isWeekTabActivated.set(true);
84
+ history.replaceState(history.state, document.title, window.location.href.replace(/tab=\w+/, `tab=${this.tab}`));
85
+ switch (this.tab) {
86
+ case 'week':
87
+ // if (this.activeDay.date) {
88
+ // this.setDay('segmentChanged', this.activeDay.date);
89
+ // } else {
90
+ // throw new Error('activeDay has no date');
91
+ // }
92
+ break;
93
+ case 'singles':
94
+ // this.slotsProvider.loadTodayAndFutureEvents(undefined)
95
+ // .subscribe({
96
+ // error: this.errorLogger.logError,
97
+ // next: events => {
98
+ // const slotGroupsByDate: { [dateKey: string]: SlotsGroup } = {};
99
+ // events.forEach(event => {
100
+ // const eventStartDate = new Date(event.dtStarts);
101
+ // const dateKey = localDateToIso(eventStartDate);
102
+ // let slotGroup = slotGroupsByDate[dateKey];
103
+ // if (!slotGroup) {
104
+ // const wd = 'we'; // TODO: why Wednesday?
105
+ // slotGroupsByDate[dateKey] = slotGroup = {
106
+ // wd,
107
+ // date: eventStartDate,
108
+ // title: wdCodeToWeekdayName(wd),
109
+ // slots: [],
110
+ // };
111
+ // }
112
+ // slotGroup.slots.push(eventToSlot(event));
113
+ // });
114
+ // this.todayAndFutureEvents = Object.values(slotGroupsByDate);
115
+ // },
116
+ // });
117
+ break;
118
+ default:
119
+ break;
120
+ }
121
+ }
122
+ // get inactiveDay(): Day {
123
+ // return this.activeDayParity === 'odd' ? this.evenDay : this.oddDay;
124
+ // }
125
+ // noinspection JSMethodCanBeStatic
126
+ // noinspection JSMethodCanBqw2se3333eStatic
127
+ ngOnChanges(changes) {
128
+ if (changes['tab'] && this.tab === 'week') {
129
+ this.$isWeekTabActivated.set(true);
130
+ }
131
+ }
132
+ // We filter recurring at calendar level, so we can share it across different components?
133
+ filterRecurrings(filter, allRecurring) {
134
+ const text = filter.text.toLowerCase();
135
+ const filtered = allRecurring?.filter((r) => {
136
+ const title = r.brief?.title || r.dbo?.title;
137
+ let hide = '';
138
+ if (!hide && title && !title.trim().toLowerCase().includes(text)) {
139
+ hide = 'title';
140
+ }
141
+ if (!hide &&
142
+ (!r.brief ||
143
+ !hasContact(r.space.id, filter.contactIDs, r.brief.related))) {
144
+ hide = 'contactIDs';
145
+ }
146
+ const slots = r.dbo?.slots || r.brief?.slots;
147
+ if (!hide && !this.hasWeekday(slots, filter.weekdays)) {
148
+ hide = 'weekdays';
149
+ }
150
+ if (!hide && !this.hasRepeats(filter.repeats, slots)) {
151
+ hide = 'repeats';
152
+ }
153
+ return !hide;
154
+ });
155
+ return filtered;
156
+ }
157
+ // noinspection JSMethodCanBeStatic
158
+ hasRepeats(repeats, slots) {
159
+ return (!repeats.length ||
160
+ (!!slots &&
161
+ Object.values(slots).some((slot) => repeats.includes(slot.repeats))));
162
+ }
163
+ hasWeekday(slots, weekdays) {
164
+ return (!weekdays.length ||
165
+ (!!slots &&
166
+ Object.values(slots).some((slot) => slot.weekdays?.some((wd) => weekdays.includes(wd)))));
167
+ }
168
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
169
+ onDayChanged(d) {
170
+ this.changeBrowserURL();
171
+ // this.setSlidesAnimationState();
172
+ //
173
+ // this.activeDay.changeDate(d);
174
+ //
175
+ // this.activeWeek.activeDate = d;
176
+ // const { tab } = this;
177
+ // const activeWd = jsDayToWeekday(d.getDay() as wdNumber);
178
+ // const datesToPreload: Date[] = [];
179
+ // const datesToLoad: Day[] = [];
180
+ // activeWeek.weekdays.forEach((weekday) => {
181
+ // const weekdayDate = getWdDate(weekday.wd, activeWd, d);
182
+ // if (!weekday.date || weekday.date.getTime() !== weekdayDate.getTime() || !weekday.slots) {
183
+ // // console.log('weekday.date !== weekdayDate', weekday.date, weekdayDate);
184
+ // weekday = { ...weekday, date: weekdayDate };
185
+ // if (tab === 'week' || tab === 'day' && weekday.wd === activeWd) {
186
+ // datesToLoad.push(weekday);
187
+ // // tslint:disable-next-line:no-magic-numbers
188
+ // const diff = tab === 'day' ? SHIFT_1_DAY : SHIFT_1_WEEK;
189
+ // const wdDate = weekday.date;
190
+ // if (wdDate) {
191
+ // datesToPreload.push(new Date(wdDate.getFullYear(), wdDate.getMonth(), wdDate.getDate() + diff));
192
+ // datesToPreload.push(new Date(wdDate.getFullYear(), wdDate.getMonth(), wdDate.getDate() - diff));
193
+ // }
194
+ // if (tab === 'day') {
195
+ // const activeWeekDaysToPreload = activeWeek.weekdays
196
+ // .filter(wd =>
197
+ // !wd.date ||
198
+ // // tslint:disable-next-line:no-non-null-assertion
199
+ // !datesToPreload.some(dtp => dtp.getTime() === wd.date?.getTime()));
200
+ // activeWeekDaysToPreload.forEach(wd => {
201
+ // if (!wd.date) {
202
+ // // wd.date = weekdayDate;
203
+ // // this.errorLogger.logError('not implemented yet: !wd.date');
204
+ // console.error('not implemented yet: !wd.date');
205
+ // } else {
206
+ // datesToPreload.push(wd.date);
207
+ // }
208
+ // });
209
+ // }
210
+ // }
211
+ // }
212
+ // if (weekday.wd === activeWd) {
213
+ // this.activeDay.weekday = weekday;
214
+ // }
215
+ // });
216
+ //
217
+ // console.log(`segment=${tab}, datesToPreload:`, datesToPreload);
218
+ // if (this.team) {
219
+ // this.slotsProvider.getDays(...datesToLoad)
220
+ // .pipe(
221
+ // takeUntil(this.destroyed),
222
+ // )
223
+ // .subscribe({
224
+ // error: this.errorLogger.logErrorHandler('failed to get days'),
225
+ // });
226
+ // }
227
+ // this.slotsProvider.preloadEvents(tx, ...datesToPreload),
228
+ }
229
+ changeBrowserURL() {
230
+ if (this.$isToday()) {
231
+ history.replaceState(history.state, document.title, window.location.href.replace(/&date=\d{4}-\d{2}-\d{2}/, ''));
232
+ }
233
+ else {
234
+ const isoDate = `&date=${localDateToIso(this.$date())}`;
235
+ if (!window.location.href.includes('&date')) {
236
+ history.replaceState(history.state, document.title, window.location.href + isoDate);
237
+ }
238
+ else {
239
+ history.replaceState(history.state, document.title, window.location.href.replace(/&date=\d{4}-\d{2}-\d{2}/, isoDate));
240
+ }
241
+ }
242
+ }
243
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: CalendarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
244
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.0", type: CalendarComponent, isStandalone: true, selector: "sneat-calendar", inputs: { member: "member", tab: "tab" }, outputs: { tabChanged: "tabChanged", dateChanged: "dateChanged" }, providers: [
245
+ { provide: ClassName, useValue: 'CalendarComponent' },
246
+ CalendarFilterService,
247
+ CalendarStateService,
248
+ CalendariumSpaceService,
249
+ ContactusSpaceService,
250
+ ], viewQueries: [{ propertyName: "calendarFilterComponent", first: true, predicate: ["calendarFilterComponent"], descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<ion-segment [(ngModel)]=\"tab\" (ionChange)=\"segmentChanged($event)\">\n <ion-segment-button value=\"day\">\n <ion-label class=\"smaller\">\uD83D\uDCC5 Day</ion-label>\n </ion-segment-button>\n <ion-segment-button value=\"week\">\n <ion-label class=\"smaller\">\uD83D\uDDD3\uFE0F Week</ion-label>\n </ion-segment-button>\n <ion-segment-button value=\"recurrings\">\n <ion-label class=\"smaller\">\uD83D\uDD01 Repeats</ion-label>\n </ion-segment-button>\n <ion-segment-button value=\"singles\">\n <ion-label class=\"smaller\">1\uFE0F\u20E3-timers</ion-label>\n </ion-segment-button>\n</ion-segment>\n\n<sneat-calendar-filter\n #calendarFilterComponent\n [space]=\"$space()\"\n [showWeekdays]=\"tab === 'recurrings'\"\n [showRepeats]=\"tab === 'recurrings'\"\n/>\n\n<!--\nWe use style.display instead of *ngIf to avoid re-creating of the component on tab re-activation.\nThis is just a small performance optimization.\n-->\n<sneat-day-tab\n [style.display]=\"tab === 'day' ? 'block' : 'none'\"\n [$space]=\"$space()\"\n [$spaceDaysProvider]=\"spaceDaysProvider\"\n/>\n\n<!--\nWe use *ngIf instead of [style.display] to avoid rendering of the tab when it's not visible.\nThis is due to weird bug that affects user service onSnapshot not retuning user data\nwhen we have more than 1 week components (odd/event for slider).\nThis is probably due to the fact that we open 14 listeners (1 for each day of 2 weeks) and Firestore is not able to handle that many listeners?\n\n[style.display]=\"tab === 'week' ? 'block' : 'none'\"\n-->\n@if ($isWeekTabActivated()) {\n <sneat-week-tab\n [style.display]=\"tab === 'week' ? 'block' : 'none'\"\n [$space]=\"$space()\"\n [$spaceDaysProvider]=\"spaceDaysProvider\"\n />\n}\n\n@switch (tab) {\n @case (\"recurrings\") {\n <sneat-recurrings-tab\n [$space]=\"$space()\"\n [$recurrings]=\"$recurrings()\"\n [$allRecurrings]=\"$allRecurrings()\"\n [$contactusSpace]=\"$contactusSpace()\"\n />\n }\n @case (\"singles\") {\n <sneat-singles-tab\n [$space]=\"$space()\"\n [onDateSelected]=\"onDateSelected\"\n [$contactusSpace]=\"$contactusSpace()\"\n />\n }\n}\n", styles: ["ion-segment-button .smaller{font-size:smaller}\n"], dependencies: [{ kind: "component", type: SinglesTabComponent, selector: "sneat-singles-tab", inputs: ["onDateSelected", "$contactusSpace"], outputs: ["slotClicked"] }, { kind: "component", type: RecurringsTabComponent, selector: "sneat-recurrings-tab", inputs: ["$space", "$recurrings", "$contactusSpace", "$allRecurrings"] }, { kind: "component", type: CalendarWeekTabComponent, selector: "sneat-week-tab", inputs: ["$spaceDaysProvider"] }, { kind: "component", type: CalendarDayTabComponent, selector: "sneat-day-tab", inputs: ["$spaceDaysProvider"] }, { kind: "component", type: CalendarFilterComponent, selector: "sneat-calendar-filter", inputs: ["space", "showWeekdays", "showRepeats"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: CalendarDayServiceModule }, { kind: "component", type: IonSegment, selector: "ion-segment", inputs: ["color", "disabled", "mode", "scrollable", "selectOnFocus", "swipeGesture", "value"] }, { kind: "component", type: IonSegmentButton, selector: "ion-segment-button", inputs: ["contentId", "disabled", "layout", "mode", "type", "value"] }, { kind: "component", type: IonLabel, selector: "ion-label", inputs: ["color", "mode", "position"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
251
+ }
252
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: CalendarComponent, decorators: [{
253
+ type: Component,
254
+ args: [{ imports: [
255
+ SinglesTabComponent,
256
+ RecurringsTabComponent,
257
+ CalendarWeekTabComponent,
258
+ CalendarDayTabComponent,
259
+ CalendarFilterComponent,
260
+ FormsModule,
261
+ CalendarDayServiceModule,
262
+ IonSegment,
263
+ IonSegmentButton,
264
+ IonLabel,
265
+ ], providers: [
266
+ { provide: ClassName, useValue: 'CalendarComponent' },
267
+ CalendarFilterService,
268
+ CalendarStateService,
269
+ CalendariumSpaceService,
270
+ ContactusSpaceService,
271
+ ], changeDetection: ChangeDetectionStrategy.OnPush, selector: 'sneat-calendar', template: "<ion-segment [(ngModel)]=\"tab\" (ionChange)=\"segmentChanged($event)\">\n <ion-segment-button value=\"day\">\n <ion-label class=\"smaller\">\uD83D\uDCC5 Day</ion-label>\n </ion-segment-button>\n <ion-segment-button value=\"week\">\n <ion-label class=\"smaller\">\uD83D\uDDD3\uFE0F Week</ion-label>\n </ion-segment-button>\n <ion-segment-button value=\"recurrings\">\n <ion-label class=\"smaller\">\uD83D\uDD01 Repeats</ion-label>\n </ion-segment-button>\n <ion-segment-button value=\"singles\">\n <ion-label class=\"smaller\">1\uFE0F\u20E3-timers</ion-label>\n </ion-segment-button>\n</ion-segment>\n\n<sneat-calendar-filter\n #calendarFilterComponent\n [space]=\"$space()\"\n [showWeekdays]=\"tab === 'recurrings'\"\n [showRepeats]=\"tab === 'recurrings'\"\n/>\n\n<!--\nWe use style.display instead of *ngIf to avoid re-creating of the component on tab re-activation.\nThis is just a small performance optimization.\n-->\n<sneat-day-tab\n [style.display]=\"tab === 'day' ? 'block' : 'none'\"\n [$space]=\"$space()\"\n [$spaceDaysProvider]=\"spaceDaysProvider\"\n/>\n\n<!--\nWe use *ngIf instead of [style.display] to avoid rendering of the tab when it's not visible.\nThis is due to weird bug that affects user service onSnapshot not retuning user data\nwhen we have more than 1 week components (odd/event for slider).\nThis is probably due to the fact that we open 14 listeners (1 for each day of 2 weeks) and Firestore is not able to handle that many listeners?\n\n[style.display]=\"tab === 'week' ? 'block' : 'none'\"\n-->\n@if ($isWeekTabActivated()) {\n <sneat-week-tab\n [style.display]=\"tab === 'week' ? 'block' : 'none'\"\n [$space]=\"$space()\"\n [$spaceDaysProvider]=\"spaceDaysProvider\"\n />\n}\n\n@switch (tab) {\n @case (\"recurrings\") {\n <sneat-recurrings-tab\n [$space]=\"$space()\"\n [$recurrings]=\"$recurrings()\"\n [$allRecurrings]=\"$allRecurrings()\"\n [$contactusSpace]=\"$contactusSpace()\"\n />\n }\n @case (\"singles\") {\n <sneat-singles-tab\n [$space]=\"$space()\"\n [onDateSelected]=\"onDateSelected\"\n [$contactusSpace]=\"$contactusSpace()\"\n />\n }\n}\n", styles: ["ion-segment-button .smaller{font-size:smaller}\n"] }]
272
+ }], ctorParameters: () => [], propDecorators: { calendarFilterComponent: [{
273
+ type: ViewChild,
274
+ args: ['calendarFilterComponent']
275
+ }], member: [{
276
+ type: Input
277
+ }], tab: [{
278
+ type: Input
279
+ }], tabChanged: [{
280
+ type: Output
281
+ }], dateChanged: [{
282
+ type: Output
283
+ }] } });
284
+ //# sourceMappingURL=calendar.component.js.map