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