@dereekb/dbx-form 9.17.3 → 9.18.1

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 (144) hide show
  1. package/calendar/README.md +6 -0
  2. package/calendar/index.d.ts +1 -0
  3. package/calendar/lib/calendar.module.d.ts +29 -0
  4. package/calendar/lib/calendar.schedule.selection.cell.component.d.ts +14 -0
  5. package/calendar/lib/calendar.schedule.selection.component.d.ts +27 -0
  6. package/calendar/lib/calendar.schedule.selection.d.ts +29 -0
  7. package/calendar/lib/calendar.schedule.selection.days.component.d.ts +17 -0
  8. package/calendar/lib/calendar.schedule.selection.days.form.component.d.ts +10 -0
  9. package/calendar/lib/calendar.schedule.selection.dialog.button.component.d.ts +12 -0
  10. package/calendar/lib/calendar.schedule.selection.dialog.component.d.ts +12 -0
  11. package/calendar/lib/calendar.schedule.selection.form.d.ts +4 -0
  12. package/calendar/lib/calendar.schedule.selection.popover.button.component.d.ts +15 -0
  13. package/calendar/lib/calendar.schedule.selection.popover.component.d.ts +14 -0
  14. package/calendar/lib/calendar.schedule.selection.popover.content.component.d.ts +7 -0
  15. package/calendar/lib/calendar.schedule.selection.range.component.d.ts +37 -0
  16. package/calendar/lib/calendar.schedule.selection.store.d.ts +142 -0
  17. package/calendar/lib/calendar.schedule.selection.store.provide.d.ts +24 -0
  18. package/calendar/lib/field/index.d.ts +1 -0
  19. package/calendar/lib/field/schedule/calendar.schedule.field.component.d.ts +40 -0
  20. package/calendar/lib/field/schedule/calendar.schedule.field.d.ts +6 -0
  21. package/calendar/lib/field/schedule/calendar.schedule.module.d.ts +15 -0
  22. package/calendar/lib/field/schedule/index.d.ts +3 -0
  23. package/calendar/lib/index.d.ts +16 -0
  24. package/esm2020/calendar/dereekb-dbx-form-calendar.mjs +5 -0
  25. package/esm2020/calendar/index.mjs +2 -0
  26. package/esm2020/calendar/lib/calendar.module.mjs +138 -0
  27. package/esm2020/calendar/lib/calendar.schedule.selection.cell.component.mjs +46 -0
  28. package/esm2020/calendar/lib/calendar.schedule.selection.component.mjs +72 -0
  29. package/esm2020/calendar/lib/calendar.schedule.selection.days.component.mjs +45 -0
  30. package/esm2020/calendar/lib/calendar.schedule.selection.days.form.component.mjs +26 -0
  31. package/esm2020/calendar/lib/calendar.schedule.selection.dialog.button.component.mjs +32 -0
  32. package/esm2020/calendar/lib/calendar.schedule.selection.dialog.component.mjs +35 -0
  33. package/esm2020/calendar/lib/calendar.schedule.selection.form.mjs +15 -0
  34. package/esm2020/calendar/lib/calendar.schedule.selection.mjs +30 -0
  35. package/esm2020/calendar/lib/calendar.schedule.selection.popover.button.component.mjs +45 -0
  36. package/esm2020/calendar/lib/calendar.schedule.selection.popover.component.mjs +37 -0
  37. package/esm2020/calendar/lib/calendar.schedule.selection.popover.content.component.mjs +27 -0
  38. package/esm2020/calendar/lib/calendar.schedule.selection.range.component.mjs +99 -0
  39. package/esm2020/calendar/lib/calendar.schedule.selection.store.mjs +294 -0
  40. package/esm2020/calendar/lib/calendar.schedule.selection.store.provide.mjs +52 -0
  41. package/esm2020/calendar/lib/field/index.mjs +3 -0
  42. package/esm2020/calendar/lib/field/schedule/calendar.schedule.field.component.mjs +95 -0
  43. package/esm2020/calendar/lib/field/schedule/calendar.schedule.field.mjs +16 -0
  44. package/esm2020/calendar/lib/field/schedule/calendar.schedule.module.mjs +54 -0
  45. package/esm2020/calendar/lib/field/schedule/index.mjs +4 -0
  46. package/esm2020/calendar/lib/index.mjs +17 -0
  47. package/esm2020/lib/form/action/form.action.directive.mjs +4 -4
  48. package/esm2020/lib/form/action/form.action.module.mjs +5 -5
  49. package/esm2020/lib/form/action/transition/form.action.transition.module.mjs +5 -5
  50. package/esm2020/lib/form/action/transition/form.action.transition.safety.directive.mjs +4 -4
  51. package/esm2020/lib/form/form.module.mjs +5 -5
  52. package/esm2020/lib/form/io/form.changes.directive.mjs +4 -4
  53. package/esm2020/lib/form/io/form.input.directive.mjs +4 -4
  54. package/esm2020/lib/form/io/form.io.module.mjs +5 -5
  55. package/esm2020/lib/form/io/form.loading.directive.mjs +4 -4
  56. package/esm2020/lib/form.module.mjs +5 -5
  57. package/esm2020/lib/formly/field/checklist/checklist.item.field.component.mjs +7 -7
  58. package/esm2020/lib/formly/field/checklist/checklist.item.field.content.default.component.mjs +4 -4
  59. package/esm2020/lib/formly/field/checklist/checklist.item.field.module.mjs +5 -5
  60. package/esm2020/lib/formly/field/component/component.field.component.mjs +4 -4
  61. package/esm2020/lib/formly/field/component/component.field.module.mjs +5 -5
  62. package/esm2020/lib/formly/field/form.field.module.mjs +5 -5
  63. package/esm2020/lib/formly/field/selection/list/list.field.component.mjs +4 -4
  64. package/esm2020/lib/formly/field/selection/list/list.field.module.mjs +5 -5
  65. package/esm2020/lib/formly/field/selection/pickable/pickable.chip.field.component.mjs +4 -4
  66. package/esm2020/lib/formly/field/selection/pickable/pickable.field.directive.mjs +4 -4
  67. package/esm2020/lib/formly/field/selection/pickable/pickable.field.module.mjs +5 -5
  68. package/esm2020/lib/formly/field/selection/pickable/pickable.list.field.component.mjs +13 -13
  69. package/esm2020/lib/formly/field/selection/searchable/searchable.chip.field.component.mjs +4 -4
  70. package/esm2020/lib/formly/field/selection/searchable/searchable.field.autocomplete.item.component.mjs +10 -10
  71. package/esm2020/lib/formly/field/selection/searchable/searchable.field.directive.mjs +4 -4
  72. package/esm2020/lib/formly/field/selection/searchable/searchable.field.module.mjs +5 -5
  73. package/esm2020/lib/formly/field/selection/searchable/searchable.text.field.component.mjs +4 -4
  74. package/esm2020/lib/formly/field/selection/selection.module.mjs +5 -5
  75. package/esm2020/lib/formly/field/texteditor/texteditor.field.component.mjs +4 -4
  76. package/esm2020/lib/formly/field/texteditor/texteditor.field.module.mjs +5 -5
  77. package/esm2020/lib/formly/field/value/array/array.field.component.mjs +14 -6
  78. package/esm2020/lib/formly/field/value/array/array.field.mjs +3 -2
  79. package/esm2020/lib/formly/field/value/array/array.field.module.mjs +5 -5
  80. package/esm2020/lib/formly/field/value/boolean/boolean.field.module.mjs +5 -5
  81. package/esm2020/lib/formly/field/value/date/date.field.module.mjs +5 -5
  82. package/esm2020/lib/formly/field/value/date/datetime.field.component.mjs +19 -9
  83. package/esm2020/lib/formly/field/value/number/number.field.mjs +4 -1
  84. package/esm2020/lib/formly/field/value/number/number.field.module.mjs +5 -5
  85. package/esm2020/lib/formly/field/value/phone/phone.field.component.mjs +4 -4
  86. package/esm2020/lib/formly/field/value/phone/phone.field.module.mjs +5 -5
  87. package/esm2020/lib/formly/field/value/text/text.field.module.mjs +5 -5
  88. package/esm2020/lib/formly/field/value/value.module.mjs +5 -5
  89. package/esm2020/lib/formly/field/wrapper/autotouch.wrapper.component.mjs +4 -4
  90. package/esm2020/lib/formly/field/wrapper/expandable.wrapper.component.mjs +4 -4
  91. package/esm2020/lib/formly/field/wrapper/expandable.wrapper.delegate.mjs +4 -4
  92. package/esm2020/lib/formly/field/wrapper/flex.wrapper.component.mjs +4 -4
  93. package/esm2020/lib/formly/field/wrapper/form.wrapper.module.mjs +5 -5
  94. package/esm2020/lib/formly/field/wrapper/info.wrapper.component.mjs +4 -4
  95. package/esm2020/lib/formly/field/wrapper/section.wrapper.component.mjs +4 -4
  96. package/esm2020/lib/formly/field/wrapper/style.wrapper.component.mjs +4 -4
  97. package/esm2020/lib/formly/field/wrapper/subsection.wrapper.component.mjs +4 -4
  98. package/esm2020/lib/formly/field/wrapper/toggle.wrapper.component.mjs +4 -4
  99. package/esm2020/lib/formly/field/wrapper/working.wrapper.component.mjs +4 -4
  100. package/esm2020/lib/formly/formly.context.directive.mjs +4 -4
  101. package/esm2020/lib/formly/formly.directive.mjs +13 -13
  102. package/esm2020/lib/formly/formly.form.component.mjs +4 -4
  103. package/esm2020/lib/formly/formly.module.mjs +5 -5
  104. package/esm2020/lib/layout/form.layout.module.mjs +5 -5
  105. package/esm2020/lib/layout/form.spacer.component.mjs +4 -4
  106. package/esm2020/mapbox/lib/field/latlng/latlng.field.component.mjs +4 -4
  107. package/esm2020/mapbox/lib/field/latlng/latlng.module.mjs +5 -5
  108. package/esm2020/mapbox/lib/field/zoom/zoom.field.component.mjs +4 -4
  109. package/esm2020/mapbox/lib/field/zoom/zoom.module.mjs +5 -5
  110. package/esm2020/mapbox/lib/mapbox.module.mjs +5 -5
  111. package/fesm2015/dereekb-dbx-form-calendar.mjs +1063 -0
  112. package/fesm2015/dereekb-dbx-form-calendar.mjs.map +1 -0
  113. package/fesm2015/dereekb-dbx-form-mapbox.mjs +18 -18
  114. package/fesm2015/dereekb-dbx-form-mapbox.mjs.map +1 -1
  115. package/fesm2015/dereekb-dbx-form.mjs +252 -230
  116. package/fesm2015/dereekb-dbx-form.mjs.map +1 -1
  117. package/fesm2020/dereekb-dbx-form-calendar.mjs +1055 -0
  118. package/fesm2020/dereekb-dbx-form-calendar.mjs.map +1 -0
  119. package/fesm2020/dereekb-dbx-form-mapbox.mjs +18 -18
  120. package/fesm2020/dereekb-dbx-form-mapbox.mjs.map +1 -1
  121. package/fesm2020/dereekb-dbx-form.mjs +252 -230
  122. package/fesm2020/dereekb-dbx-form.mjs.map +1 -1
  123. package/lib/extension/_extension.scss +38 -0
  124. package/lib/extension/calendar/_calendar.scss +89 -0
  125. package/lib/formly/field/value/array/array.field.component.d.ts +9 -2
  126. package/lib/formly/field/value/array/array.field.d.ts +1 -0
  127. package/lib/formly/field/value/date/datetime.field.component.d.ts +9 -7
  128. package/lib/formly/field/value/number/number.field.d.ts +4 -0
  129. package/lib/style/_all-core.scss +3 -1
  130. package/lib/style/_all-theme.scss +2 -0
  131. package/lib/style/_all-typography.scss +3 -1
  132. package/lib/style/_config.scss +16 -0
  133. package/lib/style/_core.scss +2 -2
  134. package/mapbox/esm2020/lib/field/latlng/latlng.field.component.mjs +4 -4
  135. package/mapbox/esm2020/lib/field/latlng/latlng.module.mjs +5 -5
  136. package/mapbox/esm2020/lib/field/zoom/zoom.field.component.mjs +4 -4
  137. package/mapbox/esm2020/lib/field/zoom/zoom.module.mjs +5 -5
  138. package/mapbox/esm2020/lib/mapbox.module.mjs +5 -5
  139. package/mapbox/fesm2015/dereekb-dbx-form-mapbox.mjs +18 -18
  140. package/mapbox/fesm2015/dereekb-dbx-form-mapbox.mjs.map +1 -1
  141. package/mapbox/fesm2020/dereekb-dbx-form-mapbox.mjs +18 -18
  142. package/mapbox/fesm2020/dereekb-dbx-form-mapbox.mjs.map +1 -1
  143. package/mapbox/package.json +7 -7
  144. package/package.json +16 -8
@@ -0,0 +1,1055 @@
1
+ import * as i4 from '@dereekb/dbx-form';
2
+ import { formlyField, propsAndConfigForFieldConfig, flexLayoutWrapper, toggleField, AbstractSyncFormlyFormDirective, provideFormlyContext, DbxFormModule, DbxFormlyModule } from '@dereekb/dbx-form';
3
+ import * as i1$1 from '@dereekb/dbx-web';
4
+ import { AbstractPopoverDirective, AbstractDialogDirective, DbxActionModule, DbxButtonModule, DbxDialogInteractionModule, DbxPopoverInteractionModule, DbxTextModule } from '@dereekb/dbx-web';
5
+ import * as i0 from '@angular/core';
6
+ import { Injectable, SkipSelf, Directive, Injector, Optional, Component, Input, ElementRef, ViewChild, ChangeDetectionStrategy, EventEmitter, Output, NgModule } from '@angular/core';
7
+ import { FieldType } from '@ngx-formly/material';
8
+ import { map, distinctUntilChanged, shareReplay, BehaviorSubject, of, startWith, filter, first, throttleTime as throttleTime$1, switchMap as switchMap$1 } from 'rxjs';
9
+ import { filterMaybe, SubscriptionObject, asObservable } from '@dereekb/rxjs';
10
+ import { DateScheduleDayCode, expandDateScheduleDayCodesToDayOfWeekSet, dateTimingRelativeIndexFactory, dateBlockDayOfWeekFactory, isSameDate, isSameDateRange, isSameDateScheduleRange, findMaxDate, isSameDateDay, findMinDate, dateScheduleDateFilter, dateScheduleDayCodes, isDateInDateRangeFunction, isDateWithinDateBlockRangeFunction, dateScheduleEncodedWeek, dateBlockTimingDateFactory, enabledDaysFromDateScheduleDayCodes, dateScheduleDayCodesFromEnabledDays, formatToMonthDayString } from '@dereekb/date';
11
+ import { setsAreEquivalent, iterableToArray, toggleInSet, addToSet, isIndexNumberInIndexRangeFunction, range, minAndMaxNumber, randomNumberFactory, getDaysOfWeekNames } from '@dereekb/util';
12
+ import { ComponentStore } from '@ngrx/component-store';
13
+ import { startOfDay, startOfYear, addYears } from 'date-fns';
14
+ import { switchMap, throttleTime } from 'rxjs/operators';
15
+ import * as i1 from '@dereekb/dbx-web/calendar';
16
+ import { prepareAndSortCalendarEvents, DbxCalendarStore, DbxCalendarModule } from '@dereekb/dbx-web/calendar';
17
+ import * as i3 from '@angular/forms';
18
+ import { FormGroup, FormControl, FormsModule, ReactiveFormsModule } from '@angular/forms';
19
+ import * as i3$1 from '@angular/common';
20
+ import { CommonModule } from '@angular/common';
21
+ import * as i5 from '@angular/material/form-field';
22
+ import { MatFormFieldModule } from '@angular/material/form-field';
23
+ import * as i7 from '@angular/material/datepicker';
24
+ import { MatDatepickerModule } from '@angular/material/datepicker';
25
+ import * as i1$2 from '@angular/material/dialog';
26
+ import * as i4$1 from 'angular-calendar';
27
+ import { CalendarModule, CalendarDayModule, CalendarWeekModule } from 'angular-calendar';
28
+ import * as i3$2 from '@dereekb/dbx-core';
29
+ import * as i3$3 from '@angular/material/icon';
30
+ import { MatIconModule } from '@angular/material/icon';
31
+ import * as i2 from '@angular/material/button';
32
+ import { MatButtonModule } from '@angular/material/button';
33
+ import * as i1$3 from '@ngx-formly/core';
34
+ import { FormlyModule } from '@ngx-formly/core';
35
+ import { MatInputModule } from '@angular/material/input';
36
+ import { MatButtonToggleModule } from '@angular/material/button-toggle';
37
+ import { FlexLayoutModule } from '@angular/flex-layout';
38
+
39
+ function dateScheduleRangeField(config = {}) {
40
+ const { key = 'schedule', filter } = config;
41
+ const fieldConfig = {
42
+ ...formlyField({
43
+ key,
44
+ type: 'date-schedule-range',
45
+ ...propsAndConfigForFieldConfig(config, {
46
+ label: config.label ?? 'Schedule',
47
+ filter
48
+ })
49
+ })
50
+ };
51
+ return fieldConfig;
52
+ }
53
+
54
+ var CalendarScheduleSelectionDayState;
55
+ (function (CalendarScheduleSelectionDayState) {
56
+ CalendarScheduleSelectionDayState[CalendarScheduleSelectionDayState["NOT_APPLICABLE"] = 0] = "NOT_APPLICABLE";
57
+ CalendarScheduleSelectionDayState[CalendarScheduleSelectionDayState["DISABLED"] = 1] = "DISABLED";
58
+ CalendarScheduleSelectionDayState[CalendarScheduleSelectionDayState["NOT_SELECTED"] = 2] = "NOT_SELECTED";
59
+ CalendarScheduleSelectionDayState[CalendarScheduleSelectionDayState["SELECTED"] = 3] = "SELECTED";
60
+ })(CalendarScheduleSelectionDayState || (CalendarScheduleSelectionDayState = {}));
61
+ const defaultCalendarScheduleSelectionCellContentFactory = (day) => {
62
+ let icon;
63
+ let text;
64
+ switch (day.meta?.state) {
65
+ case CalendarScheduleSelectionDayState.SELECTED:
66
+ icon = 'check_box';
67
+ break;
68
+ case CalendarScheduleSelectionDayState.DISABLED:
69
+ icon = 'block';
70
+ break;
71
+ case CalendarScheduleSelectionDayState.NOT_APPLICABLE:
72
+ break;
73
+ case CalendarScheduleSelectionDayState.NOT_SELECTED:
74
+ icon = 'check_box_outline_blank';
75
+ text = 'Add';
76
+ break;
77
+ }
78
+ return {
79
+ icon,
80
+ text
81
+ };
82
+ };
83
+
84
+ function initialCalendarScheduleSelectionState() {
85
+ const start = startOfDay(new Date());
86
+ const scheduleDays = new Set([DateScheduleDayCode.WEEKDAY, DateScheduleDayCode.WEEKEND]);
87
+ const allowedDaysOfWeek = expandDateScheduleDayCodesToDayOfWeekSet(Array.from(scheduleDays));
88
+ const indexFactory = dateTimingRelativeIndexFactory({ start });
89
+ const indexDayOfWeek = dateBlockDayOfWeekFactory(start);
90
+ return {
91
+ start,
92
+ indexFactory,
93
+ selectedIndexes: new Set(),
94
+ scheduleDays,
95
+ allowedDaysOfWeek,
96
+ indexDayOfWeek,
97
+ isEnabledFilterDay: () => true,
98
+ isEnabledDay: () => false,
99
+ minDate: new Date(0),
100
+ maxDate: startOfYear(addYears(new Date(), 100)),
101
+ cellContentFactory: defaultCalendarScheduleSelectionCellContentFactory
102
+ };
103
+ }
104
+ class DbxCalendarScheduleSelectionStore extends ComponentStore {
105
+ constructor() {
106
+ super(initialCalendarScheduleSelectionState());
107
+ // MARK: Accessors
108
+ this.filter$ = this.state$.pipe(map((x) => x.filter), distinctUntilChanged(), shareReplay(1));
109
+ this.inputStart$ = this.state$.pipe(map((x) => x.inputStart), distinctUntilChanged(isSameDate), shareReplay(1));
110
+ this.inputEnd$ = this.state$.pipe(map((x) => x.inputEnd), distinctUntilChanged(isSameDate), shareReplay(1));
111
+ this.currentInputRange$ = this.state$.pipe(map(({ inputStart, inputEnd }) => ({ inputStart, inputEnd })), distinctUntilChanged((a, b) => isSameDate(a.inputStart, b.inputStart) && isSameDate(a.inputEnd, b.inputEnd)), map((x) => {
112
+ if (x.inputStart && x.inputEnd) {
113
+ return x;
114
+ }
115
+ else {
116
+ return undefined;
117
+ }
118
+ }), shareReplay(1));
119
+ this.inputRange$ = this.currentInputRange$.pipe(filterMaybe(), shareReplay(1));
120
+ this.selectedDates$ = this.state$.pipe(map((x) => x.selectedIndexes), distinctUntilChanged(), shareReplay(1));
121
+ this.isEnabledFilterDayFunction$ = this.state$.pipe(map((x) => x.isEnabledFilterDay), shareReplay(1));
122
+ this.isEnabledDayFunction$ = this.state$.pipe(map((x) => x.isEnabledDay), shareReplay(1));
123
+ this.currentDateRange$ = this.state$.pipe(map(computeCalendarScheduleSelectionRange), distinctUntilChanged((a, b) => isSameDateRange(a, b)), shareReplay(1));
124
+ this.dateRange$ = this.currentDateRange$.pipe(filterMaybe(), shareReplay(1));
125
+ this.scheduleDays$ = this.state$.pipe(map((x) => x.scheduleDays), distinctUntilChanged(setsAreEquivalent), shareReplay(1));
126
+ this.currentSelectionValue$ = this.state$.pipe(map((x) => x.currentSelectionValue), shareReplay(1));
127
+ this.selectionValue$ = this.currentSelectionValue$.pipe(filterMaybe(), shareReplay(1));
128
+ this.currentDateScheduleRangeValue$ = this.currentSelectionValue$.pipe(map((x) => x?.dateScheduleRange), distinctUntilChanged(isSameDateScheduleRange), shareReplay(1));
129
+ this.dateScheduleRangeValue$ = this.currentDateScheduleRangeValue$.pipe(filterMaybe(), shareReplay(1));
130
+ this.minDate$ = this.state$.pipe(map((x) => findMaxDate([x.filter?.start, x.minDate])), distinctUntilChanged(isSameDateDay), shareReplay(1));
131
+ this.maxDate$ = this.state$.pipe(map((x) => findMinDate([x.filter?.end, x.maxDate])), distinctUntilChanged(isSameDateDay), shareReplay(1));
132
+ this.cellContentFactory$ = this.state$.pipe(map((x) => x.cellContentFactory), distinctUntilChanged(), shareReplay(1));
133
+ this.isCustomized$ = this.state$.pipe(map((x) => x.selectedIndexes.size > 0), distinctUntilChanged(), shareReplay(1));
134
+ // MARK: State Changes
135
+ this.setFilter = this.updater((state, filter) => updateStateWithFilter(state, filter));
136
+ this.clearFilter = this.updater((state) => updateStateWithFilter(state, undefined));
137
+ this.setTimezone = this.updater((state, timezone) => ({ ...state, timezone }));
138
+ this.setInputRange = this.updater((state, range) => updateStateWithChangedRange(state, range));
139
+ this.toggleSelectedDates = this.updater((state, toggle) => updateStateWithChangedDates(state, { toggle }));
140
+ this.addSelectedDates = this.updater((state, add) => updateStateWithChangedDates(state, { add }));
141
+ this.removeSelectedDates = this.updater((state, remove) => updateStateWithChangedDates(state, { remove }));
142
+ this.setSelectedDates = this.updater((state, set) => updateStateWithChangedDates(state, { set }));
143
+ this.setScheduleDays = this.updater((state, scheduleDays) => updateStateWithChangedScheduleDays(state, scheduleDays));
144
+ this.setAllowAllScheduleDays = this.updater((state) => updateStateWithChangedScheduleDays(state, null));
145
+ this.setDateScheduleRangeValue = this.updater((state, value) => updateStateWithDateScheduleRangeValue(state, value));
146
+ this.setCellContentFactory = this.updater((state, cellContentFactory) => ({ ...state, cellContentFactory }));
147
+ }
148
+ }
149
+ DbxCalendarScheduleSelectionStore.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxCalendarScheduleSelectionStore, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
150
+ DbxCalendarScheduleSelectionStore.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxCalendarScheduleSelectionStore });
151
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxCalendarScheduleSelectionStore, decorators: [{
152
+ type: Injectable
153
+ }], ctorParameters: function () { return []; } });
154
+ function updateStateWithFilter(state, filter) {
155
+ let isEnabledFilterDay = () => true;
156
+ if (filter) {
157
+ isEnabledFilterDay = dateScheduleDateFilter(filter);
158
+ }
159
+ return { ...state, filter, isEnabledFilterDay };
160
+ }
161
+ function updateStateWithDateScheduleRangeValue(state, change) {
162
+ const isSameValue = isSameDateScheduleRange(state.currentSelectionValue?.dateScheduleRange, change);
163
+ if (isSameValue) {
164
+ return state;
165
+ }
166
+ else {
167
+ if (change != null) {
168
+ const nextState = { ...state, inputStart: change.start, inputEnd: change.end, selectedIndexes: new Set(change.ex) };
169
+ return updateStateWithChangedScheduleDays(finalizeNewCalendarScheduleSelectionState(nextState), dateScheduleDayCodes(change.w));
170
+ }
171
+ else {
172
+ return noSelectionCalendarScheduleSelectionState(state); // clear selection, retain disabled days
173
+ }
174
+ }
175
+ }
176
+ function updateStateWithChangedScheduleDays(state, change) {
177
+ const { scheduleDays: currentScheduleDays } = state;
178
+ const scheduleDays = new Set(change || [DateScheduleDayCode.WEEKDAY, DateScheduleDayCode.WEEKEND]);
179
+ if (setsAreEquivalent(currentScheduleDays, scheduleDays)) {
180
+ return state; // no change
181
+ }
182
+ else {
183
+ const allowedDaysOfWeek = expandDateScheduleDayCodesToDayOfWeekSet(Array.from(scheduleDays));
184
+ const nextState = { ...state, scheduleDays, allowedDaysOfWeek };
185
+ return finalizeNewCalendarScheduleSelectionState(nextState);
186
+ }
187
+ }
188
+ function updateStateWithChangedDates(state, change) {
189
+ const { indexFactory, allowedDaysOfWeek, indexDayOfWeek } = state;
190
+ let selectedIndexes;
191
+ if (change.set) {
192
+ selectedIndexes = new Set(iterableToArray(change.set).map(indexFactory));
193
+ }
194
+ else {
195
+ selectedIndexes = new Set(state.selectedIndexes);
196
+ if (change.toggle) {
197
+ const allowedToToggle = iterableToArray(change.toggle)
198
+ .map(indexFactory)
199
+ .filter((i) => allowedDaysOfWeek.has(indexDayOfWeek(i)));
200
+ toggleInSet(selectedIndexes, allowedToToggle);
201
+ }
202
+ if (change.add) {
203
+ addToSet(selectedIndexes, iterableToArray(change.add).map(indexFactory));
204
+ }
205
+ if (change.remove) {
206
+ addToSet(selectedIndexes, iterableToArray(change.remove).map(indexFactory));
207
+ }
208
+ }
209
+ const nextState = { ...state, selectedIndexes };
210
+ nextState.isEnabledDay = isEnabledDayInCalendarScheduleSelectionState(nextState);
211
+ // Recalculate the range and simplified to exclusions
212
+ const rangeAndExclusion = computeScheduleSelectionRangeAndExclusion(nextState);
213
+ if (rangeAndExclusion) {
214
+ return finalizeNewCalendarScheduleSelectionState({ ...nextState, selectedIndexes: new Set(rangeAndExclusion.excluded), inputStart: rangeAndExclusion.start, inputEnd: rangeAndExclusion.end });
215
+ }
216
+ else {
217
+ // no selected days
218
+ return noSelectionCalendarScheduleSelectionState(state);
219
+ }
220
+ }
221
+ function noSelectionCalendarScheduleSelectionState(state) {
222
+ return finalizeNewCalendarScheduleSelectionState({ ...state, selectedIndexes: new Set(), inputStart: null, inputEnd: null });
223
+ }
224
+ function updateStateWithChangedRange(state, change) {
225
+ const { inputStart: currentInputStart, inputEnd: currentInputEnd, indexFactory, minDate, maxDate } = state;
226
+ const inputStart = startOfDay(change.inputStart);
227
+ const inputEnd = startOfDay(change.inputEnd);
228
+ const isValidRange = minDate != null || maxDate != null ? isDateInDateRangeFunction({ start: minDate ?? undefined, end: maxDate ?? undefined }) : () => true;
229
+ if (!isValidRange(inputStart) || !isValidRange(inputEnd) || (isSameDateDay(inputStart, currentInputStart) && isSameDateDay(inputEnd, currentInputEnd))) {
230
+ return state; // if no change, return the current state.
231
+ }
232
+ // retain all indexes that are within the new range
233
+ const minIndex = indexFactory(inputStart);
234
+ const maxIndex = indexFactory(inputEnd) + 1;
235
+ const currentIndexes = Array.from(state.selectedIndexes);
236
+ const isInCurrentRange = isIndexNumberInIndexRangeFunction({ minIndex, maxIndex });
237
+ const excludedIndexesInNewRange = currentIndexes.filter(isInCurrentRange);
238
+ const nextState = { ...state, excludedIndexesInNewRange, inputStart, inputEnd };
239
+ return finalizeNewCalendarScheduleSelectionState(nextState);
240
+ }
241
+ function finalizeNewCalendarScheduleSelectionState(nextState) {
242
+ nextState.isEnabledDay = isEnabledDayInCalendarScheduleSelectionState(nextState);
243
+ nextState.currentSelectionValue = computeScheduleSelectionValue(nextState);
244
+ return nextState;
245
+ }
246
+ function isEnabledDayInCalendarScheduleSelectionState(state) {
247
+ const { indexFactory, inputStart, inputEnd, indexDayOfWeek, allowedDaysOfWeek } = state;
248
+ let isInStartAndEndRange;
249
+ if (inputStart && inputEnd) {
250
+ isInStartAndEndRange = isDateWithinDateBlockRangeFunction({ start: state.start, range: { start: inputStart, end: inputEnd } });
251
+ }
252
+ else {
253
+ isInStartAndEndRange = () => false;
254
+ }
255
+ return (input) => {
256
+ const index = indexFactory(input);
257
+ const dayOfWeek = indexDayOfWeek(index);
258
+ const isInSelectedRange = isInStartAndEndRange(input);
259
+ const isSelected = state.selectedIndexes.has(index);
260
+ const isAllowedDayOfWeek = allowedDaysOfWeek.has(dayOfWeek);
261
+ const result = isAllowedDayOfWeek && ((isInSelectedRange && !isSelected) || (isSelected && !isInSelectedRange));
262
+ return result;
263
+ };
264
+ }
265
+ function computeScheduleSelectionValue(state) {
266
+ const { scheduleDays, allowedDaysOfWeek, indexDayOfWeek } = state;
267
+ const rangeAndExclusion = computeScheduleSelectionRangeAndExclusion(state);
268
+ if (rangeAndExclusion == null) {
269
+ return null;
270
+ }
271
+ const { start, end, excluded, dateBlockRange } = rangeAndExclusion;
272
+ const indexOffset = dateBlockRange.i;
273
+ const ex = excluded
274
+ .filter((x) => {
275
+ const isExcludedIndex = allowedDaysOfWeek.has(indexDayOfWeek(x));
276
+ return isExcludedIndex;
277
+ })
278
+ .map((x) => x - indexOffset); // set to the proper offset
279
+ const w = dateScheduleEncodedWeek(scheduleDays);
280
+ const d = []; // "included" blocks are never used/calculated.
281
+ const dateScheduleRange = {
282
+ start,
283
+ end,
284
+ w,
285
+ d,
286
+ ex
287
+ };
288
+ return {
289
+ dateScheduleRange,
290
+ minMaxRange: { start, end }
291
+ };
292
+ }
293
+ function computeScheduleSelectionRangeAndExclusion(state) {
294
+ const { isEnabledDay } = state;
295
+ const dateFactory = dateBlockTimingDateFactory(state);
296
+ const dateBlockRange = computeCalendarScheduleSelectionDateBlockRange(state);
297
+ if (dateBlockRange == null) {
298
+ return null; // returns null if no items are selected.
299
+ }
300
+ const start = dateFactory(dateBlockRange.i);
301
+ const end = dateFactory(dateBlockRange.to);
302
+ const excluded = range(dateBlockRange.i, dateBlockRange.to + 1).filter((x) => {
303
+ const isExcludedIndex = !isEnabledDay(x);
304
+ return isExcludedIndex;
305
+ });
306
+ const result = {
307
+ dateBlockRange,
308
+ start,
309
+ end,
310
+ excluded
311
+ };
312
+ return result;
313
+ }
314
+ function computeCalendarScheduleSelectionRange(state) {
315
+ const dateFactory = dateBlockTimingDateFactory(state);
316
+ const dateBlockRange = computeCalendarScheduleSelectionDateBlockRange(state);
317
+ if (dateBlockRange != null) {
318
+ return { start: dateFactory(dateBlockRange.i), end: dateFactory(dateBlockRange.to) };
319
+ }
320
+ else {
321
+ return undefined;
322
+ }
323
+ }
324
+ function computeCalendarScheduleSelectionDateBlockRange(state) {
325
+ const { indexFactory, inputStart, inputEnd, allowedDaysOfWeek, indexDayOfWeek, isEnabledDay, isEnabledFilterDay } = state;
326
+ const enabledSelectedIndexes = Array.from(state.selectedIndexes).filter((i) => allowedDaysOfWeek.has(indexDayOfWeek(i)));
327
+ const minAndMaxSelectedValues = minAndMaxNumber(enabledSelectedIndexes);
328
+ let startRange;
329
+ let endRange;
330
+ if (minAndMaxSelectedValues) {
331
+ startRange = minAndMaxSelectedValues.min;
332
+ endRange = minAndMaxSelectedValues.max;
333
+ }
334
+ if (inputStart != null && inputEnd != null) {
335
+ const inputStartIndex = indexFactory(inputStart);
336
+ const inputEndIndex = indexFactory(inputEnd);
337
+ startRange = startRange != null ? Math.min(inputStartIndex, startRange) : inputStartIndex;
338
+ endRange = endRange != null ? Math.max(inputEndIndex, endRange) : inputEndIndex;
339
+ }
340
+ if (startRange != null && endRange != null) {
341
+ const scanStartIndex = startRange;
342
+ const scanEndIndex = endRange;
343
+ // clear start and end
344
+ startRange = undefined;
345
+ endRange = undefined;
346
+ // if the min is equal to the start index, then we are in the range and need to iterate dates until we find one that is not selected/excluded.
347
+ for (let i = scanStartIndex; i <= scanEndIndex; i += 1) {
348
+ if (isEnabledFilterDay(i) && isEnabledDay(i)) {
349
+ startRange = i;
350
+ break;
351
+ }
352
+ }
353
+ // same with the max
354
+ for (let i = scanEndIndex; i >= scanStartIndex; i -= 1) {
355
+ if (isEnabledFilterDay(i) && isEnabledDay(i)) {
356
+ endRange = i;
357
+ break;
358
+ }
359
+ }
360
+ }
361
+ if (startRange != null && endRange != null) {
362
+ return { i: startRange, to: endRange };
363
+ }
364
+ else {
365
+ return undefined;
366
+ }
367
+ }
368
+
369
+ /**
370
+ * Token used by provideCalendarScheduleSelectionStoreIfDoesNotExist() to prevent injecting a parent DbxCalendarScheduleSelectionStore into the child view.
371
+ */
372
+ class DbxCalendarScheduleSelectionStoreProviderBlock {
373
+ constructor(dbxCalendarScheduleSelectionStore) {
374
+ this.dbxCalendarScheduleSelectionStore = dbxCalendarScheduleSelectionStore;
375
+ }
376
+ }
377
+ DbxCalendarScheduleSelectionStoreProviderBlock.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxCalendarScheduleSelectionStoreProviderBlock, deps: [{ token: DbxCalendarScheduleSelectionStore, skipSelf: true }], target: i0.ɵɵFactoryTarget.Injectable });
378
+ DbxCalendarScheduleSelectionStoreProviderBlock.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxCalendarScheduleSelectionStoreProviderBlock });
379
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxCalendarScheduleSelectionStoreProviderBlock, decorators: [{
380
+ type: Injectable
381
+ }], ctorParameters: function () { return [{ type: DbxCalendarScheduleSelectionStore, decorators: [{
382
+ type: SkipSelf
383
+ }] }]; } });
384
+ class DbxCalendarScheduleSelectionStoreInjectionBlockDirective {
385
+ }
386
+ DbxCalendarScheduleSelectionStoreInjectionBlockDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxCalendarScheduleSelectionStoreInjectionBlockDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
387
+ DbxCalendarScheduleSelectionStoreInjectionBlockDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.12", type: DbxCalendarScheduleSelectionStoreInjectionBlockDirective, selector: "[dbxCalendarScheduleSelectionStoreParentBlocker]", providers: [DbxCalendarScheduleSelectionStoreProviderBlock], ngImport: i0 });
388
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxCalendarScheduleSelectionStoreInjectionBlockDirective, decorators: [{
389
+ type: Directive,
390
+ args: [{
391
+ selector: '[dbxCalendarScheduleSelectionStoreParentBlocker]',
392
+ providers: [DbxCalendarScheduleSelectionStoreProviderBlock]
393
+ }]
394
+ }] });
395
+ /**
396
+ * Creates a Provider that initializes a new DbxCalendarScheduleSelectionStore if a parent does not exist.
397
+ *
398
+ * If a DbxCalendarScheduleSelectionStoreInjectionBlock is available in the context, and references the same dbxCalendarScheduleSelectionStore that is attempting to be injected, a new DbxCalendarScheduleSelectionStore is created.
399
+ *
400
+ * @returns
401
+ */
402
+ function provideCalendarScheduleSelectionStoreIfParentIsUnavailable() {
403
+ return {
404
+ provide: DbxCalendarScheduleSelectionStore,
405
+ useFactory: (parentInjector, dbxCalendarScheduleSelectionStoreInjectionBlock, dbxCalendarScheduleSelectionStore) => {
406
+ if (!dbxCalendarScheduleSelectionStore || (dbxCalendarScheduleSelectionStore && dbxCalendarScheduleSelectionStoreInjectionBlock != null && dbxCalendarScheduleSelectionStoreInjectionBlock.dbxCalendarScheduleSelectionStore === dbxCalendarScheduleSelectionStore)) {
407
+ // create a new dbxCalendarScheduleSelectionStore to use
408
+ const injector = Injector.create({ providers: [{ provide: DbxCalendarScheduleSelectionStore }], parent: parentInjector });
409
+ dbxCalendarScheduleSelectionStore = injector.get(DbxCalendarScheduleSelectionStore);
410
+ }
411
+ return dbxCalendarScheduleSelectionStore;
412
+ },
413
+ deps: [Injector, [new Optional(), DbxCalendarScheduleSelectionStoreProviderBlock], [new Optional(), new SkipSelf(), DbxCalendarScheduleSelectionStore]]
414
+ };
415
+ }
416
+
417
+ class DbxScheduleSelectionCalendarDateRangeComponent {
418
+ constructor(dbxCalendarStore, dbxCalendarScheduleSelectionStore) {
419
+ this.dbxCalendarStore = dbxCalendarStore;
420
+ this.dbxCalendarScheduleSelectionStore = dbxCalendarScheduleSelectionStore;
421
+ this.appearance = 'fill';
422
+ this.label = 'Enter a date range';
423
+ this.showCustomize = false;
424
+ this.random = randomNumberFactory(10000)();
425
+ this._pickerOpened = new BehaviorSubject(false);
426
+ this._syncSub = new SubscriptionObject();
427
+ this._valueSub = new SubscriptionObject();
428
+ this.range = new FormGroup({
429
+ start: new FormControl(null),
430
+ end: new FormControl(null)
431
+ });
432
+ this.minDate$ = this.dbxCalendarScheduleSelectionStore.minDate$;
433
+ this.maxDate$ = this.dbxCalendarScheduleSelectionStore.maxDate$;
434
+ this.isCustomized$ = this.dbxCalendarScheduleSelectionStore.isCustomized$;
435
+ this.pickerOpened$ = this._pickerOpened.asObservable();
436
+ }
437
+ set disabled(disabled) {
438
+ if (disabled) {
439
+ this.range.disable();
440
+ }
441
+ else {
442
+ this.range.enable();
443
+ }
444
+ }
445
+ ngOnInit() {
446
+ this._syncSub.subscription = this.dbxCalendarScheduleSelectionStore.inputRange$.subscribe((x) => {
447
+ this.range.setValue({
448
+ start: x.inputStart ?? null,
449
+ end: x.inputEnd ?? null
450
+ });
451
+ });
452
+ this._valueSub.subscription = this._pickerOpened
453
+ .pipe(distinctUntilChanged(), switchMap((opened) => {
454
+ let obs;
455
+ if (opened) {
456
+ obs = of({});
457
+ }
458
+ else {
459
+ obs = this.range.valueChanges.pipe(startWith(this.range.value));
460
+ }
461
+ return obs;
462
+ }), filter((x) => Boolean(x.start && x.end)), distinctUntilChanged((a, b) => isSameDateDay(a.start, b.start) && isSameDateDay(a.end, b.end)), throttleTime(100, undefined, { trailing: true }))
463
+ .subscribe((x) => {
464
+ if (x.start && x.end) {
465
+ this.dbxCalendarScheduleSelectionStore.setInputRange({ inputStart: x.start, inputEnd: x.end });
466
+ }
467
+ });
468
+ }
469
+ ngOnDestroy() {
470
+ this._syncSub.destroy();
471
+ this._valueSub.destroy();
472
+ }
473
+ pickerOpened() {
474
+ this._pickerOpened.next(true);
475
+ }
476
+ pickerClosed() {
477
+ this._pickerOpened.next(false);
478
+ }
479
+ }
480
+ DbxScheduleSelectionCalendarDateRangeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxScheduleSelectionCalendarDateRangeComponent, deps: [{ token: i1.DbxCalendarStore }, { token: DbxCalendarScheduleSelectionStore }], target: i0.ɵɵFactoryTarget.Component });
481
+ DbxScheduleSelectionCalendarDateRangeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: DbxScheduleSelectionCalendarDateRangeComponent, selector: "dbx-schedule-selection-calendar-date-range", inputs: { required: "required", appearance: "appearance", label: "label", hint: "hint", disabled: "disabled", showCustomize: "showCustomize" }, ngImport: i0, template: "<mat-form-field class=\"dbx-schedule-selection-calendar-date-range-field\" [appearance]=\"appearance\">\n <mat-label *ngIf=\"label\">{{ label }}</mat-label>\n <div *ngIf=\"showCustomize && (isCustomized$ | async)\" class=\"date-range-field-customized\">\n <span class=\"dbx-accent-bg date-range-field-customized-text\">Custom</span>\n </div>\n <mat-date-range-input [required]=\"required\" [min]=\"minDate$ | async\" [max]=\"maxDate$ | async\" [formGroup]=\"range\" [rangePicker]=\"picker\">\n <input matStartDate formControlName=\"start\" placeholder=\"Start date\" />\n <input matEndDate formControlName=\"end\" placeholder=\"End date\" />\n </mat-date-range-input>\n <mat-datepicker-toggle matIconSuffix [for]=\"picker\"></mat-datepicker-toggle>\n <div *ngIf=\"showCustomize\">\n <dbx-button-spacer></dbx-button-spacer>\n <ng-content select=\"[customizeButton]\"></ng-content>\n </div>\n <mat-date-range-picker #picker (opened)=\"pickerOpened()\" (closed)=\"pickerClosed()\"></mat-date-range-picker>\n <mat-error *ngIf=\"range.controls.start.hasError('matStartDateInvalid')\">Invalid start date</mat-error>\n <mat-error *ngIf=\"range.controls.end.hasError('matEndDateInvalid')\">Invalid end date</mat-error>\n</mat-form-field>\n", dependencies: [{ kind: "directive", type: i3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i3.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i5.MatError, selector: "mat-error", inputs: ["id"] }, { kind: "component", type: i5.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i5.MatLabel, selector: "mat-label" }, { kind: "directive", type: i1$1.DbxButtonSpacerDirective, selector: "dbx-button-spacer,[dbxButtonSpacer]" }, { kind: "component", type: i7.MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }, { kind: "component", type: i7.MatDateRangeInput, selector: "mat-date-range-input", inputs: ["rangePicker", "required", "dateFilter", "min", "max", "disabled", "separator", "comparisonStart", "comparisonEnd"], exportAs: ["matDateRangeInput"] }, { kind: "directive", type: i7.MatStartDate, selector: "input[matStartDate]", inputs: ["errorStateMatcher"], outputs: ["dateChange", "dateInput"] }, { kind: "directive", type: i7.MatEndDate, selector: "input[matEndDate]", inputs: ["errorStateMatcher"], outputs: ["dateChange", "dateInput"] }, { kind: "component", type: i7.MatDateRangePicker, selector: "mat-date-range-picker", exportAs: ["matDateRangePicker"] }, { kind: "pipe", type: i3$1.AsyncPipe, name: "async" }] });
482
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxScheduleSelectionCalendarDateRangeComponent, decorators: [{
483
+ type: Component,
484
+ args: [{ selector: 'dbx-schedule-selection-calendar-date-range', template: "<mat-form-field class=\"dbx-schedule-selection-calendar-date-range-field\" [appearance]=\"appearance\">\n <mat-label *ngIf=\"label\">{{ label }}</mat-label>\n <div *ngIf=\"showCustomize && (isCustomized$ | async)\" class=\"date-range-field-customized\">\n <span class=\"dbx-accent-bg date-range-field-customized-text\">Custom</span>\n </div>\n <mat-date-range-input [required]=\"required\" [min]=\"minDate$ | async\" [max]=\"maxDate$ | async\" [formGroup]=\"range\" [rangePicker]=\"picker\">\n <input matStartDate formControlName=\"start\" placeholder=\"Start date\" />\n <input matEndDate formControlName=\"end\" placeholder=\"End date\" />\n </mat-date-range-input>\n <mat-datepicker-toggle matIconSuffix [for]=\"picker\"></mat-datepicker-toggle>\n <div *ngIf=\"showCustomize\">\n <dbx-button-spacer></dbx-button-spacer>\n <ng-content select=\"[customizeButton]\"></ng-content>\n </div>\n <mat-date-range-picker #picker (opened)=\"pickerOpened()\" (closed)=\"pickerClosed()\"></mat-date-range-picker>\n <mat-error *ngIf=\"range.controls.start.hasError('matStartDateInvalid')\">Invalid start date</mat-error>\n <mat-error *ngIf=\"range.controls.end.hasError('matEndDateInvalid')\">Invalid end date</mat-error>\n</mat-form-field>\n" }]
485
+ }], ctorParameters: function () { return [{ type: i1.DbxCalendarStore }, { type: DbxCalendarScheduleSelectionStore }]; }, propDecorators: { required: [{
486
+ type: Input
487
+ }], appearance: [{
488
+ type: Input
489
+ }], label: [{
490
+ type: Input
491
+ }], hint: [{
492
+ type: Input
493
+ }], disabled: [{
494
+ type: Input
495
+ }], showCustomize: [{
496
+ type: Input
497
+ }] } });
498
+
499
+ function dbxScheduleSelectionCalendarDateDaysFormFields() {
500
+ const fields = dbxScheduleSelectionCalendarDateDaysFormDayFields();
501
+ return [flexLayoutWrapper(fields, { relative: true, size: 3 })];
502
+ }
503
+ function dbxScheduleSelectionCalendarDateDaysFormDayFields() {
504
+ return getDaysOfWeekNames(false).map((dayOfWeekName) => {
505
+ return toggleField({
506
+ key: dayOfWeekName.toLowerCase(),
507
+ label: dayOfWeekName
508
+ });
509
+ });
510
+ }
511
+
512
+ class DbxScheduleSelectionCalendarDateDaysFormComponent extends AbstractSyncFormlyFormDirective {
513
+ constructor() {
514
+ super(...arguments);
515
+ this.fields = dbxScheduleSelectionCalendarDateDaysFormFields();
516
+ }
517
+ }
518
+ DbxScheduleSelectionCalendarDateDaysFormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxScheduleSelectionCalendarDateDaysFormComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
519
+ DbxScheduleSelectionCalendarDateDaysFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: DbxScheduleSelectionCalendarDateDaysFormComponent, selector: "dbx-schedule-selection-calendar-date-days-form", providers: [provideFormlyContext()], usesInheritance: true, ngImport: i0, template: `
520
+ <dbx-formly></dbx-formly>
521
+ `, isInline: true, dependencies: [{ kind: "component", type: i4.DbxFormlyFormComponent, selector: "dbx-formly", exportAs: ["formly"] }] });
522
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxScheduleSelectionCalendarDateDaysFormComponent, decorators: [{
523
+ type: Component,
524
+ args: [{
525
+ template: `
526
+ <dbx-formly></dbx-formly>
527
+ `,
528
+ selector: 'dbx-schedule-selection-calendar-date-days-form',
529
+ providers: [provideFormlyContext()]
530
+ }]
531
+ }] });
532
+
533
+ class DbxScheduleSelectionCalendarDateDaysComponent {
534
+ constructor(dbxCalendarStore, dbxCalendarScheduleSelectionStore) {
535
+ this.dbxCalendarStore = dbxCalendarStore;
536
+ this.dbxCalendarScheduleSelectionStore = dbxCalendarScheduleSelectionStore;
537
+ this.template$ = this.dbxCalendarScheduleSelectionStore.scheduleDays$.pipe(map(enabledDaysFromDateScheduleDayCodes), shareReplay());
538
+ this.isFormModified = (value) => {
539
+ const newSetValue = new Set(dateScheduleDayCodesFromEnabledDays(value));
540
+ return this.dbxCalendarScheduleSelectionStore.scheduleDays$.pipe(map((currentSet) => !setsAreEquivalent(currentSet, newSetValue)));
541
+ };
542
+ this.updateScheduleDays = (value) => {
543
+ this.dbxCalendarScheduleSelectionStore.setScheduleDays(new Set(dateScheduleDayCodesFromEnabledDays(value)));
544
+ return of(true);
545
+ };
546
+ }
547
+ }
548
+ DbxScheduleSelectionCalendarDateDaysComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxScheduleSelectionCalendarDateDaysComponent, deps: [{ token: i1.DbxCalendarStore }, { token: DbxCalendarScheduleSelectionStore }], target: i0.ɵɵFactoryTarget.Component });
549
+ DbxScheduleSelectionCalendarDateDaysComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: DbxScheduleSelectionCalendarDateDaysComponent, selector: "dbx-schedule-selection-calendar-date-days", ngImport: i0, template: `
550
+ <div class="dbx-schedule-selection-calendar-date-days" dbxAction dbxActionAutoTrigger dbxActionEnforceModified [instantTrigger]="true" [dbxActionHandler]="updateScheduleDays">
551
+ <dbx-schedule-selection-calendar-date-days-form dbxActionForm [dbxFormSource]="template$" [dbxActionFormModified]="isFormModified"></dbx-schedule-selection-calendar-date-days-form>
552
+ </div>
553
+ `, isInline: true, dependencies: [{ kind: "directive", type: i3$2.DbxActionDirective, selector: "dbx-action,[dbxAction],dbx-action-context,[dbxActionContext]", exportAs: ["action", "dbxAction"] }, { kind: "directive", type: i3$2.DbxActionHandlerDirective, selector: "[dbxActionHandler]", inputs: ["dbxActionHandler"] }, { kind: "directive", type: i3$2.DbxActionEnforceModifiedDirective, selector: "[dbxActionEnforceModified]", inputs: ["dbxActionEnforceModified"] }, { kind: "directive", type: i3$2.DbxActionAutoTriggerDirective, selector: "dbxActionAutoTrigger, [dbxActionAutoTrigger]", inputs: ["dbxActionAutoTrigger", "triggerDebounce", "triggerThrottle", "triggerErrorThrottle", "fastTrigger", "instantTrigger", "triggerLimit"] }, { kind: "directive", type: i4.DbxActionFormDirective, selector: "[dbxActionForm]", inputs: ["dbxActionFormValidator", "dbxActionFormModified", "formDisabledOnWorking"] }, { kind: "directive", type: i4.DbxFormSourceDirective, selector: "[dbxFormSource]", inputs: ["dbxFormSourceMode", "dbxFormSource"] }, { kind: "component", type: DbxScheduleSelectionCalendarDateDaysFormComponent, selector: "dbx-schedule-selection-calendar-date-days-form" }] });
554
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxScheduleSelectionCalendarDateDaysComponent, decorators: [{
555
+ type: Component,
556
+ args: [{
557
+ selector: 'dbx-schedule-selection-calendar-date-days',
558
+ template: `
559
+ <div class="dbx-schedule-selection-calendar-date-days" dbxAction dbxActionAutoTrigger dbxActionEnforceModified [instantTrigger]="true" [dbxActionHandler]="updateScheduleDays">
560
+ <dbx-schedule-selection-calendar-date-days-form dbxActionForm [dbxFormSource]="template$" [dbxActionFormModified]="isFormModified"></dbx-schedule-selection-calendar-date-days-form>
561
+ </div>
562
+ `
563
+ }]
564
+ }], ctorParameters: function () { return [{ type: i1.DbxCalendarStore }, { type: DbxCalendarScheduleSelectionStore }]; } });
565
+
566
+ class DbxScheduleSelectionCalendarDatePopoverContentComponent {
567
+ ngOnDestroy() { }
568
+ }
569
+ DbxScheduleSelectionCalendarDatePopoverContentComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxScheduleSelectionCalendarDatePopoverContentComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
570
+ DbxScheduleSelectionCalendarDatePopoverContentComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: DbxScheduleSelectionCalendarDatePopoverContentComponent, selector: "dbx-schedule-selection-calendar-date-popover-content", ngImport: i0, template: `
571
+ <div>
572
+ <dbx-schedule-selection-calendar-date-range></dbx-schedule-selection-calendar-date-range>
573
+ <dbx-schedule-selection-calendar-date-days></dbx-schedule-selection-calendar-date-days>
574
+ </div>
575
+ `, isInline: true, dependencies: [{ kind: "component", type: DbxScheduleSelectionCalendarDateDaysComponent, selector: "dbx-schedule-selection-calendar-date-days" }, { kind: "component", type: DbxScheduleSelectionCalendarDateRangeComponent, selector: "dbx-schedule-selection-calendar-date-range", inputs: ["required", "appearance", "label", "hint", "disabled", "showCustomize"] }] });
576
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxScheduleSelectionCalendarDatePopoverContentComponent, decorators: [{
577
+ type: Component,
578
+ args: [{
579
+ selector: 'dbx-schedule-selection-calendar-date-popover-content',
580
+ template: `
581
+ <div>
582
+ <dbx-schedule-selection-calendar-date-range></dbx-schedule-selection-calendar-date-range>
583
+ <dbx-schedule-selection-calendar-date-days></dbx-schedule-selection-calendar-date-days>
584
+ </div>
585
+ `
586
+ }]
587
+ }] });
588
+
589
+ const DEFAULT_SCHEDULE_SELECTION_CALENDAR_DATE_POPOVER_KEY = 'calendarselection';
590
+ class DbxScheduleSelectionCalendarDatePopoverComponent extends AbstractPopoverDirective {
591
+ static openPopover(popoverService, { origin, injector }, popoverKey) {
592
+ return popoverService.open({
593
+ key: popoverKey ?? DEFAULT_SCHEDULE_SELECTION_CALENDAR_DATE_POPOVER_KEY,
594
+ origin,
595
+ componentClass: DbxScheduleSelectionCalendarDatePopoverComponent,
596
+ injector
597
+ });
598
+ }
599
+ }
600
+ DbxScheduleSelectionCalendarDatePopoverComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxScheduleSelectionCalendarDatePopoverComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
601
+ DbxScheduleSelectionCalendarDatePopoverComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: DbxScheduleSelectionCalendarDatePopoverComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: `
602
+ <dbx-popover-content>
603
+ <dbx-popover-scroll-content>
604
+ <dbx-schedule-selection-calendar-date-popover-content (close)="close()"></dbx-schedule-selection-calendar-date-popover-content>
605
+ </dbx-popover-scroll-content>
606
+ </dbx-popover-content>
607
+ `, isInline: true, dependencies: [{ kind: "component", type: i1$1.DbxPopoverContentComponent, selector: "dbx-popover-content" }, { kind: "component", type: i1$1.DbxPopoverScrollContentComponent, selector: "dbx-popover-scroll-content" }, { kind: "component", type: DbxScheduleSelectionCalendarDatePopoverContentComponent, selector: "dbx-schedule-selection-calendar-date-popover-content" }] });
608
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxScheduleSelectionCalendarDatePopoverComponent, decorators: [{
609
+ type: Component,
610
+ args: [{
611
+ template: `
612
+ <dbx-popover-content>
613
+ <dbx-popover-scroll-content>
614
+ <dbx-schedule-selection-calendar-date-popover-content (close)="close()"></dbx-schedule-selection-calendar-date-popover-content>
615
+ </dbx-popover-scroll-content>
616
+ </dbx-popover-content>
617
+ `
618
+ }]
619
+ }] });
620
+
621
+ class DbxScheduleSelectionCalendarDatePopoverButtonComponent {
622
+ constructor(popoverService, dbxCalendarScheduleSelectionStore, injector) {
623
+ this.popoverService = popoverService;
624
+ this.dbxCalendarScheduleSelectionStore = dbxCalendarScheduleSelectionStore;
625
+ this.injector = injector;
626
+ this.buttonText$ = this.dbxCalendarScheduleSelectionStore.currentDateRange$.pipe(map((x) => {
627
+ if (x?.start && x.end) {
628
+ return `${formatToMonthDayString(x.start)} - ${formatToMonthDayString(x.end)}`;
629
+ }
630
+ else {
631
+ return 'Pick a Date Range';
632
+ }
633
+ }), shareReplay(1));
634
+ }
635
+ openPopover() {
636
+ DbxScheduleSelectionCalendarDatePopoverComponent.openPopover(this.popoverService, { origin: this.buttonPopoverOrigin, injector: this.injector });
637
+ }
638
+ }
639
+ DbxScheduleSelectionCalendarDatePopoverButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxScheduleSelectionCalendarDatePopoverButtonComponent, deps: [{ token: i1$1.DbxPopoverService }, { token: DbxCalendarScheduleSelectionStore }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
640
+ DbxScheduleSelectionCalendarDatePopoverButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: DbxScheduleSelectionCalendarDatePopoverButtonComponent, selector: "dbx-schedule-selection-calendar-date-popover-button", viewQueries: [{ propertyName: "buttonPopoverOrigin", first: true, predicate: ["buttonPopoverOrigin"], descendants: true, read: ElementRef }], ngImport: i0, template: `
641
+ <dbx-button #buttonPopoverOrigin icon="date_range" [raised]="true" color="accent" [text]="buttonText$ | async" (buttonClick)="openPopover()"></dbx-button>
642
+ `, isInline: true, dependencies: [{ kind: "component", type: i1$1.DbxButtonComponent, selector: "dbx-button", inputs: ["type", "raised", "stroked", "flat", "color", "customButtonColor", "customTextColor", "customSpinnerColor"] }, { kind: "pipe", type: i3$1.AsyncPipe, name: "async" }] });
643
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxScheduleSelectionCalendarDatePopoverButtonComponent, decorators: [{
644
+ type: Component,
645
+ args: [{
646
+ selector: 'dbx-schedule-selection-calendar-date-popover-button',
647
+ template: `
648
+ <dbx-button #buttonPopoverOrigin icon="date_range" [raised]="true" color="accent" [text]="buttonText$ | async" (buttonClick)="openPopover()"></dbx-button>
649
+ `
650
+ }]
651
+ }], ctorParameters: function () { return [{ type: i1$1.DbxPopoverService }, { type: DbxCalendarScheduleSelectionStore }, { type: i0.Injector }]; }, propDecorators: { buttonPopoverOrigin: [{
652
+ type: ViewChild,
653
+ args: ['buttonPopoverOrigin', { read: ElementRef }]
654
+ }] } });
655
+
656
+ class DbxScheduleSelectionCalendarCellComponent {
657
+ constructor(dbxCalendarScheduleSelectionStore) {
658
+ this.dbxCalendarScheduleSelectionStore = dbxCalendarScheduleSelectionStore;
659
+ this.content = {};
660
+ }
661
+ get icon() {
662
+ return this.content.icon;
663
+ }
664
+ get text() {
665
+ return this.content.text;
666
+ }
667
+ set day(day) {
668
+ this.dbxCalendarScheduleSelectionStore.cellContentFactory$.pipe(first()).subscribe((fn) => {
669
+ this.content = fn(day);
670
+ });
671
+ }
672
+ }
673
+ DbxScheduleSelectionCalendarCellComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxScheduleSelectionCalendarCellComponent, deps: [{ token: DbxCalendarScheduleSelectionStore }], target: i0.ɵɵFactoryTarget.Component });
674
+ DbxScheduleSelectionCalendarCellComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: DbxScheduleSelectionCalendarCellComponent, selector: "dbx-schedule-selection-calendar-cell", inputs: { day: "day" }, host: { classAttribute: "dbx-schedule-selection-calendar-cell" }, ngImport: i0, template: `
675
+ <mat-icon *ngIf="icon">{{ icon }}</mat-icon>
676
+ <span>{{ text }}</span>
677
+ `, isInline: true, dependencies: [{ kind: "directive", type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3$3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
678
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxScheduleSelectionCalendarCellComponent, decorators: [{
679
+ type: Component,
680
+ args: [{
681
+ selector: 'dbx-schedule-selection-calendar-cell',
682
+ template: `
683
+ <mat-icon *ngIf="icon">{{ icon }}</mat-icon>
684
+ <span>{{ text }}</span>
685
+ `,
686
+ host: {
687
+ class: 'dbx-schedule-selection-calendar-cell'
688
+ },
689
+ changeDetection: ChangeDetectionStrategy.OnPush
690
+ }]
691
+ }], ctorParameters: function () { return [{ type: DbxCalendarScheduleSelectionStore }]; }, propDecorators: { day: [{
692
+ type: Input
693
+ }] } });
694
+
695
+ class DbxScheduleSelectionCalendarComponent {
696
+ constructor(calendarStore, dbxCalendarScheduleSelectionStore) {
697
+ this.calendarStore = calendarStore;
698
+ this.dbxCalendarScheduleSelectionStore = dbxCalendarScheduleSelectionStore;
699
+ this.clickEvent = new EventEmitter();
700
+ // refresh any time the selected day function updates
701
+ this.state$ = this.dbxCalendarScheduleSelectionStore.state$;
702
+ this.refresh$ = this.state$.pipe(throttleTime$1(100), map(() => undefined));
703
+ this.events$ = this.calendarStore.visibleEvents$.pipe(map(prepareAndSortCalendarEvents), shareReplay(1));
704
+ this.viewDate$ = this.calendarStore.date$;
705
+ }
706
+ dayClicked({ date }) {
707
+ this.dbxCalendarScheduleSelectionStore.toggleSelectedDates(date);
708
+ }
709
+ eventClicked(action, event) {
710
+ this.clickEvent.emit({ action, event });
711
+ }
712
+ beforeMonthViewRender({ body }) {
713
+ this.state$.pipe(first()).subscribe(({ isEnabledDay, indexFactory, isEnabledFilterDay, allowedDaysOfWeek }) => {
714
+ body.forEach((viewDay) => {
715
+ const { date } = viewDay;
716
+ const i = indexFactory(date);
717
+ const day = date.getDay();
718
+ let state;
719
+ if (!isEnabledFilterDay(i)) {
720
+ viewDay.cssClass = 'cal-day-not-applicable';
721
+ state = CalendarScheduleSelectionDayState.NOT_APPLICABLE;
722
+ }
723
+ else if (!allowedDaysOfWeek.has(day)) {
724
+ viewDay.cssClass = 'cal-day-disabled';
725
+ state = CalendarScheduleSelectionDayState.DISABLED;
726
+ }
727
+ else if (isEnabledDay(i)) {
728
+ viewDay.cssClass = 'cal-day-selected';
729
+ state = CalendarScheduleSelectionDayState.SELECTED;
730
+ }
731
+ else {
732
+ viewDay.cssClass = 'cal-day-not-selected';
733
+ state = CalendarScheduleSelectionDayState.NOT_SELECTED;
734
+ }
735
+ viewDay.meta = {
736
+ state,
737
+ i
738
+ };
739
+ });
740
+ });
741
+ }
742
+ ngOnDestroy() {
743
+ this.clickEvent.complete();
744
+ }
745
+ }
746
+ DbxScheduleSelectionCalendarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxScheduleSelectionCalendarComponent, deps: [{ token: i1.DbxCalendarStore }, { token: DbxCalendarScheduleSelectionStore }], target: i0.ɵɵFactoryTarget.Component });
747
+ DbxScheduleSelectionCalendarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: DbxScheduleSelectionCalendarComponent, selector: "dbx-schedule-selection-calendar", outputs: { clickEvent: "clickEvent" }, providers: [DbxCalendarStore], ngImport: i0, template: "<dbx-calendar-base class=\"dbx-schedule-selection-calendar\">\n <ng-container controls>\n <dbx-schedule-selection-calendar-date-popover-button></dbx-schedule-selection-calendar-date-popover-button>\n </ng-container>\n <div class=\"dbx-calendar-content dbx-calendar-content-month\">\n <mwl-calendar-month-view [refresh]=\"refresh$\" [viewDate]=\"(viewDate$ | async)!\" [events]=\"(events$ | async)!\" (dayClicked)=\"dayClicked($event.day)\" (eventClicked)=\"eventClicked('Clicked', $event.event)\" (beforeViewRender)=\"beforeMonthViewRender($event)\" [cellTemplate]=\"monthDayCellTemplate\"></mwl-calendar-month-view>\n </div>\n</dbx-calendar-base>\n\n<!-- Cell -->\n<ng-template #monthDayCellTemplate let-day=\"day\" let-locale=\"locale\">\n <div class=\"cal-cell-top\">\n <span class=\"cal-day-badge\" *ngIf=\"day.badgeTotal > 0\">{{ day.badgeTotal }}</span>\n <span class=\"cal-day-number\">{{ day.date | calendarDate: 'monthViewDayNumber':locale }}</span>\n </div>\n <dbx-schedule-selection-calendar-cell [day]=\"day\"></dbx-schedule-selection-calendar-cell>\n</ng-template>\n", dependencies: [{ kind: "component", type: i1.DbxCalendarBaseComponent, selector: "dbx-calendar-base" }, { kind: "directive", type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i4$1.CalendarMonthViewComponent, selector: "mwl-calendar-month-view", inputs: ["viewDate", "events", "excludeDays", "activeDayIsOpen", "activeDay", "refresh", "locale", "tooltipPlacement", "tooltipTemplate", "tooltipAppendToBody", "tooltipDelay", "weekStartsOn", "headerTemplate", "cellTemplate", "openDayEventsTemplate", "eventTitleTemplate", "eventActionsTemplate", "weekendDays"], outputs: ["beforeViewRender", "dayClicked", "eventClicked", "columnHeaderClicked", "eventTimesChanged"] }, { kind: "component", type: DbxScheduleSelectionCalendarDatePopoverButtonComponent, selector: "dbx-schedule-selection-calendar-date-popover-button" }, { kind: "component", type: DbxScheduleSelectionCalendarCellComponent, selector: "dbx-schedule-selection-calendar-cell", inputs: ["day"] }, { kind: "pipe", type: i3$1.AsyncPipe, name: "async" }, { kind: "pipe", type: i4$1.ɵCalendarDatePipe, name: "calendarDate" }] });
748
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxScheduleSelectionCalendarComponent, decorators: [{
749
+ type: Component,
750
+ args: [{ selector: 'dbx-schedule-selection-calendar', providers: [DbxCalendarStore], template: "<dbx-calendar-base class=\"dbx-schedule-selection-calendar\">\n <ng-container controls>\n <dbx-schedule-selection-calendar-date-popover-button></dbx-schedule-selection-calendar-date-popover-button>\n </ng-container>\n <div class=\"dbx-calendar-content dbx-calendar-content-month\">\n <mwl-calendar-month-view [refresh]=\"refresh$\" [viewDate]=\"(viewDate$ | async)!\" [events]=\"(events$ | async)!\" (dayClicked)=\"dayClicked($event.day)\" (eventClicked)=\"eventClicked('Clicked', $event.event)\" (beforeViewRender)=\"beforeMonthViewRender($event)\" [cellTemplate]=\"monthDayCellTemplate\"></mwl-calendar-month-view>\n </div>\n</dbx-calendar-base>\n\n<!-- Cell -->\n<ng-template #monthDayCellTemplate let-day=\"day\" let-locale=\"locale\">\n <div class=\"cal-cell-top\">\n <span class=\"cal-day-badge\" *ngIf=\"day.badgeTotal > 0\">{{ day.badgeTotal }}</span>\n <span class=\"cal-day-number\">{{ day.date | calendarDate: 'monthViewDayNumber':locale }}</span>\n </div>\n <dbx-schedule-selection-calendar-cell [day]=\"day\"></dbx-schedule-selection-calendar-cell>\n</ng-template>\n" }]
751
+ }], ctorParameters: function () { return [{ type: i1.DbxCalendarStore }, { type: DbxCalendarScheduleSelectionStore }]; }, propDecorators: { clickEvent: [{
752
+ type: Output
753
+ }] } });
754
+
755
+ class DbxScheduleSelectionCalendarDateDialogComponent extends AbstractDialogDirective {
756
+ static openDialog(matDialog, { injector }) {
757
+ return matDialog.open(DbxScheduleSelectionCalendarDateDialogComponent, {
758
+ injector,
759
+ width: '80vw',
760
+ minWidth: 460
761
+ });
762
+ }
763
+ }
764
+ DbxScheduleSelectionCalendarDateDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxScheduleSelectionCalendarDateDialogComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
765
+ DbxScheduleSelectionCalendarDateDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: DbxScheduleSelectionCalendarDateDialogComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: `
766
+ <dbx-dialog-content>
767
+ <dbx-dialog-content-close (close)="close()"></dbx-dialog-content-close>
768
+ <dbx-schedule-selection-calendar></dbx-schedule-selection-calendar>
769
+ <dbx-dialog-content-footer closeText="Close Calendar" (close)="close()"></dbx-dialog-content-footer>
770
+ </dbx-dialog-content>
771
+ `, isInline: true, dependencies: [{ kind: "directive", type: i1$1.DbxDialogContentDirective, selector: "dbx-dialog-content,[dbxDialogContent].dbx-dialog-content", inputs: ["width"] }, { kind: "component", type: i1$1.DbxDialogContentFooterComponent, selector: "dbx-dialog-content-footer", inputs: ["closeText"], outputs: ["close"] }, { kind: "component", type: i1$1.DbxDialogContentCloseComponent, selector: "dbx-dialog-content-close", outputs: ["close"] }, { kind: "component", type: DbxScheduleSelectionCalendarComponent, selector: "dbx-schedule-selection-calendar", outputs: ["clickEvent"] }] });
772
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxScheduleSelectionCalendarDateDialogComponent, decorators: [{
773
+ type: Component,
774
+ args: [{
775
+ template: `
776
+ <dbx-dialog-content>
777
+ <dbx-dialog-content-close (close)="close()"></dbx-dialog-content-close>
778
+ <dbx-schedule-selection-calendar></dbx-schedule-selection-calendar>
779
+ <dbx-dialog-content-footer closeText="Close Calendar" (close)="close()"></dbx-dialog-content-footer>
780
+ </dbx-dialog-content>
781
+ `
782
+ }]
783
+ }] });
784
+
785
+ class DbxScheduleSelectionCalendarDateDialogButtonComponent {
786
+ constructor(matDialog, injector) {
787
+ this.matDialog = matDialog;
788
+ this.injector = injector;
789
+ this.buttonText = 'Customize';
790
+ }
791
+ clickCustomize() {
792
+ DbxScheduleSelectionCalendarDateDialogComponent.openDialog(this.matDialog, { injector: this.injector });
793
+ }
794
+ }
795
+ DbxScheduleSelectionCalendarDateDialogButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxScheduleSelectionCalendarDateDialogButtonComponent, deps: [{ token: i1$2.MatDialog }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
796
+ DbxScheduleSelectionCalendarDateDialogButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: DbxScheduleSelectionCalendarDateDialogButtonComponent, selector: "dbx-schedule-selection-calendar-date-dialog-button", inputs: { buttonText: "buttonText" }, ngImport: i0, template: `
797
+ <button mat-raised-button color="accent" (click)="clickCustomize()">{{ buttonText }}</button>
798
+ `, isInline: true, dependencies: [{ kind: "component", type: i2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }] });
799
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxScheduleSelectionCalendarDateDialogButtonComponent, decorators: [{
800
+ type: Component,
801
+ args: [{
802
+ selector: 'dbx-schedule-selection-calendar-date-dialog-button',
803
+ template: `
804
+ <button mat-raised-button color="accent" (click)="clickCustomize()">{{ buttonText }}</button>
805
+ `
806
+ }]
807
+ }], ctorParameters: function () { return [{ type: i1$2.MatDialog }, { type: i0.Injector }]; }, propDecorators: { buttonText: [{
808
+ type: Input
809
+ }] } });
810
+
811
+ class DbxFormCalendarDateScheduleRangeFieldComponent extends FieldType {
812
+ constructor(compact, dbxCalendarScheduleSelectionStore, ngZone) {
813
+ super();
814
+ this.compact = compact;
815
+ this.dbxCalendarScheduleSelectionStore = dbxCalendarScheduleSelectionStore;
816
+ this.ngZone = ngZone;
817
+ this._syncSub = new SubscriptionObject();
818
+ this._valueSub = new SubscriptionObject();
819
+ this._filterSub = new SubscriptionObject();
820
+ this._formControlObs = new BehaviorSubject(undefined);
821
+ this.formControl$ = this._formControlObs.pipe(filterMaybe());
822
+ this.value$ = this.formControl$.pipe(switchMap$1((control) => control.valueChanges.pipe(startWith(control.value))), shareReplay(1));
823
+ }
824
+ get formGroupName() {
825
+ return this.field.key;
826
+ }
827
+ get formGroup() {
828
+ return this.form;
829
+ }
830
+ get appearance() {
831
+ return this.props.appearance ?? 'standard';
832
+ }
833
+ get label() {
834
+ return this.field.props?.label;
835
+ }
836
+ get description() {
837
+ return this.props.description;
838
+ }
839
+ get isReadonlyOrDisabled() {
840
+ return this.props.readonly || this.disabled;
841
+ }
842
+ get showCustomize() {
843
+ return !this.props.hideCustomize;
844
+ }
845
+ get filter() {
846
+ return this.props.filter;
847
+ }
848
+ ngOnInit() {
849
+ this._formControlObs.next(this.formControl);
850
+ this._syncSub.subscription = this.value$.pipe(distinctUntilChanged(isSameDateScheduleRange)).subscribe((x) => {
851
+ this.dbxCalendarScheduleSelectionStore.setDateScheduleRangeValue(x);
852
+ });
853
+ this._valueSub.subscription = this.dbxCalendarScheduleSelectionStore.currentDateScheduleRangeValue$.subscribe((x) => {
854
+ this.formControl.setValue(x);
855
+ });
856
+ const filter = this.filter;
857
+ if (filter != null) {
858
+ this._filterSub.subscription = this.dbxCalendarScheduleSelectionStore.setFilter(asObservable(filter));
859
+ }
860
+ }
861
+ ngOnDestroy() {
862
+ super.ngOnDestroy();
863
+ this._syncSub.destroy();
864
+ this._valueSub.destroy();
865
+ this._formControlObs.complete();
866
+ this._filterSub.destroy();
867
+ }
868
+ }
869
+ DbxFormCalendarDateScheduleRangeFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFormCalendarDateScheduleRangeFieldComponent, deps: [{ token: i1$1.CompactContextStore, optional: true }, { token: DbxCalendarScheduleSelectionStore }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
870
+ DbxFormCalendarDateScheduleRangeFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: DbxFormCalendarDateScheduleRangeFieldComponent, selector: "ng-component", providers: [provideCalendarScheduleSelectionStoreIfParentIsUnavailable()], usesInheritance: true, ngImport: i0, template: `
871
+ <div class="dbx-schedule-selection-field">
872
+ <dbx-schedule-selection-calendar-date-range [showCustomize]="showCustomize" [appearance]="appearance" [required]="required" [disabled]="isReadonlyOrDisabled" [label]="label" [hint]="description">
873
+ <dbx-schedule-selection-calendar-date-dialog-button customizeButton></dbx-schedule-selection-calendar-date-dialog-button>
874
+ </dbx-schedule-selection-calendar-date-range>
875
+ </div>
876
+ `, isInline: true, dependencies: [{ kind: "component", type: DbxScheduleSelectionCalendarDateRangeComponent, selector: "dbx-schedule-selection-calendar-date-range", inputs: ["required", "appearance", "label", "hint", "disabled", "showCustomize"] }, { kind: "component", type: DbxScheduleSelectionCalendarDateDialogButtonComponent, selector: "dbx-schedule-selection-calendar-date-dialog-button", inputs: ["buttonText"] }] });
877
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFormCalendarDateScheduleRangeFieldComponent, decorators: [{
878
+ type: Component,
879
+ args: [{
880
+ template: `
881
+ <div class="dbx-schedule-selection-field">
882
+ <dbx-schedule-selection-calendar-date-range [showCustomize]="showCustomize" [appearance]="appearance" [required]="required" [disabled]="isReadonlyOrDisabled" [label]="label" [hint]="description">
883
+ <dbx-schedule-selection-calendar-date-dialog-button customizeButton></dbx-schedule-selection-calendar-date-dialog-button>
884
+ </dbx-schedule-selection-calendar-date-range>
885
+ </div>
886
+ `,
887
+ providers: [provideCalendarScheduleSelectionStoreIfParentIsUnavailable()]
888
+ }]
889
+ }], ctorParameters: function () { return [{ type: i1$1.CompactContextStore, decorators: [{
890
+ type: Optional
891
+ }] }, { type: DbxCalendarScheduleSelectionStore }, { type: i0.NgZone }]; } });
892
+
893
+ const declarations = [
894
+ //
895
+ DbxScheduleSelectionCalendarComponent,
896
+ DbxScheduleSelectionCalendarDateDaysComponent,
897
+ DbxScheduleSelectionCalendarDateDaysFormComponent,
898
+ DbxScheduleSelectionCalendarDateRangeComponent,
899
+ DbxScheduleSelectionCalendarDatePopoverButtonComponent,
900
+ DbxScheduleSelectionCalendarCellComponent,
901
+ DbxScheduleSelectionCalendarDatePopoverComponent,
902
+ DbxScheduleSelectionCalendarDatePopoverContentComponent,
903
+ DbxCalendarScheduleSelectionStoreInjectionBlockDirective,
904
+ DbxScheduleSelectionCalendarDateDialogComponent,
905
+ DbxScheduleSelectionCalendarDateDialogButtonComponent
906
+ ];
907
+ class DbxFormCalendarModule {
908
+ }
909
+ DbxFormCalendarModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFormCalendarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
910
+ DbxFormCalendarModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.12", ngImport: i0, type: DbxFormCalendarModule, declarations: [
911
+ //
912
+ DbxScheduleSelectionCalendarComponent,
913
+ DbxScheduleSelectionCalendarDateDaysComponent,
914
+ DbxScheduleSelectionCalendarDateDaysFormComponent,
915
+ DbxScheduleSelectionCalendarDateRangeComponent,
916
+ DbxScheduleSelectionCalendarDatePopoverButtonComponent,
917
+ DbxScheduleSelectionCalendarCellComponent,
918
+ DbxScheduleSelectionCalendarDatePopoverComponent,
919
+ DbxScheduleSelectionCalendarDatePopoverContentComponent,
920
+ DbxCalendarScheduleSelectionStoreInjectionBlockDirective,
921
+ DbxScheduleSelectionCalendarDateDialogComponent,
922
+ DbxScheduleSelectionCalendarDateDialogButtonComponent], imports: [
923
+ //
924
+ DbxActionModule,
925
+ DbxFormModule,
926
+ DbxFormlyModule,
927
+ DbxCalendarModule,
928
+ CommonModule,
929
+ MatIconModule,
930
+ MatButtonModule,
931
+ FormsModule,
932
+ ReactiveFormsModule,
933
+ MatFormFieldModule,
934
+ MatButtonToggleModule,
935
+ DbxButtonModule,
936
+ MatDatepickerModule,
937
+ DbxDialogInteractionModule,
938
+ DbxPopoverInteractionModule,
939
+ CalendarModule,
940
+ CalendarDayModule,
941
+ FlexLayoutModule,
942
+ CalendarWeekModule], exports: [
943
+ //
944
+ DbxScheduleSelectionCalendarComponent,
945
+ DbxScheduleSelectionCalendarDateDaysComponent,
946
+ DbxScheduleSelectionCalendarDateDaysFormComponent,
947
+ DbxScheduleSelectionCalendarDateRangeComponent,
948
+ DbxScheduleSelectionCalendarDatePopoverButtonComponent,
949
+ DbxScheduleSelectionCalendarCellComponent,
950
+ DbxScheduleSelectionCalendarDatePopoverComponent,
951
+ DbxScheduleSelectionCalendarDatePopoverContentComponent,
952
+ DbxCalendarScheduleSelectionStoreInjectionBlockDirective,
953
+ DbxScheduleSelectionCalendarDateDialogComponent,
954
+ DbxScheduleSelectionCalendarDateDialogButtonComponent] });
955
+ DbxFormCalendarModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFormCalendarModule, imports: [
956
+ //
957
+ DbxActionModule,
958
+ DbxFormModule,
959
+ DbxFormlyModule,
960
+ DbxCalendarModule,
961
+ CommonModule,
962
+ MatIconModule,
963
+ MatButtonModule,
964
+ FormsModule,
965
+ ReactiveFormsModule,
966
+ MatFormFieldModule,
967
+ MatButtonToggleModule,
968
+ DbxButtonModule,
969
+ MatDatepickerModule,
970
+ DbxDialogInteractionModule,
971
+ DbxPopoverInteractionModule,
972
+ CalendarModule,
973
+ CalendarDayModule,
974
+ FlexLayoutModule,
975
+ CalendarWeekModule] });
976
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFormCalendarModule, decorators: [{
977
+ type: NgModule,
978
+ args: [{
979
+ imports: [
980
+ //
981
+ DbxActionModule,
982
+ DbxFormModule,
983
+ DbxFormlyModule,
984
+ DbxCalendarModule,
985
+ CommonModule,
986
+ MatIconModule,
987
+ MatButtonModule,
988
+ FormsModule,
989
+ ReactiveFormsModule,
990
+ MatFormFieldModule,
991
+ MatButtonToggleModule,
992
+ DbxButtonModule,
993
+ MatDatepickerModule,
994
+ DbxDialogInteractionModule,
995
+ DbxPopoverInteractionModule,
996
+ CalendarModule,
997
+ CalendarDayModule,
998
+ FlexLayoutModule,
999
+ CalendarWeekModule
1000
+ ],
1001
+ declarations,
1002
+ exports: declarations
1003
+ }]
1004
+ }] });
1005
+
1006
+ class DbxFormDateScheduleRangeFieldModule {
1007
+ }
1008
+ DbxFormDateScheduleRangeFieldModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFormDateScheduleRangeFieldModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1009
+ DbxFormDateScheduleRangeFieldModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.12", ngImport: i0, type: DbxFormDateScheduleRangeFieldModule, declarations: [DbxFormCalendarDateScheduleRangeFieldComponent], imports: [CommonModule,
1010
+ MatIconModule,
1011
+ DbxFormCalendarModule,
1012
+ MatButtonModule,
1013
+ DbxTextModule,
1014
+ FormsModule,
1015
+ ReactiveFormsModule,
1016
+ MatInputModule, i1$3.FormlyModule] });
1017
+ DbxFormDateScheduleRangeFieldModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFormDateScheduleRangeFieldModule, imports: [CommonModule,
1018
+ MatIconModule,
1019
+ DbxFormCalendarModule,
1020
+ MatButtonModule,
1021
+ DbxTextModule,
1022
+ FormsModule,
1023
+ ReactiveFormsModule,
1024
+ MatInputModule,
1025
+ FormlyModule.forChild({
1026
+ types: [{ name: 'date-schedule-range', component: DbxFormCalendarDateScheduleRangeFieldComponent }]
1027
+ })] });
1028
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFormDateScheduleRangeFieldModule, decorators: [{
1029
+ type: NgModule,
1030
+ args: [{
1031
+ imports: [
1032
+ CommonModule,
1033
+ MatIconModule,
1034
+ DbxFormCalendarModule,
1035
+ MatButtonModule,
1036
+ DbxTextModule,
1037
+ FormsModule,
1038
+ ReactiveFormsModule,
1039
+ MatInputModule,
1040
+ FormlyModule.forChild({
1041
+ types: [{ name: 'date-schedule-range', component: DbxFormCalendarDateScheduleRangeFieldComponent }]
1042
+ })
1043
+ ],
1044
+ declarations: [DbxFormCalendarDateScheduleRangeFieldComponent]
1045
+ }]
1046
+ }] });
1047
+
1048
+ // export * from './selection';
1049
+
1050
+ /**
1051
+ * Generated bundle index. Do not edit.
1052
+ */
1053
+
1054
+ export { CalendarScheduleSelectionDayState, DEFAULT_SCHEDULE_SELECTION_CALENDAR_DATE_POPOVER_KEY, DbxCalendarScheduleSelectionStore, DbxCalendarScheduleSelectionStoreInjectionBlockDirective, DbxCalendarScheduleSelectionStoreProviderBlock, DbxFormCalendarDateScheduleRangeFieldComponent, DbxFormCalendarModule, DbxFormDateScheduleRangeFieldModule, DbxScheduleSelectionCalendarCellComponent, DbxScheduleSelectionCalendarComponent, DbxScheduleSelectionCalendarDateDaysComponent, DbxScheduleSelectionCalendarDateDaysFormComponent, DbxScheduleSelectionCalendarDateDialogButtonComponent, DbxScheduleSelectionCalendarDateDialogComponent, DbxScheduleSelectionCalendarDatePopoverButtonComponent, DbxScheduleSelectionCalendarDatePopoverComponent, DbxScheduleSelectionCalendarDatePopoverContentComponent, DbxScheduleSelectionCalendarDateRangeComponent, computeCalendarScheduleSelectionDateBlockRange, computeCalendarScheduleSelectionRange, computeScheduleSelectionRangeAndExclusion, computeScheduleSelectionValue, dateScheduleRangeField, dbxScheduleSelectionCalendarDateDaysFormDayFields, dbxScheduleSelectionCalendarDateDaysFormFields, defaultCalendarScheduleSelectionCellContentFactory, finalizeNewCalendarScheduleSelectionState, initialCalendarScheduleSelectionState, isEnabledDayInCalendarScheduleSelectionState, noSelectionCalendarScheduleSelectionState, provideCalendarScheduleSelectionStoreIfParentIsUnavailable, updateStateWithChangedDates, updateStateWithChangedRange, updateStateWithChangedScheduleDays, updateStateWithDateScheduleRangeValue, updateStateWithFilter };
1055
+ //# sourceMappingURL=dereekb-dbx-form-calendar.mjs.map