@dereekb/dbx-form 9.24.3 → 9.24.5

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.
@@ -3,14 +3,14 @@ import { formlyField, propsAndConfigForFieldConfig, flexLayoutWrapper, toggleFie
3
3
  import * as i0 from '@angular/core';
4
4
  import { Injectable, SkipSelf, Directive, Injector, Optional, Component, Inject, Input, ElementRef, ViewChild, ChangeDetectionStrategy, EventEmitter, Output, InjectionToken, NgModule } from '@angular/core';
5
5
  import { FieldType } from '@ngx-formly/material';
6
- import { switchMap, first, tap, map, distinctUntilChanged, shareReplay, combineLatestWith, BehaviorSubject, of, startWith, filter, throttleTime } from 'rxjs';
7
- import { filterMaybe, SubscriptionObject, asObservable } from '@dereekb/rxjs';
8
- import { DateScheduleDayCode, expandDateScheduleDayCodesToDayOfWeekSet, dateTimingRelativeIndexFactory, dateBlockDayOfWeekFactory, findMaxDate, findMinDate, isSameDateRange, isSameDateDay, isSameDate, isSameDateScheduleRange, dateTimingRelativeIndexArrayFactory, isInfiniteDateRange, copyDateScheduleDateFilterConfig, dateScheduleDateFilter, dateTimezoneUtcNormal, expandDateScheduleDayCodes, isDateInDateRangeFunction, isDateWithinDateBlockRangeFunction, copyHoursAndMinutesFromDate, dateScheduleEncodedWeek, dateBlockTimingDateFactory, enabledDaysFromDateScheduleDayCodes, dateScheduleDayCodesFromEnabledDays, formatToMonthDayString } from '@dereekb/date';
9
- import { setsAreEquivalent, unique, mergeArrays, iterableToArray, toggleInSet, addToSet, isIndexNumberInIndexRangeFunction, range, minAndMaxNumber, getDaysOfWeekNames, mergeObjects, KeyValueTypleValueFilter } from '@dereekb/util';
6
+ import { switchMap, first, tap, map, distinctUntilChanged, shareReplay, combineLatestWith, BehaviorSubject, of, startWith, filter, throttleTime, combineLatest } from 'rxjs';
7
+ import { filterMaybe, distinctUntilHasDifferentValues, SubscriptionObject, asObservable } from '@dereekb/rxjs';
8
+ import { DateScheduleDayCode, expandDateScheduleDayCodesToDayOfWeekSet, dateTimingRelativeIndexFactory, dateBlockDayOfWeekFactory, findMaxDate, findMinDate, isSameDateRange, isSameDateDay, isSameDate, expandDateScheduleRange, isSameDateScheduleRange, dateTimingRelativeIndexArrayFactory, isInfiniteDateRange, copyDateScheduleDateFilterConfig, dateScheduleDateFilter, dateTimezoneUtcNormal, expandDateScheduleDayCodes, isDateInDateRangeFunction, isDateWithinDateBlockRangeFunction, copyHoursAndMinutesFromDate, dateScheduleEncodedWeek, dateBlockTimingDateFactory, enabledDaysFromDateScheduleDayCodes, dateScheduleDayCodesFromEnabledDays, formatToMonthDayString } from '@dereekb/date';
9
+ import { setsAreEquivalent, unique, mergeArrays, iterableToArray, range, toggleInSet, removeFromSet, addToSet, isIndexNumberInIndexRangeFunction, minAndMaxNumber, getDaysOfWeekNames, mergeObjects, KeyValueTypleValueFilter } from '@dereekb/util';
10
10
  import { ComponentStore } from '@ngrx/component-store';
11
11
  import { startOfDay, endOfDay, isBefore } from 'date-fns';
12
12
  import * as i1$1 from '@dereekb/dbx-web';
13
- import { AbstractPopoverDirective, AbstractDialogDirective, DbxActionModule, DbxButtonModule, DbxDialogInteractionModule, DbxPopoverInteractionModule, DbxTextModule } from '@dereekb/dbx-web';
13
+ import { AbstractPopoverDirective, AbstractDialogDirective, sanitizeDbxDialogContentConfig, DbxActionModule, DbxButtonModule, DbxDialogInteractionModule, DbxPopoverInteractionModule, DbxTextModule } from '@dereekb/dbx-web';
14
14
  import * as i3 from '@angular/forms';
15
15
  import { FormGroup, FormControl, FormsModule, ReactiveFormsModule } from '@angular/forms';
16
16
  import * as i5 from '@angular/material/form-field';
@@ -96,7 +96,7 @@ function initialCalendarScheduleSelectionState() {
96
96
  return {
97
97
  start,
98
98
  indexFactory,
99
- selectedIndexes: new Set(),
99
+ toggledIndexes: new Set(),
100
100
  scheduleDays,
101
101
  allowedDaysOfWeek,
102
102
  indexDayOfWeek,
@@ -150,7 +150,10 @@ class DbxCalendarScheduleSelectionStore extends ComponentStore {
150
150
  }
151
151
  }), shareReplay(1));
152
152
  this.inputRange$ = this.currentInputRange$.pipe(filterMaybe(), shareReplay(1));
153
- this.selectedDates$ = this.state$.pipe(map((x) => x.selectedIndexes), distinctUntilChanged(), shareReplay(1));
153
+ /**
154
+ * @deprecated This is not the same as the current selection value. This is the set of manually togged off dates. It will be removed in a future update.
155
+ */
156
+ this.selectedDates$ = this.state$.pipe(map((x) => x.toggledIndexes), distinctUntilChanged(), shareReplay(1));
154
157
  this.isEnabledFilterDayFunction$ = this.state$.pipe(map((x) => x.isEnabledFilterDay), shareReplay(1));
155
158
  this.isEnabledDayFunction$ = this.state$.pipe(map((x) => x.isEnabledDay), shareReplay(1));
156
159
  this.currentDateRange$ = this.state$.pipe(map(computeCalendarScheduleSelectionRange), distinctUntilChanged((a, b) => isSameDateRange(a, b)), shareReplay(1));
@@ -164,6 +167,9 @@ class DbxCalendarScheduleSelectionStore extends ComponentStore {
164
167
  this.effectiveTimezone$ = this.state$.pipe(map((x) => (!calendarScheduleStartBeingUsedFromFilter(x) && x.timezone ? x.timezone : undefined)), distinctUntilChanged(), shareReplay(1));
165
168
  this.effectiveTimezoneNormal$ = this.state$.pipe(map((x) => (!calendarScheduleStartBeingUsedFromFilter(x) && x.timezoneNormal ? x.timezoneNormal : undefined)), distinctUntilChanged(), shareReplay(1));
166
169
  this.currentSelectionValue$ = this.state$.pipe(map((x) => x.currentSelectionValue), shareReplay(1));
170
+ this.currentSelectionValueDateBlockDurationSpan$ = this.currentSelectionValue$.pipe(map((x) => (x ? expandDateScheduleRange(x) : [])), shareReplay(1));
171
+ this.selectionValueSelectedIndexes$ = this.currentSelectionValueDateBlockDurationSpan$.pipe(map((x) => new Set(x.map((y) => y.i))), distinctUntilHasDifferentValues(), shareReplay(1));
172
+ this.selectionValue$ = this.currentSelectionValue$.pipe(filterMaybe(), shareReplay(1));
167
173
  this.currentSelectionValueWithTimezone$ = this.currentSelectionValue$.pipe(combineLatestWith(this.effectiveTimezoneNormal$), map(([x, timezoneNormal]) => {
168
174
  if (x && timezoneNormal) {
169
175
  x = {
@@ -172,6 +178,8 @@ class DbxCalendarScheduleSelectionStore extends ComponentStore {
172
178
  }
173
179
  return x;
174
180
  }), distinctUntilChanged(), shareReplay(1));
181
+ this.selectionValueWithTimezone$ = this.currentSelectionValueWithTimezone$.pipe(filterMaybe(), shareReplay(1));
182
+ this.selectionValueWithTimezoneDateBlockDurationSpan$ = this.selectionValueWithTimezone$.pipe(map((x) => expandDateScheduleRange(x)), shareReplay(1));
175
183
  this.nextToggleSelection$ = this.hasConfiguredMinMaxRange$.pipe(switchMap((hasConfiguredMinMaxRange) => {
176
184
  let obs;
177
185
  if (hasConfiguredMinMaxRange) {
@@ -182,11 +190,10 @@ class DbxCalendarScheduleSelectionStore extends ComponentStore {
182
190
  }
183
191
  return obs;
184
192
  }), shareReplay(1));
185
- this.selectionValue$ = this.currentSelectionValueWithTimezone$.pipe(filterMaybe(), shareReplay(1));
186
193
  this.currentDateScheduleRangeValue$ = this.currentSelectionValueWithTimezone$.pipe(map((x) => x === null || x === void 0 ? void 0 : x.dateScheduleRange), distinctUntilChanged(isSameDateScheduleRange), shareReplay(1));
187
194
  this.dateScheduleRangeValue$ = this.currentDateScheduleRangeValue$.pipe(filterMaybe(), shareReplay(1));
188
195
  this.cellContentFactory$ = this.state$.pipe(map((x) => x.cellContentFactory), distinctUntilChanged(), shareReplay(1));
189
- this.isCustomized$ = this.state$.pipe(map((x) => x.selectedIndexes.size > 0), distinctUntilChanged(), shareReplay(1));
196
+ this.isCustomized$ = this.state$.pipe(map((x) => x.toggledIndexes.size > 0), distinctUntilChanged(), shareReplay(1));
190
197
  // MARK: State Changes
191
198
  this.setMinMaxDateRange = this.updater(updateStateWithMinMaxDateRange);
192
199
  this.setFilter = this.updater(updateStateWithFilter);
@@ -195,10 +202,13 @@ class DbxCalendarScheduleSelectionStore extends ComponentStore {
195
202
  this.clearFilter = this.updater((state) => updateStateWithFilter(state, undefined));
196
203
  this.setTimezone = this.updater(updateStateWithTimezoneValue);
197
204
  this.setInputRange = this.updater(updateStateWithChangedRange);
205
+ // NOTE: Selected dates are NOT selected indexes. They are the internal selected dates that are excluded from the selection.
198
206
  this.toggleSelectedDates = this.updater((state, toggle) => updateStateWithChangedDates(state, { toggle }));
199
207
  this.addSelectedDates = this.updater((state, add) => updateStateWithChangedDates(state, { add }));
200
208
  this.removeSelectedDates = this.updater((state, remove) => updateStateWithChangedDates(state, { remove }));
201
209
  this.setSelectedDates = this.updater((state, set) => updateStateWithChangedDates(state, { set }));
210
+ // NOTE: Selected indexes are the typical/expected indexes that are selected or not.
211
+ this.setSelectedIndexes = this.updater((state, set) => updateStateWithChangedDates(state, { set, invertSetBehavior: true }));
202
212
  this.selectAllDates = this.updater((state, selectAll = 'all') => updateStateWithChangedDates(state, { selectAll }));
203
213
  this.setInitialSelectionState = this.updater(updateStateWithInitialSelectionState);
204
214
  this.setScheduleDays = this.updater(updateStateWithChangedScheduleDays);
@@ -213,8 +223,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
213
223
  type: Injectable
214
224
  }], ctorParameters: function () { return []; } });
215
225
  function updateStateWithInitialSelectionState(state, initialSelectionState) {
216
- const { selectedIndexes } = state;
217
- if (selectedIndexes.size === 0 && initialSelectionState === 'all') {
226
+ const { toggledIndexes } = state;
227
+ if (toggledIndexes.size === 0 && initialSelectionState === 'all') {
218
228
  state = updateStateWithChangedDates(state, { selectAll: initialSelectionState });
219
229
  }
220
230
  return Object.assign(Object.assign({}, state), { initialSelectionState });
@@ -335,7 +345,7 @@ function updateStateWithDateScheduleRangeValue(state, change) {
335
345
  }
336
346
  else {
337
347
  if (change != null) {
338
- const nextState = Object.assign(Object.assign({}, state), { inputStart: change.start, inputEnd: change.end, selectedIndexes: new Set(change.ex) });
348
+ const nextState = Object.assign(Object.assign({}, state), { inputStart: change.start, inputEnd: change.end, toggledIndexes: new Set(change.ex) });
339
349
  return updateStateWithChangedScheduleDays(finalizeNewCalendarScheduleSelectionState(nextState), expandDateScheduleDayCodes(change.w || '89'));
340
350
  }
341
351
  else {
@@ -357,12 +367,20 @@ function updateStateWithChangedScheduleDays(state, change) {
357
367
  }
358
368
  function updateStateWithChangedDates(state, change) {
359
369
  var _a;
360
- const { indexFactory, allowedDaysOfWeek, indexDayOfWeek, inputStart: currentInputStart, inputEnd: currentInputEnd, minMaxDateRange } = state;
370
+ const { indexFactory, allowedDaysOfWeek, indexDayOfWeek, inputStart: currentInputStart, inputEnd: currentInputEnd, minMaxDateRange, filter } = state;
361
371
  const { start: minDate, end: maxDate } = calendarScheduleMinAndMaxDateRange(state);
362
372
  let inputStart = currentInputStart;
363
373
  let inputEnd = currentInputEnd;
364
- let selectedIndexes;
365
- if (change.reset || change.selectAll != null || change.set) {
374
+ /**
375
+ * This is a set of indexes that are internally "selected" so that they are excluded from the inputStart/inputEnd date range.
376
+ *
377
+ * Do not confuse this with the actual indexes that are selected.
378
+ */
379
+ let toggledIndexes;
380
+ function asIndexes(indexes) {
381
+ return iterableToArray(indexes).map(indexFactory);
382
+ }
383
+ if (change.reset || change.selectAll != null || change.set != null) {
366
384
  let set = (_a = change.set) !== null && _a !== void 0 ? _a : [];
367
385
  const selectAll = change.reset === true ? state.initialSelectionState : change.selectAll;
368
386
  switch (selectAll) {
@@ -379,29 +397,52 @@ function updateStateWithChangedDates(state, change) {
379
397
  set = [];
380
398
  break;
381
399
  }
382
- selectedIndexes = new Set(iterableToArray(set).map(indexFactory));
400
+ toggledIndexes = new Set(asIndexes(set));
401
+ if (change.invertSetBehavior && minDate && maxDate && !selectAll) {
402
+ const minIndex = indexFactory(minDate);
403
+ const maxIndex = indexFactory(maxDate);
404
+ inputStart = minDate;
405
+ inputEnd = maxDate;
406
+ toggledIndexes = new Set(range(minIndex, maxIndex + 1).filter((x) => !toggledIndexes.has(x)));
407
+ }
383
408
  }
384
409
  else {
385
- selectedIndexes = new Set(state.selectedIndexes);
410
+ toggledIndexes = new Set(state.toggledIndexes);
386
411
  if (change.toggle) {
387
- const allowedToToggle = iterableToArray(change.toggle)
388
- .map(indexFactory)
389
- .filter((i) => allowedDaysOfWeek.has(indexDayOfWeek(i)));
390
- toggleInSet(selectedIndexes, allowedToToggle);
412
+ const allowedToToggle = asIndexes(change.toggle).filter((i) => allowedDaysOfWeek.has(indexDayOfWeek(i)));
413
+ toggleInSet(toggledIndexes, allowedToToggle);
391
414
  }
415
+ let addToExclusion;
416
+ let removeFromExclusion;
392
417
  if (change.add) {
393
- addToSet(selectedIndexes, iterableToArray(change.add).map(indexFactory));
418
+ if (change.invertSetBehavior) {
419
+ addToExclusion = change.add;
420
+ }
421
+ else {
422
+ removeFromExclusion = change.add;
423
+ }
394
424
  }
395
425
  if (change.remove) {
396
- addToSet(selectedIndexes, iterableToArray(change.remove).map(indexFactory));
426
+ if (change.invertSetBehavior) {
427
+ removeFromExclusion = change.remove;
428
+ }
429
+ else {
430
+ addToExclusion = change.remove;
431
+ }
432
+ }
433
+ if (addToExclusion) {
434
+ removeFromSet(toggledIndexes, asIndexes(addToExclusion));
435
+ }
436
+ if (removeFromExclusion) {
437
+ addToSet(toggledIndexes, asIndexes(removeFromExclusion));
397
438
  }
398
439
  }
399
- const nextState = Object.assign(Object.assign({}, state), { inputStart, inputEnd, selectedIndexes });
440
+ const nextState = Object.assign(Object.assign({}, state), { inputStart, inputEnd, toggledIndexes });
400
441
  nextState.isEnabledDay = isEnabledDayInCalendarScheduleSelectionState(nextState);
401
442
  // Recalculate the range and simplified to exclusions
402
443
  const rangeAndExclusion = computeScheduleSelectionRangeAndExclusion(nextState);
403
444
  if (rangeAndExclusion) {
404
- return finalizeNewCalendarScheduleSelectionState(Object.assign(Object.assign({}, nextState), { selectedIndexes: new Set(rangeAndExclusion.excluded), inputStart: rangeAndExclusion.start, inputEnd: rangeAndExclusion.end }));
445
+ return finalizeNewCalendarScheduleSelectionState(Object.assign(Object.assign({}, nextState), { toggledIndexes: new Set(rangeAndExclusion.excluded), inputStart: rangeAndExclusion.start, inputEnd: rangeAndExclusion.end }));
405
446
  }
406
447
  else {
407
448
  // no selected days
@@ -409,7 +450,7 @@ function updateStateWithChangedDates(state, change) {
409
450
  }
410
451
  }
411
452
  function noSelectionCalendarScheduleSelectionState(state) {
412
- return finalizeNewCalendarScheduleSelectionState(Object.assign(Object.assign({}, state), { selectedIndexes: new Set(), inputStart: null, inputEnd: null }));
453
+ return finalizeNewCalendarScheduleSelectionState(Object.assign(Object.assign({}, state), { toggledIndexes: new Set(), inputStart: null, inputEnd: null }));
413
454
  }
414
455
  function updateStateWithChangedRange(state, change) {
415
456
  const { inputStart: currentInputStart, inputEnd: currentInputEnd, indexFactory, minMaxDateRange } = state;
@@ -423,11 +464,11 @@ function updateStateWithChangedRange(state, change) {
423
464
  // retain all indexes that are within the new range
424
465
  const minIndex = indexFactory(inputStart);
425
466
  const maxIndex = indexFactory(inputEnd) + 1;
426
- const currentIndexes = Array.from(state.selectedIndexes);
467
+ const currentIndexes = Array.from(state.toggledIndexes);
427
468
  const isInCurrentRange = isIndexNumberInIndexRangeFunction({ minIndex, maxIndex });
428
469
  const excludedIndexesInNewRange = currentIndexes.filter(isInCurrentRange);
429
- const selectedIndexes = new Set(excludedIndexesInNewRange);
430
- const nextState = Object.assign(Object.assign({}, state), { selectedIndexes, inputStart, inputEnd });
470
+ const toggledIndexes = new Set(excludedIndexesInNewRange);
471
+ const nextState = Object.assign(Object.assign({}, state), { toggledIndexes, inputStart, inputEnd });
431
472
  return finalizeNewCalendarScheduleSelectionState(nextState);
432
473
  }
433
474
  function finalizeNewCalendarScheduleSelectionState(nextState) {
@@ -448,7 +489,7 @@ function isEnabledDayInCalendarScheduleSelectionState(state) {
448
489
  const index = indexFactory(input);
449
490
  const dayOfWeek = indexDayOfWeek(index);
450
491
  const isInSelectedRange = isInStartAndEndRange(input);
451
- const isSelected = state.selectedIndexes.has(index);
492
+ const isSelected = state.toggledIndexes.has(index);
452
493
  const isAllowedDayOfWeek = allowedDaysOfWeek.has(dayOfWeek);
453
494
  const result = isAllowedDayOfWeek && ((isInSelectedRange && !isSelected) || (isSelected && !isInSelectedRange));
454
495
  return result;
@@ -530,8 +571,8 @@ function computeCalendarScheduleSelectionRange(state) {
530
571
  }
531
572
  function computeCalendarScheduleSelectionDateBlockRange(state) {
532
573
  const { indexFactory, inputStart, inputEnd, allowedDaysOfWeek, indexDayOfWeek, isEnabledDay, isEnabledFilterDay } = state;
533
- const enabledSelectedIndexes = Array.from(state.selectedIndexes).filter((i) => allowedDaysOfWeek.has(indexDayOfWeek(i)));
534
- const minAndMaxSelectedValues = minAndMaxNumber(enabledSelectedIndexes);
574
+ const enabledExclusionIndexes = Array.from(state.toggledIndexes).filter((i) => allowedDaysOfWeek.has(indexDayOfWeek(i)));
575
+ const minAndMaxSelectedValues = minAndMaxNumber(enabledExclusionIndexes);
535
576
  let startRange;
536
577
  let endRange;
537
578
  if (minAndMaxSelectedValues) {
@@ -992,6 +1033,46 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
992
1033
  }]
993
1034
  }], ctorParameters: function () { return [{ type: i1$1.DbxPopoverService }, { type: DbxCalendarScheduleSelectionStore }, { type: i0.Injector }]; } });
994
1035
 
1036
+ function dbxScheduleSelectionCalendarBeforeMonthViewRenderFactory(inputModifyFn) {
1037
+ const modifyFn = inputModifyFn || (() => { });
1038
+ return (state$) => {
1039
+ return (renderEvent) => {
1040
+ const { body } = renderEvent;
1041
+ // use latest/current state
1042
+ state$.pipe(first()).subscribe((calendarScheduleState) => {
1043
+ const { isEnabledDay, indexFactory, isEnabledFilterDay, allowedDaysOfWeek } = calendarScheduleState;
1044
+ body.forEach((viewDay) => {
1045
+ const { date } = viewDay;
1046
+ const i = indexFactory(date);
1047
+ const day = date.getDay();
1048
+ let state;
1049
+ if (!isEnabledFilterDay(i)) {
1050
+ viewDay.cssClass = 'cal-day-not-applicable';
1051
+ state = CalendarScheduleSelectionDayState.NOT_APPLICABLE;
1052
+ }
1053
+ else if (!allowedDaysOfWeek.has(day)) {
1054
+ viewDay.cssClass = 'cal-day-disabled';
1055
+ state = CalendarScheduleSelectionDayState.DISABLED;
1056
+ }
1057
+ else if (isEnabledDay(i)) {
1058
+ viewDay.cssClass = 'cal-day-selected';
1059
+ state = CalendarScheduleSelectionDayState.SELECTED;
1060
+ }
1061
+ else {
1062
+ viewDay.cssClass = 'cal-day-not-selected';
1063
+ state = CalendarScheduleSelectionDayState.NOT_SELECTED;
1064
+ }
1065
+ const meta = {
1066
+ state,
1067
+ i
1068
+ };
1069
+ viewDay.meta = meta;
1070
+ modifyFn(viewDay, calendarScheduleState);
1071
+ });
1072
+ });
1073
+ };
1074
+ };
1075
+ }
995
1076
  class DbxScheduleSelectionCalendarComponent {
996
1077
  constructor(calendarStore, dbxCalendarScheduleSelectionStore) {
997
1078
  this.calendarStore = calendarStore;
@@ -1002,7 +1083,17 @@ class DbxScheduleSelectionCalendarComponent {
1002
1083
  this.clickEvent = new EventEmitter();
1003
1084
  // refresh any time the selected day function updates
1004
1085
  this.state$ = this.dbxCalendarScheduleSelectionStore.state$;
1005
- this.refresh$ = this.state$.pipe(throttleTime(100), map(() => undefined));
1086
+ this.beforeMonthViewRender$ = this._config.pipe(switchMap((x) => {
1087
+ let factory;
1088
+ if (x.beforeMonthViewRenderFunctionFactory) {
1089
+ factory = asObservable(x.beforeMonthViewRenderFunctionFactory);
1090
+ }
1091
+ else {
1092
+ factory = asObservable(x.customizeDay).pipe(map((x) => dbxScheduleSelectionCalendarBeforeMonthViewRenderFactory(x)));
1093
+ }
1094
+ return factory.pipe(map((x) => x(this.state$)));
1095
+ }), shareReplay(1));
1096
+ this.refresh$ = combineLatest([this.state$, this.beforeMonthViewRender$]).pipe(throttleTime(100), map(() => undefined));
1006
1097
  this.events$ = this.calendarStore.visibleEvents$.pipe(map(prepareAndSortCalendarEvents), shareReplay(1));
1007
1098
  this.viewDate$ = this.calendarStore.date$;
1008
1099
  }
@@ -1018,7 +1109,7 @@ class DbxScheduleSelectionCalendarComponent {
1018
1109
  return this._config.value;
1019
1110
  }
1020
1111
  set config(config) {
1021
- this._config.next(config);
1112
+ this._config.next(config !== null && config !== void 0 ? config : {});
1022
1113
  }
1023
1114
  dayClicked({ date }) {
1024
1115
  this.dbxCalendarScheduleSelectionStore.toggleSelectedDates(date);
@@ -1027,34 +1118,8 @@ class DbxScheduleSelectionCalendarComponent {
1027
1118
  this.clickEvent.emit({ action, event });
1028
1119
  }
1029
1120
  beforeMonthViewRender(renderEvent) {
1030
- const { body } = renderEvent;
1031
- this.state$.pipe(first()).subscribe(({ isEnabledDay, indexFactory, isEnabledFilterDay, allowedDaysOfWeek }) => {
1032
- body.forEach((viewDay) => {
1033
- const { date } = viewDay;
1034
- const i = indexFactory(date);
1035
- const day = date.getDay();
1036
- let state;
1037
- if (!isEnabledFilterDay(i)) {
1038
- viewDay.cssClass = 'cal-day-not-applicable';
1039
- state = CalendarScheduleSelectionDayState.NOT_APPLICABLE;
1040
- }
1041
- else if (!allowedDaysOfWeek.has(day)) {
1042
- viewDay.cssClass = 'cal-day-disabled';
1043
- state = CalendarScheduleSelectionDayState.DISABLED;
1044
- }
1045
- else if (isEnabledDay(i)) {
1046
- viewDay.cssClass = 'cal-day-selected';
1047
- state = CalendarScheduleSelectionDayState.SELECTED;
1048
- }
1049
- else {
1050
- viewDay.cssClass = 'cal-day-not-selected';
1051
- state = CalendarScheduleSelectionDayState.NOT_SELECTED;
1052
- }
1053
- viewDay.meta = {
1054
- state,
1055
- i
1056
- };
1057
- });
1121
+ this.beforeMonthViewRender$.pipe(first()).subscribe((x) => {
1122
+ x(renderEvent);
1058
1123
  });
1059
1124
  }
1060
1125
  }
@@ -1094,7 +1159,7 @@ class DbxScheduleSelectionCalendarDateDialogComponent extends AbstractDialogDire
1094
1159
  const contentConfig = mergeObjects([defaultContentConfig, inputContentConfig], KeyValueTypleValueFilter.NULL);
1095
1160
  const closeConfig = mergeObjects([defaultCloseConfig, contentConfig === null || contentConfig === void 0 ? void 0 : contentConfig.closeConfig, inputCloseConfig], KeyValueTypleValueFilter.NULL);
1096
1161
  contentConfig.closeConfig = closeConfig;
1097
- return matDialog.open(DbxScheduleSelectionCalendarDateDialogComponent, Object.assign(Object.assign({ height: 'calc(var(--vh100) * 0.9)', width: '80vw', minHeight: 400, minWidth: 360 }, contentConfig.dialogConfig), { injector, data: {
1162
+ return matDialog.open(DbxScheduleSelectionCalendarDateDialogComponent, Object.assign(Object.assign({ height: 'calc(var(--vh100) * 0.9)', width: '80vw', minHeight: 400, minWidth: 360 }, sanitizeDbxDialogContentConfig(contentConfig.dialogConfig)), { injector, data: {
1098
1163
  config,
1099
1164
  contentConfig
1100
1165
  } }));
@@ -1455,5 +1520,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
1455
1520
  * Generated bundle index. Do not edit.
1456
1521
  */
1457
1522
 
1458
- export { CalendarScheduleSelectionDayState, DEFAULT_DBX_SCHEDULE_SELECTION_CALENDAR_DATE_POPUP_CLOSE_CONFIG_TOKEN, DEFAULT_DBX_SCHEDULE_SELECTION_CALENDAR_DATE_POPUP_CONTENT_CONFIG_TOKEN, DEFAULT_SCHEDULE_SELECTION_CALENDAR_DATE_POPOVER_KEY, DbxCalendarScheduleSelectionStore, DbxCalendarScheduleSelectionStoreInjectionBlockDirective, DbxCalendarScheduleSelectionStoreProviderBlock, DbxFormCalendarDateScheduleRangeFieldComponent, DbxFormCalendarModule, DbxFormDateScheduleRangeFieldModule, DbxScheduleSelectionCalendarCellComponent, DbxScheduleSelectionCalendarComponent, DbxScheduleSelectionCalendarDateDaysComponent, DbxScheduleSelectionCalendarDateDaysFormComponent, DbxScheduleSelectionCalendarDateDialogButtonComponent, DbxScheduleSelectionCalendarDateDialogComponent, DbxScheduleSelectionCalendarDatePopoverButtonComponent, DbxScheduleSelectionCalendarDatePopoverComponent, DbxScheduleSelectionCalendarDatePopoverContentComponent, DbxScheduleSelectionCalendarDateRangeComponent, DbxScheduleSelectionCalendarSelectionToggleButtonComponent, calendarScheduleMaxDate, calendarScheduleMinAndMaxDateRange, calendarScheduleMinDate, calendarScheduleStartBeingUsedFromFilter, computeCalendarScheduleSelectionDateBlockRange, computeCalendarScheduleSelectionRange, computeScheduleSelectionRangeAndExclusion, computeScheduleSelectionValue, dateScheduleRangeField, dbxScheduleSelectionCalendarDateDaysFormDayFields, dbxScheduleSelectionCalendarDateDaysFormFields, defaultCalendarScheduleSelectionCellContentFactory, finalizeNewCalendarScheduleSelectionState, initialCalendarScheduleSelectionState, isEnabledDayInCalendarScheduleSelectionState, noSelectionCalendarScheduleSelectionState, provideCalendarScheduleSelectionStoreIfParentIsUnavailable, updateStateWithChangedDates, updateStateWithChangedRange, updateStateWithChangedScheduleDays, updateStateWithComputeSelectionResultRelativeToFilter, updateStateWithDateScheduleRangeValue, updateStateWithExclusions, updateStateWithFilter, updateStateWithInitialSelectionState, updateStateWithMinMaxDateRange, updateStateWithTimezoneValue };
1523
+ export { CalendarScheduleSelectionDayState, DEFAULT_DBX_SCHEDULE_SELECTION_CALENDAR_DATE_POPUP_CLOSE_CONFIG_TOKEN, DEFAULT_DBX_SCHEDULE_SELECTION_CALENDAR_DATE_POPUP_CONTENT_CONFIG_TOKEN, DEFAULT_SCHEDULE_SELECTION_CALENDAR_DATE_POPOVER_KEY, DbxCalendarScheduleSelectionStore, DbxCalendarScheduleSelectionStoreInjectionBlockDirective, DbxCalendarScheduleSelectionStoreProviderBlock, DbxFormCalendarDateScheduleRangeFieldComponent, DbxFormCalendarModule, DbxFormDateScheduleRangeFieldModule, DbxScheduleSelectionCalendarCellComponent, DbxScheduleSelectionCalendarComponent, DbxScheduleSelectionCalendarDateDaysComponent, DbxScheduleSelectionCalendarDateDaysFormComponent, DbxScheduleSelectionCalendarDateDialogButtonComponent, DbxScheduleSelectionCalendarDateDialogComponent, DbxScheduleSelectionCalendarDatePopoverButtonComponent, DbxScheduleSelectionCalendarDatePopoverComponent, DbxScheduleSelectionCalendarDatePopoverContentComponent, DbxScheduleSelectionCalendarDateRangeComponent, DbxScheduleSelectionCalendarSelectionToggleButtonComponent, calendarScheduleMaxDate, calendarScheduleMinAndMaxDateRange, calendarScheduleMinDate, calendarScheduleStartBeingUsedFromFilter, computeCalendarScheduleSelectionDateBlockRange, computeCalendarScheduleSelectionRange, computeScheduleSelectionRangeAndExclusion, computeScheduleSelectionValue, dateScheduleRangeField, dbxScheduleSelectionCalendarBeforeMonthViewRenderFactory, dbxScheduleSelectionCalendarDateDaysFormDayFields, dbxScheduleSelectionCalendarDateDaysFormFields, defaultCalendarScheduleSelectionCellContentFactory, finalizeNewCalendarScheduleSelectionState, initialCalendarScheduleSelectionState, isEnabledDayInCalendarScheduleSelectionState, noSelectionCalendarScheduleSelectionState, provideCalendarScheduleSelectionStoreIfParentIsUnavailable, updateStateWithChangedDates, updateStateWithChangedRange, updateStateWithChangedScheduleDays, updateStateWithComputeSelectionResultRelativeToFilter, updateStateWithDateScheduleRangeValue, updateStateWithExclusions, updateStateWithFilter, updateStateWithInitialSelectionState, updateStateWithMinMaxDateRange, updateStateWithTimezoneValue };
1459
1524
  //# sourceMappingURL=dereekb-dbx-form-calendar.mjs.map