@datarailsshared/datarailsshared 1.4.23 → 1.4.24-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.24-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.23.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
@@ -1948,10 +1948,17 @@
1948
1948
  var TooltipComponent = /** @class */ (function () {
1949
1949
  function TooltipComponent() {
1950
1950
  this.isContentTemplate = false;
1951
+ this.isMouseOn$ = new rxjs.BehaviorSubject(false);
1951
1952
  }
1952
1953
  TooltipComponent.prototype.ngOnInit = function () {
1953
1954
  this.isContentTemplate = this.content instanceof i0.TemplateRef;
1954
1955
  };
1956
+ TooltipComponent.prototype.setMouseOn = function () {
1957
+ this.isMouseOn$.next(true);
1958
+ };
1959
+ TooltipComponent.prototype.unsetMouseOn = function () {
1960
+ this.isMouseOn$.next(false);
1961
+ };
1955
1962
  return TooltipComponent;
1956
1963
  }());
1957
1964
  TooltipComponent.decorators = [
@@ -1970,7 +1977,9 @@
1970
1977
  contentContext: [{ type: i0.Input }],
1971
1978
  position: [{ type: i0.Input }],
1972
1979
  options: [{ type: i0.Input }],
1973
- class: [{ type: i0.Input }]
1980
+ class: [{ type: i0.Input }],
1981
+ setMouseOn: [{ type: i0.HostListener, args: ['mouseenter',] }],
1982
+ unsetMouseOn: [{ type: i0.HostListener, args: ['mouseleave',] }]
1974
1983
  };
1975
1984
 
1976
1985
  var DrTooltipDirective = /** @class */ (function () {
@@ -1981,6 +1990,8 @@
1981
1990
  this.contentContext = {};
1982
1991
  this.position = 'top';
1983
1992
  this.class = '';
1993
+ // is used for preserve tooltip from being hidden for N milliseconds
1994
+ this.drTooltipMousleaveTimeout = 0;
1984
1995
  }
1985
1996
  Object.defineProperty(DrTooltipDirective.prototype, "drTooltipOptions", {
1986
1997
  set: function (options) {
@@ -2021,16 +2032,37 @@
2021
2032
  if (this.overlayRef) {
2022
2033
  this.overlayRef.dispose();
2023
2034
  }
2035
+ if (this.tooltipMouseOnSubscription) {
2036
+ this.tooltipMouseOnSubscription.unsubscribe();
2037
+ }
2024
2038
  };
2025
2039
  DrTooltipDirective.prototype.show = function () {
2026
- if (this.manualHandling)
2040
+ if (this.manualHandling || this.overlayRef)
2027
2041
  return;
2028
2042
  this.renderTooltip();
2029
2043
  };
2030
2044
  DrTooltipDirective.prototype.hide = function () {
2031
- if (this.manualHandling)
2045
+ var _this = this;
2046
+ var _a;
2047
+ if (this.manualHandling || !this.tooltipRef || ((_a = this.tooltipRef) === null || _a === void 0 ? void 0 : _a.instance.isMouseOn$.getValue()))
2032
2048
  return;
2033
- this.destroyTooltip();
2049
+ // if this timeout value is set - then preserve
2050
+ // tooltip from being hidden N milliseconds and not hiding it
2051
+ // in case mouse is pointed on tooltip
2052
+ if (this.drTooltipMousleaveTimeout) {
2053
+ if (this.mouseleaveTimer) {
2054
+ clearTimeout(this.mouseleaveTimer);
2055
+ }
2056
+ this.mouseleaveTimer = setTimeout(function () {
2057
+ var _a;
2058
+ if (_this.tooltipRef && !((_a = _this.tooltipRef) === null || _a === void 0 ? void 0 : _a.instance.isMouseOn$.getValue())) {
2059
+ _this.destroyTooltip();
2060
+ }
2061
+ }, this.drTooltipMousleaveTimeout);
2062
+ }
2063
+ else {
2064
+ this.destroyTooltip();
2065
+ }
2034
2066
  };
2035
2067
  DrTooltipDirective.prototype.createOverlay = function () {
2036
2068
  var positionStrategy = this.overlayPositionBuilder
@@ -2039,15 +2071,21 @@
2039
2071
  this.overlayRef = this.overlay.create({ positionStrategy: positionStrategy });
2040
2072
  };
2041
2073
  DrTooltipDirective.prototype.renderTooltip = function () {
2074
+ var _this = this;
2042
2075
  var _a;
2043
2076
  this.createOverlay();
2044
2077
  if (!((_a = this.overlayRef) === null || _a === void 0 ? void 0 : _a.hasAttached()) && this.content) {
2045
- var tooltipRef = this.overlayRef.attach(new portal.ComponentPortal(TooltipComponent));
2046
- tooltipRef.instance.content = this.content;
2047
- tooltipRef.instance.contentContext = this.contentContext;
2048
- tooltipRef.instance.position = this.position;
2049
- tooltipRef.instance.options = this.options;
2050
- tooltipRef.instance.class = this.class + ' ' + this.position;
2078
+ this.tooltipRef = this.overlayRef.attach(new portal.ComponentPortal(TooltipComponent));
2079
+ this.tooltipRef.instance.content = this.content;
2080
+ this.tooltipRef.instance.contentContext = this.contentContext;
2081
+ this.tooltipRef.instance.position = this.position;
2082
+ this.tooltipRef.instance.options = this.options;
2083
+ this.tooltipRef.instance.class = this.class + ' ' + this.position;
2084
+ this.tooltipMouseOnSubscription = this.tooltipRef.instance.isMouseOn$.pipe(operators.skip(1)).subscribe(function (isMouseOn) {
2085
+ if (!isMouseOn) {
2086
+ _this.destroyTooltip();
2087
+ }
2088
+ });
2051
2089
  }
2052
2090
  };
2053
2091
  DrTooltipDirective.prototype.destroyTooltip = function () {
@@ -2055,6 +2093,10 @@
2055
2093
  this.overlayRef.dispose();
2056
2094
  }
2057
2095
  this.overlayRef = null;
2096
+ this.tooltipRef = null;
2097
+ if (this.tooltipMouseOnSubscription) {
2098
+ this.tooltipMouseOnSubscription.unsubscribe();
2099
+ }
2058
2100
  };
2059
2101
  return DrTooltipDirective;
2060
2102
  }());
@@ -2073,6 +2115,7 @@
2073
2115
  contentContext: [{ type: i0.Input, args: ['drTooltipContext',] }],
2074
2116
  position: [{ type: i0.Input, args: ['drTooltipPosition',] }],
2075
2117
  class: [{ type: i0.Input, args: ['drTooltipClass',] }],
2118
+ drTooltipMousleaveTimeout: [{ type: i0.Input }],
2076
2119
  drTooltipOptions: [{ type: i0.Input }],
2077
2120
  showTooltip: [{ type: i0.Input, args: ['drTooltipShow',] }],
2078
2121
  show: [{ type: i0.HostListener, args: ['mouseenter',] }],
@@ -2390,978 +2433,525 @@
2390
2433
  <dr-button [isDisabled]="false" [theme]="'text-link'">Text Link</dr-button>
2391
2434
  */
2392
2435
 
2393
- var MAT_DEFAULT_DATE_FORMAT = 'MM/DD/yyyy';
2394
- var DATE_INPUT_FORMAT = 'YYYY/MM/DD';
2395
- var YEAR_FORMAT = 'yyyy';
2396
- var MONTH_YEAR_FORMAT = 'MM/yyyy';
2397
- var QUARTER_FORMAT = 'Q/yyyy';
2398
- var CustomDateFormat = /** @class */ (function () {
2399
- function CustomDateFormat() {
2400
- this._parse = {
2401
- dateInput: DATE_INPUT_FORMAT
2402
- };
2403
- this._display = {
2404
- dateInput: DATE_INPUT_FORMAT,
2405
- monthYearLabel: 'MMM YYYY',
2406
- dateA11yLabel: 'LL',
2407
- monthYearA11yLabel: 'MMM YYYY',
2408
- quarterYearLabel: 'Q/YYYY',
2409
- yearLabel: 'YYYY'
2410
- };
2436
+ var DrPopoverRef = /** @class */ (function () {
2437
+ function DrPopoverRef(overlayRef) {
2438
+ this.overlayRef = overlayRef;
2439
+ this.onClose$ = new rxjs.Subject();
2440
+ // FIXME: this decision was made because of the incompatible rxjs version
2441
+ /**
2442
+ * Correct type is @type {Observable<any>}
2443
+ */
2444
+ this.onClose = this.onClose$.asObservable();
2445
+ this.onBackdropClick = this.overlayRef.backdropClick();
2411
2446
  }
2412
- Object.defineProperty(CustomDateFormat.prototype, "parse", {
2413
- get: function () {
2414
- return this._parse;
2415
- },
2416
- set: function (parse) {
2417
- this._parse = Object.assign({}, this._parse, parse);
2418
- },
2419
- enumerable: false,
2420
- configurable: true
2421
- });
2422
- Object.defineProperty(CustomDateFormat.prototype, "display", {
2423
- get: function () {
2424
- return this._display;
2425
- },
2426
- set: function (display) {
2427
- this._display = Object.assign({}, this._display, display);
2428
- },
2429
- enumerable: false,
2430
- configurable: true
2431
- });
2432
- CustomDateFormat.prototype.updateDateFormat = function (parse, display) {
2433
- this.parse = parse;
2434
- if (!display) {
2435
- display = parse;
2436
- }
2437
- this.display = display;
2447
+ DrPopoverRef.prototype.close = function (res) {
2448
+ this.overlayRef.detach();
2449
+ this.overlayRef.dispose();
2450
+ this.onClose$.next(res);
2451
+ this.onClose$.complete();
2438
2452
  };
2439
- return CustomDateFormat;
2453
+ return DrPopoverRef;
2440
2454
  }());
2441
2455
 
2442
- var moment$2 = require('moment');
2443
- var DrDatePickerService = /** @class */ (function () {
2444
- function DrDatePickerService() {
2445
- this.timeframe = 'day';
2446
- this.format = new rxjs.BehaviorSubject(MAT_DEFAULT_DATE_FORMAT);
2447
- this.updatedQuater = new rxjs.Subject();
2456
+ exports.DrPopoverAlignmentDimension = void 0;
2457
+ (function (DrPopoverAlignmentDimension) {
2458
+ DrPopoverAlignmentDimension["Width"] = "width";
2459
+ DrPopoverAlignmentDimension["Height"] = "height";
2460
+ })(exports.DrPopoverAlignmentDimension || (exports.DrPopoverAlignmentDimension = {}));
2461
+ var DEFAULT_CONFIG = {
2462
+ hasBackdrop: false,
2463
+ closeOnBackdropClick: false,
2464
+ backdropClass: 'dr-popover-transparent-backdrop',
2465
+ };
2466
+ var DEFAULT_MODEL = {
2467
+ position: 'bottom',
2468
+ class: '',
2469
+ overlayConfig: {},
2470
+ manualClosing: { enabled: false },
2471
+ };
2472
+ function getAlignmentDimension(position) {
2473
+ if (!POPUP_POSITIONS[position])
2474
+ return exports.DrPopoverAlignmentDimension.Width;
2475
+ if ((position === null || position === void 0 ? void 0 : position.includes('left')) || (position === null || position === void 0 ? void 0 : position.includes('right'))) {
2476
+ return exports.DrPopoverAlignmentDimension.Height;
2448
2477
  }
2449
- DrDatePickerService.prototype.getQuarterDisplay = function (value, format) {
2450
- return 'Q' + moment$2(value).quarter() + format.charAt(1) + moment$2(value).year();
2451
- };
2452
- DrDatePickerService.prototype.setTimeframe = function (format) {
2453
- var lowerCaseFormat = format.toLowerCase();
2454
- switch (true) {
2455
- case lowerCaseFormat.includes('q'):
2456
- this.timeframe = 'quarter';
2457
- break;
2458
- case lowerCaseFormat.includes('d'):
2459
- this.timeframe = 'day';
2460
- break;
2461
- case lowerCaseFormat.includes('m'):
2462
- this.timeframe = 'month';
2463
- break;
2464
- case lowerCaseFormat.includes('y'):
2465
- this.timeframe = 'year';
2466
- break;
2467
- default:
2468
- this.timeframe = 'day';
2469
- }
2470
- };
2471
- return DrDatePickerService;
2472
- }());
2473
- DrDatePickerService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function DrDatePickerService_Factory() { return new DrDatePickerService(); }, token: DrDatePickerService, providedIn: "root" });
2474
- DrDatePickerService.decorators = [
2475
- { type: i0.Injectable, args: [{
2476
- providedIn: 'root',
2477
- },] }
2478
- ];
2478
+ return exports.DrPopoverAlignmentDimension.Width;
2479
+ }
2479
2480
 
2480
- var moment$1 = require('moment');
2481
- var DrDatePickerCustomHeaderComponent = /** @class */ (function () {
2482
- function DrDatePickerCustomHeaderComponent(_calendar, _dateAdapter, _dateFormats, cdr, datePickerService) {
2483
- var _this = this;
2484
- this._calendar = _calendar;
2485
- this._dateAdapter = _dateAdapter;
2486
- this._dateFormats = _dateFormats;
2481
+ var DrPopoverComponent = /** @class */ (function () {
2482
+ function DrPopoverComponent(cdr, componentFactoryResolver, viewContainerRef, elementRef, popoverRef) {
2487
2483
  this.cdr = cdr;
2488
- this.datePickerService = datePickerService;
2489
- this._destroyed = new rxjs.Subject();
2490
- this.quarters = [1, 2, 3, 4];
2491
- this.selectedQuarter = 1;
2492
- this.timeframeOptions = [{
2493
- title: 'Day',
2494
- value: 'month',
2495
- format: MAT_DEFAULT_DATE_FORMAT,
2496
- periodLabel: function () { return _this._dateAdapter
2497
- .format(_this._calendar.activeDate, _this._dateFormats.display.monthYearLabel)
2498
- .toLocaleUpperCase(); }
2499
- }, {
2500
- title: 'Month',
2501
- value: 'year',
2502
- format: MONTH_YEAR_FORMAT,
2503
- periodLabel: function () { return String(moment$1(_this._calendar.activeDate).year()); }
2504
- }, {
2505
- title: 'Quarter',
2506
- value: 'none',
2507
- format: QUARTER_FORMAT,
2508
- periodLabel: function () { return String(moment$1(_this._calendar.activeDate).year()); }
2509
- }, {
2510
- title: 'Year',
2511
- value: 'multi-year',
2512
- format: YEAR_FORMAT,
2513
- periodLabel: function () {
2514
- var currentYear = moment$1(_this._calendar.activeDate).year();
2515
- var startPeriod = Math.floor(currentYear / 24) * 24;
2516
- return startPeriod + '-' + (startPeriod + 23);
2517
- }
2518
- }];
2519
- this.pagingSetup = {
2520
- 'year': function (forward) { return _this.pagingDateChange('addCalendarYears', 1, forward); },
2521
- 'none': function (forward) { return _this.pagingDateChange('addCalendarYears', 1, forward); },
2522
- 'month': function (forward) { return _this.pagingDateChange('addCalendarMonths', 1, forward); },
2523
- 'multi-year': function (forward) { return _this.pagingDateChange('addCalendarYears', 24, forward); }
2524
- };
2525
- this.selectedTimeframe = 'month';
2526
- this.timeframeSelection = false;
2527
- this.periodMonthLabel = '';
2528
- this.periodYearLabel = '';
2529
- _calendar.stateChanges.pipe(operators.takeUntil(this._destroyed)).subscribe(function () { return _this.setPeriodLabels(); });
2530
- this.datePickerService.format
2531
- .pipe(operators.take(1))
2532
- .subscribe(function (value) {
2533
- _this.selectedTimeframe = _this.timeframeOptions.filter(function (option) { return option.format == value; })[0].value;
2534
- _this.setPeriodLabels();
2535
- });
2536
- _calendar.viewChanged.pipe(operators.takeUntil(this._destroyed)).subscribe(function () { return _this.setPeriodLabels(); });
2484
+ this.componentFactoryResolver = componentFactoryResolver;
2485
+ this.viewContainerRef = viewContainerRef;
2486
+ this.elementRef = elementRef;
2487
+ this.popoverRef = popoverRef;
2488
+ this.class = '';
2489
+ this.isContentTemplate = false;
2490
+ this.popover = true;
2537
2491
  }
2538
- DrDatePickerCustomHeaderComponent.prototype.ngOnDestroy = function () {
2539
- this._destroyed.next();
2540
- this._destroyed.complete();
2541
- };
2542
- DrDatePickerCustomHeaderComponent.prototype.setPeriodLabels = function () {
2543
- var _this = this;
2544
- var currentTimeframeOption = this.timeframeOptions.filter(function (option) { return option.value === _this._calendar.currentView; })[0];
2545
- var fullPeriodLabel = currentTimeframeOption.periodLabel();
2546
- if (this._calendar.currentView === 'month') {
2547
- this.periodMonthLabel = fullPeriodLabel.slice(0, 3);
2548
- this.periodYearLabel = fullPeriodLabel.slice(4);
2549
- }
2550
- else {
2551
- this.periodMonthLabel = '';
2552
- this.periodYearLabel = fullPeriodLabel;
2492
+ DrPopoverComponent.prototype.clickOutside = function (e) {
2493
+ var isTargetHost = this.hostRef instanceof i0.ElementRef && (this.hostRef.nativeElement === e.target || this.hostRef.nativeElement.contains(e.target));
2494
+ var isTargetInPopover = this.elementRef.nativeElement.contains(e.target);
2495
+ var isTargetInDatepicker = e.target.closest('mat-datepicker-popup');
2496
+ var isTargetInSelect = e.target.closest('ng-dropdown-panel');
2497
+ var isTargetInDatepickerContent = e.target.closest('mat-datepicker-content');
2498
+ if (!isTargetHost
2499
+ && !isTargetInPopover
2500
+ && !isTargetInDatepicker
2501
+ && !isTargetInSelect
2502
+ && !isTargetInDatepickerContent
2503
+ && !this.manualClosing.enabled) {
2504
+ this.popoverRef.close();
2553
2505
  }
2554
- this.cdr.markForCheck();
2555
2506
  };
2556
- DrDatePickerCustomHeaderComponent.prototype.setTimeframe = function () {
2557
- var _this = this;
2558
- this.timeframeSelection = false;
2559
- this._calendar.currentView = this.selectedTimeframe;
2560
- var chosenTimeframeOption = this.timeframeOptions.filter(function (option) { return option.value === _this.selectedTimeframe; })[0];
2561
- this.datePickerService.format.next(chosenTimeframeOption.format);
2562
- this.datePickerService.setTimeframe(chosenTimeframeOption.format);
2563
- if (this.selectedTimeframe == 'none') {
2564
- this.selectedQuarter = moment$1(this._calendar.activeDate).quarter();
2507
+ DrPopoverComponent.prototype.ngOnInit = function () {
2508
+ this.isContentTemplate = this.content instanceof i0.TemplateRef;
2509
+ if (!this.isContentTemplate) {
2510
+ this.componentRef = this.viewContainerRef.createComponent(this.componentFactoryResolver.resolveComponentFactory(this.content));
2511
+ Object.assign(this.componentRef.instance, this.contentContext);
2512
+ this.popoverContainer.nativeElement.appendChild(this.componentRef.location.nativeElement);
2565
2513
  }
2514
+ if (this.alignment === 'host') {
2515
+ this[getAlignmentDimension(this.position)] = '100%';
2516
+ }
2517
+ this.cdr.detectChanges();
2566
2518
  };
2567
- Object.defineProperty(DrDatePickerCustomHeaderComponent.prototype, "currentViewIsQuater", {
2568
- get: function () {
2569
- return !['month', 'year', 'multi-year'].includes(this._calendar.currentView);
2570
- },
2571
- enumerable: false,
2572
- configurable: true
2573
- });
2574
- DrDatePickerCustomHeaderComponent.prototype.switchViewOnClickOnPeriodLabel = function (view) {
2575
- this._calendar.currentView = view;
2576
- };
2577
- DrDatePickerCustomHeaderComponent.prototype.onSelectQuater = function (quarterNumber) {
2578
- var monthsInQuarter = 3;
2579
- this.selectedQuarter = moment$1(this._calendar.activeDate).quarter();
2580
- var unadaptedDate = this._dateAdapter.addCalendarMonths(this._calendar.activeDate, monthsInQuarter * (quarterNumber - this.selectedQuarter));
2581
- this._calendar.activeDate = unadaptedDate;
2582
- this.datePickerService.updatedQuater.next(moment$1(unadaptedDate));
2583
- this.datePickerService.calendarInstance.close();
2584
- };
2585
- DrDatePickerCustomHeaderComponent.prototype.pagingClicked = function (forward) {
2586
- this.pagingSetup[this._calendar.currentView] && this.pagingSetup[this._calendar.currentView](forward);
2587
- };
2588
- DrDatePickerCustomHeaderComponent.prototype.pagingDateChange = function (actionCall, amount, forward) {
2589
- this._calendar.activeDate = this._dateAdapter[actionCall](this._calendar.activeDate, forward ? amount : -amount);
2590
- this.setPeriodLabels();
2591
- };
2592
- return DrDatePickerCustomHeaderComponent;
2519
+ return DrPopoverComponent;
2593
2520
  }());
2594
- DrDatePickerCustomHeaderComponent.decorators = [
2521
+ DrPopoverComponent.decorators = [
2595
2522
  { type: i0.Component, args: [{
2596
- selector: 'dr-date-picker_custom-header.component',
2597
- 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",
2523
+ selector: 'dr-popover',
2524
+ 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",
2525
+ animations: [
2526
+ animations.trigger('popover', POPUP_ANIMATION),
2527
+ ],
2598
2528
  changeDetection: i0.ChangeDetectionStrategy.OnPush,
2599
- 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"]
2529
+ 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"]
2600
2530
  },] }
2601
2531
  ];
2602
- DrDatePickerCustomHeaderComponent.ctorParameters = function () { return [
2603
- { type: datepicker.MatCalendar },
2604
- { type: core.DateAdapter },
2605
- { type: CustomDateFormat, decorators: [{ type: i0.Inject, args: [core.MAT_DATE_FORMATS,] }] },
2532
+ DrPopoverComponent.ctorParameters = function () { return [
2606
2533
  { type: i0.ChangeDetectorRef },
2607
- { type: DrDatePickerService }
2534
+ { type: i0.ComponentFactoryResolver },
2535
+ { type: i0.ViewContainerRef },
2536
+ { type: i0.ElementRef },
2537
+ { type: DrPopoverRef }
2608
2538
  ]; };
2539
+ DrPopoverComponent.propDecorators = {
2540
+ content: [{ type: i0.Input }],
2541
+ contentContext: [{ type: i0.Input }],
2542
+ class: [{ type: i0.Input }],
2543
+ hostRef: [{ type: i0.Input }],
2544
+ manualClosing: [{ type: i0.Input }],
2545
+ alignment: [{ type: i0.Input }],
2546
+ position: [{ type: i0.Input }],
2547
+ popoverContainer: [{ type: i0.ViewChild, args: ['popoverContainer', { read: i0.ElementRef, static: true },] }],
2548
+ width: [{ type: i0.HostBinding, args: ['style.width',] }],
2549
+ height: [{ type: i0.HostBinding, args: ['style.height',] }],
2550
+ popover: [{ type: i0.HostBinding, args: ['@popover',] }],
2551
+ clickOutside: [{ type: i0.HostListener, args: ['document:mouseup', ['$event'],] }]
2552
+ };
2609
2553
 
2610
- var moment = require('moment');
2611
- var noop = function () { };
2612
- var ɵ0$1 = noop;
2613
- var DrDatePickerComponent = /** @class */ (function () {
2614
- function DrDatePickerComponent(cdr, _dateAdapter, datePickerService) {
2615
- var _this = this;
2616
- this.cdr = cdr;
2617
- this._dateAdapter = _dateAdapter;
2618
- this.datePickerService = datePickerService;
2619
- this._destroyed = new rxjs.Subject();
2620
- this.readonly = true;
2621
- this._format = MAT_DEFAULT_DATE_FORMAT;
2622
- this.customHeader = DrDatePickerCustomHeaderComponent;
2623
- this.onChangeFormat = new i0.EventEmitter();
2624
- this.timeframeSelection = false;
2625
- this.takeEndOfPeriod = false;
2626
- this.placeholder = 'Select';
2627
- this.min = null;
2628
- this.max = null;
2629
- this.calendarViewSetup = {
2630
- 'year': function (calendar) { return calendar.currentView = 'multi-year'; },
2631
- 'month': function (calendar) { return calendar.currentView = 'year'; },
2632
- 'quarter': function (calendar) { return calendar.currentView = 'none'; },
2633
- 'day': function (calendar) { return calendar.currentView = 'month'; }
2634
- };
2635
- this.pagingSetup = {
2636
- 'year': function (forward) { return _this.pagingDateChange('addCalendarYears', 1, forward); },
2637
- 'quarter': function (forward) { return _this.pagingDateChange('addCalendarMonths', 3, forward); },
2638
- 'month': function (forward) { return _this.pagingDateChange('addCalendarMonths', 1, forward); },
2639
- 'day': function (forward) { return _this.pagingDateChange('addCalendarDays', 1, forward); }
2640
- };
2641
- this.innerValue = null;
2642
- this.onTouchedCallback = noop;
2643
- this.onChangeCallback = noop;
2644
- datePickerService.format
2645
- .pipe(operators.takeUntil(this._destroyed))
2646
- .subscribe(function (value) {
2647
- _this._format = value;
2648
- _this.onChangeFormat.emit(_this.normalizeValue(value));
2649
- cdr.markForCheck();
2650
- });
2651
- datePickerService.updatedQuater
2652
- .pipe(operators.takeUntil(this._destroyed))
2653
- .subscribe(function (value) {
2654
- _this.tryToNormalaizeTimeframe(value, 'quarter');
2655
- _this.writeValue(value);
2656
- _this.onChangeCallback(value);
2657
- });
2554
+ var DrPopoverService = /** @class */ (function () {
2555
+ function DrPopoverService(overlay, overlayPositionBuilder, injector) {
2556
+ this.overlay = overlay;
2557
+ this.overlayPositionBuilder = overlayPositionBuilder;
2558
+ this.injector = injector;
2658
2559
  }
2659
- Object.defineProperty(DrDatePickerComponent.prototype, "format", {
2660
- set: function (value) {
2661
- if (value) {
2662
- value = this.normalizeValue(value);
2663
- this._format = value;
2664
- this.datePickerService.format.next(value);
2665
- this.datePickerService.setTimeframe(value);
2666
- this.cdr.markForCheck();
2667
- }
2668
- },
2669
- enumerable: false,
2670
- configurable: true
2671
- });
2672
- DrDatePickerComponent.prototype.ngAfterViewInit = function () {
2673
- var _this = this;
2674
- this.datePickerService.calendarInstance = this.dp;
2675
- if (this._format === MAT_DEFAULT_DATE_FORMAT) {
2560
+ DrPopoverService.prototype.open = function (content, popoverModel) {
2561
+ if (!content)
2676
2562
  return;
2677
- }
2678
- setTimeout(function () {
2679
- var popupInstance = _this.dp._popupComponentRef.instance;
2680
- var calenderInstance = popupInstance._calendar._calendarHeaderPortal._attachedHost._attachedRef.instance;
2681
- calenderInstance.currentPeriodClicked = function () {
2682
- this.calendarViewSetup[this.datePickerService.timeframe] && this.calendarViewSetup[this.datePickerService.timeframe](this.calendar);
2683
- };
2684
- }, 1000);
2685
- };
2686
- DrDatePickerComponent.prototype.tryToNormalaizeTimeframe = function (normalizedRef, timeframe) {
2687
- if (this.takeEndOfPeriod) {
2688
- normalizedRef.endOf(timeframe);
2689
- }
2690
- normalizedRef.set('hour', 12);
2563
+ var model = Object.assign(Object.assign({}, DEFAULT_MODEL), popoverModel);
2564
+ var overlayRef = this.createOverlay(model);
2565
+ var popoverRef = new DrPopoverRef(overlayRef);
2566
+ this.attachOverlayContainer(content, model, overlayRef, popoverRef);
2567
+ this.registerListeners(model, overlayRef, popoverRef);
2568
+ return popoverRef;
2691
2569
  };
2692
- Object.defineProperty(DrDatePickerComponent.prototype, "value", {
2693
- get: function () {
2694
- return this.innerValue;
2695
- },
2696
- set: function (v) {
2697
- if (v !== this.innerValue) {
2698
- this.innerValue = v;
2699
- this.onChangeCallback(v);
2700
- }
2701
- this.cdr.markForCheck();
2702
- },
2703
- enumerable: false,
2704
- configurable: true
2705
- });
2706
- DrDatePickerComponent.prototype.registerOnChange = function (fn) {
2707
- this.onChangeCallback = fn;
2570
+ DrPopoverService.prototype.attachOverlayContainer = function (content, _a, overlayRef, popoverRef) {
2571
+ var contentContext = _a.contentContext, position = _a.position, elementClass = _a.class, manualClosing = _a.manualClosing, hostRef = _a.hostRef, alignment = _a.alignment;
2572
+ var componentPortal = new portal.ComponentPortal(DrPopoverComponent, null, this.createInjector(popoverRef));
2573
+ var contentRef = overlayRef.attach(componentPortal);
2574
+ popoverRef.componentRef = contentRef;
2575
+ contentRef.instance.content = content;
2576
+ contentRef.instance.contentContext = Object.assign(Object.assign({}, contentContext), { closePopover: popoverRef.close.bind(popoverRef) });
2577
+ contentRef.instance.class = elementClass + ' ' + position;
2578
+ contentRef.instance.manualClosing = manualClosing;
2579
+ contentRef.instance.hostRef = hostRef;
2580
+ contentRef.instance.alignment = alignment;
2581
+ contentRef.instance.position = position;
2708
2582
  };
2709
- DrDatePickerComponent.prototype.registerOnTouched = function (fn) {
2710
- this.onTouchedCallback = fn;
2583
+ DrPopoverService.prototype.createOverlay = function (popoverModel) {
2584
+ var overlayConfig = this.getOverlayConfig(popoverModel);
2585
+ return this.overlay.create(overlayConfig);
2711
2586
  };
2712
- DrDatePickerComponent.prototype.writeValue = function (value) {
2713
- if (value !== this.innerValue) {
2714
- if (value && typeof value === 'number') {
2715
- this.innerValue = moment.unix(value);
2716
- }
2717
- else {
2718
- this.innerValue = value;
2719
- }
2720
- this.tryToNormalaizeTimeframe(this.innerValue, this.datePickerService.timeframe);
2721
- this.cdr.markForCheck();
2587
+ DrPopoverService.prototype.getOverlayConfig = function (popoverModel) {
2588
+ if (!POPUP_POSITIONS[popoverModel.position])
2589
+ throw new Error("DrPopover does not support the '" + (popoverModel === null || popoverModel === void 0 ? void 0 : popoverModel.position) + "' position!");
2590
+ var config = Object.assign(Object.assign({}, DEFAULT_CONFIG), popoverModel.overlayConfig || {});
2591
+ var hostElement = this.getHostElement(popoverModel.hostRef);
2592
+ var positionStrategy = this.overlayPositionBuilder
2593
+ .flexibleConnectedTo(popoverModel.hostRef)
2594
+ .withPositions([POPUP_POSITIONS[popoverModel.position]]);
2595
+ var overlayConfig = new i1.OverlayConfig(Object.assign({ scrollStrategy: this.overlay.scrollStrategies.noop(), positionStrategy: positionStrategy }, config));
2596
+ if (popoverModel.alignment === 'host' && hostElement) {
2597
+ var alignmentDimension = getAlignmentDimension(popoverModel.position);
2598
+ overlayConfig[alignmentDimension] = hostElement.getBoundingClientRect()[alignmentDimension];
2722
2599
  }
2600
+ return overlayConfig;
2723
2601
  };
2724
- Object.defineProperty(DrDatePickerComponent.prototype, "quarterDisplay", {
2725
- get: function () {
2726
- return this.datePickerService.getQuarterDisplay(this.value, this._format);
2727
- },
2728
- enumerable: false,
2729
- configurable: true
2730
- });
2731
- DrDatePickerComponent.prototype.normalizeValue = function (value) {
2732
- if (value.includes('d')) {
2733
- value = value.replace(/d/g, 'D');
2602
+ DrPopoverService.prototype.createInjector = function (popoverRef) {
2603
+ var injectionTokens = [
2604
+ { provide: DrPopoverRef, useValue: popoverRef },
2605
+ ];
2606
+ return i0.Injector.create({ providers: injectionTokens, parent: this.injector });
2607
+ };
2608
+ DrPopoverService.prototype.registerListeners = function (popoverModel, overlayRef, popoverRef) {
2609
+ var config = popoverModel.overlayConfig || {};
2610
+ var targetElement = popoverModel.targetElement;
2611
+ var hostElement = this.getHostElement(popoverModel.hostRef);
2612
+ if ((config === null || config === void 0 ? void 0 : config.closeOnBackdropClick) && (config === null || config === void 0 ? void 0 : config.hasBackdrop)) {
2613
+ overlayRef.backdropClick().subscribe(function () { return popoverRef.close(); });
2734
2614
  }
2735
- else if (value.includes('D')) {
2736
- value = value.replace(/D/g, 'd');
2615
+ if (targetElement) {
2616
+ targetElement.addEventListener('mouseup', function () { return popoverRef.close(); }, { once: true });
2737
2617
  }
2738
- return value;
2739
- };
2740
- DrDatePickerComponent.prototype.chosenMonthHandler = function (normalizedMonth, datepicker) {
2741
- if (this.datePickerService.timeframe === 'month') {
2742
- this.tryToNormalaizeTimeframe(normalizedMonth, 'month');
2743
- this.writeValue(normalizedMonth);
2744
- this.onChangeCallback(normalizedMonth);
2745
- datepicker.close();
2618
+ if (popoverModel.alignment === 'host' && hostElement) {
2619
+ var alignmentDimension_1 = getAlignmentDimension(popoverModel.position);
2620
+ var resizeObserver_1 = new ResizeObserver(function (entries) {
2621
+ entries.forEach(function (host) {
2622
+ var _a;
2623
+ return overlayRef.updateSize((_a = {}, _a[alignmentDimension_1] = host.target.getBoundingClientRect()[alignmentDimension_1], _a));
2624
+ });
2625
+ });
2626
+ resizeObserver_1.observe(hostElement);
2627
+ popoverRef.onClose.pipe(operators.first()).subscribe(function () { return resizeObserver_1.unobserve(hostElement); });
2746
2628
  }
2747
2629
  };
2748
- DrDatePickerComponent.prototype.chosenYearHandler = function (normalizedYear, datepicker) {
2749
- if (this.datePickerService.timeframe === 'year') {
2750
- this.tryToNormalaizeTimeframe(normalizedYear, 'year');
2751
- this.writeValue(normalizedYear);
2752
- this.onChangeCallback(normalizedYear);
2753
- datepicker.close();
2630
+ DrPopoverService.prototype.getHostElement = function (hostRef) {
2631
+ if (!hostRef || hostRef.x)
2632
+ return null;
2633
+ if (hostRef.nativeElement)
2634
+ return hostRef.nativeElement;
2635
+ return hostRef;
2636
+ };
2637
+ return DrPopoverService;
2638
+ }());
2639
+ DrPopoverService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function DrPopoverService_Factory() { return new DrPopoverService(i0__namespace.ɵɵinject(i1__namespace.Overlay), i0__namespace.ɵɵinject(i1__namespace.OverlayPositionBuilder), i0__namespace.ɵɵinject(i0__namespace.INJECTOR)); }, token: DrPopoverService, providedIn: "root" });
2640
+ DrPopoverService.decorators = [
2641
+ { type: i0.Injectable, args: [{
2642
+ providedIn: 'root',
2643
+ },] }
2644
+ ];
2645
+ DrPopoverService.ctorParameters = function () { return [
2646
+ { type: i1.Overlay },
2647
+ { type: i1.OverlayPositionBuilder },
2648
+ { type: i0.Injector }
2649
+ ]; };
2650
+
2651
+ var DrPopoverDirective = /** @class */ (function () {
2652
+ function DrPopoverDirective(elementRef, drPopoverService) {
2653
+ this.elementRef = elementRef;
2654
+ this.drPopoverService = drPopoverService;
2655
+ this.contentContext = {};
2656
+ this.position = 'bottom';
2657
+ this.class = '';
2658
+ this.overlayConfig = {};
2659
+ this.manualClosing = { enabled: false };
2660
+ this.popoverClose = new i0.EventEmitter();
2661
+ this.showStateChange = new i0.EventEmitter();
2662
+ }
2663
+ DrPopoverDirective.prototype.togglePopover = function () {
2664
+ if (this.popoverRef) {
2665
+ this.closePopover();
2666
+ }
2667
+ else {
2668
+ this.renderPopover();
2669
+ this.showStateChange.emit({ isShown: !!this.popoverRef });
2754
2670
  }
2755
2671
  };
2756
- DrDatePickerComponent.prototype.pagingClicked = function (forward) {
2757
- this.pagingSetup[this.datePickerService.timeframe] && this.pagingSetup[this.datePickerService.timeframe](forward);
2758
- this.datePickerService.calendarInstance.close();
2672
+ DrPopoverDirective.prototype.closePopover = function (res) {
2673
+ if (this.popoverRef) {
2674
+ this.popoverRef.close(res);
2675
+ this.popoverRef = null;
2676
+ }
2759
2677
  };
2760
- DrDatePickerComponent.prototype.pagingDateChange = function (actionCall, amount, forward) {
2761
- var newValue = this._dateAdapter[actionCall](this.innerValue, forward ? amount : -amount);
2762
- this.writeValue(newValue);
2763
- this.onChangeCallback(newValue);
2678
+ DrPopoverDirective.prototype.renderPopover = function () {
2679
+ var _this = this;
2680
+ var popoverRef = this.popoverRef = this.drPopoverService.open(this.content, {
2681
+ hostRef: this.elementRef,
2682
+ overlayConfig: this.overlayConfig,
2683
+ class: this.class,
2684
+ manualClosing: this.manualClosing,
2685
+ position: this.position,
2686
+ contentContext: this.contentContext,
2687
+ alignment: this.alignment,
2688
+ });
2689
+ popoverRef.onClose.pipe(operators.first()).subscribe(function (res) {
2690
+ _this.closePopover();
2691
+ _this.popoverClose.emit(res);
2692
+ _this.showStateChange.emit({ isShown: !!_this.popoverRef });
2693
+ });
2764
2694
  };
2765
- DrDatePickerComponent.prototype.ngOnDestroy = function () {
2766
- this._destroyed.next();
2767
- this._destroyed.complete();
2695
+ DrPopoverDirective.prototype.ngOnDestroy = function () {
2696
+ this.closePopover();
2768
2697
  };
2769
- return DrDatePickerComponent;
2698
+ return DrPopoverDirective;
2770
2699
  }());
2771
- DrDatePickerComponent.decorators = [
2772
- { type: i0.Component, args: [{
2773
- selector: 'dr-date-picker',
2774
- 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",
2775
- changeDetection: i0.ChangeDetectionStrategy.OnPush,
2776
- providers: [
2777
- { provide: forms.NG_VALUE_ACCESSOR, useExisting: DrDatePickerComponent, multi: true }
2778
- ],
2779
- 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"]
2700
+ DrPopoverDirective.decorators = [
2701
+ { type: i0.Directive, args: [{
2702
+ selector: '[drPopover]'
2780
2703
  },] }
2781
2704
  ];
2782
- DrDatePickerComponent.ctorParameters = function () { return [
2783
- { type: i0.ChangeDetectorRef },
2784
- { type: core.DateAdapter },
2785
- { type: DrDatePickerService }
2705
+ DrPopoverDirective.ctorParameters = function () { return [
2706
+ { type: i0.ElementRef },
2707
+ { type: DrPopoverService }
2786
2708
  ]; };
2787
- DrDatePickerComponent.propDecorators = {
2788
- _format: [{ type: i0.Input }],
2789
- onChangeFormat: [{ type: i0.Output }],
2790
- format: [{ type: i0.Input }],
2791
- timeframeSelection: [{ type: i0.Input }],
2792
- takeEndOfPeriod: [{ type: i0.Input }],
2793
- placeholder: [{ type: i0.Input }],
2794
- min: [{ type: i0.Input }],
2795
- max: [{ type: i0.Input }],
2796
- dp: [{ type: i0.ViewChild, args: ['datePicker',] }]
2709
+ DrPopoverDirective.propDecorators = {
2710
+ content: [{ type: i0.Input, args: ['drPopover',] }],
2711
+ contentContext: [{ type: i0.Input, args: ['drPopoverContext',] }],
2712
+ position: [{ type: i0.Input, args: ['drPopoverPosition',] }],
2713
+ class: [{ type: i0.Input, args: ['drPopoverClass',] }],
2714
+ overlayConfig: [{ type: i0.Input, args: ['drPopoverOverlayConfig',] }],
2715
+ manualClosing: [{ type: i0.Input, args: ['drPopoverManualClosing',] }],
2716
+ alignment: [{ type: i0.Input, args: ['drPopoverAlignment',] }],
2717
+ popoverClose: [{ type: i0.Output, args: ['drPopoverClose',] }],
2718
+ showStateChange: [{ type: i0.Output, args: ['drPopoverShowStateChange',] }],
2719
+ togglePopover: [{ type: i0.HostListener, args: ['click',] }]
2797
2720
  };
2798
2721
 
2799
- var DrDatePickerFormatDirective = /** @class */ (function () {
2800
- function DrDatePickerFormatDirective(matDateFormat, ngControl) {
2801
- this.matDateFormat = matDateFormat;
2802
- this.ngControl = ngControl;
2722
+ var DrDropdownService = /** @class */ (function () {
2723
+ function DrDropdownService() {
2724
+ this.actionItem = new rxjs.Subject();
2803
2725
  }
2804
- Object.defineProperty(DrDatePickerFormatDirective.prototype, "datePickerFormat", {
2805
- set: function (format) {
2806
- var _a;
2807
- if (this.configDateParse) {
2808
- this.matDateFormat.updateDateFormat(this.configDateParse, this.configDateDisplay);
2809
- }
2810
- else {
2811
- this.matDateFormat.updateDateFormat({ dateInput: format });
2812
- }
2813
- var value = this.ngControl.value;
2814
- (_a = this.ngControl.valueAccessor) === null || _a === void 0 ? void 0 : _a.writeValue(value);
2726
+ Object.defineProperty(DrDropdownService.prototype, "addMenu", {
2727
+ set: function (item) {
2728
+ this.menuInView = item;
2815
2729
  },
2816
2730
  enumerable: false,
2817
2731
  configurable: true
2818
2732
  });
2819
- return DrDatePickerFormatDirective;
2733
+ DrDropdownService.prototype.destroy = function () {
2734
+ if (this.menuInView) {
2735
+ this.menuInView.destroy();
2736
+ }
2737
+ };
2738
+ return DrDropdownService;
2820
2739
  }());
2821
- DrDatePickerFormatDirective.decorators = [
2822
- { type: i0.Directive, args: [{
2823
- selector: '[drDatePickerFormat]',
2824
- providers: [
2825
- {
2826
- provide: core.DateAdapter,
2827
- useClass: materialMomentAdapter.MomentDateAdapter
2828
- },
2829
- {
2830
- provide: core.MAT_DATE_FORMATS,
2831
- useClass: CustomDateFormat
2832
- }
2833
- ]
2740
+ DrDropdownService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function DrDropdownService_Factory() { return new DrDropdownService(); }, token: DrDropdownService, providedIn: "root" });
2741
+ DrDropdownService.decorators = [
2742
+ { type: i0.Injectable, args: [{
2743
+ providedIn: 'root'
2834
2744
  },] }
2835
2745
  ];
2836
- DrDatePickerFormatDirective.ctorParameters = function () { return [
2837
- { type: CustomDateFormat, decorators: [{ type: i0.Inject, args: [core.MAT_DATE_FORMATS,] }] },
2838
- { type: forms.NgControl, decorators: [{ type: i0.Optional }] }
2839
- ]; };
2840
- DrDatePickerFormatDirective.propDecorators = {
2841
- configDateParse: [{ type: i0.Input }],
2842
- configDateDisplay: [{ type: i0.Input }],
2843
- datePickerFormat: [{ type: i0.Input, args: ['drDatePickerFormat',] }]
2844
- };
2845
-
2846
- var DrPopoverRef = /** @class */ (function () {
2847
- function DrPopoverRef(overlayRef) {
2848
- this.overlayRef = overlayRef;
2849
- this.onClose$ = new rxjs.Subject();
2850
- // FIXME: this decision was made because of the incompatible rxjs version
2851
- /**
2852
- * Correct type is @type {Observable<any>}
2853
- */
2854
- this.onClose = this.onClose$.asObservable();
2855
- this.onBackdropClick = this.overlayRef.backdropClick();
2856
- }
2857
- DrPopoverRef.prototype.close = function (res) {
2858
- this.overlayRef.detach();
2859
- this.overlayRef.dispose();
2860
- this.onClose$.next(res);
2861
- this.onClose$.complete();
2862
- };
2863
- return DrPopoverRef;
2864
- }());
2865
-
2866
- exports.DrPopoverAlignmentDimension = void 0;
2867
- (function (DrPopoverAlignmentDimension) {
2868
- DrPopoverAlignmentDimension["Width"] = "width";
2869
- DrPopoverAlignmentDimension["Height"] = "height";
2870
- })(exports.DrPopoverAlignmentDimension || (exports.DrPopoverAlignmentDimension = {}));
2871
- var DEFAULT_CONFIG = {
2872
- hasBackdrop: false,
2873
- closeOnBackdropClick: false,
2874
- backdropClass: 'dr-popover-transparent-backdrop',
2875
- };
2876
- var DEFAULT_MODEL = {
2877
- position: 'bottom',
2878
- class: '',
2879
- overlayConfig: {},
2880
- manualClosing: { enabled: false },
2881
- };
2882
- function getAlignmentDimension(position) {
2883
- if (!POPUP_POSITIONS[position])
2884
- return exports.DrPopoverAlignmentDimension.Width;
2885
- if ((position === null || position === void 0 ? void 0 : position.includes('left')) || (position === null || position === void 0 ? void 0 : position.includes('right'))) {
2886
- return exports.DrPopoverAlignmentDimension.Height;
2887
- }
2888
- return exports.DrPopoverAlignmentDimension.Width;
2889
- }
2746
+ DrDropdownService.ctorParameters = function () { return []; };
2890
2747
 
2891
- var DrPopoverComponent = /** @class */ (function () {
2892
- function DrPopoverComponent(cdr, componentFactoryResolver, viewContainerRef, elementRef, popoverRef) {
2748
+ var DrDropdownComponent = /** @class */ (function () {
2749
+ function DrDropdownComponent(menuService, cdr) {
2750
+ this.menuService = menuService;
2893
2751
  this.cdr = cdr;
2894
- this.componentFactoryResolver = componentFactoryResolver;
2895
- this.viewContainerRef = viewContainerRef;
2896
- this.elementRef = elementRef;
2897
- this.popoverRef = popoverRef;
2898
- this.class = '';
2899
- this.isContentTemplate = false;
2900
- this.popover = true;
2752
+ this.position = 'left';
2901
2753
  }
2902
- DrPopoverComponent.prototype.clickOutside = function (e) {
2903
- var isTargetHost = this.hostRef instanceof i0.ElementRef && (this.hostRef.nativeElement === e.target || this.hostRef.nativeElement.contains(e.target));
2904
- var isTargetInPopover = this.elementRef.nativeElement.contains(e.target);
2905
- var isTargetInDatepicker = e.target.closest('mat-datepicker-popup');
2906
- var isTargetInSelect = e.target.closest('ng-dropdown-panel');
2907
- var isTargetInDatepickerContent = e.target.closest('mat-datepicker-content');
2908
- if (!isTargetHost
2909
- && !isTargetInPopover
2910
- && !isTargetInDatepicker
2911
- && !isTargetInSelect
2912
- && !isTargetInDatepickerContent
2913
- && !this.manualClosing.enabled) {
2914
- this.popoverRef.close();
2754
+ Object.defineProperty(DrDropdownComponent.prototype, "options", {
2755
+ set: function (data) {
2756
+ if (data) {
2757
+ this.option = data.option;
2758
+ this.position = data.position;
2759
+ this.drDropdownInHover = data.drDropdownInHover;
2760
+ this.containerClass = data.class;
2761
+ this.list = data.list || [];
2762
+ this.list.forEach(function (item) {
2763
+ var _a, _b;
2764
+ if ((_a = item.children) === null || _a === void 0 ? void 0 : _a.length) {
2765
+ item.childOptions = {
2766
+ list: item.children,
2767
+ class: ((_b = item === null || item === void 0 ? void 0 : item.childOptions) === null || _b === void 0 ? void 0 : _b.class) || '',
2768
+ position: 'child'
2769
+ };
2770
+ }
2771
+ });
2772
+ this.cdr.markForCheck();
2773
+ }
2774
+ },
2775
+ enumerable: false,
2776
+ configurable: true
2777
+ });
2778
+ DrDropdownComponent.prototype.onMouseLeave = function () {
2779
+ if (this.drDropdownInHover)
2780
+ this.menuService.destroy();
2781
+ };
2782
+ DrDropdownComponent.prototype.onClickedOutside = function () {
2783
+ if (this.firstInit) {
2784
+ this.menuService.destroy();
2785
+ }
2786
+ else {
2787
+ this.firstInit = true;
2915
2788
  }
2916
2789
  };
2917
- DrPopoverComponent.prototype.ngOnInit = function () {
2918
- this.isContentTemplate = this.content instanceof i0.TemplateRef;
2919
- if (!this.isContentTemplate) {
2920
- this.componentRef = this.viewContainerRef.createComponent(this.componentFactoryResolver.resolveComponentFactory(this.content));
2921
- Object.assign(this.componentRef.instance, this.contentContext);
2922
- this.popoverContainer.nativeElement.appendChild(this.componentRef.location.nativeElement);
2790
+ DrDropdownComponent.prototype.hide = function () {
2791
+ this.menuService.destroy();
2792
+ };
2793
+ DrDropdownComponent.prototype.disabled = function (act) {
2794
+ if (!act.disabled) {
2795
+ return false;
2923
2796
  }
2924
- if (this.alignment === 'host') {
2925
- this[getAlignmentDimension(this.position)] = '100%';
2797
+ if (typeof act.disabled === 'boolean') {
2798
+ return act.disabled;
2799
+ }
2800
+ else {
2801
+ return act.disabled(act.data);
2926
2802
  }
2927
- this.cdr.detectChanges();
2928
2803
  };
2929
- return DrPopoverComponent;
2804
+ DrDropdownComponent.prototype.selected = function (act) {
2805
+ if (!act.selected) {
2806
+ return false;
2807
+ }
2808
+ if (typeof act.selected === 'boolean') {
2809
+ return act.selected;
2810
+ }
2811
+ else {
2812
+ return act.selected(act.data);
2813
+ }
2814
+ };
2815
+ DrDropdownComponent.prototype.tooltipToShow = function (act) {
2816
+ if (act.toolTipIfDisabled && !this.disabled(act))
2817
+ return '';
2818
+ return act.toolTip;
2819
+ };
2820
+ DrDropdownComponent.prototype.tooltipPosition = function (widthMoreRight) {
2821
+ return widthMoreRight ? 'right' : 'left';
2822
+ };
2823
+ DrDropdownComponent.prototype.action = function (act) {
2824
+ if (!this.disabled(act)) {
2825
+ if (act.action) {
2826
+ act.action(act.data);
2827
+ }
2828
+ else {
2829
+ this.menuService.actionItem.next({ event: act.event || act.title || 'default', data: act.data });
2830
+ }
2831
+ this.hide();
2832
+ }
2833
+ };
2834
+ DrDropdownComponent.prototype.onActionIconClick = function ($event, actionIcon, data) {
2835
+ $event.stopPropagation();
2836
+ if (!this.disabled(actionIcon)) {
2837
+ actionIcon.action(data);
2838
+ this.hide();
2839
+ }
2840
+ };
2841
+ return DrDropdownComponent;
2930
2842
  }());
2931
- DrPopoverComponent.decorators = [
2843
+ DrDropdownComponent.decorators = [
2932
2844
  { type: i0.Component, args: [{
2933
- selector: 'dr-popover',
2934
- 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",
2935
- animations: [
2936
- animations.trigger('popover', POPUP_ANIMATION),
2937
- ],
2845
+ selector: 'dr-dropdown',
2846
+ template: "<div #menuContainer\n (mouseleave)=\"onMouseLeave()\"\n (clickOutside)=\"onClickedOutside()\"\n [drDropdownPosition]=\"option\"\n #dropdownPosition=\"dropdownPosition\"\n [position]=\"position\"\n [class]=\"containerClass\"\n class=\"dr-dropdown\">\n <div class=\"dr-dropdown__container\">\n <div *ngFor=\"let act of list | drDropdownItemShowPipe\"\n (click)=\"action(act)\"\n [drTooltip]=\"tooltipToShow(act)\"\n [drTooltipPosition]=\"tooltipPosition(dropdownPosition.widthMoreRight)\"\n [drTooltipOptions]=\"{ withoutArrow: true }\"\n [drTooltipClass]=\"'dr-dropdown__tooltip'\"\n class=\"dr-dropdown__container__item\"\n [class.item-disabled]=\"disabled(act)\"\n [class.item-selected]=\"selected(act)\">\n <i *ngIf=\"act.icon\" [class]=\"act.icon\"></i>\n <span class=\"dr-dropdown__container__item__text\">{{act.title}}</span>\n <i *ngFor=\"let actionIcon of act.actionIcons\"\n [class]=\"actionIcon.icon\"\n [class.showOnHover]=\"actionIcon.showOnHover\"\n (click)=\"onActionIconClick($event, actionIcon, act.data)\"></i>\n <i *ngIf=\"act.children?.length\" class=\"dr-icon-arrow-right\"></i>\n <dr-dropdown *ngIf=\"act.children?.length\" [options]=\"act.childOptions\"></dr-dropdown>\n </div>\n </div>\n</div>\n",
2938
2847
  changeDetection: i0.ChangeDetectionStrategy.OnPush,
2939
- 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"]
2848
+ styles: ["::ng-deep .dr-dropdown__container__item .dr-dropdown{visibility:hidden;transition-delay:.2s}::ng-deep .dr-dropdown__container__item:hover>*>.dr-dropdown{visibility:visible;transition-delay:0s}::ng-deep .dr-dropdown__tooltip>.default-content{max-width:300px;white-space:normal!important}.dr-dropdown{position:absolute;z-index:-1;top:0;left:0;width:auto}.dr-dropdown__container{display:flex;flex-direction:column;background:#fff;border-radius:4px;box-shadow:0 4px 8px 1px #00000040;padding:8px 0;overflow-y:auto;max-height:60vh}.dr-dropdown__container__item{display:flex;align-items:center;justify-content:flex-start;cursor:pointer;min-width:15rem;font-style:normal;font-weight:400;font-size:14px;line-height:24px;clear:both;width:100%;white-space:nowrap;padding:0 12px;height:36px;flex-shrink:0}.dr-dropdown__container__item:hover{background-color:#f9faff}.dr-dropdown__container__item:hover .showOnHover{visibility:visible}.dr-dropdown__container__item.item-selected{background:#F3F7FF}.dr-dropdown__container__item.item-disabled,.dr-dropdown__container__item.item-disabled i,.dr-dropdown__container__item.item-disabled .dr-dropdown__container__item__text{color:#bcbcbc}.dr-dropdown__container__item i:first-child{margin-right:8px}.dr-dropdown__container__item__text{margin-right:auto;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.dr-dropdown__container__item i,.dr-dropdown__container__item__text{color:#151b3f}.dr-dropdown__container__item i{color:#4e566c}.dr-dropdown__container__item i:hover{color:#4646ce}.dr-dropdown__container__item .showOnHover{visibility:hidden}.dr-dropdown.content-top{transform:translate(-50%,-100%)}.dr-dropdown.content-top-left{transform:translate(-100%,-100%)}.dr-dropdown.content-bottom{transform:translate(-50%,50%)}.dr-dropdown.content-bottom-left{transform:translate(-90%,35%)}.dr-dropdown.content-bottom-right{transform:translateY(15%)}.dr-dropdown.content-left{transform:translate(-100%)}.dr-dropdown.content-left-center{transform:translate(-100%,-50%)}.dr-dropdown.content-right{transform:translate(5%)}\n"]
2940
2849
  },] }
2941
2850
  ];
2942
- DrPopoverComponent.ctorParameters = function () { return [
2943
- { type: i0.ChangeDetectorRef },
2944
- { type: i0.ComponentFactoryResolver },
2945
- { type: i0.ViewContainerRef },
2946
- { type: i0.ElementRef },
2947
- { type: DrPopoverRef }
2851
+ DrDropdownComponent.ctorParameters = function () { return [
2852
+ { type: DrDropdownService },
2853
+ { type: i0.ChangeDetectorRef }
2948
2854
  ]; };
2949
- DrPopoverComponent.propDecorators = {
2950
- content: [{ type: i0.Input }],
2951
- contentContext: [{ type: i0.Input }],
2952
- class: [{ type: i0.Input }],
2953
- hostRef: [{ type: i0.Input }],
2954
- manualClosing: [{ type: i0.Input }],
2955
- alignment: [{ type: i0.Input }],
2956
- position: [{ type: i0.Input }],
2957
- popoverContainer: [{ type: i0.ViewChild, args: ['popoverContainer', { read: i0.ElementRef, static: true },] }],
2958
- width: [{ type: i0.HostBinding, args: ['style.width',] }],
2959
- height: [{ type: i0.HostBinding, args: ['style.height',] }],
2960
- popover: [{ type: i0.HostBinding, args: ['@popover',] }],
2961
- clickOutside: [{ type: i0.HostListener, args: ['document:mouseup', ['$event'],] }]
2855
+ DrDropdownComponent.propDecorators = {
2856
+ viewMenu: [{ type: i0.ViewChild, args: ['listMenu',] }],
2857
+ menuContainer: [{ type: i0.ViewChild, args: ['menuContainer',] }],
2858
+ options: [{ type: i0.Input }]
2962
2859
  };
2963
2860
 
2964
- var DrPopoverService = /** @class */ (function () {
2965
- function DrPopoverService(overlay, overlayPositionBuilder, injector) {
2966
- this.overlay = overlay;
2967
- this.overlayPositionBuilder = overlayPositionBuilder;
2968
- this.injector = injector;
2861
+ var DrDropdownDirective = /** @class */ (function () {
2862
+ function DrDropdownDirective(componentFactoryResolver, viewContainerRef, service, el, _document) {
2863
+ this.componentFactoryResolver = componentFactoryResolver;
2864
+ this.viewContainerRef = viewContainerRef;
2865
+ this.service = service;
2866
+ this.el = el;
2867
+ this._document = _document;
2868
+ this.position = 'left';
2969
2869
  }
2970
- DrPopoverService.prototype.open = function (content, popoverModel) {
2971
- if (!content)
2870
+ DrDropdownDirective.prototype.elementHover = function () {
2871
+ if (!this.drDropdownInHover)
2972
2872
  return;
2973
- var model = Object.assign(Object.assign({}, DEFAULT_MODEL), popoverModel);
2974
- var overlayRef = this.createOverlay(model);
2975
- var popoverRef = new DrPopoverRef(overlayRef);
2976
- this.attachOverlayContainer(content, model, overlayRef, popoverRef);
2977
- this.registerListeners(model, overlayRef, popoverRef);
2978
- return popoverRef;
2979
- };
2980
- DrPopoverService.prototype.attachOverlayContainer = function (content, _a, overlayRef, popoverRef) {
2981
- var contentContext = _a.contentContext, position = _a.position, elementClass = _a.class, manualClosing = _a.manualClosing, hostRef = _a.hostRef, alignment = _a.alignment;
2982
- var componentPortal = new portal.ComponentPortal(DrPopoverComponent, null, this.createInjector(popoverRef));
2983
- var contentRef = overlayRef.attach(componentPortal);
2984
- popoverRef.componentRef = contentRef;
2985
- contentRef.instance.content = content;
2986
- contentRef.instance.contentContext = Object.assign(Object.assign({}, contentContext), { closePopover: popoverRef.close.bind(popoverRef) });
2987
- contentRef.instance.class = elementClass + ' ' + position;
2988
- contentRef.instance.manualClosing = manualClosing;
2989
- contentRef.instance.hostRef = hostRef;
2990
- contentRef.instance.alignment = alignment;
2991
- contentRef.instance.position = position;
2992
- };
2993
- DrPopoverService.prototype.createOverlay = function (popoverModel) {
2994
- var overlayConfig = this.getOverlayConfig(popoverModel);
2995
- return this.overlay.create(overlayConfig);
2873
+ this.openDropdown();
2996
2874
  };
2997
- DrPopoverService.prototype.getOverlayConfig = function (popoverModel) {
2998
- if (!POPUP_POSITIONS[popoverModel.position])
2999
- throw new Error("DrPopover does not support the '" + (popoverModel === null || popoverModel === void 0 ? void 0 : popoverModel.position) + "' position!");
3000
- var config = Object.assign(Object.assign({}, DEFAULT_CONFIG), popoverModel.overlayConfig || {});
3001
- var hostElement = this.getHostElement(popoverModel.hostRef);
3002
- var positionStrategy = this.overlayPositionBuilder
3003
- .flexibleConnectedTo(popoverModel.hostRef)
3004
- .withPositions([POPUP_POSITIONS[popoverModel.position]]);
3005
- var overlayConfig = new i1.OverlayConfig(Object.assign({ scrollStrategy: this.overlay.scrollStrategies.noop(), positionStrategy: positionStrategy }, config));
3006
- if (popoverModel.alignment === 'host' && hostElement) {
3007
- var alignmentDimension = getAlignmentDimension(popoverModel.position);
3008
- overlayConfig[alignmentDimension] = hostElement.getBoundingClientRect()[alignmentDimension];
3009
- }
3010
- return overlayConfig;
2875
+ DrDropdownDirective.prototype.elementClick = function () {
2876
+ this.openDropdown();
3011
2877
  };
3012
- DrPopoverService.prototype.createInjector = function (popoverRef) {
3013
- var injectionTokens = [
3014
- { provide: DrPopoverRef, useValue: popoverRef },
3015
- ];
3016
- return i0.Injector.create({ providers: injectionTokens, parent: this.injector });
2878
+ DrDropdownDirective.prototype.documentClick = function (e) {
2879
+ this.closeDropdown(e);
3017
2880
  };
3018
- DrPopoverService.prototype.registerListeners = function (popoverModel, overlayRef, popoverRef) {
3019
- var config = popoverModel.overlayConfig || {};
3020
- var targetElement = popoverModel.targetElement;
3021
- var hostElement = this.getHostElement(popoverModel.hostRef);
3022
- if ((config === null || config === void 0 ? void 0 : config.closeOnBackdropClick) && (config === null || config === void 0 ? void 0 : config.hasBackdrop)) {
3023
- overlayRef.backdropClick().subscribe(function () { return popoverRef.close(); });
3024
- }
3025
- if (targetElement) {
3026
- targetElement.addEventListener('mouseup', function () { return popoverRef.close(); }, { once: true });
2881
+ DrDropdownDirective.prototype.openDropdown = function () {
2882
+ var option = this.el.nativeElement.getBoundingClientRect();
2883
+ this._document.querySelectorAll('dr-dropdown').forEach(function (item) { return item.remove(); });
2884
+ if (this.contentCmpRef && this.contentCmpRef.destroyCbs) {
2885
+ this.contentCmpRef.destroy();
2886
+ this.contentCmpRef = null;
3027
2887
  }
3028
- if (popoverModel.alignment === 'host' && hostElement) {
3029
- var alignmentDimension_1 = getAlignmentDimension(popoverModel.position);
3030
- var resizeObserver_1 = new ResizeObserver(function (entries) {
3031
- entries.forEach(function (host) {
3032
- var _a;
3033
- return overlayRef.updateSize((_a = {}, _a[alignmentDimension_1] = host.target.getBoundingClientRect()[alignmentDimension_1], _a));
3034
- });
2888
+ else {
2889
+ this.service.destroy();
2890
+ this.showMenu({
2891
+ option: option,
2892
+ drDropdownInHover: this.drDropdownInHover,
2893
+ position: this.position,
2894
+ list: this.drDropdown,
2895
+ class: this.drDropdownClass
3035
2896
  });
3036
- resizeObserver_1.observe(hostElement);
3037
- popoverRef.onClose.pipe(operators.first()).subscribe(function () { return resizeObserver_1.unobserve(hostElement); });
3038
2897
  }
3039
2898
  };
3040
- DrPopoverService.prototype.getHostElement = function (hostRef) {
3041
- if (!hostRef || hostRef.x)
3042
- return null;
3043
- if (hostRef.nativeElement)
3044
- return hostRef.nativeElement;
3045
- return hostRef;
3046
- };
3047
- return DrPopoverService;
3048
- }());
3049
- DrPopoverService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function DrPopoverService_Factory() { return new DrPopoverService(i0__namespace.ɵɵinject(i1__namespace.Overlay), i0__namespace.ɵɵinject(i1__namespace.OverlayPositionBuilder), i0__namespace.ɵɵinject(i0__namespace.INJECTOR)); }, token: DrPopoverService, providedIn: "root" });
3050
- DrPopoverService.decorators = [
3051
- { type: i0.Injectable, args: [{
3052
- providedIn: 'root',
3053
- },] }
3054
- ];
3055
- DrPopoverService.ctorParameters = function () { return [
3056
- { type: i1.Overlay },
3057
- { type: i1.OverlayPositionBuilder },
3058
- { type: i0.Injector }
3059
- ]; };
3060
-
3061
- var DrPopoverDirective = /** @class */ (function () {
3062
- function DrPopoverDirective(elementRef, drPopoverService) {
3063
- this.elementRef = elementRef;
3064
- this.drPopoverService = drPopoverService;
3065
- this.contentContext = {};
3066
- this.position = 'bottom';
3067
- this.class = '';
3068
- this.overlayConfig = {};
3069
- this.manualClosing = { enabled: false };
3070
- this.popoverClose = new i0.EventEmitter();
3071
- this.showStateChange = new i0.EventEmitter();
3072
- }
3073
- DrPopoverDirective.prototype.togglePopover = function () {
3074
- if (this.popoverRef) {
3075
- this.closePopover();
3076
- }
3077
- else {
3078
- this.renderPopover();
3079
- this.showStateChange.emit({ isShown: !!this.popoverRef });
2899
+ DrDropdownDirective.prototype.closeDropdown = function (e) {
2900
+ var menuItem = e.target.classList;
2901
+ if (menuItem.contains('dr-dropdown__container__item') || menuItem.contains('dr-dropdown__container__item__text')) {
2902
+ return;
3080
2903
  }
3081
- };
3082
- DrPopoverDirective.prototype.closePopover = function (res) {
3083
- if (this.popoverRef) {
3084
- this.popoverRef.close(res);
3085
- this.popoverRef = null;
2904
+ var elems = this._document.querySelectorAll('dr-dropdown');
2905
+ if (!e.target.contains(this.el.nativeElement) && this.contentCmpRef || elems.length && !e.target.contains(this.el.nativeElement)) {
2906
+ setTimeout(function () { return elems.forEach(function (item) { return item.remove(); }); }, 100);
3086
2907
  }
3087
2908
  };
3088
- DrPopoverDirective.prototype.renderPopover = function () {
3089
- var _this = this;
3090
- var popoverRef = this.popoverRef = this.drPopoverService.open(this.content, {
3091
- hostRef: this.elementRef,
3092
- overlayConfig: this.overlayConfig,
3093
- class: this.class,
3094
- manualClosing: this.manualClosing,
3095
- position: this.position,
3096
- contentContext: this.contentContext,
3097
- alignment: this.alignment,
3098
- });
3099
- popoverRef.onClose.pipe(operators.first()).subscribe(function (res) {
3100
- _this.closePopover();
3101
- _this.popoverClose.emit(res);
3102
- _this.showStateChange.emit({ isShown: !!_this.popoverRef });
3103
- });
2909
+ DrDropdownDirective.prototype.showMenu = function (options) {
2910
+ var componentFactory;
2911
+ componentFactory = this.componentFactoryResolver.resolveComponentFactory(DrDropdownComponent);
2912
+ this.contentCmpRef = this.viewContainerRef.createComponent(componentFactory);
2913
+ this.service.addMenu = this.contentCmpRef;
2914
+ this._document.querySelector('nb-layout').appendChild(this.contentCmpRef.location.nativeElement);
2915
+ this.contentCmpRef.instance.options = options;
3104
2916
  };
3105
- DrPopoverDirective.prototype.ngOnDestroy = function () {
3106
- this.closePopover();
2917
+ DrDropdownDirective.prototype.ngOnDestroy = function () {
2918
+ if (this.contentCmpRef) {
2919
+ this.contentCmpRef.destroy();
2920
+ }
3107
2921
  };
3108
- return DrPopoverDirective;
2922
+ return DrDropdownDirective;
3109
2923
  }());
3110
- DrPopoverDirective.decorators = [
2924
+ DrDropdownDirective.decorators = [
3111
2925
  { type: i0.Directive, args: [{
3112
- selector: '[drPopover]'
2926
+ selector: '[drDropdown]'
3113
2927
  },] }
3114
2928
  ];
3115
- DrPopoverDirective.ctorParameters = function () { return [
2929
+ DrDropdownDirective.ctorParameters = function () { return [
2930
+ { type: i0.ComponentFactoryResolver },
2931
+ { type: i0.ViewContainerRef },
2932
+ { type: DrDropdownService },
3116
2933
  { type: i0.ElementRef },
3117
- { type: DrPopoverService }
2934
+ { type: undefined, decorators: [{ type: i0.Inject, args: [common.DOCUMENT,] }] }
3118
2935
  ]; };
3119
- DrPopoverDirective.propDecorators = {
3120
- content: [{ type: i0.Input, args: ['drPopover',] }],
3121
- contentContext: [{ type: i0.Input, args: ['drPopoverContext',] }],
3122
- position: [{ type: i0.Input, args: ['drPopoverPosition',] }],
3123
- class: [{ type: i0.Input, args: ['drPopoverClass',] }],
3124
- overlayConfig: [{ type: i0.Input, args: ['drPopoverOverlayConfig',] }],
3125
- manualClosing: [{ type: i0.Input, args: ['drPopoverManualClosing',] }],
3126
- alignment: [{ type: i0.Input, args: ['drPopoverAlignment',] }],
3127
- popoverClose: [{ type: i0.Output, args: ['drPopoverClose',] }],
3128
- showStateChange: [{ type: i0.Output, args: ['drPopoverShowStateChange',] }],
3129
- togglePopover: [{ type: i0.HostListener, args: ['click',] }]
2936
+ DrDropdownDirective.propDecorators = {
2937
+ position: [{ type: i0.Input }],
2938
+ drDropdown: [{ type: i0.Input }],
2939
+ drDropdownClass: [{ type: i0.Input }],
2940
+ drDropdownInHover: [{ type: i0.Input }],
2941
+ contentCmpRef: [{ type: i0.ViewChild, args: [DrDropdownComponent, { static: true, read: i0.ViewContainerRef },] }],
2942
+ elementHover: [{ type: i0.HostListener, args: ['mouseenter',] }],
2943
+ elementClick: [{ type: i0.HostListener, args: ['click',] }],
2944
+ documentClick: [{ type: i0.HostListener, args: ['document:mouseup', ['$event'],] }]
3130
2945
  };
3131
2946
 
3132
- var DrDropdownService = /** @class */ (function () {
3133
- function DrDropdownService() {
3134
- this.actionItem = new rxjs.Subject();
2947
+ var DrDropdownPositionDirective = /** @class */ (function () {
2948
+ function DrDropdownPositionDirective(el, renderer) {
2949
+ this.el = el;
2950
+ this.renderer = renderer;
2951
+ this.position = 'left';
3135
2952
  }
3136
- Object.defineProperty(DrDropdownService.prototype, "addMenu", {
3137
- set: function (item) {
3138
- this.menuInView = item;
3139
- },
3140
- enumerable: false,
3141
- configurable: true
3142
- });
3143
- DrDropdownService.prototype.destroy = function () {
3144
- if (this.menuInView) {
3145
- this.menuInView.destroy();
3146
- }
3147
- };
3148
- return DrDropdownService;
3149
- }());
3150
- DrDropdownService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function DrDropdownService_Factory() { return new DrDropdownService(); }, token: DrDropdownService, providedIn: "root" });
3151
- DrDropdownService.decorators = [
3152
- { type: i0.Injectable, args: [{
3153
- providedIn: 'root'
3154
- },] }
3155
- ];
3156
- DrDropdownService.ctorParameters = function () { return []; };
3157
-
3158
- var DrDropdownComponent = /** @class */ (function () {
3159
- function DrDropdownComponent(menuService, cdr) {
3160
- this.menuService = menuService;
3161
- this.cdr = cdr;
3162
- this.position = 'left';
3163
- }
3164
- Object.defineProperty(DrDropdownComponent.prototype, "options", {
3165
- set: function (data) {
3166
- if (data) {
3167
- this.option = data.option;
3168
- this.position = data.position;
3169
- this.drDropdownInHover = data.drDropdownInHover;
3170
- this.containerClass = data.class;
3171
- this.list = data.list || [];
3172
- this.list.forEach(function (item) {
3173
- var _a, _b;
3174
- if ((_a = item.children) === null || _a === void 0 ? void 0 : _a.length) {
3175
- item.childOptions = {
3176
- list: item.children,
3177
- class: ((_b = item === null || item === void 0 ? void 0 : item.childOptions) === null || _b === void 0 ? void 0 : _b.class) || '',
3178
- position: 'child'
3179
- };
3180
- }
3181
- });
3182
- this.cdr.markForCheck();
3183
- }
3184
- },
3185
- enumerable: false,
3186
- configurable: true
3187
- });
3188
- DrDropdownComponent.prototype.onMouseLeave = function () {
3189
- if (this.drDropdownInHover)
3190
- this.menuService.destroy();
3191
- };
3192
- DrDropdownComponent.prototype.onClickedOutside = function () {
3193
- if (this.firstInit) {
3194
- this.menuService.destroy();
3195
- }
3196
- else {
3197
- this.firstInit = true;
3198
- }
3199
- };
3200
- DrDropdownComponent.prototype.hide = function () {
3201
- this.menuService.destroy();
3202
- };
3203
- DrDropdownComponent.prototype.disabled = function (act) {
3204
- if (!act.disabled) {
3205
- return false;
3206
- }
3207
- if (typeof act.disabled === 'boolean') {
3208
- return act.disabled;
3209
- }
3210
- else {
3211
- return act.disabled(act.data);
3212
- }
3213
- };
3214
- DrDropdownComponent.prototype.selected = function (act) {
3215
- if (!act.selected) {
3216
- return false;
3217
- }
3218
- if (typeof act.selected === 'boolean') {
3219
- return act.selected;
3220
- }
3221
- else {
3222
- return act.selected(act.data);
3223
- }
3224
- };
3225
- DrDropdownComponent.prototype.tooltipToShow = function (act) {
3226
- if (act.toolTipIfDisabled && !this.disabled(act))
3227
- return '';
3228
- return act.toolTip;
3229
- };
3230
- DrDropdownComponent.prototype.tooltipPosition = function (widthMoreRight) {
3231
- return widthMoreRight ? 'right' : 'left';
3232
- };
3233
- DrDropdownComponent.prototype.action = function (act) {
3234
- if (!this.disabled(act)) {
3235
- if (act.action) {
3236
- act.action(act.data);
3237
- }
3238
- else {
3239
- this.menuService.actionItem.next({ event: act.event || act.title || 'default', data: act.data });
3240
- }
3241
- this.hide();
3242
- }
3243
- };
3244
- DrDropdownComponent.prototype.onActionIconClick = function ($event, actionIcon, data) {
3245
- $event.stopPropagation();
3246
- if (!this.disabled(actionIcon)) {
3247
- actionIcon.action(data);
3248
- this.hide();
3249
- }
3250
- };
3251
- return DrDropdownComponent;
3252
- }());
3253
- DrDropdownComponent.decorators = [
3254
- { type: i0.Component, args: [{
3255
- selector: 'dr-dropdown',
3256
- template: "<div #menuContainer\n (mouseleave)=\"onMouseLeave()\"\n (clickOutside)=\"onClickedOutside()\"\n [drDropdownPosition]=\"option\"\n #dropdownPosition=\"dropdownPosition\"\n [position]=\"position\"\n [class]=\"containerClass\"\n class=\"dr-dropdown\">\n <div class=\"dr-dropdown__container\">\n <div *ngFor=\"let act of list | drDropdownItemShowPipe\"\n (click)=\"action(act)\"\n [drTooltip]=\"tooltipToShow(act)\"\n [drTooltipPosition]=\"tooltipPosition(dropdownPosition.widthMoreRight)\"\n [drTooltipOptions]=\"{ withoutArrow: true }\"\n [drTooltipClass]=\"'dr-dropdown__tooltip'\"\n class=\"dr-dropdown__container__item\"\n [class.item-disabled]=\"disabled(act)\"\n [class.item-selected]=\"selected(act)\">\n <i *ngIf=\"act.icon\" [class]=\"act.icon\"></i>\n <span class=\"dr-dropdown__container__item__text\">{{act.title}}</span>\n <i *ngFor=\"let actionIcon of act.actionIcons\"\n [class]=\"actionIcon.icon\"\n [class.showOnHover]=\"actionIcon.showOnHover\"\n (click)=\"onActionIconClick($event, actionIcon, act.data)\"></i>\n <i *ngIf=\"act.children?.length\" class=\"dr-icon-arrow-right\"></i>\n <dr-dropdown *ngIf=\"act.children?.length\" [options]=\"act.childOptions\"></dr-dropdown>\n </div>\n </div>\n</div>\n",
3257
- changeDetection: i0.ChangeDetectionStrategy.OnPush,
3258
- styles: ["::ng-deep .dr-dropdown__container__item .dr-dropdown{visibility:hidden;transition-delay:.2s}::ng-deep .dr-dropdown__container__item:hover>*>.dr-dropdown{visibility:visible;transition-delay:0s}::ng-deep .dr-dropdown__tooltip>.default-content{max-width:300px;white-space:normal!important}.dr-dropdown{position:absolute;z-index:-1;top:0;left:0;width:auto}.dr-dropdown__container{display:flex;flex-direction:column;background:#fff;border-radius:4px;box-shadow:0 4px 8px 1px #00000040;padding:8px 0;overflow-y:auto;max-height:60vh}.dr-dropdown__container__item{display:flex;align-items:center;justify-content:flex-start;cursor:pointer;min-width:15rem;font-style:normal;font-weight:400;font-size:14px;line-height:24px;clear:both;width:100%;white-space:nowrap;padding:0 12px;height:36px;flex-shrink:0}.dr-dropdown__container__item:hover{background-color:#f9faff}.dr-dropdown__container__item:hover .showOnHover{visibility:visible}.dr-dropdown__container__item.item-selected{background:#F3F7FF}.dr-dropdown__container__item.item-disabled,.dr-dropdown__container__item.item-disabled i,.dr-dropdown__container__item.item-disabled .dr-dropdown__container__item__text{color:#bcbcbc}.dr-dropdown__container__item i:first-child{margin-right:8px}.dr-dropdown__container__item__text{margin-right:auto;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.dr-dropdown__container__item i,.dr-dropdown__container__item__text{color:#151b3f}.dr-dropdown__container__item i{color:#4e566c}.dr-dropdown__container__item i:hover{color:#4646ce}.dr-dropdown__container__item .showOnHover{visibility:hidden}.dr-dropdown.content-top{transform:translate(-50%,-100%)}.dr-dropdown.content-top-left{transform:translate(-100%,-100%)}.dr-dropdown.content-bottom{transform:translate(-50%,50%)}.dr-dropdown.content-bottom-left{transform:translate(-90%,35%)}.dr-dropdown.content-bottom-right{transform:translateY(15%)}.dr-dropdown.content-left{transform:translate(-100%)}.dr-dropdown.content-left-center{transform:translate(-100%,-50%)}.dr-dropdown.content-right{transform:translate(5%)}\n"]
3259
- },] }
3260
- ];
3261
- DrDropdownComponent.ctorParameters = function () { return [
3262
- { type: DrDropdownService },
3263
- { type: i0.ChangeDetectorRef }
3264
- ]; };
3265
- DrDropdownComponent.propDecorators = {
3266
- viewMenu: [{ type: i0.ViewChild, args: ['listMenu',] }],
3267
- menuContainer: [{ type: i0.ViewChild, args: ['menuContainer',] }],
3268
- options: [{ type: i0.Input }]
3269
- };
3270
-
3271
- var DrDropdownDirective = /** @class */ (function () {
3272
- function DrDropdownDirective(componentFactoryResolver, viewContainerRef, service, el, _document) {
3273
- this.componentFactoryResolver = componentFactoryResolver;
3274
- this.viewContainerRef = viewContainerRef;
3275
- this.service = service;
3276
- this.el = el;
3277
- this._document = _document;
3278
- this.position = 'left';
3279
- }
3280
- DrDropdownDirective.prototype.elementHover = function () {
3281
- if (!this.drDropdownInHover)
3282
- return;
3283
- this.openDropdown();
3284
- };
3285
- DrDropdownDirective.prototype.elementClick = function () {
3286
- this.openDropdown();
3287
- };
3288
- DrDropdownDirective.prototype.documentClick = function (e) {
3289
- this.closeDropdown(e);
3290
- };
3291
- DrDropdownDirective.prototype.openDropdown = function () {
3292
- var option = this.el.nativeElement.getBoundingClientRect();
3293
- this._document.querySelectorAll('dr-dropdown').forEach(function (item) { return item.remove(); });
3294
- if (this.contentCmpRef && this.contentCmpRef.destroyCbs) {
3295
- this.contentCmpRef.destroy();
3296
- this.contentCmpRef = null;
3297
- }
3298
- else {
3299
- this.service.destroy();
3300
- this.showMenu({
3301
- option: option,
3302
- drDropdownInHover: this.drDropdownInHover,
3303
- position: this.position,
3304
- list: this.drDropdown,
3305
- class: this.drDropdownClass
3306
- });
3307
- }
3308
- };
3309
- DrDropdownDirective.prototype.closeDropdown = function (e) {
3310
- var menuItem = e.target.classList;
3311
- if (menuItem.contains('dr-dropdown__container__item') || menuItem.contains('dr-dropdown__container__item__text')) {
3312
- return;
3313
- }
3314
- var elems = this._document.querySelectorAll('dr-dropdown');
3315
- if (!e.target.contains(this.el.nativeElement) && this.contentCmpRef || elems.length && !e.target.contains(this.el.nativeElement)) {
3316
- setTimeout(function () { return elems.forEach(function (item) { return item.remove(); }); }, 100);
3317
- }
3318
- };
3319
- DrDropdownDirective.prototype.showMenu = function (options) {
3320
- var componentFactory;
3321
- componentFactory = this.componentFactoryResolver.resolveComponentFactory(DrDropdownComponent);
3322
- this.contentCmpRef = this.viewContainerRef.createComponent(componentFactory);
3323
- this.service.addMenu = this.contentCmpRef;
3324
- this._document.querySelector('nb-layout').appendChild(this.contentCmpRef.location.nativeElement);
3325
- this.contentCmpRef.instance.options = options;
3326
- };
3327
- DrDropdownDirective.prototype.ngOnDestroy = function () {
3328
- if (this.contentCmpRef) {
3329
- this.contentCmpRef.destroy();
3330
- }
3331
- };
3332
- return DrDropdownDirective;
3333
- }());
3334
- DrDropdownDirective.decorators = [
3335
- { type: i0.Directive, args: [{
3336
- selector: '[drDropdown]'
3337
- },] }
3338
- ];
3339
- DrDropdownDirective.ctorParameters = function () { return [
3340
- { type: i0.ComponentFactoryResolver },
3341
- { type: i0.ViewContainerRef },
3342
- { type: DrDropdownService },
3343
- { type: i0.ElementRef },
3344
- { type: undefined, decorators: [{ type: i0.Inject, args: [common.DOCUMENT,] }] }
3345
- ]; };
3346
- DrDropdownDirective.propDecorators = {
3347
- position: [{ type: i0.Input }],
3348
- drDropdown: [{ type: i0.Input }],
3349
- drDropdownClass: [{ type: i0.Input }],
3350
- drDropdownInHover: [{ type: i0.Input }],
3351
- contentCmpRef: [{ type: i0.ViewChild, args: [DrDropdownComponent, { static: true, read: i0.ViewContainerRef },] }],
3352
- elementHover: [{ type: i0.HostListener, args: ['mouseenter',] }],
3353
- elementClick: [{ type: i0.HostListener, args: ['click',] }],
3354
- documentClick: [{ type: i0.HostListener, args: ['document:mouseup', ['$event'],] }]
3355
- };
3356
-
3357
- var DrDropdownPositionDirective = /** @class */ (function () {
3358
- function DrDropdownPositionDirective(el, renderer) {
3359
- this.el = el;
3360
- this.renderer = renderer;
3361
- this.position = 'left';
3362
- }
3363
- DrDropdownPositionDirective.prototype.ngOnInit = function () {
3364
- setTimeout(this.calculatePosition.bind(this), 1);
2953
+ DrDropdownPositionDirective.prototype.ngOnInit = function () {
2954
+ setTimeout(this.calculatePosition.bind(this), 1);
3365
2955
  };
3366
2956
  DrDropdownPositionDirective.prototype.calculatePosition = function () {
3367
2957
  var xDifference = 0;
@@ -3439,510 +3029,1039 @@
3439
3029
  this.renderer.setStyle(this.el.nativeElement, 'z-index', '10010');
3440
3030
  }
3441
3031
  };
3442
- return DrDropdownPositionDirective;
3032
+ return DrDropdownPositionDirective;
3033
+ }());
3034
+ DrDropdownPositionDirective.decorators = [
3035
+ { type: i0.Directive, args: [{
3036
+ selector: '[drDropdownPosition]',
3037
+ exportAs: 'dropdownPosition'
3038
+ },] }
3039
+ ];
3040
+ DrDropdownPositionDirective.ctorParameters = function () { return [
3041
+ { type: i0.ElementRef },
3042
+ { type: i0.Renderer2 }
3043
+ ]; };
3044
+ DrDropdownPositionDirective.propDecorators = {
3045
+ drDropdownPosition: [{ type: i0.Input }],
3046
+ position: [{ type: i0.Input }]
3047
+ };
3048
+
3049
+ var DrDropdownItemShowPipe = /** @class */ (function () {
3050
+ function DrDropdownItemShowPipe() {
3051
+ }
3052
+ DrDropdownItemShowPipe.prototype.transform = function (arr) {
3053
+ return arr.filter(function (item) { return item.show ? item.show(item.data) : true; });
3054
+ };
3055
+ return DrDropdownItemShowPipe;
3056
+ }());
3057
+ DrDropdownItemShowPipe.decorators = [
3058
+ { type: i0.Pipe, args: [{
3059
+ name: 'drDropdownItemShowPipe'
3060
+ },] }
3061
+ ];
3062
+
3063
+ var DrTabComponent = /** @class */ (function () {
3064
+ function DrTabComponent() {
3065
+ }
3066
+ DrTabComponent.prototype.ngOnInit = function () {
3067
+ };
3068
+ return DrTabComponent;
3069
+ }());
3070
+ DrTabComponent.decorators = [
3071
+ { type: i0.Component, args: [{
3072
+ selector: 'dr-tab',
3073
+ template: "\n <ng-template>\n <ng-content></ng-content>\n </ng-template>\n "
3074
+ },] }
3075
+ ];
3076
+ DrTabComponent.ctorParameters = function () { return []; };
3077
+ DrTabComponent.propDecorators = {
3078
+ label: [{ type: i0.Input }],
3079
+ disabled: [{ type: i0.Input }],
3080
+ contentTemplate: [{ type: i0.ViewChild, args: [i0.TemplateRef,] }]
3081
+ };
3082
+
3083
+ var DrTabsComponent = /** @class */ (function () {
3084
+ function DrTabsComponent() {
3085
+ this.selectedTab = 0;
3086
+ this.selectedTabChange = new i0.EventEmitter();
3087
+ }
3088
+ DrTabsComponent.prototype.selectedIndexChange = function ($event) {
3089
+ this.selectedTab = $event;
3090
+ this.selectedTabChange.emit($event);
3091
+ };
3092
+ return DrTabsComponent;
3093
+ }());
3094
+ DrTabsComponent.decorators = [
3095
+ { type: i0.Component, args: [{
3096
+ selector: 'dr-tabs',
3097
+ template: "<mat-tab-group disableRipple [selectedIndex]=\"selectedTab\"\n (selectedIndexChange)=\"selectedIndexChange($event)\"\n [class.with-radio]=\"withRadio\"\n [class.vertical]=\"vertical\"\n [animationDuration]=\" vertical ? '0ms' : '500ms'\">\n <mat-tab *ngFor=\"let tab of tabsContentList; let index = index\" label=\"{{tab.label}}\" [disabled]=\"tab.disabled\" >\n <ng-container *ngIf=\"withRadio\">\n <ng-template mat-tab-label>\n <dr-radio-button [value]=\"index\"\n [(ngModel)]=\"selectedTab\">\n </dr-radio-button>\n {{tab.label}}\n </ng-template>\n </ng-container>\n\n <ng-container *ngTemplateOutlet=\"tab.contentTemplate\" ></ng-container>\n </mat-tab>\n</mat-tab-group>\n",
3098
+ styles: [":host{width:100%}:host ::ng-deep .mat-tab-group,:host ::ng-deep .mat-tab-body-wrapper{height:100%}:host ::ng-deep .mat-tab-nav-bar,:host ::ng-deep .mat-tab-header{border-bottom:1px solid #D5DAE5}:host ::ng-deep .mat-tab-labels{padding:0 17px}:host ::ng-deep .mat-tab-label{padding:0 8px;min-width:0;height:38px;opacity:1}:host ::ng-deep .mat-tab-label:not(:last-child){margin-right:21px}:host ::ng-deep .mat-tab-label-active .mat-tab-label-content{color:#579bf2;font-weight:700}:host ::ng-deep .mat-tab-label-content{font-weight:400;font-size:14px;line-height:22px;color:#51566f;font-family:\"Poppins\",sans-serif}:host ::ng-deep .mat-ink-bar{height:3px;border-radius:5px;background-color:#579bf2!important}:host ::ng-deep .with-radio .mat-tab-labels{padding:0;margin-bottom:8px}:host ::ng-deep .with-radio .mat-tab-label{padding:8px 16px;min-width:0;flex-grow:1;justify-content:start;height:38px;opacity:1}:host ::ng-deep .with-radio .mat-tab-label:not(:last-child){margin-right:8px}:host ::ng-deep .with-radio .mat-tab-label-active{background:#F6F7F8;border-radius:3px}:host ::ng-deep .with-radio .mat-tab-label-active .mat-tab-label-content{color:#0c142b;font-weight:600}:host ::ng-deep .with-radio .mat-ink-bar{display:none!important}:host ::ng-deep .vertical.mat-tab-group{flex-direction:row}:host ::ng-deep .vertical .mat-tab-header{border-bottom:none}:host ::ng-deep .vertical .mat-tab-labels{flex-direction:column;padding:0;border-right:1px solid #D5DAE5}:host ::ng-deep .vertical .mat-ink-bar{display:none!important}:host ::ng-deep .vertical .mat-tab-label{border-bottom:1px solid #D5DAE5;margin:0!important}:host ::ng-deep .vertical .mat-tab-label:before{content:\"\";width:2px;height:100%;display:flex;position:absolute;top:0;left:0}:host ::ng-deep .vertical .mat-tab-label-active{background-color:#f3f7ff}:host ::ng-deep .vertical .mat-tab-label-active:before{background-color:#151a41}:host ::ng-deep .vertical .mat-tab-label-active .mat-tab-label-content{font-weight:normal;color:#151a41}:host ::ng-deep .vertical .mat-tab-body-wrapper{width:100%;padding:16px}\n"]
3099
+ },] }
3100
+ ];
3101
+ DrTabsComponent.ctorParameters = function () { return []; };
3102
+ DrTabsComponent.propDecorators = {
3103
+ selectedTab: [{ type: i0.Input }],
3104
+ withRadio: [{ type: i0.Input }],
3105
+ vertical: [{ type: i0.Input }],
3106
+ selectedTabChange: [{ type: i0.Output }],
3107
+ tabsContentList: [{ type: i0.ContentChildren, args: [DrTabComponent,] }]
3108
+ };
3109
+
3110
+ var DrAccordionComponent = /** @class */ (function () {
3111
+ function DrAccordionComponent() {
3112
+ this.openCloseItems = new rxjs.Subject();
3113
+ this.multiValue = false;
3114
+ }
3115
+ Object.defineProperty(DrAccordionComponent.prototype, "multi", {
3116
+ /**
3117
+ * Allow multiple items to be expanded at the same time.
3118
+ */
3119
+ get: function () {
3120
+ return this.multiValue;
3121
+ },
3122
+ set: function (val) {
3123
+ this.multiValue = !!val;
3124
+ },
3125
+ enumerable: false,
3126
+ configurable: true
3127
+ });
3128
+ /**
3129
+ * Opens all enabled accordion items.
3130
+ */
3131
+ DrAccordionComponent.prototype.openAll = function () {
3132
+ if (this.multi) {
3133
+ this.openCloseItems.next(false);
3134
+ }
3135
+ };
3136
+ /**
3137
+ * Closes all enabled accordion items.
3138
+ */
3139
+ DrAccordionComponent.prototype.closeAll = function () {
3140
+ this.openCloseItems.next(true);
3141
+ };
3142
+ return DrAccordionComponent;
3143
+ }());
3144
+ DrAccordionComponent.decorators = [
3145
+ { type: i0.Component, args: [{
3146
+ selector: 'dr-accordion',
3147
+ template: '<ng-content select="dr-accordion-item"></ng-content>',
3148
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
3149
+ styles: [":host{display:block;box-shadow:#2c33491a 0 5px 10px}\n"]
3150
+ },] }
3151
+ ];
3152
+ DrAccordionComponent.propDecorators = {
3153
+ multi: [{ type: i0.Input, args: ['multi',] }]
3154
+ };
3155
+
3156
+ var DrAccordionItemComponent = /** @class */ (function () {
3157
+ function DrAccordionItemComponent(accordion, cd) {
3158
+ this.accordion = accordion;
3159
+ this.cd = cd;
3160
+ /**
3161
+ * Emits whenever the expanded state of the accordion changes.
3162
+ * Primarily used to facilitate two-way binding.
3163
+ */
3164
+ this.collapsedChange = new i0.EventEmitter();
3165
+ this.accordionItemInvalidate = new rxjs.Subject();
3166
+ this.collapsedValue = true;
3167
+ this.disabledValue = false;
3168
+ this.destroy$ = new rxjs.Subject();
3169
+ }
3170
+ Object.defineProperty(DrAccordionItemComponent.prototype, "collapsed", {
3171
+ /**
3172
+ * Item is collapse (`true` by default)
3173
+ * @type {boolean}
3174
+ */
3175
+ get: function () {
3176
+ return this.collapsedValue;
3177
+ },
3178
+ set: function (val) {
3179
+ this.collapsedValue = !!val;
3180
+ this.collapsedChange.emit(this.collapsedValue);
3181
+ this.invalidate();
3182
+ },
3183
+ enumerable: false,
3184
+ configurable: true
3185
+ });
3186
+ Object.defineProperty(DrAccordionItemComponent.prototype, "expanded", {
3187
+ /**
3188
+ * Item is expanded (`false` by default)
3189
+ */
3190
+ get: function () {
3191
+ return !this.collapsed;
3192
+ },
3193
+ set: function (val) {
3194
+ this.collapsedValue = !val;
3195
+ },
3196
+ enumerable: false,
3197
+ configurable: true
3198
+ });
3199
+ Object.defineProperty(DrAccordionItemComponent.prototype, "disabled", {
3200
+ /**
3201
+ * Item is disabled and cannot be opened.
3202
+ * @type {boolean}
3203
+ */
3204
+ get: function () {
3205
+ return this.disabledValue;
3206
+ },
3207
+ set: function (val) {
3208
+ this.disabledValue = !!val;
3209
+ this.invalidate();
3210
+ },
3211
+ enumerable: false,
3212
+ configurable: true
3213
+ });
3214
+ /**
3215
+ * Open/close the item
3216
+ */
3217
+ DrAccordionItemComponent.prototype.toggle = function () {
3218
+ if (!this.disabled) {
3219
+ // we need this temporary variable as `openCloseItems.next` will change current value we need to save
3220
+ var willSet = !this.collapsed;
3221
+ if (!this.accordion.multi) {
3222
+ this.accordion.openCloseItems.next(true);
3223
+ }
3224
+ this.collapsed = willSet;
3225
+ }
3226
+ };
3227
+ /**
3228
+ * Open the item.
3229
+ */
3230
+ DrAccordionItemComponent.prototype.open = function () {
3231
+ if (!this.disabled) {
3232
+ this.collapsed = false;
3233
+ }
3234
+ };
3235
+ /**
3236
+ * Collapse the item.
3237
+ */
3238
+ DrAccordionItemComponent.prototype.close = function () {
3239
+ if (!this.disabled) {
3240
+ this.collapsed = true;
3241
+ }
3242
+ };
3243
+ DrAccordionItemComponent.prototype.ngOnInit = function () {
3244
+ var _this = this;
3245
+ this.accordion.openCloseItems
3246
+ .pipe(operators.takeUntil(this.destroy$))
3247
+ .subscribe(function (collapsed) {
3248
+ if (!_this.disabled) {
3249
+ _this.collapsed = collapsed;
3250
+ }
3251
+ });
3252
+ };
3253
+ DrAccordionItemComponent.prototype.ngOnChanges = function (changes) {
3254
+ this.accordionItemInvalidate.next(true);
3255
+ };
3256
+ DrAccordionItemComponent.prototype.ngOnDestroy = function () {
3257
+ this.destroy$.next();
3258
+ this.destroy$.complete();
3259
+ this.accordionItemInvalidate.complete();
3260
+ };
3261
+ DrAccordionItemComponent.prototype.invalidate = function () {
3262
+ this.accordionItemInvalidate.next(true);
3263
+ this.cd.markForCheck();
3264
+ };
3265
+ return DrAccordionItemComponent;
3266
+ }());
3267
+ DrAccordionItemComponent.decorators = [
3268
+ { type: i0.Component, args: [{
3269
+ selector: 'dr-accordion-item',
3270
+ template: "\n <ng-content select=\"dr-accordion-item-header\"></ng-content>\n <ng-content select=\"dr-accordion-item-body\"></ng-content>\n ",
3271
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
3272
+ styles: [":host{background-color:#fff;color:#222b45;font-family:\"Poppins\",sans-serif;font-size:16px;font-weight:400;line-height:1.25rem;display:flex;flex-direction:column}\n"]
3273
+ },] }
3274
+ ];
3275
+ DrAccordionItemComponent.ctorParameters = function () { return [
3276
+ { type: DrAccordionComponent, decorators: [{ type: i0.Host }] },
3277
+ { type: i0.ChangeDetectorRef }
3278
+ ]; };
3279
+ DrAccordionItemComponent.propDecorators = {
3280
+ collapsed: [{ type: i0.Input, args: ['collapsed',] }, { type: i0.HostBinding, args: ['class.collapsed',] }],
3281
+ expanded: [{ type: i0.Input, args: ['expanded',] }, { type: i0.HostBinding, args: ['class.expanded',] }],
3282
+ disabled: [{ type: i0.Input, args: ['disabled',] }, { type: i0.HostBinding, args: ['class.disabled',] }],
3283
+ collapsedChange: [{ type: i0.Output }]
3284
+ };
3285
+
3286
+ var DrAccordionItemHeaderComponent = /** @class */ (function () {
3287
+ function DrAccordionItemHeaderComponent(accordionItem, cd) {
3288
+ this.accordionItem = accordionItem;
3289
+ this.cd = cd;
3290
+ this.destroy$ = new rxjs.Subject();
3291
+ }
3292
+ Object.defineProperty(DrAccordionItemHeaderComponent.prototype, "isCollapsed", {
3293
+ get: function () {
3294
+ return this.accordionItem.collapsed;
3295
+ },
3296
+ enumerable: false,
3297
+ configurable: true
3298
+ });
3299
+ Object.defineProperty(DrAccordionItemHeaderComponent.prototype, "expanded", {
3300
+ get: function () {
3301
+ return !this.accordionItem.collapsed;
3302
+ },
3303
+ enumerable: false,
3304
+ configurable: true
3305
+ });
3306
+ Object.defineProperty(DrAccordionItemHeaderComponent.prototype, "tabbable", {
3307
+ get: function () {
3308
+ return this.accordionItem.disabled ? '-1' : '0';
3309
+ },
3310
+ enumerable: false,
3311
+ configurable: true
3312
+ });
3313
+ Object.defineProperty(DrAccordionItemHeaderComponent.prototype, "disabled", {
3314
+ get: function () {
3315
+ return this.accordionItem.disabled;
3316
+ },
3317
+ enumerable: false,
3318
+ configurable: true
3319
+ });
3320
+ DrAccordionItemHeaderComponent.prototype.toggle = function () {
3321
+ this.accordionItem.toggle();
3322
+ };
3323
+ Object.defineProperty(DrAccordionItemHeaderComponent.prototype, "state", {
3324
+ get: function () {
3325
+ if (this.isCollapsed) {
3326
+ return 'collapsed';
3327
+ }
3328
+ return 'expanded';
3329
+ },
3330
+ enumerable: false,
3331
+ configurable: true
3332
+ });
3333
+ DrAccordionItemHeaderComponent.prototype.ngOnInit = function () {
3334
+ var _this = this;
3335
+ this.accordionItem.accordionItemInvalidate
3336
+ .pipe(operators.takeUntil(this.destroy$))
3337
+ .subscribe(function () { return _this.cd.markForCheck(); });
3338
+ };
3339
+ DrAccordionItemHeaderComponent.prototype.ngOnDestroy = function () {
3340
+ this.destroy$.next();
3341
+ this.destroy$.complete();
3342
+ };
3343
+ return DrAccordionItemHeaderComponent;
3344
+ }());
3345
+ DrAccordionItemHeaderComponent.decorators = [
3346
+ { type: i0.Component, args: [{
3347
+ selector: 'dr-accordion-item-header',
3348
+ template: "\n <ng-content select=\"dr-accordion-item-title\"></ng-content>\n <ng-content select=\"dr-accordion-item-description\"></ng-content>\n <ng-content></ng-content>\n <i class=\"dr-icon-arrow-down expansion-indicator\"\n [@expansionIndicator]=\"state\"\n *ngIf=\"!disabled\">\n </i>\n ",
3349
+ animations: [
3350
+ animations.trigger('expansionIndicator', [
3351
+ animations.state('expanded', animations.style({
3352
+ transform: 'rotate(180deg)',
3353
+ })),
3354
+ animations.transition('collapsed => expanded', animations.animate('100ms ease-in')),
3355
+ animations.transition('expanded => collapsed', animations.animate('100ms ease-out')),
3356
+ ]),
3357
+ ],
3358
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
3359
+ styles: [":host{display:flex;align-items:center;cursor:pointer;position:relative;border-bottom:1px solid #edf1f7;color:#222b45;font-family:\"Poppins\",sans-serif;font-size:13px;font-weight:600;line-height:1.5rem;padding:1.25rem;text-transform:capitalize}:host:focus{outline:0}:host .expansion-indicator{font-size:24px;position:absolute;right:10px;font-weight:700}\n"]
3360
+ },] }
3361
+ ];
3362
+ DrAccordionItemHeaderComponent.ctorParameters = function () { return [
3363
+ { type: DrAccordionItemComponent, decorators: [{ type: i0.Host }] },
3364
+ { type: i0.ChangeDetectorRef }
3365
+ ]; };
3366
+ DrAccordionItemHeaderComponent.propDecorators = {
3367
+ isCollapsed: [{ type: i0.HostBinding, args: ['class.accordion-item-header-collapsed',] }],
3368
+ expanded: [{ type: i0.HostBinding, args: ['class.accordion-item-header-expanded',] }, { type: i0.HostBinding, args: ['attr.aria-expanded',] }],
3369
+ tabbable: [{ type: i0.HostBinding, args: ['attr.tabindex',] }],
3370
+ disabled: [{ type: i0.HostBinding, args: ['attr.aria-disabled',] }],
3371
+ toggle: [{ type: i0.HostListener, args: ['click',] }, { type: i0.HostListener, args: ['keydown.space',] }, { type: i0.HostListener, args: ['keydown.enter',] }]
3372
+ };
3373
+
3374
+ var accordionItemBodyTrigger = animations.trigger('accordionItemBody', [
3375
+ animations.state('collapsed', animations.style({
3376
+ overflow: 'hidden',
3377
+ visibility: 'hidden',
3378
+ height: 0,
3379
+ })),
3380
+ animations.state('expanded', animations.style({
3381
+ overflow: 'hidden',
3382
+ visibility: 'visible',
3383
+ })),
3384
+ animations.transition('collapsed => expanded', animations.animate('100ms ease-in')),
3385
+ animations.transition('expanded => collapsed', animations.animate('100ms ease-out')),
3386
+ ]);
3387
+ var DrAccordionItemBodyComponent = /** @class */ (function () {
3388
+ function DrAccordionItemBodyComponent(accordionItem, cd) {
3389
+ this.accordionItem = accordionItem;
3390
+ this.cd = cd;
3391
+ this.destroy$ = new rxjs.Subject();
3392
+ }
3393
+ Object.defineProperty(DrAccordionItemBodyComponent.prototype, "state", {
3394
+ get: function () {
3395
+ return this.accordionItem.collapsed ? 'collapsed' : 'expanded';
3396
+ },
3397
+ enumerable: false,
3398
+ configurable: true
3399
+ });
3400
+ DrAccordionItemBodyComponent.prototype.ngOnInit = function () {
3401
+ var _this = this;
3402
+ this.accordionItem.accordionItemInvalidate
3403
+ .pipe(operators.takeUntil(this.destroy$))
3404
+ .subscribe(function () { return _this.cd.markForCheck(); });
3405
+ };
3406
+ DrAccordionItemBodyComponent.prototype.ngOnDestroy = function () {
3407
+ this.destroy$.next();
3408
+ this.destroy$.complete();
3409
+ };
3410
+ return DrAccordionItemBodyComponent;
3411
+ }());
3412
+ DrAccordionItemBodyComponent.decorators = [
3413
+ { type: i0.Component, args: [{
3414
+ selector: 'dr-accordion-item-body',
3415
+ template: "\n <div [@accordionItemBody]=\"{ value: state }\">\n <div class=\"item-body\">\n <ng-content></ng-content>\n </div>\n </div>\n ",
3416
+ animations: [accordionItemBodyTrigger],
3417
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
3418
+ styles: [".item-body{flex:1;-ms-flex:1 1 auto;overflow:auto;position:relative}\n"]
3419
+ },] }
3420
+ ];
3421
+ DrAccordionItemBodyComponent.ctorParameters = function () { return [
3422
+ { type: DrAccordionItemComponent, decorators: [{ type: i0.Host }] },
3423
+ { type: i0.ChangeDetectorRef }
3424
+ ]; };
3425
+
3426
+ var DrModelDebounceChangeDirective = /** @class */ (function () {
3427
+ function DrModelDebounceChangeDirective(ngModel) {
3428
+ this.ngModel = ngModel;
3429
+ this.debounce = 200;
3430
+ this.ngModelDebounceChange = new i0.EventEmitter();
3431
+ }
3432
+ DrModelDebounceChangeDirective.prototype.ngOnInit = function () {
3433
+ var _this = this;
3434
+ this.subscription = this.ngModel.control.valueChanges
3435
+ .pipe(operators.skip(1), operators.debounceTime(this.debounce), operators.distinctUntilChanged())
3436
+ .subscribe(function (value) { return _this.ngModelDebounceChange.emit(value); });
3437
+ };
3438
+ DrModelDebounceChangeDirective.prototype.ngOnDestroy = function () {
3439
+ this.subscription.unsubscribe();
3440
+ };
3441
+ return DrModelDebounceChangeDirective;
3443
3442
  }());
3444
- DrDropdownPositionDirective.decorators = [
3443
+ DrModelDebounceChangeDirective.decorators = [
3445
3444
  { type: i0.Directive, args: [{
3446
- selector: '[drDropdownPosition]',
3447
- exportAs: 'dropdownPosition'
3445
+ selector: '[ngModelDebounceChange]'
3448
3446
  },] }
3449
3447
  ];
3450
- DrDropdownPositionDirective.ctorParameters = function () { return [
3451
- { type: i0.ElementRef },
3452
- { type: i0.Renderer2 }
3448
+ DrModelDebounceChangeDirective.ctorParameters = function () { return [
3449
+ { type: forms.NgModel }
3453
3450
  ]; };
3454
- DrDropdownPositionDirective.propDecorators = {
3455
- drDropdownPosition: [{ type: i0.Input }],
3456
- position: [{ type: i0.Input }]
3451
+ DrModelDebounceChangeDirective.propDecorators = {
3452
+ debounce: [{ type: i0.Input }],
3453
+ ngModelDebounceChange: [{ type: i0.Output }]
3457
3454
  };
3458
3455
 
3459
- var DrDropdownItemShowPipe = /** @class */ (function () {
3460
- function DrDropdownItemShowPipe() {
3456
+ var MAT_DEFAULT_DATE_FORMAT = 'MM/DD/yyyy';
3457
+ var DATE_INPUT_FORMAT = 'YYYY/MM/DD';
3458
+ var YEAR_FORMAT = 'yyyy';
3459
+ var MONTH_YEAR_FORMAT = 'MM/yyyy';
3460
+ var QUARTER_FORMAT = 'Q/yyyy';
3461
+ var CustomDateFormat = /** @class */ (function () {
3462
+ function CustomDateFormat() {
3463
+ this._parse = {
3464
+ dateInput: DATE_INPUT_FORMAT
3465
+ };
3466
+ this._display = {
3467
+ dateInput: DATE_INPUT_FORMAT,
3468
+ monthYearLabel: 'MMM YYYY',
3469
+ dateA11yLabel: 'LL',
3470
+ monthYearA11yLabel: 'MMM YYYY',
3471
+ quarterYearLabel: 'Q/YYYY',
3472
+ yearLabel: 'YYYY'
3473
+ };
3461
3474
  }
3462
- DrDropdownItemShowPipe.prototype.transform = function (arr) {
3463
- return arr.filter(function (item) { return item.show ? item.show(item.data) : true; });
3475
+ Object.defineProperty(CustomDateFormat.prototype, "parse", {
3476
+ get: function () {
3477
+ return this._parse;
3478
+ },
3479
+ set: function (parse) {
3480
+ this._parse = Object.assign({}, this._parse, parse);
3481
+ },
3482
+ enumerable: false,
3483
+ configurable: true
3484
+ });
3485
+ Object.defineProperty(CustomDateFormat.prototype, "display", {
3486
+ get: function () {
3487
+ return this._display;
3488
+ },
3489
+ set: function (display) {
3490
+ this._display = Object.assign({}, this._display, display);
3491
+ },
3492
+ enumerable: false,
3493
+ configurable: true
3494
+ });
3495
+ CustomDateFormat.prototype.updateDateFormat = function (parse, display) {
3496
+ this.parse = parse;
3497
+ if (!display) {
3498
+ display = parse;
3499
+ }
3500
+ this.display = display;
3464
3501
  };
3465
- return DrDropdownItemShowPipe;
3502
+ return CustomDateFormat;
3466
3503
  }());
3467
- DrDropdownItemShowPipe.decorators = [
3468
- { type: i0.Pipe, args: [{
3469
- name: 'drDropdownItemShowPipe'
3504
+ exports.DatePickerPeriodPosition = void 0;
3505
+ (function (DatePickerPeriodPosition) {
3506
+ DatePickerPeriodPosition[DatePickerPeriodPosition["END_OF_PERIOD"] = 0] = "END_OF_PERIOD";
3507
+ DatePickerPeriodPosition[DatePickerPeriodPosition["MIDDLE_OF_PERIOD"] = 1] = "MIDDLE_OF_PERIOD";
3508
+ DatePickerPeriodPosition[DatePickerPeriodPosition["START_OF_PERIOD"] = 2] = "START_OF_PERIOD";
3509
+ DatePickerPeriodPosition[DatePickerPeriodPosition["DEFAULT"] = 3] = "DEFAULT";
3510
+ })(exports.DatePickerPeriodPosition || (exports.DatePickerPeriodPosition = {}));
3511
+
3512
+ var components$2 = [DateTagComponent,
3513
+ DayTagComponent,
3514
+ WeekTagComponent,
3515
+ MonthTagComponent,
3516
+ QuarterTagComponent,
3517
+ AnyTagComponent,
3518
+ YearTagComponent,
3519
+ ForecastTagComponent];
3520
+ var ɵ0$1 = { useUtc: true };
3521
+ var DateTagModule = /** @class */ (function () {
3522
+ function DateTagModule() {
3523
+ }
3524
+ return DateTagModule;
3525
+ }());
3526
+ DateTagModule.decorators = [
3527
+ { type: i0.NgModule, args: [{
3528
+ imports: [
3529
+ common.CommonModule,
3530
+ core.MatNativeDateModule,
3531
+ datepicker.MatDatepickerModule,
3532
+ forms.FormsModule,
3533
+ formField.MatFormFieldModule,
3534
+ forms.ReactiveFormsModule,
3535
+ input.MatInputModule,
3536
+ materialMomentAdapter.MatMomentDateModule,
3537
+ select.MatSelectModule
3538
+ ],
3539
+ exports: components$2,
3540
+ providers: [
3541
+ { provide: materialMomentAdapter.MAT_MOMENT_DATE_ADAPTER_OPTIONS, useValue: ɵ0$1 }
3542
+ ],
3543
+ declarations: components$2,
3470
3544
  },] }
3471
3545
  ];
3546
+ ;
3472
3547
 
3473
- var DrTabComponent = /** @class */ (function () {
3474
- function DrTabComponent() {
3548
+ var ListTagModule = /** @class */ (function () {
3549
+ function ListTagModule() {
3475
3550
  }
3476
- DrTabComponent.prototype.ngOnInit = function () {
3477
- };
3478
- return DrTabComponent;
3551
+ return ListTagModule;
3479
3552
  }());
3480
- DrTabComponent.decorators = [
3481
- { type: i0.Component, args: [{
3482
- selector: 'dr-tab',
3483
- template: "\n <ng-template>\n <ng-content></ng-content>\n </ng-template>\n "
3553
+ ListTagModule.decorators = [
3554
+ { type: i0.NgModule, args: [{
3555
+ imports: [
3556
+ common.CommonModule,
3557
+ forms.FormsModule,
3558
+ formField.MatFormFieldModule,
3559
+ forms.ReactiveFormsModule,
3560
+ materialMomentAdapter.MatMomentDateModule,
3561
+ select.MatSelectModule,
3562
+ buttonToggle.MatButtonToggleModule,
3563
+ ],
3564
+ exports: [ListTagComponent],
3565
+ providers: [],
3566
+ declarations: [
3567
+ ListTagComponent
3568
+ ],
3484
3569
  },] }
3485
3570
  ];
3486
- DrTabComponent.ctorParameters = function () { return []; };
3487
- DrTabComponent.propDecorators = {
3488
- label: [{ type: i0.Input }],
3489
- disabled: [{ type: i0.Input }],
3490
- contentTemplate: [{ type: i0.ViewChild, args: [i0.TemplateRef,] }]
3491
- };
3492
3571
 
3493
- var DrTabsComponent = /** @class */ (function () {
3494
- function DrTabsComponent() {
3495
- this.selectedTab = 0;
3496
- this.selectedTabChange = new i0.EventEmitter();
3572
+ var DrTagModule = /** @class */ (function () {
3573
+ function DrTagModule() {
3497
3574
  }
3498
- DrTabsComponent.prototype.selectedIndexChange = function ($event) {
3499
- this.selectedTab = $event;
3500
- this.selectedTabChange.emit($event);
3501
- };
3502
- return DrTabsComponent;
3575
+ return DrTagModule;
3503
3576
  }());
3504
- DrTabsComponent.decorators = [
3505
- { type: i0.Component, args: [{
3506
- selector: 'dr-tabs',
3507
- template: "<mat-tab-group disableRipple [selectedIndex]=\"selectedTab\"\n (selectedIndexChange)=\"selectedIndexChange($event)\"\n [class.with-radio]=\"withRadio\"\n [class.vertical]=\"vertical\"\n [animationDuration]=\" vertical ? '0ms' : '500ms'\">\n <mat-tab *ngFor=\"let tab of tabsContentList; let index = index\" label=\"{{tab.label}}\" [disabled]=\"tab.disabled\" >\n <ng-container *ngIf=\"withRadio\">\n <ng-template mat-tab-label>\n <dr-radio-button [value]=\"index\"\n [(ngModel)]=\"selectedTab\">\n </dr-radio-button>\n {{tab.label}}\n </ng-template>\n </ng-container>\n\n <ng-container *ngTemplateOutlet=\"tab.contentTemplate\" ></ng-container>\n </mat-tab>\n</mat-tab-group>\n",
3508
- styles: [":host{width:100%}:host ::ng-deep .mat-tab-group,:host ::ng-deep .mat-tab-body-wrapper{height:100%}:host ::ng-deep .mat-tab-nav-bar,:host ::ng-deep .mat-tab-header{border-bottom:1px solid #D5DAE5}:host ::ng-deep .mat-tab-labels{padding:0 17px}:host ::ng-deep .mat-tab-label{padding:0 8px;min-width:0;height:38px;opacity:1}:host ::ng-deep .mat-tab-label:not(:last-child){margin-right:21px}:host ::ng-deep .mat-tab-label-active .mat-tab-label-content{color:#579bf2;font-weight:700}:host ::ng-deep .mat-tab-label-content{font-weight:400;font-size:14px;line-height:22px;color:#51566f;font-family:\"Poppins\",sans-serif}:host ::ng-deep .mat-ink-bar{height:3px;border-radius:5px;background-color:#579bf2!important}:host ::ng-deep .with-radio .mat-tab-labels{padding:0;margin-bottom:8px}:host ::ng-deep .with-radio .mat-tab-label{padding:8px 16px;min-width:0;flex-grow:1;justify-content:start;height:38px;opacity:1}:host ::ng-deep .with-radio .mat-tab-label:not(:last-child){margin-right:8px}:host ::ng-deep .with-radio .mat-tab-label-active{background:#F6F7F8;border-radius:3px}:host ::ng-deep .with-radio .mat-tab-label-active .mat-tab-label-content{color:#0c142b;font-weight:600}:host ::ng-deep .with-radio .mat-ink-bar{display:none!important}:host ::ng-deep .vertical.mat-tab-group{flex-direction:row}:host ::ng-deep .vertical .mat-tab-header{border-bottom:none}:host ::ng-deep .vertical .mat-tab-labels{flex-direction:column;padding:0;border-right:1px solid #D5DAE5}:host ::ng-deep .vertical .mat-ink-bar{display:none!important}:host ::ng-deep .vertical .mat-tab-label{border-bottom:1px solid #D5DAE5;margin:0!important}:host ::ng-deep .vertical .mat-tab-label:before{content:\"\";width:2px;height:100%;display:flex;position:absolute;top:0;left:0}:host ::ng-deep .vertical .mat-tab-label-active{background-color:#f3f7ff}:host ::ng-deep .vertical .mat-tab-label-active:before{background-color:#151a41}:host ::ng-deep .vertical .mat-tab-label-active .mat-tab-label-content{font-weight:normal;color:#151a41}:host ::ng-deep .vertical .mat-tab-body-wrapper{width:100%;padding:16px}\n"]
3577
+ DrTagModule.decorators = [
3578
+ { type: i0.NgModule, args: [{
3579
+ imports: [
3580
+ common.CommonModule,
3581
+ DateTagModule,
3582
+ ListTagModule
3583
+ ],
3584
+ exports: [DrTagComponent],
3585
+ providers: [],
3586
+ declarations: [
3587
+ DrTagComponent
3588
+ ],
3509
3589
  },] }
3510
3590
  ];
3511
- DrTabsComponent.ctorParameters = function () { return []; };
3512
- DrTabsComponent.propDecorators = {
3513
- selectedTab: [{ type: i0.Input }],
3514
- withRadio: [{ type: i0.Input }],
3515
- vertical: [{ type: i0.Input }],
3516
- selectedTabChange: [{ type: i0.Output }],
3517
- tabsContentList: [{ type: i0.ContentChildren, args: [DrTabComponent,] }]
3518
- };
3519
3591
 
3520
- var DrAccordionComponent = /** @class */ (function () {
3521
- function DrAccordionComponent() {
3522
- this.openCloseItems = new rxjs.Subject();
3523
- this.multiValue = false;
3592
+ var moment$2 = require('moment');
3593
+ var DrDatePickerService = /** @class */ (function () {
3594
+ function DrDatePickerService() {
3595
+ this.isTimeframeSelectionEnabled = false;
3596
+ this.timeframe = 'day';
3597
+ this.format$ = new rxjs.BehaviorSubject(MAT_DEFAULT_DATE_FORMAT);
3598
+ this.updatedQuarter$ = new rxjs.Subject();
3599
+ this.formatConfig = {
3600
+ day: MAT_DEFAULT_DATE_FORMAT,
3601
+ month: MONTH_YEAR_FORMAT,
3602
+ year: YEAR_FORMAT,
3603
+ quarter: QUARTER_FORMAT,
3604
+ };
3605
+ }
3606
+ DrDatePickerService.prototype.getQuarterDisplay = function (value) {
3607
+ return 'Q' + moment$2(value).quarter() + this.format$.getValue().charAt(1) + moment$2(value).year();
3608
+ };
3609
+ DrDatePickerService.prototype.getTimeframe = function (format) {
3610
+ var defaultFrame = 'day';
3611
+ if (!format) {
3612
+ return defaultFrame;
3613
+ }
3614
+ var lowerCaseFormat = format.toLowerCase();
3615
+ switch (true) {
3616
+ case lowerCaseFormat.includes('q'):
3617
+ return 'quarter';
3618
+ case lowerCaseFormat.includes('d'):
3619
+ return 'day';
3620
+ case lowerCaseFormat.includes('m'):
3621
+ return 'month';
3622
+ case lowerCaseFormat.includes('y'):
3623
+ return 'year';
3624
+ default:
3625
+ return defaultFrame;
3626
+ }
3627
+ };
3628
+ DrDatePickerService.prototype.getConfiguredFormat = function (timeframe) {
3629
+ return this.formatConfig[timeframe];
3630
+ };
3631
+ DrDatePickerService.prototype.updateTimeframeAndFormat = function (format) {
3632
+ var normalizedFormat = this.normalizeValue(format || this.format$.getValue());
3633
+ this.timeframe = this.getTimeframe(normalizedFormat);
3634
+ this.format$.next(this.getConfiguredFormat(this.timeframe));
3635
+ };
3636
+ DrDatePickerService.prototype.normalizeValue = function (value) {
3637
+ return value.replace(/d/g, 'D');
3638
+ };
3639
+ return DrDatePickerService;
3640
+ }());
3641
+ DrDatePickerService.decorators = [
3642
+ { type: i0.Injectable }
3643
+ ];
3644
+
3645
+ var moment$1 = require('moment');
3646
+ var DrDatePickerCustomHeaderComponent = /** @class */ (function () {
3647
+ function DrDatePickerCustomHeaderComponent(_calendar, _dateAdapter, _dateFormats, cdr, datePickerService) {
3648
+ var _this = this;
3649
+ this._calendar = _calendar;
3650
+ this._dateAdapter = _dateAdapter;
3651
+ this._dateFormats = _dateFormats;
3652
+ this.cdr = cdr;
3653
+ this.datePickerService = datePickerService;
3654
+ this._destroyed = new rxjs.Subject();
3655
+ this.quarters = [1, 2, 3, 4];
3656
+ this.selectedQuarter = 1;
3657
+ this.timeframeOptions = [{
3658
+ title: 'Day',
3659
+ value: 'month',
3660
+ format: this.datePickerService.formatConfig.day,
3661
+ periodLabel: function () { return _this._dateAdapter
3662
+ .format(_this._calendar.activeDate, _this._dateFormats.display.monthYearLabel)
3663
+ .toLocaleUpperCase(); }
3664
+ }, {
3665
+ title: 'Month',
3666
+ value: 'year',
3667
+ format: this.datePickerService.formatConfig.month,
3668
+ periodLabel: function () { return String(moment$1(_this._calendar.activeDate).year()); }
3669
+ }, {
3670
+ title: 'Quarter',
3671
+ value: 'none',
3672
+ format: this.datePickerService.formatConfig.quarter,
3673
+ periodLabel: function () { return String(moment$1(_this._calendar.activeDate).year()); }
3674
+ }, {
3675
+ title: 'Year',
3676
+ value: 'multi-year',
3677
+ format: this.datePickerService.formatConfig.year,
3678
+ periodLabel: function () {
3679
+ var currentYear = moment$1(_this._calendar.activeDate).year();
3680
+ var startPeriod = Math.floor(currentYear / 24) * 24;
3681
+ return startPeriod + '-' + (startPeriod + 23);
3682
+ }
3683
+ }];
3684
+ this.pagingSetup = {
3685
+ 'year': function (forward) { return _this.pagingDateChange('addCalendarYears', 1, forward); },
3686
+ 'none': function (forward) { return _this.pagingDateChange('addCalendarYears', 1, forward); },
3687
+ 'month': function (forward) { return _this.pagingDateChange('addCalendarMonths', 1, forward); },
3688
+ 'multi-year': function (forward) { return _this.pagingDateChange('addCalendarYears', 24, forward); }
3689
+ };
3690
+ this.selectedTimeframe = 'month';
3691
+ this.timeframeSelection = false;
3692
+ this.periodMonthLabel = '';
3693
+ this.periodYearLabel = '';
3694
+ _calendar.stateChanges.pipe(operators.takeUntil(this._destroyed)).subscribe(function () { return _this.setPeriodLabels(); });
3695
+ this.datePickerService.format$
3696
+ .pipe(operators.take(1))
3697
+ .subscribe(function (value) {
3698
+ _this.selectedTimeframe = _this.timeframeOptions.filter(function (option) { return option.format == value; })[0].value;
3699
+ _this.setPeriodLabels();
3700
+ });
3701
+ _calendar.viewChanged.pipe(operators.takeUntil(this._destroyed)).subscribe(function () { return _this.setPeriodLabels(); });
3524
3702
  }
3525
- Object.defineProperty(DrAccordionComponent.prototype, "multi", {
3526
- /**
3527
- * Allow multiple items to be expanded at the same time.
3528
- */
3703
+ DrDatePickerCustomHeaderComponent.prototype.ngOnDestroy = function () {
3704
+ this._destroyed.next();
3705
+ this._destroyed.complete();
3706
+ };
3707
+ DrDatePickerCustomHeaderComponent.prototype.setPeriodLabels = function () {
3708
+ var _this = this;
3709
+ var currentTimeframeOption = this.timeframeOptions.filter(function (option) { return option.value === _this._calendar.currentView; })[0];
3710
+ var fullPeriodLabel = currentTimeframeOption.periodLabel();
3711
+ if (this._calendar.currentView === 'month') {
3712
+ this.periodMonthLabel = fullPeriodLabel.slice(0, 3);
3713
+ this.periodYearLabel = fullPeriodLabel.slice(4);
3714
+ }
3715
+ else {
3716
+ this.periodMonthLabel = '';
3717
+ this.periodYearLabel = fullPeriodLabel;
3718
+ }
3719
+ this.cdr.markForCheck();
3720
+ };
3721
+ DrDatePickerCustomHeaderComponent.prototype.setTimeframe = function () {
3722
+ var _this = this;
3723
+ this.timeframeSelection = false;
3724
+ this._calendar.currentView = this.selectedTimeframe;
3725
+ var chosenTimeframeOption = this.timeframeOptions.filter(function (option) { return option.value === _this.selectedTimeframe; })[0];
3726
+ this.datePickerService.updateTimeframeAndFormat(chosenTimeframeOption.format);
3727
+ if (this.selectedTimeframe == 'none') {
3728
+ this.selectedQuarter = moment$1(this._calendar.activeDate).quarter();
3729
+ }
3730
+ };
3731
+ Object.defineProperty(DrDatePickerCustomHeaderComponent.prototype, "currentViewIsQuarter", {
3529
3732
  get: function () {
3530
- return this.multiValue;
3531
- },
3532
- set: function (val) {
3533
- this.multiValue = !!val;
3733
+ return !['month', 'year', 'multi-year'].includes(this._calendar.currentView);
3534
3734
  },
3535
3735
  enumerable: false,
3536
3736
  configurable: true
3537
3737
  });
3538
- /**
3539
- * Opens all enabled accordion items.
3540
- */
3541
- DrAccordionComponent.prototype.openAll = function () {
3542
- if (this.multi) {
3543
- this.openCloseItems.next(false);
3544
- }
3738
+ DrDatePickerCustomHeaderComponent.prototype.switchViewOnClickOnPeriodLabel = function (view) {
3739
+ this._calendar.currentView = view;
3545
3740
  };
3546
- /**
3547
- * Closes all enabled accordion items.
3548
- */
3549
- DrAccordionComponent.prototype.closeAll = function () {
3550
- this.openCloseItems.next(true);
3741
+ DrDatePickerCustomHeaderComponent.prototype.onSelectQuarter = function (quarterNumber) {
3742
+ var monthsInQuarter = 3;
3743
+ this.selectedQuarter = moment$1(this._calendar.activeDate).quarter();
3744
+ var unadaptedDate = this._dateAdapter.addCalendarMonths(this._calendar.activeDate, monthsInQuarter * (quarterNumber - this.selectedQuarter));
3745
+ this._calendar.activeDate = unadaptedDate;
3746
+ this.datePickerService.updatedQuarter$.next(moment$1(unadaptedDate));
3747
+ this.datePickerService.calendarInstance.close();
3551
3748
  };
3552
- return DrAccordionComponent;
3749
+ DrDatePickerCustomHeaderComponent.prototype.pagingClicked = function (forward) {
3750
+ this.pagingSetup[this._calendar.currentView] && this.pagingSetup[this._calendar.currentView](forward);
3751
+ };
3752
+ DrDatePickerCustomHeaderComponent.prototype.pagingDateChange = function (actionCall, amount, forward) {
3753
+ this._calendar.activeDate = this._dateAdapter[actionCall](this._calendar.activeDate, forward ? amount : -amount);
3754
+ this.setPeriodLabels();
3755
+ };
3756
+ return DrDatePickerCustomHeaderComponent;
3553
3757
  }());
3554
- DrAccordionComponent.decorators = [
3758
+ DrDatePickerCustomHeaderComponent.decorators = [
3555
3759
  { type: i0.Component, args: [{
3556
- selector: 'dr-accordion',
3557
- template: '<ng-content select="dr-accordion-item"></ng-content>',
3760
+ selector: 'dr-date-picker_custom-header.component',
3761
+ 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",
3558
3762
  changeDetection: i0.ChangeDetectionStrategy.OnPush,
3559
- styles: [":host{display:block;box-shadow:#2c33491a 0 5px 10px}\n"]
3763
+ 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"]
3560
3764
  },] }
3561
3765
  ];
3562
- DrAccordionComponent.propDecorators = {
3563
- multi: [{ type: i0.Input, args: ['multi',] }]
3564
- };
3766
+ DrDatePickerCustomHeaderComponent.ctorParameters = function () { return [
3767
+ { type: datepicker.MatCalendar },
3768
+ { type: core.DateAdapter },
3769
+ { type: CustomDateFormat, decorators: [{ type: i0.Inject, args: [core.MAT_DATE_FORMATS,] }] },
3770
+ { type: i0.ChangeDetectorRef },
3771
+ { type: DrDatePickerService }
3772
+ ]; };
3565
3773
 
3566
- var DrAccordionItemComponent = /** @class */ (function () {
3567
- function DrAccordionItemComponent(accordion, cd) {
3568
- this.accordion = accordion;
3569
- this.cd = cd;
3570
- /**
3571
- * Emits whenever the expanded state of the accordion changes.
3572
- * Primarily used to facilitate two-way binding.
3573
- */
3574
- this.collapsedChange = new i0.EventEmitter();
3575
- this.accordionItemInvalidate = new rxjs.Subject();
3576
- this.collapsedValue = true;
3577
- this.disabledValue = false;
3578
- this.destroy$ = new rxjs.Subject();
3774
+ var moment = require('moment');
3775
+ var noop = function () { };
3776
+ var ɵ0 = noop;
3777
+ var DrDatePickerComponent = /** @class */ (function () {
3778
+ function DrDatePickerComponent(cdr, dateAdapter, datePickerService) {
3779
+ var _this = this;
3780
+ this.cdr = cdr;
3781
+ this.dateAdapter = dateAdapter;
3782
+ this.datePickerService = datePickerService;
3783
+ // Whether to transform date, taking end, start, middle of preiod (i.e. set middle of month if timeframe='month')
3784
+ this.periodPosition = exports.DatePickerPeriodPosition.DEFAULT;
3785
+ this.placeholder = 'Select';
3786
+ this.calendarViewsTimeframeMapping = {
3787
+ year: 'multi-year',
3788
+ month: 'year',
3789
+ quarter: 'none',
3790
+ day: 'month',
3791
+ };
3792
+ this.customHeader = DrDatePickerCustomHeaderComponent;
3793
+ this.readonly = true;
3794
+ this.innerValue = null;
3795
+ this.destroyed$ = new rxjs.Subject();
3796
+ this.onTouchedCallback = noop;
3797
+ this.onChangeCallback = noop;
3798
+ datePickerService.updatedQuarter$
3799
+ .pipe(operators.takeUntil(this.destroyed$))
3800
+ .subscribe(function (value) {
3801
+ _this.setValueFromMoment(value);
3802
+ });
3579
3803
  }
3580
- Object.defineProperty(DrAccordionItemComponent.prototype, "collapsed", {
3581
- /**
3582
- * Item is collapse (`true` by default)
3583
- * @type {boolean}
3584
- */
3585
- get: function () {
3586
- return this.collapsedValue;
3587
- },
3588
- set: function (val) {
3589
- this.collapsedValue = !!val;
3590
- this.collapsedChange.emit(this.collapsedValue);
3591
- this.invalidate();
3804
+ Object.defineProperty(DrDatePickerComponent.prototype, "format", {
3805
+ set: function (value) {
3806
+ this.datePickerService.updateTimeframeAndFormat(value);
3592
3807
  },
3593
3808
  enumerable: false,
3594
3809
  configurable: true
3595
3810
  });
3596
- Object.defineProperty(DrAccordionItemComponent.prototype, "expanded", {
3597
- /**
3598
- * Item is expanded (`false` by default)
3599
- */
3600
- get: function () {
3601
- return !this.collapsed;
3811
+ Object.defineProperty(DrDatePickerComponent.prototype, "min", {
3812
+ set: function (minDate) {
3813
+ this._min = moment.unix(minDate).utc();
3602
3814
  },
3603
- set: function (val) {
3604
- this.collapsedValue = !val;
3815
+ enumerable: false,
3816
+ configurable: true
3817
+ });
3818
+ Object.defineProperty(DrDatePickerComponent.prototype, "max", {
3819
+ set: function (maxDate) {
3820
+ this._max = moment.unix(maxDate).utc();
3605
3821
  },
3606
3822
  enumerable: false,
3607
3823
  configurable: true
3608
3824
  });
3609
- Object.defineProperty(DrAccordionItemComponent.prototype, "disabled", {
3610
- /**
3611
- * Item is disabled and cannot be opened.
3612
- * @type {boolean}
3613
- */
3825
+ Object.defineProperty(DrDatePickerComponent.prototype, "value", {
3614
3826
  get: function () {
3615
- return this.disabledValue;
3827
+ return this.innerValue;
3616
3828
  },
3617
- set: function (val) {
3618
- this.disabledValue = !!val;
3619
- this.invalidate();
3829
+ set: function (v) {
3830
+ if (v !== this.innerValue) {
3831
+ this.setValueFromMoment(v);
3832
+ }
3833
+ this.cdr.markForCheck();
3620
3834
  },
3621
3835
  enumerable: false,
3622
3836
  configurable: true
3623
3837
  });
3838
+ DrDatePickerComponent.prototype.ngAfterViewInit = function () {
3839
+ this.datePickerService.calendarInstance = this.dp;
3840
+ this.dp.startView = this.calendarViewsTimeframeMapping[this.datePickerService.timeframe];
3841
+ };
3842
+ DrDatePickerComponent.prototype.ngOnDestroy = function () {
3843
+ this.destroyed$.next();
3844
+ this.destroyed$.complete();
3845
+ };
3624
3846
  /**
3625
- * Open/close the item
3847
+ * Updating component inner value according to datepicker timeframe (day, month etc.)
3848
+ * and date position in period (start, end, middle)
3626
3849
  */
3627
- DrAccordionItemComponent.prototype.toggle = function () {
3628
- if (!this.disabled) {
3629
- // we need this temporary variable as `openCloseItems.next` will change current value we need to save
3630
- var willSet = !this.collapsed;
3631
- if (!this.accordion.multi) {
3632
- this.accordion.openCloseItems.next(true);
3633
- }
3634
- this.collapsed = willSet;
3850
+ DrDatePickerComponent.prototype.tryToNormalaizeTimeframe = function () {
3851
+ var timeframe = this.datePickerService.timeframe;
3852
+ switch (this.periodPosition) {
3853
+ case exports.DatePickerPeriodPosition.START_OF_PERIOD:
3854
+ this.innerValue.startOf(timeframe);
3855
+ break;
3856
+ case exports.DatePickerPeriodPosition.END_OF_PERIOD:
3857
+ this.innerValue.endOf(timeframe);
3858
+ break;
3859
+ case exports.DatePickerPeriodPosition.MIDDLE_OF_PERIOD:
3860
+ this.innerValue.startOf(timeframe);
3861
+ var endOfPeriod = this.innerValue.clone().endOf(timeframe);
3862
+ var diff = endOfPeriod.diff(this.innerValue, 'seconds');
3863
+ this.innerValue.add(diff / 2 + 1, 'seconds');
3864
+ break;
3865
+ default:
3866
+ this.innerValue.startOf(timeframe);
3867
+ break;
3635
3868
  }
3636
3869
  };
3637
- /**
3638
- * Open the item.
3639
- */
3640
- DrAccordionItemComponent.prototype.open = function () {
3641
- if (!this.disabled) {
3642
- this.collapsed = false;
3870
+ DrDatePickerComponent.prototype.chosenPeriodHandler = function (chosenDate, timeframe) {
3871
+ if (this.datePickerService.timeframe === timeframe) {
3872
+ this.setValueFromMoment(chosenDate);
3873
+ this.dp.close();
3643
3874
  }
3644
3875
  };
3645
3876
  /**
3646
- * Collapse the item.
3877
+ * Setting value from outside of component via ngModel or formControl updates
3647
3878
  */
3648
- DrAccordionItemComponent.prototype.close = function () {
3649
- if (!this.disabled) {
3650
- this.collapsed = true;
3879
+ DrDatePickerComponent.prototype.writeValue = function (value) {
3880
+ this.innerValue = value ? moment.unix(value).utc() : value;
3881
+ if (this.innerValue) {
3882
+ this.tryToNormalaizeTimeframe();
3651
3883
  }
3884
+ this.cdr.markForCheck();
3652
3885
  };
3653
- DrAccordionItemComponent.prototype.ngOnInit = function () {
3654
- var _this = this;
3655
- this.accordion.openCloseItems
3656
- .pipe(operators.takeUntil(this.destroy$))
3657
- .subscribe(function (collapsed) {
3658
- if (!_this.disabled) {
3659
- _this.collapsed = collapsed;
3660
- }
3661
- });
3886
+ DrDatePickerComponent.prototype.registerOnChange = function (fn) {
3887
+ this.onChangeCallback = fn;
3662
3888
  };
3663
- DrAccordionItemComponent.prototype.ngOnChanges = function (changes) {
3664
- this.accordionItemInvalidate.next(true);
3889
+ DrDatePickerComponent.prototype.registerOnTouched = function (fn) {
3890
+ this.onTouchedCallback = fn;
3665
3891
  };
3666
- DrAccordionItemComponent.prototype.ngOnDestroy = function () {
3667
- this.destroy$.next();
3668
- this.destroy$.complete();
3669
- this.accordionItemInvalidate.complete();
3892
+ /**
3893
+ * Set inner value from Moment and propagate
3894
+ * @param momentDate
3895
+ */
3896
+ DrDatePickerComponent.prototype.setValueFromMoment = function (momentDate) {
3897
+ this.setValue(momentDate.unix());
3670
3898
  };
3671
- DrAccordionItemComponent.prototype.invalidate = function () {
3672
- this.accordionItemInvalidate.next(true);
3673
- this.cd.markForCheck();
3899
+ /**
3900
+ * Set inner value from timestamp and propagate
3901
+ * @param timestamp
3902
+ */
3903
+ DrDatePickerComponent.prototype.setValue = function (timestamp) {
3904
+ this.writeValue(timestamp);
3905
+ this.onChangeCallback(this.innerValue.unix());
3674
3906
  };
3675
- return DrAccordionItemComponent;
3907
+ return DrDatePickerComponent;
3676
3908
  }());
3677
- DrAccordionItemComponent.decorators = [
3909
+ DrDatePickerComponent.decorators = [
3678
3910
  { type: i0.Component, args: [{
3679
- selector: 'dr-accordion-item',
3680
- template: "\n <ng-content select=\"dr-accordion-item-header\"></ng-content>\n <ng-content select=\"dr-accordion-item-body\"></ng-content>\n ",
3911
+ selector: 'dr-date-picker',
3912
+ 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",
3681
3913
  changeDetection: i0.ChangeDetectionStrategy.OnPush,
3682
- styles: [":host{background-color:#fff;color:#222b45;font-family:\"Poppins\",sans-serif;font-size:16px;font-weight:400;line-height:1.25rem;display:flex;flex-direction:column}\n"]
3914
+ providers: [
3915
+ { provide: forms.NG_VALUE_ACCESSOR, useExisting: DrDatePickerComponent, multi: true },
3916
+ { provide: DrDatePickerService }
3917
+ ],
3918
+ 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"]
3683
3919
  },] }
3684
3920
  ];
3685
- DrAccordionItemComponent.ctorParameters = function () { return [
3686
- { type: DrAccordionComponent, decorators: [{ type: i0.Host }] },
3687
- { type: i0.ChangeDetectorRef }
3921
+ DrDatePickerComponent.ctorParameters = function () { return [
3922
+ { type: i0.ChangeDetectorRef },
3923
+ { type: core.DateAdapter },
3924
+ { type: DrDatePickerService }
3688
3925
  ]; };
3689
- DrAccordionItemComponent.propDecorators = {
3690
- collapsed: [{ type: i0.Input, args: ['collapsed',] }, { type: i0.HostBinding, args: ['class.collapsed',] }],
3691
- expanded: [{ type: i0.Input, args: ['expanded',] }, { type: i0.HostBinding, args: ['class.expanded',] }],
3692
- disabled: [{ type: i0.Input, args: ['disabled',] }, { type: i0.HostBinding, args: ['class.disabled',] }],
3693
- collapsedChange: [{ type: i0.Output }]
3926
+ DrDatePickerComponent.propDecorators = {
3927
+ format: [{ type: i0.Input }],
3928
+ min: [{ type: i0.Input }],
3929
+ max: [{ type: i0.Input }],
3930
+ periodPosition: [{ type: i0.Input }],
3931
+ placeholder: [{ type: i0.Input }],
3932
+ dp: [{ type: i0.ViewChild, args: ['datePicker',] }]
3694
3933
  };
3695
3934
 
3696
- var DrAccordionItemHeaderComponent = /** @class */ (function () {
3697
- function DrAccordionItemHeaderComponent(accordionItem, cd) {
3698
- this.accordionItem = accordionItem;
3699
- this.cd = cd;
3700
- this.destroy$ = new rxjs.Subject();
3935
+ var DrDatePickerWithTimeframeComponent = /** @class */ (function (_super) {
3936
+ __extends(DrDatePickerWithTimeframeComponent, _super);
3937
+ function DrDatePickerWithTimeframeComponent(cdr, dateAdapter, datePickerService) {
3938
+ var _this = _super.call(this, cdr, dateAdapter, datePickerService) || this;
3939
+ _this.cdr = cdr;
3940
+ _this.dateAdapter = dateAdapter;
3941
+ _this.datePickerService = datePickerService;
3942
+ _this.isDashboardDatepicker = false;
3943
+ _this.onChangeFormat = new i0.EventEmitter();
3944
+ _this.pagingSetup = {
3945
+ 'year': function (forward) { return _this.pagingDateChange('addCalendarYears', 1, forward); },
3946
+ 'quarter': function (forward) { return _this.pagingDateChange('addCalendarMonths', 3, forward); },
3947
+ 'month': function (forward) { return _this.pagingDateChange('addCalendarMonths', 1, forward); },
3948
+ 'day': function (forward) { return _this.pagingDateChange('addCalendarDays', 1, forward); }
3949
+ };
3950
+ datePickerService.isTimeframeSelectionEnabled = true;
3951
+ datePickerService.format$
3952
+ .pipe(operators.takeUntil(_this.destroyed$))
3953
+ .subscribe(function (value) {
3954
+ _this.onChangeFormat.emit(datePickerService.normalizeValue(value));
3955
+ });
3956
+ return _this;
3701
3957
  }
3702
- Object.defineProperty(DrAccordionItemHeaderComponent.prototype, "isCollapsed", {
3703
- get: function () {
3704
- return this.accordionItem.collapsed;
3705
- },
3706
- enumerable: false,
3707
- configurable: true
3708
- });
3709
- Object.defineProperty(DrAccordionItemHeaderComponent.prototype, "expanded", {
3710
- get: function () {
3711
- return !this.accordionItem.collapsed;
3712
- },
3713
- enumerable: false,
3714
- configurable: true
3715
- });
3716
- Object.defineProperty(DrAccordionItemHeaderComponent.prototype, "tabbable", {
3958
+ Object.defineProperty(DrDatePickerWithTimeframeComponent.prototype, "isDashboardClassDisplayed", {
3717
3959
  get: function () {
3718
- return this.accordionItem.disabled ? '-1' : '0';
3960
+ return this.isDashboardDatepicker;
3719
3961
  },
3720
3962
  enumerable: false,
3721
3963
  configurable: true
3722
3964
  });
3723
- Object.defineProperty(DrAccordionItemHeaderComponent.prototype, "disabled", {
3965
+ ;
3966
+ Object.defineProperty(DrDatePickerWithTimeframeComponent.prototype, "quarterDisplay", {
3724
3967
  get: function () {
3725
- return this.accordionItem.disabled;
3968
+ return this.datePickerService.getQuarterDisplay(this.value);
3726
3969
  },
3727
3970
  enumerable: false,
3728
3971
  configurable: true
3729
3972
  });
3730
- DrAccordionItemHeaderComponent.prototype.toggle = function () {
3731
- this.accordionItem.toggle();
3973
+ DrDatePickerWithTimeframeComponent.prototype.ngOnInit = function () {
3974
+ if (this.dateFormatConfig) {
3975
+ this.datePickerService.formatConfig = Object.assign(Object.assign({}, this.datePickerService.formatConfig), this.dateFormatConfig);
3976
+ }
3732
3977
  };
3733
- Object.defineProperty(DrAccordionItemHeaderComponent.prototype, "state", {
3734
- get: function () {
3735
- if (this.isCollapsed) {
3736
- return 'collapsed';
3737
- }
3738
- return 'expanded';
3739
- },
3740
- enumerable: false,
3741
- configurable: true
3742
- });
3743
- DrAccordionItemHeaderComponent.prototype.ngOnInit = function () {
3744
- var _this = this;
3745
- this.accordionItem.accordionItemInvalidate
3746
- .pipe(operators.takeUntil(this.destroy$))
3747
- .subscribe(function () { return _this.cd.markForCheck(); });
3978
+ DrDatePickerWithTimeframeComponent.prototype.pagingClicked = function (forward) {
3979
+ this.pagingSetup[this.datePickerService.timeframe] && this.pagingSetup[this.datePickerService.timeframe](forward);
3980
+ this.dp.close();
3748
3981
  };
3749
- DrAccordionItemHeaderComponent.prototype.ngOnDestroy = function () {
3750
- this.destroy$.next();
3751
- this.destroy$.complete();
3982
+ DrDatePickerWithTimeframeComponent.prototype.pagingDateChange = function (actionCall, amount, forward) {
3983
+ var newValue = this.dateAdapter[actionCall](this.innerValue, forward ? amount : -amount);
3984
+ this.setValueFromMoment(newValue);
3752
3985
  };
3753
- return DrAccordionItemHeaderComponent;
3754
- }());
3755
- DrAccordionItemHeaderComponent.decorators = [
3986
+ return DrDatePickerWithTimeframeComponent;
3987
+ }(DrDatePickerComponent));
3988
+ DrDatePickerWithTimeframeComponent.decorators = [
3756
3989
  { type: i0.Component, args: [{
3757
- selector: 'dr-accordion-item-header',
3758
- template: "\n <ng-content select=\"dr-accordion-item-title\"></ng-content>\n <ng-content select=\"dr-accordion-item-description\"></ng-content>\n <ng-content></ng-content>\n <i class=\"dr-icon-arrow-down expansion-indicator\"\n [@expansionIndicator]=\"state\"\n *ngIf=\"!disabled\">\n </i>\n ",
3759
- animations: [
3760
- animations.trigger('expansionIndicator', [
3761
- animations.state('expanded', animations.style({
3762
- transform: 'rotate(180deg)',
3763
- })),
3764
- animations.transition('collapsed => expanded', animations.animate('100ms ease-in')),
3765
- animations.transition('expanded => collapsed', animations.animate('100ms ease-out')),
3766
- ]),
3767
- ],
3990
+ selector: 'dr-date-picker-with-timeframe',
3991
+ 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",
3768
3992
  changeDetection: i0.ChangeDetectionStrategy.OnPush,
3769
- styles: [":host{display:flex;align-items:center;cursor:pointer;position:relative;border-bottom:1px solid #edf1f7;color:#222b45;font-family:\"Poppins\",sans-serif;font-size:13px;font-weight:600;line-height:1.5rem;padding:1.25rem;text-transform:capitalize}:host:focus{outline:0}:host .expansion-indicator{font-size:24px;position:absolute;right:10px;font-weight:700}\n"]
3993
+ providers: [
3994
+ { provide: forms.NG_VALUE_ACCESSOR, useExisting: DrDatePickerWithTimeframeComponent, multi: true },
3995
+ { provide: DrDatePickerService }
3996
+ ],
3997
+ 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"]
3770
3998
  },] }
3771
3999
  ];
3772
- DrAccordionItemHeaderComponent.ctorParameters = function () { return [
3773
- { type: DrAccordionItemComponent, decorators: [{ type: i0.Host }] },
3774
- { type: i0.ChangeDetectorRef }
4000
+ DrDatePickerWithTimeframeComponent.ctorParameters = function () { return [
4001
+ { type: i0.ChangeDetectorRef },
4002
+ { type: core.DateAdapter },
4003
+ { type: DrDatePickerService }
3775
4004
  ]; };
3776
- DrAccordionItemHeaderComponent.propDecorators = {
3777
- isCollapsed: [{ type: i0.HostBinding, args: ['class.accordion-item-header-collapsed',] }],
3778
- expanded: [{ type: i0.HostBinding, args: ['class.accordion-item-header-expanded',] }, { type: i0.HostBinding, args: ['attr.aria-expanded',] }],
3779
- tabbable: [{ type: i0.HostBinding, args: ['attr.tabindex',] }],
3780
- disabled: [{ type: i0.HostBinding, args: ['attr.aria-disabled',] }],
3781
- toggle: [{ type: i0.HostListener, args: ['click',] }, { type: i0.HostListener, args: ['keydown.space',] }, { type: i0.HostListener, args: ['keydown.enter',] }]
4005
+ DrDatePickerWithTimeframeComponent.propDecorators = {
4006
+ isDashboardClassDisplayed: [{ type: i0.HostBinding, args: ['class.dr-date-picker-on-dashboard',] }],
4007
+ isDashboardDatepicker: [{ type: i0.Input }],
4008
+ dateFormatConfig: [{ type: i0.Input }],
4009
+ onChangeFormat: [{ type: i0.Output }]
3782
4010
  };
3783
4011
 
3784
- var accordionItemBodyTrigger = animations.trigger('accordionItemBody', [
3785
- animations.state('collapsed', animations.style({
3786
- overflow: 'hidden',
3787
- visibility: 'hidden',
3788
- height: 0,
3789
- })),
3790
- animations.state('expanded', animations.style({
3791
- overflow: 'hidden',
3792
- visibility: 'visible',
3793
- })),
3794
- animations.transition('collapsed => expanded', animations.animate('100ms ease-in')),
3795
- animations.transition('expanded => collapsed', animations.animate('100ms ease-out')),
3796
- ]);
3797
- var DrAccordionItemBodyComponent = /** @class */ (function () {
3798
- function DrAccordionItemBodyComponent(accordionItem, cd) {
3799
- this.accordionItem = accordionItem;
3800
- this.cd = cd;
3801
- this.destroy$ = new rxjs.Subject();
4012
+ var DrDatePickerFormatDirective = /** @class */ (function () {
4013
+ function DrDatePickerFormatDirective(matDateFormat, ngControl) {
4014
+ this.matDateFormat = matDateFormat;
4015
+ this.ngControl = ngControl;
3802
4016
  }
3803
- Object.defineProperty(DrAccordionItemBodyComponent.prototype, "state", {
3804
- get: function () {
3805
- return this.accordionItem.collapsed ? 'collapsed' : 'expanded';
4017
+ Object.defineProperty(DrDatePickerFormatDirective.prototype, "datePickerFormat", {
4018
+ set: function (format) {
4019
+ var _a;
4020
+ if (this.configDateParse) {
4021
+ this.matDateFormat.updateDateFormat(this.configDateParse, this.configDateDisplay);
4022
+ }
4023
+ else {
4024
+ this.matDateFormat.updateDateFormat({ dateInput: format });
4025
+ }
4026
+ var value = this.ngControl.value;
4027
+ (_a = this.ngControl.valueAccessor) === null || _a === void 0 ? void 0 : _a.writeValue(value);
3806
4028
  },
3807
4029
  enumerable: false,
3808
4030
  configurable: true
3809
4031
  });
3810
- DrAccordionItemBodyComponent.prototype.ngOnInit = function () {
3811
- var _this = this;
3812
- this.accordionItem.accordionItemInvalidate
3813
- .pipe(operators.takeUntil(this.destroy$))
3814
- .subscribe(function () { return _this.cd.markForCheck(); });
3815
- };
3816
- DrAccordionItemBodyComponent.prototype.ngOnDestroy = function () {
3817
- this.destroy$.next();
3818
- this.destroy$.complete();
3819
- };
3820
- return DrAccordionItemBodyComponent;
3821
- }());
3822
- DrAccordionItemBodyComponent.decorators = [
3823
- { type: i0.Component, args: [{
3824
- selector: 'dr-accordion-item-body',
3825
- template: "\n <div [@accordionItemBody]=\"{ value: state }\">\n <div class=\"item-body\">\n <ng-content></ng-content>\n </div>\n </div>\n ",
3826
- animations: [accordionItemBodyTrigger],
3827
- changeDetection: i0.ChangeDetectionStrategy.OnPush,
3828
- styles: [".item-body{flex:1;-ms-flex:1 1 auto;overflow:auto;position:relative}\n"]
3829
- },] }
3830
- ];
3831
- DrAccordionItemBodyComponent.ctorParameters = function () { return [
3832
- { type: DrAccordionItemComponent, decorators: [{ type: i0.Host }] },
3833
- { type: i0.ChangeDetectorRef }
3834
- ]; };
3835
-
3836
- var DrModelDebounceChangeDirective = /** @class */ (function () {
3837
- function DrModelDebounceChangeDirective(ngModel) {
3838
- this.ngModel = ngModel;
3839
- this.debounce = 200;
3840
- this.ngModelDebounceChange = new i0.EventEmitter();
3841
- }
3842
- DrModelDebounceChangeDirective.prototype.ngOnInit = function () {
3843
- var _this = this;
3844
- this.subscription = this.ngModel.control.valueChanges
3845
- .pipe(operators.skip(1), operators.debounceTime(this.debounce), operators.distinctUntilChanged())
3846
- .subscribe(function (value) { return _this.ngModelDebounceChange.emit(value); });
3847
- };
3848
- DrModelDebounceChangeDirective.prototype.ngOnDestroy = function () {
3849
- this.subscription.unsubscribe();
3850
- };
3851
- return DrModelDebounceChangeDirective;
4032
+ return DrDatePickerFormatDirective;
3852
4033
  }());
3853
- DrModelDebounceChangeDirective.decorators = [
4034
+ DrDatePickerFormatDirective.decorators = [
3854
4035
  { type: i0.Directive, args: [{
3855
- selector: '[ngModelDebounceChange]'
4036
+ selector: '[drDatePickerFormat]',
4037
+ providers: [
4038
+ {
4039
+ provide: core.DateAdapter,
4040
+ useClass: materialMomentAdapter.MomentDateAdapter
4041
+ },
4042
+ {
4043
+ provide: core.MAT_DATE_FORMATS,
4044
+ useClass: CustomDateFormat
4045
+ }
4046
+ ]
3856
4047
  },] }
3857
4048
  ];
3858
- DrModelDebounceChangeDirective.ctorParameters = function () { return [
3859
- { type: forms.NgModel }
4049
+ DrDatePickerFormatDirective.ctorParameters = function () { return [
4050
+ { type: CustomDateFormat, decorators: [{ type: i0.Inject, args: [core.MAT_DATE_FORMATS,] }] },
4051
+ { type: forms.NgControl, decorators: [{ type: i0.Optional }] }
3860
4052
  ]; };
3861
- DrModelDebounceChangeDirective.propDecorators = {
3862
- debounce: [{ type: i0.Input }],
3863
- ngModelDebounceChange: [{ type: i0.Output }]
4053
+ DrDatePickerFormatDirective.propDecorators = {
4054
+ configDateParse: [{ type: i0.Input }],
4055
+ configDateDisplay: [{ type: i0.Input }],
4056
+ datePickerFormat: [{ type: i0.Input, args: ['drDatePickerFormat',] }]
3864
4057
  };
3865
4058
 
3866
- var components$2 = [DateTagComponent,
3867
- DayTagComponent,
3868
- WeekTagComponent,
3869
- MonthTagComponent,
3870
- QuarterTagComponent,
3871
- AnyTagComponent,
3872
- YearTagComponent,
3873
- ForecastTagComponent];
3874
- var ɵ0 = { useUtc: true };
3875
- var DateTagModule = /** @class */ (function () {
3876
- function DateTagModule() {
3877
- }
3878
- return DateTagModule;
3879
- }());
3880
- DateTagModule.decorators = [
3881
- { type: i0.NgModule, args: [{
3882
- imports: [
3883
- common.CommonModule,
3884
- core.MatNativeDateModule,
3885
- datepicker.MatDatepickerModule,
3886
- forms.FormsModule,
3887
- formField.MatFormFieldModule,
3888
- forms.ReactiveFormsModule,
3889
- input.MatInputModule,
3890
- materialMomentAdapter.MatMomentDateModule,
3891
- select.MatSelectModule
3892
- ],
3893
- exports: components$2,
3894
- providers: [
3895
- { provide: materialMomentAdapter.MAT_MOMENT_DATE_ADAPTER_OPTIONS, useValue: ɵ0 }
3896
- ],
3897
- declarations: components$2,
3898
- },] }
3899
- ];
3900
- ;
3901
-
3902
- var ListTagModule = /** @class */ (function () {
3903
- function ListTagModule() {
3904
- }
3905
- return ListTagModule;
3906
- }());
3907
- ListTagModule.decorators = [
3908
- { type: i0.NgModule, args: [{
3909
- imports: [
3910
- common.CommonModule,
3911
- forms.FormsModule,
3912
- formField.MatFormFieldModule,
3913
- forms.ReactiveFormsModule,
3914
- materialMomentAdapter.MatMomentDateModule,
3915
- select.MatSelectModule,
3916
- buttonToggle.MatButtonToggleModule,
3917
- ],
3918
- exports: [ListTagComponent],
3919
- providers: [],
3920
- declarations: [
3921
- ListTagComponent
3922
- ],
3923
- },] }
3924
- ];
3925
-
3926
- var DrTagModule = /** @class */ (function () {
3927
- function DrTagModule() {
3928
- }
3929
- return DrTagModule;
3930
- }());
3931
- DrTagModule.decorators = [
3932
- { type: i0.NgModule, args: [{
3933
- imports: [
3934
- common.CommonModule,
3935
- DateTagModule,
3936
- ListTagModule
3937
- ],
3938
- exports: [DrTagComponent],
3939
- providers: [],
3940
- declarations: [
3941
- DrTagComponent
3942
- ],
3943
- },] }
3944
- ];
3945
-
4059
+ // !!! Please do not use such approach in other places
4060
+ // Hard fix for 'none' calendar view selection
4061
+ datepicker.MatCalendar.prototype.focusActiveCell = function () {
4062
+ var _a;
4063
+ (_a = this._getCurrentViewComponent()) === null || _a === void 0 ? void 0 : _a._focusActiveCell(false);
4064
+ };
3946
4065
  var components$1 = [
3947
4066
  DrButtonComponent,
3948
4067
  RadioButtonComponent,
@@ -3953,6 +4072,7 @@
3953
4072
  DrToggleComponent,
3954
4073
  DrToggleButtonComponent,
3955
4074
  DrDatePickerComponent,
4075
+ DrDatePickerWithTimeframeComponent,
3956
4076
  DrDatePickerFormatDirective,
3957
4077
  DrDatePickerCustomHeaderComponent,
3958
4078
  DrModelDebounceChangeDirective
@@ -3972,9 +4092,6 @@
3972
4092
  common.CommonModule,
3973
4093
  ngSelect.NgSelectModule,
3974
4094
  datepicker.MatDatepickerModule
3975
- ],
3976
- providers: [
3977
- DrDatePickerService
3978
4095
  ]
3979
4096
  },] }
3980
4097
  ];
@@ -4146,6 +4263,8 @@
4146
4263
 
4147
4264
  exports.AnyTagComponent = AnyTagComponent;
4148
4265
  exports.CheckboxComponent = CheckboxComponent;
4266
+ exports.CustomDateFormat = CustomDateFormat;
4267
+ exports.DATE_INPUT_FORMAT = DATE_INPUT_FORMAT;
4149
4268
  exports.DateTagComponent = DateTagComponent;
4150
4269
  exports.DateTagModule = DateTagModule;
4151
4270
  exports.DayTagComponent = DayTagComponent;
@@ -4158,8 +4277,6 @@
4158
4277
  exports.DrAvatarModule = DrAvatarModule;
4159
4278
  exports.DrAvatarPipe = DrAvatarPipe;
4160
4279
  exports.DrButtonComponent = DrButtonComponent;
4161
- exports.DrDatePickerComponent = DrDatePickerComponent;
4162
- exports.DrDatePickerFormatDirective = DrDatePickerFormatDirective;
4163
4280
  exports.DrDropdownComponent = DrDropdownComponent;
4164
4281
  exports.DrDropdownDirective = DrDropdownDirective;
4165
4282
  exports.DrDropdownItemShowPipe = DrDropdownItemShowPipe;
@@ -4191,18 +4308,24 @@
4191
4308
  exports.ISpinnerOptions = ISpinnerOptions;
4192
4309
  exports.ListTagComponent = ListTagComponent;
4193
4310
  exports.ListTagModule = ListTagModule;
4311
+ exports.MAT_DEFAULT_DATE_FORMAT = MAT_DEFAULT_DATE_FORMAT;
4312
+ exports.MONTH_YEAR_FORMAT = MONTH_YEAR_FORMAT;
4194
4313
  exports.MonthTagComponent = MonthTagComponent;
4314
+ exports.QUARTER_FORMAT = QUARTER_FORMAT;
4195
4315
  exports.QuarterTagComponent = QuarterTagComponent;
4196
4316
  exports.RadioButtonComponent = RadioButtonComponent;
4197
4317
  exports.RadioGroupComponent = RadioGroupComponent;
4198
4318
  exports.TooltipComponent = TooltipComponent;
4199
4319
  exports.WeekTagComponent = WeekTagComponent;
4320
+ exports.YEAR_FORMAT = YEAR_FORMAT;
4200
4321
  exports.YearTagComponent = YearTagComponent;
4201
4322
  exports["ɵa"] = components$2;
4202
4323
  exports["ɵb"] = POPUP_ANIMATION;
4203
- exports["ɵc"] = DrDatePickerService;
4204
- exports["ɵd"] = CustomDateFormat;
4205
- exports["ɵe"] = DrDatePickerCustomHeaderComponent;
4324
+ exports["ɵc"] = DrDatePickerComponent;
4325
+ exports["ɵd"] = DrDatePickerService;
4326
+ exports["ɵe"] = DrDatePickerWithTimeframeComponent;
4327
+ exports["ɵf"] = DrDatePickerFormatDirective;
4328
+ exports["ɵg"] = DrDatePickerCustomHeaderComponent;
4206
4329
 
4207
4330
  Object.defineProperty(exports, '__esModule', { value: true });
4208
4331