@dereekb/dbx-form 9.25.11 → 9.25.13
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 +42 -26
- package/esm2020/calendar/lib/calendar.schedule.selection.popover.button.component.mjs +4 -2
- package/esm2020/calendar/lib/calendar.schedule.selection.store.mjs +109 -34
- package/esm2020/calendar/lib/calendar.schedule.selection.toggle.button.component.mjs +21 -19
- package/fesm2015/dereekb-dbx-form-calendar.mjs +131 -55
- package/fesm2015/dereekb-dbx-form-calendar.mjs.map +1 -1
- package/fesm2020/dereekb-dbx-form-calendar.mjs +133 -54
- package/fesm2020/dereekb-dbx-form-calendar.mjs.map +1 -1
- package/lib/extension/calendar/_calendar.scss +4 -1
- package/mapbox/package.json +4 -4
- package/package.json +4 -4
|
@@ -23,24 +23,26 @@ export class DbxScheduleSelectionCalendarSelectionToggleButtonComponent {
|
|
|
23
23
|
return this.dbxCalendarScheduleSelectionStore.nextToggleSelection$.pipe(map((x) => !x));
|
|
24
24
|
}
|
|
25
25
|
}), distinctUntilChanged(), shareReplay(1));
|
|
26
|
-
this.buttonDisplay$ = this.dbxCalendarScheduleSelectionStore.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
26
|
+
this.buttonDisplay$ = this.dbxCalendarScheduleSelectionStore.selectionMode$.pipe(switchMap((selectionMode) => {
|
|
27
|
+
return this.dbxCalendarScheduleSelectionStore.nextToggleSelection$.pipe(map((x) => {
|
|
28
|
+
let buttonDisplay;
|
|
29
|
+
switch (x) {
|
|
30
|
+
case 'all':
|
|
31
|
+
buttonDisplay = {
|
|
32
|
+
icon: 'select_all',
|
|
33
|
+
text: 'Select All'
|
|
34
|
+
};
|
|
35
|
+
break;
|
|
36
|
+
default:
|
|
37
|
+
case 'none':
|
|
38
|
+
buttonDisplay = {
|
|
39
|
+
icon: 'clear',
|
|
40
|
+
text: selectionMode === 'multiple' ? 'Clear All' : 'Clear'
|
|
41
|
+
};
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
return buttonDisplay;
|
|
45
|
+
}));
|
|
44
46
|
}), shareReplay(1));
|
|
45
47
|
}
|
|
46
48
|
ngOnDestroy() {
|
|
@@ -68,4 +70,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
|
|
|
68
70
|
}], ctorParameters: function () { return [{ type: i1.DbxPopoverService }, { type: i2.DbxCalendarScheduleSelectionStore }, { type: i0.Injector }]; }, propDecorators: { disabled: [{
|
|
69
71
|
type: Input
|
|
70
72
|
}] } });
|
|
71
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
73
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2FsZW5kYXIuc2NoZWR1bGUuc2VsZWN0aW9uLnRvZ2dsZS5idXR0b24uY29tcG9uZW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvZGJ4LWZvcm0vY2FsZW5kYXIvc3JjL2xpYi9jYWxlbmRhci5zY2hlZHVsZS5zZWxlY3Rpb24udG9nZ2xlLmJ1dHRvbi5jb21wb25lbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFNBQVMsRUFBRSxRQUFRLEVBQUUsS0FBSyxFQUFhLE1BQU0sZUFBZSxDQUFDO0FBQ3RFLE9BQU8sRUFBRSxpQkFBaUIsRUFBRSxNQUFNLGtCQUFrQixDQUFDO0FBQ3JELE9BQU8sRUFBRSxlQUFlLEVBQUUsb0JBQW9CLEVBQUUsR0F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7XG4gIH1cblxuICBASW5wdXQoKVxuICBzZXQgZGlzYWJsZWQoZGlzYWJsZWQ6IE1heWJlPGJvb2xlYW4+KSB7XG4gICAgdGhpcy5fZGlzYWJsZWQubmV4dChkaXNhYmxlZCk7XG4gIH1cbn1cbiJdfQ==
|
|
@@ -5,8 +5,8 @@ import { Injectable, SkipSelf, Directive, Injector, Optional, Component, Inject,
|
|
|
5
5
|
import { FieldType } from '@ngx-formly/material';
|
|
6
6
|
import { switchMap, first, tap, map, distinctUntilChanged, shareReplay, of, combineLatestWith, BehaviorSubject, filter, combineLatest, EMPTY, startWith, throttleTime } from 'rxjs';
|
|
7
7
|
import { filterMaybe, distinctUntilHasDifferentValues, SubscriptionObject, asObservableFromGetter, asObservable } from '@dereekb/rxjs';
|
|
8
|
-
import { DateCellScheduleDayCode, expandDateCellScheduleDayCodesToDayOfWeekSet, dateCellTimingStartsAtForStartOfDay, dateCellTimingRelativeIndexFactory, dateCellDayOfWeekFactory, dateTimezoneUtcNormal, findMaxDate, findMinDate, isSameDateRange, isSameDateDay, isSameDate, dateCellTimingDateFactory, expandDateCellScheduleRange, formatToISO8601DayString, changeDateCellScheduleDateRangeToTimezone, isSameDateCellScheduleDateRange, dateCellTimingRelativeIndexArrayFactory, isInfiniteDateRange, copyDateCellScheduleDateFilterConfig, SYSTEM_DATE_TIMEZONE_UTC_NORMAL_INSTANCE, dateCellScheduleDateFilter, fullDateCellScheduleRange, dateCellTimingTimezoneNormalInstance, expandDateCellScheduleDayCodes, fullWeekDateCellScheduleDayCodes, dateCellScheduleDayCodesAreSetsEquivalent, simplifyDateCellScheduleDayCodes, isDateInDateRangeFunction, isDateWithinDateCellRangeFunction, dateCellScheduleEncodedWeek,
|
|
9
|
-
import { isInAllowedDaysOfWeekSet, mapValuesToSet, unique, mergeArrays, iterableToArray, range, toggleInSet, removeFromSet, addToSet, isIndexNumberInIndexRangeFunction,
|
|
8
|
+
import { DateCellScheduleDayCode, expandDateCellScheduleDayCodesToDayOfWeekSet, dateCellTimingStartsAtForStartOfDay, dateCellTimingRelativeIndexFactory, dateCellDayOfWeekFactory, dateTimezoneUtcNormal, findMaxDate, findMinDate, isSameDateRange, isSameDateDay, isSameDate, dateCellTimingDateFactory, expandDateCellScheduleRange, formatToISO8601DayString, changeDateCellScheduleDateRangeToTimezone, isSameDateCellScheduleDateRange, dateCellTimingRelativeIndexArrayFactory, isInfiniteDateRange, copyDateCellScheduleDateFilterConfig, SYSTEM_DATE_TIMEZONE_UTC_NORMAL_INSTANCE, dateCellScheduleDateFilter, fullDateCellScheduleRange, dateCellTimingTimezoneNormalInstance, expandDateCellScheduleDayCodes, fullWeekDateCellScheduleDayCodes, dateCellScheduleDayCodesAreSetsEquivalent, simplifyDateCellScheduleDayCodes, dateCellTimingStartDateFactory, isDateInDateRangeFunction, isDateWithinDateCellRangeFunction, dateCellScheduleEncodedWeek, enabledDaysFromDateCellScheduleDayCodes, dateCellScheduleDayCodesFromEnabledDays, formatToMonthDayString, dateRange, DateRangeType } from '@dereekb/date';
|
|
9
|
+
import { isInAllowedDaysOfWeekSet, mapValuesToSet, unique, mergeArrays, iterableToArray, isIterable, firstValueFromIterable, minAndMaxNumber, range, toggleInSet, removeFromSet, addToSet, isIndexNumberInIndexRangeFunction, getDaysOfWeekNames, reduceBooleansWithAnd, mergeObjects, KeyValueTypleValueFilter } from '@dereekb/util';
|
|
10
10
|
import { ComponentStore } from '@ngrx/component-store';
|
|
11
11
|
import { startOfDay, endOfDay, isBefore, endOfWeek } from 'date-fns';
|
|
12
12
|
import * as i1$1 from '@dereekb/dbx-web';
|
|
@@ -98,6 +98,7 @@ function initialCalendarScheduleSelectionState() {
|
|
|
98
98
|
const indexFactory = dateCellTimingRelativeIndexFactory(defaultStartsAt);
|
|
99
99
|
const indexDayOfWeek = dateCellDayOfWeekFactory(startsAt);
|
|
100
100
|
return {
|
|
101
|
+
selectionMode: 'multiple',
|
|
101
102
|
start: startsAt,
|
|
102
103
|
systemTimezone,
|
|
103
104
|
indexFactory,
|
|
@@ -164,6 +165,7 @@ class DbxCalendarScheduleSelectionStore extends ComponentStore {
|
|
|
164
165
|
}))));
|
|
165
166
|
});
|
|
166
167
|
// MARK: Accessors
|
|
168
|
+
this.selectionMode$ = this.state$.pipe(map((x) => x.selectionMode), distinctUntilChanged(), shareReplay(1));
|
|
167
169
|
this.filter$ = this.state$.pipe(map((x) => x.filter), distinctUntilChanged(), shareReplay(1));
|
|
168
170
|
this.minMaxDateRange$ = this.state$.pipe(map(calendarScheduleMinAndMaxDateRange), distinctUntilChanged(isSameDateRange), shareReplay(1));
|
|
169
171
|
this.minDate$ = this.minMaxDateRange$.pipe(map((x) => x === null || x === void 0 ? void 0 : x.start), distinctUntilChanged(isSameDateDay), shareReplay(1));
|
|
@@ -261,15 +263,19 @@ class DbxCalendarScheduleSelectionStore extends ComponentStore {
|
|
|
261
263
|
this.addSelectedDates = this.updater((state, add) => updateStateWithChangedDates(state, { add }));
|
|
262
264
|
this.removeSelectedDates = this.updater((state, remove) => updateStateWithChangedDates(state, { remove }));
|
|
263
265
|
this.setSelectedDates = this.updater((state, set) => updateStateWithChangedDates(state, { set }));
|
|
266
|
+
this.selectAllDates = this.updater((state, selectAll = 'all') => updateStateWithChangedDates(state, { selectAll }));
|
|
264
267
|
// NOTE: Selected indexes are the typical/expected indexes that are selected or not.
|
|
265
268
|
this.setSelectedIndexes = this.updater((state, set) => updateStateWithChangedDates(state, { set, invertSetBehavior: true }));
|
|
266
|
-
this.selectAllDates = this.updater((state, selectAll = 'all') => updateStateWithChangedDates(state, { selectAll }));
|
|
267
269
|
this.setInitialSelectionState = this.updater(updateStateWithInitialSelectionState);
|
|
268
270
|
this.setDefaultScheduleDays = this.updater(updateStateWithChangedDefaultScheduleDays);
|
|
269
271
|
this.setScheduleDays = this.updater(updateStateWithChangedScheduleDays);
|
|
270
272
|
this.setAllowAllScheduleDays = this.updater((state) => updateStateWithChangedScheduleDays(state, [DateCellScheduleDayCode.WEEKDAY, DateCellScheduleDayCode.WEEKEND]));
|
|
271
273
|
this.setDateScheduleRangeValue = this.updater((state, value) => updateStateWithDateCellScheduleRangeValue(state, value));
|
|
272
274
|
this.setCellContentFactory = this.updater((state, cellContentFactory) => (Object.assign(Object.assign({}, state), { cellContentFactory })));
|
|
275
|
+
/**
|
|
276
|
+
* Sets the selection mode.
|
|
277
|
+
*/
|
|
278
|
+
this.setSelectionMode = this.updater(updateStateWithSelectionMode);
|
|
273
279
|
/**
|
|
274
280
|
* Used by the parent view to propogate a readonly state.
|
|
275
281
|
*
|
|
@@ -333,20 +339,19 @@ function updateStateWithExclusions(state, inputExclusions) {
|
|
|
333
339
|
return updateStateWithFilter(state, state.filter);
|
|
334
340
|
}
|
|
335
341
|
function updateStateWithMinMaxDateRange(state, minMaxDateRange) {
|
|
336
|
-
state = Object.assign({}, state);
|
|
337
342
|
if (minMaxDateRange != null && !isInfiniteDateRange(minMaxDateRange)) {
|
|
338
|
-
state
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
343
|
+
state = Object.assign(Object.assign({}, state), { minMaxDateRange: {
|
|
344
|
+
start: minMaxDateRange.start != null ? startOfDay(minMaxDateRange.start) : undefined,
|
|
345
|
+
end: minMaxDateRange.end != null ? endOfDay(minMaxDateRange.end) : undefined
|
|
346
|
+
} });
|
|
342
347
|
}
|
|
343
348
|
else {
|
|
344
|
-
|
|
349
|
+
state = Object.assign(Object.assign({}, state), { minMaxDateRange: undefined });
|
|
345
350
|
}
|
|
346
351
|
return updateStateWithFilter(state, state.filter);
|
|
347
352
|
}
|
|
348
|
-
function updateStateWithFilter(
|
|
349
|
-
const { computedExclusions: exclusions, minMaxDateRange, systemTimezone } =
|
|
353
|
+
function updateStateWithFilter(currentState, inputFilter) {
|
|
354
|
+
const { computedExclusions: exclusions, minMaxDateRange, systemTimezone } = currentState;
|
|
350
355
|
let isEnabledFilterDay = () => true;
|
|
351
356
|
let filter = null;
|
|
352
357
|
// create the filter using inputFilter, exclusions, and minMaxDateRange
|
|
@@ -412,11 +417,11 @@ function updateStateWithFilter(state, inputFilter) {
|
|
|
412
417
|
// use the current state's start, but make sure it is in the proper timezone.
|
|
413
418
|
if (enabledFilter.timezone) {
|
|
414
419
|
const timezoneNormal = dateTimezoneUtcNormal(enabledFilter.timezone);
|
|
415
|
-
finalEnabledStart = timezoneNormal.startOfDayInTargetTimezone(
|
|
420
|
+
finalEnabledStart = timezoneNormal.startOfDayInTargetTimezone(currentState.start); // get the start of the day for the current start
|
|
416
421
|
finalEnabledTimezone = enabledFilter.timezone;
|
|
417
422
|
}
|
|
418
423
|
else {
|
|
419
|
-
finalEnabledStart =
|
|
424
|
+
finalEnabledStart = currentState.start;
|
|
420
425
|
finalEnabledTimezone = systemTimezone;
|
|
421
426
|
}
|
|
422
427
|
}
|
|
@@ -434,7 +439,7 @@ function updateStateWithFilter(state, inputFilter) {
|
|
|
434
439
|
// create the filter
|
|
435
440
|
isEnabledFilterDay = dateCellScheduleDateFilter(enabledFilter);
|
|
436
441
|
}
|
|
437
|
-
|
|
442
|
+
let nextState = Object.assign(Object.assign({}, currentState), { filter, isEnabledFilterDay });
|
|
438
443
|
// For the same reason as above, use the filter's start date as the relative start if applicable.
|
|
439
444
|
if (filter && filter.start) {
|
|
440
445
|
let startForSystemTimezone = filter.start;
|
|
@@ -442,20 +447,20 @@ function updateStateWithFilter(state, inputFilter) {
|
|
|
442
447
|
const timezoneNormal = dateTimezoneUtcNormal(filter.timezone);
|
|
443
448
|
startForSystemTimezone = timezoneNormal.systemDateToTargetDate(filter.start); // get the start of the day for the system timezone
|
|
444
449
|
}
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
450
|
+
nextState.start = startForSystemTimezone;
|
|
451
|
+
nextState.indexFactory = dateCellTimingRelativeIndexFactory({ startsAt: startForSystemTimezone, timezone: systemTimezone });
|
|
452
|
+
nextState.indexDayOfWeek = dateCellDayOfWeekFactory(startForSystemTimezone);
|
|
448
453
|
}
|
|
449
454
|
// attempt to re-apply the initial selection state once filter is applied
|
|
450
|
-
if (
|
|
451
|
-
|
|
455
|
+
if (nextState.initialSelectionState) {
|
|
456
|
+
nextState = updateStateWithInitialSelectionState(nextState, nextState.initialSelectionState);
|
|
452
457
|
}
|
|
453
458
|
// re-calculate the selection given the filter
|
|
454
|
-
const { inputStart, inputEnd } =
|
|
459
|
+
const { inputStart, inputEnd } = nextState;
|
|
455
460
|
if (inputStart && inputEnd) {
|
|
456
|
-
|
|
461
|
+
nextState = updateStateWithChangedRange(nextState, { inputStart, inputEnd });
|
|
457
462
|
}
|
|
458
|
-
return
|
|
463
|
+
return nextState;
|
|
459
464
|
}
|
|
460
465
|
function updateStateWithTimezoneValue(state, timezone) {
|
|
461
466
|
const { currentSelectionValue } = state;
|
|
@@ -543,6 +548,22 @@ function updateStateWithChangedScheduleDays(state, change) {
|
|
|
543
548
|
return finalizeUpdateStateWithChangedScheduleDays(state, Object.assign(Object.assign({}, state), { scheduleDays: newScheduleDays !== null && newScheduleDays !== void 0 ? newScheduleDays : undefined }));
|
|
544
549
|
}
|
|
545
550
|
}
|
|
551
|
+
function updateStateWithSelectionMode(state, selectionMode) {
|
|
552
|
+
const { selectionMode: currentSelectionMode } = state;
|
|
553
|
+
if (currentSelectionMode !== selectionMode) {
|
|
554
|
+
const nextState = Object.assign(Object.assign({}, state), { selectionMode });
|
|
555
|
+
if (selectionMode === 'multiple') {
|
|
556
|
+
return nextState;
|
|
557
|
+
}
|
|
558
|
+
else {
|
|
559
|
+
const currentSelectionRange = computeCalendarScheduleSelectionDateCellRange(nextState);
|
|
560
|
+
return currentSelectionRange ? updateStateWithChangedDates(nextState, { set: [currentSelectionRange.i], invertSetBehavior: true }) : nextState;
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
else {
|
|
564
|
+
return state;
|
|
565
|
+
}
|
|
566
|
+
}
|
|
546
567
|
function finalizeUpdateStateWithChangedScheduleDays(previousState, nextState) {
|
|
547
568
|
var _a;
|
|
548
569
|
const previousScheduleDays = previousState.effectiveScheduleDays;
|
|
@@ -561,8 +582,8 @@ function finalizeUpdateStateWithChangedScheduleDays(previousState, nextState) {
|
|
|
561
582
|
}
|
|
562
583
|
function updateStateWithChangedDates(state, change) {
|
|
563
584
|
var _a;
|
|
564
|
-
const { allowedDaysOfWeek, indexFactory, indexDayOfWeek, inputStart: currentInputStart, inputEnd: currentInputEnd, minMaxDateRange, filter } = state;
|
|
565
|
-
const { start:
|
|
585
|
+
const { selectionMode, allowedDaysOfWeek, indexFactory, indexDayOfWeek, inputStart: currentInputStart, inputEnd: currentInputEnd, minMaxDateRange, filter } = state;
|
|
586
|
+
const { start: minDateFromFilter, end: maxDateFromFilter } = calendarScheduleMinAndMaxDateRangeRelativeToFilter(state);
|
|
566
587
|
let inputStart = currentInputStart;
|
|
567
588
|
let inputEnd = currentInputEnd;
|
|
568
589
|
/**
|
|
@@ -574,14 +595,39 @@ function updateStateWithChangedDates(state, change) {
|
|
|
574
595
|
function asIndexes(indexes) {
|
|
575
596
|
return iterableToArray(indexes).map(indexFactory);
|
|
576
597
|
}
|
|
598
|
+
// When using selection mode "single" we update the change to reflect the single selection.
|
|
599
|
+
if (selectionMode === 'single') {
|
|
600
|
+
function setFromFirstValue(input) {
|
|
601
|
+
const firstValue = isIterable(input) ? firstValueFromIterable(input) : input;
|
|
602
|
+
const set = new Set();
|
|
603
|
+
if (firstValue != null) {
|
|
604
|
+
set.add(firstValue);
|
|
605
|
+
}
|
|
606
|
+
return set;
|
|
607
|
+
}
|
|
608
|
+
if (change.set) {
|
|
609
|
+
change = { set: setFromFirstValue(change.set), invertSetBehavior: true };
|
|
610
|
+
}
|
|
611
|
+
else if (change.toggle) {
|
|
612
|
+
const nextSet = setFromFirstValue(change.toggle);
|
|
613
|
+
if (nextSet.size) {
|
|
614
|
+
const firstSetValueIndex = indexFactory(firstValueFromIterable(nextSet));
|
|
615
|
+
if (state.toggledIndexes.has(firstSetValueIndex) || (inputStart && indexFactory(inputStart) === firstSetValueIndex)) {
|
|
616
|
+
nextSet.clear(); // clear with the next set
|
|
617
|
+
}
|
|
618
|
+
change = { set: nextSet, invertSetBehavior: true };
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
// set, selectAll, add, and remove are treated as they normally are.
|
|
622
|
+
}
|
|
577
623
|
if (change.reset || change.selectAll != null || change.set != null) {
|
|
578
624
|
let set = (_a = change.set) !== null && _a !== void 0 ? _a : [];
|
|
579
625
|
const selectAll = change.reset === true ? state.initialSelectionState : change.selectAll;
|
|
580
626
|
switch (selectAll) {
|
|
581
627
|
case 'all':
|
|
582
|
-
if (
|
|
583
|
-
inputStart =
|
|
584
|
-
inputEnd =
|
|
628
|
+
if (minDateFromFilter != null && maxDateFromFilter != null) {
|
|
629
|
+
inputStart = minDateFromFilter;
|
|
630
|
+
inputEnd = maxDateFromFilter;
|
|
585
631
|
set = [];
|
|
586
632
|
}
|
|
587
633
|
break;
|
|
@@ -591,17 +637,43 @@ function updateStateWithChangedDates(state, change) {
|
|
|
591
637
|
set = [];
|
|
592
638
|
break;
|
|
593
639
|
}
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
640
|
+
const inputSetIndexes = asIndexes(set);
|
|
641
|
+
toggledIndexes = new Set(inputSetIndexes);
|
|
642
|
+
if (change.invertSetBehavior && !selectAll) {
|
|
643
|
+
let minIndex;
|
|
644
|
+
let maxIndex;
|
|
645
|
+
if (minDateFromFilter != null && maxDateFromFilter != null) {
|
|
646
|
+
// only applicable when the filter is set.
|
|
647
|
+
minIndex = indexFactory(minDateFromFilter);
|
|
648
|
+
maxIndex = indexFactory(maxDateFromFilter);
|
|
649
|
+
inputStart = minDateFromFilter;
|
|
650
|
+
inputEnd = maxDateFromFilter;
|
|
651
|
+
}
|
|
652
|
+
else {
|
|
653
|
+
// when the filter is not set, use the least and greatest indexes from the input set.
|
|
654
|
+
const minAndMax = minAndMaxNumber(inputSetIndexes);
|
|
655
|
+
if (minAndMax != null) {
|
|
656
|
+
minIndex = minAndMax.min;
|
|
657
|
+
maxIndex = minAndMax.max;
|
|
658
|
+
const dateFactory = dateCellTimingStartDateFactory(indexFactory._timing);
|
|
659
|
+
inputStart = dateFactory(minAndMax.min);
|
|
660
|
+
inputEnd = minAndMax.min === minAndMax.max ? inputStart : dateFactory(minAndMax.max);
|
|
661
|
+
}
|
|
662
|
+
else {
|
|
663
|
+
// equivalent to an empty set / using "none" with selectAll.
|
|
664
|
+
inputStart = null;
|
|
665
|
+
inputEnd = null;
|
|
666
|
+
toggledIndexes = new Set();
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
// toggledIndexes should not include any indexes we want to include
|
|
670
|
+
if (minIndex != null && maxIndex != null) {
|
|
671
|
+
toggledIndexes = new Set(range(minIndex, maxIndex + 1).filter((x) => !toggledIndexes.has(x)));
|
|
672
|
+
}
|
|
601
673
|
}
|
|
602
674
|
}
|
|
603
675
|
else {
|
|
604
|
-
toggledIndexes = new Set(state.toggledIndexes);
|
|
676
|
+
toggledIndexes = new Set(state.toggledIndexes); // copy the set
|
|
605
677
|
if (change.toggle) {
|
|
606
678
|
const allowedToToggle = asIndexes(change.toggle).filter((i) => allowedDaysOfWeek.has(indexDayOfWeek(i)));
|
|
607
679
|
toggleInSet(toggledIndexes, allowedToToggle);
|
|
@@ -1176,7 +1248,9 @@ class DbxScheduleSelectionCalendarDatePopoverButtonComponent {
|
|
|
1176
1248
|
this.disabled$ = this.dbxCalendarScheduleSelectionStore.isViewReadonly$;
|
|
1177
1249
|
this.buttonText$ = this.dbxCalendarScheduleSelectionStore.currentDateRange$.pipe(map((x) => {
|
|
1178
1250
|
if ((x === null || x === void 0 ? void 0 : x.start) && x.end) {
|
|
1179
|
-
|
|
1251
|
+
const startString = formatToMonthDayString(x.start);
|
|
1252
|
+
const endString = formatToMonthDayString(x.end);
|
|
1253
|
+
return startString === endString ? startString : `${formatToMonthDayString(x.start)} - ${formatToMonthDayString(x.end)}`;
|
|
1180
1254
|
}
|
|
1181
1255
|
else {
|
|
1182
1256
|
return 'Pick a Date Range';
|
|
@@ -1260,24 +1334,26 @@ class DbxScheduleSelectionCalendarSelectionToggleButtonComponent {
|
|
|
1260
1334
|
return this.dbxCalendarScheduleSelectionStore.nextToggleSelection$.pipe(map((x) => !x));
|
|
1261
1335
|
}
|
|
1262
1336
|
}), distinctUntilChanged(), shareReplay(1));
|
|
1263
|
-
this.buttonDisplay$ = this.dbxCalendarScheduleSelectionStore.
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1337
|
+
this.buttonDisplay$ = this.dbxCalendarScheduleSelectionStore.selectionMode$.pipe(switchMap((selectionMode) => {
|
|
1338
|
+
return this.dbxCalendarScheduleSelectionStore.nextToggleSelection$.pipe(map((x) => {
|
|
1339
|
+
let buttonDisplay;
|
|
1340
|
+
switch (x) {
|
|
1341
|
+
case 'all':
|
|
1342
|
+
buttonDisplay = {
|
|
1343
|
+
icon: 'select_all',
|
|
1344
|
+
text: 'Select All'
|
|
1345
|
+
};
|
|
1346
|
+
break;
|
|
1347
|
+
default:
|
|
1348
|
+
case 'none':
|
|
1349
|
+
buttonDisplay = {
|
|
1350
|
+
icon: 'clear',
|
|
1351
|
+
text: selectionMode === 'multiple' ? 'Clear All' : 'Clear'
|
|
1352
|
+
};
|
|
1353
|
+
break;
|
|
1354
|
+
}
|
|
1355
|
+
return buttonDisplay;
|
|
1356
|
+
}));
|
|
1281
1357
|
}), shareReplay(1));
|
|
1282
1358
|
}
|
|
1283
1359
|
ngOnDestroy() {
|
|
@@ -1875,5 +1951,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
|
|
|
1875
1951
|
* Generated bundle index. Do not edit.
|
|
1876
1952
|
*/
|
|
1877
1953
|
|
|
1878
|
-
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, computeCalendarScheduleSelectionDateCellRange, computeCalendarScheduleSelectionRange, computeScheduleSelectionRangeAndExclusion, computeScheduleSelectionValue, dateScheduleRangeField, dbxScheduleSelectionCalendarBeforeMonthViewRenderFactory, dbxScheduleSelectionCalendarDateDaysFormDayFields, dbxScheduleSelectionCalendarDateDaysFormFields, defaultCalendarScheduleSelectionCellContentFactory, finalizeNewCalendarScheduleSelectionState, finalizeUpdateStateWithChangedScheduleDays, initialCalendarScheduleSelectionState, isEnabledDayInCalendarScheduleSelectionState, noSelectionCalendarScheduleSelectionState, provideCalendarScheduleSelectionStoreIfParentIsUnavailable, updateStateWithChangedDates, updateStateWithChangedDefaultScheduleDays, updateStateWithChangedRange, updateStateWithChangedScheduleDays, updateStateWithComputeSelectionResultRelativeToFilter, updateStateWithDateCellScheduleRangeValue, updateStateWithExclusions, updateStateWithFilter, updateStateWithInitialSelectionState, updateStateWithMinMaxDateRange, updateStateWithTimezoneValue };
|
|
1954
|
+
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, computeCalendarScheduleSelectionDateCellRange, computeCalendarScheduleSelectionRange, computeScheduleSelectionRangeAndExclusion, computeScheduleSelectionValue, dateScheduleRangeField, dbxScheduleSelectionCalendarBeforeMonthViewRenderFactory, dbxScheduleSelectionCalendarDateDaysFormDayFields, dbxScheduleSelectionCalendarDateDaysFormFields, defaultCalendarScheduleSelectionCellContentFactory, finalizeNewCalendarScheduleSelectionState, finalizeUpdateStateWithChangedScheduleDays, initialCalendarScheduleSelectionState, isEnabledDayInCalendarScheduleSelectionState, noSelectionCalendarScheduleSelectionState, provideCalendarScheduleSelectionStoreIfParentIsUnavailable, updateStateWithChangedDates, updateStateWithChangedDefaultScheduleDays, updateStateWithChangedRange, updateStateWithChangedScheduleDays, updateStateWithComputeSelectionResultRelativeToFilter, updateStateWithDateCellScheduleRangeValue, updateStateWithExclusions, updateStateWithFilter, updateStateWithInitialSelectionState, updateStateWithMinMaxDateRange, updateStateWithSelectionMode, updateStateWithTimezoneValue };
|
|
1879
1955
|
//# sourceMappingURL=dereekb-dbx-form-calendar.mjs.map
|