@dereekb/dbx-form 9.23.22 → 9.23.24
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.range.component.d.ts +2 -0
- package/calendar/lib/calendar.schedule.selection.store.d.ts +19 -3
- package/calendar/lib/field/schedule/calendar.schedule.field.component.d.ts +7 -1
- package/esm2020/calendar/lib/calendar.module.mjs +8 -5
- package/esm2020/calendar/lib/calendar.schedule.selection.component.mjs +1 -1
- package/esm2020/calendar/lib/calendar.schedule.selection.range.component.mjs +9 -4
- package/esm2020/calendar/lib/calendar.schedule.selection.store.mjs +68 -16
- package/esm2020/calendar/lib/field/schedule/calendar.schedule.field.component.mjs +10 -2
- package/esm2020/calendar/lib/field/schedule/calendar.schedule.field.mjs +3 -2
- package/fesm2015/dereekb-dbx-form-calendar.mjs +83 -25
- package/fesm2015/dereekb-dbx-form-calendar.mjs.map +1 -1
- package/fesm2020/dereekb-dbx-form-calendar.mjs +93 -25
- package/fesm2020/dereekb-dbx-form-calendar.mjs.map +1 -1
- package/mapbox/package.json +4 -4
- package/package.json +4 -4
|
@@ -5,9 +5,9 @@ import { AbstractPopoverDirective, AbstractDialogDirective, DbxActionModule, Dbx
|
|
|
5
5
|
import * as i0 from '@angular/core';
|
|
6
6
|
import { Injectable, SkipSelf, Directive, Injector, Optional, Component, Inject, Input, ElementRef, ViewChild, ChangeDetectionStrategy, EventEmitter, Output, NgModule } from '@angular/core';
|
|
7
7
|
import { FieldType } from '@ngx-formly/material';
|
|
8
|
-
import { switchMap, first, tap, map, distinctUntilChanged, shareReplay, BehaviorSubject, of, startWith, filter, throttleTime } from 'rxjs';
|
|
8
|
+
import { switchMap, first, tap, map, distinctUntilChanged, shareReplay, combineLatestWith, BehaviorSubject, of, startWith, filter, throttleTime } from 'rxjs';
|
|
9
9
|
import { filterMaybe, SubscriptionObject, asObservable } from '@dereekb/rxjs';
|
|
10
|
-
import { DateScheduleDayCode, expandDateScheduleDayCodesToDayOfWeekSet, dateTimingRelativeIndexFactory, dateBlockDayOfWeekFactory, findMaxDate, findMinDate, isSameDateRange, isSameDateDay, isSameDate, isSameDateScheduleRange, dateTimingRelativeIndexArrayFactory, isInfiniteDateRange, copyDateScheduleDateFilterConfig, dateScheduleDateFilter, expandDateScheduleDayCodes, isDateInDateRangeFunction, isDateWithinDateBlockRangeFunction, copyHoursAndMinutesFromDate, dateScheduleEncodedWeek, dateBlockTimingDateFactory, enabledDaysFromDateScheduleDayCodes, dateScheduleDayCodesFromEnabledDays, formatToMonthDayString } from '@dereekb/date';
|
|
10
|
+
import { DateScheduleDayCode, expandDateScheduleDayCodesToDayOfWeekSet, dateTimingRelativeIndexFactory, dateBlockDayOfWeekFactory, findMaxDate, findMinDate, isSameDateRange, isSameDateDay, isSameDate, isSameDateScheduleRange, dateTimingRelativeIndexArrayFactory, isInfiniteDateRange, copyDateScheduleDateFilterConfig, dateScheduleDateFilter, dateTimezoneUtcNormal, expandDateScheduleDayCodes, isDateInDateRangeFunction, isDateWithinDateBlockRangeFunction, copyHoursAndMinutesFromDate, dateScheduleEncodedWeek, dateBlockTimingDateFactory, enabledDaysFromDateScheduleDayCodes, dateScheduleDayCodesFromEnabledDays, formatToMonthDayString } from '@dereekb/date';
|
|
11
11
|
import { setsAreEquivalent, unique, mergeArrays, iterableToArray, toggleInSet, addToSet, isIndexNumberInIndexRangeFunction, range, minAndMaxNumber, getDaysOfWeekNames } from '@dereekb/util';
|
|
12
12
|
import { ComponentStore } from '@ngrx/component-store';
|
|
13
13
|
import { startOfDay, endOfDay, isBefore } from 'date-fns';
|
|
@@ -21,9 +21,9 @@ import * as i4 from '@angular/common';
|
|
|
21
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 i1$2 from '@angular/material/dialog';
|
|
25
24
|
import * as i3$1 from '@dereekb/dbx-core';
|
|
26
|
-
import { switchMapDbxInjectionComponentConfig, DbxInjectionComponentModule } from '@dereekb/dbx-core';
|
|
25
|
+
import { switchMapDbxInjectionComponentConfig, DbxInjectionComponentModule, DbxDatePipeModule } from '@dereekb/dbx-core';
|
|
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 i3$2 from '@angular/material/icon';
|
|
@@ -37,7 +37,7 @@ import { MatButtonToggleModule } from '@angular/material/button-toggle';
|
|
|
37
37
|
import { FlexLayoutModule } from '@angular/flex-layout';
|
|
38
38
|
|
|
39
39
|
function dateScheduleRangeField(config = {}) {
|
|
40
|
-
const { key = 'schedule', filter, initialSelectionState, computeSelectionResultRelativeToFilter, exclusions, minMaxDateRange } = config;
|
|
40
|
+
const { key = 'schedule', filter, timezone, initialSelectionState, computeSelectionResultRelativeToFilter, exclusions, minMaxDateRange } = config;
|
|
41
41
|
const fieldConfig = {
|
|
42
42
|
...formlyField({
|
|
43
43
|
key,
|
|
@@ -46,6 +46,7 @@ function dateScheduleRangeField(config = {}) {
|
|
|
46
46
|
label: config.label ?? 'Schedule',
|
|
47
47
|
minMaxDateRange,
|
|
48
48
|
filter,
|
|
49
|
+
timezone,
|
|
49
50
|
computeSelectionResultRelativeToFilter,
|
|
50
51
|
initialSelectionState,
|
|
51
52
|
exclusions
|
|
@@ -116,6 +117,9 @@ function calendarScheduleMinAndMaxDateRange(x) {
|
|
|
116
117
|
end: calendarScheduleMaxDate(x) || undefined
|
|
117
118
|
};
|
|
118
119
|
}
|
|
120
|
+
function calendarScheduleStartBeingUsedFromFilter(x) {
|
|
121
|
+
return x.computeSelectionResultRelativeToFilter && x.filter?.start != null;
|
|
122
|
+
}
|
|
119
123
|
class DbxCalendarScheduleSelectionStore extends ComponentStore {
|
|
120
124
|
constructor() {
|
|
121
125
|
super(initialCalendarScheduleSelectionState());
|
|
@@ -147,10 +151,27 @@ class DbxCalendarScheduleSelectionStore extends ComponentStore {
|
|
|
147
151
|
this.isEnabledDayFunction$ = this.state$.pipe(map((x) => x.isEnabledDay), shareReplay(1));
|
|
148
152
|
this.currentDateRange$ = this.state$.pipe(map(computeCalendarScheduleSelectionRange), distinctUntilChanged((a, b) => isSameDateRange(a, b)), shareReplay(1));
|
|
149
153
|
this.computeSelectionResultRelativeToFilter$ = this.state$.pipe(map((x) => x.computeSelectionResultRelativeToFilter), shareReplay(1));
|
|
150
|
-
this.startBeingUsedFromFilter$ = this.state$.pipe(
|
|
154
|
+
this.startBeingUsedFromFilter$ = this.state$.pipe(
|
|
155
|
+
//
|
|
156
|
+
map(calendarScheduleStartBeingUsedFromFilter), distinctUntilChanged(), shareReplay(1));
|
|
151
157
|
this.dateRange$ = this.currentDateRange$.pipe(filterMaybe(), shareReplay(1));
|
|
152
158
|
this.scheduleDays$ = this.state$.pipe(map((x) => x.scheduleDays), distinctUntilChanged(setsAreEquivalent), shareReplay(1));
|
|
159
|
+
this.currentTimezone$ = this.state$.pipe(map((x) => x.timezone), distinctUntilChanged(), shareReplay(1));
|
|
160
|
+
this.effectiveTimezone$ = this.state$.pipe(map((x) => (!calendarScheduleStartBeingUsedFromFilter(x) && x.timezone ? x.timezone : undefined)), distinctUntilChanged(), shareReplay(1));
|
|
161
|
+
this.effectiveTimezoneNormal$ = this.state$.pipe(map((x) => (!calendarScheduleStartBeingUsedFromFilter(x) && x.timezoneNormal ? x.timezoneNormal : undefined)), distinctUntilChanged(), shareReplay(1));
|
|
153
162
|
this.currentSelectionValue$ = this.state$.pipe(map((x) => x.currentSelectionValue), shareReplay(1));
|
|
163
|
+
this.currentSelectionValueWithTimezone$ = this.currentSelectionValue$.pipe(combineLatestWith(this.effectiveTimezoneNormal$), map(([x, timezoneNormal]) => {
|
|
164
|
+
if (x && timezoneNormal) {
|
|
165
|
+
x = {
|
|
166
|
+
dateScheduleRange: {
|
|
167
|
+
...x.dateScheduleRange,
|
|
168
|
+
start: timezoneNormal.targetDateToSystemDate(x.dateScheduleRange.start),
|
|
169
|
+
end: timezoneNormal.targetDateToSystemDate(x.dateScheduleRange.end)
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
return x;
|
|
174
|
+
}), distinctUntilChanged(), shareReplay(1));
|
|
154
175
|
this.nextToggleSelection$ = this.hasConfiguredMinMaxRange$.pipe(switchMap((hasConfiguredMinMaxRange) => {
|
|
155
176
|
let obs;
|
|
156
177
|
if (hasConfiguredMinMaxRange) {
|
|
@@ -161,26 +182,26 @@ class DbxCalendarScheduleSelectionStore extends ComponentStore {
|
|
|
161
182
|
}
|
|
162
183
|
return obs;
|
|
163
184
|
}), shareReplay(1));
|
|
164
|
-
this.selectionValue$ = this.
|
|
165
|
-
this.currentDateScheduleRangeValue$ = this.
|
|
185
|
+
this.selectionValue$ = this.currentSelectionValueWithTimezone$.pipe(filterMaybe(), shareReplay(1));
|
|
186
|
+
this.currentDateScheduleRangeValue$ = this.currentSelectionValueWithTimezone$.pipe(map((x) => x?.dateScheduleRange), distinctUntilChanged(isSameDateScheduleRange), shareReplay(1));
|
|
166
187
|
this.dateScheduleRangeValue$ = this.currentDateScheduleRangeValue$.pipe(filterMaybe(), shareReplay(1));
|
|
167
188
|
this.cellContentFactory$ = this.state$.pipe(map((x) => x.cellContentFactory), distinctUntilChanged(), shareReplay(1));
|
|
168
189
|
this.isCustomized$ = this.state$.pipe(map((x) => x.selectedIndexes.size > 0), distinctUntilChanged(), shareReplay(1));
|
|
169
190
|
// MARK: State Changes
|
|
170
|
-
this.setMinMaxDateRange = this.updater(
|
|
171
|
-
this.setFilter = this.updater(
|
|
172
|
-
this.setExclusions = this.updater(
|
|
173
|
-
this.setComputeSelectionResultRelativeToFilter = this.updater(
|
|
191
|
+
this.setMinMaxDateRange = this.updater(updateStateWithMinMaxDateRange);
|
|
192
|
+
this.setFilter = this.updater(updateStateWithFilter);
|
|
193
|
+
this.setExclusions = this.updater(updateStateWithExclusions);
|
|
194
|
+
this.setComputeSelectionResultRelativeToFilter = this.updater(updateStateWithComputeSelectionResultRelativeToFilter);
|
|
174
195
|
this.clearFilter = this.updater((state) => updateStateWithFilter(state, undefined));
|
|
175
|
-
this.setTimezone = this.updater(
|
|
176
|
-
this.setInputRange = this.updater(
|
|
196
|
+
this.setTimezone = this.updater(updateStateWithTimezoneValue);
|
|
197
|
+
this.setInputRange = this.updater(updateStateWithChangedRange);
|
|
177
198
|
this.toggleSelectedDates = this.updater((state, toggle) => updateStateWithChangedDates(state, { toggle }));
|
|
178
199
|
this.addSelectedDates = this.updater((state, add) => updateStateWithChangedDates(state, { add }));
|
|
179
200
|
this.removeSelectedDates = this.updater((state, remove) => updateStateWithChangedDates(state, { remove }));
|
|
180
201
|
this.setSelectedDates = this.updater((state, set) => updateStateWithChangedDates(state, { set }));
|
|
181
202
|
this.selectAllDates = this.updater((state, selectAll = 'all') => updateStateWithChangedDates(state, { selectAll }));
|
|
182
|
-
this.setInitialSelectionState = this.updater(
|
|
183
|
-
this.setScheduleDays = this.updater(
|
|
203
|
+
this.setInitialSelectionState = this.updater(updateStateWithInitialSelectionState);
|
|
204
|
+
this.setScheduleDays = this.updater(updateStateWithChangedScheduleDays);
|
|
184
205
|
this.setAllowAllScheduleDays = this.updater((state) => updateStateWithChangedScheduleDays(state, null));
|
|
185
206
|
this.setDateScheduleRangeValue = this.updater((state, value) => updateStateWithDateScheduleRangeValue(state, value));
|
|
186
207
|
this.setCellContentFactory = this.updater((state, cellContentFactory) => ({ ...state, cellContentFactory }));
|
|
@@ -284,15 +305,47 @@ function updateStateWithFilter(state, inputFilter) {
|
|
|
284
305
|
}
|
|
285
306
|
return state;
|
|
286
307
|
}
|
|
308
|
+
function updateStateWithTimezoneValue(state, timezone) {
|
|
309
|
+
const { currentSelectionValue } = state;
|
|
310
|
+
const timezoneNormal = timezone ? dateTimezoneUtcNormal({ timezone }) : undefined;
|
|
311
|
+
if (timezoneNormal && currentSelectionValue) {
|
|
312
|
+
// update the selection value to reflect the timezone changes.
|
|
313
|
+
const { dateScheduleRange: currentDateScheduleRange } = currentSelectionValue;
|
|
314
|
+
const start = timezoneNormal.targetDateToSystemDate(currentDateScheduleRange.start);
|
|
315
|
+
const end = timezoneNormal.targetDateToSystemDate(currentDateScheduleRange.end);
|
|
316
|
+
const newRange = {
|
|
317
|
+
...currentSelectionValue.dateScheduleRange,
|
|
318
|
+
start,
|
|
319
|
+
end
|
|
320
|
+
};
|
|
321
|
+
return updateStateWithDateScheduleRangeValue({ ...state, timezone, timezoneNormal }, newRange);
|
|
322
|
+
}
|
|
323
|
+
else {
|
|
324
|
+
return { ...state, timezone, timezoneNormal }; // no change in value
|
|
325
|
+
}
|
|
326
|
+
}
|
|
287
327
|
function updateStateWithDateScheduleRangeValue(state, change) {
|
|
288
|
-
const
|
|
328
|
+
const { timezoneNormal, currentSelectionValue } = state;
|
|
329
|
+
let currentDateScheduleRange = currentSelectionValue?.dateScheduleRange; // current range is always in system time
|
|
330
|
+
if (!calendarScheduleStartBeingUsedFromFilter(state) && timezoneNormal) {
|
|
331
|
+
// When using timezones, always return from the start of the day. Inputs are converted to the system time and used as the start of the day.
|
|
332
|
+
// Outputs remain accurate.
|
|
333
|
+
if (change) {
|
|
334
|
+
change = {
|
|
335
|
+
...change,
|
|
336
|
+
start: startOfDay(timezoneNormal.systemDateToTargetDate(change.start)),
|
|
337
|
+
end: startOfDay(timezoneNormal.systemDateToTargetDate(change.end))
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
const isSameValue = isSameDateScheduleRange(currentDateScheduleRange, change);
|
|
289
342
|
if (isSameValue) {
|
|
290
343
|
return state;
|
|
291
344
|
}
|
|
292
345
|
else {
|
|
293
346
|
if (change != null) {
|
|
294
347
|
const nextState = { ...state, inputStart: change.start, inputEnd: change.end, selectedIndexes: new Set(change.ex) };
|
|
295
|
-
return updateStateWithChangedScheduleDays(finalizeNewCalendarScheduleSelectionState(nextState), expandDateScheduleDayCodes(change.w));
|
|
348
|
+
return updateStateWithChangedScheduleDays(finalizeNewCalendarScheduleSelectionState(nextState), expandDateScheduleDayCodes(change.w || '89'));
|
|
296
349
|
}
|
|
297
350
|
else {
|
|
298
351
|
return noSelectionCalendarScheduleSelectionState(state); // clear selection, retain disabled days
|
|
@@ -583,6 +636,7 @@ class DbxScheduleSelectionCalendarDateRangeComponent {
|
|
|
583
636
|
this.matFormFieldDefaultOptions = matFormFieldDefaultOptions;
|
|
584
637
|
this._required = new BehaviorSubject(false);
|
|
585
638
|
this.required$ = this._required.asObservable();
|
|
639
|
+
this.timezone$ = this.dbxCalendarScheduleSelectionStore.currentTimezone$;
|
|
586
640
|
this.label = 'Enter a date range';
|
|
587
641
|
this.showCustomize = false;
|
|
588
642
|
this._pickerOpened = new BehaviorSubject(false);
|
|
@@ -605,6 +659,9 @@ class DbxScheduleSelectionCalendarDateRangeComponent {
|
|
|
605
659
|
};
|
|
606
660
|
this.minDate$ = this.dbxCalendarScheduleSelectionStore.minDate$;
|
|
607
661
|
this.maxDate$ = this.dbxCalendarScheduleSelectionStore.maxDate$;
|
|
662
|
+
this.timezoneReleventDate$ = this.dbxCalendarScheduleSelectionStore.currentDateRange$.pipe(map((currentDateRange) => {
|
|
663
|
+
return currentDateRange ? currentDateRange.start ?? currentDateRange.end : undefined ?? new Date();
|
|
664
|
+
}), shareReplay(1));
|
|
608
665
|
this.isCustomized$ = this.dbxCalendarScheduleSelectionStore.isCustomized$;
|
|
609
666
|
this.pickerOpened$ = this._pickerOpened.asObservable();
|
|
610
667
|
}
|
|
@@ -676,10 +733,10 @@ class DbxScheduleSelectionCalendarDateRangeComponent {
|
|
|
676
733
|
}
|
|
677
734
|
}
|
|
678
735
|
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 });
|
|
679
|
-
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 <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 matIconSuffix [for]=\"picker\"></mat-datepicker-toggle>\n <dbx-button-spacer></dbx-button-spacer>\n <mat-date-range-input [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 <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 <mat-error *ngIf=\"range.hasError('required')\">Date range is required</mat-error>\n <mat-error *ngIf=\"range.controls.start.hasError('matStartDateInvalid')\">Invalid start date</mat-error>\n <mat-error *ngIf=\"range.controls.end.hasError('matEndDateInvalid')\">Invalid end date</mat-error>\n <mat-error *ngIf=\"range.controls.start.hasError('matDatepickerMin')\">Start date is too early</mat-error>\n <mat-error *ngIf=\"range.controls.end.hasError('matDatepickerMin')\">End date is too early.</mat-error>\n <mat-error *ngIf=\"range.controls.start.hasError('matDatepickerMax')\">Start date is too late.</mat-error>\n <mat-error *ngIf=\"range.controls.end.hasError('matDatepickerMax')\">End date is too late</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" }] });
|
|
736
|
+
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 <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 matIconSuffix [for]=\"picker\"></mat-datepicker-toggle>\n <dbx-button-spacer></dbx-button-spacer>\n <mat-date-range-input [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 <mat-error *ngIf=\"range.hasError('required')\">Date range is required</mat-error>\n <mat-error *ngIf=\"range.controls.start.hasError('matStartDateInvalid')\">Invalid start date</mat-error>\n <mat-error *ngIf=\"range.controls.end.hasError('matEndDateInvalid')\">Invalid end date</mat-error>\n <mat-error *ngIf=\"range.controls.start.hasError('matDatepickerMin')\">Start date is too early</mat-error>\n <mat-error *ngIf=\"range.controls.end.hasError('matDatepickerMin')\">End date is too early.</mat-error>\n <mat-error *ngIf=\"range.controls.start.hasError('matDatepickerMax')\">Start date is too late.</mat-error>\n <mat-error *ngIf=\"range.controls.end.hasError('matDatepickerMax')\">End date is too late</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" }] });
|
|
680
737
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxScheduleSelectionCalendarDateRangeComponent, decorators: [{
|
|
681
738
|
type: Component,
|
|
682
|
-
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 <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 matIconSuffix [for]=\"picker\"></mat-datepicker-toggle>\n <dbx-button-spacer></dbx-button-spacer>\n <mat-date-range-input [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 <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 <mat-error *ngIf=\"range.hasError('required')\">Date range is required</mat-error>\n <mat-error *ngIf=\"range.controls.start.hasError('matStartDateInvalid')\">Invalid start date</mat-error>\n <mat-error *ngIf=\"range.controls.end.hasError('matEndDateInvalid')\">Invalid end date</mat-error>\n <mat-error *ngIf=\"range.controls.start.hasError('matDatepickerMin')\">Start date is too early</mat-error>\n <mat-error *ngIf=\"range.controls.end.hasError('matDatepickerMin')\">End date is too early.</mat-error>\n <mat-error *ngIf=\"range.controls.start.hasError('matDatepickerMax')\">Start date is too late.</mat-error>\n <mat-error *ngIf=\"range.controls.end.hasError('matDatepickerMax')\">End date is too late</mat-error>\n <mat-hint>{{ hint }}</mat-hint>\n</mat-form-field>\n" }]
|
|
739
|
+
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 <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 matIconSuffix [for]=\"picker\"></mat-datepicker-toggle>\n <dbx-button-spacer></dbx-button-spacer>\n <mat-date-range-input [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 <mat-error *ngIf=\"range.hasError('required')\">Date range is required</mat-error>\n <mat-error *ngIf=\"range.controls.start.hasError('matStartDateInvalid')\">Invalid start date</mat-error>\n <mat-error *ngIf=\"range.controls.end.hasError('matEndDateInvalid')\">Invalid end date</mat-error>\n <mat-error *ngIf=\"range.controls.start.hasError('matDatepickerMin')\">Start date is too early</mat-error>\n <mat-error *ngIf=\"range.controls.end.hasError('matDatepickerMin')\">End date is too early.</mat-error>\n <mat-error *ngIf=\"range.controls.start.hasError('matDatepickerMax')\">Start date is too late.</mat-error>\n <mat-error *ngIf=\"range.controls.end.hasError('matDatepickerMax')\">End date is too late</mat-error>\n <mat-hint>{{ hint }}</mat-hint>\n</mat-form-field>\n" }]
|
|
683
740
|
}], ctorParameters: function () { return [{ type: i1.DbxCalendarStore }, { type: DbxCalendarScheduleSelectionStore }, { type: undefined, decorators: [{
|
|
684
741
|
type: Inject,
|
|
685
742
|
args: [MAT_FORM_FIELD_DEFAULT_OPTIONS]
|
|
@@ -1080,6 +1137,7 @@ class DbxFormCalendarDateScheduleRangeFieldComponent extends FieldType {
|
|
|
1080
1137
|
this.ngZone = ngZone;
|
|
1081
1138
|
this._syncSub = new SubscriptionObject();
|
|
1082
1139
|
this._valueSub = new SubscriptionObject();
|
|
1140
|
+
this._timezoneSub = new SubscriptionObject();
|
|
1083
1141
|
this._minMaxDateRangeSub = new SubscriptionObject();
|
|
1084
1142
|
this._filterSub = new SubscriptionObject();
|
|
1085
1143
|
this._exclusionsSub = new SubscriptionObject();
|
|
@@ -1114,6 +1172,9 @@ class DbxFormCalendarDateScheduleRangeFieldComponent extends FieldType {
|
|
|
1114
1172
|
get exclusions() {
|
|
1115
1173
|
return this.props.exclusions;
|
|
1116
1174
|
}
|
|
1175
|
+
get timezone() {
|
|
1176
|
+
return this.props.timezone;
|
|
1177
|
+
}
|
|
1117
1178
|
get initialSelectionState() {
|
|
1118
1179
|
return this.props.initialSelectionState;
|
|
1119
1180
|
}
|
|
@@ -1128,7 +1189,7 @@ class DbxFormCalendarDateScheduleRangeFieldComponent extends FieldType {
|
|
|
1128
1189
|
this._valueSub.subscription = this.dbxCalendarScheduleSelectionStore.currentDateScheduleRangeValue$.subscribe((x) => {
|
|
1129
1190
|
this.formControl.setValue(x);
|
|
1130
1191
|
});
|
|
1131
|
-
const { minMaxDateRange, filter, exclusions } = this;
|
|
1192
|
+
const { timezone, minMaxDateRange, filter, exclusions } = this;
|
|
1132
1193
|
if (filter != null) {
|
|
1133
1194
|
this._filterSub.subscription = this.dbxCalendarScheduleSelectionStore.setFilter(asObservable(filter));
|
|
1134
1195
|
}
|
|
@@ -1138,6 +1199,9 @@ class DbxFormCalendarDateScheduleRangeFieldComponent extends FieldType {
|
|
|
1138
1199
|
if (exclusions != null) {
|
|
1139
1200
|
this._exclusionsSub.subscription = this.dbxCalendarScheduleSelectionStore.setExclusions(asObservable(exclusions));
|
|
1140
1201
|
}
|
|
1202
|
+
if (timezone != null) {
|
|
1203
|
+
this.dbxCalendarScheduleSelectionStore.setTimezone(asObservable(this.timezone));
|
|
1204
|
+
}
|
|
1141
1205
|
if (this.initialSelectionState !== undefined) {
|
|
1142
1206
|
this.dbxCalendarScheduleSelectionStore.setInitialSelectionState(this.initialSelectionState);
|
|
1143
1207
|
}
|
|
@@ -1150,6 +1214,7 @@ class DbxFormCalendarDateScheduleRangeFieldComponent extends FieldType {
|
|
|
1150
1214
|
this._syncSub.destroy();
|
|
1151
1215
|
this._valueSub.destroy();
|
|
1152
1216
|
this._filterSub.destroy();
|
|
1217
|
+
this._timezoneSub.destroy();
|
|
1153
1218
|
this._minMaxDateRangeSub.destroy();
|
|
1154
1219
|
this._exclusionsSub.destroy();
|
|
1155
1220
|
this._formControlObs.complete();
|
|
@@ -1231,7 +1296,8 @@ DbxFormCalendarModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", v
|
|
|
1231
1296
|
CalendarModule,
|
|
1232
1297
|
CalendarDayModule,
|
|
1233
1298
|
FlexLayoutModule,
|
|
1234
|
-
CalendarWeekModule
|
|
1299
|
+
CalendarWeekModule,
|
|
1300
|
+
DbxDatePipeModule], exports: [
|
|
1235
1301
|
//
|
|
1236
1302
|
DbxScheduleSelectionCalendarComponent,
|
|
1237
1303
|
DbxScheduleSelectionCalendarDateDaysComponent,
|
|
@@ -1266,7 +1332,8 @@ DbxFormCalendarModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", v
|
|
|
1266
1332
|
CalendarModule,
|
|
1267
1333
|
CalendarDayModule,
|
|
1268
1334
|
FlexLayoutModule,
|
|
1269
|
-
CalendarWeekModule
|
|
1335
|
+
CalendarWeekModule,
|
|
1336
|
+
DbxDatePipeModule] });
|
|
1270
1337
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFormCalendarModule, decorators: [{
|
|
1271
1338
|
type: NgModule,
|
|
1272
1339
|
args: [{
|
|
@@ -1291,7 +1358,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
|
|
|
1291
1358
|
CalendarModule,
|
|
1292
1359
|
CalendarDayModule,
|
|
1293
1360
|
FlexLayoutModule,
|
|
1294
|
-
CalendarWeekModule
|
|
1361
|
+
CalendarWeekModule,
|
|
1362
|
+
DbxDatePipeModule
|
|
1295
1363
|
],
|
|
1296
1364
|
declarations,
|
|
1297
1365
|
exports: declarations
|
|
@@ -1346,5 +1414,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
|
|
|
1346
1414
|
* Generated bundle index. Do not edit.
|
|
1347
1415
|
*/
|
|
1348
1416
|
|
|
1349
|
-
export { CalendarScheduleSelectionDayState, 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, computeCalendarScheduleSelectionDateBlockRange, computeCalendarScheduleSelectionRange, computeScheduleSelectionRangeAndExclusion, computeScheduleSelectionValue, dateScheduleRangeField, dbxScheduleSelectionCalendarDateDaysFormDayFields, dbxScheduleSelectionCalendarDateDaysFormFields, defaultCalendarScheduleSelectionCellContentFactory, finalizeNewCalendarScheduleSelectionState, initialCalendarScheduleSelectionState, isEnabledDayInCalendarScheduleSelectionState, noSelectionCalendarScheduleSelectionState, provideCalendarScheduleSelectionStoreIfParentIsUnavailable, updateStateWithChangedDates, updateStateWithChangedRange, updateStateWithChangedScheduleDays, updateStateWithComputeSelectionResultRelativeToFilter, updateStateWithDateScheduleRangeValue, updateStateWithExclusions, updateStateWithFilter, updateStateWithInitialSelectionState, updateStateWithMinMaxDateRange };
|
|
1417
|
+
export { CalendarScheduleSelectionDayState, 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, dbxScheduleSelectionCalendarDateDaysFormDayFields, dbxScheduleSelectionCalendarDateDaysFormFields, defaultCalendarScheduleSelectionCellContentFactory, finalizeNewCalendarScheduleSelectionState, initialCalendarScheduleSelectionState, isEnabledDayInCalendarScheduleSelectionState, noSelectionCalendarScheduleSelectionState, provideCalendarScheduleSelectionStoreIfParentIsUnavailable, updateStateWithChangedDates, updateStateWithChangedRange, updateStateWithChangedScheduleDays, updateStateWithComputeSelectionResultRelativeToFilter, updateStateWithDateScheduleRangeValue, updateStateWithExclusions, updateStateWithFilter, updateStateWithInitialSelectionState, updateStateWithMinMaxDateRange, updateStateWithTimezoneValue };
|
|
1350
1418
|
//# sourceMappingURL=dereekb-dbx-form-calendar.mjs.map
|