@dereekb/dbx-form 9.23.21 → 9.23.23

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.
@@ -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, dateTimezoneUtcNormal, dateTimingRelativeIndexArrayFactory, isInfiniteDateRange, copyDateScheduleDateFilterConfig, dateScheduleDateFilter, 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(map((x) => x.computeSelectionResultRelativeToFilter && x.filter?.start != null), shareReplay(1));
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,8 +182,8 @@ class DbxCalendarScheduleSelectionStore extends ComponentStore {
161
182
  }
162
183
  return obs;
163
184
  }), shareReplay(1));
164
- this.selectionValue$ = this.currentSelectionValue$.pipe(filterMaybe(), shareReplay(1));
165
- this.currentDateScheduleRangeValue$ = this.currentSelectionValue$.pipe(map((x) => x?.dateScheduleRange), distinctUntilChanged(isSameDateScheduleRange), shareReplay(1));
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));
@@ -172,7 +193,7 @@ class DbxCalendarScheduleSelectionStore extends ComponentStore {
172
193
  this.setExclusions = this.updater((state, exclusions) => updateStateWithExclusions(state, exclusions));
173
194
  this.setComputeSelectionResultRelativeToFilter = this.updater((state, computeSelectionResultRelativeToFilter) => updateStateWithComputeSelectionResultRelativeToFilter(state, computeSelectionResultRelativeToFilter));
174
195
  this.clearFilter = this.updater((state) => updateStateWithFilter(state, undefined));
175
- this.setTimezone = this.updater((state, timezone) => ({ ...state, timezone }));
196
+ this.setTimezone = this.updater((state, timezone) => ({ ...state, timezone, timezoneNormal: timezone ? dateTimezoneUtcNormal({ timezone }) : undefined }));
176
197
  this.setInputRange = this.updater((state, range) => updateStateWithChangedRange(state, range));
177
198
  this.toggleSelectedDates = this.updater((state, toggle) => updateStateWithChangedDates(state, { toggle }));
178
199
  this.addSelectedDates = this.updater((state, add) => updateStateWithChangedDates(state, { add }));
@@ -285,14 +306,32 @@ function updateStateWithFilter(state, inputFilter) {
285
306
  return state;
286
307
  }
287
308
  function updateStateWithDateScheduleRangeValue(state, change) {
288
- const isSameValue = isSameDateScheduleRange(state.currentSelectionValue?.dateScheduleRange, change);
309
+ const { timezoneNormal } = state;
310
+ let currentDateScheduleRange = state.currentSelectionValue?.dateScheduleRange;
311
+ if (!calendarScheduleStartBeingUsedFromFilter(state) && timezoneNormal) {
312
+ if (change) {
313
+ change = {
314
+ ...change,
315
+ start: timezoneNormal.systemDateToTargetDate(change.start),
316
+ end: timezoneNormal.systemDateToTargetDate(change.end)
317
+ };
318
+ }
319
+ if (currentDateScheduleRange) {
320
+ currentDateScheduleRange = {
321
+ ...currentDateScheduleRange,
322
+ start: timezoneNormal.targetDateToSystemDate(currentDateScheduleRange.start),
323
+ end: timezoneNormal.targetDateToSystemDate(currentDateScheduleRange.end)
324
+ };
325
+ }
326
+ }
327
+ const isSameValue = isSameDateScheduleRange(currentDateScheduleRange, change);
289
328
  if (isSameValue) {
290
329
  return state;
291
330
  }
292
331
  else {
293
332
  if (change != null) {
294
333
  const nextState = { ...state, inputStart: change.start, inputEnd: change.end, selectedIndexes: new Set(change.ex) };
295
- return updateStateWithChangedScheduleDays(finalizeNewCalendarScheduleSelectionState(nextState), expandDateScheduleDayCodes(change.w));
334
+ return updateStateWithChangedScheduleDays(finalizeNewCalendarScheduleSelectionState(nextState), expandDateScheduleDayCodes(change.w || '89'));
296
335
  }
297
336
  else {
298
337
  return noSelectionCalendarScheduleSelectionState(state); // clear selection, retain disabled days
@@ -583,6 +622,7 @@ class DbxScheduleSelectionCalendarDateRangeComponent {
583
622
  this.matFormFieldDefaultOptions = matFormFieldDefaultOptions;
584
623
  this._required = new BehaviorSubject(false);
585
624
  this.required$ = this._required.asObservable();
625
+ this.timezone$ = this.dbxCalendarScheduleSelectionStore.currentTimezone$;
586
626
  this.label = 'Enter a date range';
587
627
  this.showCustomize = false;
588
628
  this._pickerOpened = new BehaviorSubject(false);
@@ -605,6 +645,9 @@ class DbxScheduleSelectionCalendarDateRangeComponent {
605
645
  };
606
646
  this.minDate$ = this.dbxCalendarScheduleSelectionStore.minDate$;
607
647
  this.maxDate$ = this.dbxCalendarScheduleSelectionStore.maxDate$;
648
+ this.timezoneReleventDate$ = this.dbxCalendarScheduleSelectionStore.currentDateRange$.pipe(map((currentDateRange) => {
649
+ return currentDateRange ? currentDateRange.start ?? currentDateRange.end : undefined ?? new Date();
650
+ }), shareReplay(1));
608
651
  this.isCustomized$ = this.dbxCalendarScheduleSelectionStore.isCustomized$;
609
652
  this.pickerOpened$ = this._pickerOpened.asObservable();
610
653
  }
@@ -676,10 +719,10 @@ class DbxScheduleSelectionCalendarDateRangeComponent {
676
719
  }
677
720
  }
678
721
  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" }] });
722
+ 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-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
723
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxScheduleSelectionCalendarDateRangeComponent, decorators: [{
681
724
  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" }]
725
+ 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-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
726
  }], ctorParameters: function () { return [{ type: i1.DbxCalendarStore }, { type: DbxCalendarScheduleSelectionStore }, { type: undefined, decorators: [{
684
727
  type: Inject,
685
728
  args: [MAT_FORM_FIELD_DEFAULT_OPTIONS]
@@ -1080,6 +1123,7 @@ class DbxFormCalendarDateScheduleRangeFieldComponent extends FieldType {
1080
1123
  this.ngZone = ngZone;
1081
1124
  this._syncSub = new SubscriptionObject();
1082
1125
  this._valueSub = new SubscriptionObject();
1126
+ this._timezoneSub = new SubscriptionObject();
1083
1127
  this._minMaxDateRangeSub = new SubscriptionObject();
1084
1128
  this._filterSub = new SubscriptionObject();
1085
1129
  this._exclusionsSub = new SubscriptionObject();
@@ -1114,6 +1158,9 @@ class DbxFormCalendarDateScheduleRangeFieldComponent extends FieldType {
1114
1158
  get exclusions() {
1115
1159
  return this.props.exclusions;
1116
1160
  }
1161
+ get timezone() {
1162
+ return this.props.timezone;
1163
+ }
1117
1164
  get initialSelectionState() {
1118
1165
  return this.props.initialSelectionState;
1119
1166
  }
@@ -1128,7 +1175,7 @@ class DbxFormCalendarDateScheduleRangeFieldComponent extends FieldType {
1128
1175
  this._valueSub.subscription = this.dbxCalendarScheduleSelectionStore.currentDateScheduleRangeValue$.subscribe((x) => {
1129
1176
  this.formControl.setValue(x);
1130
1177
  });
1131
- const { minMaxDateRange, filter, exclusions } = this;
1178
+ const { timezone, minMaxDateRange, filter, exclusions } = this;
1132
1179
  if (filter != null) {
1133
1180
  this._filterSub.subscription = this.dbxCalendarScheduleSelectionStore.setFilter(asObservable(filter));
1134
1181
  }
@@ -1138,6 +1185,9 @@ class DbxFormCalendarDateScheduleRangeFieldComponent extends FieldType {
1138
1185
  if (exclusions != null) {
1139
1186
  this._exclusionsSub.subscription = this.dbxCalendarScheduleSelectionStore.setExclusions(asObservable(exclusions));
1140
1187
  }
1188
+ if (timezone != null) {
1189
+ this.dbxCalendarScheduleSelectionStore.setTimezone(asObservable(this.timezone));
1190
+ }
1141
1191
  if (this.initialSelectionState !== undefined) {
1142
1192
  this.dbxCalendarScheduleSelectionStore.setInitialSelectionState(this.initialSelectionState);
1143
1193
  }
@@ -1150,6 +1200,7 @@ class DbxFormCalendarDateScheduleRangeFieldComponent extends FieldType {
1150
1200
  this._syncSub.destroy();
1151
1201
  this._valueSub.destroy();
1152
1202
  this._filterSub.destroy();
1203
+ this._timezoneSub.destroy();
1153
1204
  this._minMaxDateRangeSub.destroy();
1154
1205
  this._exclusionsSub.destroy();
1155
1206
  this._formControlObs.complete();
@@ -1231,7 +1282,8 @@ DbxFormCalendarModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", v
1231
1282
  CalendarModule,
1232
1283
  CalendarDayModule,
1233
1284
  FlexLayoutModule,
1234
- CalendarWeekModule], exports: [
1285
+ CalendarWeekModule,
1286
+ DbxDatePipeModule], exports: [
1235
1287
  //
1236
1288
  DbxScheduleSelectionCalendarComponent,
1237
1289
  DbxScheduleSelectionCalendarDateDaysComponent,
@@ -1266,7 +1318,8 @@ DbxFormCalendarModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", v
1266
1318
  CalendarModule,
1267
1319
  CalendarDayModule,
1268
1320
  FlexLayoutModule,
1269
- CalendarWeekModule] });
1321
+ CalendarWeekModule,
1322
+ DbxDatePipeModule] });
1270
1323
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFormCalendarModule, decorators: [{
1271
1324
  type: NgModule,
1272
1325
  args: [{
@@ -1291,7 +1344,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
1291
1344
  CalendarModule,
1292
1345
  CalendarDayModule,
1293
1346
  FlexLayoutModule,
1294
- CalendarWeekModule
1347
+ CalendarWeekModule,
1348
+ DbxDatePipeModule
1295
1349
  ],
1296
1350
  declarations,
1297
1351
  exports: declarations
@@ -1346,5 +1400,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
1346
1400
  * Generated bundle index. Do not edit.
1347
1401
  */
1348
1402
 
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 };
1403
+ 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 };
1350
1404
  //# sourceMappingURL=dereekb-dbx-form-calendar.mjs.map