@datarailsshared/datarailsshared 1.3.49 → 1.3.50

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.
@@ -2516,22 +2516,23 @@
2516
2516
  this.timeframeSelection = false;
2517
2517
  this.periodMonthLabel = '';
2518
2518
  this.periodYearLabel = '';
2519
- _calendar.stateChanges
2520
- .pipe(operators.takeUntil(this._destroyed))
2521
- .subscribe(function () { return cdr.markForCheck(); });
2519
+ _calendar.stateChanges.pipe(operators.takeUntil(this._destroyed)).subscribe(function () { return _this.setPeriodLabels(); });
2522
2520
  this.datePickerService.format
2523
2521
  .pipe(operators.take(1))
2524
2522
  .subscribe(function (value) {
2525
2523
  _this.selectedTimeframe = _this.timeframeOptions.filter(function (option) { return option.format == value; })[0].value;
2526
2524
  });
2525
+ _calendar.viewChanged.pipe(operators.takeUntil(this._destroyed)).subscribe(function () { return _this.setPeriodLabels(); });
2527
2526
  }
2528
2527
  DrDatePickerCustomHeaderComponent.prototype.ngOnDestroy = function () {
2529
2528
  this._destroyed.next();
2530
2529
  this._destroyed.complete();
2531
2530
  };
2532
- DrDatePickerCustomHeaderComponent.prototype.setPeriodLabels = function (currentTimeframeOption) {
2531
+ DrDatePickerCustomHeaderComponent.prototype.setPeriodLabels = function () {
2532
+ var _this = this;
2533
+ var currentTimeframeOption = this.timeframeOptions.filter(function (option) { return option.value === _this._calendar.currentView; })[0];
2533
2534
  var fullPeriodLabel = currentTimeframeOption.periodLabel();
2534
- if (this.selectedTimeframe === 'month') {
2535
+ if (this._calendar.currentView === 'month') {
2535
2536
  this.periodMonthLabel = fullPeriodLabel.slice(0, 3);
2536
2537
  this.periodYearLabel = fullPeriodLabel.slice(4);
2537
2538
  }
@@ -2539,13 +2540,13 @@
2539
2540
  this.periodMonthLabel = '';
2540
2541
  this.periodYearLabel = fullPeriodLabel;
2541
2542
  }
2543
+ this.cdr.markForCheck();
2542
2544
  };
2543
2545
  DrDatePickerCustomHeaderComponent.prototype.setTimeframe = function () {
2544
2546
  var _this = this;
2545
2547
  this.timeframeSelection = false;
2546
2548
  this._calendar.currentView = this.selectedTimeframe;
2547
2549
  var chosenTimeframeOption = this.timeframeOptions.filter(function (option) { return option.value === _this.selectedTimeframe; })[0];
2548
- this.setPeriodLabels(chosenTimeframeOption);
2549
2550
  this.datePickerService.format.next(chosenTimeframeOption.format);
2550
2551
  this.datePickerService.setTimeframe(chosenTimeframeOption.format);
2551
2552
  if (this.selectedTimeframe == 'none') {
@@ -2571,13 +2572,11 @@
2571
2572
  this.datePickerService.calendarInstance.close();
2572
2573
  };
2573
2574
  DrDatePickerCustomHeaderComponent.prototype.pagingClicked = function (forward) {
2574
- this.pagingSetup[this.selectedTimeframe] && this.pagingSetup[this.selectedTimeframe](forward);
2575
+ this.pagingSetup[this._calendar.currentView] && this.pagingSetup[this._calendar.currentView](forward);
2575
2576
  };
2576
2577
  DrDatePickerCustomHeaderComponent.prototype.pagingDateChange = function (actionCall, amount, forward) {
2577
- var _this = this;
2578
2578
  this._calendar.activeDate = this._dateAdapter[actionCall](this._calendar.activeDate, forward ? amount : -amount);
2579
- var chosenTimeframeOption = this.timeframeOptions.filter(function (option) { return option.value === _this.selectedTimeframe; })[0];
2580
- this.setPeriodLabels(chosenTimeframeOption);
2579
+ this.setPeriodLabels();
2581
2580
  };
2582
2581
  return DrDatePickerCustomHeaderComponent;
2583
2582
  }());
@@ -2586,7 +2585,7 @@
2586
2585
  selector: 'dr-date-picker_custom-header.component',
2587
2586
  template: "<div class=\"dr-datepicker__timeframe-select__wrapper\">\r\n <dr-select \r\n class=\"dr-datepicker__timeframe-select\"\r\n [(ngModel)]=\"selectedTimeframe\"\r\n [items]=\"timeframeOptions\"\r\n bindLabel=\"title\"\r\n bindValue=\"value\"\r\n (ngModelChange)=\"setTimeframe()\">\r\n </dr-select>\r\n</div>\r\n\r\n<div class=\"dr-date-paging\">\r\n <div class=\"dr-date-paging flip-page-button\"\r\n (click)=\"pagingClicked(false)\">\r\n <i class=\"dr-icon-arrow-left presentation_buttons-navigate_input\"></i> \r\n </div>\r\n <span class=\"example-header-label\">\r\n <span (click)=\"switchViewOnClickOnPeriodLabel('year')\">{{periodMonthLabel + ' '}}</span> \r\n <span (click)=\"switchViewOnClickOnPeriodLabel('multi-year')\">{{periodYearLabel}}</span>\r\n </span>\r\n <div class=\"dr-date-paging flip-page-button\"\r\n (click)=\"pagingClicked(true)\">\r\n <i class=\"dr-icon-arrow-right presentation_buttons-navigate_input\"></i>\r\n </div>\r\n</div>\r\n<div #quarterlyDatePicker class=\"dr-quarterly-datepicker\" *ngIf=\"currentViewIsQuater\">\r\n <div *ngFor=\"let quarter of quarters\" \r\n class=\"quarter-selector\" (click)=\"onSelectQuater(quarter)\"\r\n [class]=\"quarter == selectedQuarter ? 'selected' : ''\"\r\n >Q{{quarter}}</div>\r\n</div>\r\n\r\n",
2588
2587
  changeDetection: i0.ChangeDetectionStrategy.OnPush,
2589
- 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}.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"]
2588
+ 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"]
2590
2589
  },] }
2591
2590
  ];
2592
2591
  DrDatePickerCustomHeaderComponent.ctorParameters = function () { return [
@@ -2677,6 +2676,7 @@
2677
2676
  if (this.takeEndOfPeriod) {
2678
2677
  normalizedRef.endOf(timeframe);
2679
2678
  }
2679
+ normalizedRef.set('hour', 12);
2680
2680
  };
2681
2681
  Object.defineProperty(DrDatePickerComponent.prototype, "value", {
2682
2682
  get: function () {
@@ -2727,7 +2727,7 @@
2727
2727
  return value;
2728
2728
  };
2729
2729
  DrDatePickerComponent.prototype.chosenMonthHandler = function (normalizedMonth, datepicker) {
2730
- if (this.datePickerService.timeframe == 'month') {
2730
+ if (this.datePickerService.timeframe === 'month') {
2731
2731
  this.tryToNormalaizeTimeframe(normalizedMonth, 'month');
2732
2732
  this.writeValue(normalizedMonth);
2733
2733
  this.onChangeCallback(normalizedMonth);
@@ -2735,16 +2735,12 @@
2735
2735
  }
2736
2736
  };
2737
2737
  DrDatePickerComponent.prototype.chosenYearHandler = function (normalizedYear, datepicker) {
2738
- if (this.datePickerService.timeframe == 'year') {
2738
+ if (this.datePickerService.timeframe === 'year') {
2739
2739
  this.tryToNormalaizeTimeframe(normalizedYear, 'year');
2740
2740
  this.writeValue(normalizedYear);
2741
2741
  this.onChangeCallback(normalizedYear);
2742
2742
  datepicker.close();
2743
2743
  }
2744
- else if (['quarter', 'day'].includes(this.datePickerService.timeframe)) {
2745
- this.writeValue(normalizedYear);
2746
- datepicker.close();
2747
- }
2748
2744
  };
2749
2745
  DrDatePickerComponent.prototype.pagingClicked = function (forward) {
2750
2746
  this.pagingSetup[this.datePickerService.timeframe] && this.pagingSetup[this.datePickerService.timeframe](forward);