novo-elements 7.4.0-next.1 → 7.4.0

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.
@@ -16,7 +16,7 @@ import { OverlayConfig, OverlayModule, CdkScrollable, OverlayContainer, Fullscre
16
16
  import * as i2 from '@angular/cdk/portal';
17
17
  import { ComponentPortal, PortalInjector, PortalModule, TemplatePortal } from '@angular/cdk/portal';
18
18
  import * as dateFns from 'date-fns';
19
- import { isSameDay, differenceInCalendarDays, isWithinRange, startOfWeek, endOfWeek, startOfMonth, addDays, isToday, isBefore, isAfter, getMonth, getYear, isDate, startOfDay, addMonths, setMonth, setYear, subMonths, parse, format, isValid } from 'date-fns';
19
+ import { isSameDay, differenceInCalendarDays, isWithinRange, startOfWeek, endOfWeek, startOfMonth, addDays, isToday, isBefore, isAfter, getMonth, getYear, isDate, startOfDay, addMonths, setMonth, setYear, subMonths, parse, format, isValid, subDays } from 'date-fns';
20
20
  import { Subject, from, of, fromEvent, merge, Subscription, interval, ReplaySubject, BehaviorSubject, combineLatest } from 'rxjs';
21
21
  import { filter, take, first, switchMap, takeUntil, debounceTime, distinctUntilChanged, startWith, debounce, map, catchError, mapTo, delay, tap } from 'rxjs/operators';
22
22
  import * as i1$2 from '@angular/platform-browser';
@@ -37741,16 +37741,13 @@ class NovoDatePickerElement {
37741
37741
  }
37742
37742
  }
37743
37743
  modelToSelection(model) {
37744
- // this.selection = this._strategy.selectionFinished();
37745
37744
  switch (this.mode) {
37746
37745
  case 'multiple':
37747
37746
  this.selection = model;
37748
37747
  break;
37749
37748
  case 'range':
37750
37749
  case 'week':
37751
- const range = this.model;
37752
- this.selection = [range.startDate, range.endDate].filter(Boolean);
37753
- break;
37750
+ this.setRangeSelection();
37754
37751
  case 'single':
37755
37752
  default:
37756
37753
  this.selection = [model];
@@ -37764,8 +37761,7 @@ class NovoDatePickerElement {
37764
37761
  this.selection = this.model;
37765
37762
  }
37766
37763
  if (this.mode === 'range') {
37767
- const range = this.model;
37768
- this.selection = [range.startDate, range.endDate].filter(Boolean);
37764
+ this.setRangeSelection();
37769
37765
  }
37770
37766
  if (Helpers.isDate(model)) {
37771
37767
  this.updateView(model);
@@ -37779,6 +37775,18 @@ class NovoDatePickerElement {
37779
37775
  }
37780
37776
  }
37781
37777
  }
37778
+ setRangeSelection() {
37779
+ if (this.model?.hasOwnProperty('startDate')) {
37780
+ // coming from standalone date picker
37781
+ const range = this.model;
37782
+ this.selection = [range.startDate, range.endDate].filter(Boolean);
37783
+ }
37784
+ else if (this.model?.hasOwnProperty('min')) {
37785
+ // coming from data-table filter where model end date is the beginning of the next day
37786
+ const range = this.model;
37787
+ this.selection = [range.min, subDays(range.max, 1)].filter(Boolean);
37788
+ }
37789
+ }
37782
37790
  registerOnChange(fn) {
37783
37791
  this._onChange = fn;
37784
37792
  }