@datarailsshared/datarailsshared 1.4.18-cicd → 1.4.20-tigers

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