@datarailsshared/datarailsshared 1.4.108 → 1.4.109

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.
@@ -4612,6 +4612,7 @@
4612
4612
  _a[exports.TimeframeOption.DAY] = function (forward) { return _this.pagingDateChange('addCalendarDays', 1, forward); },
4613
4613
  _a[exports.TimeframeOption.WEEK] = function (forward) { return _this.pagingDateChange('addCalendarDays', 7, forward); },
4614
4614
  _a);
4615
+ _this.onChangeDebounced$ = new rxjs.Subject();
4615
4616
  datePickerService.isTimeframeSelectionEnabled = true;
4616
4617
  datePickerService.format$.pipe(operators.takeUntil(_this.destroyed$)).subscribe(function (value) {
4617
4618
  _this.onChangeFormat.emit(datePickerService.normalizeValue(value));
@@ -4661,8 +4662,14 @@
4661
4662
  configurable: true
4662
4663
  });
4663
4664
  DrDatePickerWithTimeframeComponent.prototype.ngOnInit = function () {
4665
+ var _this = this;
4664
4666
  this.datePickerService.isTimeframeSelectionEnabled = this.canSelectTimeframe;
4665
4667
  this.cdr.markForCheck();
4668
+ if (this.paginationDebounce) {
4669
+ this.onChangeDebounced$.pipe(operators.takeUntil(this.destroyed$), operators.debounceTime(this.paginationDebounce)).subscribe(function (value) {
4670
+ _this.onChangeCallback(value);
4671
+ });
4672
+ }
4666
4673
  };
4667
4674
  DrDatePickerWithTimeframeComponent.prototype.pagingClicked = function (forward) {
4668
4675
  if (this.pagingSetup[this.datePickerService.timeframe]) {
@@ -4672,7 +4679,17 @@
4672
4679
  };
4673
4680
  DrDatePickerWithTimeframeComponent.prototype.pagingDateChange = function (actionCall, amount, forward) {
4674
4681
  var newValue = this.dateAdapter[actionCall](this.innerValue, forward ? amount : -amount);
4675
- this.setValueFromMoment(newValue);
4682
+ if (this.paginationDebounce) {
4683
+ // this is required for not sending extra requests when user quickly clicking on pagination
4684
+ // here we do the same as in setValueFromMoment(newValue) with difference
4685
+ // that updating of ngModel/formControl is debounced
4686
+ var timestamp = newValue.unix();
4687
+ this.writeValue(timestamp);
4688
+ this.onChangeDebounced$.next(this.innerValue.unix());
4689
+ }
4690
+ else {
4691
+ this.setValueFromMoment(newValue);
4692
+ }
4676
4693
  };
4677
4694
  return DrDatePickerWithTimeframeComponent;
4678
4695
  }(DrDatePickerComponent));
@@ -4699,6 +4716,7 @@
4699
4716
  dateFormatConfig: [{ type: i0.Input }],
4700
4717
  canSelectTimeframe: [{ type: i0.Input }],
4701
4718
  availableTimeframes: [{ type: i0.Input }],
4719
+ paginationDebounce: [{ type: i0.Input }],
4702
4720
  onChangeFormat: [{ type: i0.Output }]
4703
4721
  };
4704
4722