@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.
@@ -3,9 +3,9 @@ import { formlyField, propsAndConfigForFieldConfig, flexLayoutWrapper, toggleFie
3
3
  import * as i0 from '@angular/core';
4
4
  import { Injectable, SkipSelf, Directive, Injector, Optional, Component, Inject, Input, ElementRef, ViewChild, ChangeDetectionStrategy, EventEmitter, Output, NgModule } from '@angular/core';
5
5
  import { FieldType } from '@ngx-formly/material';
6
- import { switchMap, first, tap, map, distinctUntilChanged, shareReplay, BehaviorSubject, of, startWith, filter, throttleTime } from 'rxjs';
6
+ import { switchMap, first, tap, map, distinctUntilChanged, shareReplay, combineLatestWith, BehaviorSubject, of, startWith, filter, throttleTime } from 'rxjs';
7
7
  import { filterMaybe, SubscriptionObject, asObservable } from '@dereekb/rxjs';
8
- 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';
8
+ 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';
9
9
  import { setsAreEquivalent, unique, mergeArrays, iterableToArray, toggleInSet, addToSet, isIndexNumberInIndexRangeFunction, range, minAndMaxNumber, getDaysOfWeekNames } from '@dereekb/util';
10
10
  import { ComponentStore } from '@ngrx/component-store';
11
11
  import { startOfDay, endOfDay, isBefore } from 'date-fns';
@@ -22,7 +22,7 @@ import { CommonModule } from '@angular/common';
22
22
  import * as i7 from '@angular/material/datepicker';
23
23
  import { MatDatepickerModule } from '@angular/material/datepicker';
24
24
  import * as i3$1 from '@dereekb/dbx-core';
25
- import { switchMapDbxInjectionComponentConfig, DbxInjectionComponentModule } 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 i3$2 from '@angular/material/icon';
@@ -38,11 +38,12 @@ import { FlexLayoutModule } from '@angular/flex-layout';
38
38
 
39
39
  function dateScheduleRangeField(config = {}) {
40
40
  var _a;
41
- const { key = 'schedule', filter, initialSelectionState, computeSelectionResultRelativeToFilter, exclusions, minMaxDateRange } = config;
41
+ const { key = 'schedule', filter, timezone, initialSelectionState, computeSelectionResultRelativeToFilter, exclusions, minMaxDateRange } = config;
42
42
  const fieldConfig = Object.assign({}, formlyField(Object.assign({ key, type: 'date-schedule-range' }, propsAndConfigForFieldConfig(config, {
43
43
  label: (_a = config.label) !== null && _a !== void 0 ? _a : 'Schedule',
44
44
  minMaxDateRange,
45
45
  filter,
46
+ timezone,
46
47
  computeSelectionResultRelativeToFilter,
47
48
  initialSelectionState,
48
49
  exclusions
@@ -114,6 +115,10 @@ function calendarScheduleMinAndMaxDateRange(x) {
114
115
  end: calendarScheduleMaxDate(x) || undefined
115
116
  };
116
117
  }
118
+ function calendarScheduleStartBeingUsedFromFilter(x) {
119
+ var _a;
120
+ return x.computeSelectionResultRelativeToFilter && ((_a = x.filter) === null || _a === void 0 ? void 0 : _a.start) != null;
121
+ }
117
122
  class DbxCalendarScheduleSelectionStore extends ComponentStore {
118
123
  constructor() {
119
124
  super(initialCalendarScheduleSelectionState());
@@ -145,10 +150,23 @@ class DbxCalendarScheduleSelectionStore extends ComponentStore {
145
150
  this.isEnabledDayFunction$ = this.state$.pipe(map((x) => x.isEnabledDay), shareReplay(1));
146
151
  this.currentDateRange$ = this.state$.pipe(map(computeCalendarScheduleSelectionRange), distinctUntilChanged((a, b) => isSameDateRange(a, b)), shareReplay(1));
147
152
  this.computeSelectionResultRelativeToFilter$ = this.state$.pipe(map((x) => x.computeSelectionResultRelativeToFilter), shareReplay(1));
148
- this.startBeingUsedFromFilter$ = this.state$.pipe(map((x) => { var _a; return x.computeSelectionResultRelativeToFilter && ((_a = x.filter) === null || _a === void 0 ? void 0 : _a.start) != null; }), shareReplay(1));
153
+ this.startBeingUsedFromFilter$ = this.state$.pipe(
154
+ //
155
+ map(calendarScheduleStartBeingUsedFromFilter), distinctUntilChanged(), shareReplay(1));
149
156
  this.dateRange$ = this.currentDateRange$.pipe(filterMaybe(), shareReplay(1));
150
157
  this.scheduleDays$ = this.state$.pipe(map((x) => x.scheduleDays), distinctUntilChanged(setsAreEquivalent), shareReplay(1));
158
+ this.currentTimezone$ = this.state$.pipe(map((x) => x.timezone), distinctUntilChanged(), shareReplay(1));
159
+ this.effectiveTimezone$ = this.state$.pipe(map((x) => (!calendarScheduleStartBeingUsedFromFilter(x) && x.timezone ? x.timezone : undefined)), distinctUntilChanged(), shareReplay(1));
160
+ this.effectiveTimezoneNormal$ = this.state$.pipe(map((x) => (!calendarScheduleStartBeingUsedFromFilter(x) && x.timezoneNormal ? x.timezoneNormal : undefined)), distinctUntilChanged(), shareReplay(1));
151
161
  this.currentSelectionValue$ = this.state$.pipe(map((x) => x.currentSelectionValue), shareReplay(1));
162
+ this.currentSelectionValueWithTimezone$ = this.currentSelectionValue$.pipe(combineLatestWith(this.effectiveTimezoneNormal$), map(([x, timezoneNormal]) => {
163
+ if (x && timezoneNormal) {
164
+ x = {
165
+ dateScheduleRange: Object.assign(Object.assign({}, x.dateScheduleRange), { start: timezoneNormal.targetDateToSystemDate(x.dateScheduleRange.start), end: timezoneNormal.targetDateToSystemDate(x.dateScheduleRange.end) })
166
+ };
167
+ }
168
+ return x;
169
+ }), distinctUntilChanged(), shareReplay(1));
152
170
  this.nextToggleSelection$ = this.hasConfiguredMinMaxRange$.pipe(switchMap((hasConfiguredMinMaxRange) => {
153
171
  let obs;
154
172
  if (hasConfiguredMinMaxRange) {
@@ -159,8 +177,8 @@ class DbxCalendarScheduleSelectionStore extends ComponentStore {
159
177
  }
160
178
  return obs;
161
179
  }), shareReplay(1));
162
- this.selectionValue$ = this.currentSelectionValue$.pipe(filterMaybe(), shareReplay(1));
163
- this.currentDateScheduleRangeValue$ = this.currentSelectionValue$.pipe(map((x) => x === null || x === void 0 ? void 0 : x.dateScheduleRange), distinctUntilChanged(isSameDateScheduleRange), shareReplay(1));
180
+ this.selectionValue$ = this.currentSelectionValueWithTimezone$.pipe(filterMaybe(), shareReplay(1));
181
+ this.currentDateScheduleRangeValue$ = this.currentSelectionValueWithTimezone$.pipe(map((x) => x === null || x === void 0 ? void 0 : x.dateScheduleRange), distinctUntilChanged(isSameDateScheduleRange), shareReplay(1));
164
182
  this.dateScheduleRangeValue$ = this.currentDateScheduleRangeValue$.pipe(filterMaybe(), shareReplay(1));
165
183
  this.cellContentFactory$ = this.state$.pipe(map((x) => x.cellContentFactory), distinctUntilChanged(), shareReplay(1));
166
184
  this.isCustomized$ = this.state$.pipe(map((x) => x.selectedIndexes.size > 0), distinctUntilChanged(), shareReplay(1));
@@ -170,7 +188,7 @@ class DbxCalendarScheduleSelectionStore extends ComponentStore {
170
188
  this.setExclusions = this.updater((state, exclusions) => updateStateWithExclusions(state, exclusions));
171
189
  this.setComputeSelectionResultRelativeToFilter = this.updater((state, computeSelectionResultRelativeToFilter) => updateStateWithComputeSelectionResultRelativeToFilter(state, computeSelectionResultRelativeToFilter));
172
190
  this.clearFilter = this.updater((state) => updateStateWithFilter(state, undefined));
173
- this.setTimezone = this.updater((state, timezone) => (Object.assign(Object.assign({}, state), { timezone })));
191
+ this.setTimezone = this.updater((state, timezone) => (Object.assign(Object.assign({}, state), { timezone, timezoneNormal: timezone ? dateTimezoneUtcNormal({ timezone }) : undefined })));
174
192
  this.setInputRange = this.updater((state, range) => updateStateWithChangedRange(state, range));
175
193
  this.toggleSelectedDates = this.updater((state, toggle) => updateStateWithChangedDates(state, { toggle }));
176
194
  this.addSelectedDates = this.updater((state, add) => updateStateWithChangedDates(state, { add }));
@@ -282,14 +300,24 @@ function updateStateWithFilter(state, inputFilter) {
282
300
  }
283
301
  function updateStateWithDateScheduleRangeValue(state, change) {
284
302
  var _a;
285
- const isSameValue = isSameDateScheduleRange((_a = state.currentSelectionValue) === null || _a === void 0 ? void 0 : _a.dateScheduleRange, change);
303
+ const { timezoneNormal } = state;
304
+ let currentDateScheduleRange = (_a = state.currentSelectionValue) === null || _a === void 0 ? void 0 : _a.dateScheduleRange;
305
+ if (!calendarScheduleStartBeingUsedFromFilter(state) && timezoneNormal) {
306
+ if (change) {
307
+ change = Object.assign(Object.assign({}, change), { start: timezoneNormal.systemDateToTargetDate(change.start), end: timezoneNormal.systemDateToTargetDate(change.end) });
308
+ }
309
+ if (currentDateScheduleRange) {
310
+ currentDateScheduleRange = Object.assign(Object.assign({}, currentDateScheduleRange), { start: timezoneNormal.targetDateToSystemDate(currentDateScheduleRange.start), end: timezoneNormal.targetDateToSystemDate(currentDateScheduleRange.end) });
311
+ }
312
+ }
313
+ const isSameValue = isSameDateScheduleRange(currentDateScheduleRange, change);
286
314
  if (isSameValue) {
287
315
  return state;
288
316
  }
289
317
  else {
290
318
  if (change != null) {
291
319
  const nextState = Object.assign(Object.assign({}, state), { inputStart: change.start, inputEnd: change.end, selectedIndexes: new Set(change.ex) });
292
- return updateStateWithChangedScheduleDays(finalizeNewCalendarScheduleSelectionState(nextState), expandDateScheduleDayCodes(change.w));
320
+ return updateStateWithChangedScheduleDays(finalizeNewCalendarScheduleSelectionState(nextState), expandDateScheduleDayCodes(change.w || '89'));
293
321
  }
294
322
  else {
295
323
  return noSelectionCalendarScheduleSelectionState(state); // clear selection, retain disabled days
@@ -583,6 +611,7 @@ class DbxScheduleSelectionCalendarDateRangeComponent {
583
611
  this.matFormFieldDefaultOptions = matFormFieldDefaultOptions;
584
612
  this._required = new BehaviorSubject(false);
585
613
  this.required$ = this._required.asObservable();
614
+ this.timezone$ = this.dbxCalendarScheduleSelectionStore.currentTimezone$;
586
615
  this.label = 'Enter a date range';
587
616
  this.showCustomize = false;
588
617
  this._pickerOpened = new BehaviorSubject(false);
@@ -605,6 +634,10 @@ class DbxScheduleSelectionCalendarDateRangeComponent {
605
634
  };
606
635
  this.minDate$ = this.dbxCalendarScheduleSelectionStore.minDate$;
607
636
  this.maxDate$ = this.dbxCalendarScheduleSelectionStore.maxDate$;
637
+ this.timezoneReleventDate$ = this.dbxCalendarScheduleSelectionStore.currentDateRange$.pipe(map((currentDateRange) => {
638
+ var _a;
639
+ return currentDateRange ? (_a = currentDateRange.start) !== null && _a !== void 0 ? _a : currentDateRange.end : undefined !== null && undefined !== void 0 ? undefined : new Date();
640
+ }), shareReplay(1));
608
641
  this.isCustomized$ = this.dbxCalendarScheduleSelectionStore.isCustomized$;
609
642
  this.pickerOpened$ = this._pickerOpened.asObservable();
610
643
  }
@@ -677,10 +710,10 @@ class DbxScheduleSelectionCalendarDateRangeComponent {
677
710
  }
678
711
  }
679
712
  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 });
680
- 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" }] });
713
+ 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" }] });
681
714
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxScheduleSelectionCalendarDateRangeComponent, decorators: [{
682
715
  type: Component,
683
- 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" }]
716
+ 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" }]
684
717
  }], ctorParameters: function () {
685
718
  return [{ type: i1.DbxCalendarStore }, { type: DbxCalendarScheduleSelectionStore }, { type: undefined, decorators: [{
686
719
  type: Inject,
@@ -1083,6 +1116,7 @@ class DbxFormCalendarDateScheduleRangeFieldComponent extends FieldType {
1083
1116
  this.ngZone = ngZone;
1084
1117
  this._syncSub = new SubscriptionObject();
1085
1118
  this._valueSub = new SubscriptionObject();
1119
+ this._timezoneSub = new SubscriptionObject();
1086
1120
  this._minMaxDateRangeSub = new SubscriptionObject();
1087
1121
  this._filterSub = new SubscriptionObject();
1088
1122
  this._exclusionsSub = new SubscriptionObject();
@@ -1118,6 +1152,9 @@ class DbxFormCalendarDateScheduleRangeFieldComponent extends FieldType {
1118
1152
  get exclusions() {
1119
1153
  return this.props.exclusions;
1120
1154
  }
1155
+ get timezone() {
1156
+ return this.props.timezone;
1157
+ }
1121
1158
  get initialSelectionState() {
1122
1159
  return this.props.initialSelectionState;
1123
1160
  }
@@ -1132,7 +1169,7 @@ class DbxFormCalendarDateScheduleRangeFieldComponent extends FieldType {
1132
1169
  this._valueSub.subscription = this.dbxCalendarScheduleSelectionStore.currentDateScheduleRangeValue$.subscribe((x) => {
1133
1170
  this.formControl.setValue(x);
1134
1171
  });
1135
- const { minMaxDateRange, filter, exclusions } = this;
1172
+ const { timezone, minMaxDateRange, filter, exclusions } = this;
1136
1173
  if (filter != null) {
1137
1174
  this._filterSub.subscription = this.dbxCalendarScheduleSelectionStore.setFilter(asObservable(filter));
1138
1175
  }
@@ -1142,6 +1179,9 @@ class DbxFormCalendarDateScheduleRangeFieldComponent extends FieldType {
1142
1179
  if (exclusions != null) {
1143
1180
  this._exclusionsSub.subscription = this.dbxCalendarScheduleSelectionStore.setExclusions(asObservable(exclusions));
1144
1181
  }
1182
+ if (timezone != null) {
1183
+ this.dbxCalendarScheduleSelectionStore.setTimezone(asObservable(this.timezone));
1184
+ }
1145
1185
  if (this.initialSelectionState !== undefined) {
1146
1186
  this.dbxCalendarScheduleSelectionStore.setInitialSelectionState(this.initialSelectionState);
1147
1187
  }
@@ -1154,6 +1194,7 @@ class DbxFormCalendarDateScheduleRangeFieldComponent extends FieldType {
1154
1194
  this._syncSub.destroy();
1155
1195
  this._valueSub.destroy();
1156
1196
  this._filterSub.destroy();
1197
+ this._timezoneSub.destroy();
1157
1198
  this._minMaxDateRangeSub.destroy();
1158
1199
  this._exclusionsSub.destroy();
1159
1200
  this._formControlObs.complete();
@@ -1238,7 +1279,8 @@ DbxFormCalendarModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", v
1238
1279
  CalendarModule,
1239
1280
  CalendarDayModule,
1240
1281
  FlexLayoutModule,
1241
- CalendarWeekModule
1282
+ CalendarWeekModule,
1283
+ DbxDatePipeModule
1242
1284
  ], exports: [
1243
1285
  //
1244
1286
  DbxScheduleSelectionCalendarComponent,
@@ -1275,7 +1317,8 @@ DbxFormCalendarModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", v
1275
1317
  CalendarModule,
1276
1318
  CalendarDayModule,
1277
1319
  FlexLayoutModule,
1278
- CalendarWeekModule
1320
+ CalendarWeekModule,
1321
+ DbxDatePipeModule
1279
1322
  ] });
1280
1323
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFormCalendarModule, decorators: [{
1281
1324
  type: NgModule,
@@ -1301,7 +1344,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
1301
1344
  CalendarModule,
1302
1345
  CalendarDayModule,
1303
1346
  FlexLayoutModule,
1304
- CalendarWeekModule
1347
+ CalendarWeekModule,
1348
+ DbxDatePipeModule
1305
1349
  ],
1306
1350
  declarations,
1307
1351
  exports: declarations
@@ -1356,5 +1400,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
1356
1400
  * Generated bundle index. Do not edit.
1357
1401
  */
1358
1402
 
1359
- 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 };
1360
1404
  //# sourceMappingURL=dereekb-dbx-form-calendar.mjs.map