@dereekb/dbx-form 9.23.28 → 9.24.1

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.
Files changed (40) hide show
  1. package/calendar/lib/calendar.schedule.selection.dialog.button.component.d.ts +4 -1
  2. package/calendar/lib/calendar.schedule.selection.dialog.component.d.ts +11 -4
  3. package/calendar/lib/field/schedule/calendar.schedule.field.component.d.ts +6 -1
  4. package/esm2020/calendar/lib/calendar.schedule.selection.days.component.mjs +1 -1
  5. package/esm2020/calendar/lib/calendar.schedule.selection.dialog.button.component.mjs +5 -3
  6. package/esm2020/calendar/lib/calendar.schedule.selection.dialog.component.mjs +22 -7
  7. package/esm2020/calendar/lib/calendar.schedule.selection.range.component.mjs +1 -1
  8. package/esm2020/calendar/lib/field/schedule/calendar.schedule.field.component.mjs +7 -4
  9. package/esm2020/calendar/lib/field/schedule/calendar.schedule.field.mjs +7 -4
  10. package/esm2020/lib/form/action/form.action.directive.mjs +11 -4
  11. package/esm2020/lib/formly/field/value/date/date.field.module.mjs +18 -6
  12. package/esm2020/lib/formly/field/value/date/date.value.mjs +73 -0
  13. package/esm2020/lib/formly/field/value/date/datetime.field.component.mjs +60 -106
  14. package/esm2020/lib/formly/field/value/date/datetime.field.mjs +31 -4
  15. package/esm2020/lib/formly/field/value/date/datetime.field.service.mjs +31 -0
  16. package/esm2020/lib/formly/field/value/date/datetime.mjs +26 -0
  17. package/esm2020/lib/formly/field/value/date/datetime.preset.mjs +31 -0
  18. package/esm2020/lib/formly/field/value/date/fixeddaterange.field.component.mjs +451 -0
  19. package/esm2020/lib/formly/field/value/date/index.mjs +5 -1
  20. package/fesm2015/dereekb-dbx-form-calendar.mjs +39 -17
  21. package/fesm2015/dereekb-dbx-form-calendar.mjs.map +1 -1
  22. package/fesm2015/dereekb-dbx-form.mjs +647 -66
  23. package/fesm2015/dereekb-dbx-form.mjs.map +1 -1
  24. package/fesm2020/dereekb-dbx-form-calendar.mjs +39 -17
  25. package/fesm2020/dereekb-dbx-form-calendar.mjs.map +1 -1
  26. package/fesm2020/dereekb-dbx-form.mjs +643 -60
  27. package/fesm2020/dereekb-dbx-form.mjs.map +1 -1
  28. package/lib/form/action/form.action.directive.d.ts +13 -7
  29. package/lib/formly/field/value/date/_date.scss +29 -0
  30. package/lib/formly/field/value/date/date.field.module.d.ts +18 -17
  31. package/lib/formly/field/value/date/date.value.d.ts +20 -0
  32. package/lib/formly/field/value/date/datetime.d.ts +56 -0
  33. package/lib/formly/field/value/date/datetime.field.component.d.ts +31 -27
  34. package/lib/formly/field/value/date/datetime.field.d.ts +8 -4
  35. package/lib/formly/field/value/date/datetime.field.service.d.ts +15 -0
  36. package/lib/formly/field/value/date/datetime.preset.d.ts +2 -0
  37. package/lib/formly/field/value/date/fixeddaterange.field.component.d.ts +154 -0
  38. package/lib/formly/field/value/date/index.d.ts +4 -0
  39. package/mapbox/package.json +4 -4
  40. package/package.json +4 -4
@@ -1,10 +1,12 @@
1
1
  import { OnInit, OnDestroy } from '@angular/core';
2
2
  import { Observable } from 'rxjs';
3
3
  import { DbxActionContextStoreSourceInstance, DbxActionValueOnTriggerResult } from '@dereekb/dbx-core';
4
- import { LockSet, IsModifiedFunction, IsValidFunction } from '@dereekb/rxjs';
4
+ import { LockSet, IsModifiedFunction, IsValidFunction, ObservableOrValue } from '@dereekb/rxjs';
5
5
  import { DbxMutableForm } from '../../form/form';
6
+ import { MapFunction } from '@dereekb/util';
6
7
  import * as i0 from "@angular/core";
7
8
  export declare const APP_ACTION_FORM_DISABLED_KEY = "dbx_action_form";
9
+ export declare type DbxActionFormMapValueFunction<T, O> = MapFunction<T, ObservableOrValue<DbxActionValueOnTriggerResult<O>>>;
8
10
  /**
9
11
  * Used with an action to bind a form to an action as it's value source.
10
12
  *
@@ -12,9 +14,9 @@ export declare const APP_ACTION_FORM_DISABLED_KEY = "dbx_action_form";
12
14
  *
13
15
  * If the source is not considered modified, the trigger will be ignored.
14
16
  */
15
- export declare class DbxActionFormDirective<T = object> implements OnInit, OnDestroy {
17
+ export declare class DbxActionFormDirective<T = object, O = T> implements OnInit, OnDestroy {
16
18
  readonly form: DbxMutableForm<T>;
17
- readonly source: DbxActionContextStoreSourceInstance<T, unknown>;
19
+ readonly source: DbxActionContextStoreSourceInstance<O, unknown>;
18
20
  readonly lockSet: LockSet;
19
21
  /**
20
22
  * Optional validator that checks whether or not the value is
@@ -25,17 +27,21 @@ export declare class DbxActionFormDirective<T = object> implements OnInit, OnDes
25
27
  * Optional function that checks whether or not the value has been modified.
26
28
  */
27
29
  dbxActionFormModified?: IsModifiedFunction<T>;
30
+ /**
31
+ * Optional function that maps the form's value to the source's value.
32
+ */
33
+ dbxActionFormMapValue?: DbxActionFormMapValueFunction<T, O>;
28
34
  private _formDisabledWhileWorking;
29
35
  private _triggeredSub;
30
36
  private _isCompleteSub;
31
37
  private _isWorkingSub;
32
- constructor(form: DbxMutableForm<T>, source: DbxActionContextStoreSourceInstance<T, unknown>);
38
+ constructor(form: DbxMutableForm<T>, source: DbxActionContextStoreSourceInstance<O, unknown>);
33
39
  get formDisabledOnWorking(): boolean;
34
40
  set formDisabledOnWorking(formDisabledOnWorking: boolean);
35
41
  ngOnInit(): void;
36
42
  ngOnDestroy(): void;
37
43
  protected preCheckReadyValue(value: T): Observable<boolean>;
38
- protected readyValue(value: T): Observable<DbxActionValueOnTriggerResult>;
39
- static ɵfac: i0.ɵɵFactoryDeclaration<DbxActionFormDirective<any>, [{ host: true; }, null]>;
40
- static ɵdir: i0.ɵɵDirectiveDeclaration<DbxActionFormDirective<any>, "[dbxActionForm]", never, { "dbxActionFormValidator": "dbxActionFormValidator"; "dbxActionFormModified": "dbxActionFormModified"; "formDisabledOnWorking": "formDisabledOnWorking"; }, {}, never, never, false>;
44
+ protected readyValue(value: T): Observable<DbxActionValueOnTriggerResult<O>>;
45
+ static ɵfac: i0.ɵɵFactoryDeclaration<DbxActionFormDirective<any, any>, [{ host: true; }, null]>;
46
+ static ɵdir: i0.ɵɵDirectiveDeclaration<DbxActionFormDirective<any, any>, "[dbxActionForm]", never, { "dbxActionFormValidator": "dbxActionFormValidator"; "dbxActionFormModified": "dbxActionFormModified"; "dbxActionFormMapValue": "dbxActionFormMapValue"; "formDisabledOnWorking": "formDisabledOnWorking"; }, {}, never, never, false>;
41
47
  }
@@ -86,6 +86,35 @@ $dbx-datetime-row-width: 40px + ($dbx-datetime-button-spacing * 2); // times 2 f
86
86
  .dbx-datetime-hint-row {
87
87
  // margin-left: 12px;
88
88
  }
89
+
90
+ .dbx-fixeddaterange-field {
91
+ .mat-calendar,
92
+ .dbx-fixeddaterange-field-input {
93
+ margin: auto;
94
+ min-width: 240px;
95
+ max-width: 320px;
96
+ }
97
+ }
98
+
99
+ .dbx-fixeddaterange-field-full-width .dbx-fixeddaterange-field {
100
+ .mat-calendar,
101
+ .dbx-fixeddaterange-field-input {
102
+ max-width: unset;
103
+ }
104
+ }
105
+
106
+ .mat-form-field.dbx-fixeddaterange-field-input {
107
+ display: block;
108
+ }
109
+
110
+ .dbx-fixeddaterange-field-input-end {
111
+ opacity: 0.6;
112
+ pointer-events: none;
113
+ }
114
+
115
+ .dbx-form-fixed-date-range-field-wrapper .mat-form-field-appearance-outline .mat-form-field-infix {
116
+ padding: 0;
117
+ }
89
118
  }
90
119
 
91
120
  @mixin color($theme-config) {
@@ -1,23 +1,24 @@
1
1
  import * as i0 from "@angular/core";
2
2
  import * as i1 from "./datetime.field.component";
3
- import * as i2 from "@angular/common";
4
- import * as i3 from "@angular/forms";
5
- import * as i4 from "@angular/material/input";
6
- import * as i5 from "@angular/material/divider";
7
- import * as i6 from "@angular/material/form-field";
8
- import * as i7 from "@dereekb/dbx-web";
9
- import * as i8 from "@angular/material/button";
10
- import * as i9 from "@angular/material/datepicker";
11
- import * as i10 from "@angular/material/core";
12
- import * as i11 from "@angular/material/menu";
13
- import * as i12 from "@dereekb/dbx-core";
14
- import * as i13 from "@angular/material/chips";
15
- import * as i14 from "@angular/material/icon";
16
- import * as i15 from "@angular/flex-layout";
17
- import * as i16 from "@ngx-formly/core";
18
- import * as i17 from "../../wrapper/form.wrapper.module";
3
+ import * as i2 from "./fixeddaterange.field.component";
4
+ import * as i3 from "@angular/common";
5
+ import * as i4 from "@angular/forms";
6
+ import * as i5 from "@angular/material/input";
7
+ import * as i6 from "@angular/material/divider";
8
+ import * as i7 from "@angular/material/form-field";
9
+ import * as i8 from "@dereekb/dbx-web";
10
+ import * as i9 from "@angular/material/button";
11
+ import * as i10 from "@angular/material/datepicker";
12
+ import * as i11 from "@angular/material/core";
13
+ import * as i12 from "@angular/material/menu";
14
+ import * as i13 from "@dereekb/dbx-core";
15
+ import * as i14 from "@angular/material/chips";
16
+ import * as i15 from "@angular/material/icon";
17
+ import * as i16 from "@angular/flex-layout";
18
+ import * as i17 from "@ngx-formly/core";
19
+ import * as i18 from "../../wrapper/form.wrapper.module";
19
20
  export declare class DbxFormFormlyDateFieldModule {
20
21
  static ɵfac: i0.ɵɵFactoryDeclaration<DbxFormFormlyDateFieldModule, never>;
21
- static ɵmod: i0.ɵɵNgModuleDeclaration<DbxFormFormlyDateFieldModule, [typeof i1.DbxDateTimeFieldComponent], [typeof i2.CommonModule, typeof i3.FormsModule, typeof i4.MatInputModule, typeof i5.MatDividerModule, typeof i6.MatFormFieldModule, typeof i7.DbxButtonModule, typeof i8.MatButtonModule, typeof i9.MatDatepickerModule, typeof i10.MatNativeDateModule, typeof i11.MatMenuModule, typeof i3.ReactiveFormsModule, typeof i12.DbxDatePipeModule, typeof i13.MatChipsModule, typeof i14.MatIconModule, typeof i15.FlexLayoutModule, typeof i16.FormlyModule], [typeof i17.DbxFormFormlyWrapperModule]>;
22
+ static ɵmod: i0.ɵɵNgModuleDeclaration<DbxFormFormlyDateFieldModule, [typeof i1.DbxDateTimeFieldComponent, typeof i2.DbxFixedDateRangeFieldComponent], [typeof i3.CommonModule, typeof i4.FormsModule, typeof i5.MatInputModule, typeof i6.MatDividerModule, typeof i7.MatFormFieldModule, typeof i8.DbxButtonModule, typeof i9.MatButtonModule, typeof i10.MatDatepickerModule, typeof i11.MatNativeDateModule, typeof i12.MatMenuModule, typeof i4.ReactiveFormsModule, typeof i13.DbxDatePipeModule, typeof i13.DbxValuePipeModule, typeof i14.MatChipsModule, typeof i15.MatIconModule, typeof i16.FlexLayoutModule, typeof i17.FormlyModule], [typeof i18.DbxFormFormlyWrapperModule]>;
22
23
  static ɵinj: i0.ɵɵInjectorDeclaration<DbxFormFormlyDateFieldModule>;
23
24
  }
@@ -0,0 +1,20 @@
1
+ import { DateTimezoneUtcNormalInstance, DateRangeWithDateOrStringValue } from '@dereekb/date';
2
+ import { ISO8601DayString, Maybe } from '@dereekb/util';
3
+ export declare enum DbxDateTimeValueMode {
4
+ /**
5
+ * Value is returned/parsed as a Date.
6
+ */
7
+ DATE = 0,
8
+ /**
9
+ * Value is returned/parsed as an ISO8601DateString
10
+ */
11
+ DATE_STRING = 1,
12
+ /**
13
+ * Value is returned/parsed as an ISO8601DayString, relative to the current timezone.
14
+ */
15
+ DAY_STRING = 2
16
+ }
17
+ export declare function dbxDateTimeInputValueParseFactory(mode: DbxDateTimeValueMode, timezoneInstance: Maybe<DateTimezoneUtcNormalInstance>): (date: Maybe<Date | string>) => Maybe<Date>;
18
+ export declare function dbxDateTimeOutputValueFactory(mode: DbxDateTimeValueMode, timezoneInstance: Maybe<DateTimezoneUtcNormalInstance>): (date: Maybe<Date>) => Maybe<Date | string>;
19
+ export declare function dbxDateTimeIsSameDateTimeFieldValue(a: Maybe<Date | ISO8601DayString>, b: Maybe<Date | ISO8601DayString>): boolean;
20
+ export declare function dbxDateRangeIsSameDateRangeFieldValue(a: Maybe<DateRangeWithDateOrStringValue>, b: Maybe<DateRangeWithDateOrStringValue>): boolean;
@@ -0,0 +1,56 @@
1
+ import { Getter, GetterOrValue, LogicalDate, Maybe, ReadableTimeString } from '@dereekb/util';
2
+ /**
3
+ * A pair of either a logical date or a time string.
4
+ */
5
+ export interface DateTimePresetValue {
6
+ /**
7
+ * Logical date to provide.
8
+ */
9
+ logicalDate?: Maybe<LogicalDate>;
10
+ /**
11
+ * Time string value. Ignored if logical date is provided.
12
+ */
13
+ timeString?: Maybe<ReadableTimeString>;
14
+ }
15
+ /**
16
+ * Configuration for a DateTimePreset
17
+ */
18
+ export interface DateTimePresetConfiguration {
19
+ /**
20
+ * Label
21
+ */
22
+ label: GetterOrValue<string>;
23
+ /**
24
+ * Whether or not the value should be retrieved each time or can be cached.
25
+ *
26
+ * Only relevant if a getter is used.
27
+ */
28
+ dynamic?: boolean;
29
+ /**
30
+ * Logical time to provide.
31
+ */
32
+ logicalDate?: Maybe<GetterOrValue<LogicalDate>>;
33
+ /**
34
+ * Time string to return. Ignored if logicalDate is provided.
35
+ */
36
+ timeString?: Maybe<GetterOrValue<ReadableTimeString>>;
37
+ }
38
+ /**
39
+ * A label and value getter.
40
+ */
41
+ export interface DateTimePreset {
42
+ /**
43
+ * Getter for the label
44
+ */
45
+ label: Getter<string>;
46
+ /**
47
+ * Getter for the value
48
+ */
49
+ value: Getter<DateTimePresetValue>;
50
+ }
51
+ /**
52
+ * Creates a DateTimePreset from a DateTimePresetConfiguration
53
+ *
54
+ * @param config
55
+ */
56
+ export declare function dateTimePreset(config: DateTimePresetConfiguration): DateTimePreset;
@@ -1,4 +1,4 @@
1
- import { LogicalDateStringCode, Maybe, ReadableTimeString, ArrayOrValue, ISO8601DateString, DecisionFunction, TimezoneString } from '@dereekb/util';
1
+ import { Maybe, ReadableTimeString, ArrayOrValue, ISO8601DateString, DecisionFunction, TimezoneString, LogicalDate } from '@dereekb/util';
2
2
  import { DateTimeMinuteConfig, DateTimezoneUtcNormalInstance } from '@dereekb/date';
3
3
  import { Observable } from 'rxjs';
4
4
  import { ChangeDetectorRef, OnDestroy, OnInit } from '@angular/core';
@@ -7,6 +7,9 @@ import { FieldType } from '@ngx-formly/material';
7
7
  import { FieldTypeConfig, FormlyFieldProps } from '@ngx-formly/core';
8
8
  import { MatDatepickerInputEvent } from '@angular/material/datepicker';
9
9
  import { ObservableOrValueGetter } from '@dereekb/rxjs';
10
+ import { DateTimePreset, DateTimePresetConfiguration } from './datetime';
11
+ import { DbxDateTimeFieldMenuPresetsService } from './datetime.field.service';
12
+ import { DbxDateTimeValueMode } from './date.value';
10
13
  import * as i0 from "@angular/core";
11
14
  export declare enum DbxDateTimeFieldTimeMode {
12
15
  /**
@@ -22,23 +25,7 @@ export declare enum DbxDateTimeFieldTimeMode {
22
25
  */
23
26
  NONE = "none"
24
27
  }
25
- export declare enum DbxDateTimeValueMode {
26
- /**
27
- * Value is returned/parsed as a Date.
28
- */
29
- DATE = 0,
30
- /**
31
- * Value is returned/parsed as an ISO8601DateString
32
- */
33
- DATE_STRING = 1,
34
- /**
35
- * Value is returned/parsed as an ISO8601DayString, relative to the current timezone.
36
- */
37
- DAY_STRING = 2
38
- }
39
- export declare function dbxDateTimeInputValueParseFactory(mode: DbxDateTimeValueMode, timezoneInstance: Maybe<DateTimezoneUtcNormalInstance>): (date: Maybe<Date | string>) => Maybe<Date>;
40
- export declare function dbxDateTimeOutputValueFactory(mode: DbxDateTimeValueMode, timezoneInstance: Maybe<DateTimezoneUtcNormalInstance>): (date: Maybe<Date>) => Maybe<Date | string>;
41
- export declare type DateTimePickerConfiguration = Omit<DateTimeMinuteConfig, 'date'>;
28
+ export declare type DbxDateTimePickerConfiguration = Omit<DateTimeMinuteConfig, 'date'>;
42
29
  export declare type DbxDateTimeFieldSyncType = 'before' | 'after';
43
30
  export interface DbxDateTimeFieldSyncField {
44
31
  /**
@@ -110,9 +97,9 @@ export interface DbxDateTimeFieldProps extends FormlyFieldProps {
110
97
  */
111
98
  hideDatePicker?: boolean;
112
99
  /**
113
- * Used for returning the configuration observable.
100
+ * Custom picker configuration
114
101
  */
115
- getConfigObs?: () => Observable<DateTimePickerConfiguration>;
102
+ pickerConfig?: ObservableOrValueGetter<DbxDateTimePickerConfiguration>;
116
103
  /**
117
104
  * Used for syncing with one or more fields with a Date value.
118
105
  */
@@ -127,6 +114,16 @@ export interface DbxDateTimeFieldProps extends FormlyFieldProps {
127
114
  * Whether or not to display the timezone. True by default.
128
115
  */
129
116
  showTimezone?: boolean;
117
+ /**
118
+ * Custom presets to show in the dropdown.
119
+ */
120
+ presets?: ObservableOrValueGetter<DateTimePresetConfiguration[]>;
121
+ /**
122
+ * Used for returning the configuration observable.
123
+ *
124
+ * @deprecated Use pickerConfig instead.
125
+ */
126
+ getConfigObs?: ObservableOrValueGetter<DbxDateTimePickerConfiguration>;
130
127
  }
131
128
  export interface DbxDateTimeFieldSyncParsedField extends Pick<DbxDateTimeFieldSyncField, 'syncType'> {
132
129
  control: AbstractControl<Maybe<Date | ISO8601DateString>>;
@@ -134,10 +131,13 @@ export interface DbxDateTimeFieldSyncParsedField extends Pick<DbxDateTimeFieldSy
134
131
  export declare function syncConfigValueObs(parseConfigsObs: Observable<DbxDateTimeFieldSyncParsedField[]>, type: DbxDateTimeFieldSyncType): Observable<Date | null>;
135
132
  export declare class DbxDateTimeFieldComponent extends FieldType<FieldTypeConfig<DbxDateTimeFieldProps>> implements OnInit, OnDestroy {
136
133
  private readonly cdRef;
134
+ private readonly dbxDateTimeFieldConfigService;
137
135
  private _sub;
138
136
  private _valueSub;
137
+ private _config;
138
+ private _syncConfigObs;
139
139
  private _defaultTimezone;
140
- private _customTimezone;
140
+ private _presets;
141
141
  private _fullDayInputCtrl?;
142
142
  private _fullDayControlObs;
143
143
  readonly fullDayControl$: Observable<AbstractControl<boolean, boolean>>;
@@ -155,8 +155,6 @@ export declare class DbxDateTimeFieldComponent extends FieldType<FieldTypeConfig
155
155
  readonly timeString$: Observable<ReadableTimeString | ''>;
156
156
  readonly dateInputCtrl: FormControl<Date | null>;
157
157
  readonly timeInputCtrl: FormControl<string | null>;
158
- private _config;
159
- private _syncConfigObs;
160
158
  get dateLabel(): string;
161
159
  get timeLabel(): string;
162
160
  get allDayLabel(): string;
@@ -172,7 +170,7 @@ export declare class DbxDateTimeFieldComponent extends FieldType<FieldTypeConfig
172
170
  get hideDatePicker(): boolean;
173
171
  get timezone(): Maybe<ObservableOrValueGetter<Maybe<string>>>;
174
172
  get showTimezone(): boolean;
175
- get allowChangeTimezone(): boolean;
173
+ get presets(): ObservableOrValueGetter<DateTimePresetConfiguration[]> | undefined;
176
174
  readonly fullDay$: Observable<boolean>;
177
175
  readonly showTimeInput$: Observable<boolean>;
178
176
  readonly showAddTime$: Observable<boolean>;
@@ -187,15 +185,17 @@ export declare class DbxDateTimeFieldComponent extends FieldType<FieldTypeConfig
187
185
  readonly dateInputMin$: Observable<Date | null>;
188
186
  readonly dateInputMax$: Observable<Date | null>;
189
187
  readonly rawDateTime$: Observable<Maybe<Date>>;
190
- readonly config$: Observable<Maybe<DateTimePickerConfiguration>>;
188
+ readonly config$: Observable<Maybe<DbxDateTimePickerConfiguration>>;
191
189
  readonly pickerFilter$: Observable<DecisionFunction<Date | null>>;
192
190
  readonly defaultPickerFilter: DecisionFunction<Date | null>;
193
191
  readonly timeOutput$: Observable<Maybe<Date>>;
194
- constructor(cdRef: ChangeDetectorRef);
192
+ readonly presets$: Observable<DateTimePreset[]>;
193
+ constructor(cdRef: ChangeDetectorRef, dbxDateTimeFieldConfigService: DbxDateTimeFieldMenuPresetsService);
195
194
  ngOnInit(): void;
196
195
  ngOnDestroy(): void;
196
+ selectPreset(preset: DateTimePreset): void;
197
197
  datePicked(event: MatDatepickerInputEvent<Date>): void;
198
- setLogicalTime(time: LogicalDateStringCode): void;
198
+ setLogicalTime(time: LogicalDate): void;
199
199
  setDateInputValue(date: Date): void;
200
200
  setTimeFromDate(timeDate: Date): void;
201
201
  setTime(time: ReadableTimeString): void;
@@ -209,3 +209,7 @@ export declare class DbxDateTimeFieldComponent extends FieldType<FieldTypeConfig
209
209
  static ɵfac: i0.ɵɵFactoryDeclaration<DbxDateTimeFieldComponent, never>;
210
210
  static ɵcmp: i0.ɵɵComponentDeclaration<DbxDateTimeFieldComponent, "ng-component", never, {}, {}, never, never, false>;
211
211
  }
212
+ /**
213
+ * @deprecated Use DbxDateTimePickerConfiguration instead.
214
+ */
215
+ export declare type DateTimePickerConfiguration = DbxDateTimePickerConfiguration;
@@ -1,27 +1,31 @@
1
1
  import { Observable } from 'rxjs';
2
2
  import { FormlyFieldConfig } from '@ngx-formly/core';
3
3
  import { LabeledFieldConfig, DescriptionFieldConfig, MaterialFormFieldConfig } from '../../field';
4
- import { DbxDateTimeFieldProps, DateTimePickerConfiguration } from './datetime.field.component';
4
+ import { DbxDateTimeFieldProps, DbxDateTimePickerConfiguration } from './datetime.field.component';
5
+ import { DbxFixedDateRangeFieldProps } from './fixeddaterange.field.component';
5
6
  export interface DateTimeFieldConfig extends LabeledFieldConfig, DescriptionFieldConfig, DbxDateTimeFieldProps, MaterialFormFieldConfig {
6
7
  }
7
8
  export declare type TimeFieldConfig = Omit<DateTimeFieldConfig, 'showDate'>;
8
- export declare const TAKE_NEXT_UPCOMING_TIME_CONFIG_OBS: () => Observable<DateTimePickerConfiguration>;
9
+ export declare const TAKE_NEXT_UPCOMING_TIME_CONFIG_OBS: () => Observable<DbxDateTimePickerConfiguration>;
9
10
  /**
10
11
  * Same as DateTime field but with the Date input hidden by default.
11
12
  */
12
13
  export declare function timeOnlyField(config?: Partial<TimeFieldConfig>): FormlyFieldConfig;
13
14
  export declare function dateTimeField(config?: Partial<DateTimeFieldConfig>): import("../../wrapper/wrapper").WrapperFormlyFieldConfig<import("../../wrapper/style.wrapper.component").DbxFormStyleWrapperConfig, FormlyFieldConfig<DbxDateTimeFieldProps>>;
14
15
  export declare type DateDateRangeFieldDateConfig = Omit<DateTimeFieldConfig, 'dateLabel' | 'timeOnly' | 'timeMode' | 'getSyncFieldsObs' | 'timezone' | 'showTimezone'>;
15
- export interface DateDateRangeFieldConfig extends Pick<DateTimeFieldConfig, 'timezone' | 'showTimezone'> {
16
+ export interface DateDateRangeFieldConfig extends Pick<DateTimeFieldConfig, 'timezone' | 'showTimezone' | 'presets'> {
16
17
  required?: boolean;
17
18
  start?: Partial<DateDateRangeFieldDateConfig>;
18
19
  end?: Partial<DateDateRangeFieldDateConfig>;
19
20
  }
20
21
  export declare function dateRangeField(config?: DateDateRangeFieldConfig): FormlyFieldConfig;
21
22
  export declare type DateTimeRangeFieldTimeConfig = Omit<DateDateRangeFieldDateConfig, 'allDayLabel' | 'fullDayFieldName' | 'fullDayInUTC' | 'timezone' | 'showTimezone'>;
22
- export interface DateDateTimeRangeFieldConfig extends Pick<DateTimeFieldConfig, 'timezone' | 'showTimezone'> {
23
+ export interface DateDateTimeRangeFieldConfig extends Pick<DateTimeFieldConfig, 'timezone' | 'showTimezone' | 'presets'> {
23
24
  required?: boolean;
24
25
  start?: Partial<DateTimeRangeFieldTimeConfig>;
25
26
  end?: Partial<DateTimeRangeFieldTimeConfig>;
26
27
  }
27
28
  export declare function dateTimeRangeField(inputConfig?: DateDateTimeRangeFieldConfig): FormlyFieldConfig;
29
+ export interface FixedDateRangeFieldConfig extends LabeledFieldConfig, DescriptionFieldConfig, DbxFixedDateRangeFieldProps, MaterialFormFieldConfig {
30
+ }
31
+ export declare function fixedDateRangeField(config?: Partial<FixedDateRangeFieldConfig>): import("../../wrapper/wrapper").WrapperFormlyFieldConfig<import("../../wrapper/style.wrapper.component").DbxFormStyleWrapperConfig, FormlyFieldConfig<DbxDateTimeFieldProps>>;
@@ -0,0 +1,15 @@
1
+ import { DateTimePresetConfiguration } from './datetime';
2
+ import { InjectionToken } from '@angular/core';
3
+ import { Maybe } from '@dereekb/util';
4
+ import * as i0 from "@angular/core";
5
+ export declare const DBX_DATE_TIME_FIELD_MENU_PRESETS_TOKEN: InjectionToken<unknown>;
6
+ export declare class DbxDateTimeFieldMenuPresetsService {
7
+ private readonly initialConfigs;
8
+ private _configurations;
9
+ readonly configurations$: import("rxjs").Observable<DateTimePresetConfiguration[]>;
10
+ get configurations(): DateTimePresetConfiguration[];
11
+ set configurations(configurations: DateTimePresetConfiguration[]);
12
+ constructor(initialConfigs: Maybe<DateTimePresetConfiguration[]>);
13
+ static ɵfac: i0.ɵɵFactoryDeclaration<DbxDateTimeFieldMenuPresetsService, [{ optional: true; }]>;
14
+ static ɵprov: i0.ɵɵInjectableDeclaration<DbxDateTimeFieldMenuPresetsService>;
15
+ }
@@ -0,0 +1,2 @@
1
+ import { DateTimePresetConfiguration } from './datetime';
2
+ export declare const DEFAULT_DATE_TIME_FIELD_MENU_PRESETS_PRESETS: DateTimePresetConfiguration[];
@@ -0,0 +1,154 @@
1
+ import { Maybe, DecisionFunction, TimezoneString } from '@dereekb/util';
2
+ import { DateTimezoneUtcNormalInstance, DateRangeInput, DateRange, DateTimeMinuteConfig, LimitDateTimeInstance } from '@dereekb/date';
3
+ import { Observable } from 'rxjs';
4
+ import { ElementRef, OnDestroy, OnInit } from '@angular/core';
5
+ import { AbstractControl, FormControl, FormGroup } from '@angular/forms';
6
+ import { FieldType } from '@ngx-formly/material';
7
+ import { FieldTypeConfig, FormlyFieldProps } from '@ngx-formly/core';
8
+ import { MatDateRangeSelectionStrategy, DateRange as DatePickerDateRange, MatCalendar } from '@angular/material/datepicker';
9
+ import { ObservableOrValueGetter } from '@dereekb/rxjs';
10
+ import { DbxDateTimeValueMode } from './date.value';
11
+ import { DateTimePresetConfiguration } from './datetime';
12
+ import { DbxDateTimeFieldMenuPresetsService } from './datetime.field.service';
13
+ import { DateAdapter } from '@angular/material/core';
14
+ import * as i0 from "@angular/core";
15
+ export declare type DbxFixedDateRangeDateRangeInput = Omit<DateRangeInput, 'date'>;
16
+ export declare type DbxFixedDateRangePickerConfiguration = Omit<DateTimeMinuteConfig, 'date'>;
17
+ export declare type DbxFixedDateRangeSelectionMode = 'single' | 'arbitrary' | 'arbitrary_quick';
18
+ export declare type DbxFixedDateRangePicking = 'start' | 'end';
19
+ export interface DbxFixedDateRangeFieldProps extends FormlyFieldProps {
20
+ /**
21
+ * Date range input to build the date range.
22
+ */
23
+ dateRangeInput: ObservableOrValueGetter<DbxFixedDateRangeDateRangeInput>;
24
+ /**
25
+ * Selection mode to use when picking dates on the calendar.
26
+ */
27
+ selectionMode?: Maybe<ObservableOrValueGetter<DbxFixedDateRangeSelectionMode>>;
28
+ /**
29
+ * Value mode for the dates in the output DateRange.
30
+ *
31
+ * Defaults to DATE
32
+ */
33
+ valueMode?: DbxDateTimeValueMode;
34
+ /**
35
+ * Whether or not to pass the date value as a UTC date, or a date in the current timezone.
36
+ */
37
+ fullDayInUTC?: boolean;
38
+ /**
39
+ * Custom picker configuration
40
+ */
41
+ pickerConfig?: ObservableOrValueGetter<DbxFixedDateRangePickerConfiguration>;
42
+ /**
43
+ * (Optional) The input timezone to default to.
44
+ *
45
+ * Ignored if fullDayInUTC is true.
46
+ */
47
+ timezone?: Maybe<ObservableOrValueGetter<Maybe<TimezoneString>>>;
48
+ /**
49
+ * Whether or not to display the timezone. True by default.
50
+ */
51
+ showTimezone?: boolean;
52
+ /**
53
+ * Custom presets to show in the dropdown.
54
+ */
55
+ presets?: ObservableOrValueGetter<DateTimePresetConfiguration[]>;
56
+ /**
57
+ * Whether or not to show the range input. Defaults to true.
58
+ */
59
+ showRangeInput?: boolean;
60
+ }
61
+ export interface FixedDateRangeScan {
62
+ /**
63
+ * The latest date passed, if applicable.
64
+ */
65
+ lastDateRange?: Maybe<Partial<DateRange>>;
66
+ /**
67
+ * The generated boundary range.
68
+ */
69
+ boundary?: DateRange;
70
+ /**
71
+ * New Date Range
72
+ */
73
+ range?: DateRange;
74
+ }
75
+ export declare class DbxFixedDateRangeFieldComponent extends FieldType<FieldTypeConfig<DbxFixedDateRangeFieldProps>> implements OnInit, OnDestroy {
76
+ private readonly dbxDateTimeFieldConfigService;
77
+ private _sub;
78
+ private _inputRangeFormSub;
79
+ private _inputRangeFormValueSub;
80
+ private _dateRangeInputSub;
81
+ private _currentSelectionModeSub;
82
+ private _latestBoundarySub;
83
+ private _disableEndSub;
84
+ private _activeDateSub;
85
+ private _currentDateRangeInput;
86
+ private _currentSelectionMode;
87
+ private _latestBoundary;
88
+ private _config;
89
+ private _selectionMode;
90
+ private _dateRangeInput;
91
+ private _timezone;
92
+ private _presets;
93
+ private _selectedDateRange;
94
+ private _formControlObs;
95
+ readonly formControl$: Observable<AbstractControl<Maybe<DateRange>, Maybe<DateRange>>>;
96
+ calendar: MatCalendar<Date>;
97
+ startDateInputElement: ElementRef;
98
+ endDateInputElement: ElementRef;
99
+ get currentDateRangeInput(): Maybe<DbxFixedDateRangeDateRangeInput>;
100
+ get currentSelectionMode(): DbxFixedDateRangeSelectionMode;
101
+ get latestBoundary(): Maybe<DateRange>;
102
+ readonly config$: Observable<DbxFixedDateRangePickerConfiguration>;
103
+ readonly limitDateTimeInstance$: Observable<LimitDateTimeInstance>;
104
+ readonly selectionMode$: Observable<DbxFixedDateRangeSelectionMode>;
105
+ readonly dateRangeInput$: Observable<Maybe<DbxFixedDateRangeDateRangeInput>>;
106
+ readonly timezone$: Observable<Maybe<TimezoneString>>;
107
+ readonly timezoneInstance$: Observable<Maybe<DateTimezoneUtcNormalInstance>>;
108
+ readonly valueInSystemTimezone$: Observable<Maybe<DateRange>>;
109
+ readonly startDate$: Observable<Date>;
110
+ dateRangeSelectionForMode(mode: DbxFixedDateRangeSelectionMode): Observable<Maybe<DateRange>>;
111
+ readonly fullBoundary$: Observable<Maybe<DateRange>>;
112
+ readonly latestBoundary$: Observable<Maybe<DateRange>>;
113
+ readonly dateRangeSelection$: Observable<Maybe<DateRange>>;
114
+ readonly calendarSelection$: Observable<DatePickerDateRange<Date> | null>;
115
+ readonly endDisabled$: Observable<boolean>;
116
+ readonly inputRangeForm: FormGroup<{
117
+ start: FormControl<Maybe<Date>>;
118
+ end: FormControl<Maybe<Date>>;
119
+ }>;
120
+ get fixedDateRangeField(): DbxFixedDateRangeFieldProps;
121
+ get selectionMode(): Maybe<ObservableOrValueGetter<DbxFixedDateRangeSelectionMode>>;
122
+ get valueMode(): DbxDateTimeValueMode;
123
+ get description(): Maybe<string>;
124
+ get timezone(): Maybe<ObservableOrValueGetter<Maybe<string>>>;
125
+ get showTimezone(): boolean;
126
+ get presets(): ObservableOrValueGetter<DateTimePresetConfiguration[]> | undefined;
127
+ get showRangeInput(): boolean;
128
+ readonly minMaxRange$: Observable<Maybe<Partial<DateRange>>>;
129
+ readonly min$: Observable<Date | null>;
130
+ readonly max$: Observable<Date | null>;
131
+ readonly pickerFilter$: Observable<DecisionFunction<Date | null>>;
132
+ readonly defaultPickerFilter: DecisionFunction<Date | null>;
133
+ constructor(dbxDateTimeFieldConfigService: DbxDateTimeFieldMenuPresetsService);
134
+ ngOnInit(): void;
135
+ ngOnDestroy(): void;
136
+ selectedChange(date: Maybe<Date>): void;
137
+ setDateRange(dateRange: Maybe<Partial<DateRange>>): void;
138
+ _createDateRange(date: Maybe<Date>): Maybe<DateRange>;
139
+ static ɵfac: i0.ɵɵFactoryDeclaration<DbxFixedDateRangeFieldComponent, never>;
140
+ static ɵcmp: i0.ɵɵComponentDeclaration<DbxFixedDateRangeFieldComponent, "ng-component", never, {}, {}, never, never, false>;
141
+ }
142
+ export declare class DbxFixedDateRangeFieldSelectionStrategy<D> implements MatDateRangeSelectionStrategy<D> {
143
+ private _dateAdapter;
144
+ readonly dbxFixedDateRangeFieldComponent: DbxFixedDateRangeFieldComponent;
145
+ constructor(_dateAdapter: DateAdapter<D>, dbxFixedDateRangeFieldComponent: DbxFixedDateRangeFieldComponent);
146
+ selectionFinished(date: D | null, currentRange: DatePickerDateRange<D>, event: Event): DatePickerDateRange<D>;
147
+ createPreview(activeDate: D | null, currentRange: DatePickerDateRange<D>, event: Event): DatePickerDateRange<D>;
148
+ private _createDateRangeWithDate;
149
+ private _createDateRange;
150
+ dateFromAdapterDate(input: D): Date;
151
+ adapterDateFromDate(date: Date): D;
152
+ static ɵfac: i0.ɵɵFactoryDeclaration<DbxFixedDateRangeFieldSelectionStrategy<any>, never>;
153
+ static ɵprov: i0.ɵɵInjectableDeclaration<DbxFixedDateRangeFieldSelectionStrategy<any>>;
154
+ }
@@ -1,3 +1,7 @@
1
1
  export * from './date.field.module';
2
+ export * from './date.value';
2
3
  export * from './datetime.field';
4
+ export * from './datetime.field.service';
3
5
  export * from './datetime.field.component';
6
+ export * from './datetime.preset';
7
+ export * from './datetime';
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@dereekb/dbx-form/mapbox",
3
- "version": "9.23.28",
3
+ "version": "9.24.1",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^14.1.0",
6
6
  "@angular/core": "^14.1.0",
7
7
  "@angular/forms": "^14.2.0",
8
- "@dereekb/dbx-web": "9.23.28",
8
+ "@dereekb/dbx-web": "9.24.1",
9
9
  "@ngx-formly/core": "^6.0.0",
10
10
  "@ngx-formly/material": "^6.0.0",
11
11
  "@ng-web-apis/geolocation": "^2.0.0",
12
12
  "mapbox-gl": "^2.9.2",
13
- "@dereekb/dbx-web/mapbox": "9.23.28",
14
- "@dereekb/dbx-form": "9.23.28"
13
+ "@dereekb/dbx-web/mapbox": "9.24.1",
14
+ "@dereekb/dbx-form": "9.24.1"
15
15
  },
16
16
  "dependencies": {
17
17
  "tslib": "^2.3.0"
package/package.json CHANGED
@@ -1,19 +1,19 @@
1
1
  {
2
2
  "name": "@dereekb/dbx-form",
3
- "version": "9.23.28",
3
+ "version": "9.24.1",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^14.0.0",
6
6
  "@angular/core": "^14.0.0",
7
7
  "lodash.clonedeep": "^4.5.0",
8
- "@dereekb/dbx-core": "9.23.28",
8
+ "@dereekb/dbx-core": "9.24.1",
9
9
  "@angular/material": "^14.2.0",
10
- "@dereekb/dbx-web": "9.23.28",
10
+ "@dereekb/dbx-web": "9.24.1",
11
11
  "@angular/forms": "^14.2.0",
12
12
  "@ngx-formly/core": "^6.0.0",
13
13
  "@ngx-formly/material": "^6.0.0",
14
14
  "ngx-editor": "^15.0.0",
15
15
  "ngx-mat-intl-tel-input": "^5.0.0",
16
- "@dereekb/model": "9.23.28"
16
+ "@dereekb/model": "9.24.1"
17
17
  },
18
18
  "dependencies": {
19
19
  "tslib": "^2.3.0"