@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,16 +1,18 @@
|
|
|
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 i0 from '@angular/core';
|
|
4
|
-
import { Injectable, SkipSelf, Directive, Injector, Optional, Component, Inject, Input,
|
|
4
|
+
import { Injectable, SkipSelf, Directive, Injector, Optional, Component, Inject, Input, ViewChild, ElementRef, ChangeDetectionStrategy, EventEmitter, Output, InjectionToken, NgModule } from '@angular/core';
|
|
5
5
|
import { FieldType } from '@ngx-formly/material';
|
|
6
|
-
import { switchMap, first, tap, map, distinctUntilChanged, shareReplay, of, combineLatestWith, BehaviorSubject,
|
|
6
|
+
import { switchMap, first, tap, map, distinctUntilChanged, shareReplay, of, combineLatestWith, BehaviorSubject, filter, startWith, throttleTime, combineLatest } from 'rxjs';
|
|
7
7
|
import { filterMaybe, distinctUntilHasDifferentValues, SubscriptionObject, asObservableFromGetter, asObservable } from '@dereekb/rxjs';
|
|
8
|
-
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';
|
|
9
|
-
import {
|
|
8
|
+
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';
|
|
9
|
+
import { mapValuesToSet, unique, mergeArrays, iterableToArray, range, toggleInSet, removeFromSet, addToSet, isIndexNumberInIndexRangeFunction, minAndMaxNumber, 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';
|
|
13
|
-
import { AbstractPopoverDirective, AbstractDialogDirective, sanitizeDbxDialogContentConfig, DbxActionModule, DbxButtonModule, DbxDialogInteractionModule, DbxPopoverInteractionModule
|
|
13
|
+
import { AbstractPopoverDirective, AbstractDialogDirective, sanitizeDbxDialogContentConfig, DbxContentLayoutModule, DbxTextModule, DbxActionModule, DbxButtonModule, DbxDialogInteractionModule, DbxPopoverInteractionModule } from '@dereekb/dbx-web';
|
|
14
|
+
import * as i3$1 from '@dereekb/dbx-core';
|
|
15
|
+
import { switchMapDbxInjectionComponentConfig, DbxInjectionComponentModule, DbxDatePipeModule } from '@dereekb/dbx-core';
|
|
14
16
|
import * as i3 from '@angular/forms';
|
|
15
17
|
import { FormGroup, FormControl, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
16
18
|
import * as i5 from '@angular/material/form-field';
|
|
@@ -21,30 +23,29 @@ import * as i4 from '@angular/common';
|
|
|
21
23
|
import { CommonModule } from '@angular/common';
|
|
22
24
|
import * as i7 from '@angular/material/datepicker';
|
|
23
25
|
import { MatDatepickerModule } from '@angular/material/datepicker';
|
|
24
|
-
import * as i3$1 from '@dereekb/dbx-core';
|
|
25
|
-
import { switchMapDbxInjectionComponentConfig, DbxInjectionComponentModule, DbxDatePipeModule } from '@dereekb/dbx-core';
|
|
26
26
|
import * as i6 from 'angular-calendar';
|
|
27
27
|
import { CalendarModule, CalendarDayModule, CalendarWeekModule } from 'angular-calendar';
|
|
28
28
|
import * as i7$1 from '@angular/flex-layout/extended';
|
|
29
29
|
import * as i3$2 from '@angular/material/icon';
|
|
30
30
|
import { MatIconModule } from '@angular/material/icon';
|
|
31
31
|
import * as i1$2 from '@angular/material/dialog';
|
|
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
40
|
var _a;
|
|
42
|
-
const { key = 'schedule', appearance, hideCustomize, filter, timezone, initialSelectionState, computeSelectionResultRelativeToFilter, exclusions, minMaxDateRange, cellContentFactory, dialogContentConfig, closeDialogConfig } = config;
|
|
41
|
+
const { key = 'schedule', appearance, hideCustomize, allowTextInput, filter, timezone, initialSelectionState, computeSelectionResultRelativeToFilter, exclusions, defaultScheduleDays, minMaxDateRange, cellContentFactory, dialogContentConfig, closeDialogConfig, customDetailsConfig } = config;
|
|
43
42
|
const fieldConfig = Object.assign({}, formlyField(Object.assign({ key, type: 'date-schedule-range' }, propsAndConfigForFieldConfig(config, {
|
|
44
43
|
label: (_a = config.label) !== null && _a !== void 0 ? _a : 'Schedule',
|
|
44
|
+
allowTextInput,
|
|
45
45
|
appearance,
|
|
46
46
|
hideCustomize,
|
|
47
47
|
timezone,
|
|
48
|
+
defaultScheduleDays,
|
|
48
49
|
minMaxDateRange,
|
|
49
50
|
filter,
|
|
50
51
|
exclusions,
|
|
@@ -52,7 +53,8 @@ function dateScheduleRangeField(config = {}) {
|
|
|
52
53
|
closeDialogConfig,
|
|
53
54
|
computeSelectionResultRelativeToFilter,
|
|
54
55
|
initialSelectionState,
|
|
55
|
-
cellContentFactory
|
|
56
|
+
cellContentFactory,
|
|
57
|
+
customDetailsConfig
|
|
56
58
|
}))));
|
|
57
59
|
return fieldConfig;
|
|
58
60
|
}
|
|
@@ -89,8 +91,8 @@ const defaultCalendarScheduleSelectionCellContentFactory = (day) => {
|
|
|
89
91
|
};
|
|
90
92
|
|
|
91
93
|
function initialCalendarScheduleSelectionState() {
|
|
92
|
-
const
|
|
93
|
-
const allowedDaysOfWeek = expandDateScheduleDayCodesToDayOfWeekSet(
|
|
94
|
+
const defaultScheduleDays = new Set([DateScheduleDayCode.WEEKDAY, DateScheduleDayCode.WEEKEND]);
|
|
95
|
+
const allowedDaysOfWeek = expandDateScheduleDayCodesToDayOfWeekSet(defaultScheduleDays);
|
|
94
96
|
const start = startOfDay(new Date());
|
|
95
97
|
const indexFactory = dateTimingRelativeIndexFactory({ start });
|
|
96
98
|
const indexDayOfWeek = dateBlockDayOfWeekFactory(start);
|
|
@@ -98,7 +100,8 @@ function initialCalendarScheduleSelectionState() {
|
|
|
98
100
|
start,
|
|
99
101
|
indexFactory,
|
|
100
102
|
toggledIndexes: new Set(),
|
|
101
|
-
|
|
103
|
+
defaultScheduleDays,
|
|
104
|
+
effectiveScheduleDays: defaultScheduleDays,
|
|
102
105
|
allowedDaysOfWeek,
|
|
103
106
|
indexDayOfWeek,
|
|
104
107
|
isEnabledFilterDay: () => true,
|
|
@@ -163,7 +166,8 @@ class DbxCalendarScheduleSelectionStore extends ComponentStore {
|
|
|
163
166
|
//
|
|
164
167
|
map(calendarScheduleStartBeingUsedFromFilter), distinctUntilChanged(), shareReplay(1));
|
|
165
168
|
this.dateRange$ = this.currentDateRange$.pipe(filterMaybe(), shareReplay(1));
|
|
166
|
-
this.
|
|
169
|
+
this.allowedDaysOfWeek$ = this.state$.pipe(map((x) => x.allowedDaysOfWeek), distinctUntilHasDifferentValues(), shareReplay(1));
|
|
170
|
+
this.scheduleDays$ = this.state$.pipe(map((x) => x.effectiveScheduleDays), distinctUntilHasDifferentValues(), shareReplay(1));
|
|
167
171
|
this.currentTimezone$ = this.state$.pipe(map((x) => x.timezone), distinctUntilChanged(), shareReplay(1));
|
|
168
172
|
this.effectiveTimezone$ = this.state$.pipe(map((x) => (!calendarScheduleStartBeingUsedFromFilter(x) && x.timezone ? x.timezone : undefined)), distinctUntilChanged(), shareReplay(1));
|
|
169
173
|
this.effectiveTimezoneNormal$ = this.state$.pipe(map((x) => (!calendarScheduleStartBeingUsedFromFilter(x) && x.timezoneNormal ? x.timezoneNormal : undefined)), distinctUntilChanged(), shareReplay(1));
|
|
@@ -203,6 +207,7 @@ class DbxCalendarScheduleSelectionStore extends ComponentStore {
|
|
|
203
207
|
this.isViewReadonly$ = this.state$.pipe(map((x) => x.isViewReadonly), distinctUntilChanged(), shareReplay(1));
|
|
204
208
|
// MARK: State Changes
|
|
205
209
|
this.setMinMaxDateRange = this.updater(updateStateWithMinMaxDateRange);
|
|
210
|
+
this.setDefaultWeek = this.updater(updateStateWithMinMaxDateRange);
|
|
206
211
|
this.setFilter = this.updater(updateStateWithFilter);
|
|
207
212
|
this.setExclusions = this.updater(updateStateWithExclusions);
|
|
208
213
|
this.setComputeSelectionResultRelativeToFilter = this.updater(updateStateWithComputeSelectionResultRelativeToFilter);
|
|
@@ -218,8 +223,9 @@ class DbxCalendarScheduleSelectionStore extends ComponentStore {
|
|
|
218
223
|
this.setSelectedIndexes = this.updater((state, set) => updateStateWithChangedDates(state, { set, invertSetBehavior: true }));
|
|
219
224
|
this.selectAllDates = this.updater((state, selectAll = 'all') => updateStateWithChangedDates(state, { selectAll }));
|
|
220
225
|
this.setInitialSelectionState = this.updater(updateStateWithInitialSelectionState);
|
|
226
|
+
this.setDefaultScheduleDays = this.updater(updateStateWithChangedDefaultScheduleDays);
|
|
221
227
|
this.setScheduleDays = this.updater(updateStateWithChangedScheduleDays);
|
|
222
|
-
this.setAllowAllScheduleDays = this.updater((state) => updateStateWithChangedScheduleDays(state,
|
|
228
|
+
this.setAllowAllScheduleDays = this.updater((state) => updateStateWithChangedScheduleDays(state, [DateScheduleDayCode.WEEKDAY, DateScheduleDayCode.WEEKEND]));
|
|
223
229
|
this.setDateScheduleRangeValue = this.updater((state, value) => updateStateWithDateScheduleRangeValue(state, value));
|
|
224
230
|
this.setCellContentFactory = this.updater((state, cellContentFactory) => (Object.assign(Object.assign({}, state), { cellContentFactory })));
|
|
225
231
|
/**
|
|
@@ -366,21 +372,57 @@ function updateStateWithDateScheduleRangeValue(state, change) {
|
|
|
366
372
|
}
|
|
367
373
|
}
|
|
368
374
|
}
|
|
375
|
+
function updateStateWithChangedDefaultScheduleDays(state, change) {
|
|
376
|
+
const { defaultScheduleDays: currentDefaultScheduleDays } = state;
|
|
377
|
+
const defaultScheduleDays = new Set(change !== null && change !== void 0 ? change : fullWeekDayScheduleDayCodes());
|
|
378
|
+
if (dateScheduleDayCodesAreSetsEquivalent(defaultScheduleDays, currentDefaultScheduleDays)) {
|
|
379
|
+
return state; // no change
|
|
380
|
+
}
|
|
381
|
+
else {
|
|
382
|
+
return finalizeUpdateStateWithChangedScheduleDays(state, Object.assign(Object.assign({}, state), { defaultScheduleDays }));
|
|
383
|
+
}
|
|
384
|
+
}
|
|
369
385
|
function updateStateWithChangedScheduleDays(state, change) {
|
|
370
386
|
const { scheduleDays: currentScheduleDays } = state;
|
|
371
|
-
const scheduleDays = new Set(change
|
|
372
|
-
|
|
373
|
-
|
|
387
|
+
const scheduleDays = new Set(change !== null && change !== void 0 ? change : []);
|
|
388
|
+
let newScheduleDays;
|
|
389
|
+
if (currentScheduleDays != null && change != null) {
|
|
390
|
+
if (dateScheduleDayCodesAreSetsEquivalent(scheduleDays, currentScheduleDays)) {
|
|
391
|
+
newScheduleDays = undefined; //no change
|
|
392
|
+
}
|
|
393
|
+
else {
|
|
394
|
+
newScheduleDays = scheduleDays;
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
else if (currentScheduleDays !== change) {
|
|
398
|
+
newScheduleDays = change ? scheduleDays : null; // set the new one, or clear it
|
|
399
|
+
}
|
|
400
|
+
if (newScheduleDays === undefined) {
|
|
401
|
+
return state;
|
|
402
|
+
}
|
|
403
|
+
else {
|
|
404
|
+
return finalizeUpdateStateWithChangedScheduleDays(state, Object.assign(Object.assign({}, state), { scheduleDays: newScheduleDays !== null && newScheduleDays !== void 0 ? newScheduleDays : undefined }));
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
function finalizeUpdateStateWithChangedScheduleDays(previousState, nextState) {
|
|
408
|
+
var _a;
|
|
409
|
+
const previousScheduleDays = previousState.effectiveScheduleDays;
|
|
410
|
+
const nextScheduleDays = (_a = nextState.scheduleDays) !== null && _a !== void 0 ? _a : nextState.defaultScheduleDays;
|
|
411
|
+
if (dateScheduleDayCodesAreSetsEquivalent(nextScheduleDays, previousScheduleDays)) {
|
|
412
|
+
return nextState; // the default or input schedule changed but the schedule is still the same, so no need for an update.
|
|
374
413
|
}
|
|
375
414
|
else {
|
|
376
|
-
const
|
|
377
|
-
const
|
|
378
|
-
return finalizeNewCalendarScheduleSelectionState(nextState)
|
|
415
|
+
const effectiveScheduleDays = new Set(simplifyDateScheduleDayCodes(nextScheduleDays));
|
|
416
|
+
const allowedDaysOfWeek = expandDateScheduleDayCodesToDayOfWeekSet(nextScheduleDays);
|
|
417
|
+
return finalizeNewCalendarScheduleSelectionState(Object.assign(Object.assign({}, nextState), {
|
|
418
|
+
// update the effective schedule days and allowed days of week
|
|
419
|
+
effectiveScheduleDays,
|
|
420
|
+
allowedDaysOfWeek }));
|
|
379
421
|
}
|
|
380
422
|
}
|
|
381
423
|
function updateStateWithChangedDates(state, change) {
|
|
382
424
|
var _a;
|
|
383
|
-
const {
|
|
425
|
+
const { allowedDaysOfWeek, indexFactory, indexDayOfWeek, inputStart: currentInputStart, inputEnd: currentInputEnd, minMaxDateRange, filter } = state;
|
|
384
426
|
const { start: minDate, end: maxDate } = calendarScheduleMinAndMaxDateRange(state);
|
|
385
427
|
let inputStart = currentInputStart;
|
|
386
428
|
let inputEnd = currentInputEnd;
|
|
@@ -490,7 +532,7 @@ function finalizeNewCalendarScheduleSelectionState(nextState) {
|
|
|
490
532
|
return nextState;
|
|
491
533
|
}
|
|
492
534
|
function isEnabledDayInCalendarScheduleSelectionState(state) {
|
|
493
|
-
const { indexFactory, inputStart, inputEnd, indexDayOfWeek
|
|
535
|
+
const { allowedDaysOfWeek, indexFactory, inputStart, inputEnd, indexDayOfWeek } = state;
|
|
494
536
|
let isInStartAndEndRange;
|
|
495
537
|
if (inputStart && inputEnd) {
|
|
496
538
|
isInStartAndEndRange = isDateWithinDateBlockRangeFunction({ start: state.start, range: { start: inputStart, end: inputEnd } });
|
|
@@ -509,7 +551,7 @@ function isEnabledDayInCalendarScheduleSelectionState(state) {
|
|
|
509
551
|
};
|
|
510
552
|
}
|
|
511
553
|
function computeScheduleSelectionValue(state) {
|
|
512
|
-
const { indexFactory,
|
|
554
|
+
const { indexFactory, allowedDaysOfWeek, effectiveScheduleDays, indexDayOfWeek, computeSelectionResultRelativeToFilter, filter } = state;
|
|
513
555
|
const rangeAndExclusion = computeScheduleSelectionRangeAndExclusion(state);
|
|
514
556
|
if (rangeAndExclusion == null) {
|
|
515
557
|
return null;
|
|
@@ -537,7 +579,7 @@ function computeScheduleSelectionValue(state) {
|
|
|
537
579
|
: allExcluded;
|
|
538
580
|
const offsetExcluded = excluded.map((x) => x - indexOffset); // set to the proper offset
|
|
539
581
|
const ex = [...filterOffsetExcludedRange, ...offsetExcluded];
|
|
540
|
-
const w = dateScheduleEncodedWeek(
|
|
582
|
+
const w = dateScheduleEncodedWeek(effectiveScheduleDays);
|
|
541
583
|
const d = []; // "included" blocks are never used/calculated.
|
|
542
584
|
// Always ensure the end is after or equal to the start.
|
|
543
585
|
if (isBefore(end, start)) {
|
|
@@ -583,7 +625,7 @@ function computeCalendarScheduleSelectionRange(state) {
|
|
|
583
625
|
return dateRange;
|
|
584
626
|
}
|
|
585
627
|
function computeCalendarScheduleSelectionDateBlockRange(state) {
|
|
586
|
-
const { indexFactory, inputStart, inputEnd,
|
|
628
|
+
const { allowedDaysOfWeek, indexFactory, inputStart, inputEnd, indexDayOfWeek, isEnabledDay, isEnabledFilterDay } = state;
|
|
587
629
|
const enabledExclusionIndexes = Array.from(state.toggledIndexes).filter((i) => allowedDaysOfWeek.has(indexDayOfWeek(i)));
|
|
588
630
|
const minAndMaxSelectedValues = minAndMaxNumber(enabledExclusionIndexes);
|
|
589
631
|
let startRange;
|
|
@@ -685,6 +727,7 @@ class DbxScheduleSelectionCalendarDateRangeComponent {
|
|
|
685
727
|
this._required = new BehaviorSubject(false);
|
|
686
728
|
this.required$ = this._required.asObservable();
|
|
687
729
|
this.timezone$ = this.dbxCalendarScheduleSelectionStore.currentTimezone$;
|
|
730
|
+
this.openPickerOnTextClick = true;
|
|
688
731
|
this.label = 'Enter a date range';
|
|
689
732
|
this.showCustomize = false;
|
|
690
733
|
this._pickerOpened = new BehaviorSubject(false);
|
|
@@ -712,6 +755,34 @@ class DbxScheduleSelectionCalendarDateRangeComponent {
|
|
|
712
755
|
return currentDateRange ? (_a = currentDateRange.start) !== null && _a !== void 0 ? _a : currentDateRange.end : undefined !== null && undefined !== void 0 ? undefined : new Date();
|
|
713
756
|
}), shareReplay(1));
|
|
714
757
|
this.isCustomized$ = this.dbxCalendarScheduleSelectionStore.isCustomized$;
|
|
758
|
+
this.currentErrorMessage$ = this.range.statusChanges.pipe(filter((x) => x === 'INVALID' || x === 'VALID'), map((x) => {
|
|
759
|
+
let currentErrorMessage;
|
|
760
|
+
if (x === 'INVALID') {
|
|
761
|
+
const { start, end } = this.range.controls;
|
|
762
|
+
if (this.range.hasError('required')) {
|
|
763
|
+
currentErrorMessage = 'Date range is required';
|
|
764
|
+
}
|
|
765
|
+
else if (start.hasError('matStartDateInvalid')) {
|
|
766
|
+
currentErrorMessage = 'Invalid start date';
|
|
767
|
+
}
|
|
768
|
+
else if (start.hasError('matDatepickerMin')) {
|
|
769
|
+
currentErrorMessage = 'Start date is too early';
|
|
770
|
+
}
|
|
771
|
+
else if (start.hasError('matDatepickerMax')) {
|
|
772
|
+
currentErrorMessage = 'Start date is too late';
|
|
773
|
+
}
|
|
774
|
+
else if (end.hasError('matStartDateInvalid')) {
|
|
775
|
+
currentErrorMessage = 'Invalid end date';
|
|
776
|
+
}
|
|
777
|
+
else if (end.hasError('matDatepickerMin')) {
|
|
778
|
+
currentErrorMessage = 'End date is too early';
|
|
779
|
+
}
|
|
780
|
+
else if (end.hasError('matDatepickerMax')) {
|
|
781
|
+
currentErrorMessage = 'End date is too late';
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
return currentErrorMessage;
|
|
785
|
+
}), shareReplay(1));
|
|
715
786
|
this.pickerOpened$ = this._pickerOpened.asObservable();
|
|
716
787
|
}
|
|
717
788
|
set disabled(disabled) {
|
|
@@ -775,6 +846,11 @@ class DbxScheduleSelectionCalendarDateRangeComponent {
|
|
|
775
846
|
set required(required) {
|
|
776
847
|
this._required.next(required);
|
|
777
848
|
}
|
|
849
|
+
clickedDateRangeInput() {
|
|
850
|
+
if (this.openPickerOnTextClick) {
|
|
851
|
+
this.picker.open();
|
|
852
|
+
}
|
|
853
|
+
}
|
|
778
854
|
pickerOpened() {
|
|
779
855
|
this._pickerOpened.next(true);
|
|
780
856
|
}
|
|
@@ -783,16 +859,21 @@ class DbxScheduleSelectionCalendarDateRangeComponent {
|
|
|
783
859
|
}
|
|
784
860
|
}
|
|
785
861
|
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 });
|
|
786
|
-
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
|
|
862
|
+
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" }] });
|
|
787
863
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxScheduleSelectionCalendarDateRangeComponent, decorators: [{
|
|
788
864
|
type: Component,
|
|
789
|
-
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
|
|
865
|
+
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" }]
|
|
790
866
|
}], ctorParameters: function () {
|
|
791
867
|
return [{ type: i1.DbxCalendarStore }, { type: DbxCalendarScheduleSelectionStore }, { type: undefined, decorators: [{
|
|
792
868
|
type: Inject,
|
|
793
869
|
args: [MAT_FORM_FIELD_DEFAULT_OPTIONS]
|
|
794
870
|
}] }];
|
|
795
|
-
}, propDecorators: {
|
|
871
|
+
}, propDecorators: { openPickerOnTextClick: [{
|
|
872
|
+
type: Input
|
|
873
|
+
}], picker: [{
|
|
874
|
+
type: ViewChild,
|
|
875
|
+
args: ['picker']
|
|
876
|
+
}], label: [{
|
|
796
877
|
type: Input
|
|
797
878
|
}], hint: [{
|
|
798
879
|
type: Input
|
|
@@ -845,7 +926,10 @@ class DbxScheduleSelectionCalendarDateDaysComponent {
|
|
|
845
926
|
this.template$ = this.dbxCalendarScheduleSelectionStore.scheduleDays$.pipe(map(enabledDaysFromDateScheduleDayCodes), shareReplay());
|
|
846
927
|
this.isFormModified = (value) => {
|
|
847
928
|
const newSetValue = new Set(dateScheduleDayCodesFromEnabledDays(value));
|
|
848
|
-
return this.dbxCalendarScheduleSelectionStore.scheduleDays$.pipe(map((currentSet) =>
|
|
929
|
+
return this.dbxCalendarScheduleSelectionStore.scheduleDays$.pipe(map((currentSet) => {
|
|
930
|
+
const result = !dateScheduleDayCodesAreSetsEquivalent(newSetValue, currentSet);
|
|
931
|
+
return result;
|
|
932
|
+
}));
|
|
849
933
|
};
|
|
850
934
|
this.updateScheduleDays = (value) => {
|
|
851
935
|
this.dbxCalendarScheduleSelectionStore.setScheduleDays(new Set(dateScheduleDayCodesFromEnabledDays(value)));
|
|
@@ -875,20 +959,24 @@ class DbxScheduleSelectionCalendarDatePopoverContentComponent {
|
|
|
875
959
|
}
|
|
876
960
|
DbxScheduleSelectionCalendarDatePopoverContentComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxScheduleSelectionCalendarDatePopoverContentComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
877
961
|
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: `
|
|
878
|
-
<
|
|
879
|
-
<dbx-schedule-selection-calendar-date-range></dbx-schedule-selection-calendar-date-range>
|
|
880
|
-
<dbx-
|
|
881
|
-
|
|
882
|
-
|
|
962
|
+
<dbx-content-container padding="min" topPadding="normal">
|
|
963
|
+
<dbx-schedule-selection-calendar-date-range [openPickerOnTextClick]="false"></dbx-schedule-selection-calendar-date-range>
|
|
964
|
+
<dbx-label-block header="Allowed Days Of Week">
|
|
965
|
+
<dbx-schedule-selection-calendar-date-days></dbx-schedule-selection-calendar-date-days>
|
|
966
|
+
</dbx-label-block>
|
|
967
|
+
</dbx-content-container>
|
|
968
|
+
`, 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"] }] });
|
|
883
969
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxScheduleSelectionCalendarDatePopoverContentComponent, decorators: [{
|
|
884
970
|
type: Component,
|
|
885
971
|
args: [{
|
|
886
972
|
selector: 'dbx-schedule-selection-calendar-date-popover-content',
|
|
887
973
|
template: `
|
|
888
|
-
<
|
|
889
|
-
<dbx-schedule-selection-calendar-date-range></dbx-schedule-selection-calendar-date-range>
|
|
890
|
-
<dbx-
|
|
891
|
-
|
|
974
|
+
<dbx-content-container padding="min" topPadding="normal">
|
|
975
|
+
<dbx-schedule-selection-calendar-date-range [openPickerOnTextClick]="false"></dbx-schedule-selection-calendar-date-range>
|
|
976
|
+
<dbx-label-block header="Allowed Days Of Week">
|
|
977
|
+
<dbx-schedule-selection-calendar-date-days></dbx-schedule-selection-calendar-date-days>
|
|
978
|
+
</dbx-label-block>
|
|
979
|
+
</dbx-content-container>
|
|
892
980
|
`
|
|
893
981
|
}]
|
|
894
982
|
}] });
|
|
@@ -1146,20 +1234,36 @@ class DbxScheduleSelectionCalendarComponent {
|
|
|
1146
1234
|
this.calendarStore.setNavigationRangeLimit(this.dbxCalendarScheduleSelectionStore.minMaxDateRange$); // set navigation limit to the min/max allowed dates.
|
|
1147
1235
|
this.calendarStore.setShowPageButtons(true);
|
|
1148
1236
|
// when a new filter is set, if the first two pages of selectable indexes fit within the calendar month, focus on that calendar month.
|
|
1149
|
-
this._centerRangeSub.subscription = this.dbxCalendarScheduleSelectionStore.
|
|
1150
|
-
|
|
1237
|
+
this._centerRangeSub.subscription = this.dbxCalendarScheduleSelectionStore.currentDateRange$
|
|
1238
|
+
.pipe(first(), switchMap((x) => {
|
|
1239
|
+
let result = x
|
|
1240
|
+
? of([x, true])
|
|
1241
|
+
: this.dbxCalendarScheduleSelectionStore.minMaxDateRange$.pipe(first(), map((y) => [y, false]));
|
|
1242
|
+
return result;
|
|
1243
|
+
}))
|
|
1244
|
+
.subscribe(([x, isFromSelectedDateRange]) => {
|
|
1245
|
+
if (x === null || x === void 0 ? void 0 : x.start) {
|
|
1246
|
+
let tapDay;
|
|
1151
1247
|
const startMonth = dateRange({ date: x.start, type: DateRangeType.CALENDAR_MONTH });
|
|
1152
|
-
const
|
|
1153
|
-
if (
|
|
1154
|
-
const
|
|
1155
|
-
|
|
1248
|
+
const monthToFocus = endOfWeek(startMonth.start);
|
|
1249
|
+
if (x.end != null) {
|
|
1250
|
+
const endMonth = dateRange({ date: x.end, type: DateRangeType.CALENDAR_MONTH });
|
|
1251
|
+
if (isSameDate(startMonth.start, endMonth.start)) {
|
|
1252
|
+
tapDay = monthToFocus;
|
|
1253
|
+
}
|
|
1254
|
+
}
|
|
1255
|
+
if (!tapDay && isFromSelectedDateRange) {
|
|
1256
|
+
tapDay = monthToFocus;
|
|
1257
|
+
}
|
|
1258
|
+
if (tapDay) {
|
|
1259
|
+
this.calendarStore.tapDay(tapDay);
|
|
1156
1260
|
}
|
|
1157
1261
|
}
|
|
1158
1262
|
});
|
|
1159
1263
|
}
|
|
1160
1264
|
ngOnDestroy() {
|
|
1161
|
-
this._inputReadonly.complete();
|
|
1162
1265
|
this.clickEvent.complete();
|
|
1266
|
+
this._inputReadonly.complete();
|
|
1163
1267
|
this._config.complete();
|
|
1164
1268
|
this._centerRangeSub.destroy();
|
|
1165
1269
|
}
|
|
@@ -1264,19 +1368,21 @@ class DbxScheduleSelectionCalendarDateDialogButtonComponent {
|
|
|
1264
1368
|
}
|
|
1265
1369
|
}
|
|
1266
1370
|
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 });
|
|
1267
|
-
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: `
|
|
1268
|
-
<button
|
|
1269
|
-
`, isInline: true, dependencies: [{ kind: "component", type:
|
|
1371
|
+
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: `
|
|
1372
|
+
<dbx-button [raised]="true" color="accent" [text]="buttonText" [disabled]="disabled" (buttonClick)="clickCustomize()"></dbx-button>
|
|
1373
|
+
`, isInline: true, dependencies: [{ kind: "component", type: i1$1.DbxButtonComponent, selector: "dbx-button", inputs: ["type", "raised", "stroked", "flat", "iconOnly", "color", "customButtonColor", "customTextColor", "customSpinnerColor"] }] });
|
|
1270
1374
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxScheduleSelectionCalendarDateDialogButtonComponent, decorators: [{
|
|
1271
1375
|
type: Component,
|
|
1272
1376
|
args: [{
|
|
1273
1377
|
selector: 'dbx-schedule-selection-calendar-date-dialog-button',
|
|
1274
1378
|
template: `
|
|
1275
|
-
<button
|
|
1379
|
+
<dbx-button [raised]="true" color="accent" [text]="buttonText" [disabled]="disabled" (buttonClick)="clickCustomize()"></dbx-button>
|
|
1276
1380
|
`
|
|
1277
1381
|
}]
|
|
1278
1382
|
}], ctorParameters: function () { return [{ type: i1$2.MatDialog }, { type: i0.Injector }]; }, propDecorators: { buttonText: [{
|
|
1279
1383
|
type: Input
|
|
1384
|
+
}], disabled: [{
|
|
1385
|
+
type: Input
|
|
1280
1386
|
}], contentConfig: [{
|
|
1281
1387
|
type: Input
|
|
1282
1388
|
}], closeConfig: [{
|
|
@@ -1293,11 +1399,13 @@ class DbxFormCalendarDateScheduleRangeFieldComponent extends FieldType {
|
|
|
1293
1399
|
this._valueSub = new SubscriptionObject();
|
|
1294
1400
|
this._timezoneSub = new SubscriptionObject();
|
|
1295
1401
|
this._minMaxDateRangeSub = new SubscriptionObject();
|
|
1402
|
+
this._defaultWeekSub = new SubscriptionObject();
|
|
1296
1403
|
this._filterSub = new SubscriptionObject();
|
|
1297
1404
|
this._exclusionsSub = new SubscriptionObject();
|
|
1298
1405
|
this._formControlObs = new BehaviorSubject(undefined);
|
|
1299
1406
|
this.formControl$ = this._formControlObs.pipe(filterMaybe());
|
|
1300
1407
|
this.value$ = this.formControl$.pipe(switchMap((control) => control.valueChanges.pipe(startWith(control.value))), shareReplay(1));
|
|
1408
|
+
this.disableCustomize$ = this.value$.pipe(map((x) => (this.allowCustomizeWithoutDateRange ? false : !x)), distinctUntilChanged(), shareReplay(1));
|
|
1301
1409
|
}
|
|
1302
1410
|
get formGroupName() {
|
|
1303
1411
|
return this.field.key;
|
|
@@ -1315,9 +1423,19 @@ class DbxFormCalendarDateScheduleRangeFieldComponent extends FieldType {
|
|
|
1315
1423
|
get isReadonlyOrDisabled() {
|
|
1316
1424
|
return this.props.readonly || this.disabled;
|
|
1317
1425
|
}
|
|
1426
|
+
get openPickerOnTextClick() {
|
|
1427
|
+
return this.props.allowTextInput !== true; // Opposite of allowTextInput
|
|
1428
|
+
}
|
|
1429
|
+
get allowCustomizeWithoutDateRange() {
|
|
1430
|
+
var _a;
|
|
1431
|
+
return (_a = this.props.allowCustomizeWithoutDateRange) !== null && _a !== void 0 ? _a : false;
|
|
1432
|
+
}
|
|
1318
1433
|
get showCustomize() {
|
|
1319
1434
|
return !this.props.hideCustomize;
|
|
1320
1435
|
}
|
|
1436
|
+
get defaultScheduleDays() {
|
|
1437
|
+
return this.props.defaultScheduleDays;
|
|
1438
|
+
}
|
|
1321
1439
|
get minMaxDateRange() {
|
|
1322
1440
|
return this.props.minMaxDateRange;
|
|
1323
1441
|
}
|
|
@@ -1342,6 +1460,9 @@ class DbxFormCalendarDateScheduleRangeFieldComponent extends FieldType {
|
|
|
1342
1460
|
get dialogContentConfig() {
|
|
1343
1461
|
return this.props.dialogContentConfig;
|
|
1344
1462
|
}
|
|
1463
|
+
get customDetailsConfig() {
|
|
1464
|
+
return this.props.customDetailsConfig;
|
|
1465
|
+
}
|
|
1345
1466
|
get cellContentFactory() {
|
|
1346
1467
|
return this.props.cellContentFactory;
|
|
1347
1468
|
}
|
|
@@ -1353,10 +1474,13 @@ class DbxFormCalendarDateScheduleRangeFieldComponent extends FieldType {
|
|
|
1353
1474
|
this._valueSub.subscription = this.dbxCalendarScheduleSelectionStore.currentDateScheduleRangeValue$.subscribe((x) => {
|
|
1354
1475
|
this.formControl.setValue(x);
|
|
1355
1476
|
});
|
|
1356
|
-
const { timezone, minMaxDateRange, filter, exclusions } = this;
|
|
1477
|
+
const { timezone, minMaxDateRange, filter, exclusions, defaultScheduleDays } = this;
|
|
1357
1478
|
if (filter != null) {
|
|
1358
1479
|
this._filterSub.subscription = this.dbxCalendarScheduleSelectionStore.setFilter(asObservable(filter));
|
|
1359
1480
|
}
|
|
1481
|
+
if (defaultScheduleDays != null) {
|
|
1482
|
+
this._defaultWeekSub.subscription = this.dbxCalendarScheduleSelectionStore.setDefaultScheduleDays(asObservable(defaultScheduleDays));
|
|
1483
|
+
}
|
|
1360
1484
|
if (minMaxDateRange != null) {
|
|
1361
1485
|
this._minMaxDateRangeSub.subscription = this.dbxCalendarScheduleSelectionStore.setMinMaxDateRange(asObservable(minMaxDateRange));
|
|
1362
1486
|
}
|
|
@@ -1390,18 +1514,20 @@ class DbxFormCalendarDateScheduleRangeFieldComponent extends FieldType {
|
|
|
1390
1514
|
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 });
|
|
1391
1515
|
DbxFormCalendarDateScheduleRangeFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: DbxFormCalendarDateScheduleRangeFieldComponent, selector: "ng-component", providers: [provideCalendarScheduleSelectionStoreIfParentIsUnavailable()], usesInheritance: true, ngImport: i0, template: `
|
|
1392
1516
|
<div class="dbx-schedule-selection-field">
|
|
1393
|
-
<dbx-schedule-selection-calendar-date-range [showCustomize]="showCustomize" [required]="required" [disabled]="isReadonlyOrDisabled" [label]="label" [hint]="description">
|
|
1394
|
-
<dbx-schedule-selection-calendar-date-dialog-button [contentConfig]="dialogContentConfig" [closeConfig]="closeDialogConfig"
|
|
1517
|
+
<dbx-schedule-selection-calendar-date-range [openPickerOnTextClick]="openPickerOnTextClick" [showCustomize]="showCustomize" [required]="required" [disabled]="isReadonlyOrDisabled" [label]="label" [hint]="description">
|
|
1518
|
+
<dbx-schedule-selection-calendar-date-dialog-button customizeButton [disabled]="disableCustomize$ | async" [contentConfig]="dialogContentConfig" [closeConfig]="closeDialogConfig"></dbx-schedule-selection-calendar-date-dialog-button>
|
|
1519
|
+
<dbx-injection [config]="customDetailsConfig"></dbx-injection>
|
|
1395
1520
|
</dbx-schedule-selection-calendar-date-range>
|
|
1396
1521
|
</div>
|
|
1397
|
-
`, 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"] }] });
|
|
1522
|
+
`, 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" }] });
|
|
1398
1523
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFormCalendarDateScheduleRangeFieldComponent, decorators: [{
|
|
1399
1524
|
type: Component,
|
|
1400
1525
|
args: [{
|
|
1401
1526
|
template: `
|
|
1402
1527
|
<div class="dbx-schedule-selection-field">
|
|
1403
|
-
<dbx-schedule-selection-calendar-date-range [showCustomize]="showCustomize" [required]="required" [disabled]="isReadonlyOrDisabled" [label]="label" [hint]="description">
|
|
1404
|
-
<dbx-schedule-selection-calendar-date-dialog-button [contentConfig]="dialogContentConfig" [closeConfig]="closeDialogConfig"
|
|
1528
|
+
<dbx-schedule-selection-calendar-date-range [openPickerOnTextClick]="openPickerOnTextClick" [showCustomize]="showCustomize" [required]="required" [disabled]="isReadonlyOrDisabled" [label]="label" [hint]="description">
|
|
1529
|
+
<dbx-schedule-selection-calendar-date-dialog-button customizeButton [disabled]="disableCustomize$ | async" [contentConfig]="dialogContentConfig" [closeConfig]="closeDialogConfig"></dbx-schedule-selection-calendar-date-dialog-button>
|
|
1530
|
+
<dbx-injection [config]="customDetailsConfig"></dbx-injection>
|
|
1405
1531
|
</dbx-schedule-selection-calendar-date-range>
|
|
1406
1532
|
</div>
|
|
1407
1533
|
`,
|
|
@@ -1448,6 +1574,8 @@ DbxFormCalendarModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", v
|
|
|
1448
1574
|
], imports: [
|
|
1449
1575
|
//
|
|
1450
1576
|
DbxInjectionComponentModule,
|
|
1577
|
+
DbxContentLayoutModule,
|
|
1578
|
+
DbxTextModule,
|
|
1451
1579
|
DbxActionModule,
|
|
1452
1580
|
DbxFormModule,
|
|
1453
1581
|
DbxFormlyModule,
|
|
@@ -1486,6 +1614,8 @@ DbxFormCalendarModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", v
|
|
|
1486
1614
|
DbxFormCalendarModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFormCalendarModule, imports: [
|
|
1487
1615
|
//
|
|
1488
1616
|
DbxInjectionComponentModule,
|
|
1617
|
+
DbxContentLayoutModule,
|
|
1618
|
+
DbxTextModule,
|
|
1489
1619
|
DbxActionModule,
|
|
1490
1620
|
DbxFormModule,
|
|
1491
1621
|
DbxFormlyModule,
|
|
@@ -1513,6 +1643,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
|
|
|
1513
1643
|
imports: [
|
|
1514
1644
|
//
|
|
1515
1645
|
DbxInjectionComponentModule,
|
|
1646
|
+
DbxContentLayoutModule,
|
|
1647
|
+
DbxTextModule,
|
|
1516
1648
|
DbxActionModule,
|
|
1517
1649
|
DbxFormModule,
|
|
1518
1650
|
DbxFormlyModule,
|
|
@@ -1542,7 +1674,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
|
|
|
1542
1674
|
class DbxFormDateScheduleRangeFieldModule {
|
|
1543
1675
|
}
|
|
1544
1676
|
DbxFormDateScheduleRangeFieldModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFormDateScheduleRangeFieldModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1545
|
-
DbxFormDateScheduleRangeFieldModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.12", ngImport: i0, type: DbxFormDateScheduleRangeFieldModule, declarations: [DbxFormCalendarDateScheduleRangeFieldComponent], imports: [
|
|
1677
|
+
DbxFormDateScheduleRangeFieldModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.12", ngImport: i0, type: DbxFormDateScheduleRangeFieldModule, declarations: [DbxFormCalendarDateScheduleRangeFieldComponent], imports: [DbxInjectionComponentModule,
|
|
1678
|
+
CommonModule,
|
|
1546
1679
|
MatIconModule,
|
|
1547
1680
|
DbxFormCalendarModule,
|
|
1548
1681
|
MatButtonModule,
|
|
@@ -1550,7 +1683,8 @@ DbxFormDateScheduleRangeFieldModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersio
|
|
|
1550
1683
|
FormsModule,
|
|
1551
1684
|
ReactiveFormsModule,
|
|
1552
1685
|
MatInputModule, i1$3.FormlyModule] });
|
|
1553
|
-
DbxFormDateScheduleRangeFieldModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFormDateScheduleRangeFieldModule, imports: [
|
|
1686
|
+
DbxFormDateScheduleRangeFieldModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFormDateScheduleRangeFieldModule, imports: [DbxInjectionComponentModule,
|
|
1687
|
+
CommonModule,
|
|
1554
1688
|
MatIconModule,
|
|
1555
1689
|
DbxFormCalendarModule,
|
|
1556
1690
|
MatButtonModule,
|
|
@@ -1565,6 +1699,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
|
|
|
1565
1699
|
type: NgModule,
|
|
1566
1700
|
args: [{
|
|
1567
1701
|
imports: [
|
|
1702
|
+
DbxInjectionComponentModule,
|
|
1568
1703
|
CommonModule,
|
|
1569
1704
|
MatIconModule,
|
|
1570
1705
|
DbxFormCalendarModule,
|
|
@@ -1587,5 +1722,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
|
|
|
1587
1722
|
* Generated bundle index. Do not edit.
|
|
1588
1723
|
*/
|
|
1589
1724
|
|
|
1590
|
-
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 };
|
|
1725
|
+
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 };
|
|
1591
1726
|
//# sourceMappingURL=dereekb-dbx-form-calendar.mjs.map
|