@datarailsshared/datarailsshared 1.4.18-cicd → 1.4.20-tigers

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 (35) hide show
  1. package/bundles/datarailsshared-datarailsshared.umd.js +1420 -1297
  2. package/bundles/datarailsshared-datarailsshared.umd.js.map +1 -1
  3. package/datarailsshared-datarailsshared-1.4.20-tigers.tgz +0 -0
  4. package/datarailsshared-datarailsshared.d.ts +5 -3
  5. package/datarailsshared-datarailsshared.metadata.json +1 -1
  6. package/esm2015/datarailsshared-datarailsshared.js +6 -4
  7. package/esm2015/lib/dr-inputs/date-pickers/directives/dr-date-picker-format.directive.js +47 -0
  8. package/esm2015/lib/dr-inputs/date-pickers/dr-date-picker/dr-date-picker.component.js +152 -0
  9. package/esm2015/lib/dr-inputs/date-pickers/dr-date-picker-with-timeframe/dr-date-picker-with-timeframe.component.js +72 -0
  10. package/esm2015/lib/dr-inputs/date-pickers/dr-date-picker_custom-header/dr-date-picker_custom-header.component.js +128 -0
  11. package/esm2015/lib/dr-inputs/date-pickers/services/dr-date-picker.service.js +55 -0
  12. package/esm2015/lib/dr-inputs/dr-inputs.module.js +13 -9
  13. package/esm2015/lib/dr-tooltip/dr-tooltip.component.js +13 -3
  14. package/esm2015/lib/dr-tooltip/dr-tooltip.directive.js +43 -10
  15. package/esm2015/lib/models/datePicker.js +8 -1
  16. package/esm2015/public-api.js +3 -3
  17. package/fesm2015/datarailsshared-datarailsshared.js +624 -523
  18. package/fesm2015/datarailsshared-datarailsshared.js.map +1 -1
  19. package/lib/dr-inputs/{dr-date-picker → date-pickers/directives}/dr-date-picker-format.directive.d.ts +1 -1
  20. package/lib/dr-inputs/date-pickers/dr-date-picker/dr-date-picker.component.d.ts +55 -0
  21. package/lib/dr-inputs/date-pickers/dr-date-picker-with-timeframe/dr-date-picker-with-timeframe.component.d.ts +26 -0
  22. package/lib/dr-inputs/{dr-date-picker → date-pickers}/dr-date-picker_custom-header/dr-date-picker_custom-header.component.d.ts +4 -4
  23. package/lib/dr-inputs/date-pickers/services/dr-date-picker.service.d.ts +18 -0
  24. package/lib/dr-tooltip/dr-tooltip.component.d.ts +4 -0
  25. package/lib/dr-tooltip/dr-tooltip.directive.d.ts +4 -0
  26. package/lib/models/datePicker.d.ts +12 -0
  27. package/package.json +1 -1
  28. package/public-api.d.ts +1 -2
  29. package/datarailsshared-datarailsshared-1.4.18-cicd.tgz +0 -0
  30. package/esm2015/lib/dr-inputs/dr-date-picker/dr-date-picker-format.directive.js +0 -47
  31. package/esm2015/lib/dr-inputs/dr-date-picker/dr-date-picker.component.js +0 -183
  32. package/esm2015/lib/dr-inputs/dr-date-picker/dr-date-picker.service.js +0 -41
  33. package/esm2015/lib/dr-inputs/dr-date-picker/dr-date-picker_custom-header/dr-date-picker_custom-header.component.js +0 -129
  34. package/lib/dr-inputs/dr-date-picker/dr-date-picker.component.d.ts +0 -54
  35. package/lib/dr-inputs/dr-date-picker/dr-date-picker.service.d.ts +0 -12
@@ -1,17 +1,17 @@
1
1
  import * as i0 from '@angular/core';
2
- import { EventEmitter, Component, ViewEncapsulation, Input, Output, ChangeDetectionStrategy, ChangeDetectorRef, forwardRef, ElementRef, Inject, PLATFORM_ID, ContentChildren, Renderer2, HostBinding, ContentChild, Pipe, TemplateRef, Directive, HostListener, ComponentFactoryResolver, ViewContainerRef, ViewChild, Injectable, Optional, Injector, Host, NgModule } from '@angular/core';
3
- import { FormControl, NG_VALUE_ACCESSOR, NgControl, NgModel, FormsModule, ReactiveFormsModule } from '@angular/forms';
2
+ import { EventEmitter, Component, ViewEncapsulation, Input, Output, ChangeDetectionStrategy, ChangeDetectorRef, forwardRef, ElementRef, Inject, PLATFORM_ID, ContentChildren, Renderer2, HostBinding, ContentChild, Pipe, TemplateRef, HostListener, Directive, ComponentFactoryResolver, ViewContainerRef, ViewChild, Injector, Injectable, Host, NgModule, Optional } from '@angular/core';
3
+ import { FormControl, NG_VALUE_ACCESSOR, NgModel, FormsModule, ReactiveFormsModule, NgControl } from '@angular/forms';
4
4
  import { DateAdapter, MAT_DATE_LOCALE, MAT_DATE_FORMATS, MatNativeDateModule } from '@angular/material/core';
5
5
  import { MomentDateAdapter, MAT_MOMENT_DATE_ADAPTER_OPTIONS, MatMomentDateModule } from '@angular/material-moment-adapter';
6
6
  import * as momentImported from 'moment';
7
7
  import { isPlatformBrowser, DOCUMENT, CommonModule } from '@angular/common';
8
8
  import { Subject, from, merge, fromEvent, noop as noop$1, BehaviorSubject } from 'rxjs';
9
- import { startWith, switchMap, takeUntil, filter, take, first, skip, debounceTime, distinctUntilChanged } from 'rxjs/operators';
9
+ import { startWith, switchMap, takeUntil, filter, skip, first, debounceTime, distinctUntilChanged, take } from 'rxjs/operators';
10
10
  import { transition, style, animate, trigger, state } from '@angular/animations';
11
11
  import * as i1 from '@angular/cdk/overlay';
12
12
  import { Overlay, OverlayPositionBuilder, OverlayConfig } from '@angular/cdk/overlay';
13
13
  import { ComponentPortal } from '@angular/cdk/portal';
14
- import { MatCalendar, MatDatepickerModule } from '@angular/material/datepicker';
14
+ import { MatDatepickerModule, MatCalendar } from '@angular/material/datepicker';
15
15
  import { MatFormFieldModule } from '@angular/material/form-field';
16
16
  import { MatInputModule } from '@angular/material/input';
17
17
  import { MatSelectModule } from '@angular/material/select';
@@ -1486,10 +1486,17 @@ const POPUP_ANIMATION = [
1486
1486
  class TooltipComponent {
1487
1487
  constructor() {
1488
1488
  this.isContentTemplate = false;
1489
+ this.isMouseOn$ = new BehaviorSubject(false);
1489
1490
  }
1490
1491
  ngOnInit() {
1491
1492
  this.isContentTemplate = this.content instanceof TemplateRef;
1492
1493
  }
1494
+ setMouseOn() {
1495
+ this.isMouseOn$.next(true);
1496
+ }
1497
+ unsetMouseOn() {
1498
+ this.isMouseOn$.next(false);
1499
+ }
1493
1500
  }
1494
1501
  TooltipComponent.decorators = [
1495
1502
  { type: Component, args: [{
@@ -1507,7 +1514,9 @@ TooltipComponent.propDecorators = {
1507
1514
  contentContext: [{ type: Input }],
1508
1515
  position: [{ type: Input }],
1509
1516
  options: [{ type: Input }],
1510
- class: [{ type: Input }]
1517
+ class: [{ type: Input }],
1518
+ setMouseOn: [{ type: HostListener, args: ['mouseenter',] }],
1519
+ unsetMouseOn: [{ type: HostListener, args: ['mouseleave',] }]
1511
1520
  };
1512
1521
 
1513
1522
  class DrTooltipDirective {
@@ -1518,6 +1527,8 @@ class DrTooltipDirective {
1518
1527
  this.contentContext = {};
1519
1528
  this.position = 'top';
1520
1529
  this.class = '';
1530
+ // is used for preserve tooltip from being hidden for N milliseconds
1531
+ this.drTooltipMousleaveTimeout = 0;
1521
1532
  }
1522
1533
  set drTooltipOptions(options) {
1523
1534
  if (options === null || options === void 0 ? void 0 : options.indent) {
@@ -1550,16 +1561,36 @@ class DrTooltipDirective {
1550
1561
  if (this.overlayRef) {
1551
1562
  this.overlayRef.dispose();
1552
1563
  }
1564
+ if (this.tooltipMouseOnSubscription) {
1565
+ this.tooltipMouseOnSubscription.unsubscribe();
1566
+ }
1553
1567
  }
1554
1568
  show() {
1555
- if (this.manualHandling)
1569
+ if (this.manualHandling || this.overlayRef)
1556
1570
  return;
1557
1571
  this.renderTooltip();
1558
1572
  }
1559
1573
  hide() {
1560
- if (this.manualHandling)
1574
+ var _a;
1575
+ if (this.manualHandling || !this.tooltipRef || ((_a = this.tooltipRef) === null || _a === void 0 ? void 0 : _a.instance.isMouseOn$.getValue()))
1561
1576
  return;
1562
- this.destroyTooltip();
1577
+ // if this timeout value is set - then preserve
1578
+ // tooltip from being hidden N milliseconds and not hiding it
1579
+ // in case mouse is pointed on tooltip
1580
+ if (this.drTooltipMousleaveTimeout) {
1581
+ if (this.mouseleaveTimer) {
1582
+ clearTimeout(this.mouseleaveTimer);
1583
+ }
1584
+ this.mouseleaveTimer = setTimeout(() => {
1585
+ var _a;
1586
+ if (this.tooltipRef && !((_a = this.tooltipRef) === null || _a === void 0 ? void 0 : _a.instance.isMouseOn$.getValue())) {
1587
+ this.destroyTooltip();
1588
+ }
1589
+ }, this.drTooltipMousleaveTimeout);
1590
+ }
1591
+ else {
1592
+ this.destroyTooltip();
1593
+ }
1563
1594
  }
1564
1595
  createOverlay() {
1565
1596
  const positionStrategy = this.overlayPositionBuilder
@@ -1571,12 +1602,17 @@ class DrTooltipDirective {
1571
1602
  var _a;
1572
1603
  this.createOverlay();
1573
1604
  if (!((_a = this.overlayRef) === null || _a === void 0 ? void 0 : _a.hasAttached()) && this.content) {
1574
- const tooltipRef = this.overlayRef.attach(new ComponentPortal(TooltipComponent));
1575
- tooltipRef.instance.content = this.content;
1576
- tooltipRef.instance.contentContext = this.contentContext;
1577
- tooltipRef.instance.position = this.position;
1578
- tooltipRef.instance.options = this.options;
1579
- tooltipRef.instance.class = this.class + ' ' + this.position;
1605
+ this.tooltipRef = this.overlayRef.attach(new ComponentPortal(TooltipComponent));
1606
+ this.tooltipRef.instance.content = this.content;
1607
+ this.tooltipRef.instance.contentContext = this.contentContext;
1608
+ this.tooltipRef.instance.position = this.position;
1609
+ this.tooltipRef.instance.options = this.options;
1610
+ this.tooltipRef.instance.class = this.class + ' ' + this.position;
1611
+ this.tooltipMouseOnSubscription = this.tooltipRef.instance.isMouseOn$.pipe(skip(1)).subscribe((isMouseOn) => {
1612
+ if (!isMouseOn) {
1613
+ this.destroyTooltip();
1614
+ }
1615
+ });
1580
1616
  }
1581
1617
  }
1582
1618
  destroyTooltip() {
@@ -1584,6 +1620,10 @@ class DrTooltipDirective {
1584
1620
  this.overlayRef.dispose();
1585
1621
  }
1586
1622
  this.overlayRef = null;
1623
+ this.tooltipRef = null;
1624
+ if (this.tooltipMouseOnSubscription) {
1625
+ this.tooltipMouseOnSubscription.unsubscribe();
1626
+ }
1587
1627
  }
1588
1628
  }
1589
1629
  DrTooltipDirective.decorators = [
@@ -1601,6 +1641,7 @@ DrTooltipDirective.propDecorators = {
1601
1641
  contentContext: [{ type: Input, args: ['drTooltipContext',] }],
1602
1642
  position: [{ type: Input, args: ['drTooltipPosition',] }],
1603
1643
  class: [{ type: Input, args: ['drTooltipClass',] }],
1644
+ drTooltipMousleaveTimeout: [{ type: Input }],
1604
1645
  drTooltipOptions: [{ type: Input }],
1605
1646
  showTooltip: [{ type: Input, args: ['drTooltipShow',] }],
1606
1647
  show: [{ type: HostListener, args: ['mouseenter',] }],
@@ -1880,521 +1921,106 @@ DrButtonComponent.propDecorators = {
1880
1921
  <dr-button [isDisabled]="false" [theme]="'text-link'">Text Link</dr-button>
1881
1922
  */
1882
1923
 
1883
- const MAT_DEFAULT_DATE_FORMAT = 'MM/DD/yyyy';
1884
- const DATE_INPUT_FORMAT = 'YYYY/MM/DD';
1885
- const YEAR_FORMAT = 'yyyy';
1886
- const MONTH_YEAR_FORMAT = 'MM/yyyy';
1887
- const QUARTER_FORMAT = 'Q/yyyy';
1888
- class CustomDateFormat {
1889
- constructor() {
1890
- this._parse = {
1891
- dateInput: DATE_INPUT_FORMAT
1892
- };
1893
- this._display = {
1894
- dateInput: DATE_INPUT_FORMAT,
1895
- monthYearLabel: 'MMM YYYY',
1896
- dateA11yLabel: 'LL',
1897
- monthYearA11yLabel: 'MMM YYYY',
1898
- quarterYearLabel: 'Q/YYYY',
1899
- yearLabel: 'YYYY'
1900
- };
1901
- }
1902
- set parse(parse) {
1903
- this._parse = Object.assign({}, this._parse, parse);
1904
- }
1905
- get parse() {
1906
- return this._parse;
1907
- }
1908
- set display(display) {
1909
- this._display = Object.assign({}, this._display, display);
1910
- }
1911
- get display() {
1912
- return this._display;
1924
+ class DrPopoverRef {
1925
+ constructor(overlayRef) {
1926
+ this.overlayRef = overlayRef;
1927
+ this.onClose$ = new Subject();
1928
+ // FIXME: this decision was made because of the incompatible rxjs version
1929
+ /**
1930
+ * Correct type is @type {Observable<any>}
1931
+ */
1932
+ this.onClose = this.onClose$.asObservable();
1933
+ this.onBackdropClick = this.overlayRef.backdropClick();
1913
1934
  }
1914
- updateDateFormat(parse, display) {
1915
- this.parse = parse;
1916
- if (!display) {
1917
- display = parse;
1918
- }
1919
- this.display = display;
1935
+ close(res) {
1936
+ this.overlayRef.detach();
1937
+ this.overlayRef.dispose();
1938
+ this.onClose$.next(res);
1939
+ this.onClose$.complete();
1920
1940
  }
1921
1941
  }
1922
1942
 
1923
- const moment$2 = require('moment');
1924
- class DrDatePickerService {
1925
- constructor() {
1926
- this.timeframe = 'day';
1927
- this.format = new BehaviorSubject(MAT_DEFAULT_DATE_FORMAT);
1928
- this.updatedQuater = new Subject();
1929
- }
1930
- getQuarterDisplay(value, format) {
1931
- return 'Q' + moment$2(value).quarter() + format.charAt(1) + moment$2(value).year();
1932
- }
1933
- setTimeframe(format) {
1934
- const lowerCaseFormat = format.toLowerCase();
1935
- switch (true) {
1936
- case lowerCaseFormat.includes('q'):
1937
- this.timeframe = 'quarter';
1938
- break;
1939
- case lowerCaseFormat.includes('d'):
1940
- this.timeframe = 'day';
1941
- break;
1942
- case lowerCaseFormat.includes('m'):
1943
- this.timeframe = 'month';
1944
- break;
1945
- case lowerCaseFormat.includes('y'):
1946
- this.timeframe = 'year';
1947
- break;
1948
- default:
1949
- this.timeframe = 'day';
1950
- }
1943
+ var DrPopoverAlignmentDimension;
1944
+ (function (DrPopoverAlignmentDimension) {
1945
+ DrPopoverAlignmentDimension["Width"] = "width";
1946
+ DrPopoverAlignmentDimension["Height"] = "height";
1947
+ })(DrPopoverAlignmentDimension || (DrPopoverAlignmentDimension = {}));
1948
+ const DEFAULT_CONFIG = {
1949
+ hasBackdrop: false,
1950
+ closeOnBackdropClick: false,
1951
+ backdropClass: 'dr-popover-transparent-backdrop',
1952
+ };
1953
+ const DEFAULT_MODEL = {
1954
+ position: 'bottom',
1955
+ class: '',
1956
+ overlayConfig: {},
1957
+ manualClosing: { enabled: false },
1958
+ };
1959
+ function getAlignmentDimension(position) {
1960
+ if (!POPUP_POSITIONS[position])
1961
+ return DrPopoverAlignmentDimension.Width;
1962
+ if ((position === null || position === void 0 ? void 0 : position.includes('left')) || (position === null || position === void 0 ? void 0 : position.includes('right'))) {
1963
+ return DrPopoverAlignmentDimension.Height;
1951
1964
  }
1965
+ return DrPopoverAlignmentDimension.Width;
1952
1966
  }
1953
- DrDatePickerService.ɵprov = i0.ɵɵdefineInjectable({ factory: function DrDatePickerService_Factory() { return new DrDatePickerService(); }, token: DrDatePickerService, providedIn: "root" });
1954
- DrDatePickerService.decorators = [
1955
- { type: Injectable, args: [{
1956
- providedIn: 'root',
1957
- },] }
1958
- ];
1959
1967
 
1960
- const moment$1 = require('moment');
1961
- class DrDatePickerCustomHeaderComponent {
1962
- constructor(_calendar, _dateAdapter, _dateFormats, cdr, datePickerService) {
1963
- this._calendar = _calendar;
1964
- this._dateAdapter = _dateAdapter;
1965
- this._dateFormats = _dateFormats;
1968
+ class DrPopoverComponent {
1969
+ constructor(cdr, componentFactoryResolver, viewContainerRef, elementRef, popoverRef) {
1966
1970
  this.cdr = cdr;
1967
- this.datePickerService = datePickerService;
1968
- this._destroyed = new Subject();
1969
- this.quarters = [1, 2, 3, 4];
1970
- this.selectedQuarter = 1;
1971
- this.timeframeOptions = [{
1972
- title: 'Day',
1973
- value: 'month',
1974
- format: MAT_DEFAULT_DATE_FORMAT,
1975
- periodLabel: () => this._dateAdapter
1976
- .format(this._calendar.activeDate, this._dateFormats.display.monthYearLabel)
1977
- .toLocaleUpperCase()
1978
- }, {
1979
- title: 'Month',
1980
- value: 'year',
1981
- format: MONTH_YEAR_FORMAT,
1982
- periodLabel: () => String(moment$1(this._calendar.activeDate).year())
1983
- }, {
1984
- title: 'Quarter',
1985
- value: 'none',
1986
- format: QUARTER_FORMAT,
1987
- periodLabel: () => String(moment$1(this._calendar.activeDate).year())
1988
- }, {
1989
- title: 'Year',
1990
- value: 'multi-year',
1991
- format: YEAR_FORMAT,
1992
- periodLabel: () => {
1993
- const currentYear = moment$1(this._calendar.activeDate).year();
1994
- const startPeriod = Math.floor(currentYear / 24) * 24;
1995
- return startPeriod + '-' + (startPeriod + 23);
1996
- }
1997
- }];
1998
- this.pagingSetup = {
1999
- 'year': (forward) => this.pagingDateChange('addCalendarYears', 1, forward),
2000
- 'none': (forward) => this.pagingDateChange('addCalendarYears', 1, forward),
2001
- 'month': (forward) => this.pagingDateChange('addCalendarMonths', 1, forward),
2002
- 'multi-year': (forward) => this.pagingDateChange('addCalendarYears', 24, forward)
2003
- };
2004
- this.selectedTimeframe = 'month';
2005
- this.timeframeSelection = false;
2006
- this.periodMonthLabel = '';
2007
- this.periodYearLabel = '';
2008
- _calendar.stateChanges.pipe(takeUntil(this._destroyed)).subscribe(() => this.setPeriodLabels());
2009
- this.datePickerService.format
2010
- .pipe(take(1))
2011
- .subscribe(value => {
2012
- this.selectedTimeframe = this.timeframeOptions.filter(option => option.format == value)[0].value;
2013
- this.setPeriodLabels();
2014
- });
2015
- _calendar.viewChanged.pipe(takeUntil(this._destroyed)).subscribe(() => this.setPeriodLabels());
2016
- }
2017
- ngOnDestroy() {
2018
- this._destroyed.next();
2019
- this._destroyed.complete();
1971
+ this.componentFactoryResolver = componentFactoryResolver;
1972
+ this.viewContainerRef = viewContainerRef;
1973
+ this.elementRef = elementRef;
1974
+ this.popoverRef = popoverRef;
1975
+ this.class = '';
1976
+ this.isContentTemplate = false;
1977
+ this.popover = true;
2020
1978
  }
2021
- setPeriodLabels() {
2022
- const currentTimeframeOption = this.timeframeOptions.filter(option => option.value === this._calendar.currentView)[0];
2023
- const fullPeriodLabel = currentTimeframeOption.periodLabel();
2024
- if (this._calendar.currentView === 'month') {
2025
- this.periodMonthLabel = fullPeriodLabel.slice(0, 3);
2026
- this.periodYearLabel = fullPeriodLabel.slice(4);
2027
- }
2028
- else {
2029
- this.periodMonthLabel = '';
2030
- this.periodYearLabel = fullPeriodLabel;
1979
+ clickOutside(e) {
1980
+ const isTargetHost = this.hostRef instanceof ElementRef && (this.hostRef.nativeElement === e.target || this.hostRef.nativeElement.contains(e.target));
1981
+ const isTargetInPopover = this.elementRef.nativeElement.contains(e.target);
1982
+ const isTargetInDatepicker = e.target.closest('mat-datepicker-popup');
1983
+ const isTargetInSelect = e.target.closest('ng-dropdown-panel');
1984
+ const isTargetInDatepickerContent = e.target.closest('mat-datepicker-content');
1985
+ if (!isTargetHost
1986
+ && !isTargetInPopover
1987
+ && !isTargetInDatepicker
1988
+ && !isTargetInSelect
1989
+ && !isTargetInDatepickerContent
1990
+ && !this.manualClosing.enabled) {
1991
+ this.popoverRef.close();
2031
1992
  }
2032
- this.cdr.markForCheck();
2033
1993
  }
2034
- setTimeframe() {
2035
- this.timeframeSelection = false;
2036
- this._calendar.currentView = this.selectedTimeframe;
2037
- const chosenTimeframeOption = this.timeframeOptions.filter(option => option.value === this.selectedTimeframe)[0];
2038
- this.datePickerService.format.next(chosenTimeframeOption.format);
2039
- this.datePickerService.setTimeframe(chosenTimeframeOption.format);
2040
- if (this.selectedTimeframe == 'none') {
2041
- this.selectedQuarter = moment$1(this._calendar.activeDate).quarter();
1994
+ ngOnInit() {
1995
+ this.isContentTemplate = this.content instanceof TemplateRef;
1996
+ if (!this.isContentTemplate) {
1997
+ this.componentRef = this.viewContainerRef.createComponent(this.componentFactoryResolver.resolveComponentFactory(this.content));
1998
+ Object.assign(this.componentRef.instance, this.contentContext);
1999
+ this.popoverContainer.nativeElement.appendChild(this.componentRef.location.nativeElement);
2042
2000
  }
2043
- }
2044
- get currentViewIsQuater() {
2045
- return !['month', 'year', 'multi-year'].includes(this._calendar.currentView);
2046
- }
2047
- switchViewOnClickOnPeriodLabel(view) {
2048
- this._calendar.currentView = view;
2049
- }
2050
- onSelectQuater(quarterNumber) {
2051
- const monthsInQuarter = 3;
2052
- this.selectedQuarter = moment$1(this._calendar.activeDate).quarter();
2053
- const unadaptedDate = this._dateAdapter.addCalendarMonths(this._calendar.activeDate, monthsInQuarter * (quarterNumber - this.selectedQuarter));
2054
- this._calendar.activeDate = unadaptedDate;
2055
- this.datePickerService.updatedQuater.next(moment$1(unadaptedDate));
2056
- this.datePickerService.calendarInstance.close();
2057
- }
2058
- pagingClicked(forward) {
2059
- this.pagingSetup[this._calendar.currentView] && this.pagingSetup[this._calendar.currentView](forward);
2060
- }
2061
- pagingDateChange(actionCall, amount, forward) {
2062
- this._calendar.activeDate = this._dateAdapter[actionCall](this._calendar.activeDate, forward ? amount : -amount);
2063
- this.setPeriodLabels();
2001
+ if (this.alignment === 'host') {
2002
+ this[getAlignmentDimension(this.position)] = '100%';
2003
+ }
2004
+ this.cdr.detectChanges();
2064
2005
  }
2065
2006
  }
2066
- DrDatePickerCustomHeaderComponent.decorators = [
2007
+ DrPopoverComponent.decorators = [
2067
2008
  { type: Component, args: [{
2068
- selector: 'dr-date-picker_custom-header.component',
2069
- template: "<div class=\"dr-datepicker__timeframe-select__wrapper\">\n <dr-select \n class=\"dr-datepicker__timeframe-select\"\n [(ngModel)]=\"selectedTimeframe\"\n [items]=\"timeframeOptions\"\n bindLabel=\"title\"\n bindValue=\"value\"\n (ngModelChange)=\"setTimeframe()\">\n </dr-select>\n</div>\n\n<div class=\"dr-date-paging\">\n <div class=\"dr-date-paging flip-page-button\"\n (click)=\"pagingClicked(false)\">\n <i class=\"dr-icon-arrow-left presentation_buttons-navigate_input\"></i> \n </div>\n <span class=\"example-header-label\">\n <span (click)=\"switchViewOnClickOnPeriodLabel('year')\">{{periodMonthLabel + ' '}}</span> \n <span (click)=\"switchViewOnClickOnPeriodLabel('multi-year')\">{{periodYearLabel}}</span>\n </span>\n <div class=\"dr-date-paging flip-page-button\"\n (click)=\"pagingClicked(true)\">\n <i class=\"dr-icon-arrow-right presentation_buttons-navigate_input\"></i>\n </div>\n</div>\n<div #quarterlyDatePicker class=\"dr-quarterly-datepicker\" *ngIf=\"currentViewIsQuater\">\n <div *ngFor=\"let quarter of quarters\" \n class=\"quarter-selector\" (click)=\"onSelectQuater(quarter)\"\n [class]=\"quarter == selectedQuarter ? 'selected' : ''\"\n >Q{{quarter}}</div>\n</div>\n\n",
2009
+ selector: 'dr-popover',
2010
+ template: "<div class=\"dr-popover\" [class]=\"class\" #popoverContainer>\n <ng-container *ngIf=\"isContentTemplate\">\n <ng-container *ngTemplateOutlet=\"content; context: contentContext\"></ng-container>\n </ng-container>\n</div>\n",
2011
+ animations: [
2012
+ trigger('popover', POPUP_ANIMATION),
2013
+ ],
2070
2014
  changeDetection: ChangeDetectionStrategy.OnPush,
2071
- styles: [":host{height:54px;align-items:center;font-family:\"Poppins\";font-style:normal;font-weight:600;font-size:14px;line-height:22px}.dr-datepicker__timeframe-select__wrapper{background-color:#f9faff;padding:16px 32px;border-radius:18px 18px 0 0}.dr-date-paging{display:flex;flex-direction:row;justify-content:space-between;align-items:center;padding:16px 8px;grid-gap:4px;gap:4px}.dr-date-paging.flip-page-button{width:20px;height:20px;padding:0;color:#4e566c}.dr-date-paging.flip-page-button:hover{border-radius:50%;background:#F2F2FB;color:#4646ce}.example-header-label{cursor:pointer}.dr-quarterly-datepicker{display:flex;justify-content:space-between;padding:10px}.dr-quarterly-datepicker .quarter-selector{display:block;width:74px;height:40px;text-align:center;border-radius:40px;font-weight:400;padding-top:9px}.dr-quarterly-datepicker .quarter-selector:hover{background:#F2F2FB;color:#4646ce;font-weight:600;cursor:pointer}.dr-quarterly-datepicker .quarter-selector.selected{background-color:#4646ce;color:#f3f7ff;font-weight:600}\n"]
2015
+ styles: [".dr-popover{display:flex;background:#fff;border:1px solid #E5E5E5;border-radius:5px;box-sizing:border-box;box-shadow:0 4px 14px #0003;font-size:12px;color:#545a6b;max-height:100vh;max-width:100vw;overflow:auto}::ng-deep .dr-popover-transparent-backdrop{background-color:transparent}\n"]
2072
2016
  },] }
2073
2017
  ];
2074
- DrDatePickerCustomHeaderComponent.ctorParameters = () => [
2075
- { type: MatCalendar },
2076
- { type: DateAdapter },
2077
- { type: CustomDateFormat, decorators: [{ type: Inject, args: [MAT_DATE_FORMATS,] }] },
2018
+ DrPopoverComponent.ctorParameters = () => [
2078
2019
  { type: ChangeDetectorRef },
2079
- { type: DrDatePickerService }
2080
- ];
2081
-
2082
- const moment = require('moment');
2083
- const noop = () => { };
2084
- const ɵ0$1 = noop;
2085
- class DrDatePickerComponent {
2086
- constructor(cdr, _dateAdapter, datePickerService) {
2087
- this.cdr = cdr;
2088
- this._dateAdapter = _dateAdapter;
2089
- this.datePickerService = datePickerService;
2090
- this._destroyed = new Subject();
2091
- this.readonly = true;
2092
- this._format = MAT_DEFAULT_DATE_FORMAT;
2093
- this.customHeader = DrDatePickerCustomHeaderComponent;
2094
- this.onChangeFormat = new EventEmitter();
2095
- this.timeframeSelection = false;
2096
- this.takeEndOfPeriod = false;
2097
- this.placeholder = 'Select';
2098
- this.min = null;
2099
- this.max = null;
2100
- this.calendarViewSetup = {
2101
- 'year': (calendar) => calendar.currentView = 'multi-year',
2102
- 'month': (calendar) => calendar.currentView = 'year',
2103
- 'quarter': (calendar) => calendar.currentView = 'none',
2104
- 'day': (calendar) => calendar.currentView = 'month'
2105
- };
2106
- this.pagingSetup = {
2107
- 'year': (forward) => this.pagingDateChange('addCalendarYears', 1, forward),
2108
- 'quarter': (forward) => this.pagingDateChange('addCalendarMonths', 3, forward),
2109
- 'month': (forward) => this.pagingDateChange('addCalendarMonths', 1, forward),
2110
- 'day': (forward) => this.pagingDateChange('addCalendarDays', 1, forward)
2111
- };
2112
- this.innerValue = null;
2113
- this.onTouchedCallback = noop;
2114
- this.onChangeCallback = noop;
2115
- datePickerService.format
2116
- .pipe(takeUntil(this._destroyed))
2117
- .subscribe((value) => {
2118
- this._format = value;
2119
- this.onChangeFormat.emit(this.normalizeValue(value));
2120
- cdr.markForCheck();
2121
- });
2122
- datePickerService.updatedQuater
2123
- .pipe(takeUntil(this._destroyed))
2124
- .subscribe((value) => {
2125
- this.tryToNormalaizeTimeframe(value, 'quarter');
2126
- this.writeValue(value);
2127
- this.onChangeCallback(value);
2128
- });
2129
- }
2130
- set format(value) {
2131
- if (value) {
2132
- value = this.normalizeValue(value);
2133
- this._format = value;
2134
- this.datePickerService.format.next(value);
2135
- this.datePickerService.setTimeframe(value);
2136
- this.cdr.markForCheck();
2137
- }
2138
- }
2139
- ngAfterViewInit() {
2140
- this.datePickerService.calendarInstance = this.dp;
2141
- if (this._format === MAT_DEFAULT_DATE_FORMAT) {
2142
- return;
2143
- }
2144
- setTimeout(() => {
2145
- const popupInstance = this.dp._popupComponentRef.instance;
2146
- const calenderInstance = popupInstance._calendar._calendarHeaderPortal._attachedHost._attachedRef.instance;
2147
- calenderInstance.currentPeriodClicked = function () {
2148
- this.calendarViewSetup[this.datePickerService.timeframe] && this.calendarViewSetup[this.datePickerService.timeframe](this.calendar);
2149
- };
2150
- }, 1000);
2151
- }
2152
- tryToNormalaizeTimeframe(normalizedRef, timeframe) {
2153
- if (this.takeEndOfPeriod) {
2154
- normalizedRef.endOf(timeframe);
2155
- }
2156
- normalizedRef.set('hour', 12);
2157
- }
2158
- get value() {
2159
- return this.innerValue;
2160
- }
2161
- set value(v) {
2162
- if (v !== this.innerValue) {
2163
- this.innerValue = v;
2164
- this.onChangeCallback(v);
2165
- }
2166
- this.cdr.markForCheck();
2167
- }
2168
- registerOnChange(fn) {
2169
- this.onChangeCallback = fn;
2170
- }
2171
- registerOnTouched(fn) {
2172
- this.onTouchedCallback = fn;
2173
- }
2174
- writeValue(value) {
2175
- if (value !== this.innerValue) {
2176
- if (value && typeof value === 'number') {
2177
- this.innerValue = moment.unix(value);
2178
- }
2179
- else {
2180
- this.innerValue = value;
2181
- }
2182
- this.tryToNormalaizeTimeframe(this.innerValue, this.datePickerService.timeframe);
2183
- this.cdr.markForCheck();
2184
- }
2185
- }
2186
- get quarterDisplay() {
2187
- return this.datePickerService.getQuarterDisplay(this.value, this._format);
2188
- }
2189
- normalizeValue(value) {
2190
- if (value.includes('d')) {
2191
- value = value.replace(/d/g, 'D');
2192
- }
2193
- else if (value.includes('D')) {
2194
- value = value.replace(/D/g, 'd');
2195
- }
2196
- return value;
2197
- }
2198
- chosenMonthHandler(normalizedMonth, datepicker) {
2199
- if (this.datePickerService.timeframe === 'month') {
2200
- this.tryToNormalaizeTimeframe(normalizedMonth, 'month');
2201
- this.writeValue(normalizedMonth);
2202
- this.onChangeCallback(normalizedMonth);
2203
- datepicker.close();
2204
- }
2205
- }
2206
- chosenYearHandler(normalizedYear, datepicker) {
2207
- if (this.datePickerService.timeframe === 'year') {
2208
- this.tryToNormalaizeTimeframe(normalizedYear, 'year');
2209
- this.writeValue(normalizedYear);
2210
- this.onChangeCallback(normalizedYear);
2211
- datepicker.close();
2212
- }
2213
- }
2214
- pagingClicked(forward) {
2215
- this.pagingSetup[this.datePickerService.timeframe] && this.pagingSetup[this.datePickerService.timeframe](forward);
2216
- this.datePickerService.calendarInstance.close();
2217
- }
2218
- pagingDateChange(actionCall, amount, forward) {
2219
- const newValue = this._dateAdapter[actionCall](this.innerValue, forward ? amount : -amount);
2220
- this.writeValue(newValue);
2221
- this.onChangeCallback(newValue);
2222
- }
2223
- ngOnDestroy() {
2224
- this._destroyed.next();
2225
- this._destroyed.complete();
2226
- }
2227
- }
2228
- DrDatePickerComponent.decorators = [
2229
- { type: Component, args: [{
2230
- selector: 'dr-date-picker',
2231
- template: "<div class=\"dr-datepicker__with-timeframe-selection\"\n *ngIf=\"timeframeSelection;else noTimeframeSelection\">\n <div class=\"dr-input-date-paging__flip-page-button\"\n (click)=\"pagingClicked(false)\"\n >\n <i class=\"dr-icon-arrow-left presentation_buttons-navigate_input\"></i> \n </div>\n <div class=\"dr-input-date-paging__quarter-display\"\n *ngIf=\"_format.includes('Q')\"\n (click)=\"datePicker.open()\"\n >{{quarterDisplay}}</div>\n <input [(ngModel)]=\"value\"\n (click)=\"datePicker.open()\"\n [matDatepicker]=\"datePicker\"\n [placeholder]=\"placeholder\"\n [drDatePickerFormat]=\"_format\"\n [readonly]=\"readonly\"\n [class]=\"_format.includes('Q') ? 'when-quarter' : ''\"\n [min]=\"min\"\n [max]=\"max\"/>\n <div class=\"dr-input-date-paging__flip-page-button\"\n (click)=\"pagingClicked(true)\">\n <i class=\"dr-icon-arrow-right presentation_buttons-navigate_input\"></i>\n </div>\n <mat-datepicker #datePicker\n class=\"dr-timeframe-datepicker\"\n [calendarHeaderComponent]=\"customHeader\"\n (yearSelected)=\"chosenYearHandler($event, datePicker)\"\n (monthSelected)=\"chosenMonthHandler($event, datePicker)\">\n </mat-datepicker>\n</div>\n\n<ng-template class=\"dr-datepicker__no-timeframe-selection\"\n #noTimeframeSelection>\n <i class=\"dr-icon-schedule\"></i>\n <input [(ngModel)]=\"value\"\n (click)=\"datePicker.open()\"\n [matDatepicker]=\"datePicker\"\n [placeholder]=\"placeholder\"\n [drDatePickerFormat]=\"_format\"\n [readonly]=\"readonly\"\n [min]=\"min\"\n [max]=\"max\"/>\n <mat-datepicker #datePicker\n (yearSelected)=\"chosenYearHandler($event, datePicker)\"\n (monthSelected)=\"chosenMonthHandler($event, datePicker)\">\n </mat-datepicker>\n</ng-template>\n\n",
2232
- changeDetection: ChangeDetectionStrategy.OnPush,
2233
- providers: [
2234
- { provide: NG_VALUE_ACCESSOR, useExisting: DrDatePickerComponent, multi: true }
2235
- ],
2236
- styles: [":host{position:relative;width:100%;display:flex;flex-direction:row;min-height:32px;height:32px;font-size:14px;font-family:\"Poppins\",sans-serif;background-color:#fff;border:1px solid #C3C4CE;border-radius:6px;color:#85889c;overflow:hidden;outline:none;cursor:pointer}:host.period-datepicker{border:none}:host:hover{border-color:#85889c}:host:focus-within{border-color:#21b8f1!important;color:#151b3f}:host.disabled{pointer-events:none;border:none;color:#85889c;background:#E5E6EA}:host.ng-valid.ng-dirty{border-color:#03a678}:host.ng-invalid.ng-dirty:not(:focus-within){border-color:#de2833!important}:host.ng-untouched.ng-valid{border-color:#c3c4ce}:host:after,:host:before{position:absolute;display:flex;border-color:#999999 transparent transparent;color:#999}:host:after{content:\"\";height:0;width:0;border-style:solid;border-width:5px 5px 2.5px;right:11px;top:13px}:host i{position:absolute;color:#999;left:8px;top:3px}:host input{display:flex;flex-grow:1;height:100%;border:none;text-align:left;padding-left:35px;padding-right:25px;cursor:pointer!important;outline:none}:host input.when-quarter{position:absolute;visibility:hidden}:host input:disabled{border:none;color:#85889c;background:transparent}:host input::-webkit-search-decoration,:host input::-webkit-search-cancel-button,:host input::-webkit-search-results-button,:host input::-webkit-search-results-decoration{-webkit-appearance:none}:host .dr-datepicker__with-timeframe-selection{display:flex;align-items:center}:host .dr-datepicker__with-timeframe-selection .dr-input-date-paging__flip-page-button{width:25px;height:25px;border-radius:16px;padding:0;background-color:#fff}:host .dr-datepicker__with-timeframe-selection .dr-input-date-paging__flip-page-button i{position:relative;color:#0c142b;top:unset;left:unset}:host .dr-datepicker__with-timeframe-selection .dr-input-date-paging__flip-page-button:hover{background-color:#f2f2fb;color:#4646ce}:host .dr-datepicker__with-timeframe-selection input{width:90px;padding:0;border-radius:5px;text-decoration:underline;text-align:center}:host .dr-datepicker__with-timeframe-selection input:hover{background-color:#f2f2fb;color:#4646ce}:host .dr-input-date-paging__quarter-display{width:90px;height:22px;padding-left:0;text-align:center;line-height:22px;color:#0c142b;-webkit-text-decoration-line:underline;text-decoration-line:underline}:host .dr-input-date-paging__quarter-display:hover{background-color:#f2f2fb;border-radius:5px;cursor:pointer;-webkit-text-decoration-line:underline;text-decoration-line:underline;color:#4646ce}::ng-deep .mat-datepicker-content{margin:7px 0;box-shadow:0 4px 8px 1px #00000040;border-radius:12px!important}::ng-deep .mat-datepicker-content button[disabled]{border:inherit;color:inherit;background-color:inherit}::ng-deep .mat-datepicker-content button[disabled]:hover{border:inherit}::ng-deep .mat-calendar-body-cell:not(.mat-calendar-body-disabled):hover>.mat-calendar-body-cell-content:not(.mat-calendar-body-selected):not(.mat-calendar-body-comparison-identical){background:#F2F2FB;color:#4646ce;font-weight:600}::ng-deep .mat-calendar-body-selected{background-color:#4646ce;color:#f2f2fb;font-weight:600}::ng-deep .mat-calendar-body-today.mat-calendar-body-selected{box-shadow:none}::ng-deep .mat-button-focus-overlay{background:#F3F7FF}::ng-deep .mat-calendar-controls .mat-icon-button:hover .mat-button-focus-overlay{opacity:1!important;background:#F3F7FF;transition:opacity .2s cubic-bezier(.35,0,.25,1)}::ng-deep .mat-calendar-controls .mat-calendar-period-button:hover{background:#F3F7FF;transition:background .2s cubic-bezier(.35,0,.25,1)}::ng-deep .mat-calendar-table-header th{font-size:14px;font-weight:600;color:#19181a}::ng-deep .mat-calendar-table-header-divider{display:none}::ng-deep .mat-calendar-body-label{color:#fff;padding:0}\n"]
2237
- },] }
2238
- ];
2239
- DrDatePickerComponent.ctorParameters = () => [
2240
- { type: ChangeDetectorRef },
2241
- { type: DateAdapter },
2242
- { type: DrDatePickerService }
2243
- ];
2244
- DrDatePickerComponent.propDecorators = {
2245
- _format: [{ type: Input }],
2246
- onChangeFormat: [{ type: Output }],
2247
- format: [{ type: Input }],
2248
- timeframeSelection: [{ type: Input }],
2249
- takeEndOfPeriod: [{ type: Input }],
2250
- placeholder: [{ type: Input }],
2251
- min: [{ type: Input }],
2252
- max: [{ type: Input }],
2253
- dp: [{ type: ViewChild, args: ['datePicker',] }]
2254
- };
2255
-
2256
- class DrDatePickerFormatDirective {
2257
- constructor(matDateFormat, ngControl) {
2258
- this.matDateFormat = matDateFormat;
2259
- this.ngControl = ngControl;
2260
- }
2261
- set datePickerFormat(format) {
2262
- var _a;
2263
- if (this.configDateParse) {
2264
- this.matDateFormat.updateDateFormat(this.configDateParse, this.configDateDisplay);
2265
- }
2266
- else {
2267
- this.matDateFormat.updateDateFormat({ dateInput: format });
2268
- }
2269
- const value = this.ngControl.value;
2270
- (_a = this.ngControl.valueAccessor) === null || _a === void 0 ? void 0 : _a.writeValue(value);
2271
- }
2272
- }
2273
- DrDatePickerFormatDirective.decorators = [
2274
- { type: Directive, args: [{
2275
- selector: '[drDatePickerFormat]',
2276
- providers: [
2277
- {
2278
- provide: DateAdapter,
2279
- useClass: MomentDateAdapter
2280
- },
2281
- {
2282
- provide: MAT_DATE_FORMATS,
2283
- useClass: CustomDateFormat
2284
- }
2285
- ]
2286
- },] }
2287
- ];
2288
- DrDatePickerFormatDirective.ctorParameters = () => [
2289
- { type: CustomDateFormat, decorators: [{ type: Inject, args: [MAT_DATE_FORMATS,] }] },
2290
- { type: NgControl, decorators: [{ type: Optional }] }
2291
- ];
2292
- DrDatePickerFormatDirective.propDecorators = {
2293
- configDateParse: [{ type: Input }],
2294
- configDateDisplay: [{ type: Input }],
2295
- datePickerFormat: [{ type: Input, args: ['drDatePickerFormat',] }]
2296
- };
2297
-
2298
- class DrPopoverRef {
2299
- constructor(overlayRef) {
2300
- this.overlayRef = overlayRef;
2301
- this.onClose$ = new Subject();
2302
- // FIXME: this decision was made because of the incompatible rxjs version
2303
- /**
2304
- * Correct type is @type {Observable<any>}
2305
- */
2306
- this.onClose = this.onClose$.asObservable();
2307
- this.onBackdropClick = this.overlayRef.backdropClick();
2308
- }
2309
- close(res) {
2310
- this.overlayRef.detach();
2311
- this.overlayRef.dispose();
2312
- this.onClose$.next(res);
2313
- this.onClose$.complete();
2314
- }
2315
- }
2316
-
2317
- var DrPopoverAlignmentDimension;
2318
- (function (DrPopoverAlignmentDimension) {
2319
- DrPopoverAlignmentDimension["Width"] = "width";
2320
- DrPopoverAlignmentDimension["Height"] = "height";
2321
- })(DrPopoverAlignmentDimension || (DrPopoverAlignmentDimension = {}));
2322
- const DEFAULT_CONFIG = {
2323
- hasBackdrop: false,
2324
- closeOnBackdropClick: false,
2325
- backdropClass: 'dr-popover-transparent-backdrop',
2326
- };
2327
- const DEFAULT_MODEL = {
2328
- position: 'bottom',
2329
- class: '',
2330
- overlayConfig: {},
2331
- manualClosing: { enabled: false },
2332
- };
2333
- function getAlignmentDimension(position) {
2334
- if (!POPUP_POSITIONS[position])
2335
- return DrPopoverAlignmentDimension.Width;
2336
- if ((position === null || position === void 0 ? void 0 : position.includes('left')) || (position === null || position === void 0 ? void 0 : position.includes('right'))) {
2337
- return DrPopoverAlignmentDimension.Height;
2338
- }
2339
- return DrPopoverAlignmentDimension.Width;
2340
- }
2341
-
2342
- class DrPopoverComponent {
2343
- constructor(cdr, componentFactoryResolver, viewContainerRef, elementRef, popoverRef) {
2344
- this.cdr = cdr;
2345
- this.componentFactoryResolver = componentFactoryResolver;
2346
- this.viewContainerRef = viewContainerRef;
2347
- this.elementRef = elementRef;
2348
- this.popoverRef = popoverRef;
2349
- this.class = '';
2350
- this.isContentTemplate = false;
2351
- this.popover = true;
2352
- }
2353
- clickOutside(e) {
2354
- const isTargetHost = this.hostRef instanceof ElementRef && (this.hostRef.nativeElement === e.target || this.hostRef.nativeElement.contains(e.target));
2355
- const isTargetInPopover = this.elementRef.nativeElement.contains(e.target);
2356
- const isTargetInDatepicker = e.target.closest('mat-datepicker-popup');
2357
- const isTargetInSelect = e.target.closest('ng-dropdown-panel');
2358
- const isTargetInDatepickerContent = e.target.closest('mat-datepicker-content');
2359
- if (!isTargetHost
2360
- && !isTargetInPopover
2361
- && !isTargetInDatepicker
2362
- && !isTargetInSelect
2363
- && !isTargetInDatepickerContent
2364
- && !this.manualClosing.enabled) {
2365
- this.popoverRef.close();
2366
- }
2367
- }
2368
- ngOnInit() {
2369
- this.isContentTemplate = this.content instanceof TemplateRef;
2370
- if (!this.isContentTemplate) {
2371
- this.componentRef = this.viewContainerRef.createComponent(this.componentFactoryResolver.resolveComponentFactory(this.content));
2372
- Object.assign(this.componentRef.instance, this.contentContext);
2373
- this.popoverContainer.nativeElement.appendChild(this.componentRef.location.nativeElement);
2374
- }
2375
- if (this.alignment === 'host') {
2376
- this[getAlignmentDimension(this.position)] = '100%';
2377
- }
2378
- this.cdr.detectChanges();
2379
- }
2380
- }
2381
- DrPopoverComponent.decorators = [
2382
- { type: Component, args: [{
2383
- selector: 'dr-popover',
2384
- template: "<div class=\"dr-popover\" [class]=\"class\" #popoverContainer>\n <ng-container *ngIf=\"isContentTemplate\">\n <ng-container *ngTemplateOutlet=\"content; context: contentContext\"></ng-container>\n </ng-container>\n</div>\n",
2385
- animations: [
2386
- trigger('popover', POPUP_ANIMATION),
2387
- ],
2388
- changeDetection: ChangeDetectionStrategy.OnPush,
2389
- styles: [".dr-popover{display:flex;background:#fff;border:1px solid #E5E5E5;border-radius:5px;box-sizing:border-box;box-shadow:0 4px 14px #0003;font-size:12px;color:#545a6b;max-height:100vh;max-width:100vw;overflow:auto}::ng-deep .dr-popover-transparent-backdrop{background-color:transparent}\n"]
2390
- },] }
2391
- ];
2392
- DrPopoverComponent.ctorParameters = () => [
2393
- { type: ChangeDetectorRef },
2394
- { type: ComponentFactoryResolver },
2395
- { type: ViewContainerRef },
2396
- { type: ElementRef },
2397
- { type: DrPopoverRef }
2020
+ { type: ComponentFactoryResolver },
2021
+ { type: ViewContainerRef },
2022
+ { type: ElementRef },
2023
+ { type: DrPopoverRef }
2398
2024
  ];
2399
2025
  DrPopoverComponent.propDecorators = {
2400
2026
  content: [{ type: Input }],
@@ -3260,15 +2886,62 @@ DrModelDebounceChangeDirective.propDecorators = {
3260
2886
  ngModelDebounceChange: [{ type: Output }]
3261
2887
  };
3262
2888
 
3263
- const components$2 = [DateTagComponent,
3264
- DayTagComponent,
3265
- WeekTagComponent,
3266
- MonthTagComponent,
3267
- QuarterTagComponent,
3268
- AnyTagComponent,
3269
- YearTagComponent,
2889
+ const MAT_DEFAULT_DATE_FORMAT = 'MM/DD/yyyy';
2890
+ const DATE_INPUT_FORMAT = 'YYYY/MM/DD';
2891
+ const YEAR_FORMAT = 'yyyy';
2892
+ const MONTH_YEAR_FORMAT = 'MM/yyyy';
2893
+ const QUARTER_FORMAT = 'Q/yyyy';
2894
+ class CustomDateFormat {
2895
+ constructor() {
2896
+ this._parse = {
2897
+ dateInput: DATE_INPUT_FORMAT
2898
+ };
2899
+ this._display = {
2900
+ dateInput: DATE_INPUT_FORMAT,
2901
+ monthYearLabel: 'MMM YYYY',
2902
+ dateA11yLabel: 'LL',
2903
+ monthYearA11yLabel: 'MMM YYYY',
2904
+ quarterYearLabel: 'Q/YYYY',
2905
+ yearLabel: 'YYYY'
2906
+ };
2907
+ }
2908
+ set parse(parse) {
2909
+ this._parse = Object.assign({}, this._parse, parse);
2910
+ }
2911
+ get parse() {
2912
+ return this._parse;
2913
+ }
2914
+ set display(display) {
2915
+ this._display = Object.assign({}, this._display, display);
2916
+ }
2917
+ get display() {
2918
+ return this._display;
2919
+ }
2920
+ updateDateFormat(parse, display) {
2921
+ this.parse = parse;
2922
+ if (!display) {
2923
+ display = parse;
2924
+ }
2925
+ this.display = display;
2926
+ }
2927
+ }
2928
+ var DatePickerPeriodPosition;
2929
+ (function (DatePickerPeriodPosition) {
2930
+ DatePickerPeriodPosition[DatePickerPeriodPosition["END_OF_PERIOD"] = 0] = "END_OF_PERIOD";
2931
+ DatePickerPeriodPosition[DatePickerPeriodPosition["MIDDLE_OF_PERIOD"] = 1] = "MIDDLE_OF_PERIOD";
2932
+ DatePickerPeriodPosition[DatePickerPeriodPosition["START_OF_PERIOD"] = 2] = "START_OF_PERIOD";
2933
+ DatePickerPeriodPosition[DatePickerPeriodPosition["DEFAULT"] = 3] = "DEFAULT";
2934
+ })(DatePickerPeriodPosition || (DatePickerPeriodPosition = {}));
2935
+
2936
+ const components$2 = [DateTagComponent,
2937
+ DayTagComponent,
2938
+ WeekTagComponent,
2939
+ MonthTagComponent,
2940
+ QuarterTagComponent,
2941
+ AnyTagComponent,
2942
+ YearTagComponent,
3270
2943
  ForecastTagComponent];
3271
- const ɵ0 = { useUtc: true };
2944
+ const ɵ0$1 = { useUtc: true };
3272
2945
  class DateTagModule {
3273
2946
  }
3274
2947
  DateTagModule.decorators = [
@@ -3286,7 +2959,7 @@ DateTagModule.decorators = [
3286
2959
  ],
3287
2960
  exports: components$2,
3288
2961
  providers: [
3289
- { provide: MAT_MOMENT_DATE_ADAPTER_OPTIONS, useValue: ɵ0 }
2962
+ { provide: MAT_MOMENT_DATE_ADAPTER_OPTIONS, useValue: ɵ0$1 }
3290
2963
  ],
3291
2964
  declarations: components$2,
3292
2965
  },] }
@@ -3331,6 +3004,436 @@ DrTagModule.decorators = [
3331
3004
  },] }
3332
3005
  ];
3333
3006
 
3007
+ const moment$2 = require('moment');
3008
+ class DrDatePickerService {
3009
+ constructor() {
3010
+ this.isTimeframeSelectionEnabled = false;
3011
+ this.timeframe = 'day';
3012
+ this.format$ = new BehaviorSubject(MAT_DEFAULT_DATE_FORMAT);
3013
+ this.updatedQuarter$ = new Subject();
3014
+ this.formatConfig = {
3015
+ day: MAT_DEFAULT_DATE_FORMAT,
3016
+ month: MONTH_YEAR_FORMAT,
3017
+ year: YEAR_FORMAT,
3018
+ quarter: QUARTER_FORMAT,
3019
+ };
3020
+ }
3021
+ getQuarterDisplay(value) {
3022
+ return 'Q' + moment$2(value).quarter() + this.format$.getValue().charAt(1) + moment$2(value).year();
3023
+ }
3024
+ getTimeframe(format) {
3025
+ const defaultFrame = 'day';
3026
+ if (!format) {
3027
+ return defaultFrame;
3028
+ }
3029
+ const lowerCaseFormat = format.toLowerCase();
3030
+ switch (true) {
3031
+ case lowerCaseFormat.includes('q'):
3032
+ return 'quarter';
3033
+ case lowerCaseFormat.includes('d'):
3034
+ return 'day';
3035
+ case lowerCaseFormat.includes('m'):
3036
+ return 'month';
3037
+ case lowerCaseFormat.includes('y'):
3038
+ return 'year';
3039
+ default:
3040
+ return defaultFrame;
3041
+ }
3042
+ }
3043
+ getConfiguredFormat(timeframe) {
3044
+ return this.formatConfig[timeframe];
3045
+ }
3046
+ updateTimeframeAndFormat(format) {
3047
+ const normalizedFormat = this.normalizeValue(format || this.format$.getValue());
3048
+ this.timeframe = this.getTimeframe(normalizedFormat);
3049
+ this.format$.next(this.getConfiguredFormat(this.timeframe));
3050
+ }
3051
+ normalizeValue(value) {
3052
+ return value.replace(/d/g, 'D');
3053
+ }
3054
+ }
3055
+ DrDatePickerService.decorators = [
3056
+ { type: Injectable }
3057
+ ];
3058
+
3059
+ const moment$1 = require('moment');
3060
+ class DrDatePickerCustomHeaderComponent {
3061
+ constructor(_calendar, _dateAdapter, _dateFormats, cdr, datePickerService) {
3062
+ this._calendar = _calendar;
3063
+ this._dateAdapter = _dateAdapter;
3064
+ this._dateFormats = _dateFormats;
3065
+ this.cdr = cdr;
3066
+ this.datePickerService = datePickerService;
3067
+ this._destroyed = new Subject();
3068
+ this.quarters = [1, 2, 3, 4];
3069
+ this.selectedQuarter = 1;
3070
+ this.timeframeOptions = [{
3071
+ title: 'Day',
3072
+ value: 'month',
3073
+ format: this.datePickerService.formatConfig.day,
3074
+ periodLabel: () => this._dateAdapter
3075
+ .format(this._calendar.activeDate, this._dateFormats.display.monthYearLabel)
3076
+ .toLocaleUpperCase()
3077
+ }, {
3078
+ title: 'Month',
3079
+ value: 'year',
3080
+ format: this.datePickerService.formatConfig.month,
3081
+ periodLabel: () => String(moment$1(this._calendar.activeDate).year())
3082
+ }, {
3083
+ title: 'Quarter',
3084
+ value: 'none',
3085
+ format: this.datePickerService.formatConfig.quarter,
3086
+ periodLabel: () => String(moment$1(this._calendar.activeDate).year())
3087
+ }, {
3088
+ title: 'Year',
3089
+ value: 'multi-year',
3090
+ format: this.datePickerService.formatConfig.year,
3091
+ periodLabel: () => {
3092
+ const currentYear = moment$1(this._calendar.activeDate).year();
3093
+ const startPeriod = Math.floor(currentYear / 24) * 24;
3094
+ return startPeriod + '-' + (startPeriod + 23);
3095
+ }
3096
+ }];
3097
+ this.pagingSetup = {
3098
+ 'year': (forward) => this.pagingDateChange('addCalendarYears', 1, forward),
3099
+ 'none': (forward) => this.pagingDateChange('addCalendarYears', 1, forward),
3100
+ 'month': (forward) => this.pagingDateChange('addCalendarMonths', 1, forward),
3101
+ 'multi-year': (forward) => this.pagingDateChange('addCalendarYears', 24, forward)
3102
+ };
3103
+ this.selectedTimeframe = 'month';
3104
+ this.timeframeSelection = false;
3105
+ this.periodMonthLabel = '';
3106
+ this.periodYearLabel = '';
3107
+ _calendar.stateChanges.pipe(takeUntil(this._destroyed)).subscribe(() => this.setPeriodLabels());
3108
+ this.datePickerService.format$
3109
+ .pipe(take(1))
3110
+ .subscribe(value => {
3111
+ this.selectedTimeframe = this.timeframeOptions.filter(option => option.format == value)[0].value;
3112
+ this.setPeriodLabels();
3113
+ });
3114
+ _calendar.viewChanged.pipe(takeUntil(this._destroyed)).subscribe(() => this.setPeriodLabels());
3115
+ }
3116
+ ngOnDestroy() {
3117
+ this._destroyed.next();
3118
+ this._destroyed.complete();
3119
+ }
3120
+ setPeriodLabels() {
3121
+ const currentTimeframeOption = this.timeframeOptions.filter(option => option.value === this._calendar.currentView)[0];
3122
+ const fullPeriodLabel = currentTimeframeOption.periodLabel();
3123
+ if (this._calendar.currentView === 'month') {
3124
+ this.periodMonthLabel = fullPeriodLabel.slice(0, 3);
3125
+ this.periodYearLabel = fullPeriodLabel.slice(4);
3126
+ }
3127
+ else {
3128
+ this.periodMonthLabel = '';
3129
+ this.periodYearLabel = fullPeriodLabel;
3130
+ }
3131
+ this.cdr.markForCheck();
3132
+ }
3133
+ setTimeframe() {
3134
+ this.timeframeSelection = false;
3135
+ this._calendar.currentView = this.selectedTimeframe;
3136
+ const chosenTimeframeOption = this.timeframeOptions.filter(option => option.value === this.selectedTimeframe)[0];
3137
+ this.datePickerService.updateTimeframeAndFormat(chosenTimeframeOption.format);
3138
+ if (this.selectedTimeframe == 'none') {
3139
+ this.selectedQuarter = moment$1(this._calendar.activeDate).quarter();
3140
+ }
3141
+ }
3142
+ get currentViewIsQuarter() {
3143
+ return !['month', 'year', 'multi-year'].includes(this._calendar.currentView);
3144
+ }
3145
+ switchViewOnClickOnPeriodLabel(view) {
3146
+ this._calendar.currentView = view;
3147
+ }
3148
+ onSelectQuarter(quarterNumber) {
3149
+ const monthsInQuarter = 3;
3150
+ this.selectedQuarter = moment$1(this._calendar.activeDate).quarter();
3151
+ const unadaptedDate = this._dateAdapter.addCalendarMonths(this._calendar.activeDate, monthsInQuarter * (quarterNumber - this.selectedQuarter));
3152
+ this._calendar.activeDate = unadaptedDate;
3153
+ this.datePickerService.updatedQuarter$.next(moment$1(unadaptedDate));
3154
+ this.datePickerService.calendarInstance.close();
3155
+ }
3156
+ pagingClicked(forward) {
3157
+ this.pagingSetup[this._calendar.currentView] && this.pagingSetup[this._calendar.currentView](forward);
3158
+ }
3159
+ pagingDateChange(actionCall, amount, forward) {
3160
+ this._calendar.activeDate = this._dateAdapter[actionCall](this._calendar.activeDate, forward ? amount : -amount);
3161
+ this.setPeriodLabels();
3162
+ }
3163
+ }
3164
+ DrDatePickerCustomHeaderComponent.decorators = [
3165
+ { type: Component, args: [{
3166
+ selector: 'dr-date-picker_custom-header.component',
3167
+ template: "<div *ngIf=\"datePickerService.isTimeframeSelectionEnabled\" class=\"dr-datepicker__timeframe-select__wrapper\">\n <dr-select\n class=\"dr-datepicker__timeframe-select\"\n [(ngModel)]=\"selectedTimeframe\"\n [items]=\"timeframeOptions\"\n bindLabel=\"title\"\n bindValue=\"value\"\n (ngModelChange)=\"setTimeframe()\">\n </dr-select>\n</div>\n\n<div class=\"dr-date-paging\">\n <div class=\"dr-date-paging flip-page-button\"\n (click)=\"pagingClicked(false)\">\n <i class=\"dr-icon-arrow-left presentation_buttons-navigate_input\"></i>\n </div>\n <span class=\"example-header-label\">\n <span (click)=\"switchViewOnClickOnPeriodLabel('year')\">{{periodMonthLabel + ' '}}</span>\n <span (click)=\"switchViewOnClickOnPeriodLabel('multi-year')\">{{periodYearLabel}}</span>\n </span>\n <div class=\"dr-date-paging flip-page-button\"\n (click)=\"pagingClicked(true)\">\n <i class=\"dr-icon-arrow-right presentation_buttons-navigate_input\"></i>\n </div>\n</div>\n<div #quarterlyDatePicker class=\"dr-quarterly-datepicker\" *ngIf=\"currentViewIsQuarter\">\n <div *ngFor=\"let quarter of quarters\"\n class=\"quarter-selector\" (click)=\"onSelectQuarter(quarter)\"\n [class]=\"quarter == selectedQuarter ? 'selected' : ''\"\n >Q{{quarter}}</div>\n</div>\n\n",
3168
+ changeDetection: ChangeDetectionStrategy.OnPush,
3169
+ styles: [":host{height:54px;align-items:center;font-family:\"Poppins\";font-style:normal;font-weight:600;font-size:14px;line-height:22px}.dr-datepicker__timeframe-select__wrapper{background-color:#f9faff;padding:16px 32px;border-radius:18px 18px 0 0}.dr-date-paging{display:flex;flex-direction:row;justify-content:space-between;align-items:center;padding:16px 8px;grid-gap:4px;gap:4px}.dr-date-paging.flip-page-button{width:20px;height:20px;padding:0;color:#4e566c}.dr-date-paging.flip-page-button:hover{border-radius:50%;background:#F2F2FB;color:#4646ce}.example-header-label{cursor:pointer}.dr-quarterly-datepicker{display:flex;justify-content:space-between;padding:10px}.dr-quarterly-datepicker .quarter-selector{display:block;width:74px;height:40px;text-align:center;border-radius:40px;font-weight:400;padding-top:9px}.dr-quarterly-datepicker .quarter-selector:hover{background:#F2F2FB;color:#4646ce;font-weight:600;cursor:pointer}.dr-quarterly-datepicker .quarter-selector.selected{background-color:#4646ce;color:#f3f7ff;font-weight:600}\n"]
3170
+ },] }
3171
+ ];
3172
+ DrDatePickerCustomHeaderComponent.ctorParameters = () => [
3173
+ { type: MatCalendar },
3174
+ { type: DateAdapter },
3175
+ { type: CustomDateFormat, decorators: [{ type: Inject, args: [MAT_DATE_FORMATS,] }] },
3176
+ { type: ChangeDetectorRef },
3177
+ { type: DrDatePickerService }
3178
+ ];
3179
+
3180
+ const moment = require('moment');
3181
+ const noop = () => { };
3182
+ const ɵ0 = noop;
3183
+ class DrDatePickerComponent {
3184
+ constructor(cdr, dateAdapter, datePickerService) {
3185
+ this.cdr = cdr;
3186
+ this.dateAdapter = dateAdapter;
3187
+ this.datePickerService = datePickerService;
3188
+ // Whether to transform date, taking end, start, middle of preiod (i.e. set middle of month if timeframe='month')
3189
+ this.periodPosition = DatePickerPeriodPosition.DEFAULT;
3190
+ this.placeholder = 'Select';
3191
+ this.calendarViewsTimeframeMapping = {
3192
+ year: 'multi-year',
3193
+ month: 'year',
3194
+ quarter: 'none',
3195
+ day: 'month',
3196
+ };
3197
+ this.customHeader = DrDatePickerCustomHeaderComponent;
3198
+ this.readonly = true;
3199
+ this.innerValue = null;
3200
+ this.destroyed$ = new Subject();
3201
+ this.onTouchedCallback = noop;
3202
+ this.onChangeCallback = noop;
3203
+ datePickerService.updatedQuarter$
3204
+ .pipe(takeUntil(this.destroyed$))
3205
+ .subscribe((value) => {
3206
+ this.setValueFromMoment(value);
3207
+ });
3208
+ }
3209
+ set format(value) {
3210
+ this.datePickerService.updateTimeframeAndFormat(value);
3211
+ }
3212
+ set min(minDate) {
3213
+ this._min = moment.unix(minDate);
3214
+ }
3215
+ set max(maxDate) {
3216
+ this._max = moment.unix(maxDate);
3217
+ }
3218
+ get value() {
3219
+ return this.innerValue;
3220
+ }
3221
+ set value(v) {
3222
+ if (v !== this.innerValue) {
3223
+ this.setValueFromMoment(v);
3224
+ }
3225
+ this.cdr.markForCheck();
3226
+ }
3227
+ ngAfterViewInit() {
3228
+ this.datePickerService.calendarInstance = this.dp;
3229
+ this.dp.startView = this.calendarViewsTimeframeMapping[this.datePickerService.timeframe];
3230
+ }
3231
+ ngOnDestroy() {
3232
+ this.destroyed$.next();
3233
+ this.destroyed$.complete();
3234
+ }
3235
+ /**
3236
+ * Updating component inner value according to datepicker timeframe (day, month etc.)
3237
+ * and date position in period (start, end, middle)
3238
+ */
3239
+ tryToNormalaizeTimeframe() {
3240
+ const timeframe = this.datePickerService.timeframe;
3241
+ switch (this.periodPosition) {
3242
+ case DatePickerPeriodPosition.START_OF_PERIOD:
3243
+ this.innerValue.startOf(timeframe);
3244
+ break;
3245
+ case DatePickerPeriodPosition.END_OF_PERIOD:
3246
+ this.innerValue.endOf(timeframe);
3247
+ break;
3248
+ case DatePickerPeriodPosition.MIDDLE_OF_PERIOD:
3249
+ this.innerValue.startOf(timeframe);
3250
+ const endOfPeriod = this.innerValue.clone().endOf(timeframe);
3251
+ const diff = endOfPeriod.diff(this.innerValue, 'seconds');
3252
+ this.innerValue.add(diff / 2 + 1, 'seconds');
3253
+ break;
3254
+ default:
3255
+ this.innerValue.startOf(timeframe);
3256
+ break;
3257
+ }
3258
+ }
3259
+ chosenPeriodHandler(chosenDate, timeframe) {
3260
+ if (this.datePickerService.timeframe === timeframe) {
3261
+ this.setValueFromMoment(chosenDate);
3262
+ this.dp.close();
3263
+ }
3264
+ }
3265
+ /**
3266
+ * Setting value from outside of component via ngModel or formControl updates
3267
+ */
3268
+ writeValue(value) {
3269
+ this.innerValue = value ? moment.unix(value) : value;
3270
+ if (this.innerValue) {
3271
+ this.tryToNormalaizeTimeframe();
3272
+ }
3273
+ this.cdr.markForCheck();
3274
+ }
3275
+ registerOnChange(fn) {
3276
+ this.onChangeCallback = fn;
3277
+ }
3278
+ registerOnTouched(fn) {
3279
+ this.onTouchedCallback = fn;
3280
+ }
3281
+ /**
3282
+ * Set inner value from Moment and propagate
3283
+ * @param momentDate
3284
+ */
3285
+ setValueFromMoment(momentDate) {
3286
+ this.setValue(momentDate.unix());
3287
+ }
3288
+ /**
3289
+ * Set inner value from timestamp and propagate
3290
+ * @param timestamp
3291
+ */
3292
+ setValue(timestamp) {
3293
+ this.writeValue(timestamp);
3294
+ this.onChangeCallback(this.innerValue.unix());
3295
+ }
3296
+ }
3297
+ DrDatePickerComponent.decorators = [
3298
+ { type: Component, args: [{
3299
+ selector: 'dr-date-picker',
3300
+ template: "<i class=\"dr-icon-schedule\"></i>\n<input [(ngModel)]=\"value\"\n (click)=\"datePicker.open()\"\n [matDatepicker]=\"datePicker\"\n [placeholder]=\"placeholder\"\n [drDatePickerFormat]=\"datePickerService.format$ | async\"\n [readonly]=\"readonly\"\n [min]=\"_min\"\n [max]=\"_max\"/>\n<mat-datepicker #datePicker\n [calendarHeaderComponent]=\"customHeader\"\n (yearSelected)=\"chosenPeriodHandler($event, 'year')\"\n (monthSelected)=\"chosenPeriodHandler($event, 'month')\">\n</mat-datepicker>\n",
3301
+ changeDetection: ChangeDetectionStrategy.OnPush,
3302
+ providers: [
3303
+ { provide: NG_VALUE_ACCESSOR, useExisting: DrDatePickerComponent, multi: true },
3304
+ { provide: DrDatePickerService }
3305
+ ],
3306
+ styles: [":host{position:relative;width:100%;display:flex;flex-direction:row;min-height:32px;height:32px;font-size:14px;font-family:\"Poppins\",sans-serif;background-color:#fff;border:1px solid #C3C4CE;border-radius:6px;color:#85889c;overflow:hidden;outline:none;cursor:pointer}:host:hover{border-color:#85889c}:host:focus-within{border-color:#21b8f1!important;color:#151b3f}:host.disabled{pointer-events:none;border:none;color:#85889c;background:#E5E6EA}:host.ng-valid.ng-dirty{border-color:#03a678}:host.ng-invalid.ng-dirty:not(:focus-within){border-color:#de2833!important}:host.ng-untouched.ng-valid{border-color:#c3c4ce}:host:after,:host:before{position:absolute;display:flex;border-color:#999999 transparent transparent;color:#999}:host:after{content:\"\";height:0;width:0;border-style:solid;border-width:5px 5px 2.5px;right:11px;top:13px}:host i{position:absolute;color:#999;left:8px;top:3px}:host input{display:flex;flex-grow:1;height:100%;border:none;text-align:left;padding-left:35px;padding-right:25px;cursor:pointer!important;outline:none}:host input.when-quarter{position:absolute;visibility:hidden}:host input:disabled{border:none;color:#85889c;background:transparent}:host input::-webkit-search-decoration,:host input::-webkit-search-cancel-button,:host input::-webkit-search-results-button,:host input::-webkit-search-results-decoration{-webkit-appearance:none}::ng-deep .mat-datepicker-content{margin:7px 0;box-shadow:0 4px 8px 1px #00000040;border-radius:12px!important}::ng-deep .mat-datepicker-content button[disabled]{border:inherit;color:inherit;background-color:inherit}::ng-deep .mat-datepicker-content button[disabled]:hover{border:inherit}::ng-deep .mat-calendar-body-cell:not(.mat-calendar-body-disabled):hover>.mat-calendar-body-cell-content:not(.mat-calendar-body-selected):not(.mat-calendar-body-comparison-identical){background:#F2F2FB;color:#4646ce;font-weight:600}::ng-deep .mat-calendar-body-selected{background-color:#4646ce;color:#f2f2fb;font-weight:600}::ng-deep .mat-calendar-body-today.mat-calendar-body-selected{box-shadow:none}::ng-deep .mat-button-focus-overlay{background:#F3F7FF}::ng-deep .mat-calendar-controls .mat-icon-button:hover .mat-button-focus-overlay{opacity:1!important;background:#F3F7FF;transition:opacity .2s cubic-bezier(.35,0,.25,1)}::ng-deep .mat-calendar-controls .mat-calendar-period-button:hover{background:#F3F7FF;transition:background .2s cubic-bezier(.35,0,.25,1)}::ng-deep .mat-calendar-table-header th{font-size:14px;font-weight:600;color:#19181a}::ng-deep .mat-calendar-table-header-divider{display:none}::ng-deep .mat-calendar-body-label{color:#fff;padding:0}\n"]
3307
+ },] }
3308
+ ];
3309
+ DrDatePickerComponent.ctorParameters = () => [
3310
+ { type: ChangeDetectorRef },
3311
+ { type: DateAdapter },
3312
+ { type: DrDatePickerService }
3313
+ ];
3314
+ DrDatePickerComponent.propDecorators = {
3315
+ format: [{ type: Input }],
3316
+ min: [{ type: Input }],
3317
+ max: [{ type: Input }],
3318
+ periodPosition: [{ type: Input }],
3319
+ placeholder: [{ type: Input }],
3320
+ dp: [{ type: ViewChild, args: ['datePicker',] }]
3321
+ };
3322
+
3323
+ class DrDatePickerWithTimeframeComponent extends DrDatePickerComponent {
3324
+ constructor(cdr, dateAdapter, datePickerService) {
3325
+ super(cdr, dateAdapter, datePickerService);
3326
+ this.cdr = cdr;
3327
+ this.dateAdapter = dateAdapter;
3328
+ this.datePickerService = datePickerService;
3329
+ this.isDashboardDatepicker = false;
3330
+ this.onChangeFormat = new EventEmitter();
3331
+ this.pagingSetup = {
3332
+ 'year': (forward) => this.pagingDateChange('addCalendarYears', 1, forward),
3333
+ 'quarter': (forward) => this.pagingDateChange('addCalendarMonths', 3, forward),
3334
+ 'month': (forward) => this.pagingDateChange('addCalendarMonths', 1, forward),
3335
+ 'day': (forward) => this.pagingDateChange('addCalendarDays', 1, forward)
3336
+ };
3337
+ datePickerService.isTimeframeSelectionEnabled = true;
3338
+ datePickerService.format$
3339
+ .pipe(takeUntil(this.destroyed$))
3340
+ .subscribe((value) => {
3341
+ this.onChangeFormat.emit(datePickerService.normalizeValue(value));
3342
+ });
3343
+ }
3344
+ get isDashboardClassDisplayed() {
3345
+ return this.isDashboardDatepicker;
3346
+ }
3347
+ ;
3348
+ get quarterDisplay() {
3349
+ return this.datePickerService.getQuarterDisplay(this.value);
3350
+ }
3351
+ ngOnInit() {
3352
+ if (this.dateFormatConfig) {
3353
+ this.datePickerService.formatConfig = Object.assign(Object.assign({}, this.datePickerService.formatConfig), this.dateFormatConfig);
3354
+ }
3355
+ }
3356
+ pagingClicked(forward) {
3357
+ this.pagingSetup[this.datePickerService.timeframe] && this.pagingSetup[this.datePickerService.timeframe](forward);
3358
+ this.dp.close();
3359
+ }
3360
+ pagingDateChange(actionCall, amount, forward) {
3361
+ const newValue = this.dateAdapter[actionCall](this.innerValue, forward ? amount : -amount);
3362
+ this.setValueFromMoment(newValue);
3363
+ }
3364
+ }
3365
+ DrDatePickerWithTimeframeComponent.decorators = [
3366
+ { type: Component, args: [{
3367
+ selector: 'dr-date-picker-with-timeframe',
3368
+ template: "<div class=\"dr-input-date-paging__flip-page-button\"\n (click)=\"pagingClicked(false)\"\n>\n <i class=\"dr-icon-arrow-left presentation_buttons-navigate_input\"></i>\n</div>\n<div class=\"dr-datepicker__input-container\">\n <i *ngIf=\"isDashboardDatepicker\" class=\"dr-icon-date\"></i>\n <div\n class=\"dr-input-date-paging__formatted-value-display\"\n (click)=\"datepickerInput.click()\"\n >\n {{\n !value\n ? placeholder\n : (datePickerService.format$.getValue()?.includes('Q') ? quarterDisplay : value.format(datePickerService.format$.getValue()))\n }}\n </div>\n <input\n #datepickerInput\n [(ngModel)]=\"value\"\n (click)=\"datePicker.open()\"\n [matDatepicker]=\"datePicker\"\n [readonly]=\"readonly\"\n [min]=\"_min\"\n [max]=\"_max\"\n />\n</div>\n<div class=\"dr-input-date-paging__flip-page-button\"\n (click)=\"pagingClicked(true)\">\n <i class=\"dr-icon-arrow-right presentation_buttons-navigate_input\"></i>\n</div>\n<mat-datepicker #datePicker\n class=\"dr-timeframe-datepicker\"\n [calendarHeaderComponent]=\"customHeader\"\n (yearSelected)=\"chosenPeriodHandler($event, 'year')\"\n (monthSelected)=\"chosenPeriodHandler($event, 'month')\">\n</mat-datepicker>\n",
3369
+ changeDetection: ChangeDetectionStrategy.OnPush,
3370
+ providers: [
3371
+ { provide: NG_VALUE_ACCESSOR, useExisting: DrDatePickerWithTimeframeComponent, multi: true },
3372
+ { provide: DrDatePickerService }
3373
+ ],
3374
+ styles: [":host{position:relative;width:100%;display:flex;flex-direction:row;min-height:32px;height:32px;font-size:14px;font-family:\"Poppins\",sans-serif;background-color:#fff;border:1px solid #C3C4CE;border-radius:6px;color:#85889c;overflow:hidden;outline:none;cursor:pointer}:host:hover{border-color:#85889c}:host:focus-within{border-color:#21b8f1!important;color:#151b3f}:host.disabled{pointer-events:none;border:none;color:#85889c;background:#E5E6EA}:host.ng-valid.ng-dirty{border-color:#03a678}:host.ng-invalid.ng-dirty:not(:focus-within){border-color:#de2833!important}:host.ng-untouched.ng-valid{border-color:#c3c4ce}:host:after,:host:before{position:absolute;display:flex;border-color:#999999 transparent transparent;color:#999}:host:after{content:\"\";height:0;width:0;border-style:solid;border-width:5px 5px 2.5px;right:11px;top:13px}:host i{position:absolute;color:#999;left:8px;top:3px}:host input{display:flex;flex-grow:1;height:100%;border:none;text-align:left;padding-left:35px;padding-right:25px;cursor:pointer!important;outline:none}:host input.when-quarter{position:absolute;visibility:hidden}:host input:disabled{border:none;color:#85889c;background:transparent}:host input::-webkit-search-decoration,:host input::-webkit-search-cancel-button,:host input::-webkit-search-results-button,:host input::-webkit-search-results-decoration{-webkit-appearance:none}::ng-deep .mat-datepicker-content{margin:7px 0;box-shadow:0 4px 8px 1px #00000040;border-radius:12px!important}::ng-deep .mat-datepicker-content button[disabled]{border:inherit;color:inherit;background-color:inherit}::ng-deep .mat-datepicker-content button[disabled]:hover{border:inherit}::ng-deep .mat-calendar-body-cell:not(.mat-calendar-body-disabled):hover>.mat-calendar-body-cell-content:not(.mat-calendar-body-selected):not(.mat-calendar-body-comparison-identical){background:#F2F2FB;color:#4646ce;font-weight:600}::ng-deep .mat-calendar-body-selected{background-color:#4646ce;color:#f2f2fb;font-weight:600}::ng-deep .mat-calendar-body-today.mat-calendar-body-selected{box-shadow:none}::ng-deep .mat-button-focus-overlay{background:#F3F7FF}::ng-deep .mat-calendar-controls .mat-icon-button:hover .mat-button-focus-overlay{opacity:1!important;background:#F3F7FF;transition:opacity .2s cubic-bezier(.35,0,.25,1)}::ng-deep .mat-calendar-controls .mat-calendar-period-button:hover{background:#F3F7FF;transition:background .2s cubic-bezier(.35,0,.25,1)}::ng-deep .mat-calendar-table-header th{font-size:14px;font-weight:600;color:#19181a}::ng-deep .mat-calendar-table-header-divider{display:none}::ng-deep .mat-calendar-body-label{color:#fff;padding:0}:host{border:none;display:flex;align-items:center}:host.dr-date-picker-on-dashboard{width:180px;justify-content:space-between}:host.dr-date-picker-on-dashboard mat-datepicker{position:absolute}:host.dr-date-picker-on-dashboard .dr-datepicker__input-container{display:flex;flex-direction:row;justify-content:center;align-items:center;margin-left:-10px}:host.dr-date-picker-on-dashboard .dr-datepicker__input-container .dr-input-date-paging__formatted-value-display{font-weight:600;width:auto;margin-left:5px}:host.dr-date-picker-on-dashboard .dr-datepicker__input-container .dr-icon-date{display:block;position:relative;top:0;margin-right:8px;color:#4e566c}:host .dr-input-date-paging__flip-page-button{width:25px;height:25px;border-radius:16px;padding:0;background-color:#fff}:host .dr-input-date-paging__flip-page-button i{position:relative;color:#0c142b;top:unset;left:unset}:host .dr-input-date-paging__flip-page-button:hover{background-color:#f2f2fb;color:#4646ce}:host input{visibility:hidden;position:absolute;width:100%}:host .dr-input-date-paging__formatted-value-display{width:90px;height:22px;padding-left:0;text-align:center;line-height:22px;color:#0c142b;-webkit-text-decoration-line:underline;text-decoration-line:underline}:host .dr-input-date-paging__formatted-value-display:hover{background-color:#f2f2fb;border-radius:5px;cursor:pointer;-webkit-text-decoration-line:underline;text-decoration-line:underline;color:#4646ce}\n"]
3375
+ },] }
3376
+ ];
3377
+ DrDatePickerWithTimeframeComponent.ctorParameters = () => [
3378
+ { type: ChangeDetectorRef },
3379
+ { type: DateAdapter },
3380
+ { type: DrDatePickerService }
3381
+ ];
3382
+ DrDatePickerWithTimeframeComponent.propDecorators = {
3383
+ isDashboardClassDisplayed: [{ type: HostBinding, args: ['class.dr-date-picker-on-dashboard',] }],
3384
+ isDashboardDatepicker: [{ type: Input }],
3385
+ dateFormatConfig: [{ type: Input }],
3386
+ onChangeFormat: [{ type: Output }]
3387
+ };
3388
+
3389
+ class DrDatePickerFormatDirective {
3390
+ constructor(matDateFormat, ngControl) {
3391
+ this.matDateFormat = matDateFormat;
3392
+ this.ngControl = ngControl;
3393
+ }
3394
+ set datePickerFormat(format) {
3395
+ var _a;
3396
+ if (this.configDateParse) {
3397
+ this.matDateFormat.updateDateFormat(this.configDateParse, this.configDateDisplay);
3398
+ }
3399
+ else {
3400
+ this.matDateFormat.updateDateFormat({ dateInput: format });
3401
+ }
3402
+ const value = this.ngControl.value;
3403
+ (_a = this.ngControl.valueAccessor) === null || _a === void 0 ? void 0 : _a.writeValue(value);
3404
+ }
3405
+ }
3406
+ DrDatePickerFormatDirective.decorators = [
3407
+ { type: Directive, args: [{
3408
+ selector: '[drDatePickerFormat]',
3409
+ providers: [
3410
+ {
3411
+ provide: DateAdapter,
3412
+ useClass: MomentDateAdapter
3413
+ },
3414
+ {
3415
+ provide: MAT_DATE_FORMATS,
3416
+ useClass: CustomDateFormat
3417
+ }
3418
+ ]
3419
+ },] }
3420
+ ];
3421
+ DrDatePickerFormatDirective.ctorParameters = () => [
3422
+ { type: CustomDateFormat, decorators: [{ type: Inject, args: [MAT_DATE_FORMATS,] }] },
3423
+ { type: NgControl, decorators: [{ type: Optional }] }
3424
+ ];
3425
+ DrDatePickerFormatDirective.propDecorators = {
3426
+ configDateParse: [{ type: Input }],
3427
+ configDateDisplay: [{ type: Input }],
3428
+ datePickerFormat: [{ type: Input, args: ['drDatePickerFormat',] }]
3429
+ };
3430
+
3431
+ // !!! Please do not use such approach in other places
3432
+ // Hard fix for 'none' calendar view selection
3433
+ MatCalendar.prototype.focusActiveCell = function () {
3434
+ var _a;
3435
+ (_a = this._getCurrentViewComponent()) === null || _a === void 0 ? void 0 : _a._focusActiveCell(false);
3436
+ };
3334
3437
  const components$1 = [
3335
3438
  DrButtonComponent,
3336
3439
  RadioButtonComponent,
@@ -3341,6 +3444,7 @@ const components$1 = [
3341
3444
  DrToggleComponent,
3342
3445
  DrToggleButtonComponent,
3343
3446
  DrDatePickerComponent,
3447
+ DrDatePickerWithTimeframeComponent,
3344
3448
  DrDatePickerFormatDirective,
3345
3449
  DrDatePickerCustomHeaderComponent,
3346
3450
  DrModelDebounceChangeDirective
@@ -3357,9 +3461,6 @@ DrInputsModule.decorators = [
3357
3461
  CommonModule,
3358
3462
  NgSelectModule,
3359
3463
  MatDatepickerModule
3360
- ],
3361
- providers: [
3362
- DrDatePickerService
3363
3464
  ]
3364
3465
  },] }
3365
3466
  ];
@@ -3508,5 +3609,5 @@ DrAccordionModule.decorators = [
3508
3609
  * Generated bundle index. Do not edit.
3509
3610
  */
3510
3611
 
3511
- export { AnyTagComponent, CheckboxComponent, DateTagComponent, DateTagModule, DayTagComponent, DrAccordionComponent, DrAccordionItemBodyComponent, DrAccordionItemComponent, DrAccordionItemHeaderComponent, DrAccordionModule, DrAvatarComponent, DrAvatarModule, DrAvatarPipe, DrButtonComponent, DrDatePickerComponent, DrDatePickerFormatDirective, DrDropdownComponent, DrDropdownDirective, DrDropdownItemShowPipe, DrDropdownModule, DrDropdownPositionDirective, DrDropdownService, DrInputComponent, DrInputsModule, DrModelDebounceChangeDirective, DrPopoverAlignmentDimension, DrPopoverComponent, DrPopoverDirective, DrPopoverModule, DrPopoverRef, DrPopoverService, DrSelectComponent, DrSpinnerComponent, DrSpinnerDirective, DrSpinnerModule, DrTabComponent, DrTabsComponent, DrTabsModule, DrTagComponent, DrTagModule, DrToggleButtonComponent, DrToggleComponent, DrTooltipDirective, DrTooltipModule, ForecastTagComponent, ISpinnerOptions, ListTagComponent, ListTagModule, MonthTagComponent, QuarterTagComponent, RadioButtonComponent, RadioGroupComponent, TooltipComponent, WeekTagComponent, YearTagComponent, components$2 as ɵa, POPUP_ANIMATION as ɵb, DrDatePickerService as ɵc, CustomDateFormat as ɵd, DrDatePickerCustomHeaderComponent as ɵe };
3612
+ export { AnyTagComponent, CheckboxComponent, CustomDateFormat, DATE_INPUT_FORMAT, DatePickerPeriodPosition, DateTagComponent, DateTagModule, DayTagComponent, DrAccordionComponent, DrAccordionItemBodyComponent, DrAccordionItemComponent, DrAccordionItemHeaderComponent, DrAccordionModule, DrAvatarComponent, DrAvatarModule, DrAvatarPipe, DrButtonComponent, DrDropdownComponent, DrDropdownDirective, DrDropdownItemShowPipe, DrDropdownModule, DrDropdownPositionDirective, DrDropdownService, DrInputComponent, DrInputsModule, DrModelDebounceChangeDirective, DrPopoverAlignmentDimension, DrPopoverComponent, DrPopoverDirective, DrPopoverModule, DrPopoverRef, DrPopoverService, DrSelectComponent, DrSpinnerComponent, DrSpinnerDirective, DrSpinnerModule, DrTabComponent, DrTabsComponent, DrTabsModule, DrTagComponent, DrTagModule, DrToggleButtonComponent, DrToggleComponent, DrTooltipDirective, DrTooltipModule, ForecastTagComponent, ISpinnerOptions, ListTagComponent, ListTagModule, MAT_DEFAULT_DATE_FORMAT, MONTH_YEAR_FORMAT, MonthTagComponent, QUARTER_FORMAT, QuarterTagComponent, RadioButtonComponent, RadioGroupComponent, TooltipComponent, WeekTagComponent, YEAR_FORMAT, YearTagComponent, components$2 as ɵa, POPUP_ANIMATION as ɵb, DrDatePickerComponent as ɵc, DrDatePickerService as ɵd, DrDatePickerWithTimeframeComponent as ɵe, DrDatePickerFormatDirective as ɵf, DrDatePickerCustomHeaderComponent as ɵg };
3512
3613
  //# sourceMappingURL=datarailsshared-datarailsshared.js.map