@dereekb/dbx-form 9.23.9 → 9.23.11

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.
@@ -1,5 +1,5 @@
1
- import { DateBlockDayOfWeekFactory, DateBlockIndex, DateBlockRangeWithRange, DateOrDateBlockIndex, DateRange, DateScheduleDateFilterConfig, DateScheduleDayCode, DateScheduleRange, DateTimingRelativeIndexFactory } from '@dereekb/date';
2
- import { Maybe, DecisionFunction, IterableOrValue, MaybeMap, DayOfWeek } from '@dereekb/util';
1
+ import { DateBlockDayOfWeekFactory, DateBlockIndex, DateBlockRangeWithRange, DateOrDateBlockIndex, DateRange, DateScheduleDateFilterConfig, DateScheduleDayCode, DateScheduleRange, DateTimingRelativeIndexFactory, DateOrDateRangeOrDateBlockIndexOrDateBlockRange } from '@dereekb/date';
2
+ import { Maybe, DecisionFunction, IterableOrValue, MaybeMap, DayOfWeek, AllOrNoneSelection, ArrayOrValue } from '@dereekb/util';
3
3
  import { ComponentStore } from '@ngrx/component-store';
4
4
  import { Observable } from 'rxjs';
5
5
  import { CalendarScheduleSelectionCellContentFactory, CalendarScheduleSelectionValue } from './calendar.schedule.selection';
@@ -20,12 +20,20 @@ export interface CalendarScheduleSelectionState extends PartialCalendarScheduleS
20
20
  * Filters the days of the schedule to only allow selecting days in the schedule.
21
21
  */
22
22
  filter?: Maybe<DateScheduleDateFilterConfig>;
23
+ /**
24
+ * Additional exclusions that may not be defined within the filter.
25
+ */
26
+ inputExclusions?: Maybe<ArrayOrValue<DateOrDateRangeOrDateBlockIndexOrDateBlockRange>>;
27
+ /**
28
+ * The computed exclusions given the input exclusions.
29
+ */
30
+ computedExclusions?: Maybe<DateBlockIndex[]>;
23
31
  /**
24
32
  * Minimum date allowed if no filter is set. If a filter is set, the greater of the two dates is used as the minimum.
25
33
  */
26
34
  minDate?: Maybe<Date>;
27
35
  /**
28
- * Maximum date allowed if no fitler is set. If a filter is set, the lesser of the two dates is used as the maximum.
36
+ * Maximum date allowed if no filter is set. If a filter is set, the lesser of the two dates is used as the maximum.
29
37
  */
30
38
  maxDate?: Maybe<Date>;
31
39
  /**
@@ -80,8 +88,21 @@ export interface CalendarScheduleSelectionState extends PartialCalendarScheduleS
80
88
  * Current selection value.
81
89
  */
82
90
  currentSelectionValue?: Maybe<CalendarScheduleSelectionValue>;
91
+ /**
92
+ * Whether or not to use the filter as the start and end range instead of optimizing for the current index.
93
+ *
94
+ * Defaults to true.
95
+ */
96
+ computeSelectionResultRelativeToFilter?: Maybe<boolean>;
97
+ /**
98
+ * The initial selection state when the calendar is reset.
99
+ */
100
+ initialSelectionState?: Maybe<AllOrNoneSelection>;
83
101
  }
84
102
  export declare function initialCalendarScheduleSelectionState(): CalendarScheduleSelectionState;
103
+ export declare function calendarScheduleMinDate(x: CalendarScheduleSelectionState): Maybe<Date>;
104
+ export declare function calendarScheduleMaxDate(x: CalendarScheduleSelectionState): Maybe<Date>;
105
+ export declare function calendarScheduleMinAndMaxDate(x: CalendarScheduleSelectionState): Pick<CalendarScheduleSelectionState, 'minDate' | 'maxDate'>;
85
106
  export declare class DbxCalendarScheduleSelectionStore extends ComponentStore<CalendarScheduleSelectionState> {
86
107
  constructor();
87
108
  readonly filter$: Observable<Maybe<DateScheduleDateFilterConfig>>;
@@ -93,6 +114,8 @@ export declare class DbxCalendarScheduleSelectionStore extends ComponentStore<Ca
93
114
  readonly isEnabledFilterDayFunction$: Observable<DecisionFunction<DateOrDateBlockIndex>>;
94
115
  readonly isEnabledDayFunction$: Observable<DecisionFunction<DateOrDateBlockIndex>>;
95
116
  readonly currentDateRange$: Observable<Maybe<DateRange>>;
117
+ readonly computeSelectionResultRelativeToFilter$: Observable<Maybe<boolean>>;
118
+ readonly startBeingUsedFromFilter$: Observable<Maybe<boolean>>;
96
119
  readonly dateRange$: Observable<DateRange>;
97
120
  readonly scheduleDays$: Observable<Set<DateScheduleDayCode>>;
98
121
  readonly currentSelectionValue$: Observable<Maybe<CalendarScheduleSelectionValue>>;
@@ -104,6 +127,8 @@ export declare class DbxCalendarScheduleSelectionStore extends ComponentStore<Ca
104
127
  readonly cellContentFactory$: Observable<CalendarScheduleSelectionCellContentFactory>;
105
128
  readonly isCustomized$: Observable<boolean>;
106
129
  readonly setFilter: (() => void) | ((observableOrValue: Maybe<DateScheduleDateFilterConfig> | Observable<Maybe<DateScheduleDateFilterConfig>>) => import("rxjs").Subscription);
130
+ readonly setExclusions: (() => void) | ((observableOrValue: Maybe<ArrayOrValue<DateOrDateRangeOrDateBlockIndexOrDateBlockRange>> | Observable<Maybe<ArrayOrValue<DateOrDateRangeOrDateBlockIndexOrDateBlockRange>>>) => import("rxjs").Subscription);
131
+ readonly setComputeSelectionResultRelativeToFilter: (() => void) | ((observableOrValue: Maybe<boolean> | Observable<Maybe<boolean>>) => import("rxjs").Subscription);
107
132
  readonly clearFilter: () => void;
108
133
  readonly setTimezone: (() => void) | ((observableOrValue: Maybe<string> | Observable<Maybe<string>>) => import("rxjs").Subscription);
109
134
  readonly setInputRange: (observableOrValue: CalendarScheduleSelectionInputDateRange | Observable<CalendarScheduleSelectionInputDateRange>) => import("rxjs").Subscription;
@@ -111,6 +136,8 @@ export declare class DbxCalendarScheduleSelectionStore extends ComponentStore<Ca
111
136
  readonly addSelectedDates: (observableOrValue: IterableOrValue<DateOrDateBlockIndex> | Observable<IterableOrValue<DateOrDateBlockIndex>>) => import("rxjs").Subscription;
112
137
  readonly removeSelectedDates: (observableOrValue: IterableOrValue<DateOrDateBlockIndex> | Observable<IterableOrValue<DateOrDateBlockIndex>>) => import("rxjs").Subscription;
113
138
  readonly setSelectedDates: (observableOrValue: IterableOrValue<DateOrDateBlockIndex> | Observable<IterableOrValue<DateOrDateBlockIndex>>) => import("rxjs").Subscription;
139
+ readonly selectAllDates: (observableOrValue: AllOrNoneSelection | Observable<AllOrNoneSelection>) => import("rxjs").Subscription;
140
+ readonly setInitialSelectionState: (() => void) | ((observableOrValue: Maybe<AllOrNoneSelection> | Observable<Maybe<AllOrNoneSelection>>) => import("rxjs").Subscription);
114
141
  readonly setScheduleDays: (observableOrValue: Iterable<DateScheduleDayCode> | Observable<Iterable<DateScheduleDayCode>>) => import("rxjs").Subscription;
115
142
  readonly setAllowAllScheduleDays: () => void;
116
143
  readonly setDateScheduleRangeValue: (() => void) | ((observableOrValue: Maybe<DateScheduleRange> | Observable<Maybe<DateScheduleRange>>) => import("rxjs").Subscription);
@@ -118,14 +145,19 @@ export declare class DbxCalendarScheduleSelectionStore extends ComponentStore<Ca
118
145
  static ɵfac: i0.ɵɵFactoryDeclaration<DbxCalendarScheduleSelectionStore, never>;
119
146
  static ɵprov: i0.ɵɵInjectableDeclaration<DbxCalendarScheduleSelectionStore>;
120
147
  }
121
- export declare function updateStateWithFilter(state: CalendarScheduleSelectionState, filter: Maybe<DateScheduleDateFilterConfig>): CalendarScheduleSelectionState;
148
+ export declare function updateStateWithInitialSelectionState(state: CalendarScheduleSelectionState, initialSelectionState: Maybe<AllOrNoneSelection>): CalendarScheduleSelectionState;
149
+ export declare function updateStateWithComputeSelectionResultRelativeToFilter(currentState: CalendarScheduleSelectionState, computeSelectionResultRelativeToFilter: Maybe<boolean>): CalendarScheduleSelectionState;
150
+ export declare function updateStateWithExclusions(state: CalendarScheduleSelectionState, inputExclusions: Maybe<ArrayOrValue<DateOrDateRangeOrDateBlockIndexOrDateBlockRange>>): CalendarScheduleSelectionState;
151
+ export declare function updateStateWithFilter(state: CalendarScheduleSelectionState, inputFilter: Maybe<DateScheduleDateFilterConfig>): CalendarScheduleSelectionState;
122
152
  export declare function updateStateWithDateScheduleRangeValue(state: CalendarScheduleSelectionState, change: Maybe<DateScheduleRange>): CalendarScheduleSelectionState;
123
153
  export declare function updateStateWithChangedScheduleDays(state: CalendarScheduleSelectionState, change: Maybe<Iterable<DateScheduleDayCode>>): CalendarScheduleSelectionState;
124
154
  export interface CalendarScheduleSelectionStateDatesChange {
155
+ reset?: true;
125
156
  toggle?: IterableOrValue<DateOrDateBlockIndex>;
126
157
  add?: IterableOrValue<DateOrDateBlockIndex>;
127
158
  remove?: IterableOrValue<DateOrDateBlockIndex>;
128
159
  set?: IterableOrValue<DateOrDateBlockIndex>;
160
+ selectAll?: AllOrNoneSelection;
129
161
  }
130
162
  export declare function updateStateWithChangedDates(state: CalendarScheduleSelectionState, change: CalendarScheduleSelectionStateDatesChange): CalendarScheduleSelectionState;
131
163
  export declare function noSelectionCalendarScheduleSelectionState(state: CalendarScheduleSelectionState): CalendarScheduleSelectionState;
@@ -2,17 +2,18 @@ import { AbstractControl, FormGroup } from '@angular/forms';
2
2
  import { CompactContextStore } from '@dereekb/dbx-web';
3
3
  import { NgZone, OnDestroy, OnInit } from '@angular/core';
4
4
  import { FieldTypeConfig, FormlyFieldProps } from '@ngx-formly/core';
5
- import { Maybe } from '@dereekb/util';
5
+ import { AllOrNoneSelection, ArrayOrValue, Maybe } from '@dereekb/util';
6
6
  import { FieldType } from '@ngx-formly/material';
7
7
  import { ObservableOrValue } from '@dereekb/rxjs';
8
- import { DateScheduleDateFilterConfig } from '@dereekb/date';
9
- import { DbxCalendarScheduleSelectionStore } from '../../calendar.schedule.selection.store';
8
+ import { DateOrDateRangeOrDateBlockIndexOrDateBlockRange, DateScheduleDateFilterConfig } from '@dereekb/date';
9
+ import { CalendarScheduleSelectionState, DbxCalendarScheduleSelectionStore } from '../../calendar.schedule.selection.store';
10
10
  import { MatFormFieldAppearance } from '@angular/material/form-field';
11
11
  import * as i0 from "@angular/core";
12
- export interface DbxFormCalendarDateScheduleRangeFieldProps extends Pick<FormlyFieldProps, 'label' | 'description' | 'readonly' | 'required'> {
12
+ export interface DbxFormCalendarDateScheduleRangeFieldProps extends Pick<FormlyFieldProps, 'label' | 'description' | 'readonly' | 'required'>, Pick<CalendarScheduleSelectionState, 'computeSelectionResultRelativeToFilter' | 'initialSelectionState'> {
13
13
  appearance?: MatFormFieldAppearance;
14
14
  hideCustomize?: boolean;
15
15
  filter?: ObservableOrValue<Maybe<DateScheduleDateFilterConfig>>;
16
+ exclusions?: ObservableOrValue<Maybe<ArrayOrValue<DateOrDateRangeOrDateBlockIndexOrDateBlockRange>>>;
16
17
  }
17
18
  export declare class DbxFormCalendarDateScheduleRangeFieldComponent<T extends DbxFormCalendarDateScheduleRangeFieldProps = DbxFormCalendarDateScheduleRangeFieldProps> extends FieldType<FieldTypeConfig<T>> implements OnInit, OnDestroy {
18
19
  readonly compact: CompactContextStore;
@@ -21,6 +22,7 @@ export declare class DbxFormCalendarDateScheduleRangeFieldComponent<T extends Db
21
22
  private _syncSub;
22
23
  private _valueSub;
23
24
  private _filterSub;
25
+ private _exclusionsSub;
24
26
  private _formControlObs;
25
27
  readonly formControl$: import("rxjs").Observable<AbstractControl<any, any>>;
26
28
  readonly value$: import("rxjs").Observable<any>;
@@ -32,6 +34,9 @@ export declare class DbxFormCalendarDateScheduleRangeFieldComponent<T extends Db
32
34
  get isReadonlyOrDisabled(): boolean;
33
35
  get showCustomize(): boolean;
34
36
  get filter(): ObservableOrValue<Maybe<DateScheduleDateFilterConfig>>;
37
+ get exclusions(): ObservableOrValue<Maybe<ArrayOrValue<DateOrDateRangeOrDateBlockIndexOrDateBlockRange>>>;
38
+ get initialSelectionState(): Maybe<AllOrNoneSelection>;
39
+ get computeSelectionResultRelativeToFilter(): Maybe<boolean>;
35
40
  ngOnInit(): void;
36
41
  ngOnDestroy(): void;
37
42
  static ɵfac: i0.ɵɵFactoryDeclaration<DbxFormCalendarDateScheduleRangeFieldComponent<any>, [{ optional: true; }, null, null]>;