@dereekb/dbx-form 9.24.17 → 9.24.19
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.module.d.ts +1 -1
- package/calendar/lib/calendar.schedule.selection.dialog.button.component.d.ts +2 -1
- package/calendar/lib/calendar.schedule.selection.range.component.d.ts +6 -1
- package/calendar/lib/calendar.schedule.selection.store.d.ts +16 -3
- package/calendar/lib/field/schedule/calendar.schedule.field.component.d.ts +30 -1
- package/calendar/lib/field/schedule/calendar.schedule.module.d.ts +10 -9
- package/esm2020/calendar/lib/calendar.module.mjs +8 -2
- package/esm2020/calendar/lib/calendar.schedule.selection.component.mjs +24 -8
- package/esm2020/calendar/lib/calendar.schedule.selection.days.component.mjs +6 -4
- package/esm2020/calendar/lib/calendar.schedule.selection.dialog.button.component.mjs +8 -6
- package/esm2020/calendar/lib/calendar.schedule.selection.popover.content.component.mjs +17 -12
- package/esm2020/calendar/lib/calendar.schedule.selection.range.component.mjs +45 -5
- package/esm2020/calendar/lib/calendar.schedule.selection.store.mjs +60 -19
- package/esm2020/calendar/lib/field/schedule/calendar.schedule.field.component.mjs +31 -10
- package/esm2020/calendar/lib/field/schedule/calendar.schedule.field.mjs +6 -3
- package/esm2020/calendar/lib/field/schedule/calendar.schedule.module.mjs +7 -3
- package/esm2020/lib/formly/config/validation.mjs +3 -2
- package/esm2020/lib/formly/field/value/date/datetime.field.component.mjs +3 -3
- package/esm2020/lib/formly/field/value/date/datetime.field.mjs +3 -1
- package/esm2020/lib/formly/field/value/phone/phone.field.component.mjs +84 -5
- package/esm2020/lib/formly/field/value/phone/phone.field.mjs +9 -3
- package/esm2020/lib/validator/index.mjs +2 -1
- package/esm2020/lib/validator/phone.mjs +61 -0
- package/fesm2015/dereekb-dbx-form-calendar.mjs +195 -60
- package/fesm2015/dereekb-dbx-form-calendar.mjs.map +1 -1
- package/fesm2015/dereekb-dbx-form.mjs +150 -12
- package/fesm2015/dereekb-dbx-form.mjs.map +1 -1
- package/fesm2020/dereekb-dbx-form-calendar.mjs +197 -62
- package/fesm2020/dereekb-dbx-form-calendar.mjs.map +1 -1
- package/fesm2020/dereekb-dbx-form.mjs +149 -9
- package/fesm2020/dereekb-dbx-form.mjs.map +1 -1
- package/lib/extension/calendar/_calendar.scss +6 -0
- package/lib/formly/config/validation.d.ts +4 -0
- package/lib/formly/field/value/date/_date.scss +18 -0
- package/lib/formly/field/value/phone/_phone.scss +22 -13
- package/lib/formly/field/value/phone/phone.field.component.d.ts +19 -0
- package/lib/validator/index.d.ts +1 -0
- package/lib/validator/phone.d.ts +16 -0
- package/mapbox/package.json +4 -4
- package/package.json +4 -4
|
@@ -1,53 +1,54 @@
|
|
|
1
1
|
import * as i4$1 from '@dereekb/dbx-form';
|
|
2
2
|
import { formlyField, propsAndConfigForFieldConfig, flexLayoutWrapper, toggleField, AbstractSyncFormlyFormDirective, provideFormlyContext, DbxFormModule, DbxFormlyModule } from '@dereekb/dbx-form';
|
|
3
3
|
import * as i1$1 from '@dereekb/dbx-web';
|
|
4
|
-
import { AbstractPopoverDirective, AbstractDialogDirective, sanitizeDbxDialogContentConfig, DbxActionModule, DbxButtonModule, DbxDialogInteractionModule, DbxPopoverInteractionModule
|
|
4
|
+
import { AbstractPopoverDirective, AbstractDialogDirective, sanitizeDbxDialogContentConfig, DbxContentLayoutModule, DbxTextModule, DbxActionModule, DbxButtonModule, DbxDialogInteractionModule, DbxPopoverInteractionModule } from '@dereekb/dbx-web';
|
|
5
5
|
import * as i0 from '@angular/core';
|
|
6
|
-
import { Injectable, SkipSelf, Directive, Injector, Optional, Component, Inject, Input,
|
|
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,
|
|
8
|
+
import { switchMap, first, tap, map, distinctUntilChanged, shareReplay, of, combineLatestWith, BehaviorSubject, filter, startWith, 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, dateBlockTimingDateFactory, expandDateScheduleRange, formatToISO8601DayString, isSameDateScheduleRange, dateTimingRelativeIndexArrayFactory, isInfiniteDateRange, copyDateScheduleDateFilterConfig, dateScheduleDateFilter, dateTimezoneUtcNormal, expandDateScheduleDayCodes, isDateInDateRangeFunction, isDateWithinDateBlockRangeFunction, copyHoursAndMinutesFromDate, dateScheduleEncodedWeek, enabledDaysFromDateScheduleDayCodes, dateScheduleDayCodesFromEnabledDays, formatToMonthDayString, dateRange, DateRangeType } from '@dereekb/date';
|
|
11
|
-
import {
|
|
10
|
+
import { DateScheduleDayCode, expandDateScheduleDayCodesToDayOfWeekSet, dateTimingRelativeIndexFactory, dateBlockDayOfWeekFactory, findMaxDate, findMinDate, isSameDateRange, isSameDateDay, isSameDate, dateBlockTimingDateFactory, expandDateScheduleRange, formatToISO8601DayString, isSameDateScheduleRange, dateTimingRelativeIndexArrayFactory, isInfiniteDateRange, copyDateScheduleDateFilterConfig, dateScheduleDateFilter, dateTimezoneUtcNormal, expandDateScheduleDayCodes, fullWeekDayScheduleDayCodes, dateScheduleDayCodesAreSetsEquivalent, simplifyDateScheduleDayCodes, isDateInDateRangeFunction, isDateWithinDateBlockRangeFunction, copyHoursAndMinutesFromDate, dateScheduleEncodedWeek, enabledDaysFromDateScheduleDayCodes, dateScheduleDayCodesFromEnabledDays, formatToMonthDayString, dateRange, DateRangeType } from '@dereekb/date';
|
|
11
|
+
import { 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
|
+
import * as i3$1 from '@dereekb/dbx-core';
|
|
15
|
+
import { switchMapDbxInjectionComponentConfig, DbxInjectionComponentModule, DbxDatePipeModule } from '@dereekb/dbx-core';
|
|
14
16
|
import * as i1 from '@dereekb/dbx-web/calendar';
|
|
15
17
|
import { prepareAndSortCalendarEvents, DbxCalendarStore, DbxCalendarModule } from '@dereekb/dbx-web/calendar';
|
|
16
18
|
import * as i3 from '@angular/forms';
|
|
17
19
|
import { FormGroup, FormControl, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
18
20
|
import * as i5 from '@angular/material/form-field';
|
|
19
21
|
import { MAT_FORM_FIELD_DEFAULT_OPTIONS, MatFormFieldModule } from '@angular/material/form-field';
|
|
20
|
-
import * as i4 from '@angular/common';
|
|
21
|
-
import { CommonModule } from '@angular/common';
|
|
22
22
|
import * as i7 from '@angular/material/datepicker';
|
|
23
23
|
import { MatDatepickerModule } from '@angular/material/datepicker';
|
|
24
|
-
import * as
|
|
25
|
-
import {
|
|
24
|
+
import * as i4 from '@angular/common';
|
|
25
|
+
import { CommonModule } from '@angular/common';
|
|
26
26
|
import * as i1$2 from '@angular/material/dialog';
|
|
27
27
|
import * as i6 from 'angular-calendar';
|
|
28
28
|
import { CalendarModule, CalendarDayModule, CalendarWeekModule } from 'angular-calendar';
|
|
29
29
|
import * as i7$1 from '@angular/flex-layout/extended';
|
|
30
30
|
import * as i3$2 from '@angular/material/icon';
|
|
31
31
|
import { MatIconModule } from '@angular/material/icon';
|
|
32
|
-
import * as i2 from '@angular/material/button';
|
|
33
|
-
import { MatButtonModule } from '@angular/material/button';
|
|
34
32
|
import * as i1$3 from '@ngx-formly/core';
|
|
35
33
|
import { FormlyModule } from '@ngx-formly/core';
|
|
36
34
|
import { MatInputModule } from '@angular/material/input';
|
|
35
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
37
36
|
import { MatButtonToggleModule } from '@angular/material/button-toggle';
|
|
38
37
|
import { FlexLayoutModule } from '@angular/flex-layout';
|
|
39
38
|
|
|
40
39
|
function dateScheduleRangeField(config = {}) {
|
|
41
|
-
const { key = 'schedule', appearance, hideCustomize, filter, timezone, initialSelectionState, computeSelectionResultRelativeToFilter, exclusions, minMaxDateRange, cellContentFactory, dialogContentConfig, closeDialogConfig } = config;
|
|
40
|
+
const { key = 'schedule', appearance, hideCustomize, allowTextInput, filter, timezone, initialSelectionState, computeSelectionResultRelativeToFilter, exclusions, defaultScheduleDays, minMaxDateRange, cellContentFactory, dialogContentConfig, closeDialogConfig, customDetailsConfig } = config;
|
|
42
41
|
const fieldConfig = {
|
|
43
42
|
...formlyField({
|
|
44
43
|
key,
|
|
45
44
|
type: 'date-schedule-range',
|
|
46
45
|
...propsAndConfigForFieldConfig(config, {
|
|
47
46
|
label: config.label ?? 'Schedule',
|
|
47
|
+
allowTextInput,
|
|
48
48
|
appearance,
|
|
49
49
|
hideCustomize,
|
|
50
50
|
timezone,
|
|
51
|
+
defaultScheduleDays,
|
|
51
52
|
minMaxDateRange,
|
|
52
53
|
filter,
|
|
53
54
|
exclusions,
|
|
@@ -55,7 +56,8 @@ function dateScheduleRangeField(config = {}) {
|
|
|
55
56
|
closeDialogConfig,
|
|
56
57
|
computeSelectionResultRelativeToFilter,
|
|
57
58
|
initialSelectionState,
|
|
58
|
-
cellContentFactory
|
|
59
|
+
cellContentFactory,
|
|
60
|
+
customDetailsConfig
|
|
59
61
|
})
|
|
60
62
|
})
|
|
61
63
|
};
|
|
@@ -93,8 +95,8 @@ const defaultCalendarScheduleSelectionCellContentFactory = (day) => {
|
|
|
93
95
|
};
|
|
94
96
|
|
|
95
97
|
function initialCalendarScheduleSelectionState() {
|
|
96
|
-
const
|
|
97
|
-
const allowedDaysOfWeek = expandDateScheduleDayCodesToDayOfWeekSet(
|
|
98
|
+
const defaultScheduleDays = new Set([DateScheduleDayCode.WEEKDAY, DateScheduleDayCode.WEEKEND]);
|
|
99
|
+
const allowedDaysOfWeek = expandDateScheduleDayCodesToDayOfWeekSet(defaultScheduleDays);
|
|
98
100
|
const start = startOfDay(new Date());
|
|
99
101
|
const indexFactory = dateTimingRelativeIndexFactory({ start });
|
|
100
102
|
const indexDayOfWeek = dateBlockDayOfWeekFactory(start);
|
|
@@ -102,7 +104,8 @@ function initialCalendarScheduleSelectionState() {
|
|
|
102
104
|
start,
|
|
103
105
|
indexFactory,
|
|
104
106
|
toggledIndexes: new Set(),
|
|
105
|
-
|
|
107
|
+
defaultScheduleDays,
|
|
108
|
+
effectiveScheduleDays: defaultScheduleDays,
|
|
106
109
|
allowedDaysOfWeek,
|
|
107
110
|
indexDayOfWeek,
|
|
108
111
|
isEnabledFilterDay: () => true,
|
|
@@ -164,7 +167,8 @@ class DbxCalendarScheduleSelectionStore extends ComponentStore {
|
|
|
164
167
|
//
|
|
165
168
|
map(calendarScheduleStartBeingUsedFromFilter), distinctUntilChanged(), shareReplay(1));
|
|
166
169
|
this.dateRange$ = this.currentDateRange$.pipe(filterMaybe(), shareReplay(1));
|
|
167
|
-
this.
|
|
170
|
+
this.allowedDaysOfWeek$ = this.state$.pipe(map((x) => x.allowedDaysOfWeek), distinctUntilHasDifferentValues(), shareReplay(1));
|
|
171
|
+
this.scheduleDays$ = this.state$.pipe(map((x) => x.effectiveScheduleDays), distinctUntilHasDifferentValues(), shareReplay(1));
|
|
168
172
|
this.currentTimezone$ = this.state$.pipe(map((x) => x.timezone), distinctUntilChanged(), shareReplay(1));
|
|
169
173
|
this.effectiveTimezone$ = this.state$.pipe(map((x) => (!calendarScheduleStartBeingUsedFromFilter(x) && x.timezone ? x.timezone : undefined)), distinctUntilChanged(), shareReplay(1));
|
|
170
174
|
this.effectiveTimezoneNormal$ = this.state$.pipe(map((x) => (!calendarScheduleStartBeingUsedFromFilter(x) && x.timezoneNormal ? x.timezoneNormal : undefined)), distinctUntilChanged(), shareReplay(1));
|
|
@@ -208,6 +212,7 @@ class DbxCalendarScheduleSelectionStore extends ComponentStore {
|
|
|
208
212
|
this.isViewReadonly$ = this.state$.pipe(map((x) => x.isViewReadonly), distinctUntilChanged(), shareReplay(1));
|
|
209
213
|
// MARK: State Changes
|
|
210
214
|
this.setMinMaxDateRange = this.updater(updateStateWithMinMaxDateRange);
|
|
215
|
+
this.setDefaultWeek = this.updater(updateStateWithMinMaxDateRange);
|
|
211
216
|
this.setFilter = this.updater(updateStateWithFilter);
|
|
212
217
|
this.setExclusions = this.updater(updateStateWithExclusions);
|
|
213
218
|
this.setComputeSelectionResultRelativeToFilter = this.updater(updateStateWithComputeSelectionResultRelativeToFilter);
|
|
@@ -223,8 +228,9 @@ class DbxCalendarScheduleSelectionStore extends ComponentStore {
|
|
|
223
228
|
this.setSelectedIndexes = this.updater((state, set) => updateStateWithChangedDates(state, { set, invertSetBehavior: true }));
|
|
224
229
|
this.selectAllDates = this.updater((state, selectAll = 'all') => updateStateWithChangedDates(state, { selectAll }));
|
|
225
230
|
this.setInitialSelectionState = this.updater(updateStateWithInitialSelectionState);
|
|
231
|
+
this.setDefaultScheduleDays = this.updater(updateStateWithChangedDefaultScheduleDays);
|
|
226
232
|
this.setScheduleDays = this.updater(updateStateWithChangedScheduleDays);
|
|
227
|
-
this.setAllowAllScheduleDays = this.updater((state) => updateStateWithChangedScheduleDays(state,
|
|
233
|
+
this.setAllowAllScheduleDays = this.updater((state) => updateStateWithChangedScheduleDays(state, [DateScheduleDayCode.WEEKDAY, DateScheduleDayCode.WEEKEND]));
|
|
228
234
|
this.setDateScheduleRangeValue = this.updater((state, value) => updateStateWithDateScheduleRangeValue(state, value));
|
|
229
235
|
this.setCellContentFactory = this.updater((state, cellContentFactory) => ({ ...state, cellContentFactory }));
|
|
230
236
|
/**
|
|
@@ -380,20 +386,57 @@ function updateStateWithDateScheduleRangeValue(state, change) {
|
|
|
380
386
|
}
|
|
381
387
|
}
|
|
382
388
|
}
|
|
389
|
+
function updateStateWithChangedDefaultScheduleDays(state, change) {
|
|
390
|
+
const { defaultScheduleDays: currentDefaultScheduleDays } = state;
|
|
391
|
+
const defaultScheduleDays = new Set(change ?? fullWeekDayScheduleDayCodes());
|
|
392
|
+
if (dateScheduleDayCodesAreSetsEquivalent(defaultScheduleDays, currentDefaultScheduleDays)) {
|
|
393
|
+
return state; // no change
|
|
394
|
+
}
|
|
395
|
+
else {
|
|
396
|
+
return finalizeUpdateStateWithChangedScheduleDays(state, { ...state, defaultScheduleDays });
|
|
397
|
+
}
|
|
398
|
+
}
|
|
383
399
|
function updateStateWithChangedScheduleDays(state, change) {
|
|
384
400
|
const { scheduleDays: currentScheduleDays } = state;
|
|
385
|
-
const scheduleDays = new Set(change
|
|
386
|
-
|
|
387
|
-
|
|
401
|
+
const scheduleDays = new Set(change ?? []);
|
|
402
|
+
let newScheduleDays;
|
|
403
|
+
if (currentScheduleDays != null && change != null) {
|
|
404
|
+
if (dateScheduleDayCodesAreSetsEquivalent(scheduleDays, currentScheduleDays)) {
|
|
405
|
+
newScheduleDays = undefined; //no change
|
|
406
|
+
}
|
|
407
|
+
else {
|
|
408
|
+
newScheduleDays = scheduleDays;
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
else if (currentScheduleDays !== change) {
|
|
412
|
+
newScheduleDays = change ? scheduleDays : null; // set the new one, or clear it
|
|
413
|
+
}
|
|
414
|
+
if (newScheduleDays === undefined) {
|
|
415
|
+
return state;
|
|
388
416
|
}
|
|
389
417
|
else {
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
418
|
+
return finalizeUpdateStateWithChangedScheduleDays(state, { ...state, scheduleDays: newScheduleDays ?? undefined });
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
function finalizeUpdateStateWithChangedScheduleDays(previousState, nextState) {
|
|
422
|
+
const previousScheduleDays = previousState.effectiveScheduleDays;
|
|
423
|
+
const nextScheduleDays = nextState.scheduleDays ?? nextState.defaultScheduleDays;
|
|
424
|
+
if (dateScheduleDayCodesAreSetsEquivalent(nextScheduleDays, previousScheduleDays)) {
|
|
425
|
+
return nextState; // the default or input schedule changed but the schedule is still the same, so no need for an update.
|
|
426
|
+
}
|
|
427
|
+
else {
|
|
428
|
+
const effectiveScheduleDays = new Set(simplifyDateScheduleDayCodes(nextScheduleDays));
|
|
429
|
+
const allowedDaysOfWeek = expandDateScheduleDayCodesToDayOfWeekSet(nextScheduleDays);
|
|
430
|
+
return finalizeNewCalendarScheduleSelectionState({
|
|
431
|
+
...nextState,
|
|
432
|
+
// update the effective schedule days and allowed days of week
|
|
433
|
+
effectiveScheduleDays,
|
|
434
|
+
allowedDaysOfWeek
|
|
435
|
+
});
|
|
393
436
|
}
|
|
394
437
|
}
|
|
395
438
|
function updateStateWithChangedDates(state, change) {
|
|
396
|
-
const {
|
|
439
|
+
const { allowedDaysOfWeek, indexFactory, indexDayOfWeek, inputStart: currentInputStart, inputEnd: currentInputEnd, minMaxDateRange, filter } = state;
|
|
397
440
|
const { start: minDate, end: maxDate } = calendarScheduleMinAndMaxDateRange(state);
|
|
398
441
|
let inputStart = currentInputStart;
|
|
399
442
|
let inputEnd = currentInputEnd;
|
|
@@ -503,7 +546,7 @@ function finalizeNewCalendarScheduleSelectionState(nextState) {
|
|
|
503
546
|
return nextState;
|
|
504
547
|
}
|
|
505
548
|
function isEnabledDayInCalendarScheduleSelectionState(state) {
|
|
506
|
-
const { indexFactory, inputStart, inputEnd, indexDayOfWeek
|
|
549
|
+
const { allowedDaysOfWeek, indexFactory, inputStart, inputEnd, indexDayOfWeek } = state;
|
|
507
550
|
let isInStartAndEndRange;
|
|
508
551
|
if (inputStart && inputEnd) {
|
|
509
552
|
isInStartAndEndRange = isDateWithinDateBlockRangeFunction({ start: state.start, range: { start: inputStart, end: inputEnd } });
|
|
@@ -522,7 +565,7 @@ function isEnabledDayInCalendarScheduleSelectionState(state) {
|
|
|
522
565
|
};
|
|
523
566
|
}
|
|
524
567
|
function computeScheduleSelectionValue(state) {
|
|
525
|
-
const { indexFactory,
|
|
568
|
+
const { indexFactory, allowedDaysOfWeek, effectiveScheduleDays, indexDayOfWeek, computeSelectionResultRelativeToFilter, filter } = state;
|
|
526
569
|
const rangeAndExclusion = computeScheduleSelectionRangeAndExclusion(state);
|
|
527
570
|
if (rangeAndExclusion == null) {
|
|
528
571
|
return null;
|
|
@@ -550,7 +593,7 @@ function computeScheduleSelectionValue(state) {
|
|
|
550
593
|
: allExcluded;
|
|
551
594
|
const offsetExcluded = excluded.map((x) => x - indexOffset); // set to the proper offset
|
|
552
595
|
const ex = [...filterOffsetExcludedRange, ...offsetExcluded];
|
|
553
|
-
const w = dateScheduleEncodedWeek(
|
|
596
|
+
const w = dateScheduleEncodedWeek(effectiveScheduleDays);
|
|
554
597
|
const d = []; // "included" blocks are never used/calculated.
|
|
555
598
|
// Always ensure the end is after or equal to the start.
|
|
556
599
|
if (isBefore(end, start)) {
|
|
@@ -596,7 +639,7 @@ function computeCalendarScheduleSelectionRange(state) {
|
|
|
596
639
|
return dateRange;
|
|
597
640
|
}
|
|
598
641
|
function computeCalendarScheduleSelectionDateBlockRange(state) {
|
|
599
|
-
const { indexFactory, inputStart, inputEnd,
|
|
642
|
+
const { allowedDaysOfWeek, indexFactory, inputStart, inputEnd, indexDayOfWeek, isEnabledDay, isEnabledFilterDay } = state;
|
|
600
643
|
const enabledExclusionIndexes = Array.from(state.toggledIndexes).filter((i) => allowedDaysOfWeek.has(indexDayOfWeek(i)));
|
|
601
644
|
const minAndMaxSelectedValues = minAndMaxNumber(enabledExclusionIndexes);
|
|
602
645
|
let startRange;
|
|
@@ -696,6 +739,7 @@ class DbxScheduleSelectionCalendarDateRangeComponent {
|
|
|
696
739
|
this._required = new BehaviorSubject(false);
|
|
697
740
|
this.required$ = this._required.asObservable();
|
|
698
741
|
this.timezone$ = this.dbxCalendarScheduleSelectionStore.currentTimezone$;
|
|
742
|
+
this.openPickerOnTextClick = true;
|
|
699
743
|
this.label = 'Enter a date range';
|
|
700
744
|
this.showCustomize = false;
|
|
701
745
|
this._pickerOpened = new BehaviorSubject(false);
|
|
@@ -722,6 +766,34 @@ class DbxScheduleSelectionCalendarDateRangeComponent {
|
|
|
722
766
|
return currentDateRange ? currentDateRange.start ?? currentDateRange.end : undefined ?? new Date();
|
|
723
767
|
}), shareReplay(1));
|
|
724
768
|
this.isCustomized$ = this.dbxCalendarScheduleSelectionStore.isCustomized$;
|
|
769
|
+
this.currentErrorMessage$ = this.range.statusChanges.pipe(filter((x) => x === 'INVALID' || x === 'VALID'), map((x) => {
|
|
770
|
+
let currentErrorMessage;
|
|
771
|
+
if (x === 'INVALID') {
|
|
772
|
+
const { start, end } = this.range.controls;
|
|
773
|
+
if (this.range.hasError('required')) {
|
|
774
|
+
currentErrorMessage = 'Date range is required';
|
|
775
|
+
}
|
|
776
|
+
else if (start.hasError('matStartDateInvalid')) {
|
|
777
|
+
currentErrorMessage = 'Invalid start date';
|
|
778
|
+
}
|
|
779
|
+
else if (start.hasError('matDatepickerMin')) {
|
|
780
|
+
currentErrorMessage = 'Start date is too early';
|
|
781
|
+
}
|
|
782
|
+
else if (start.hasError('matDatepickerMax')) {
|
|
783
|
+
currentErrorMessage = 'Start date is too late';
|
|
784
|
+
}
|
|
785
|
+
else if (end.hasError('matStartDateInvalid')) {
|
|
786
|
+
currentErrorMessage = 'Invalid end date';
|
|
787
|
+
}
|
|
788
|
+
else if (end.hasError('matDatepickerMin')) {
|
|
789
|
+
currentErrorMessage = 'End date is too early';
|
|
790
|
+
}
|
|
791
|
+
else if (end.hasError('matDatepickerMax')) {
|
|
792
|
+
currentErrorMessage = 'End date is too late';
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
return currentErrorMessage;
|
|
796
|
+
}), shareReplay(1));
|
|
725
797
|
this.pickerOpened$ = this._pickerOpened.asObservable();
|
|
726
798
|
}
|
|
727
799
|
set disabled(disabled) {
|
|
@@ -784,6 +856,11 @@ class DbxScheduleSelectionCalendarDateRangeComponent {
|
|
|
784
856
|
set required(required) {
|
|
785
857
|
this._required.next(required);
|
|
786
858
|
}
|
|
859
|
+
clickedDateRangeInput() {
|
|
860
|
+
if (this.openPickerOnTextClick) {
|
|
861
|
+
this.picker.open();
|
|
862
|
+
}
|
|
863
|
+
}
|
|
787
864
|
pickerOpened() {
|
|
788
865
|
this._pickerOpened.next(true);
|
|
789
866
|
}
|
|
@@ -792,14 +869,19 @@ class DbxScheduleSelectionCalendarDateRangeComponent {
|
|
|
792
869
|
}
|
|
793
870
|
}
|
|
794
871
|
DbxScheduleSelectionCalendarDateRangeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxScheduleSelectionCalendarDateRangeComponent, deps: [{ token: i1.DbxCalendarStore }, { token: DbxCalendarScheduleSelectionStore }, { token: MAT_FORM_FIELD_DEFAULT_OPTIONS }], target: i0.ɵɵFactoryTarget.Component });
|
|
795
|
-
DbxScheduleSelectionCalendarDateRangeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: DbxScheduleSelectionCalendarDateRangeComponent, selector: "dbx-schedule-selection-calendar-date-range", inputs: { label: "label", hint: "hint", disabled: "disabled", showCustomize: "showCustomize", required: "required" }, ngImport: i0, template: "<mat-form-field class=\"dbx-schedule-selection-calendar-date-range-field\">\n <mat-label *ngIf=\"label\">{{ label }}</mat-label>\n <div *ngIf=\"showCustomize && (isCustomized$ | async)\" class=\"date-range-field-customized\">\n
|
|
872
|
+
DbxScheduleSelectionCalendarDateRangeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: DbxScheduleSelectionCalendarDateRangeComponent, selector: "dbx-schedule-selection-calendar-date-range", inputs: { openPickerOnTextClick: "openPickerOnTextClick", label: "label", hint: "hint", disabled: "disabled", showCustomize: "showCustomize", required: "required" }, viewQueries: [{ propertyName: "picker", first: true, predicate: ["picker"], descendants: true }], ngImport: i0, template: "<mat-form-field class=\"dbx-schedule-selection-calendar-date-range-field\">\n <mat-label *ngIf=\"label\">{{ label }}</mat-label>\n <div class=\"dbx-schedule-selection-calendar-date-range-field-content\">\n <!-- Primary Content -->\n <div class=\"dbx-flex\">\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 <dbx-button-spacer></dbx-button-spacer>\n <mat-datepicker-toggle class=\"mat-datepicker-button-highlight\" matIconSuffix [for]=\"picker\"></mat-datepicker-toggle>\n <dbx-button-spacer></dbx-button-spacer>\n <mat-date-range-input (click)=\"clickedDateRangeInput()\" [required]=\"required$ | async\" [min]=\"minDate$ | async\" [max]=\"maxDate$ | async\" [formGroup]=\"range\" [rangePicker]=\"picker\">\n <input [errorStateMatcher]=\"errorStateMatcher\" matStartDate formControlName=\"start\" placeholder=\"Start date\" />\n <input [errorStateMatcher]=\"errorStateMatcher\" matEndDate formControlName=\"end\" placeholder=\"End date\" />\n </mat-date-range-input>\n <span *ngIf=\"timezone$ | async\" class=\"dbx-flex-bar dbx-faint dbx-nowrap dbx-icon-spacer\">{{ timezone$ | async | timezoneAbbreviation: (timezoneReleventDate$ | async) }}</span>\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 </div>\n <!-- Custom Content -->\n <div>\n <ng-content></ng-content>\n </div>\n </div>\n <mat-error *ngIf=\"currentErrorMessage$ | async\">{{ currentErrorMessage$ | async }}</mat-error>\n <mat-hint>{{ hint }}</mat-hint>\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: i4.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.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { 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: i4.AsyncPipe, name: "async" }, { kind: "pipe", type: i3$1.TimezoneAbbreviationPipe, name: "timezoneAbbreviation" }] });
|
|
796
873
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxScheduleSelectionCalendarDateRangeComponent, decorators: [{
|
|
797
874
|
type: Component,
|
|
798
|
-
args: [{ selector: 'dbx-schedule-selection-calendar-date-range', template: "<mat-form-field class=\"dbx-schedule-selection-calendar-date-range-field\">\n <mat-label *ngIf=\"label\">{{ label }}</mat-label>\n <div *ngIf=\"showCustomize && (isCustomized$ | async)\" class=\"date-range-field-customized\">\n
|
|
875
|
+
args: [{ selector: 'dbx-schedule-selection-calendar-date-range', template: "<mat-form-field class=\"dbx-schedule-selection-calendar-date-range-field\">\n <mat-label *ngIf=\"label\">{{ label }}</mat-label>\n <div class=\"dbx-schedule-selection-calendar-date-range-field-content\">\n <!-- Primary Content -->\n <div class=\"dbx-flex\">\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 <dbx-button-spacer></dbx-button-spacer>\n <mat-datepicker-toggle class=\"mat-datepicker-button-highlight\" matIconSuffix [for]=\"picker\"></mat-datepicker-toggle>\n <dbx-button-spacer></dbx-button-spacer>\n <mat-date-range-input (click)=\"clickedDateRangeInput()\" [required]=\"required$ | async\" [min]=\"minDate$ | async\" [max]=\"maxDate$ | async\" [formGroup]=\"range\" [rangePicker]=\"picker\">\n <input [errorStateMatcher]=\"errorStateMatcher\" matStartDate formControlName=\"start\" placeholder=\"Start date\" />\n <input [errorStateMatcher]=\"errorStateMatcher\" matEndDate formControlName=\"end\" placeholder=\"End date\" />\n </mat-date-range-input>\n <span *ngIf=\"timezone$ | async\" class=\"dbx-flex-bar dbx-faint dbx-nowrap dbx-icon-spacer\">{{ timezone$ | async | timezoneAbbreviation: (timezoneReleventDate$ | async) }}</span>\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 </div>\n <!-- Custom Content -->\n <div>\n <ng-content></ng-content>\n </div>\n </div>\n <mat-error *ngIf=\"currentErrorMessage$ | async\">{{ currentErrorMessage$ | async }}</mat-error>\n <mat-hint>{{ hint }}</mat-hint>\n</mat-form-field>\n" }]
|
|
799
876
|
}], ctorParameters: function () { return [{ type: i1.DbxCalendarStore }, { type: DbxCalendarScheduleSelectionStore }, { type: undefined, decorators: [{
|
|
800
877
|
type: Inject,
|
|
801
878
|
args: [MAT_FORM_FIELD_DEFAULT_OPTIONS]
|
|
802
|
-
}] }]; }, propDecorators: {
|
|
879
|
+
}] }]; }, propDecorators: { openPickerOnTextClick: [{
|
|
880
|
+
type: Input
|
|
881
|
+
}], picker: [{
|
|
882
|
+
type: ViewChild,
|
|
883
|
+
args: ['picker']
|
|
884
|
+
}], label: [{
|
|
803
885
|
type: Input
|
|
804
886
|
}], hint: [{
|
|
805
887
|
type: Input
|
|
@@ -852,7 +934,10 @@ class DbxScheduleSelectionCalendarDateDaysComponent {
|
|
|
852
934
|
this.template$ = this.dbxCalendarScheduleSelectionStore.scheduleDays$.pipe(map(enabledDaysFromDateScheduleDayCodes), shareReplay());
|
|
853
935
|
this.isFormModified = (value) => {
|
|
854
936
|
const newSetValue = new Set(dateScheduleDayCodesFromEnabledDays(value));
|
|
855
|
-
return this.dbxCalendarScheduleSelectionStore.scheduleDays$.pipe(map((currentSet) =>
|
|
937
|
+
return this.dbxCalendarScheduleSelectionStore.scheduleDays$.pipe(map((currentSet) => {
|
|
938
|
+
const result = !dateScheduleDayCodesAreSetsEquivalent(newSetValue, currentSet);
|
|
939
|
+
return result;
|
|
940
|
+
}));
|
|
856
941
|
};
|
|
857
942
|
this.updateScheduleDays = (value) => {
|
|
858
943
|
this.dbxCalendarScheduleSelectionStore.setScheduleDays(new Set(dateScheduleDayCodesFromEnabledDays(value)));
|
|
@@ -882,20 +967,24 @@ class DbxScheduleSelectionCalendarDatePopoverContentComponent {
|
|
|
882
967
|
}
|
|
883
968
|
DbxScheduleSelectionCalendarDatePopoverContentComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxScheduleSelectionCalendarDatePopoverContentComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
884
969
|
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: `
|
|
885
|
-
<
|
|
886
|
-
<dbx-schedule-selection-calendar-date-range></dbx-schedule-selection-calendar-date-range>
|
|
887
|
-
<dbx-
|
|
888
|
-
|
|
889
|
-
|
|
970
|
+
<dbx-content-container padding="min" topPadding="normal">
|
|
971
|
+
<dbx-schedule-selection-calendar-date-range [openPickerOnTextClick]="false"></dbx-schedule-selection-calendar-date-range>
|
|
972
|
+
<dbx-label-block header="Allowed Days Of Week">
|
|
973
|
+
<dbx-schedule-selection-calendar-date-days></dbx-schedule-selection-calendar-date-days>
|
|
974
|
+
</dbx-label-block>
|
|
975
|
+
</dbx-content-container>
|
|
976
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: i1$1.DbxContentContainerDirective, selector: "dbx-content-container,[dbxContentContainer],.dbx-content-container", inputs: ["grow", "padding", "topPadding"] }, { kind: "component", type: i1$1.DbxLabelBlockComponent, selector: "dbx-label-block", inputs: ["header"] }, { kind: "component", type: DbxScheduleSelectionCalendarDateDaysComponent, selector: "dbx-schedule-selection-calendar-date-days" }, { kind: "component", type: DbxScheduleSelectionCalendarDateRangeComponent, selector: "dbx-schedule-selection-calendar-date-range", inputs: ["openPickerOnTextClick", "label", "hint", "disabled", "showCustomize", "required"] }] });
|
|
890
977
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxScheduleSelectionCalendarDatePopoverContentComponent, decorators: [{
|
|
891
978
|
type: Component,
|
|
892
979
|
args: [{
|
|
893
980
|
selector: 'dbx-schedule-selection-calendar-date-popover-content',
|
|
894
981
|
template: `
|
|
895
|
-
<
|
|
896
|
-
<dbx-schedule-selection-calendar-date-range></dbx-schedule-selection-calendar-date-range>
|
|
897
|
-
<dbx-
|
|
898
|
-
|
|
982
|
+
<dbx-content-container padding="min" topPadding="normal">
|
|
983
|
+
<dbx-schedule-selection-calendar-date-range [openPickerOnTextClick]="false"></dbx-schedule-selection-calendar-date-range>
|
|
984
|
+
<dbx-label-block header="Allowed Days Of Week">
|
|
985
|
+
<dbx-schedule-selection-calendar-date-days></dbx-schedule-selection-calendar-date-days>
|
|
986
|
+
</dbx-label-block>
|
|
987
|
+
</dbx-content-container>
|
|
899
988
|
`
|
|
900
989
|
}]
|
|
901
990
|
}] });
|
|
@@ -1153,20 +1242,36 @@ class DbxScheduleSelectionCalendarComponent {
|
|
|
1153
1242
|
this.calendarStore.setNavigationRangeLimit(this.dbxCalendarScheduleSelectionStore.minMaxDateRange$); // set navigation limit to the min/max allowed dates.
|
|
1154
1243
|
this.calendarStore.setShowPageButtons(true);
|
|
1155
1244
|
// when a new filter is set, if the first two pages of selectable indexes fit within the calendar month, focus on that calendar month.
|
|
1156
|
-
this._centerRangeSub.subscription = this.dbxCalendarScheduleSelectionStore.
|
|
1157
|
-
|
|
1245
|
+
this._centerRangeSub.subscription = this.dbxCalendarScheduleSelectionStore.currentDateRange$
|
|
1246
|
+
.pipe(first(), switchMap((x) => {
|
|
1247
|
+
let result = x
|
|
1248
|
+
? of([x, true])
|
|
1249
|
+
: this.dbxCalendarScheduleSelectionStore.minMaxDateRange$.pipe(first(), map((y) => [y, false]));
|
|
1250
|
+
return result;
|
|
1251
|
+
}))
|
|
1252
|
+
.subscribe(([x, isFromSelectedDateRange]) => {
|
|
1253
|
+
if (x?.start) {
|
|
1254
|
+
let tapDay;
|
|
1158
1255
|
const startMonth = dateRange({ date: x.start, type: DateRangeType.CALENDAR_MONTH });
|
|
1159
|
-
const
|
|
1160
|
-
if (
|
|
1161
|
-
const
|
|
1162
|
-
|
|
1256
|
+
const monthToFocus = endOfWeek(startMonth.start);
|
|
1257
|
+
if (x.end != null) {
|
|
1258
|
+
const endMonth = dateRange({ date: x.end, type: DateRangeType.CALENDAR_MONTH });
|
|
1259
|
+
if (isSameDate(startMonth.start, endMonth.start)) {
|
|
1260
|
+
tapDay = monthToFocus;
|
|
1261
|
+
}
|
|
1262
|
+
}
|
|
1263
|
+
if (!tapDay && isFromSelectedDateRange) {
|
|
1264
|
+
tapDay = monthToFocus;
|
|
1265
|
+
}
|
|
1266
|
+
if (tapDay) {
|
|
1267
|
+
this.calendarStore.tapDay(tapDay);
|
|
1163
1268
|
}
|
|
1164
1269
|
}
|
|
1165
1270
|
});
|
|
1166
1271
|
}
|
|
1167
1272
|
ngOnDestroy() {
|
|
1168
|
-
this._inputReadonly.complete();
|
|
1169
1273
|
this.clickEvent.complete();
|
|
1274
|
+
this._inputReadonly.complete();
|
|
1170
1275
|
this._config.complete();
|
|
1171
1276
|
this._centerRangeSub.destroy();
|
|
1172
1277
|
}
|
|
@@ -1278,19 +1383,21 @@ class DbxScheduleSelectionCalendarDateDialogButtonComponent {
|
|
|
1278
1383
|
}
|
|
1279
1384
|
}
|
|
1280
1385
|
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 });
|
|
1281
|
-
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", contentConfig: "contentConfig", closeConfig: "closeConfig" }, ngImport: i0, template: `
|
|
1282
|
-
<button
|
|
1283
|
-
`, isInline: true, dependencies: [{ kind: "component", type:
|
|
1386
|
+
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", disabled: "disabled", contentConfig: "contentConfig", closeConfig: "closeConfig" }, ngImport: i0, template: `
|
|
1387
|
+
<dbx-button [raised]="true" color="accent" [text]="buttonText" [disabled]="disabled" (buttonClick)="clickCustomize()"></dbx-button>
|
|
1388
|
+
`, isInline: true, dependencies: [{ kind: "component", type: i1$1.DbxButtonComponent, selector: "dbx-button", inputs: ["type", "raised", "stroked", "flat", "iconOnly", "color", "customButtonColor", "customTextColor", "customSpinnerColor"] }] });
|
|
1284
1389
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxScheduleSelectionCalendarDateDialogButtonComponent, decorators: [{
|
|
1285
1390
|
type: Component,
|
|
1286
1391
|
args: [{
|
|
1287
1392
|
selector: 'dbx-schedule-selection-calendar-date-dialog-button',
|
|
1288
1393
|
template: `
|
|
1289
|
-
<button
|
|
1394
|
+
<dbx-button [raised]="true" color="accent" [text]="buttonText" [disabled]="disabled" (buttonClick)="clickCustomize()"></dbx-button>
|
|
1290
1395
|
`
|
|
1291
1396
|
}]
|
|
1292
1397
|
}], ctorParameters: function () { return [{ type: i1$2.MatDialog }, { type: i0.Injector }]; }, propDecorators: { buttonText: [{
|
|
1293
1398
|
type: Input
|
|
1399
|
+
}], disabled: [{
|
|
1400
|
+
type: Input
|
|
1294
1401
|
}], contentConfig: [{
|
|
1295
1402
|
type: Input
|
|
1296
1403
|
}], closeConfig: [{
|
|
@@ -1307,11 +1414,13 @@ class DbxFormCalendarDateScheduleRangeFieldComponent extends FieldType {
|
|
|
1307
1414
|
this._valueSub = new SubscriptionObject();
|
|
1308
1415
|
this._timezoneSub = new SubscriptionObject();
|
|
1309
1416
|
this._minMaxDateRangeSub = new SubscriptionObject();
|
|
1417
|
+
this._defaultWeekSub = new SubscriptionObject();
|
|
1310
1418
|
this._filterSub = new SubscriptionObject();
|
|
1311
1419
|
this._exclusionsSub = new SubscriptionObject();
|
|
1312
1420
|
this._formControlObs = new BehaviorSubject(undefined);
|
|
1313
1421
|
this.formControl$ = this._formControlObs.pipe(filterMaybe());
|
|
1314
1422
|
this.value$ = this.formControl$.pipe(switchMap((control) => control.valueChanges.pipe(startWith(control.value))), shareReplay(1));
|
|
1423
|
+
this.disableCustomize$ = this.value$.pipe(map((x) => (this.allowCustomizeWithoutDateRange ? false : !x)), distinctUntilChanged(), shareReplay(1));
|
|
1315
1424
|
}
|
|
1316
1425
|
get formGroupName() {
|
|
1317
1426
|
return this.field.key;
|
|
@@ -1328,9 +1437,18 @@ class DbxFormCalendarDateScheduleRangeFieldComponent extends FieldType {
|
|
|
1328
1437
|
get isReadonlyOrDisabled() {
|
|
1329
1438
|
return this.props.readonly || this.disabled;
|
|
1330
1439
|
}
|
|
1440
|
+
get openPickerOnTextClick() {
|
|
1441
|
+
return this.props.allowTextInput !== true; // Opposite of allowTextInput
|
|
1442
|
+
}
|
|
1443
|
+
get allowCustomizeWithoutDateRange() {
|
|
1444
|
+
return this.props.allowCustomizeWithoutDateRange ?? false;
|
|
1445
|
+
}
|
|
1331
1446
|
get showCustomize() {
|
|
1332
1447
|
return !this.props.hideCustomize;
|
|
1333
1448
|
}
|
|
1449
|
+
get defaultScheduleDays() {
|
|
1450
|
+
return this.props.defaultScheduleDays;
|
|
1451
|
+
}
|
|
1334
1452
|
get minMaxDateRange() {
|
|
1335
1453
|
return this.props.minMaxDateRange;
|
|
1336
1454
|
}
|
|
@@ -1355,6 +1473,9 @@ class DbxFormCalendarDateScheduleRangeFieldComponent extends FieldType {
|
|
|
1355
1473
|
get dialogContentConfig() {
|
|
1356
1474
|
return this.props.dialogContentConfig;
|
|
1357
1475
|
}
|
|
1476
|
+
get customDetailsConfig() {
|
|
1477
|
+
return this.props.customDetailsConfig;
|
|
1478
|
+
}
|
|
1358
1479
|
get cellContentFactory() {
|
|
1359
1480
|
return this.props.cellContentFactory;
|
|
1360
1481
|
}
|
|
@@ -1366,10 +1487,13 @@ class DbxFormCalendarDateScheduleRangeFieldComponent extends FieldType {
|
|
|
1366
1487
|
this._valueSub.subscription = this.dbxCalendarScheduleSelectionStore.currentDateScheduleRangeValue$.subscribe((x) => {
|
|
1367
1488
|
this.formControl.setValue(x);
|
|
1368
1489
|
});
|
|
1369
|
-
const { timezone, minMaxDateRange, filter, exclusions } = this;
|
|
1490
|
+
const { timezone, minMaxDateRange, filter, exclusions, defaultScheduleDays } = this;
|
|
1370
1491
|
if (filter != null) {
|
|
1371
1492
|
this._filterSub.subscription = this.dbxCalendarScheduleSelectionStore.setFilter(asObservable(filter));
|
|
1372
1493
|
}
|
|
1494
|
+
if (defaultScheduleDays != null) {
|
|
1495
|
+
this._defaultWeekSub.subscription = this.dbxCalendarScheduleSelectionStore.setDefaultScheduleDays(asObservable(defaultScheduleDays));
|
|
1496
|
+
}
|
|
1373
1497
|
if (minMaxDateRange != null) {
|
|
1374
1498
|
this._minMaxDateRangeSub.subscription = this.dbxCalendarScheduleSelectionStore.setMinMaxDateRange(asObservable(minMaxDateRange));
|
|
1375
1499
|
}
|
|
@@ -1403,18 +1527,20 @@ class DbxFormCalendarDateScheduleRangeFieldComponent extends FieldType {
|
|
|
1403
1527
|
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 });
|
|
1404
1528
|
DbxFormCalendarDateScheduleRangeFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: DbxFormCalendarDateScheduleRangeFieldComponent, selector: "ng-component", providers: [provideCalendarScheduleSelectionStoreIfParentIsUnavailable()], usesInheritance: true, ngImport: i0, template: `
|
|
1405
1529
|
<div class="dbx-schedule-selection-field">
|
|
1406
|
-
<dbx-schedule-selection-calendar-date-range [showCustomize]="showCustomize" [required]="required" [disabled]="isReadonlyOrDisabled" [label]="label" [hint]="description">
|
|
1407
|
-
<dbx-schedule-selection-calendar-date-dialog-button [contentConfig]="dialogContentConfig" [closeConfig]="closeDialogConfig"
|
|
1530
|
+
<dbx-schedule-selection-calendar-date-range [openPickerOnTextClick]="openPickerOnTextClick" [showCustomize]="showCustomize" [required]="required" [disabled]="isReadonlyOrDisabled" [label]="label" [hint]="description">
|
|
1531
|
+
<dbx-schedule-selection-calendar-date-dialog-button customizeButton [disabled]="disableCustomize$ | async" [contentConfig]="dialogContentConfig" [closeConfig]="closeDialogConfig"></dbx-schedule-selection-calendar-date-dialog-button>
|
|
1532
|
+
<dbx-injection [config]="customDetailsConfig"></dbx-injection>
|
|
1408
1533
|
</dbx-schedule-selection-calendar-date-range>
|
|
1409
1534
|
</div>
|
|
1410
|
-
`, isInline: true, dependencies: [{ kind: "component", type: DbxScheduleSelectionCalendarDateRangeComponent, selector: "dbx-schedule-selection-calendar-date-range", inputs: ["label", "hint", "disabled", "showCustomize", "required"] }, { kind: "component", type: DbxScheduleSelectionCalendarDateDialogButtonComponent, selector: "dbx-schedule-selection-calendar-date-dialog-button", inputs: ["buttonText", "contentConfig", "closeConfig"] }] });
|
|
1535
|
+
`, isInline: true, dependencies: [{ kind: "component", type: i3$1.DbxInjectionComponent, selector: "dbx-injection, [dbxInjection], [dbx-injection]", inputs: ["config", "template"] }, { kind: "component", type: DbxScheduleSelectionCalendarDateRangeComponent, selector: "dbx-schedule-selection-calendar-date-range", inputs: ["openPickerOnTextClick", "label", "hint", "disabled", "showCustomize", "required"] }, { kind: "component", type: DbxScheduleSelectionCalendarDateDialogButtonComponent, selector: "dbx-schedule-selection-calendar-date-dialog-button", inputs: ["buttonText", "disabled", "contentConfig", "closeConfig"] }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }] });
|
|
1411
1536
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFormCalendarDateScheduleRangeFieldComponent, decorators: [{
|
|
1412
1537
|
type: Component,
|
|
1413
1538
|
args: [{
|
|
1414
1539
|
template: `
|
|
1415
1540
|
<div class="dbx-schedule-selection-field">
|
|
1416
|
-
<dbx-schedule-selection-calendar-date-range [showCustomize]="showCustomize" [required]="required" [disabled]="isReadonlyOrDisabled" [label]="label" [hint]="description">
|
|
1417
|
-
<dbx-schedule-selection-calendar-date-dialog-button [contentConfig]="dialogContentConfig" [closeConfig]="closeDialogConfig"
|
|
1541
|
+
<dbx-schedule-selection-calendar-date-range [openPickerOnTextClick]="openPickerOnTextClick" [showCustomize]="showCustomize" [required]="required" [disabled]="isReadonlyOrDisabled" [label]="label" [hint]="description">
|
|
1542
|
+
<dbx-schedule-selection-calendar-date-dialog-button customizeButton [disabled]="disableCustomize$ | async" [contentConfig]="dialogContentConfig" [closeConfig]="closeDialogConfig"></dbx-schedule-selection-calendar-date-dialog-button>
|
|
1543
|
+
<dbx-injection [config]="customDetailsConfig"></dbx-injection>
|
|
1418
1544
|
</dbx-schedule-selection-calendar-date-range>
|
|
1419
1545
|
</div>
|
|
1420
1546
|
`,
|
|
@@ -1458,6 +1584,8 @@ DbxFormCalendarModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", v
|
|
|
1458
1584
|
DbxScheduleSelectionCalendarSelectionToggleButtonComponent], imports: [
|
|
1459
1585
|
//
|
|
1460
1586
|
DbxInjectionComponentModule,
|
|
1587
|
+
DbxContentLayoutModule,
|
|
1588
|
+
DbxTextModule,
|
|
1461
1589
|
DbxActionModule,
|
|
1462
1590
|
DbxFormModule,
|
|
1463
1591
|
DbxFormlyModule,
|
|
@@ -1494,6 +1622,8 @@ DbxFormCalendarModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", v
|
|
|
1494
1622
|
DbxFormCalendarModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFormCalendarModule, imports: [
|
|
1495
1623
|
//
|
|
1496
1624
|
DbxInjectionComponentModule,
|
|
1625
|
+
DbxContentLayoutModule,
|
|
1626
|
+
DbxTextModule,
|
|
1497
1627
|
DbxActionModule,
|
|
1498
1628
|
DbxFormModule,
|
|
1499
1629
|
DbxFormlyModule,
|
|
@@ -1520,6 +1650,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
|
|
|
1520
1650
|
imports: [
|
|
1521
1651
|
//
|
|
1522
1652
|
DbxInjectionComponentModule,
|
|
1653
|
+
DbxContentLayoutModule,
|
|
1654
|
+
DbxTextModule,
|
|
1523
1655
|
DbxActionModule,
|
|
1524
1656
|
DbxFormModule,
|
|
1525
1657
|
DbxFormlyModule,
|
|
@@ -1549,7 +1681,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
|
|
|
1549
1681
|
class DbxFormDateScheduleRangeFieldModule {
|
|
1550
1682
|
}
|
|
1551
1683
|
DbxFormDateScheduleRangeFieldModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFormDateScheduleRangeFieldModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1552
|
-
DbxFormDateScheduleRangeFieldModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.12", ngImport: i0, type: DbxFormDateScheduleRangeFieldModule, declarations: [DbxFormCalendarDateScheduleRangeFieldComponent], imports: [
|
|
1684
|
+
DbxFormDateScheduleRangeFieldModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.12", ngImport: i0, type: DbxFormDateScheduleRangeFieldModule, declarations: [DbxFormCalendarDateScheduleRangeFieldComponent], imports: [DbxInjectionComponentModule,
|
|
1685
|
+
CommonModule,
|
|
1553
1686
|
MatIconModule,
|
|
1554
1687
|
DbxFormCalendarModule,
|
|
1555
1688
|
MatButtonModule,
|
|
@@ -1557,7 +1690,8 @@ DbxFormDateScheduleRangeFieldModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersio
|
|
|
1557
1690
|
FormsModule,
|
|
1558
1691
|
ReactiveFormsModule,
|
|
1559
1692
|
MatInputModule, i1$3.FormlyModule] });
|
|
1560
|
-
DbxFormDateScheduleRangeFieldModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFormDateScheduleRangeFieldModule, imports: [
|
|
1693
|
+
DbxFormDateScheduleRangeFieldModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFormDateScheduleRangeFieldModule, imports: [DbxInjectionComponentModule,
|
|
1694
|
+
CommonModule,
|
|
1561
1695
|
MatIconModule,
|
|
1562
1696
|
DbxFormCalendarModule,
|
|
1563
1697
|
MatButtonModule,
|
|
@@ -1572,6 +1706,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
|
|
|
1572
1706
|
type: NgModule,
|
|
1573
1707
|
args: [{
|
|
1574
1708
|
imports: [
|
|
1709
|
+
DbxInjectionComponentModule,
|
|
1575
1710
|
CommonModule,
|
|
1576
1711
|
MatIconModule,
|
|
1577
1712
|
DbxFormCalendarModule,
|
|
@@ -1594,5 +1729,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
|
|
|
1594
1729
|
* Generated bundle index. Do not edit.
|
|
1595
1730
|
*/
|
|
1596
1731
|
|
|
1597
|
-
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 };
|
|
1732
|
+
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, finalizeUpdateStateWithChangedScheduleDays, initialCalendarScheduleSelectionState, isEnabledDayInCalendarScheduleSelectionState, noSelectionCalendarScheduleSelectionState, provideCalendarScheduleSelectionStoreIfParentIsUnavailable, updateStateWithChangedDates, updateStateWithChangedDefaultScheduleDays, updateStateWithChangedRange, updateStateWithChangedScheduleDays, updateStateWithComputeSelectionResultRelativeToFilter, updateStateWithDateScheduleRangeValue, updateStateWithExclusions, updateStateWithFilter, updateStateWithInitialSelectionState, updateStateWithMinMaxDateRange, updateStateWithTimezoneValue };
|
|
1598
1733
|
//# sourceMappingURL=dereekb-dbx-form-calendar.mjs.map
|