@dereekb/dbx-form 10.1.4 → 10.1.6

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.
@@ -3952,7 +3952,7 @@ class DbxDateTimeFieldComponent extends FieldType$1 {
3952
3952
  }
3953
3953
  return result;
3954
3954
  }), distinctUntilChanged(isSameDateHoursAndMinutes), shareReplay(1));
3955
- this.config$ = combineLatest([this._config.pipe(switchMapMaybeObs()), this.syncConfigBeforeValue$, this.syncConfigAfterValue$]).pipe(map(([x, dateInputMin, dateInputMax]) => {
3955
+ this.dateTimePickerConfig$ = combineLatest([this._config.pipe(switchMapMaybeObs()), this.syncConfigBeforeValue$, this.syncConfigAfterValue$]).pipe(map(([x, dateInputMin, dateInputMax]) => {
3956
3956
  let result = x;
3957
3957
  if (dateInputMin != null || dateInputMax != null) {
3958
3958
  const { min: limitMin, max: limitMax } = x?.limits ?? {};
@@ -3969,9 +3969,9 @@ class DbxDateTimeFieldComponent extends FieldType$1 {
3969
3969
  }
3970
3970
  return result;
3971
3971
  }), distinctUntilChanged(), shareReplay(1));
3972
- this.dateInputMin$ = this.config$.pipe(map((x) => (x?.limits?.min ?? null)), distinctUntilChanged(isSameDate), shareReplay(1));
3973
- this.dateInputMax$ = this.config$.pipe(map((x) => (x?.limits?.max ?? null)), distinctUntilChanged(isSameDate), shareReplay(1));
3974
- this.pickerFilter$ = this.config$.pipe(distinctUntilChanged(), map((x) => {
3972
+ this.dateInputMin$ = this.dateTimePickerConfig$.pipe(map((x) => (x?.limits?.min ?? null)), distinctUntilChanged(isSameDate), shareReplay(1));
3973
+ this.dateInputMax$ = this.dateTimePickerConfig$.pipe(map((x) => (x?.limits?.max ?? null)), distinctUntilChanged(isSameDate), shareReplay(1));
3974
+ this.pickerFilter$ = this.dateTimePickerConfig$.pipe(distinctUntilChanged(), map((x) => {
3975
3975
  if (x) {
3976
3976
  const filter = dateTimeMinuteWholeDayDecisionFunction(x, false);
3977
3977
  return (x) => (x != null ? filter(x) : true);
@@ -3981,7 +3981,7 @@ class DbxDateTimeFieldComponent extends FieldType$1 {
3981
3981
  }
3982
3982
  }), shareReplay(1));
3983
3983
  this.defaultPickerFilter = () => true;
3984
- this.timeOutput$ = combineLatest([this.rawDateTime$, this._offset, this.config$]).pipe(throttleTime(TIME_OUTPUT_THROTTLE_TIME$1, undefined, { leading: false, trailing: true }), distinctUntilChanged((current, next) => current[0] === next[0] && next[1] === 0), tap(([, stepsOffset]) => (stepsOffset ? this._offset.next(0) : 0)), map(([date, stepsOffset, config]) => {
3984
+ this.timeOutput$ = combineLatest([this.rawDateTime$, this._offset, this.dateTimePickerConfig$]).pipe(throttleTime(TIME_OUTPUT_THROTTLE_TIME$1, undefined, { leading: false, trailing: true }), distinctUntilChanged((current, next) => current[0] === next[0] && next[1] === 0), tap(([, stepsOffset]) => (stepsOffset ? this._offset.next(0) : 0)), map(([date, stepsOffset, config]) => {
3985
3985
  if (date != null) {
3986
3986
  const instance = new DateTimeMinuteInstance({
3987
3987
  date,
@@ -4156,9 +4156,18 @@ class DbxDateTimeFieldComponent extends FieldType$1 {
4156
4156
  offset = 7;
4157
4157
  }
4158
4158
  if (direction !== 0) {
4159
- this.date$.pipe(first()).subscribe((date) => {
4160
- const newDate = addDays(date, offset * direction);
4161
- this.setDateInputValue(newDate);
4159
+ combineLatest([this.date$, this.dateTimePickerConfig$])
4160
+ .pipe(first())
4161
+ .subscribe(([date, config]) => {
4162
+ const newDate = startOfDay(addDays(date, offset * direction));
4163
+ const instance = new DateTimeMinuteInstance({
4164
+ date: newDate,
4165
+ ...config
4166
+ });
4167
+ const nextDate = instance.isInSchedule(newDate) ? newDate : instance.findNextAvailableDayInSchedule(newDate, direction === 1 ? 'future' : 'past');
4168
+ if (nextDate != null) {
4169
+ this.setDateInputValue(instance.clampToLimit(nextDate));
4170
+ }
4162
4171
  });
4163
4172
  }
4164
4173
  }