@dereekb/dbx-form 9.24.37 → 9.24.39
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.
- package/calendar/lib/calendar.schedule.selection.store.d.ts +21 -17
- package/esm2020/calendar/lib/calendar.schedule.selection.range.component.mjs +4 -4
- package/esm2020/calendar/lib/calendar.schedule.selection.store.mjs +7 -6
- package/fesm2015/dereekb-dbx-form-calendar.mjs +9 -8
- package/fesm2015/dereekb-dbx-form-calendar.mjs.map +1 -1
- package/fesm2020/dereekb-dbx-form-calendar.mjs +9 -8
- package/fesm2020/dereekb-dbx-form-calendar.mjs.map +1 -1
- package/mapbox/package.json +4 -4
- package/package.json +4 -4
|
@@ -5,10 +5,10 @@ import { AbstractPopoverDirective, AbstractDialogDirective, sanitizeDbxDialogCon
|
|
|
5
5
|
import * as i0 from '@angular/core';
|
|
6
6
|
import { Injectable, SkipSelf, Directive, Injector, Optional, Component, Inject, Input, ViewChild, ElementRef, ChangeDetectionStrategy, EventEmitter, Output, InjectionToken, NgModule } from '@angular/core';
|
|
7
7
|
import { FieldType } from '@ngx-formly/material';
|
|
8
|
-
import { switchMap, first, tap, map, distinctUntilChanged, shareReplay, of, combineLatestWith, BehaviorSubject, filter, startWith, throttleTime
|
|
8
|
+
import { switchMap, first, tap, map, distinctUntilChanged, shareReplay, of, combineLatestWith, BehaviorSubject, filter, combineLatest, startWith, throttleTime } from 'rxjs';
|
|
9
9
|
import { filterMaybe, distinctUntilHasDifferentValues, SubscriptionObject, asObservableFromGetter, asObservable } from '@dereekb/rxjs';
|
|
10
|
-
import { DateScheduleDayCode, expandDateScheduleDayCodesToDayOfWeekSet,
|
|
11
|
-
import { mapValuesToSet, unique, mergeArrays, iterableToArray, range, toggleInSet, removeFromSet, addToSet, isIndexNumberInIndexRangeFunction, minAndMaxNumber, getDaysOfWeekNames, reduceBooleansWithAnd, mergeObjects, KeyValueTypleValueFilter } from '@dereekb/util';
|
|
10
|
+
import { DateScheduleDayCode, expandDateScheduleDayCodesToDayOfWeekSet, dateBlockTimingRelativeIndexFactory, dateBlockDayOfWeekFactory, findMaxDate, findMinDate, isSameDateRange, isSameDateDay, isSameDate, dateBlockTimingDateFactory, expandDateScheduleRange, formatToISO8601DayString, isSameDateScheduleRange, dateBlockTimingRelativeIndexArrayFactory, isInfiniteDateRange, copyDateScheduleDateFilterConfig, dateScheduleDateFilter, dateTimezoneUtcNormal, expandDateScheduleDayCodes, fullWeekDayScheduleDayCodes, dateScheduleDayCodesAreSetsEquivalent, simplifyDateScheduleDayCodes, isDateInDateRangeFunction, isDateWithinDateBlockRangeFunction, copyHoursAndMinutesFromDate, dateScheduleEncodedWeek, dateBlockTimingStartDateFactory, enabledDaysFromDateScheduleDayCodes, dateScheduleDayCodesFromEnabledDays, formatToMonthDayString, dateRange, DateRangeType } from '@dereekb/date';
|
|
11
|
+
import { isInAllowedDaysOfWeekSet, mapValuesToSet, unique, mergeArrays, iterableToArray, range, toggleInSet, removeFromSet, addToSet, isIndexNumberInIndexRangeFunction, minAndMaxNumber, getDaysOfWeekNames, reduceBooleansWithAnd, mergeObjects, KeyValueTypleValueFilter } from '@dereekb/util';
|
|
12
12
|
import { ComponentStore } from '@ngrx/component-store';
|
|
13
13
|
import { startOfDay, endOfDay, isBefore, endOfWeek } from 'date-fns';
|
|
14
14
|
import * as i3$1 from '@dereekb/dbx-core';
|
|
@@ -98,7 +98,7 @@ function initialCalendarScheduleSelectionState() {
|
|
|
98
98
|
const defaultScheduleDays = new Set([DateScheduleDayCode.WEEKDAY, DateScheduleDayCode.WEEKEND]);
|
|
99
99
|
const allowedDaysOfWeek = expandDateScheduleDayCodesToDayOfWeekSet(defaultScheduleDays);
|
|
100
100
|
const start = startOfDay(new Date());
|
|
101
|
-
const indexFactory =
|
|
101
|
+
const indexFactory = dateBlockTimingRelativeIndexFactory({ start });
|
|
102
102
|
const indexDayOfWeek = dateBlockDayOfWeekFactory(start);
|
|
103
103
|
return {
|
|
104
104
|
start,
|
|
@@ -168,6 +168,7 @@ class DbxCalendarScheduleSelectionStore extends ComponentStore {
|
|
|
168
168
|
map(calendarScheduleStartBeingUsedFromFilter), distinctUntilChanged(), shareReplay(1));
|
|
169
169
|
this.dateRange$ = this.currentDateRange$.pipe(filterMaybe(), shareReplay(1));
|
|
170
170
|
this.allowedDaysOfWeek$ = this.state$.pipe(map((x) => x.allowedDaysOfWeek), distinctUntilHasDifferentValues(), shareReplay(1));
|
|
171
|
+
this.isInAllowedDaysOfWeekFunction$ = this.allowedDaysOfWeek$.pipe(map((x) => isInAllowedDaysOfWeekSet(x)), shareReplay(1));
|
|
171
172
|
this.scheduleDays$ = this.state$.pipe(map((x) => x.effectiveScheduleDays), distinctUntilHasDifferentValues(), shareReplay(1));
|
|
172
173
|
this.currentTimezone$ = this.state$.pipe(map((x) => x.timezone), distinctUntilChanged(), shareReplay(1));
|
|
173
174
|
this.effectiveTimezone$ = this.state$.pipe(map((x) => (!calendarScheduleStartBeingUsedFromFilter(x) && x.timezone ? x.timezone : undefined)), distinctUntilChanged(), shareReplay(1));
|
|
@@ -264,7 +265,7 @@ function updateStateWithExclusions(state, inputExclusions) {
|
|
|
264
265
|
let computedExclusions;
|
|
265
266
|
if (inputExclusions) {
|
|
266
267
|
const { indexFactory } = state;
|
|
267
|
-
const indexArrayFactory =
|
|
268
|
+
const indexArrayFactory = dateBlockTimingRelativeIndexArrayFactory(indexFactory);
|
|
268
269
|
computedExclusions = indexArrayFactory(inputExclusions);
|
|
269
270
|
}
|
|
270
271
|
state = { ...state, inputExclusions, computedExclusions };
|
|
@@ -325,7 +326,7 @@ function updateStateWithFilter(state, inputFilter) {
|
|
|
325
326
|
if (filter && filter.start) {
|
|
326
327
|
const start = filter.start;
|
|
327
328
|
state.start = start;
|
|
328
|
-
state.indexFactory =
|
|
329
|
+
state.indexFactory = dateBlockTimingRelativeIndexFactory({ start });
|
|
329
330
|
state.indexDayOfWeek = dateBlockDayOfWeekFactory(start);
|
|
330
331
|
}
|
|
331
332
|
// attempt to re-apply the initial selection state once filter is applied
|
|
@@ -796,9 +797,9 @@ class DbxScheduleSelectionCalendarDateRangeComponent {
|
|
|
796
797
|
}), shareReplay(1));
|
|
797
798
|
this.pickerOpened$ = this._pickerOpened.asObservable();
|
|
798
799
|
this.defaultDatePickerFilter = () => true;
|
|
799
|
-
this.datePickerFilter$ = this.dbxCalendarScheduleSelectionStore.isEnabledFilterDayFunction
|
|
800
|
+
this.datePickerFilter$ = combineLatest([this.dbxCalendarScheduleSelectionStore.isEnabledFilterDayFunction$, this.dbxCalendarScheduleSelectionStore.isInAllowedDaysOfWeekFunction$]).pipe(map(([isEnabled, isAllowedDayOfWeek]) => {
|
|
800
801
|
const fn = (date) => {
|
|
801
|
-
const result = date ? isEnabled(date) : true;
|
|
802
|
+
const result = date ? isAllowedDayOfWeek(date) && isEnabled(date) : true;
|
|
802
803
|
return result;
|
|
803
804
|
};
|
|
804
805
|
return fn;
|