ngx-bootstrap 8.0.0-RC.2 → 8.0.0-RC.3

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 (73) hide show
  1. package/accordion/package.json +5 -3
  2. package/alert/package.json +4 -2
  3. package/buttons/package.json +3 -1
  4. package/carousel/package.json +4 -2
  5. package/chronos/esm2020/i18n/es-pr.mjs +74 -0
  6. package/chronos/esm2020/public_api.mjs +2 -1
  7. package/chronos/fesm2015/ngx-bootstrap-chronos.mjs +90 -17
  8. package/chronos/fesm2015/ngx-bootstrap-chronos.mjs.map +1 -1
  9. package/chronos/fesm2020/ngx-bootstrap-chronos.mjs +90 -17
  10. package/chronos/fesm2020/ngx-bootstrap-chronos.mjs.map +1 -1
  11. package/chronos/i18n/es-pr.d.ts +2 -0
  12. package/chronos/package.json +3 -1
  13. package/chronos/public_api.d.ts +1 -0
  14. package/collapse/package.json +3 -1
  15. package/component-loader/package.json +5 -3
  16. package/datepicker/esm2020/public_api.mjs +1 -9
  17. package/datepicker/esm2020/reducer/bs-datepicker.reducer.mjs +2 -2
  18. package/datepicker/fesm2015/ngx-bootstrap-datepicker.mjs +3 -1108
  19. package/datepicker/fesm2015/ngx-bootstrap-datepicker.mjs.map +1 -1
  20. package/datepicker/fesm2020/ngx-bootstrap-datepicker.mjs +3 -1107
  21. package/datepicker/fesm2020/ngx-bootstrap-datepicker.mjs.map +1 -1
  22. package/datepicker/package.json +10 -8
  23. package/datepicker/public_api.d.ts +0 -8
  24. package/dropdown/package.json +6 -4
  25. package/focus-trap/package.json +3 -1
  26. package/locale/esm2020/public_api.mjs +2 -1
  27. package/locale/fesm2015/ngx-bootstrap-locale.mjs +1 -1
  28. package/locale/fesm2020/ngx-bootstrap-locale.mjs +1 -1
  29. package/locale/package.json +4 -2
  30. package/locale/public_api.d.ts +1 -0
  31. package/mini-ngrx/package.json +3 -1
  32. package/modal/package.json +7 -5
  33. package/package.json +5 -5
  34. package/pagination/package.json +3 -1
  35. package/popover/esm2020/popover-container.component.mjs +3 -3
  36. package/popover/fesm2015/ngx-bootstrap-popover.mjs +2 -2
  37. package/popover/fesm2015/ngx-bootstrap-popover.mjs.map +1 -1
  38. package/popover/fesm2020/ngx-bootstrap-popover.mjs +2 -2
  39. package/popover/fesm2020/ngx-bootstrap-popover.mjs.map +1 -1
  40. package/popover/package.json +6 -4
  41. package/positioning/esm2020/modifiers/preventOverflow.mjs +6 -7
  42. package/positioning/esm2020/utils/computeAutoPlacement.mjs +15 -19
  43. package/positioning/fesm2015/ngx-bootstrap-positioning.mjs +21 -26
  44. package/positioning/fesm2015/ngx-bootstrap-positioning.mjs.map +1 -1
  45. package/positioning/fesm2020/ngx-bootstrap-positioning.mjs +19 -24
  46. package/positioning/fesm2020/ngx-bootstrap-positioning.mjs.map +1 -1
  47. package/positioning/package.json +4 -2
  48. package/progressbar/package.json +4 -2
  49. package/rating/package.json +3 -1
  50. package/schematics/package.json +3 -1
  51. package/schematics/utils/current_dependency_versions.json +1 -1
  52. package/sortable/package.json +3 -1
  53. package/tabs/package.json +3 -1
  54. package/timepicker/package.json +4 -2
  55. package/tooltip/package.json +6 -4
  56. package/typeahead/package.json +6 -4
  57. package/utils/package.json +3 -1
  58. package/datepicker/date-formatter.d.ts +0 -3
  59. package/datepicker/datepicker-inner.component.d.ts +0 -80
  60. package/datepicker/datepicker.component.d.ts +0 -81
  61. package/datepicker/datepicker.config.d.ts +0 -22
  62. package/datepicker/datepicker.module.d.ts +0 -15
  63. package/datepicker/daypicker.component.d.ts +0 -20
  64. package/datepicker/esm2020/date-formatter.mjs +0 -7
  65. package/datepicker/esm2020/datepicker-inner.component.mjs +0 -325
  66. package/datepicker/esm2020/datepicker.component.mjs +0 -204
  67. package/datepicker/esm2020/datepicker.config.mjs +0 -32
  68. package/datepicker/esm2020/datepicker.module.mjs +0 -48
  69. package/datepicker/esm2020/daypicker.component.mjs +0 -255
  70. package/datepicker/esm2020/monthpicker.component.mjs +0 -131
  71. package/datepicker/esm2020/yearpicker.component.mjs +0 -146
  72. package/datepicker/monthpicker.component.d.ts +0 -14
  73. package/datepicker/yearpicker.component.d.ts +0 -14
@@ -15,8 +15,7 @@ import * as i7 from 'ngx-bootstrap/timepicker';
15
15
  import { TimepickerActions, TimepickerModule } from 'ngx-bootstrap/timepicker';
16
16
  import * as i2 from 'ngx-bootstrap/component-loader';
17
17
  import { ComponentLoaderFactory } from 'ngx-bootstrap/component-loader';
18
- import { NG_VALUE_ACCESSOR, NG_VALIDATORS, FormsModule } from '@angular/forms';
19
- import { isBs3 } from 'ngx-bootstrap/utils';
18
+ import { NG_VALUE_ACCESSOR, NG_VALIDATORS } from '@angular/forms';
20
19
 
21
20
  /**
22
21
  * For date range picker there are `BsDaterangepickerConfig` which inherits all properties,
@@ -1063,7 +1062,7 @@ function bsDatepickerReducer(state = initialDatepickerState, action) {
1063
1062
  };
1064
1063
  if (Array.isArray(state.selectedTime)) {
1065
1064
  const _time = state.selectedTime[0];
1066
- if (_time) {
1065
+ if (newState.selectedDate && _time) {
1067
1066
  copyTime(newState.selectedDate, _time);
1068
1067
  }
1069
1068
  }
@@ -3644,1072 +3643,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
3644
3643
  }] }, { type: BsLocaleService }, { type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }];
3645
3644
  } });
3646
3645
 
3647
- class DateFormatter {
3648
- format(date, format, locale) {
3649
- return formatDate(date, format, locale);
3650
- }
3651
- }
3652
-
3653
- class DatePickerInnerComponent {
3654
- constructor() {
3655
- this.monthColLimit = 0;
3656
- this.yearColLimit = 0;
3657
- this.selectionDone = new EventEmitter(undefined);
3658
- this.update = new EventEmitter(false);
3659
- this.activeDateChange = new EventEmitter(undefined);
3660
- this.stepDay = {};
3661
- this.stepMonth = {};
3662
- this.stepYear = {};
3663
- this.modes = ['day', 'month', 'year'];
3664
- this.dateFormatter = new DateFormatter();
3665
- }
3666
- get activeDate() {
3667
- return this._activeDate;
3668
- }
3669
- set activeDate(value) {
3670
- this._activeDate = value;
3671
- }
3672
- // todo: add formatter value to Date object
3673
- ngOnInit() {
3674
- // todo: use date for unique value
3675
- this.uniqueId = `datepicker--${Math.floor(Math.random() * 10000)}`;
3676
- if (this.initDate) {
3677
- this.activeDate = this.initDate;
3678
- this.selectedDate = new Date(this.activeDate.valueOf());
3679
- this.update.emit(this.activeDate);
3680
- }
3681
- else if (this.activeDate === undefined) {
3682
- this.activeDate = new Date();
3683
- }
3684
- }
3685
- // this.refreshView should be called here to reflect the changes on the fly
3686
- ngOnChanges(changes) {
3687
- this.refreshView();
3688
- this.checkIfActiveDateGotUpdated(changes["activeDate"]);
3689
- }
3690
- // Check if activeDate has been update and then emit the activeDateChange with the new date
3691
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
3692
- checkIfActiveDateGotUpdated(activeDate) {
3693
- if (activeDate && !activeDate.firstChange) {
3694
- const previousValue = activeDate.previousValue;
3695
- if (previousValue &&
3696
- previousValue instanceof Date &&
3697
- previousValue.getTime() !== activeDate.currentValue.getTime()) {
3698
- this.activeDateChange.emit(this.activeDate);
3699
- }
3700
- }
3701
- }
3702
- setCompareHandler(handler, type) {
3703
- if (type === 'day') {
3704
- this.compareHandlerDay = handler;
3705
- }
3706
- if (type === 'month') {
3707
- this.compareHandlerMonth = handler;
3708
- }
3709
- if (type === 'year') {
3710
- this.compareHandlerYear = handler;
3711
- }
3712
- }
3713
- compare(date1, date2) {
3714
- if (date1 === undefined || date2 === undefined) {
3715
- return undefined;
3716
- }
3717
- if (this.datepickerMode === 'day' && this.compareHandlerDay) {
3718
- return this.compareHandlerDay(date1, date2);
3719
- }
3720
- if (this.datepickerMode === 'month' && this.compareHandlerMonth) {
3721
- return this.compareHandlerMonth(date1, date2);
3722
- }
3723
- if (this.datepickerMode === 'year' && this.compareHandlerYear) {
3724
- return this.compareHandlerYear(date1, date2);
3725
- }
3726
- return void 0;
3727
- }
3728
- setRefreshViewHandler(handler, type) {
3729
- if (type === 'day') {
3730
- this.refreshViewHandlerDay = handler;
3731
- }
3732
- if (type === 'month') {
3733
- this.refreshViewHandlerMonth = handler;
3734
- }
3735
- if (type === 'year') {
3736
- this.refreshViewHandlerYear = handler;
3737
- }
3738
- }
3739
- refreshView() {
3740
- if (this.datepickerMode === 'day' && this.refreshViewHandlerDay) {
3741
- this.refreshViewHandlerDay();
3742
- }
3743
- if (this.datepickerMode === 'month' && this.refreshViewHandlerMonth) {
3744
- this.refreshViewHandlerMonth();
3745
- }
3746
- if (this.datepickerMode === 'year' && this.refreshViewHandlerYear) {
3747
- this.refreshViewHandlerYear();
3748
- }
3749
- }
3750
- dateFilter(date, format) {
3751
- return this.dateFormatter.format(date, format, this.locale);
3752
- }
3753
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
3754
- isActive(dateObject) {
3755
- if (this.compare(dateObject.date, this.activeDate) === 0) {
3756
- this.activeDateId = dateObject.uid;
3757
- return true;
3758
- }
3759
- return false;
3760
- }
3761
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
3762
- createDateObject(date, format) {
3763
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
3764
- const dateObject = {};
3765
- dateObject.date = new Date(date.getFullYear(), date.getMonth(), date.getDate());
3766
- dateObject.date = this.fixTimeZone(dateObject.date);
3767
- dateObject.label = this.dateFilter(date, format);
3768
- dateObject.selected = this.compare(date, this.selectedDate) === 0;
3769
- dateObject.disabled = this.isDisabled(date);
3770
- dateObject.current = this.compare(date, new Date()) === 0;
3771
- dateObject.customClass = this.getCustomClassForDate(dateObject.date);
3772
- return dateObject;
3773
- }
3774
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
3775
- split(arr, size) {
3776
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
3777
- const arrays = [];
3778
- while (arr.length > 0) {
3779
- arrays.push(arr.splice(0, size));
3780
- }
3781
- return arrays;
3782
- }
3783
- // Fix a hard-reproducible bug with timezones
3784
- // The bug depends on OS, browser, current timezone and current date
3785
- // i.e.
3786
- // var date = new Date(2014, 0, 1);
3787
- // console.log(date.getFullYear(), date.getMonth(), date.getDate(),
3788
- // date.getHours()); can result in "2013 11 31 23" because of the bug.
3789
- fixTimeZone(date) {
3790
- const hours = date.getHours();
3791
- return new Date(date.getFullYear(), date.getMonth(), date.getDate(), hours === 23 ? hours + 2 : 0);
3792
- }
3793
- select(date, isManual = true) {
3794
- if (this.datepickerMode === this.minMode) {
3795
- if (!this.activeDate) {
3796
- this.activeDate = new Date(0, 0, 0, 0, 0, 0, 0);
3797
- }
3798
- this.activeDate = new Date(date.getFullYear(), date.getMonth(), date.getDate());
3799
- this.activeDate = this.fixTimeZone(this.activeDate);
3800
- if (isManual) {
3801
- this.selectionDone.emit(this.activeDate);
3802
- }
3803
- }
3804
- else {
3805
- this.activeDate = new Date(date.getFullYear(), date.getMonth(), date.getDate());
3806
- this.activeDate = this.fixTimeZone(this.activeDate);
3807
- if (isManual && this.datepickerMode) {
3808
- this.datepickerMode = this.modes[this.modes.indexOf(this.datepickerMode) - 1];
3809
- }
3810
- }
3811
- this.selectedDate = new Date(this.activeDate.valueOf());
3812
- this.update.emit(this.activeDate);
3813
- this.refreshView();
3814
- }
3815
- move(direction) {
3816
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
3817
- let expectedStep;
3818
- if (this.datepickerMode === 'day') {
3819
- expectedStep = this.stepDay;
3820
- }
3821
- if (this.datepickerMode === 'month') {
3822
- expectedStep = this.stepMonth;
3823
- }
3824
- if (this.datepickerMode === 'year') {
3825
- expectedStep = this.stepYear;
3826
- }
3827
- if (expectedStep && this.activeDate) {
3828
- const year = this.activeDate.getFullYear() + direction * (expectedStep.years || 0);
3829
- const month = this.activeDate.getMonth() + direction * (expectedStep.months || 0);
3830
- this.activeDate = new Date(year, month, 1);
3831
- this.refreshView();
3832
- this.activeDateChange.emit(this.activeDate);
3833
- }
3834
- }
3835
- toggleMode(_direction) {
3836
- const direction = _direction || 1;
3837
- if ((this.datepickerMode === this.maxMode && direction === 1) ||
3838
- (this.datepickerMode === this.minMode && direction === -1)) {
3839
- return;
3840
- }
3841
- if (this.datepickerMode) {
3842
- this.datepickerMode = this.modes[this.modes.indexOf(this.datepickerMode) + direction];
3843
- }
3844
- this.refreshView();
3845
- }
3846
- getCustomClassForDate(date) {
3847
- if (!this.customClass) {
3848
- return '';
3849
- }
3850
- // todo: build a hash of custom classes, it will work faster
3851
- const customClassObject = this.customClass.find((customClass) => {
3852
- return (customClass.date.valueOf() === date.valueOf() &&
3853
- customClass.mode === this.datepickerMode);
3854
- }, this);
3855
- return customClassObject === undefined ? '' : customClassObject.clazz;
3856
- }
3857
- compareDateDisabled(date1Disabled, date2) {
3858
- if (date1Disabled === undefined || date2 === undefined) {
3859
- return undefined;
3860
- }
3861
- if (date1Disabled.mode === 'day' && this.compareHandlerDay) {
3862
- return this.compareHandlerDay(date1Disabled.date, date2);
3863
- }
3864
- if (date1Disabled.mode === 'month' && this.compareHandlerMonth) {
3865
- return this.compareHandlerMonth(date1Disabled.date, date2);
3866
- }
3867
- if (date1Disabled.mode === 'year' && this.compareHandlerYear) {
3868
- return this.compareHandlerYear(date1Disabled.date, date2);
3869
- }
3870
- return undefined;
3871
- }
3872
- isDisabled(date) {
3873
- let isDateDisabled = false;
3874
- if (this.dateDisabled) {
3875
- this.dateDisabled.forEach((disabledDate) => {
3876
- if (this.compareDateDisabled(disabledDate, date) === 0) {
3877
- isDateDisabled = true;
3878
- }
3879
- });
3880
- }
3881
- if (this.dayDisabled) {
3882
- isDateDisabled =
3883
- isDateDisabled ||
3884
- this.dayDisabled.indexOf(date.getDay()) > -1;
3885
- }
3886
- if (isDateDisabled) {
3887
- return isDateDisabled;
3888
- }
3889
- const minDate = Number(this.minDate && this.compare(date, this.minDate));
3890
- if (!isNaN(minDate)) {
3891
- return minDate < 0;
3892
- }
3893
- const maxDate = Number(this.maxDate && this.compare(date, this.maxDate));
3894
- if (!isNaN(maxDate)) {
3895
- return maxDate > 0;
3896
- }
3897
- return false;
3898
- }
3899
- }
3900
- DatePickerInnerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: DatePickerInnerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
3901
- DatePickerInnerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: DatePickerInnerComponent, selector: "datepicker-inner", inputs: { locale: "locale", datepickerMode: "datepickerMode", startingDay: "startingDay", yearRange: "yearRange", minDate: "minDate", maxDate: "maxDate", minMode: "minMode", maxMode: "maxMode", showWeeks: "showWeeks", formatDay: "formatDay", formatMonth: "formatMonth", formatYear: "formatYear", formatDayHeader: "formatDayHeader", formatDayTitle: "formatDayTitle", formatMonthTitle: "formatMonthTitle", onlyCurrentMonth: "onlyCurrentMonth", shortcutPropagation: "shortcutPropagation", customClass: "customClass", monthColLimit: "monthColLimit", yearColLimit: "yearColLimit", dateDisabled: "dateDisabled", dayDisabled: "dayDisabled", initDate: "initDate", activeDate: "activeDate" }, outputs: { selectionDone: "selectionDone", update: "update", activeDateChange: "activeDateChange" }, usesOnChanges: true, ngImport: i0, template: `
3902
- <!--&lt;!&ndash;ng-keydown="keydown($event)"&ndash;&gt;-->
3903
- <div *ngIf='datepickerMode' class='well well-sm bg-faded p-a card' role='application'>
3904
- <ng-content></ng-content>
3905
- </div>
3906
- `, isInline: true, directives: [{ type: i11.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
3907
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: DatePickerInnerComponent, decorators: [{
3908
- type: Component,
3909
- args: [{
3910
- selector: 'datepicker-inner',
3911
- template: `
3912
- <!--&lt;!&ndash;ng-keydown="keydown($event)"&ndash;&gt;-->
3913
- <div *ngIf='datepickerMode' class='well well-sm bg-faded p-a card' role='application'>
3914
- <ng-content></ng-content>
3915
- </div>
3916
- `
3917
- }]
3918
- }], propDecorators: { locale: [{
3919
- type: Input
3920
- }], datepickerMode: [{
3921
- type: Input
3922
- }], startingDay: [{
3923
- type: Input
3924
- }], yearRange: [{
3925
- type: Input
3926
- }], minDate: [{
3927
- type: Input
3928
- }], maxDate: [{
3929
- type: Input
3930
- }], minMode: [{
3931
- type: Input
3932
- }], maxMode: [{
3933
- type: Input
3934
- }], showWeeks: [{
3935
- type: Input
3936
- }], formatDay: [{
3937
- type: Input
3938
- }], formatMonth: [{
3939
- type: Input
3940
- }], formatYear: [{
3941
- type: Input
3942
- }], formatDayHeader: [{
3943
- type: Input
3944
- }], formatDayTitle: [{
3945
- type: Input
3946
- }], formatMonthTitle: [{
3947
- type: Input
3948
- }], onlyCurrentMonth: [{
3949
- type: Input
3950
- }], shortcutPropagation: [{
3951
- type: Input
3952
- }], customClass: [{
3953
- type: Input
3954
- }], monthColLimit: [{
3955
- type: Input
3956
- }], yearColLimit: [{
3957
- type: Input
3958
- }], dateDisabled: [{
3959
- type: Input
3960
- }], dayDisabled: [{
3961
- type: Input
3962
- }], initDate: [{
3963
- type: Input
3964
- }], selectionDone: [{
3965
- type: Output
3966
- }], update: [{
3967
- type: Output
3968
- }], activeDateChange: [{
3969
- type: Output
3970
- }], activeDate: [{
3971
- type: Input
3972
- }] } });
3973
-
3974
- class DatepickerConfig {
3975
- constructor() {
3976
- this.locale = 'en';
3977
- this.datepickerMode = 'day';
3978
- this.startingDay = 0;
3979
- this.yearRange = 20;
3980
- this.minMode = 'day';
3981
- this.maxMode = 'year';
3982
- this.showWeeks = true;
3983
- this.formatDay = 'DD';
3984
- this.formatMonth = 'MMMM';
3985
- this.formatYear = 'YYYY';
3986
- this.formatDayHeader = 'dd';
3987
- this.formatDayTitle = 'MMMM YYYY';
3988
- this.formatMonthTitle = 'YYYY';
3989
- this.onlyCurrentMonth = false;
3990
- this.monthColLimit = 3;
3991
- this.yearColLimit = 5;
3992
- this.shortcutPropagation = false;
3993
- }
3994
- }
3995
- DatepickerConfig.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: DatepickerConfig, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
3996
- DatepickerConfig.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: DatepickerConfig, providedIn: 'root' });
3997
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: DatepickerConfig, decorators: [{
3998
- type: Injectable,
3999
- args: [{
4000
- providedIn: 'root'
4001
- }]
4002
- }] });
4003
-
4004
- // @deprecated
4005
- class DayPickerComponent {
4006
- constructor(datePicker) {
4007
- this.labels = [];
4008
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
4009
- // @ts-ignore
4010
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
4011
- this.rows = [];
4012
- this.weekNumbers = [];
4013
- this.datePicker = datePicker;
4014
- }
4015
- get isBs4() {
4016
- return !isBs3();
4017
- }
4018
- /*protected getDaysInMonth(year:number, month:number) {
4019
- return ((month === 1) && (year % 4 === 0) &&
4020
- ((year % 100 !== 0) || (year % 400 === 0))) ? 29 : DAYS_IN_MONTH[month];
4021
- }*/
4022
- ngOnInit() {
4023
- // eslint-disable-next-line @typescript-eslint/no-this-alias
4024
- const self = this;
4025
- this.datePicker.stepDay = { months: 1 };
4026
- // todo valorkin fix
4027
- this.datePicker.setRefreshViewHandler(function () {
4028
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
4029
- // @ts-ignore
4030
- // eslint-disable-next-line @typescript-eslint/no-this-alias
4031
- const that = this;
4032
- const year = that.activeDate.getFullYear();
4033
- const month = that.activeDate.getMonth();
4034
- const firstDayOfMonth = new Date(year, month, 1);
4035
- const difference = that.startingDay - firstDayOfMonth.getDay();
4036
- const numDisplayedFromPreviousMonth = difference > 0 ? 7 - difference : -difference;
4037
- const firstDate = new Date(firstDayOfMonth.getTime());
4038
- if (numDisplayedFromPreviousMonth > 0) {
4039
- firstDate.setDate(-numDisplayedFromPreviousMonth + 1);
4040
- }
4041
- // 42 is the number of days on a six-week calendar
4042
- const _days = self.getDates(firstDate, 42);
4043
- const days = [];
4044
- for (let i = 0; i < 42; i++) {
4045
- const _dateObject = that.createDateObject(_days[i], that.formatDay);
4046
- _dateObject.secondary = _days[i].getMonth() !== month;
4047
- _dateObject.uid = that.uniqueId + '-' + i;
4048
- days[i] = _dateObject;
4049
- }
4050
- self.labels = [];
4051
- for (let j = 0; j < 7; j++) {
4052
- self.labels[j] = {};
4053
- self.labels[j].abbr = that.dateFilter(days[j].date, that.formatDayHeader);
4054
- self.labels[j].full = that.dateFilter(days[j].date, 'EEEE');
4055
- }
4056
- self.title = that.dateFilter(that.activeDate, that.formatDayTitle);
4057
- self.rows = that.split(days, 7);
4058
- if (that.showWeeks) {
4059
- self.weekNumbers = [];
4060
- const thursdayIndex = (4 + 7 - that.startingDay) % 7;
4061
- const numWeeks = self.rows.length;
4062
- for (let curWeek = 0; curWeek < numWeeks; curWeek++) {
4063
- const _date = self.rows[curWeek][thursdayIndex].date;
4064
- if (_date) {
4065
- self.weekNumbers.push(self.getISO8601WeekNumber(_date));
4066
- }
4067
- }
4068
- }
4069
- }, 'day');
4070
- this.datePicker.setCompareHandler(function (date1, date2) {
4071
- const d1 = new Date(date1.getFullYear(), date1.getMonth(), date1.getDate());
4072
- const d2 = new Date(date2.getFullYear(), date2.getMonth(), date2.getDate());
4073
- return d1.getTime() - d2.getTime();
4074
- }, 'day');
4075
- this.datePicker.refreshView();
4076
- }
4077
- getDates(startDate, n) {
4078
- const dates = new Array(n);
4079
- let current = new Date(startDate.getTime());
4080
- let i = 0;
4081
- let date;
4082
- while (i < n) {
4083
- date = new Date(current.getTime());
4084
- date = this.datePicker.fixTimeZone(date);
4085
- dates[i++] = date;
4086
- current = new Date(date.getFullYear(), date.getMonth(), date.getDate() + 1);
4087
- }
4088
- return dates;
4089
- }
4090
- getISO8601WeekNumber(date) {
4091
- const checkDate = new Date(date.getTime());
4092
- // Thursday
4093
- checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7));
4094
- const time = checkDate.getTime();
4095
- // Compare with Jan 1
4096
- checkDate.setMonth(0);
4097
- checkDate.setDate(1);
4098
- return (Math.floor(Math.round((time - checkDate.getTime()) / 86400000) / 7) + 1);
4099
- }
4100
- }
4101
- DayPickerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: DayPickerComponent, deps: [{ token: DatePickerInnerComponent }], target: i0.ɵɵFactoryTarget.Component });
4102
- DayPickerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: DayPickerComponent, selector: "daypicker", ngImport: i0, template: `
4103
- <table *ngIf="datePicker.datepickerMode === 'day'" role="grid" [attr.aria-labelledby]="datePicker.uniqueId + '-title'" aria-activedescendant="activeDateId">
4104
- <thead>
4105
- <tr>
4106
- <th>
4107
- <button *ngIf="!isBs4"
4108
- type="button"
4109
- class="btn btn-default btn-secondary btn-sm pull-left float-left"
4110
- (click)="datePicker.move(-1)"
4111
- tabindex="-1">‹</button>
4112
- <button *ngIf="isBs4"
4113
- type="button"
4114
- class="btn btn-default btn-secondary btn-sm pull-left float-left"
4115
- (click)="datePicker.move(-1)"
4116
- tabindex="-1">&lt;</button>
4117
- </th>
4118
- <th [attr.colspan]="5 + (datePicker.showWeeks ? 1 : 0)">
4119
- <button [id]="datePicker.uniqueId + '-title'"
4120
- type="button" class="btn btn-default btn-secondary btn-sm"
4121
- (click)="datePicker.toggleMode(0)"
4122
- [disabled]="datePicker.datepickerMode === datePicker.maxMode"
4123
- [ngClass]="{disabled: datePicker.datepickerMode === datePicker.maxMode}" tabindex="-1" style="width:100%;">
4124
- <strong>{{ title }}</strong>
4125
- </button>
4126
- </th>
4127
- <th>
4128
- <button *ngIf="!isBs4"
4129
- type="button"
4130
- class="btn btn-default btn-secondary btn-sm pull-right float-right"
4131
- (click)="datePicker.move(1)"
4132
- tabindex="-1">›</button>
4133
- <button *ngIf="isBs4"
4134
- type="button"
4135
- class="btn btn-default btn-secondary btn-sm pull-right float-right"
4136
- (click)="datePicker.move(1)"
4137
- tabindex="-1">&gt;
4138
- </button>
4139
- </th>
4140
- </tr>
4141
- <tr>
4142
- <th *ngIf="datePicker.showWeeks"></th>
4143
- <th *ngFor="let labelz of labels" class="text-center">
4144
- <small aria-label="labelz.full"><b>{{ labelz.abbr }}</b></small>
4145
- </th>
4146
- </tr>
4147
- </thead>
4148
- <tbody>
4149
- <ng-template ngFor [ngForOf]="rows" let-rowz="$implicit" let-index="index">
4150
- <tr *ngIf="!(datePicker.onlyCurrentMonth && rowz[0].secondary && rowz[6].secondary)">
4151
- <td *ngIf="datePicker.showWeeks" class="h6" class="text-center">
4152
- <em>{{ weekNumbers[index] }}</em>
4153
- </td>
4154
- <td *ngFor="let dtz of rowz" class="text-center" role="gridcell" [id]="dtz.uid">
4155
- <button type="button" style="min-width:100%;" class="btn btn-sm {{dtz.customClass}}"
4156
- *ngIf="!(datePicker.onlyCurrentMonth && dtz.secondary)"
4157
- [ngClass]="{'btn-secondary': isBs4 && !dtz.selected && !datePicker.isActive(dtz), 'btn-info': dtz.selected, disabled: dtz.disabled, active: !isBs4 && datePicker.isActive(dtz), 'btn-default': !isBs4}"
4158
- [disabled]="dtz.disabled"
4159
- (click)="datePicker.select(dtz.date)" tabindex="-1">
4160
- <span [ngClass]="{'text-muted': dtz.secondary || dtz.current, 'text-info': !isBs4 && dtz.current}">{{ dtz.label }}</span>
4161
- </button>
4162
- </td>
4163
- </tr>
4164
- </ng-template>
4165
- </tbody>
4166
- </table>
4167
- `, isInline: true, styles: [":host .btn-secondary{color:#292b2c;background-color:#fff;border-color:#ccc}:host .btn-info .text-muted{color:#292b2c!important}\n"], directives: [{ type: i11.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i11.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i11.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
4168
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: DayPickerComponent, decorators: [{
4169
- type: Component,
4170
- args: [{
4171
- selector: 'daypicker',
4172
- template: `
4173
- <table *ngIf="datePicker.datepickerMode === 'day'" role="grid" [attr.aria-labelledby]="datePicker.uniqueId + '-title'" aria-activedescendant="activeDateId">
4174
- <thead>
4175
- <tr>
4176
- <th>
4177
- <button *ngIf="!isBs4"
4178
- type="button"
4179
- class="btn btn-default btn-secondary btn-sm pull-left float-left"
4180
- (click)="datePicker.move(-1)"
4181
- tabindex="-1">‹</button>
4182
- <button *ngIf="isBs4"
4183
- type="button"
4184
- class="btn btn-default btn-secondary btn-sm pull-left float-left"
4185
- (click)="datePicker.move(-1)"
4186
- tabindex="-1">&lt;</button>
4187
- </th>
4188
- <th [attr.colspan]="5 + (datePicker.showWeeks ? 1 : 0)">
4189
- <button [id]="datePicker.uniqueId + '-title'"
4190
- type="button" class="btn btn-default btn-secondary btn-sm"
4191
- (click)="datePicker.toggleMode(0)"
4192
- [disabled]="datePicker.datepickerMode === datePicker.maxMode"
4193
- [ngClass]="{disabled: datePicker.datepickerMode === datePicker.maxMode}" tabindex="-1" style="width:100%;">
4194
- <strong>{{ title }}</strong>
4195
- </button>
4196
- </th>
4197
- <th>
4198
- <button *ngIf="!isBs4"
4199
- type="button"
4200
- class="btn btn-default btn-secondary btn-sm pull-right float-right"
4201
- (click)="datePicker.move(1)"
4202
- tabindex="-1">›</button>
4203
- <button *ngIf="isBs4"
4204
- type="button"
4205
- class="btn btn-default btn-secondary btn-sm pull-right float-right"
4206
- (click)="datePicker.move(1)"
4207
- tabindex="-1">&gt;
4208
- </button>
4209
- </th>
4210
- </tr>
4211
- <tr>
4212
- <th *ngIf="datePicker.showWeeks"></th>
4213
- <th *ngFor="let labelz of labels" class="text-center">
4214
- <small aria-label="labelz.full"><b>{{ labelz.abbr }}</b></small>
4215
- </th>
4216
- </tr>
4217
- </thead>
4218
- <tbody>
4219
- <ng-template ngFor [ngForOf]="rows" let-rowz="$implicit" let-index="index">
4220
- <tr *ngIf="!(datePicker.onlyCurrentMonth && rowz[0].secondary && rowz[6].secondary)">
4221
- <td *ngIf="datePicker.showWeeks" class="h6" class="text-center">
4222
- <em>{{ weekNumbers[index] }}</em>
4223
- </td>
4224
- <td *ngFor="let dtz of rowz" class="text-center" role="gridcell" [id]="dtz.uid">
4225
- <button type="button" style="min-width:100%;" class="btn btn-sm {{dtz.customClass}}"
4226
- *ngIf="!(datePicker.onlyCurrentMonth && dtz.secondary)"
4227
- [ngClass]="{'btn-secondary': isBs4 && !dtz.selected && !datePicker.isActive(dtz), 'btn-info': dtz.selected, disabled: dtz.disabled, active: !isBs4 && datePicker.isActive(dtz), 'btn-default': !isBs4}"
4228
- [disabled]="dtz.disabled"
4229
- (click)="datePicker.select(dtz.date)" tabindex="-1">
4230
- <span [ngClass]="{'text-muted': dtz.secondary || dtz.current, 'text-info': !isBs4 && dtz.current}">{{ dtz.label }}</span>
4231
- </button>
4232
- </td>
4233
- </tr>
4234
- </ng-template>
4235
- </tbody>
4236
- </table>
4237
- `,
4238
- styles: [
4239
- `
4240
- :host .btn-secondary {
4241
- color: #292b2c;
4242
- background-color: #fff;
4243
- border-color: #ccc;
4244
- }
4245
- :host .btn-info .text-muted {
4246
- color: #292b2c !important;
4247
- }
4248
- `
4249
- ]
4250
- }]
4251
- }], ctorParameters: function () { return [{ type: DatePickerInnerComponent }]; } });
4252
-
4253
- // @deprecated
4254
- class MonthPickerComponent {
4255
- constructor(datePicker) {
4256
- this.rows = [];
4257
- this.datePicker = datePicker;
4258
- }
4259
- get isBs4() {
4260
- return !isBs3();
4261
- }
4262
- ngOnInit() {
4263
- // eslint-disable-next-line @typescript-eslint/no-this-alias
4264
- const self = this;
4265
- this.datePicker.stepMonth = { years: 1 };
4266
- this.datePicker.setRefreshViewHandler(function () {
4267
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
4268
- // @ts-ignore
4269
- // eslint-disable-next-line @typescript-eslint/no-this-alias
4270
- const that = this;
4271
- const months = new Array(12);
4272
- const year = that.activeDate.getFullYear();
4273
- let date;
4274
- for (let i = 0; i < 12; i++) {
4275
- date = new Date(year, i, 1);
4276
- date = that.fixTimeZone(date);
4277
- months[i] = that.createDateObject(date, that.formatMonth);
4278
- months[i].uid = that.uniqueId + '-' + i;
4279
- }
4280
- self.title = that.dateFilter(that.activeDate, that.formatMonthTitle);
4281
- self.rows = that.split(months, self.datePicker.monthColLimit);
4282
- }, 'month');
4283
- this.datePicker.setCompareHandler(function (date1, date2) {
4284
- const d1 = new Date(date1.getFullYear(), date1.getMonth());
4285
- const d2 = new Date(date2.getFullYear(), date2.getMonth());
4286
- return d1.getTime() - d2.getTime();
4287
- }, 'month');
4288
- this.datePicker.refreshView();
4289
- }
4290
- }
4291
- MonthPickerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonthPickerComponent, deps: [{ token: DatePickerInnerComponent }], target: i0.ɵɵFactoryTarget.Component });
4292
- MonthPickerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: MonthPickerComponent, selector: "monthpicker", ngImport: i0, template: `
4293
- <table *ngIf="datePicker.datepickerMode==='month'" role="grid">
4294
- <thead>
4295
- <tr>
4296
- <th>
4297
- <button type="button" class="btn btn-default btn-sm pull-left float-left"
4298
- (click)="datePicker.move(-1)" tabindex="-1">‹</button></th>
4299
- <th [attr.colspan]="((datePicker.monthColLimit - 2) <= 0) ? 1 : datePicker.monthColLimit - 2">
4300
- <button [id]="datePicker.uniqueId + '-title'"
4301
- type="button" class="btn btn-default btn-sm"
4302
- (click)="datePicker.toggleMode(0)"
4303
- [disabled]="datePicker.datepickerMode === maxMode"
4304
- [ngClass]="{disabled: datePicker.datepickerMode === maxMode}" tabindex="-1" style="width:100%;">
4305
- <strong>{{ title }}</strong>
4306
- </button>
4307
- </th>
4308
- <th>
4309
- <button type="button" class="btn btn-default btn-sm pull-right float-right"
4310
- (click)="datePicker.move(1)" tabindex="-1">›</button>
4311
- </th>
4312
- </tr>
4313
- </thead>
4314
- <tbody>
4315
- <tr *ngFor="let rowz of rows">
4316
- <td *ngFor="let dtz of rowz" class="text-center" role="gridcell" [attr.id]="dtz.uid" [ngClass]="dtz.customClass">
4317
- <button type="button" style="min-width:100%;" class="btn btn-default"
4318
- [ngClass]="{'btn-link': isBs4 && !dtz.selected && !datePicker.isActive(dtz), 'btn-info': dtz.selected || (isBs4 && !dtz.selected && datePicker.isActive(dtz)), disabled: dtz.disabled, active: !isBs4 && datePicker.isActive(dtz)}"
4319
- [disabled]="dtz.disabled"
4320
- (click)="datePicker.select(dtz.date)" tabindex="-1">
4321
- <span [ngClass]="{'text-success': isBs4 && dtz.current, 'text-info': !isBs4 && dtz.current}">{{ dtz.label }}</span>
4322
- </button>
4323
- </td>
4324
- </tr>
4325
- </tbody>
4326
- </table>
4327
- `, isInline: true, styles: [":host .btn-info .text-success{color:#fff!important}\n"], directives: [{ type: i11.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i11.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i11.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
4328
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonthPickerComponent, decorators: [{
4329
- type: Component,
4330
- args: [{
4331
- selector: 'monthpicker',
4332
- template: `
4333
- <table *ngIf="datePicker.datepickerMode==='month'" role="grid">
4334
- <thead>
4335
- <tr>
4336
- <th>
4337
- <button type="button" class="btn btn-default btn-sm pull-left float-left"
4338
- (click)="datePicker.move(-1)" tabindex="-1">‹</button></th>
4339
- <th [attr.colspan]="((datePicker.monthColLimit - 2) <= 0) ? 1 : datePicker.monthColLimit - 2">
4340
- <button [id]="datePicker.uniqueId + '-title'"
4341
- type="button" class="btn btn-default btn-sm"
4342
- (click)="datePicker.toggleMode(0)"
4343
- [disabled]="datePicker.datepickerMode === maxMode"
4344
- [ngClass]="{disabled: datePicker.datepickerMode === maxMode}" tabindex="-1" style="width:100%;">
4345
- <strong>{{ title }}</strong>
4346
- </button>
4347
- </th>
4348
- <th>
4349
- <button type="button" class="btn btn-default btn-sm pull-right float-right"
4350
- (click)="datePicker.move(1)" tabindex="-1">›</button>
4351
- </th>
4352
- </tr>
4353
- </thead>
4354
- <tbody>
4355
- <tr *ngFor="let rowz of rows">
4356
- <td *ngFor="let dtz of rowz" class="text-center" role="gridcell" [attr.id]="dtz.uid" [ngClass]="dtz.customClass">
4357
- <button type="button" style="min-width:100%;" class="btn btn-default"
4358
- [ngClass]="{'btn-link': isBs4 && !dtz.selected && !datePicker.isActive(dtz), 'btn-info': dtz.selected || (isBs4 && !dtz.selected && datePicker.isActive(dtz)), disabled: dtz.disabled, active: !isBs4 && datePicker.isActive(dtz)}"
4359
- [disabled]="dtz.disabled"
4360
- (click)="datePicker.select(dtz.date)" tabindex="-1">
4361
- <span [ngClass]="{'text-success': isBs4 && dtz.current, 'text-info': !isBs4 && dtz.current}">{{ dtz.label }}</span>
4362
- </button>
4363
- </td>
4364
- </tr>
4365
- </tbody>
4366
- </table>
4367
- `,
4368
- styles: [
4369
- `
4370
- :host .btn-info .text-success {
4371
- color: #fff !important;
4372
- }
4373
- `
4374
- ]
4375
- }]
4376
- }], ctorParameters: function () { return [{ type: DatePickerInnerComponent }]; } });
4377
-
4378
- // @deprecated
4379
- class YearPickerComponent {
4380
- constructor(datePicker) {
4381
- this.rows = [];
4382
- this.datePicker = datePicker;
4383
- }
4384
- get isBs4() {
4385
- return !isBs3();
4386
- }
4387
- ngOnInit() {
4388
- // eslint-disable-next-line @typescript-eslint/no-this-alias
4389
- const self = this;
4390
- this.datePicker.stepYear = { years: this.datePicker.yearRange };
4391
- this.datePicker.setRefreshViewHandler(function () {
4392
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
4393
- // @ts-ignore
4394
- // eslint-disable-next-line @typescript-eslint/no-this-alias
4395
- const that = this;
4396
- const years = new Array(that.yearRange);
4397
- let date;
4398
- const start = self.getStartingYear(that.activeDate.getFullYear()) || 0;
4399
- for (let i = 0; i < that.yearRange; i++) {
4400
- date = new Date(start + i, 0, 1);
4401
- date = that.fixTimeZone(date);
4402
- years[i] = that.createDateObject(date, that.formatYear);
4403
- years[i].uid = that.uniqueId + '-' + i;
4404
- }
4405
- self.title = [years[0].label, years[that.yearRange - 1].label].join(' - ');
4406
- self.rows = that.split(years, self.datePicker.yearColLimit);
4407
- }, 'year');
4408
- this.datePicker.setCompareHandler(function (date1, date2) {
4409
- return date1.getFullYear() - date2.getFullYear();
4410
- }, 'year');
4411
- this.datePicker.refreshView();
4412
- }
4413
- getStartingYear(year) {
4414
- // todo: parseInt
4415
- if (this.datePicker && this.datePicker.yearRange) {
4416
- return ((year - 1) / this.datePicker.yearRange * this.datePicker.yearRange + 1);
4417
- }
4418
- return undefined;
4419
- }
4420
- }
4421
- YearPickerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: YearPickerComponent, deps: [{ token: DatePickerInnerComponent }], target: i0.ɵɵFactoryTarget.Component });
4422
- YearPickerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: YearPickerComponent, selector: "yearpicker", ngImport: i0, template: `
4423
- <table *ngIf="datePicker.datepickerMode==='year'" role='grid'>
4424
- <thead>
4425
- <tr>
4426
- <th>
4427
- <button type='button' class='btn btn-default btn-sm pull-left float-left'
4428
- (click)='datePicker.move(-1)' tabindex='-1'>‹
4429
- </button>
4430
- </th>
4431
- <th [attr.colspan]='((datePicker.yearColLimit - 2) <= 0) ? 1 : datePicker.yearColLimit - 2'>
4432
- <button [id]="datePicker.uniqueId + '-title'" role='heading'
4433
- type='button' class='btn btn-default btn-sm'
4434
- (click)='datePicker.toggleMode(0)'
4435
- [disabled]='datePicker.datepickerMode === datePicker.maxMode'
4436
- [ngClass]='{disabled: datePicker.datepickerMode === datePicker.maxMode}' tabindex='-1'
4437
- style='width:100%;'>
4438
- <strong>{{ title }}</strong>
4439
- </button>
4440
- </th>
4441
- <th>
4442
- <button type='button' class='btn btn-default btn-sm pull-right float-right'
4443
- (click)='datePicker.move(1)' tabindex='-1'>›
4444
- </button>
4445
- </th>
4446
- </tr>
4447
- </thead>
4448
- <tbody>
4449
- <tr *ngFor='let rowz of rows'>
4450
- <td *ngFor='let dtz of rowz' class='text-center' role='gridcell' [attr.id]='dtz.uid'>
4451
- <button type='button' style='min-width:100%;' class='btn btn-default'
4452
- [ngClass]="{'btn-link': isBs4 && !dtz.selected && !datePicker.isActive(dtz), 'btn-info': dtz.selected || (isBs4 && !dtz.selected && datePicker.isActive(dtz)), disabled: dtz.disabled, active: !isBs4 && datePicker.isActive(dtz)}"
4453
- [disabled]='dtz.disabled'
4454
- (click)='datePicker.select(dtz.date)' tabindex='-1'>
4455
- <span
4456
- [ngClass]="{'text-success': isBs4 && dtz.current, 'text-info': !isBs4 && dtz.current}">{{ dtz.label }}</span>
4457
- </button>
4458
- </td>
4459
- </tr>
4460
- </tbody>
4461
- </table>
4462
- `, isInline: true, styles: [":host .btn-info .text-success{color:#fff!important}\n"], directives: [{ type: i11.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i11.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i11.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
4463
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: YearPickerComponent, decorators: [{
4464
- type: Component,
4465
- args: [{
4466
- selector: 'yearpicker',
4467
- template: `
4468
- <table *ngIf="datePicker.datepickerMode==='year'" role='grid'>
4469
- <thead>
4470
- <tr>
4471
- <th>
4472
- <button type='button' class='btn btn-default btn-sm pull-left float-left'
4473
- (click)='datePicker.move(-1)' tabindex='-1'>‹
4474
- </button>
4475
- </th>
4476
- <th [attr.colspan]='((datePicker.yearColLimit - 2) <= 0) ? 1 : datePicker.yearColLimit - 2'>
4477
- <button [id]="datePicker.uniqueId + '-title'" role='heading'
4478
- type='button' class='btn btn-default btn-sm'
4479
- (click)='datePicker.toggleMode(0)'
4480
- [disabled]='datePicker.datepickerMode === datePicker.maxMode'
4481
- [ngClass]='{disabled: datePicker.datepickerMode === datePicker.maxMode}' tabindex='-1'
4482
- style='width:100%;'>
4483
- <strong>{{ title }}</strong>
4484
- </button>
4485
- </th>
4486
- <th>
4487
- <button type='button' class='btn btn-default btn-sm pull-right float-right'
4488
- (click)='datePicker.move(1)' tabindex='-1'>›
4489
- </button>
4490
- </th>
4491
- </tr>
4492
- </thead>
4493
- <tbody>
4494
- <tr *ngFor='let rowz of rows'>
4495
- <td *ngFor='let dtz of rowz' class='text-center' role='gridcell' [attr.id]='dtz.uid'>
4496
- <button type='button' style='min-width:100%;' class='btn btn-default'
4497
- [ngClass]="{'btn-link': isBs4 && !dtz.selected && !datePicker.isActive(dtz), 'btn-info': dtz.selected || (isBs4 && !dtz.selected && datePicker.isActive(dtz)), disabled: dtz.disabled, active: !isBs4 && datePicker.isActive(dtz)}"
4498
- [disabled]='dtz.disabled'
4499
- (click)='datePicker.select(dtz.date)' tabindex='-1'>
4500
- <span
4501
- [ngClass]="{'text-success': isBs4 && dtz.current, 'text-info': !isBs4 && dtz.current}">{{ dtz.label }}</span>
4502
- </button>
4503
- </td>
4504
- </tr>
4505
- </tbody>
4506
- </table>
4507
- `,
4508
- styles: [
4509
- `
4510
- :host .btn-info .text-success {
4511
- color: #fff !important;
4512
- }
4513
- `
4514
- ]
4515
- }]
4516
- }], ctorParameters: function () { return [{ type: DatePickerInnerComponent }]; } });
4517
-
4518
- const DATEPICKER_CONTROL_VALUE_ACCESSOR = {
4519
- provide: NG_VALUE_ACCESSOR,
4520
- useExisting: forwardRef(() => DatePickerComponent),
4521
- multi: true
4522
- };
4523
- class DatePickerComponent {
4524
- constructor(config) {
4525
- /** sets datepicker mode, supports: `day`, `month`, `year` */
4526
- this.datepickerMode = 'day';
4527
- /** if false week numbers will be hidden */
4528
- this.showWeeks = true;
4529
- /** number of months displayed in a single row of month picker */
4530
- this.monthColLimit = 3;
4531
- /** number of years displayed in a single row of year picker */
4532
- this.yearColLimit = 5;
4533
- this.selectionDone = new EventEmitter(undefined);
4534
- /** callback to invoke when the activeDate is changed. */
4535
- this.activeDateChange = new EventEmitter(undefined);
4536
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
4537
- this.onChange = Function.prototype;
4538
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
4539
- this.onTouched = Function.prototype;
4540
- this._now = new Date();
4541
- this.config = config;
4542
- this.configureOptions();
4543
- }
4544
- /** currently active date */
4545
- get activeDate() {
4546
- return this._activeDate || this._now;
4547
- }
4548
- set activeDate(value) {
4549
- this._activeDate = value;
4550
- }
4551
- configureOptions() {
4552
- Object.assign(this, this.config);
4553
- }
4554
- onUpdate(event) {
4555
- this.activeDate = event;
4556
- this.onChange(event);
4557
- }
4558
- onSelectionDone(event) {
4559
- this.selectionDone.emit(event);
4560
- }
4561
- onActiveDateChange(event) {
4562
- this.activeDateChange.emit(event);
4563
- }
4564
- // todo: support null value
4565
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
4566
- writeValue(value) {
4567
- var _a, _b;
4568
- if (((_a = this._datePicker) === null || _a === void 0 ? void 0 : _a.compare(value, this._activeDate)) === 0) {
4569
- return;
4570
- }
4571
- if (value && value instanceof Date) {
4572
- this.activeDate = value;
4573
- (_b = this._datePicker) === null || _b === void 0 ? void 0 : _b.select(value, false);
4574
- return;
4575
- }
4576
- this.activeDate = value ? new Date(value) : void 0;
4577
- }
4578
- registerOnChange(fn) {
4579
- this.onChange = fn;
4580
- }
4581
- registerOnTouched(fn) {
4582
- this.onTouched = fn;
4583
- }
4584
- }
4585
- DatePickerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: DatePickerComponent, deps: [{ token: DatepickerConfig }], target: i0.ɵɵFactoryTarget.Component });
4586
- DatePickerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: DatePickerComponent, selector: "datepicker", inputs: { datepickerMode: "datepickerMode", initDate: "initDate", minDate: "minDate", maxDate: "maxDate", minMode: "minMode", maxMode: "maxMode", showWeeks: "showWeeks", formatDay: "formatDay", formatMonth: "formatMonth", formatYear: "formatYear", formatDayHeader: "formatDayHeader", formatDayTitle: "formatDayTitle", formatMonthTitle: "formatMonthTitle", startingDay: "startingDay", yearRange: "yearRange", onlyCurrentMonth: "onlyCurrentMonth", shortcutPropagation: "shortcutPropagation", monthColLimit: "monthColLimit", yearColLimit: "yearColLimit", customClass: "customClass", dateDisabled: "dateDisabled", dayDisabled: "dayDisabled", activeDate: "activeDate" }, outputs: { selectionDone: "selectionDone", activeDateChange: "activeDateChange" }, providers: [DATEPICKER_CONTROL_VALUE_ACCESSOR], viewQueries: [{ propertyName: "_datePicker", first: true, predicate: DatePickerInnerComponent, descendants: true, static: true }], ngImport: i0, template: `
4587
- <datepicker-inner [activeDate]="activeDate"
4588
- (update)="onUpdate($event)"
4589
- [locale]="config.locale"
4590
- [datepickerMode]="datepickerMode"
4591
- [initDate]="initDate"
4592
- [minDate]="minDate"
4593
- [maxDate]="maxDate"
4594
- [minMode]="minMode"
4595
- [maxMode]="maxMode"
4596
- [showWeeks]="showWeeks"
4597
- [formatDay]="formatDay"
4598
- [formatMonth]="formatMonth"
4599
- [formatYear]="formatYear"
4600
- [formatDayHeader]="formatDayHeader"
4601
- [formatDayTitle]="formatDayTitle"
4602
- [formatMonthTitle]="formatMonthTitle"
4603
- [startingDay]="startingDay"
4604
- [yearRange]="yearRange"
4605
- [customClass]="customClass"
4606
- [dateDisabled]="dateDisabled"
4607
- [dayDisabled]="dayDisabled"
4608
- [onlyCurrentMonth]="onlyCurrentMonth"
4609
- [shortcutPropagation]="shortcutPropagation"
4610
- [monthColLimit]="monthColLimit"
4611
- [yearColLimit]="yearColLimit"
4612
- (selectionDone)="onSelectionDone($event)"
4613
- (activeDateChange)="onActiveDateChange($event)">
4614
- <daypicker tabindex="0"></daypicker>
4615
- <monthpicker tabindex="0"></monthpicker>
4616
- <yearpicker tabindex="0"></yearpicker>
4617
- </datepicker-inner>
4618
- `, isInline: true, components: [{ type: DatePickerInnerComponent, selector: "datepicker-inner", inputs: ["locale", "datepickerMode", "startingDay", "yearRange", "minDate", "maxDate", "minMode", "maxMode", "showWeeks", "formatDay", "formatMonth", "formatYear", "formatDayHeader", "formatDayTitle", "formatMonthTitle", "onlyCurrentMonth", "shortcutPropagation", "customClass", "monthColLimit", "yearColLimit", "dateDisabled", "dayDisabled", "initDate", "activeDate"], outputs: ["selectionDone", "update", "activeDateChange"] }, { type: DayPickerComponent, selector: "daypicker" }, { type: MonthPickerComponent, selector: "monthpicker" }, { type: YearPickerComponent, selector: "yearpicker" }] });
4619
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: DatePickerComponent, decorators: [{
4620
- type: Component,
4621
- args: [{
4622
- selector: 'datepicker',
4623
- template: `
4624
- <datepicker-inner [activeDate]="activeDate"
4625
- (update)="onUpdate($event)"
4626
- [locale]="config.locale"
4627
- [datepickerMode]="datepickerMode"
4628
- [initDate]="initDate"
4629
- [minDate]="minDate"
4630
- [maxDate]="maxDate"
4631
- [minMode]="minMode"
4632
- [maxMode]="maxMode"
4633
- [showWeeks]="showWeeks"
4634
- [formatDay]="formatDay"
4635
- [formatMonth]="formatMonth"
4636
- [formatYear]="formatYear"
4637
- [formatDayHeader]="formatDayHeader"
4638
- [formatDayTitle]="formatDayTitle"
4639
- [formatMonthTitle]="formatMonthTitle"
4640
- [startingDay]="startingDay"
4641
- [yearRange]="yearRange"
4642
- [customClass]="customClass"
4643
- [dateDisabled]="dateDisabled"
4644
- [dayDisabled]="dayDisabled"
4645
- [onlyCurrentMonth]="onlyCurrentMonth"
4646
- [shortcutPropagation]="shortcutPropagation"
4647
- [monthColLimit]="monthColLimit"
4648
- [yearColLimit]="yearColLimit"
4649
- (selectionDone)="onSelectionDone($event)"
4650
- (activeDateChange)="onActiveDateChange($event)">
4651
- <daypicker tabindex="0"></daypicker>
4652
- <monthpicker tabindex="0"></monthpicker>
4653
- <yearpicker tabindex="0"></yearpicker>
4654
- </datepicker-inner>
4655
- `,
4656
- providers: [DATEPICKER_CONTROL_VALUE_ACCESSOR]
4657
- }]
4658
- }], ctorParameters: function () { return [{ type: DatepickerConfig }]; }, propDecorators: { datepickerMode: [{
4659
- type: Input
4660
- }], initDate: [{
4661
- type: Input
4662
- }], minDate: [{
4663
- type: Input
4664
- }], maxDate: [{
4665
- type: Input
4666
- }], minMode: [{
4667
- type: Input
4668
- }], maxMode: [{
4669
- type: Input
4670
- }], showWeeks: [{
4671
- type: Input
4672
- }], formatDay: [{
4673
- type: Input
4674
- }], formatMonth: [{
4675
- type: Input
4676
- }], formatYear: [{
4677
- type: Input
4678
- }], formatDayHeader: [{
4679
- type: Input
4680
- }], formatDayTitle: [{
4681
- type: Input
4682
- }], formatMonthTitle: [{
4683
- type: Input
4684
- }], startingDay: [{
4685
- type: Input
4686
- }], yearRange: [{
4687
- type: Input
4688
- }], onlyCurrentMonth: [{
4689
- type: Input
4690
- }], shortcutPropagation: [{
4691
- type: Input
4692
- }], monthColLimit: [{
4693
- type: Input
4694
- }], yearColLimit: [{
4695
- type: Input
4696
- }], customClass: [{
4697
- type: Input
4698
- }], dateDisabled: [{
4699
- type: Input
4700
- }], dayDisabled: [{
4701
- type: Input
4702
- }], activeDate: [{
4703
- type: Input
4704
- }], selectionDone: [{
4705
- type: Output
4706
- }], activeDateChange: [{
4707
- type: Output
4708
- }], _datePicker: [{
4709
- type: ViewChild,
4710
- args: [DatePickerInnerComponent, { static: true }]
4711
- }] } });
4712
-
4713
3646
  class BsDatepickerModule {
4714
3647
  static forRoot() {
4715
3648
  return {
@@ -4802,47 +3735,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
4802
3735
  }]
4803
3736
  }] });
4804
3737
 
4805
- class DatepickerModule {
4806
- static forRoot() {
4807
- return { ngModule: DatepickerModule, providers: [DatepickerConfig] };
4808
- }
4809
- }
4810
- DatepickerModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: DatepickerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
4811
- DatepickerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: DatepickerModule, declarations: [DatePickerComponent,
4812
- DatePickerInnerComponent,
4813
- DayPickerComponent,
4814
- MonthPickerComponent,
4815
- YearPickerComponent], imports: [CommonModule, FormsModule], exports: [DatePickerComponent,
4816
- DatePickerInnerComponent,
4817
- DayPickerComponent,
4818
- MonthPickerComponent,
4819
- YearPickerComponent] });
4820
- DatepickerModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: DatepickerModule, imports: [[CommonModule, FormsModule]] });
4821
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: DatepickerModule, decorators: [{
4822
- type: NgModule,
4823
- args: [{
4824
- imports: [CommonModule, FormsModule],
4825
- declarations: [
4826
- DatePickerComponent,
4827
- DatePickerInnerComponent,
4828
- DayPickerComponent,
4829
- MonthPickerComponent,
4830
- YearPickerComponent
4831
- ],
4832
- exports: [
4833
- DatePickerComponent,
4834
- DatePickerInnerComponent,
4835
- DayPickerComponent,
4836
- MonthPickerComponent,
4837
- YearPickerComponent
4838
- ],
4839
- entryComponents: [DatePickerComponent]
4840
- }]
4841
- }] });
4842
-
4843
3738
  /**
4844
3739
  * Generated bundle index. Do not edit.
4845
3740
  */
4846
3741
 
4847
- export { BsDatepickerConfig, BsDatepickerContainerComponent, BsDatepickerDirective, BsDatepickerInlineConfig, BsDatepickerInlineContainerComponent, BsDatepickerInlineDirective, BsDatepickerInputDirective, BsDatepickerModule, BsDaterangepickerConfig, BsDaterangepickerContainerComponent, BsDaterangepickerDirective, BsDaterangepickerInlineConfig, BsDaterangepickerInlineContainerComponent, BsDaterangepickerInlineDirective, BsDaterangepickerInputDirective, BsLocaleService, DateFormatter, DatePickerComponent, DatePickerInnerComponent, DatepickerConfig, DatepickerModule, DayPickerComponent, MonthPickerComponent, YearPickerComponent };
3742
+ export { BsDatepickerConfig, BsDatepickerContainerComponent, BsDatepickerDirective, BsDatepickerInlineConfig, BsDatepickerInlineContainerComponent, BsDatepickerInlineDirective, BsDatepickerInputDirective, BsDatepickerModule, BsDaterangepickerConfig, BsDaterangepickerContainerComponent, BsDaterangepickerDirective, BsDaterangepickerInlineConfig, BsDaterangepickerInlineContainerComponent, BsDaterangepickerInlineDirective, BsDaterangepickerInputDirective, BsLocaleService };
4848
3743
  //# sourceMappingURL=ngx-bootstrap-datepicker.mjs.map