@dereekb/dbx-form 9.24.15 → 9.24.16
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 -16
- package/esm2020/calendar/lib/calendar.schedule.selection.store.mjs +10 -5
- package/fesm2015/dereekb-dbx-form-calendar.mjs +9 -4
- package/fesm2015/dereekb-dbx-form-calendar.mjs.map +1 -1
- package/fesm2020/dereekb-dbx-form-calendar.mjs +9 -4
- 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, ElementRef, ViewChild, ChangeDetectionStrategy, EventEmitter, Output, InjectionToken, NgModule } from '@angular/core';
|
|
7
7
|
import { FieldType } from '@ngx-formly/material';
|
|
8
|
-
import { switchMap, first, tap, map, distinctUntilChanged, shareReplay, combineLatestWith, BehaviorSubject,
|
|
8
|
+
import { switchMap, first, tap, map, distinctUntilChanged, shareReplay, of, combineLatestWith, BehaviorSubject, startWith, filter, throttleTime, combineLatest } from 'rxjs';
|
|
9
9
|
import { filterMaybe, distinctUntilHasDifferentValues, SubscriptionObject, asObservableFromGetter, asObservable } from '@dereekb/rxjs';
|
|
10
|
-
import { DateScheduleDayCode, expandDateScheduleDayCodesToDayOfWeekSet, dateTimingRelativeIndexFactory, dateBlockDayOfWeekFactory, findMaxDate, findMinDate, isSameDateRange, isSameDateDay, isSameDate, expandDateScheduleRange, isSameDateScheduleRange, dateTimingRelativeIndexArrayFactory, isInfiniteDateRange, copyDateScheduleDateFilterConfig, dateScheduleDateFilter, dateTimezoneUtcNormal, expandDateScheduleDayCodes, isDateInDateRangeFunction, isDateWithinDateBlockRangeFunction, copyHoursAndMinutesFromDate, dateScheduleEncodedWeek,
|
|
11
|
-
import { setsAreEquivalent, unique, mergeArrays, iterableToArray, range, toggleInSet, removeFromSet, addToSet, isIndexNumberInIndexRangeFunction, minAndMaxNumber, getDaysOfWeekNames, reduceBooleansWithAnd, mergeObjects, KeyValueTypleValueFilter } from '@dereekb/util';
|
|
10
|
+
import { DateScheduleDayCode, expandDateScheduleDayCodesToDayOfWeekSet, dateTimingRelativeIndexFactory, dateBlockDayOfWeekFactory, findMaxDate, findMinDate, isSameDateRange, isSameDateDay, isSameDate, dateBlockTimingDateFactory, expandDateScheduleRange, formatToISO8601DayString, isSameDateScheduleRange, dateTimingRelativeIndexArrayFactory, isInfiniteDateRange, copyDateScheduleDateFilterConfig, dateScheduleDateFilter, dateTimezoneUtcNormal, expandDateScheduleDayCodes, isDateInDateRangeFunction, isDateWithinDateBlockRangeFunction, copyHoursAndMinutesFromDate, dateScheduleEncodedWeek, enabledDaysFromDateScheduleDayCodes, dateScheduleDayCodesFromEnabledDays, formatToMonthDayString, dateRange, DateRangeType } from '@dereekb/date';
|
|
11
|
+
import { setsAreEquivalent, 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 i1 from '@dereekb/dbx-web/calendar';
|
|
@@ -169,8 +169,13 @@ class DbxCalendarScheduleSelectionStore extends ComponentStore {
|
|
|
169
169
|
this.effectiveTimezone$ = this.state$.pipe(map((x) => (!calendarScheduleStartBeingUsedFromFilter(x) && x.timezone ? x.timezone : undefined)), distinctUntilChanged(), shareReplay(1));
|
|
170
170
|
this.effectiveTimezoneNormal$ = this.state$.pipe(map((x) => (!calendarScheduleStartBeingUsedFromFilter(x) && x.timezoneNormal ? x.timezoneNormal : undefined)), distinctUntilChanged(), shareReplay(1));
|
|
171
171
|
this.currentSelectionValue$ = this.state$.pipe(map((x) => x.currentSelectionValue), shareReplay(1));
|
|
172
|
+
this.currentSelectionValueStart$ = this.currentSelectionValue$.pipe(map((x) => x?.dateScheduleRange.start), distinctUntilChanged(isSameDate), shareReplay(1));
|
|
173
|
+
this.currentSelectionValueDateBlockTimingDateFactory$ = this.currentSelectionValueStart$.pipe(map((start) => (start ? dateBlockTimingDateFactory({ start }) : undefined)), shareReplay(1));
|
|
172
174
|
this.currentSelectionValueDateBlockDurationSpan$ = this.currentSelectionValue$.pipe(map((x) => (x ? expandDateScheduleRange(x) : [])), shareReplay(1));
|
|
173
175
|
this.selectionValueSelectedIndexes$ = this.currentSelectionValueDateBlockDurationSpan$.pipe(map((x) => new Set(x.map((y) => y.i))), distinctUntilHasDifferentValues(), shareReplay(1));
|
|
176
|
+
this.selectionValueSelectedDates$ = this.currentSelectionValueDateBlockTimingDateFactory$.pipe(switchMap((dateFactory) => {
|
|
177
|
+
return dateFactory ? this.selectionValueSelectedIndexes$.pipe(map((x) => mapValuesToSet(x, (y) => formatToISO8601DayString(dateFactory(y))))) : of(new Set());
|
|
178
|
+
}), shareReplay(1));
|
|
174
179
|
this.selectionValue$ = this.currentSelectionValue$.pipe(filterMaybe(), shareReplay(1));
|
|
175
180
|
this.currentSelectionValueWithTimezone$ = this.currentSelectionValue$.pipe(combineLatestWith(this.effectiveTimezoneNormal$), map(([x, timezoneNormal]) => {
|
|
176
181
|
if (x && timezoneNormal) {
|
|
@@ -509,7 +514,7 @@ function isEnabledDayInCalendarScheduleSelectionState(state) {
|
|
|
509
514
|
return (input) => {
|
|
510
515
|
const index = indexFactory(input);
|
|
511
516
|
const dayOfWeek = indexDayOfWeek(index);
|
|
512
|
-
const isInSelectedRange = isInStartAndEndRange(
|
|
517
|
+
const isInSelectedRange = isInStartAndEndRange(index);
|
|
513
518
|
const isSelected = state.toggledIndexes.has(index);
|
|
514
519
|
const isAllowedDayOfWeek = allowedDaysOfWeek.has(dayOfWeek);
|
|
515
520
|
const result = isAllowedDayOfWeek && ((isInSelectedRange && !isSelected) || (isSelected && !isInSelectedRange));
|