@datarailsshared/datarailsshared 1.3.45 → 1.3.48

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.
@@ -1476,6 +1476,7 @@
1476
1476
  this.placeholder = '';
1477
1477
  this.readonly = false;
1478
1478
  this.blur = new i0.EventEmitter();
1479
+ this.ngModelDebounceChange = new i0.EventEmitter();
1479
1480
  this.innerValue = null;
1480
1481
  this._disabled = null;
1481
1482
  this._elementClass = [];
@@ -1631,7 +1632,7 @@
1631
1632
  DrInputComponent.decorators = [
1632
1633
  { type: i0.Component, args: [{
1633
1634
  selector: 'dr-input',
1634
- template: "<ng-content select=\"[prefixIcon]\"></ng-content>\r\n<input [(ngModel)]=\"value\"\r\n (ngModelChange)=\"updateChanges()\"\r\n (blur)=\"blur.emit(value); onTouched()\"\r\n [disabled]=\"_disabled\"\r\n [readonly]=\"readonly\"\r\n [type]=\"type\"\r\n [placeholder]=\"placeholder\"\r\n [name]=\"name\"\r\n [min]=\"min\"\r\n [max]=\"max\"\r\n [minLength]=\"minLength\"\r\n [maxlength]=\"maxlength\"\r\n [step]=\"step\"\r\n>\r\n<span class=\"clear-icon\" (click)=\"onClear($event)\"></span>\r\n<span *ngIf=\"type === 'search'\" class=\"search-icon\" (click)=\"onSearchClicked($event)\"></span>\r\n<ng-content select=\"[suffixIcon]\"></ng-content>\r\n<button *ngIf=\"_buttonOptions.show || (_buttonOptions.showOnFocus && _buttonOptions.focusSet)\"\r\n (click)=\"onButtonClicked($event)\">\r\n {{_buttonOptions.text}}\r\n</button>\r\n",
1635
+ template: "<ng-content select=\"[prefixIcon]\"></ng-content>\r\n<input [(ngModel)]=\"value\"\r\n (ngModelChange)=\"updateChanges()\"\r\n (ngModelDebounceChange)=\"ngModelDebounceChange.emit($event)\"\r\n (blur)=\"blur.emit(value); onTouched()\"\r\n [disabled]=\"_disabled\"\r\n [readonly]=\"readonly\"\r\n [type]=\"type\"\r\n [placeholder]=\"placeholder\"\r\n [name]=\"name\"\r\n [min]=\"min\"\r\n [max]=\"max\"\r\n [minLength]=\"minLength\"\r\n [maxlength]=\"maxlength\"\r\n [step]=\"step\"\r\n>\r\n<span *ngIf=\"value\" class=\"clear-icon\" (click)=\"onClear($event)\"></span>\r\n<span *ngIf=\"type === 'search'\" class=\"search-icon\" (click)=\"onSearchClicked($event)\"></span>\r\n<ng-content select=\"[suffixIcon]\"></ng-content>\r\n<button *ngIf=\"_buttonOptions.show || (_buttonOptions.showOnFocus && _buttonOptions.focusSet)\"\r\n (click)=\"onButtonClicked($event)\">\r\n {{_buttonOptions.text}}\r\n</button>\r\n",
1635
1636
  providers: [{
1636
1637
  provide: forms.NG_VALUE_ACCESSOR,
1637
1638
  useExisting: i0.forwardRef(function () { return DrInputComponent; }),
@@ -1660,6 +1661,7 @@
1660
1661
  maxlength: [{ type: i0.Input }],
1661
1662
  step: [{ type: i0.Input }],
1662
1663
  blur: [{ type: i0.Output }],
1664
+ ngModelDebounceChange: [{ type: i0.Output }],
1663
1665
  elementClass: [{ type: i0.HostBinding, args: ['class',] }],
1664
1666
  searchHandler: [{ type: i0.Output }],
1665
1667
  buttonHandler: [{ type: i0.Output }],
@@ -2639,8 +2641,9 @@
2639
2641
  datePickerService.updatedQuater
2640
2642
  .pipe(operators.takeUntil(this._destroyed))
2641
2643
  .subscribe(function (value) {
2644
+ _this.tryToNormalaizeTimeframe(value, 'quarter');
2642
2645
  _this.writeValue(value);
2643
- _this.value = moment(value).unix();
2646
+ _this.onChangeCallback(value);
2644
2647
  });
2645
2648
  }
2646
2649
  Object.defineProperty(DrDatePickerComponent.prototype, "format", {
@@ -2670,6 +2673,11 @@
2670
2673
  };
2671
2674
  }, 1000);
2672
2675
  };
2676
+ DrDatePickerComponent.prototype.tryToNormalaizeTimeframe = function (normalizedRef, timeframe) {
2677
+ if (this.takeEndOfPeriod) {
2678
+ normalizedRef.endOf(timeframe);
2679
+ }
2680
+ };
2673
2681
  Object.defineProperty(DrDatePickerComponent.prototype, "value", {
2674
2682
  get: function () {
2675
2683
  return this.innerValue;
@@ -2677,7 +2685,6 @@
2677
2685
  set: function (v) {
2678
2686
  if (v !== this.innerValue) {
2679
2687
  this.innerValue = v;
2680
- this.onChangeCallback(v);
2681
2688
  }
2682
2689
  this.cdr.markForCheck();
2683
2690
  },
@@ -2698,9 +2705,7 @@
2698
2705
  else {
2699
2706
  this.innerValue = value;
2700
2707
  }
2701
- if (this.takeEndOfPeriod) {
2702
- this.innerValue = moment(value).endOf(this.datePickerService.timeframe);
2703
- }
2708
+ this.tryToNormalaizeTimeframe(this.innerValue, this.datePickerService.timeframe);
2704
2709
  this.cdr.markForCheck();
2705
2710
  }
2706
2711
  };
@@ -2722,6 +2727,7 @@
2722
2727
  };
2723
2728
  DrDatePickerComponent.prototype.chosenMonthHandler = function (normalizedMonth, datepicker) {
2724
2729
  if (this.datePickerService.timeframe == 'month') {
2730
+ this.tryToNormalaizeTimeframe(normalizedMonth, 'month');
2725
2731
  this.writeValue(normalizedMonth);
2726
2732
  this.onChangeCallback(normalizedMonth);
2727
2733
  datepicker.close();
@@ -2729,6 +2735,7 @@
2729
2735
  };
2730
2736
  DrDatePickerComponent.prototype.chosenYearHandler = function (normalizedYear, datepicker) {
2731
2737
  if (this.datePickerService.timeframe == 'year') {
2738
+ this.tryToNormalaizeTimeframe(normalizedYear, 'year');
2732
2739
  this.writeValue(normalizedYear);
2733
2740
  this.onChangeCallback(normalizedYear);
2734
2741
  datepicker.close();
@@ -3813,6 +3820,36 @@
3813
3820
  { type: i0.ChangeDetectorRef }
3814
3821
  ]; };
3815
3822
 
3823
+ var DrModelDebounceChangeDirective = /** @class */ (function () {
3824
+ function DrModelDebounceChangeDirective(ngModel) {
3825
+ this.ngModel = ngModel;
3826
+ this.debounce = 200;
3827
+ this.ngModelDebounceChange = new i0.EventEmitter();
3828
+ }
3829
+ DrModelDebounceChangeDirective.prototype.ngOnInit = function () {
3830
+ var _this = this;
3831
+ this.subscription = this.ngModel.control.valueChanges
3832
+ .pipe(operators.skip(1), operators.debounceTime(this.debounce), operators.distinctUntilChanged())
3833
+ .subscribe(function (value) { return _this.ngModelDebounceChange.emit(value); });
3834
+ };
3835
+ DrModelDebounceChangeDirective.prototype.ngOnDestroy = function () {
3836
+ this.subscription.unsubscribe();
3837
+ };
3838
+ return DrModelDebounceChangeDirective;
3839
+ }());
3840
+ DrModelDebounceChangeDirective.decorators = [
3841
+ { type: i0.Directive, args: [{
3842
+ selector: '[ngModelDebounceChange]'
3843
+ },] }
3844
+ ];
3845
+ DrModelDebounceChangeDirective.ctorParameters = function () { return [
3846
+ { type: forms.NgModel }
3847
+ ]; };
3848
+ DrModelDebounceChangeDirective.propDecorators = {
3849
+ debounce: [{ type: i0.Input }],
3850
+ ngModelDebounceChange: [{ type: i0.Output }]
3851
+ };
3852
+
3816
3853
  var components$2 = [DateTagComponent,
3817
3854
  DayTagComponent,
3818
3855
  WeekTagComponent,
@@ -3904,7 +3941,8 @@
3904
3941
  DrToggleButtonComponent,
3905
3942
  DrDatePickerComponent,
3906
3943
  DrDatePickerFormatDirective,
3907
- DrDatePickerCustomHeaderComponent
3944
+ DrDatePickerCustomHeaderComponent,
3945
+ DrModelDebounceChangeDirective
3908
3946
  ];
3909
3947
  var DrInputsModule = /** @class */ (function () {
3910
3948
  function DrInputsModule() {
@@ -4117,6 +4155,7 @@
4117
4155
  exports.DrDropdownService = DrDropdownService;
4118
4156
  exports.DrInputComponent = DrInputComponent;
4119
4157
  exports.DrInputsModule = DrInputsModule;
4158
+ exports.DrModelDebounceChangeDirective = DrModelDebounceChangeDirective;
4120
4159
  exports.DrPopoverComponent = DrPopoverComponent;
4121
4160
  exports.DrPopoverDirective = DrPopoverDirective;
4122
4161
  exports.DrPopoverModule = DrPopoverModule;