@dereekb/dbx-form 9.23.20 → 9.23.22

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.
@@ -9,9 +9,9 @@ import * as i2 from '@dereekb/dbx-core';
9
9
  import { AbstractSubscriptionDirective, safeDetectChanges, DbxInjectionComponentModule, DbxDatePipeModule, mergeDbxInjectionComponentConfigs, tapDetectChanges } from '@dereekb/dbx-core';
10
10
  import * as i2$1 from '@dereekb/dbx-web';
11
11
  import { DbxActionTransitionSafetyDirective, DbxTextModule, DbxLoadingModule, DbxFlexLayoutModule, DbxSectionLayoutModule, DbxRouterAnchorModule, dbxValueListItemDecisionFunction, DbxButtonModule, DbxListLayoutModule, AbstractDbxSelectionListWrapperDirective, DEFAULT_LIST_WRAPPER_DIRECTIVE_TEMPLATE, AbstractDbxSelectionListViewDirective, addConfigToValueListItems, provideDbxListView, AbstractDbxValueListViewItemComponent, DbxActionModule, mapCompactModeObs, DbxBarLayoutModule } from '@dereekb/dbx-web';
12
- import { isPast, addSeconds, isSameMinute, startOfDay, isSameDay, addMinutes, addDays } from 'date-fns';
13
- import { BehaviorSubject, switchMap, first, exhaustMap, of, catchError, delay, filter, combineLatest, map, distinctUntilChanged, shareReplay, Subject, tap, takeUntil, EMPTY, mergeMap, startWith, debounceTime, skipWhile, scan, interval, merge, throttleTime, timer } from 'rxjs';
14
- import { LockSet, SubscriptionObject, asObservable, cleanup, loadingStateHasFinishedLoading, switchMapMaybeObs, filterMaybe, switchMapMaybeDefault, SimpleLoadingContext, distinctUntilHasDifferentValues, startWithBeginLoading, mapLoadingStateResults, successResult, ListLoadingStateContextInstance, isListLoadingStateEmpty, LoadingStateContextInstance, loadingStateHasValue, loadingStateIsLoading, beginLoading, mapLoadingStateValueWithOperator, valueFromLoadingState, loadingStateContext, skipFirstMaybe, asyncPusherCache, scanCount } from '@dereekb/rxjs';
12
+ import { isPast, addSeconds, startOfDay, addMinutes, addDays } from 'date-fns';
13
+ import { BehaviorSubject, switchMap, first, exhaustMap, of, catchError, delay, filter, combineLatest, map, distinctUntilChanged, shareReplay, Subject, tap, takeUntil, EMPTY, mergeMap, startWith, debounceTime, skipWhile, scan, combineLatestWith, throttleTime, interval, merge, timer } from 'rxjs';
14
+ import { LockSet, SubscriptionObject, asObservable, cleanup, loadingStateHasFinishedLoading, switchMapMaybeObs, filterMaybe, switchMapMaybeDefault, SimpleLoadingContext, distinctUntilHasDifferentValues, startWithBeginLoading, mapLoadingStateResults, successResult, ListLoadingStateContextInstance, isListLoadingStateEmpty, LoadingStateContextInstance, loadingStateHasValue, loadingStateIsLoading, beginLoading, mapLoadingStateValueWithOperator, valueFromLoadingState, loadingStateContext, skipFirstMaybe, asObservableFromGetter, asyncPusherCache, scanCount } from '@dereekb/rxjs';
15
15
  import * as i1$2 from '@ngx-formly/core';
16
16
  import { FieldType, FieldWrapper, FormlyModule, FieldArrayType } from '@ngx-formly/core';
17
17
  import * as i3$1 from '@angular/forms';
@@ -44,7 +44,7 @@ import * as i6 from '@angular/material/chips';
44
44
  import { MatChipsModule } from '@angular/material/chips';
45
45
  import { MatListModule } from '@angular/material/list';
46
46
  import { ENTER, COMMA } from '@angular/cdk/keycodes';
47
- import { skipUntilTimeElapsedAfterLastEmission, toJsDate, parseISO8601DayStringToDate, formatToISO8601DayString, formatToISO8601DateString, safeToJsDate, guessCurrentTimezone, toReadableTimeString, utcDayForDate, readableTimeStringToDate, findMinDate, findMaxDate, dateTimeMinuteDecisionFunction, DateTimeMinuteInstance, isSameDateHoursAndMinutes, toLocalReadableTimeString, allTimezoneInfos, timezoneInfoForSystem, searchTimezoneInfos } from '@dereekb/date';
47
+ import { skipUntilTimeElapsedAfterLastEmission, toJsDate, parseISO8601DayStringToDate, formatToISO8601DateString, formatToISO8601DayString, safeToJsDate, isSameDateHoursAndMinutes, guessCurrentTimezone, dateTimezoneUtcNormal, toLocalReadableTimeString, getTimezoneAbbreviation, isSameDateDay, utcDayForDate, readableTimeStringToDate, findMinDate, findMaxDate, dateTimeMinuteDecisionFunction, DateTimeMinuteInstance, allTimezoneInfos, timezoneInfoForSystem, searchTimezoneInfos } from '@dereekb/date';
48
48
  import { FieldType as FieldType$2, FormlyMatFormFieldModule } from '@ngx-formly/material/form-field';
49
49
  import * as i3$3 from '@angular/material/select';
50
50
  import { MatSelectModule } from '@angular/material/select';
@@ -3683,11 +3683,13 @@ var DbxDateTimeValueMode;
3683
3683
  */
3684
3684
  DbxDateTimeValueMode[DbxDateTimeValueMode["DAY_STRING"] = 2] = "DAY_STRING";
3685
3685
  })(DbxDateTimeValueMode || (DbxDateTimeValueMode = {}));
3686
- function dbxDateTimeInputValueParseFactory(mode) {
3686
+ function dbxDateTimeInputValueParseFactory(mode, timezoneInstance) {
3687
3687
  let factory;
3688
+ let useTimezoneInstance = true;
3688
3689
  switch (mode) {
3689
3690
  case DbxDateTimeValueMode.DAY_STRING:
3690
3691
  factory = (x) => (typeof x === 'string' ? parseISO8601DayStringToDate(x) : x);
3692
+ useTimezoneInstance = false; // day strings do not use timezones
3691
3693
  break;
3692
3694
  case DbxDateTimeValueMode.DATE_STRING:
3693
3695
  case DbxDateTimeValueMode.DATE:
@@ -3695,22 +3697,40 @@ function dbxDateTimeInputValueParseFactory(mode) {
3695
3697
  factory = (x) => (x != null ? toJsDate(x) : x);
3696
3698
  break;
3697
3699
  }
3700
+ if (timezoneInstance && useTimezoneInstance) {
3701
+ const originalFactory = factory;
3702
+ factory = (input) => {
3703
+ const date = originalFactory(input);
3704
+ const result = date ? timezoneInstance.systemDateToTargetDate(date) : date;
3705
+ return result;
3706
+ };
3707
+ }
3698
3708
  return factory;
3699
3709
  }
3700
- function dbxDateTimeOutputValueFactory(mode) {
3710
+ function dbxDateTimeOutputValueFactory(mode, timezoneInstance) {
3701
3711
  let factory;
3712
+ let useTimezoneInstance = true;
3702
3713
  switch (mode) {
3703
- case DbxDateTimeValueMode.DATE_STRING:
3704
- factory = (x) => (x != null ? formatToISO8601DateString(x) : x);
3705
- break;
3706
3714
  case DbxDateTimeValueMode.DAY_STRING:
3707
3715
  factory = (x) => (x != null ? formatToISO8601DayString(x) : x);
3716
+ useTimezoneInstance = false; // day strings do not use timezones
3717
+ break;
3718
+ case DbxDateTimeValueMode.DATE_STRING:
3719
+ factory = (x) => (x != null ? formatToISO8601DateString(x) : x);
3708
3720
  break;
3709
3721
  case DbxDateTimeValueMode.DATE:
3710
3722
  default:
3711
3723
  factory = (x) => x;
3712
3724
  break;
3713
3725
  }
3726
+ if (timezoneInstance && useTimezoneInstance) {
3727
+ const originalFactory = factory;
3728
+ factory = (input) => {
3729
+ const date = input ? timezoneInstance.targetDateToSystemDate(input) : input;
3730
+ const result = originalFactory(date);
3731
+ return result;
3732
+ };
3733
+ }
3714
3734
  return factory;
3715
3735
  }
3716
3736
  function syncConfigValueObs(parseConfigsObs, type) {
@@ -3727,29 +3747,37 @@ function syncConfigValueObs(parseConfigsObs, type) {
3727
3747
  return result;
3728
3748
  }), distinctUntilChanged(), shareReplay(1));
3729
3749
  }
3730
- const TIME_OUTPUT_THROTTLE_TIME = 10; // 10 ms
3750
+ function isSameDateTimeFieldValue(a, b) {
3751
+ return a && b ? (typeof a === 'string' ? a === b : isSameDateHoursAndMinutes(a, b)) : a == b;
3752
+ }
3753
+ const TIME_OUTPUT_THROTTLE_TIME = 10;
3731
3754
  class DbxDateTimeFieldComponent extends FieldType$1 {
3732
3755
  constructor(cdRef) {
3733
3756
  super();
3734
3757
  this.cdRef = cdRef;
3735
3758
  this._sub = new SubscriptionObject();
3736
3759
  this._valueSub = new SubscriptionObject();
3760
+ this._defaultTimezone = new BehaviorSubject(undefined);
3761
+ this._customTimezone = new BehaviorSubject(undefined);
3737
3762
  this._fullDayControlObs = new BehaviorSubject(undefined);
3738
3763
  this.fullDayControl$ = this._fullDayControlObs.pipe(filterMaybe());
3739
3764
  this._offset = new BehaviorSubject(0);
3740
3765
  this._formControlObs = new BehaviorSubject(undefined);
3741
3766
  this.formControl$ = this._formControlObs.pipe(filterMaybe());
3742
3767
  this._updateTime = new Subject();
3743
- this.value$ = this.formControl$.pipe(switchMap((control) => control.valueChanges.pipe(startWith(control.value), map(dbxDateTimeInputValueParseFactory(this.valueMode)))), distinctUntilChanged((a, b) => (a != null && b != null ? isSameMinute(a, b) : a === b)), shareReplay(1));
3768
+ this.timezone$ = combineLatest([this._defaultTimezone.pipe(switchMapMaybeDefault(), distinctUntilChanged()), this._customTimezone]).pipe(map(([defaultTimezone, customTimezone]) => {
3769
+ return customTimezone ?? defaultTimezone ?? guessCurrentTimezone();
3770
+ }), distinctUntilChanged(), shareReplay(1));
3771
+ this.timezoneInstance$ = this.timezone$.pipe(map((timezone) => (Boolean(timezone) ? dateTimezoneUtcNormal({ timezone }) : undefined)), shareReplay(1));
3772
+ this.valueInSystemTimezone$ = this.formControl$.pipe(map((control) => control.valueChanges.pipe(startWith(control.value), shareReplay(1))), combineLatestWith(this.timezoneInstance$), switchMap(([x, timezoneInstance]) => {
3773
+ return x.pipe(map(dbxDateTimeInputValueParseFactory(this.valueMode, timezoneInstance)));
3774
+ }), throttleTime(20, undefined, { leading: false, trailing: true }), // throttle incoming values and timezone changes
3775
+ distinctUntilChanged(isSameDateHoursAndMinutes), shareReplay(1));
3744
3776
  /**
3745
3777
  * Used to trigger/display visual updates (specifically on timeDistance, etc.).
3746
3778
  */
3747
- this.displayValue$ = interval(10 * 1000).pipe(startWith(0), map(() => new Date().getMinutes()), distinctUntilChanged(), tap(() => this.cdRef.markForCheck()), switchMap(() => this.value$), shareReplay(1));
3748
- this.timeString$ = this.value$.pipe(filterMaybe(), map((x) => {
3749
- const timezone = guessCurrentTimezone();
3750
- const timeString = toReadableTimeString(x, timezone);
3751
- return timeString;
3752
- }));
3779
+ this.displayValue$ = interval(10 * 1000).pipe(startWith(0), map(() => new Date().getMinutes()), distinctUntilChanged(), tap(() => this.cdRef.markForCheck()), switchMap(() => this.valueInSystemTimezone$), shareReplay(1));
3780
+ this.timeString$ = this.valueInSystemTimezone$.pipe(map((x) => (x ? toLocalReadableTimeString(x) : '')), distinctUntilChanged(), shareReplay(1));
3753
3781
  this.dateInputCtrl = new FormControl(new Date(), {
3754
3782
  validators: []
3755
3783
  });
@@ -3762,7 +3790,8 @@ class DbxDateTimeFieldComponent extends FieldType$1 {
3762
3790
  this.showTimeInput$ = this.fullDay$.pipe(map((x) => !x && this.timeMode !== DbxDateTimeFieldTimeMode.NONE));
3763
3791
  this.showAddTime$ = this.showTimeInput$.pipe(map((x) => !x && this.timeMode === DbxDateTimeFieldTimeMode.OPTIONAL), shareReplay(1));
3764
3792
  this.date$ = this.dateInputCtrl.valueChanges.pipe(startWith(this.dateInputCtrl.value), filterMaybe(), shareReplay(1));
3765
- this.dateValue$ = merge(this.date$, this.value$.pipe(skipFirstMaybe())).pipe(map((x) => (x ? startOfDay(x) : null)), distinctUntilChanged((a, b) => a != null && b != null && isSameDay(a, b)), shareReplay(1));
3793
+ this.timezoneAbbreviation$ = combineLatest([this.date$, this.timezone$]).pipe(map(([date, timezone]) => getTimezoneAbbreviation(timezone, date)), distinctUntilChanged(), shareReplay(1));
3794
+ this.dateValue$ = merge(this.date$, this.valueInSystemTimezone$.pipe(skipFirstMaybe())).pipe(map((x) => (x ? startOfDay(x) : null)), distinctUntilChanged(isSameDateDay), shareReplay(1));
3766
3795
  this.timeInput$ = this._updateTime.pipe(debounceTime(5), map(() => this.timeInputCtrl.value || ''), distinctUntilChanged());
3767
3796
  this.syncConfigObs$ = this._syncConfigObs.pipe(switchMapMaybeDefault(), shareReplay(1));
3768
3797
  this.parsedSyncConfigs$ = this.syncConfigObs$.pipe(map((x) => {
@@ -3793,6 +3822,9 @@ class DbxDateTimeFieldComponent extends FieldType$1 {
3793
3822
  this.dateInputMax$ = this.syncConfigAfterValue$;
3794
3823
  this.rawDateTime$ = combineLatest([this.dateValue$, this.timeInput$.pipe(startWith(null)), this.fullDay$]).pipe(map(([date, timeString, fullDay]) => {
3795
3824
  let result;
3825
+ if (!date && this.timeOnly) {
3826
+ date = new Date();
3827
+ }
3796
3828
  if (date) {
3797
3829
  if (fullDay) {
3798
3830
  if (this.dateTimeField.fullDayInUTC) {
@@ -3814,7 +3846,7 @@ class DbxDateTimeFieldComponent extends FieldType$1 {
3814
3846
  }
3815
3847
  }
3816
3848
  return result;
3817
- }), distinctUntilChanged((a, b) => a != null && b != null && isSameMinute(a, b)), shareReplay(1));
3849
+ }), distinctUntilChanged(isSameDateHoursAndMinutes), shareReplay(1));
3818
3850
  this.config$ = combineLatest([this._config.pipe(switchMapMaybeDefault(), shareReplay(1)), this.dateInputMin$, this.dateInputMax$]).pipe(map(([x, dateInputMin, dateInputMax]) => {
3819
3851
  let result = x;
3820
3852
  if (dateInputMin != null || dateInputMax != null) {
@@ -3901,17 +3933,24 @@ class DbxDateTimeFieldComponent extends FieldType$1 {
3901
3933
  get hideDatePicker() {
3902
3934
  return this.field.props.hideDatePicker ?? false;
3903
3935
  }
3936
+ get timezone() {
3937
+ return this.field.props.timezone;
3938
+ }
3939
+ get showTimezone() {
3940
+ return this.field.props.showTimezone ?? true;
3941
+ }
3942
+ get allowChangeTimezone() {
3943
+ return false; // unused
3944
+ }
3904
3945
  ngOnInit() {
3905
3946
  this._formControlObs.next(this.formControl);
3906
3947
  this._config.next(this.dateTimeField.getConfigObs?.());
3907
3948
  this._syncConfigObs.next(this.dateTimeField.getSyncFieldsObs?.());
3908
- const valueFactory = dbxDateTimeOutputValueFactory(this.valueMode);
3909
- this._sub.subscription = this.value$
3910
- .pipe(switchMap(() => {
3911
- return this.timeOutput$.pipe(throttleTime(TIME_OUTPUT_THROTTLE_TIME * 2, undefined, { leading: false, trailing: true }), skipFirstMaybe());
3912
- }), distinctUntilChanged(isSameDateHoursAndMinutes))
3913
- .subscribe((dateValue) => {
3914
- const value = valueFactory(dateValue);
3949
+ this._sub.subscription = this.valueInSystemTimezone$
3950
+ .pipe(combineLatestWith(this.timezoneInstance$.pipe(map((timezoneInstance) => dbxDateTimeOutputValueFactory(this.valueMode, timezoneInstance)))), throttleTime(TIME_OUTPUT_THROTTLE_TIME, undefined, { leading: false, trailing: true }), switchMap(([currentValue, valueFactory]) => {
3951
+ return this.timeOutput$.pipe(throttleTime(TIME_OUTPUT_THROTTLE_TIME * 2, undefined, { leading: false, trailing: true }), skipFirstMaybe(), distinctUntilChanged(isSameDateHoursAndMinutes), map((x) => valueFactory(x)), filter((x) => !isSameDateTimeFieldValue(x, currentValue)));
3952
+ }))
3953
+ .subscribe((value) => {
3915
3954
  this.formControl.setValue(value);
3916
3955
  this.formControl.markAsDirty();
3917
3956
  this.formControl.markAsTouched();
@@ -3923,6 +3962,10 @@ class DbxDateTimeFieldComponent extends FieldType$1 {
3923
3962
  }
3924
3963
  this.setTime(x);
3925
3964
  });
3965
+ // Set default timezone if provided.
3966
+ if (this.timezone && !this.dateTimeField.fullDayInUTC) {
3967
+ this._defaultTimezone.next(asObservableFromGetter(this.timezone));
3968
+ }
3926
3969
  // Watch for disabled changes so we can propogate them properly.
3927
3970
  this.formControl.registerOnDisabledChange((disabled) => {
3928
3971
  if (disabled) {
@@ -3962,6 +4005,8 @@ class DbxDateTimeFieldComponent extends FieldType$1 {
3962
4005
  }
3963
4006
  ngOnDestroy() {
3964
4007
  super.ngOnDestroy();
4008
+ this._defaultTimezone.complete();
4009
+ this._customTimezone.complete();
3965
4010
  this._fullDayControlObs.complete();
3966
4011
  this._offset.complete();
3967
4012
  this._formControlObs.complete();
@@ -3980,14 +4025,17 @@ class DbxDateTimeFieldComponent extends FieldType$1 {
3980
4025
  setLogicalTime(time) {
3981
4026
  const date = dateFromLogicalDate(time);
3982
4027
  if (date) {
3983
- const timeString = toLocalReadableTimeString(date);
3984
- this.setTime(timeString);
4028
+ this.setTimeFromDate(date);
3985
4029
  }
3986
4030
  }
3987
4031
  setDateInputValue(date) {
3988
4032
  this.dateInputCtrl.setValue(date);
3989
4033
  this._updateTime.next();
3990
4034
  }
4035
+ setTimeFromDate(timeDate) {
4036
+ const timeString = toLocalReadableTimeString(timeDate);
4037
+ this.setTime(timeString);
4038
+ }
3991
4039
  setTime(time) {
3992
4040
  this.timeInputCtrl.setValue(time);
3993
4041
  this._offset.next(0);
@@ -4064,10 +4112,10 @@ class DbxDateTimeFieldComponent extends FieldType$1 {
4064
4112
  }
4065
4113
  }
4066
4114
  DbxDateTimeFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxDateTimeFieldComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
4067
- DbxDateTimeFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: DbxDateTimeFieldComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<div class=\"dbx-datetime-field\" fxLayout=\"row wrap\" fxLayout.xs=\"column wrap\" fxLayoutAlign=\"space-evenly stretch\">\n <!-- Date -->\n <div class=\"dbx-datetime-row\" fxFlex.lt-sm=\"100\" [fxFlex]=\"dateOnly ? '100' : '50'\" *ngIf=\"showDateInput\">\n <ng-container *ngTemplateOutlet=\"dateInputTemplate\"></ng-container>\n <!-- Additional spacing -->\n <dbx-button-spacer *ngIf=\"!dateOnly\"></dbx-button-spacer>\n </div>\n <!-- Time -->\n <div class=\"dbx-datetime-row\" fxFlex.lt-sm=\"100\" [fxFlex]=\"showDateInput ? '50' : '100'\">\n <ng-container *ngIf=\"showTimeInput$ | async\">\n <ng-container *ngTemplateOutlet=\"timeMenuAndInputTemplate\"></ng-container>\n </ng-container>\n <div *ngIf=\"showAddTime$ | async\" class=\"add-time-button-wrapper\">\n <button mat-button class=\"dbx-button-spacer add-time-button\" ngClass.lt-sm=\"add-time-button-full\" (click)=\"addTime()\">\n <mat-icon>timer</mat-icon>\n Add Time\n </button>\n </div>\n </div>\n <div *ngIf=\"!hideDateHint\" class=\"dbx-datetime-row dbx-datetime-hint-row\" fxFlex=\"100\">\n <div class=\"dbx-hint\" [ngSwitch]=\"fullDay$ | async\">\n <small *ngSwitchCase=\"true\">\n <b class=\"dbx-ok\">{{ allDayLabel }}</b>\n {{ displayValue$ | async | date: 'fullDate' }} ({{ displayValue$ | async | dateDistance }})\n </small>\n <small *ngSwitchCase=\"false\">\n <ng-container *ngIf=\"value$ | async\">\n <b class=\"dbx-ok\">{{ atTimeLabel }}</b>\n {{ displayValue$ | async | date: 'medium' }} ({{ displayValue$ | async | timeDistance }})\n </ng-container>\n </small>\n </div>\n </div>\n</div>\n\n<!-- Date Input Template -->\n<ng-template #dateInputTemplate>\n <button class=\"dbx-button-spacer\" *ngIf=\"!hideDatePicker\" mat-icon-button (click)=\"picker.open()\" [disabled]=\"disabled\">\n <mat-icon>calendar_today</mat-icon>\n </button>\n <mat-form-field class=\"dbx-datetime-row-field\" [ngClass]=\"{ 'dbx-datetime-row-field-full-width': hideDatePicker }\">\n <mat-label>{{ dateLabel }}</mat-label>\n <input #dateInput matInput [min]=\"dateInputMin$ | async\" [max]=\"dateInputMax$ | async\" [matDatepicker]=\"picker\" [matDatepickerFilter]=\"(pickerFilter$ | async) || defaultPickerFilter\" (dateChange)=\"datePicked($event)\" [value]=\"dateValue$ | async\" (keydown)=\"keydownOnDateInput($event)\" />\n <mat-datepicker #picker></mat-datepicker>\n </mat-form-field>\n</ng-template>\n\n<!-- Time Menu/Input Template -->\n<ng-template #timeMenuAndInputTemplate>\n <button class=\"dbx-button-spacer\" mat-icon-button [matMenuTriggerFor]=\"timemenu\" aria-label=\"opens the time menu\" [disabled]=\"disabled\">\n <mat-icon>timer</mat-icon>\n </button>\n <mat-menu #timemenu=\"matMenu\">\n <ng-container *ngIf=\"timeMode === 'optional'\">\n <button mat-menu-item (click)=\"removeTime()\">\n <span>Remove Time</span>\n </button>\n <mat-divider></mat-divider>\n </ng-container>\n <button mat-menu-item (click)=\"setLogicalTime('now')\">\n <span>Now</span>\n </button>\n <button mat-menu-item (click)=\"setTime('12:00AM')\">\n <span>Midnight</span>\n </button>\n <button mat-menu-item (click)=\"setTime('6:00AM')\">\n <span>6:00AM</span>\n </button>\n <button mat-menu-item (click)=\"setTime('8:00AM')\">\n <span>8:00AM</span>\n </button>\n <button mat-menu-item (click)=\"setTime('10:00AM')\">\n <span>10:00AM</span>\n </button>\n <button mat-menu-item (click)=\"setTime('12:00PM')\">\n <span>Noon</span>\n </button>\n <button mat-menu-item (click)=\"setTime('2:00PM')\">\n <span>2:00PM</span>\n </button>\n <button mat-menu-item (click)=\"setTime('5:00PM')\">\n <span>5:00PM</span>\n </button>\n </mat-menu>\n <mat-form-field class=\"dbx-datetime-row-field\">\n <mat-label>{{ timeLabel }}</mat-label>\n <input #timeInput matInput [formControl]=\"timeInputCtrl\" (focus)=\"focusTime()\" (focusout)=\"focusOutTime()\" (keydown)=\"keydownOnTimeInput($event)\" />\n </mat-form-field>\n</ng-template>\n", dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i3$1.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$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "component", type: i3$4.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3$4.MatLabel, selector: "mat-label" }, { kind: "directive", type: i4$3.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i5.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { kind: "directive", type: i2$1.DbxButtonSpacerDirective, selector: "dbx-button-spacer,[dbxButtonSpacer]" }, { kind: "component", type: i1$1.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i8.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { kind: "directive", type: i8.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { kind: "component", type: i9.MatMenu, selector: "mat-menu", exportAs: ["matMenu"] }, { kind: "component", type: i9.MatMenuItem, selector: "[mat-menu-item]", inputs: ["disabled", "disableRipple", "role"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i9.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", exportAs: ["matMenuTrigger"] }, { kind: "directive", type: i3$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: i7.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i3$2.DefaultLayoutDirective, selector: " [fxLayout], [fxLayout.xs], [fxLayout.sm], [fxLayout.md], [fxLayout.lg], [fxLayout.xl], [fxLayout.lt-sm], [fxLayout.lt-md], [fxLayout.lt-lg], [fxLayout.lt-xl], [fxLayout.gt-xs], [fxLayout.gt-sm], [fxLayout.gt-md], [fxLayout.gt-lg]", inputs: ["fxLayout", "fxLayout.xs", "fxLayout.sm", "fxLayout.md", "fxLayout.lg", "fxLayout.xl", "fxLayout.lt-sm", "fxLayout.lt-md", "fxLayout.lt-lg", "fxLayout.lt-xl", "fxLayout.gt-xs", "fxLayout.gt-sm", "fxLayout.gt-md", "fxLayout.gt-lg"] }, { kind: "directive", type: i3$2.DefaultLayoutAlignDirective, selector: " [fxLayoutAlign], [fxLayoutAlign.xs], [fxLayoutAlign.sm], [fxLayoutAlign.md], [fxLayoutAlign.lg], [fxLayoutAlign.xl], [fxLayoutAlign.lt-sm], [fxLayoutAlign.lt-md], [fxLayoutAlign.lt-lg], [fxLayoutAlign.lt-xl], [fxLayoutAlign.gt-xs], [fxLayoutAlign.gt-sm], [fxLayoutAlign.gt-md], [fxLayoutAlign.gt-lg]", inputs: ["fxLayoutAlign", "fxLayoutAlign.xs", "fxLayoutAlign.sm", "fxLayoutAlign.md", "fxLayoutAlign.lg", "fxLayoutAlign.xl", "fxLayoutAlign.lt-sm", "fxLayoutAlign.lt-md", "fxLayoutAlign.lt-lg", "fxLayoutAlign.lt-xl", "fxLayoutAlign.gt-xs", "fxLayoutAlign.gt-sm", "fxLayoutAlign.gt-md", "fxLayoutAlign.gt-lg"] }, { kind: "directive", type: i3$2.DefaultFlexDirective, selector: " [fxFlex], [fxFlex.xs], [fxFlex.sm], [fxFlex.md], [fxFlex.lg], [fxFlex.xl], [fxFlex.lt-sm], [fxFlex.lt-md], [fxFlex.lt-lg], [fxFlex.lt-xl], [fxFlex.gt-xs], [fxFlex.gt-sm], [fxFlex.gt-md], [fxFlex.gt-lg]", inputs: ["fxFlex", "fxFlex.xs", "fxFlex.sm", "fxFlex.md", "fxFlex.lg", "fxFlex.xl", "fxFlex.lt-sm", "fxFlex.lt-md", "fxFlex.lt-lg", "fxFlex.lt-xl", "fxFlex.gt-xs", "fxFlex.gt-sm", "fxFlex.gt-md", "fxFlex.gt-lg"] }, { kind: "directive", type: i2$3.DefaultClassDirective, selector: " [ngClass], [ngClass.xs], [ngClass.sm], [ngClass.md], [ngClass.lg], [ngClass.xl], [ngClass.lt-sm], [ngClass.lt-md], [ngClass.lt-lg], [ngClass.lt-xl], [ngClass.gt-xs], [ngClass.gt-sm], [ngClass.gt-md], [ngClass.gt-lg]", inputs: ["ngClass", "ngClass.xs", "ngClass.sm", "ngClass.md", "ngClass.lg", "ngClass.xl", "ngClass.lt-sm", "ngClass.lt-md", "ngClass.lt-lg", "ngClass.lt-xl", "ngClass.gt-xs", "ngClass.gt-sm", "ngClass.gt-md", "ngClass.gt-lg"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "pipe", type: i1.DatePipe, name: "date" }, { kind: "pipe", type: i2.TimeDistancePipe, name: "timeDistance" }, { kind: "pipe", type: i2.DateDistancePipe, name: "dateDistance" }] });
4115
+ DbxDateTimeFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: DbxDateTimeFieldComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<div class=\"dbx-datetime-field\" fxLayout=\"row wrap\" fxLayout.xs=\"column wrap\" fxLayoutAlign=\"space-evenly stretch\">\n <!-- Date -->\n <div class=\"dbx-datetime-row\" fxFlex.lt-sm=\"100\" [fxFlex]=\"dateOnly ? '100' : '50'\" *ngIf=\"showDateInput\">\n <ng-container *ngTemplateOutlet=\"dateInputTemplate\"></ng-container>\n <!-- Additional spacing -->\n <dbx-button-spacer *ngIf=\"!dateOnly\"></dbx-button-spacer>\n </div>\n <!-- Time -->\n <div class=\"dbx-datetime-row\" fxFlex.lt-sm=\"100\" [fxFlex]=\"showDateInput ? '50' : '100'\">\n <ng-container *ngIf=\"showTimeInput$ | async\">\n <ng-container *ngTemplateOutlet=\"timeMenuAndInputTemplate\"></ng-container>\n </ng-container>\n <div *ngIf=\"showAddTime$ | async\" class=\"add-time-button-wrapper\">\n <button mat-button class=\"dbx-button-spacer add-time-button\" ngClass.lt-sm=\"add-time-button-full\" (click)=\"addTime()\">\n <mat-icon>timer</mat-icon>\n Add Time\n </button>\n </div>\n </div>\n <div *ngIf=\"!hideDateHint\" class=\"dbx-datetime-row dbx-datetime-hint-row\" fxFlex=\"100\">\n <div class=\"dbx-hint\" [ngSwitch]=\"fullDay$ | async\">\n <small *ngSwitchCase=\"true\">\n <b class=\"dbx-ok\">{{ allDayLabel }}</b>\n {{ displayValue$ | async | date: 'fullDate' }} {{ timezoneAbbreviation$ | async }} ({{ displayValue$ | async | dateDistance }})\n </small>\n <small *ngSwitchCase=\"false\">\n <ng-container *ngIf=\"displayValue$ | async\">\n <b class=\"dbx-ok\">{{ atTimeLabel }}</b>\n {{ displayValue$ | async | date: 'medium' }} {{ timezoneAbbreviation$ | async }} ({{ displayValue$ | async | timeDistance }})\n </ng-container>\n </small>\n </div>\n </div>\n</div>\n\n<!-- Date Input Template -->\n<ng-template #dateInputTemplate>\n <button class=\"dbx-button-spacer\" *ngIf=\"!hideDatePicker\" mat-icon-button (click)=\"picker.open()\" [disabled]=\"disabled\">\n <mat-icon>calendar_today</mat-icon>\n </button>\n <mat-form-field class=\"dbx-datetime-row-field\" [ngClass]=\"{ 'dbx-datetime-row-field-full-width': hideDatePicker }\">\n <mat-label>{{ dateLabel }}</mat-label>\n <input #dateInput matInput [min]=\"dateInputMin$ | async\" [max]=\"dateInputMax$ | async\" [matDatepicker]=\"picker\" [matDatepickerFilter]=\"(pickerFilter$ | async) || defaultPickerFilter\" (dateChange)=\"datePicked($event)\" [value]=\"dateValue$ | async\" (keydown)=\"keydownOnDateInput($event)\" />\n <mat-datepicker #picker></mat-datepicker>\n <span matSuffix *ngIf=\"!(showTimeInput$ | async)\">\n <ng-container *ngTemplateOutlet=\"timezoneSuffixTemplate\"></ng-container>\n </span>\n </mat-form-field>\n</ng-template>\n\n<!-- Time Menu/Input Template -->\n<ng-template #timeMenuAndInputTemplate>\n <button class=\"dbx-button-spacer\" mat-icon-button [matMenuTriggerFor]=\"timemenu\" aria-label=\"opens the time menu\" [disabled]=\"disabled\">\n <mat-icon>timer</mat-icon>\n </button>\n <mat-menu #timemenu=\"matMenu\">\n <ng-container *ngIf=\"timeMode === 'optional'\">\n <button mat-menu-item (click)=\"removeTime()\">\n <span>Remove Time</span>\n </button>\n <mat-divider></mat-divider>\n </ng-container>\n <button mat-menu-item (click)=\"setLogicalTime('now')\">\n <span>Now</span>\n </button>\n <button mat-menu-item (click)=\"setTime('12:00AM')\">\n <span>Midnight</span>\n </button>\n <button mat-menu-item (click)=\"setTime('6:00AM')\">\n <span>6:00AM</span>\n </button>\n <button mat-menu-item (click)=\"setTime('8:00AM')\">\n <span>8:00AM</span>\n </button>\n <button mat-menu-item (click)=\"setTime('10:00AM')\">\n <span>10:00AM</span>\n </button>\n <button mat-menu-item (click)=\"setTime('12:00PM')\">\n <span>Noon</span>\n </button>\n <button mat-menu-item (click)=\"setTime('2:00PM')\">\n <span>2:00PM</span>\n </button>\n <button mat-menu-item (click)=\"setTime('5:00PM')\">\n <span>5:00PM</span>\n </button>\n </mat-menu>\n <mat-form-field class=\"dbx-datetime-row-field\">\n <mat-label>{{ timeLabel }}</mat-label>\n <input #timeInput matInput [formControl]=\"timeInputCtrl\" (focus)=\"focusTime()\" (focusout)=\"focusOutTime()\" (keydown)=\"keydownOnTimeInput($event)\" />\n <span matSuffix>\n <ng-container *ngTemplateOutlet=\"timezoneSuffixTemplate\"></ng-container>\n </span>\n </mat-form-field>\n</ng-template>\n\n<!-- Timezone Suffix -->\n<ng-template #timezoneSuffixTemplate>\n <span *ngIf=\"showTimezone\" class=\"dbx-datetime-timezone dbx-faint\">{{ timezoneAbbreviation$ | async }}</span>\n</ng-template>\n", dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i3$1.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$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "component", type: i3$4.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3$4.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3$4.MatSuffix, selector: "[matSuffix]" }, { kind: "directive", type: i4$3.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i5.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { kind: "directive", type: i2$1.DbxButtonSpacerDirective, selector: "dbx-button-spacer,[dbxButtonSpacer]" }, { kind: "component", type: i1$1.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i8.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { kind: "directive", type: i8.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { kind: "component", type: i9.MatMenu, selector: "mat-menu", exportAs: ["matMenu"] }, { kind: "component", type: i9.MatMenuItem, selector: "[mat-menu-item]", inputs: ["disabled", "disableRipple", "role"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i9.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", exportAs: ["matMenuTrigger"] }, { kind: "directive", type: i3$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: i7.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i3$2.DefaultLayoutDirective, selector: " [fxLayout], [fxLayout.xs], [fxLayout.sm], [fxLayout.md], [fxLayout.lg], [fxLayout.xl], [fxLayout.lt-sm], [fxLayout.lt-md], [fxLayout.lt-lg], [fxLayout.lt-xl], [fxLayout.gt-xs], [fxLayout.gt-sm], [fxLayout.gt-md], [fxLayout.gt-lg]", inputs: ["fxLayout", "fxLayout.xs", "fxLayout.sm", "fxLayout.md", "fxLayout.lg", "fxLayout.xl", "fxLayout.lt-sm", "fxLayout.lt-md", "fxLayout.lt-lg", "fxLayout.lt-xl", "fxLayout.gt-xs", "fxLayout.gt-sm", "fxLayout.gt-md", "fxLayout.gt-lg"] }, { kind: "directive", type: i3$2.DefaultLayoutAlignDirective, selector: " [fxLayoutAlign], [fxLayoutAlign.xs], [fxLayoutAlign.sm], [fxLayoutAlign.md], [fxLayoutAlign.lg], [fxLayoutAlign.xl], [fxLayoutAlign.lt-sm], [fxLayoutAlign.lt-md], [fxLayoutAlign.lt-lg], [fxLayoutAlign.lt-xl], [fxLayoutAlign.gt-xs], [fxLayoutAlign.gt-sm], [fxLayoutAlign.gt-md], [fxLayoutAlign.gt-lg]", inputs: ["fxLayoutAlign", "fxLayoutAlign.xs", "fxLayoutAlign.sm", "fxLayoutAlign.md", "fxLayoutAlign.lg", "fxLayoutAlign.xl", "fxLayoutAlign.lt-sm", "fxLayoutAlign.lt-md", "fxLayoutAlign.lt-lg", "fxLayoutAlign.lt-xl", "fxLayoutAlign.gt-xs", "fxLayoutAlign.gt-sm", "fxLayoutAlign.gt-md", "fxLayoutAlign.gt-lg"] }, { kind: "directive", type: i3$2.DefaultFlexDirective, selector: " [fxFlex], [fxFlex.xs], [fxFlex.sm], [fxFlex.md], [fxFlex.lg], [fxFlex.xl], [fxFlex.lt-sm], [fxFlex.lt-md], [fxFlex.lt-lg], [fxFlex.lt-xl], [fxFlex.gt-xs], [fxFlex.gt-sm], [fxFlex.gt-md], [fxFlex.gt-lg]", inputs: ["fxFlex", "fxFlex.xs", "fxFlex.sm", "fxFlex.md", "fxFlex.lg", "fxFlex.xl", "fxFlex.lt-sm", "fxFlex.lt-md", "fxFlex.lt-lg", "fxFlex.lt-xl", "fxFlex.gt-xs", "fxFlex.gt-sm", "fxFlex.gt-md", "fxFlex.gt-lg"] }, { kind: "directive", type: i2$3.DefaultClassDirective, selector: " [ngClass], [ngClass.xs], [ngClass.sm], [ngClass.md], [ngClass.lg], [ngClass.xl], [ngClass.lt-sm], [ngClass.lt-md], [ngClass.lt-lg], [ngClass.lt-xl], [ngClass.gt-xs], [ngClass.gt-sm], [ngClass.gt-md], [ngClass.gt-lg]", inputs: ["ngClass", "ngClass.xs", "ngClass.sm", "ngClass.md", "ngClass.lg", "ngClass.xl", "ngClass.lt-sm", "ngClass.lt-md", "ngClass.lt-lg", "ngClass.lt-xl", "ngClass.gt-xs", "ngClass.gt-sm", "ngClass.gt-md", "ngClass.gt-lg"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "pipe", type: i1.DatePipe, name: "date" }, { kind: "pipe", type: i2.DateDistancePipe, name: "dateDistance" }, { kind: "pipe", type: i2.TimeDistancePipe, name: "timeDistance" }] });
4068
4116
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxDateTimeFieldComponent, decorators: [{
4069
4117
  type: Component,
4070
- args: [{ template: "<div class=\"dbx-datetime-field\" fxLayout=\"row wrap\" fxLayout.xs=\"column wrap\" fxLayoutAlign=\"space-evenly stretch\">\n <!-- Date -->\n <div class=\"dbx-datetime-row\" fxFlex.lt-sm=\"100\" [fxFlex]=\"dateOnly ? '100' : '50'\" *ngIf=\"showDateInput\">\n <ng-container *ngTemplateOutlet=\"dateInputTemplate\"></ng-container>\n <!-- Additional spacing -->\n <dbx-button-spacer *ngIf=\"!dateOnly\"></dbx-button-spacer>\n </div>\n <!-- Time -->\n <div class=\"dbx-datetime-row\" fxFlex.lt-sm=\"100\" [fxFlex]=\"showDateInput ? '50' : '100'\">\n <ng-container *ngIf=\"showTimeInput$ | async\">\n <ng-container *ngTemplateOutlet=\"timeMenuAndInputTemplate\"></ng-container>\n </ng-container>\n <div *ngIf=\"showAddTime$ | async\" class=\"add-time-button-wrapper\">\n <button mat-button class=\"dbx-button-spacer add-time-button\" ngClass.lt-sm=\"add-time-button-full\" (click)=\"addTime()\">\n <mat-icon>timer</mat-icon>\n Add Time\n </button>\n </div>\n </div>\n <div *ngIf=\"!hideDateHint\" class=\"dbx-datetime-row dbx-datetime-hint-row\" fxFlex=\"100\">\n <div class=\"dbx-hint\" [ngSwitch]=\"fullDay$ | async\">\n <small *ngSwitchCase=\"true\">\n <b class=\"dbx-ok\">{{ allDayLabel }}</b>\n {{ displayValue$ | async | date: 'fullDate' }} ({{ displayValue$ | async | dateDistance }})\n </small>\n <small *ngSwitchCase=\"false\">\n <ng-container *ngIf=\"value$ | async\">\n <b class=\"dbx-ok\">{{ atTimeLabel }}</b>\n {{ displayValue$ | async | date: 'medium' }} ({{ displayValue$ | async | timeDistance }})\n </ng-container>\n </small>\n </div>\n </div>\n</div>\n\n<!-- Date Input Template -->\n<ng-template #dateInputTemplate>\n <button class=\"dbx-button-spacer\" *ngIf=\"!hideDatePicker\" mat-icon-button (click)=\"picker.open()\" [disabled]=\"disabled\">\n <mat-icon>calendar_today</mat-icon>\n </button>\n <mat-form-field class=\"dbx-datetime-row-field\" [ngClass]=\"{ 'dbx-datetime-row-field-full-width': hideDatePicker }\">\n <mat-label>{{ dateLabel }}</mat-label>\n <input #dateInput matInput [min]=\"dateInputMin$ | async\" [max]=\"dateInputMax$ | async\" [matDatepicker]=\"picker\" [matDatepickerFilter]=\"(pickerFilter$ | async) || defaultPickerFilter\" (dateChange)=\"datePicked($event)\" [value]=\"dateValue$ | async\" (keydown)=\"keydownOnDateInput($event)\" />\n <mat-datepicker #picker></mat-datepicker>\n </mat-form-field>\n</ng-template>\n\n<!-- Time Menu/Input Template -->\n<ng-template #timeMenuAndInputTemplate>\n <button class=\"dbx-button-spacer\" mat-icon-button [matMenuTriggerFor]=\"timemenu\" aria-label=\"opens the time menu\" [disabled]=\"disabled\">\n <mat-icon>timer</mat-icon>\n </button>\n <mat-menu #timemenu=\"matMenu\">\n <ng-container *ngIf=\"timeMode === 'optional'\">\n <button mat-menu-item (click)=\"removeTime()\">\n <span>Remove Time</span>\n </button>\n <mat-divider></mat-divider>\n </ng-container>\n <button mat-menu-item (click)=\"setLogicalTime('now')\">\n <span>Now</span>\n </button>\n <button mat-menu-item (click)=\"setTime('12:00AM')\">\n <span>Midnight</span>\n </button>\n <button mat-menu-item (click)=\"setTime('6:00AM')\">\n <span>6:00AM</span>\n </button>\n <button mat-menu-item (click)=\"setTime('8:00AM')\">\n <span>8:00AM</span>\n </button>\n <button mat-menu-item (click)=\"setTime('10:00AM')\">\n <span>10:00AM</span>\n </button>\n <button mat-menu-item (click)=\"setTime('12:00PM')\">\n <span>Noon</span>\n </button>\n <button mat-menu-item (click)=\"setTime('2:00PM')\">\n <span>2:00PM</span>\n </button>\n <button mat-menu-item (click)=\"setTime('5:00PM')\">\n <span>5:00PM</span>\n </button>\n </mat-menu>\n <mat-form-field class=\"dbx-datetime-row-field\">\n <mat-label>{{ timeLabel }}</mat-label>\n <input #timeInput matInput [formControl]=\"timeInputCtrl\" (focus)=\"focusTime()\" (focusout)=\"focusOutTime()\" (keydown)=\"keydownOnTimeInput($event)\" />\n </mat-form-field>\n</ng-template>\n" }]
4118
+ args: [{ template: "<div class=\"dbx-datetime-field\" fxLayout=\"row wrap\" fxLayout.xs=\"column wrap\" fxLayoutAlign=\"space-evenly stretch\">\n <!-- Date -->\n <div class=\"dbx-datetime-row\" fxFlex.lt-sm=\"100\" [fxFlex]=\"dateOnly ? '100' : '50'\" *ngIf=\"showDateInput\">\n <ng-container *ngTemplateOutlet=\"dateInputTemplate\"></ng-container>\n <!-- Additional spacing -->\n <dbx-button-spacer *ngIf=\"!dateOnly\"></dbx-button-spacer>\n </div>\n <!-- Time -->\n <div class=\"dbx-datetime-row\" fxFlex.lt-sm=\"100\" [fxFlex]=\"showDateInput ? '50' : '100'\">\n <ng-container *ngIf=\"showTimeInput$ | async\">\n <ng-container *ngTemplateOutlet=\"timeMenuAndInputTemplate\"></ng-container>\n </ng-container>\n <div *ngIf=\"showAddTime$ | async\" class=\"add-time-button-wrapper\">\n <button mat-button class=\"dbx-button-spacer add-time-button\" ngClass.lt-sm=\"add-time-button-full\" (click)=\"addTime()\">\n <mat-icon>timer</mat-icon>\n Add Time\n </button>\n </div>\n </div>\n <div *ngIf=\"!hideDateHint\" class=\"dbx-datetime-row dbx-datetime-hint-row\" fxFlex=\"100\">\n <div class=\"dbx-hint\" [ngSwitch]=\"fullDay$ | async\">\n <small *ngSwitchCase=\"true\">\n <b class=\"dbx-ok\">{{ allDayLabel }}</b>\n {{ displayValue$ | async | date: 'fullDate' }} {{ timezoneAbbreviation$ | async }} ({{ displayValue$ | async | dateDistance }})\n </small>\n <small *ngSwitchCase=\"false\">\n <ng-container *ngIf=\"displayValue$ | async\">\n <b class=\"dbx-ok\">{{ atTimeLabel }}</b>\n {{ displayValue$ | async | date: 'medium' }} {{ timezoneAbbreviation$ | async }} ({{ displayValue$ | async | timeDistance }})\n </ng-container>\n </small>\n </div>\n </div>\n</div>\n\n<!-- Date Input Template -->\n<ng-template #dateInputTemplate>\n <button class=\"dbx-button-spacer\" *ngIf=\"!hideDatePicker\" mat-icon-button (click)=\"picker.open()\" [disabled]=\"disabled\">\n <mat-icon>calendar_today</mat-icon>\n </button>\n <mat-form-field class=\"dbx-datetime-row-field\" [ngClass]=\"{ 'dbx-datetime-row-field-full-width': hideDatePicker }\">\n <mat-label>{{ dateLabel }}</mat-label>\n <input #dateInput matInput [min]=\"dateInputMin$ | async\" [max]=\"dateInputMax$ | async\" [matDatepicker]=\"picker\" [matDatepickerFilter]=\"(pickerFilter$ | async) || defaultPickerFilter\" (dateChange)=\"datePicked($event)\" [value]=\"dateValue$ | async\" (keydown)=\"keydownOnDateInput($event)\" />\n <mat-datepicker #picker></mat-datepicker>\n <span matSuffix *ngIf=\"!(showTimeInput$ | async)\">\n <ng-container *ngTemplateOutlet=\"timezoneSuffixTemplate\"></ng-container>\n </span>\n </mat-form-field>\n</ng-template>\n\n<!-- Time Menu/Input Template -->\n<ng-template #timeMenuAndInputTemplate>\n <button class=\"dbx-button-spacer\" mat-icon-button [matMenuTriggerFor]=\"timemenu\" aria-label=\"opens the time menu\" [disabled]=\"disabled\">\n <mat-icon>timer</mat-icon>\n </button>\n <mat-menu #timemenu=\"matMenu\">\n <ng-container *ngIf=\"timeMode === 'optional'\">\n <button mat-menu-item (click)=\"removeTime()\">\n <span>Remove Time</span>\n </button>\n <mat-divider></mat-divider>\n </ng-container>\n <button mat-menu-item (click)=\"setLogicalTime('now')\">\n <span>Now</span>\n </button>\n <button mat-menu-item (click)=\"setTime('12:00AM')\">\n <span>Midnight</span>\n </button>\n <button mat-menu-item (click)=\"setTime('6:00AM')\">\n <span>6:00AM</span>\n </button>\n <button mat-menu-item (click)=\"setTime('8:00AM')\">\n <span>8:00AM</span>\n </button>\n <button mat-menu-item (click)=\"setTime('10:00AM')\">\n <span>10:00AM</span>\n </button>\n <button mat-menu-item (click)=\"setTime('12:00PM')\">\n <span>Noon</span>\n </button>\n <button mat-menu-item (click)=\"setTime('2:00PM')\">\n <span>2:00PM</span>\n </button>\n <button mat-menu-item (click)=\"setTime('5:00PM')\">\n <span>5:00PM</span>\n </button>\n </mat-menu>\n <mat-form-field class=\"dbx-datetime-row-field\">\n <mat-label>{{ timeLabel }}</mat-label>\n <input #timeInput matInput [formControl]=\"timeInputCtrl\" (focus)=\"focusTime()\" (focusout)=\"focusOutTime()\" (keydown)=\"keydownOnTimeInput($event)\" />\n <span matSuffix>\n <ng-container *ngTemplateOutlet=\"timezoneSuffixTemplate\"></ng-container>\n </span>\n </mat-form-field>\n</ng-template>\n\n<!-- Timezone Suffix -->\n<ng-template #timezoneSuffixTemplate>\n <span *ngIf=\"showTimezone\" class=\"dbx-datetime-timezone dbx-faint\">{{ timezoneAbbreviation$ | async }}</span>\n</ng-template>\n" }]
4071
4119
  }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; } });
4072
4120
 
4073
4121
  class DbxFormFormlyDateFieldModule {
@@ -4149,7 +4197,7 @@ function timeOnlyField(config = {}) {
4149
4197
  });
4150
4198
  }
4151
4199
  function dateTimeField(config = {}) {
4152
- const { key = 'date', dateLabel, timeLabel, allDayLabel, atTimeLabel, timeMode = DbxDateTimeFieldTimeMode.REQUIRED, valueMode, fullDayInUTC, fullDayFieldName, getConfigObs, getSyncFieldsObs, hideDatePicker, hideDateHint, timeOnly = false, materialFormField } = config;
4200
+ const { key = 'date', dateLabel, timeLabel, allDayLabel, atTimeLabel, timezone, showTimezone, timeMode = DbxDateTimeFieldTimeMode.REQUIRED, valueMode, fullDayInUTC, fullDayFieldName, getConfigObs, getSyncFieldsObs, hideDatePicker, hideDateHint, timeOnly = false, materialFormField } = config;
4153
4201
  const fieldConfig = formlyField({
4154
4202
  key,
4155
4203
  type: 'datetime',
@@ -4163,6 +4211,8 @@ function dateTimeField(config = {}) {
4163
4211
  valueMode,
4164
4212
  timeOnly,
4165
4213
  timeMode: timeOnly ? DbxDateTimeFieldTimeMode.REQUIRED : timeMode,
4214
+ timezone,
4215
+ showTimezone,
4166
4216
  fullDayFieldName,
4167
4217
  fullDayInUTC,
4168
4218
  hideDatePicker,
@@ -4176,23 +4226,27 @@ function dateTimeField(config = {}) {
4176
4226
  });
4177
4227
  }
4178
4228
  function dateRangeField(config = {}) {
4179
- const { required: inputRequired, start, end } = config;
4229
+ const { required: inputRequired, start, end, timezone, showTimezone } = config;
4180
4230
  const required = inputRequired ?? start?.required ?? false;
4181
4231
  const startFieldKey = start?.key ?? 'start';
4182
4232
  const endFieldKey = end?.key ?? 'end';
4183
4233
  const startField = dateTimeField({
4184
4234
  dateLabel: 'Start',
4185
- ...start,
4186
4235
  timeMode: DbxDateTimeFieldTimeMode.NONE,
4187
4236
  getSyncFieldsObs: () => of([{ syncWith: endFieldKey, syncType: 'after' }]),
4237
+ ...start,
4238
+ timezone,
4239
+ showTimezone,
4188
4240
  required,
4189
4241
  key: startFieldKey
4190
4242
  });
4191
4243
  const endField = dateTimeField({
4192
4244
  dateLabel: 'End',
4193
- ...end,
4194
4245
  timeMode: DbxDateTimeFieldTimeMode.NONE,
4195
4246
  getSyncFieldsObs: () => of([{ syncWith: startFieldKey, syncType: 'before' }]),
4247
+ ...end,
4248
+ timezone,
4249
+ showTimezone,
4196
4250
  required,
4197
4251
  key: endFieldKey
4198
4252
  });
@@ -4202,11 +4256,13 @@ function dateRangeField(config = {}) {
4202
4256
  };
4203
4257
  }
4204
4258
  function dateTimeRangeField(inputConfig = {}) {
4205
- const { required = false, start: inputStart, end: inputEnd } = inputConfig;
4259
+ const { required = false, start: inputStart, end: inputEnd, timezone, showTimezone } = inputConfig;
4206
4260
  function dateTimeRangeFieldConfig(config) {
4207
4261
  return {
4208
4262
  ...config,
4209
4263
  required,
4264
+ timeMode: DbxDateTimeFieldTimeMode.REQUIRED,
4265
+ getSyncFieldsObs: undefined,
4210
4266
  timeOnly: true,
4211
4267
  hideDateHint: true
4212
4268
  };
@@ -4224,6 +4280,8 @@ function dateTimeRangeField(inputConfig = {}) {
4224
4280
  key: endKey
4225
4281
  };
4226
4282
  const config = {
4283
+ timezone,
4284
+ showTimezone,
4227
4285
  start,
4228
4286
  end
4229
4287
  };
@@ -5077,9 +5135,7 @@ class DbxFormlyFormComponent extends AbstractSubscriptionDirective {
5077
5135
  else {
5078
5136
  return of(state);
5079
5137
  }
5080
- })
5081
- // tapLog('Change: ')
5082
- )), shareReplay(1));
5138
+ }))), shareReplay(1));
5083
5139
  }
5084
5140
  ngOnInit() {
5085
5141
  this.context.setDelegate(this);
@@ -5407,12 +5463,16 @@ function timezoneStringSearchFunction() {
5407
5463
  };
5408
5464
  }
5409
5465
  const DISPLAY_FOR_TIMEZONE_STRING_VALUE = (values) => {
5410
- const displayValues = values.map((x) => ({ ...x, label: x.value, sublabel: x.meta?.abbreviation ?? 'Unknown' }));
5466
+ const timezoneInfos = allTimezoneInfos();
5467
+ const displayValues = values.map((x) => {
5468
+ const meta = x.meta ?? timezoneInfos.find((y) => x.value === y.timezone); // attempt to find the metadata in the timeInfos if it isn't provided.
5469
+ return { ...x, label: x.value, sublabel: meta?.abbreviation ?? 'Unknown' };
5470
+ });
5411
5471
  const obs = of(displayValues);
5412
5472
  return obs;
5413
5473
  };
5414
5474
  /**
5415
- * Template for login field that takes in a username and password.
5475
+ * Template for a searchable text field for a timezone.
5416
5476
  *
5417
5477
  * @param param0
5418
5478
  * @returns
@@ -5422,8 +5482,11 @@ function timezoneStringField(config = {}) {
5422
5482
  key: 'timezone',
5423
5483
  label: 'Timezone',
5424
5484
  asArrayValue: false,
5485
+ required: false,
5425
5486
  ...config,
5426
5487
  searchOnEmptyText: true,
5488
+ allowStringValues: false,
5489
+ showClearValue: true,
5427
5490
  search: timezoneStringSearchFunction(),
5428
5491
  displayForValue: DISPLAY_FOR_TIMEZONE_STRING_VALUE
5429
5492
  });