ngx-bootstrap 8.0.0-RC.8 → 8.0.0-RC.9

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 (57) hide show
  1. package/accordion/package.json +3 -3
  2. package/alert/package.json +2 -2
  3. package/buttons/package.json +1 -1
  4. package/carousel/package.json +2 -2
  5. package/chronos/package.json +1 -1
  6. package/collapse/package.json +1 -1
  7. package/component-loader/package.json +3 -3
  8. package/datepicker/bs-datepicker-inline.component.d.ts +2 -0
  9. package/datepicker/bs-datepicker.component.d.ts +2 -0
  10. package/datepicker/bs-datepicker.config.d.ts +4 -0
  11. package/datepicker/bs-daterangepicker-inline.component.d.ts +2 -0
  12. package/datepicker/bs-daterangepicker.component.d.ts +2 -0
  13. package/datepicker/esm2020/bs-datepicker-inline.component.mjs +13 -3
  14. package/datepicker/esm2020/bs-datepicker.component.mjs +24 -14
  15. package/datepicker/esm2020/bs-datepicker.config.mjs +5 -1
  16. package/datepicker/esm2020/bs-datepicker.module.mjs +2 -3
  17. package/datepicker/esm2020/bs-daterangepicker-inline.component.mjs +27 -15
  18. package/datepicker/esm2020/bs-daterangepicker.component.mjs +11 -1
  19. package/datepicker/esm2020/reducer/bs-datepicker.reducer.mjs +2 -2
  20. package/datepicker/esm2020/themes/bs/bs-datepicker-container.component.mjs +10 -3
  21. package/datepicker/esm2020/themes/bs/bs-daterangepicker-container.component.mjs +10 -3
  22. package/datepicker/esm2020/utils/copy-time-utils.mjs +4 -1
  23. package/datepicker/fesm2015/ngx-bootstrap-datepicker.mjs +102 -34
  24. package/datepicker/fesm2015/ngx-bootstrap-datepicker.mjs.map +1 -1
  25. package/datepicker/fesm2020/ngx-bootstrap-datepicker.mjs +97 -34
  26. package/datepicker/fesm2020/ngx-bootstrap-datepicker.mjs.map +1 -1
  27. package/datepicker/package.json +8 -8
  28. package/dropdown/package.json +4 -4
  29. package/focus-trap/package.json +1 -1
  30. package/locale/package.json +2 -2
  31. package/mini-ngrx/package.json +1 -1
  32. package/modal/package.json +5 -5
  33. package/package.json +1 -1
  34. package/pagination/package.json +1 -1
  35. package/popover/package.json +4 -4
  36. package/positioning/package.json +2 -2
  37. package/progressbar/esm2020/bar.component.mjs +2 -2
  38. package/progressbar/fesm2015/ngx-bootstrap-progressbar.mjs +3 -3
  39. package/progressbar/fesm2015/ngx-bootstrap-progressbar.mjs.map +1 -1
  40. package/progressbar/fesm2020/ngx-bootstrap-progressbar.mjs +1 -1
  41. package/progressbar/fesm2020/ngx-bootstrap-progressbar.mjs.map +1 -1
  42. package/progressbar/package.json +2 -2
  43. package/rating/package.json +1 -1
  44. package/schematics/ng-add/index.js +1 -1
  45. package/schematics/package.json +1 -1
  46. package/schematics/utils/current_dependency_versions.json +1 -1
  47. package/sortable/package.json +1 -1
  48. package/tabs/package.json +1 -1
  49. package/timepicker/package.json +2 -2
  50. package/tooltip/package.json +4 -4
  51. package/typeahead/package.json +4 -4
  52. package/utils/esm2020/theme-provider.mjs +9 -7
  53. package/utils/fesm2015/ngx-bootstrap-utils.mjs +8 -6
  54. package/utils/fesm2015/ngx-bootstrap-utils.mjs.map +1 -1
  55. package/utils/fesm2020/ngx-bootstrap-utils.mjs +8 -6
  56. package/utils/fesm2020/ngx-bootstrap-utils.mjs.map +1 -1
  57. package/utils/package.json +1 -1
@@ -93,6 +93,10 @@ class BsDatepickerConfig {
93
93
  * Shows timepicker under datepicker
94
94
  */
95
95
  this.withTimepicker = false;
96
+ /**
97
+ * Set allowed positions of container.
98
+ */
99
+ this.allowedPositions = ['top', 'bottom'];
96
100
  }
97
101
  }
98
102
  BsDatepickerConfig.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: BsDatepickerConfig, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
@@ -976,6 +980,9 @@ function flagYearsCalendar(yearsCalendar, options) {
976
980
  }
977
981
 
978
982
  function copyTime(sourceDate, time) {
983
+ if (!sourceDate || !isNaN(sourceDate.getTime())) {
984
+ return;
985
+ }
979
986
  sourceDate.setHours(time.getHours());
980
987
  sourceDate.setMinutes(time.getMinutes());
981
988
  sourceDate.setSeconds(time.getSeconds());
@@ -1090,7 +1097,7 @@ function bsDatepickerReducer(state = initialDatepickerState, action) {
1090
1097
  selectedRange: action.payload,
1091
1098
  view: state.view
1092
1099
  };
1093
- newState.selectedRange.forEach((dte, index) => {
1100
+ newState.selectedRange?.forEach((dte, index) => {
1094
1101
  if (Array.isArray(state.selectedTime)) {
1095
1102
  const _time = state.selectedTime[index];
1096
1103
  if (_time) {
@@ -2082,8 +2089,15 @@ class BsDatepickerContainerComponent extends BsDatepickerAbstractComponent {
2082
2089
  }
2083
2090
  ngOnInit() {
2084
2091
  this._positionService.setOptions({
2085
- modifiers: { flip: { enabled: this._config.adaptivePosition } },
2086
- allowedPositions: ['top', 'bottom']
2092
+ modifiers: {
2093
+ flip: {
2094
+ enabled: this._config.adaptivePosition
2095
+ },
2096
+ preventOverflow: {
2097
+ enabled: this._config.adaptivePosition
2098
+ }
2099
+ },
2100
+ allowedPositions: this._config.allowedPositions
2087
2101
  });
2088
2102
  this._positionService.event$?.pipe(take(1))
2089
2103
  .subscribe(() => {
@@ -2317,6 +2331,21 @@ class BsDatepickerDirective {
2317
2331
  this._datepickerRef.instance.dateTooltipTexts = this.dateTooltipTexts;
2318
2332
  }
2319
2333
  }
2334
+ initSubscribes() {
2335
+ // if date changes from external source (model -> view)
2336
+ this._subs.push(this.bsValueChange.subscribe((value) => {
2337
+ if (this._datepickerRef) {
2338
+ this._datepickerRef.instance.value = value;
2339
+ }
2340
+ }));
2341
+ // if date changes from picker (view -> model)
2342
+ if (this._datepickerRef) {
2343
+ this._subs.push(this._datepickerRef.instance.valueChange.subscribe((value) => {
2344
+ this.bsValue = value;
2345
+ this.hide();
2346
+ }));
2347
+ }
2348
+ }
2320
2349
  ngAfterViewInit() {
2321
2350
  this.isOpen$.pipe(filter(isOpen => isOpen !== this.isOpen), takeUntil(this.isDestroy$))
2322
2351
  .subscribe(() => this.toggle());
@@ -2336,19 +2365,7 @@ class BsDatepickerDirective {
2336
2365
  .to(this.container)
2337
2366
  .position({ attachment: this.placement })
2338
2367
  .show({ placement: this.placement });
2339
- // if date changes from external source (model -> view)
2340
- this._subs.push(this.bsValueChange.subscribe((value) => {
2341
- if (this._datepickerRef) {
2342
- this._datepickerRef.instance.value = value;
2343
- }
2344
- }));
2345
- // if date changes from picker (view -> model)
2346
- if (this._datepickerRef) {
2347
- this._subs.push(this._datepickerRef.instance.valueChange.subscribe((value) => {
2348
- this.bsValue = value;
2349
- this.hide();
2350
- }));
2351
- }
2368
+ this.initSubscribes();
2352
2369
  }
2353
2370
  /**
2354
2371
  * Closes an element’s datepicker. This is considered a “manual” triggering of
@@ -2393,6 +2410,12 @@ class BsDatepickerDirective {
2393
2410
  initCurrentTime: this.bsConfig?.initCurrentTime
2394
2411
  });
2395
2412
  }
2413
+ unsubscribeSubscriptions() {
2414
+ if (this._subs?.length) {
2415
+ this._subs.map(sub => sub.unsubscribe());
2416
+ this._subs.length = 0;
2417
+ }
2418
+ }
2396
2419
  ngOnDestroy() {
2397
2420
  this._datepicker.dispose();
2398
2421
  this.isOpen$.next(false);
@@ -2400,6 +2423,7 @@ class BsDatepickerDirective {
2400
2423
  this.isDestroy$.next(null);
2401
2424
  this.isDestroy$.complete();
2402
2425
  }
2426
+ this.unsubscribeSubscriptions();
2403
2427
  }
2404
2428
  }
2405
2429
  BsDatepickerDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: BsDatepickerDirective, deps: [{ token: BsDatepickerConfig }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ViewContainerRef }, { token: i2.ComponentLoaderFactory }], target: i0.ɵɵFactoryTarget.Directive });
@@ -2515,19 +2539,27 @@ class BsDatepickerInlineDirective {
2515
2539
  }
2516
2540
  ngOnInit() {
2517
2541
  this.setConfig();
2518
- // if date changes from external source (model -> view)
2542
+ this.initSubscribes();
2543
+ }
2544
+ initSubscribes() {
2545
+ this.unsubscribeSubscriptions();
2519
2546
  this._subs.push(this.bsValueChange.subscribe((value) => {
2520
2547
  if (this._datepickerRef) {
2521
2548
  this._datepickerRef.instance.value = value;
2522
2549
  }
2523
2550
  }));
2524
- // if date changes from picker (view -> model)
2525
2551
  if (this._datepickerRef) {
2526
2552
  this._subs.push(this._datepickerRef.instance.valueChange.subscribe((value) => {
2527
2553
  this.bsValue = value;
2528
2554
  }));
2529
2555
  }
2530
2556
  }
2557
+ unsubscribeSubscriptions() {
2558
+ if (this._subs?.length) {
2559
+ this._subs.map(sub => sub.unsubscribe());
2560
+ this._subs.length = 0;
2561
+ }
2562
+ }
2531
2563
  ngOnChanges(changes) {
2532
2564
  if (changes["bsConfig"]) {
2533
2565
  if (changes["bsConfig"].currentValue?.initCurrentTime && changes["bsConfig"].currentValue?.initCurrentTime !== changes["bsConfig"].previousValue?.initCurrentTime && this._bsValue) {
@@ -2585,9 +2617,11 @@ class BsDatepickerInlineDirective {
2585
2617
  .attach(BsDatepickerInlineContainerComponent)
2586
2618
  .to(this._elementRef)
2587
2619
  .show();
2620
+ this.initSubscribes();
2588
2621
  }
2589
2622
  ngOnDestroy() {
2590
2623
  this._datepicker.dispose();
2624
+ this.unsubscribeSubscriptions();
2591
2625
  }
2592
2626
  }
2593
2627
  BsDatepickerInlineDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: BsDatepickerInlineDirective, deps: [{ token: BsDatepickerInlineConfig }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ViewContainerRef }, { token: i2.ComponentLoaderFactory }], target: i0.ɵɵFactoryTarget.Directive });
@@ -2663,8 +2697,15 @@ class BsDaterangepickerContainerComponent extends BsDatepickerAbstractComponent
2663
2697
  }
2664
2698
  ngOnInit() {
2665
2699
  this._positionService.setOptions({
2666
- modifiers: { flip: { enabled: this._config.adaptivePosition } },
2667
- allowedPositions: ['top', 'bottom']
2700
+ modifiers: {
2701
+ flip: {
2702
+ enabled: this._config.adaptivePosition
2703
+ },
2704
+ preventOverflow: {
2705
+ enabled: this._config.adaptivePosition
2706
+ }
2707
+ },
2708
+ allowedPositions: this._config.allowedPositions
2668
2709
  });
2669
2710
  this._positionService.event$?.pipe(take(1))
2670
2711
  .subscribe(() => {
@@ -2888,20 +2929,7 @@ class BsDaterangepickerInlineDirective {
2888
2929
  }
2889
2930
  ngOnInit() {
2890
2931
  this.setConfig();
2891
- // if date changes from external source (model -> view)
2892
- this._subs.push(this.bsValueChange.subscribe((value) => {
2893
- if (this._datepickerRef) {
2894
- this._datepickerRef.instance.value = value;
2895
- }
2896
- }));
2897
- // if date changes from picker (view -> model)
2898
- if (this._datepickerRef) {
2899
- this._subs.push(this._datepickerRef.instance.valueChange
2900
- .pipe(filter((range) => range && range[0] && !!range[1]))
2901
- .subscribe((value) => {
2902
- this.bsValue = value;
2903
- }));
2904
- }
2932
+ this.initSubscribes();
2905
2933
  }
2906
2934
  ngOnChanges(changes) {
2907
2935
  if (changes["bsConfig"]) {
@@ -2962,9 +2990,34 @@ class BsDaterangepickerInlineDirective {
2962
2990
  .attach(BsDaterangepickerInlineContainerComponent)
2963
2991
  .to(this._elementRef)
2964
2992
  .show();
2993
+ this.initSubscribes();
2994
+ }
2995
+ initSubscribes() {
2996
+ this.unsubscribeSubscriptions();
2997
+ // if date changes from external source (model -> view)
2998
+ this._subs.push(this.bsValueChange.subscribe((value) => {
2999
+ if (this._datepickerRef) {
3000
+ this._datepickerRef.instance.value = value;
3001
+ }
3002
+ }));
3003
+ // if date changes from picker (view -> model)
3004
+ if (this._datepickerRef) {
3005
+ this._subs.push(this._datepickerRef.instance.valueChange
3006
+ .pipe(filter((range) => range && range[0] && !!range[1]))
3007
+ .subscribe((value) => {
3008
+ this.bsValue = value;
3009
+ }));
3010
+ }
3011
+ }
3012
+ unsubscribeSubscriptions() {
3013
+ if (this._subs?.length) {
3014
+ this._subs.map(sub => sub.unsubscribe());
3015
+ this._subs.length = 0;
3016
+ }
2965
3017
  }
2966
3018
  ngOnDestroy() {
2967
3019
  this._datepicker.dispose();
3020
+ this.unsubscribeSubscriptions();
2968
3021
  }
2969
3022
  }
2970
3023
  BsDaterangepickerInlineDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: BsDaterangepickerInlineDirective, deps: [{ token: BsDaterangepickerInlineConfig }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ViewContainerRef }, { token: i2.ComponentLoaderFactory }], target: i0.ɵɵFactoryTarget.Directive });
@@ -3297,6 +3350,9 @@ class BsDaterangepickerDirective {
3297
3350
  .to(this.container)
3298
3351
  .position({ attachment: this.placement })
3299
3352
  .show({ placement: this.placement });
3353
+ this.initSubscribes();
3354
+ }
3355
+ initSubscribes() {
3300
3356
  // if date changes from external source (model -> view)
3301
3357
  this._subs.push(this.bsValueChange.subscribe((value) => {
3302
3358
  if (this._datepickerRef) {
@@ -3356,6 +3412,12 @@ class BsDaterangepickerDirective {
3356
3412
  }
3357
3413
  this.show();
3358
3414
  }
3415
+ unsubscribeSubscriptions() {
3416
+ if (this._subs?.length) {
3417
+ this._subs.map(sub => sub.unsubscribe());
3418
+ this._subs.length = 0;
3419
+ }
3420
+ }
3359
3421
  ngOnDestroy() {
3360
3422
  this._datepicker.dispose();
3361
3423
  this.isOpen$.next(false);
@@ -3363,6 +3425,7 @@ class BsDaterangepickerDirective {
3363
3425
  this.isDestroy$.next(null);
3364
3426
  this.isDestroy$.complete();
3365
3427
  }
3428
+ this.unsubscribeSubscriptions();
3366
3429
  }
3367
3430
  }
3368
3431
  BsDaterangepickerDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: BsDaterangepickerDirective, deps: [{ token: BsDaterangepickerConfig }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ViewContainerRef }, { token: i2.ComponentLoaderFactory }], target: i0.ɵɵFactoryTarget.Directive });