@datarailsshared/datarailsshared 1.3.46 → 1.3.49

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,6 +2641,7 @@
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
2646
  _this.onChangeCallback(value);
2644
2647
  });
@@ -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;
@@ -2698,9 +2706,7 @@
2698
2706
  else {
2699
2707
  this.innerValue = value;
2700
2708
  }
2701
- if (this.takeEndOfPeriod) {
2702
- this.innerValue = moment(value).endOf(this.datePickerService.timeframe);
2703
- }
2709
+ this.tryToNormalaizeTimeframe(this.innerValue, this.datePickerService.timeframe);
2704
2710
  this.cdr.markForCheck();
2705
2711
  }
2706
2712
  };
@@ -2722,6 +2728,7 @@
2722
2728
  };
2723
2729
  DrDatePickerComponent.prototype.chosenMonthHandler = function (normalizedMonth, datepicker) {
2724
2730
  if (this.datePickerService.timeframe == 'month') {
2731
+ this.tryToNormalaizeTimeframe(normalizedMonth, 'month');
2725
2732
  this.writeValue(normalizedMonth);
2726
2733
  this.onChangeCallback(normalizedMonth);
2727
2734
  datepicker.close();
@@ -2729,6 +2736,7 @@
2729
2736
  };
2730
2737
  DrDatePickerComponent.prototype.chosenYearHandler = function (normalizedYear, datepicker) {
2731
2738
  if (this.datePickerService.timeframe == 'year') {
2739
+ this.tryToNormalaizeTimeframe(normalizedYear, 'year');
2732
2740
  this.writeValue(normalizedYear);
2733
2741
  this.onChangeCallback(normalizedYear);
2734
2742
  datepicker.close();
@@ -3813,6 +3821,36 @@
3813
3821
  { type: i0.ChangeDetectorRef }
3814
3822
  ]; };
3815
3823
 
3824
+ var DrModelDebounceChangeDirective = /** @class */ (function () {
3825
+ function DrModelDebounceChangeDirective(ngModel) {
3826
+ this.ngModel = ngModel;
3827
+ this.debounce = 200;
3828
+ this.ngModelDebounceChange = new i0.EventEmitter();
3829
+ }
3830
+ DrModelDebounceChangeDirective.prototype.ngOnInit = function () {
3831
+ var _this = this;
3832
+ this.subscription = this.ngModel.control.valueChanges
3833
+ .pipe(operators.skip(1), operators.debounceTime(this.debounce), operators.distinctUntilChanged())
3834
+ .subscribe(function (value) { return _this.ngModelDebounceChange.emit(value); });
3835
+ };
3836
+ DrModelDebounceChangeDirective.prototype.ngOnDestroy = function () {
3837
+ this.subscription.unsubscribe();
3838
+ };
3839
+ return DrModelDebounceChangeDirective;
3840
+ }());
3841
+ DrModelDebounceChangeDirective.decorators = [
3842
+ { type: i0.Directive, args: [{
3843
+ selector: '[ngModelDebounceChange]'
3844
+ },] }
3845
+ ];
3846
+ DrModelDebounceChangeDirective.ctorParameters = function () { return [
3847
+ { type: forms.NgModel }
3848
+ ]; };
3849
+ DrModelDebounceChangeDirective.propDecorators = {
3850
+ debounce: [{ type: i0.Input }],
3851
+ ngModelDebounceChange: [{ type: i0.Output }]
3852
+ };
3853
+
3816
3854
  var components$2 = [DateTagComponent,
3817
3855
  DayTagComponent,
3818
3856
  WeekTagComponent,
@@ -3904,7 +3942,8 @@
3904
3942
  DrToggleButtonComponent,
3905
3943
  DrDatePickerComponent,
3906
3944
  DrDatePickerFormatDirective,
3907
- DrDatePickerCustomHeaderComponent
3945
+ DrDatePickerCustomHeaderComponent,
3946
+ DrModelDebounceChangeDirective
3908
3947
  ];
3909
3948
  var DrInputsModule = /** @class */ (function () {
3910
3949
  function DrInputsModule() {
@@ -4117,6 +4156,7 @@
4117
4156
  exports.DrDropdownService = DrDropdownService;
4118
4157
  exports.DrInputComponent = DrInputComponent;
4119
4158
  exports.DrInputsModule = DrInputsModule;
4159
+ exports.DrModelDebounceChangeDirective = DrModelDebounceChangeDirective;
4120
4160
  exports.DrPopoverComponent = DrPopoverComponent;
4121
4161
  exports.DrPopoverDirective = DrPopoverDirective;
4122
4162
  exports.DrPopoverModule = DrPopoverModule;