@ptsecurity/mosaic 15.9.2 → 15.9.4

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.
@@ -122,8 +122,9 @@ class McCalendarHeader {
122
122
  this.activeDateChange = new EventEmitter();
123
123
  this.monthSelected = new EventEmitter();
124
124
  this.yearSelected = new EventEmitter();
125
- this.monthNames = this.adapter.getMonthNames('long')
126
- .map((name, i) => ({ name, value: i }));
125
+ this.monthNames = this.adapter.getMonthNames('long').map((name, i) => {
126
+ return { name, nameShort: this.adapter.getMonthNames('short')[i], value: i, disabled: false };
127
+ });
127
128
  }
128
129
  get activeDate() {
129
130
  return this._activeDate;
@@ -131,6 +132,7 @@ class McCalendarHeader {
131
132
  set activeDate(value) {
132
133
  this._activeDate = value;
133
134
  this.updateSelectedValues();
135
+ this.updateSelectionOptions();
134
136
  }
135
137
  get maxDate() {
136
138
  return this._maxDate;
@@ -140,7 +142,7 @@ class McCalendarHeader {
140
142
  return;
141
143
  }
142
144
  this._maxDate = value;
143
- this.updateYearsArray();
145
+ this.updateYearsOptions();
144
146
  }
145
147
  get minDate() {
146
148
  return this._minDate;
@@ -150,16 +152,20 @@ class McCalendarHeader {
150
152
  return;
151
153
  }
152
154
  this._minDate = value;
153
- this.updateYearsArray();
155
+ this.updateYearsOptions();
154
156
  }
155
157
  get previousDisabled() {
156
- return this.compareDate(this.activeDate, this.minDate) < 0;
158
+ return this.compareDate(this.activeDate, this.minDate) <= 0;
159
+ }
160
+ get currentDisabled() {
161
+ const today = this.adapter.today();
162
+ return this.compareDate(today, this.minDate) < 0 || this.compareDate(today, this.maxDate) > 0;
157
163
  }
158
164
  get nextDisabled() {
159
165
  return this.compareDate(this.activeDate, this.maxDate) >= 0;
160
166
  }
161
167
  ngAfterContentInit() {
162
- this.updateYearsArray();
168
+ this.updateSelectionOptions();
163
169
  this.updateSelectedValues();
164
170
  }
165
171
  /** Handles when a new month is selected. */
@@ -178,6 +184,7 @@ class McCalendarHeader {
178
184
  this.activeDate = this.adapter.createDate(year, month, Math.min(this.adapter.getDate(this.activeDate), daysInMonth));
179
185
  this.yearSelected.emit(this.activeDate);
180
186
  this.activeDateChange.emit(this.activeDate);
187
+ this.updateMonthOptions();
181
188
  }
182
189
  selectCurrentDate() {
183
190
  this.activeDate = this.adapter.today();
@@ -204,7 +211,11 @@ class McCalendarHeader {
204
211
  this.selectedYear = this.years.find(({ name }) => name === year)
205
212
  || { name: year, value: this.adapter.getYearName(this.activeDate) };
206
213
  }
207
- updateYearsArray() {
214
+ updateSelectionOptions() {
215
+ this.updateYearsOptions();
216
+ this.updateMonthOptions();
217
+ }
218
+ updateYearsOptions() {
208
219
  const minYear = this.adapter.getYear(this.minDate);
209
220
  const maxYear = this.adapter.getYear(this.maxDate);
210
221
  this.years = [];
@@ -212,14 +223,33 @@ class McCalendarHeader {
212
223
  this.years.push({ name: key, value: this.adapter.getYearName(this.adapter.createDate(key)) });
213
224
  }
214
225
  }
226
+ updateMonthOptions() {
227
+ if (!this._activeDate) {
228
+ return;
229
+ }
230
+ const minYear = this.adapter.getYear(this.minDate);
231
+ const minMonth = this.adapter.getMonth(this.minDate);
232
+ const maxYear = this.adapter.getYear(this.maxDate);
233
+ const maxMonth = this.adapter.getMonth(this.maxDate);
234
+ const currentYear = this.adapter.getYear(this._activeDate);
235
+ if (currentYear === minYear && currentYear === maxYear) {
236
+ this.monthNames.forEach((month) => (month.disabled = month.value < minMonth || month.value > maxMonth));
237
+ }
238
+ else if (currentYear === minYear) {
239
+ this.monthNames.forEach((month) => (month.disabled = month.value < minMonth));
240
+ }
241
+ else if (currentYear === maxYear) {
242
+ this.monthNames.forEach((month) => (month.disabled = month.value > maxMonth));
243
+ }
244
+ }
215
245
  }
216
246
  /** @nocollapse */ McCalendarHeader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: McCalendarHeader, deps: [{ token: i1$1.DateAdapter }], target: i0.ɵɵFactoryTarget.Component });
217
- /** @nocollapse */ McCalendarHeader.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: McCalendarHeader, selector: "mc-calendar-header", inputs: { activeDate: "activeDate", maxDate: "maxDate", minDate: "minDate" }, outputs: { activeDateChange: "activeDateChange", monthSelected: "monthSelected", yearSelected: "yearSelected" }, host: { classAttribute: "mc-calendar-header" }, exportAs: ["mcCalendarHeader"], ngImport: i0, template: "<div class=\"mc-calendar-header__select-group\">\n <mc-select\n class=\"mc-calendar-header__select\"\n #monthSelect=\"mcSelect\"\n [value]=\"selectedMonth\"\n [panelClass]=\"'mc-calendar-select-panel'\"\n (selectionChange)=\"onMonthSelected($event.value)\">\n\n <button class=\"mc-button_transparent layout-padding-right-xs\"\n mc-button\n mc-select-matcher\n [class.mc-active]=\"monthSelect.panelOpen\"\n [tabindex]=\"-1\">\n {{ monthSelect.triggerValue }}\n\n <i class=\"layout-padding-left-3xs\" mc-icon=\"mc-angle-down-S_16\"></i>\n </button>\n\n <mc-option *ngFor=\"let month of monthNames\"\n [mcTooltipDisabled]=\"true\"\n [value]=\"month.value\">\n {{ month.name }}\n </mc-option>\n </mc-select>\n\n <mc-select\n #yearSelect=\"mcSelect\"\n [value]=\"selectedYear\"\n [panelClass]=\"'mc-calendar-select-panel'\"\n (selectionChange)=\"onYearSelected($event.value.name)\">\n <button class=\"mc-button_transparent layout-padding-right-xs\"\n mc-button\n mc-select-matcher\n [class.mc-active]=\"yearSelect.panelOpen\"\n [tabindex]=\"-1\">\n {{ this.selectedYear.value }}\n\n <i class=\"layout-padding-left-3xs\" mc-icon=\"mc-angle-down-S_16\"></i>\n </button>\n\n <mc-option *ngFor=\"let year of years\"\n [mcTooltipDisabled]=\"true\"\n [value]=\"year\">\n {{ year.value }}\n </mc-option>\n </mc-select>\n</div>\n\n<div class=\"mc-calendar-header__button-group\">\n <button mc-button\n class=\"mc-button_transparent mc-calendar-header__previous-button\"\n [tabindex]=\"-1\"\n [disabled]=\"previousDisabled\"\n (click)=\"selectPreviousMonth()\">\n\n <i mc-icon=\"mc-angle-left-L_16\"></i>\n </button>\n\n <button mc-button\n class=\"mc-button_transparent\"\n [tabindex]=\"-1\"\n (click)=\"selectCurrentDate()\">\n\n <i mc-icon=\"mc-circle-8_16\"></i>\n </button>\n\n <button mc-button\n class=\"mc-button_transparent mc-calendar-header__next-button\"\n [tabindex]=\"-1\"\n [disabled]=\"nextDisabled\"\n (click)=\"selectNextMonth()\">\n\n <i mc-icon=\"mc-angle-right-L_16\"></i>\n </button>\n</div>\n", styles: [".mc-calendar-header{display:flex;flex-direction:row;justify-content:space-between;padding:var(--mc-datepicker-calendar-size-padding-top, 16px) var(--mc-datepicker-calendar-size-padding-horizontal, 8px) var(--mc-datepicker-calendar-size-padding-blocks, 12px) var(--mc-datepicker-calendar-size-padding-horizontal, 8px)}.mc-calendar-header__previous-button:after{border-left-width:var(--mc-datepicker-calendar-size-icon-border-width, 2px);transform:var(--mc-datepicker-calendar-size-icon-prev-icon-transform, translateX(2px) rotate(-45deg))}.mc-calendar-header__next-button:after{border-right-width:var(--mc-datepicker-calendar-size-icon-border-width, 2px);transform:var(--mc-datepicker-calendar-size-icon-nex-icon-transform, translateX(-2px) rotate(45deg))}.mc-calendar-header__select{width:auto!important}.mc-calendar-header__button-group,.mc-calendar-header__select-group{display:flex;flex-direction:row}.mc-calendar-select-panel{margin-top:2px;min-width:98%!important}.mc-calendar-select-panel .mc-select__content{max-height:384px;overflow-x:hidden;scrollbar-gutter:stable}.mc-calendar-select-panel .mc-select__content .mc-option{min-width:65px}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: i3.McButton, selector: "[mc-button]", inputs: ["color", "tabIndex", "disabled"] }, { kind: "directive", type: i3.McButtonCssStyler, selector: "[mc-button]" }, { kind: "directive", type: i4.McValidateDirective, selector: " input[mcInput], input[mcInputPassword], input[mcTimepicker], input[mcDatepicker], textarea[mcTextarea], mc-select, mc-tree-select, mc-tag-list ", exportAs: ["McValidate"] }, { kind: "component", type: i5.McSelect, selector: "mc-select", inputs: ["disabled", "tabIndex", "hiddenItemsText", "panelClass", "backdropClass", "errorStateMatcher", "sortComparator", "hasBackdrop", "placeholder", "required", "multiple", "compareWith", "value", "id", "hiddenItemsTextFormatter"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["mcSelect"] }, { kind: "directive", type: i5.McSelectMatcher, selector: "mc-select-matcher, [mc-select-matcher]" }, { kind: "directive", type: i5.McOptionTooltip, selector: "mc-option" }, { kind: "component", type: i1$1.McOption, selector: "mc-option", inputs: ["value", "showCheckbox", "disabled"], outputs: ["onSelectionChange"], exportAs: ["mcOption"] }, { kind: "component", type: i6.McIcon, selector: "[mc-icon]", inputs: ["color"] }, { kind: "directive", type: i6.McIconCSSStyler, selector: "[mc-icon]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
247
+ /** @nocollapse */ McCalendarHeader.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: McCalendarHeader, selector: "mc-calendar-header", inputs: { activeDate: "activeDate", maxDate: "maxDate", minDate: "minDate" }, outputs: { activeDateChange: "activeDateChange", monthSelected: "monthSelected", yearSelected: "yearSelected" }, host: { classAttribute: "mc-calendar-header" }, exportAs: ["mcCalendarHeader"], ngImport: i0, template: "<div class=\"mc-calendar-header__select-group\">\n <mc-select\n class=\"mc-calendar-header__select\"\n #monthSelect=\"mcSelect\"\n [value]=\"selectedMonth\"\n [panelClass]=\"'mc-calendar-select-panel'\"\n (selectionChange)=\"onMonthSelected($event.value)\">\n\n <button class=\"mc-button_transparent layout-padding-right-xs\"\n mc-button\n mc-select-matcher\n [class.mc-active]=\"monthSelect.panelOpen\"\n [tabindex]=\"-1\">\n {{ monthSelect.triggerValue }}\n\n <i class=\"layout-padding-left-3xs\" mc-icon=\"mc-angle-down-S_16\"></i>\n </button>\n\n <mc-option *ngFor=\"let month of monthNames\"\n [mcTooltipDisabled]=\"true\"\n [disabled]=\"month.disabled\"\n [value]=\"month.value\">\n {{ month.name }}\n </mc-option>\n </mc-select>\n\n <mc-select\n #yearSelect=\"mcSelect\"\n [value]=\"selectedYear\"\n [panelClass]=\"'mc-calendar-select-panel'\"\n (selectionChange)=\"onYearSelected($event.value.name)\">\n <button class=\"mc-button_transparent layout-padding-right-xs\"\n mc-button\n mc-select-matcher\n [class.mc-active]=\"yearSelect.panelOpen\"\n [tabindex]=\"-1\">\n {{ this.selectedYear.value }}\n\n <i class=\"layout-padding-left-3xs\" mc-icon=\"mc-angle-down-S_16\"></i>\n </button>\n\n <mc-option *ngFor=\"let year of years\"\n [mcTooltipDisabled]=\"true\"\n [value]=\"year\">\n {{ year.value }}\n </mc-option>\n </mc-select>\n</div>\n\n<div class=\"mc-calendar-header__button-group\">\n <button mc-button\n class=\"mc-button_transparent mc-calendar-header__previous-button\"\n [tabindex]=\"-1\"\n [disabled]=\"previousDisabled\"\n (click)=\"selectPreviousMonth()\">\n\n <i mc-icon=\"mc-angle-left-L_16\"></i>\n </button>\n\n <button mc-button\n class=\"mc-button_transparent\"\n [disabled]=\"currentDisabled\"\n [tabindex]=\"-1\"\n (click)=\"selectCurrentDate()\">\n\n <i mc-icon=\"mc-circle-8_16\"></i>\n </button>\n\n <button mc-button\n class=\"mc-button_transparent mc-calendar-header__next-button\"\n [tabindex]=\"-1\"\n [disabled]=\"nextDisabled\"\n (click)=\"selectNextMonth()\">\n\n <i mc-icon=\"mc-angle-right-L_16\"></i>\n </button>\n</div>\n", styles: [".mc-calendar-header{display:flex;flex-direction:row;justify-content:space-between;padding:var(--mc-datepicker-calendar-size-padding-top, 16px) var(--mc-datepicker-calendar-size-padding-horizontal, 8px) var(--mc-datepicker-calendar-size-padding-blocks, 12px) var(--mc-datepicker-calendar-size-padding-horizontal, 8px)}.mc-calendar-header__previous-button:after{border-left-width:var(--mc-datepicker-calendar-size-icon-border-width, 2px);transform:var(--mc-datepicker-calendar-size-icon-prev-icon-transform, translateX(2px) rotate(-45deg))}.mc-calendar-header__next-button:after{border-right-width:var(--mc-datepicker-calendar-size-icon-border-width, 2px);transform:var(--mc-datepicker-calendar-size-icon-nex-icon-transform, translateX(-2px) rotate(45deg))}.mc-calendar-header__select{width:auto!important}.mc-calendar-header__button-group,.mc-calendar-header__select-group{display:flex;flex-direction:row}.mc-calendar-select-panel{margin-top:2px;min-width:98%!important}.mc-calendar-select-panel .mc-select__content{max-height:384px;overflow-x:hidden;scrollbar-gutter:stable}.mc-calendar-select-panel .mc-select__content .mc-option{min-width:65px}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: i3.McButton, selector: "[mc-button]", inputs: ["color", "tabIndex", "disabled"] }, { kind: "directive", type: i3.McButtonCssStyler, selector: "[mc-button]" }, { kind: "directive", type: i4.McValidateDirective, selector: " input[mcInput], input[mcInputPassword], input[mcTimepicker], input[mcDatepicker], textarea[mcTextarea], mc-select, mc-tree-select, mc-tag-list ", exportAs: ["McValidate"] }, { kind: "component", type: i5.McSelect, selector: "mc-select", inputs: ["disabled", "tabIndex", "hiddenItemsText", "panelClass", "backdropClass", "errorStateMatcher", "sortComparator", "hasBackdrop", "placeholder", "required", "multiple", "compareWith", "value", "id", "hiddenItemsTextFormatter"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["mcSelect"] }, { kind: "directive", type: i5.McSelectMatcher, selector: "mc-select-matcher, [mc-select-matcher]" }, { kind: "directive", type: i5.McOptionTooltip, selector: "mc-option" }, { kind: "component", type: i1$1.McOption, selector: "mc-option", inputs: ["value", "showCheckbox", "disabled"], outputs: ["onSelectionChange"], exportAs: ["mcOption"] }, { kind: "component", type: i6.McIcon, selector: "[mc-icon]", inputs: ["color"] }, { kind: "directive", type: i6.McIconCSSStyler, selector: "[mc-icon]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
218
248
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: McCalendarHeader, decorators: [{
219
249
  type: Component,
220
250
  args: [{ selector: 'mc-calendar-header', exportAs: 'mcCalendarHeader', host: {
221
251
  class: 'mc-calendar-header'
222
- }, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"mc-calendar-header__select-group\">\n <mc-select\n class=\"mc-calendar-header__select\"\n #monthSelect=\"mcSelect\"\n [value]=\"selectedMonth\"\n [panelClass]=\"'mc-calendar-select-panel'\"\n (selectionChange)=\"onMonthSelected($event.value)\">\n\n <button class=\"mc-button_transparent layout-padding-right-xs\"\n mc-button\n mc-select-matcher\n [class.mc-active]=\"monthSelect.panelOpen\"\n [tabindex]=\"-1\">\n {{ monthSelect.triggerValue }}\n\n <i class=\"layout-padding-left-3xs\" mc-icon=\"mc-angle-down-S_16\"></i>\n </button>\n\n <mc-option *ngFor=\"let month of monthNames\"\n [mcTooltipDisabled]=\"true\"\n [value]=\"month.value\">\n {{ month.name }}\n </mc-option>\n </mc-select>\n\n <mc-select\n #yearSelect=\"mcSelect\"\n [value]=\"selectedYear\"\n [panelClass]=\"'mc-calendar-select-panel'\"\n (selectionChange)=\"onYearSelected($event.value.name)\">\n <button class=\"mc-button_transparent layout-padding-right-xs\"\n mc-button\n mc-select-matcher\n [class.mc-active]=\"yearSelect.panelOpen\"\n [tabindex]=\"-1\">\n {{ this.selectedYear.value }}\n\n <i class=\"layout-padding-left-3xs\" mc-icon=\"mc-angle-down-S_16\"></i>\n </button>\n\n <mc-option *ngFor=\"let year of years\"\n [mcTooltipDisabled]=\"true\"\n [value]=\"year\">\n {{ year.value }}\n </mc-option>\n </mc-select>\n</div>\n\n<div class=\"mc-calendar-header__button-group\">\n <button mc-button\n class=\"mc-button_transparent mc-calendar-header__previous-button\"\n [tabindex]=\"-1\"\n [disabled]=\"previousDisabled\"\n (click)=\"selectPreviousMonth()\">\n\n <i mc-icon=\"mc-angle-left-L_16\"></i>\n </button>\n\n <button mc-button\n class=\"mc-button_transparent\"\n [tabindex]=\"-1\"\n (click)=\"selectCurrentDate()\">\n\n <i mc-icon=\"mc-circle-8_16\"></i>\n </button>\n\n <button mc-button\n class=\"mc-button_transparent mc-calendar-header__next-button\"\n [tabindex]=\"-1\"\n [disabled]=\"nextDisabled\"\n (click)=\"selectNextMonth()\">\n\n <i mc-icon=\"mc-angle-right-L_16\"></i>\n </button>\n</div>\n", styles: [".mc-calendar-header{display:flex;flex-direction:row;justify-content:space-between;padding:var(--mc-datepicker-calendar-size-padding-top, 16px) var(--mc-datepicker-calendar-size-padding-horizontal, 8px) var(--mc-datepicker-calendar-size-padding-blocks, 12px) var(--mc-datepicker-calendar-size-padding-horizontal, 8px)}.mc-calendar-header__previous-button:after{border-left-width:var(--mc-datepicker-calendar-size-icon-border-width, 2px);transform:var(--mc-datepicker-calendar-size-icon-prev-icon-transform, translateX(2px) rotate(-45deg))}.mc-calendar-header__next-button:after{border-right-width:var(--mc-datepicker-calendar-size-icon-border-width, 2px);transform:var(--mc-datepicker-calendar-size-icon-nex-icon-transform, translateX(-2px) rotate(45deg))}.mc-calendar-header__select{width:auto!important}.mc-calendar-header__button-group,.mc-calendar-header__select-group{display:flex;flex-direction:row}.mc-calendar-select-panel{margin-top:2px;min-width:98%!important}.mc-calendar-select-panel .mc-select__content{max-height:384px;overflow-x:hidden;scrollbar-gutter:stable}.mc-calendar-select-panel .mc-select__content .mc-option{min-width:65px}\n"] }]
252
+ }, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"mc-calendar-header__select-group\">\n <mc-select\n class=\"mc-calendar-header__select\"\n #monthSelect=\"mcSelect\"\n [value]=\"selectedMonth\"\n [panelClass]=\"'mc-calendar-select-panel'\"\n (selectionChange)=\"onMonthSelected($event.value)\">\n\n <button class=\"mc-button_transparent layout-padding-right-xs\"\n mc-button\n mc-select-matcher\n [class.mc-active]=\"monthSelect.panelOpen\"\n [tabindex]=\"-1\">\n {{ monthSelect.triggerValue }}\n\n <i class=\"layout-padding-left-3xs\" mc-icon=\"mc-angle-down-S_16\"></i>\n </button>\n\n <mc-option *ngFor=\"let month of monthNames\"\n [mcTooltipDisabled]=\"true\"\n [disabled]=\"month.disabled\"\n [value]=\"month.value\">\n {{ month.name }}\n </mc-option>\n </mc-select>\n\n <mc-select\n #yearSelect=\"mcSelect\"\n [value]=\"selectedYear\"\n [panelClass]=\"'mc-calendar-select-panel'\"\n (selectionChange)=\"onYearSelected($event.value.name)\">\n <button class=\"mc-button_transparent layout-padding-right-xs\"\n mc-button\n mc-select-matcher\n [class.mc-active]=\"yearSelect.panelOpen\"\n [tabindex]=\"-1\">\n {{ this.selectedYear.value }}\n\n <i class=\"layout-padding-left-3xs\" mc-icon=\"mc-angle-down-S_16\"></i>\n </button>\n\n <mc-option *ngFor=\"let year of years\"\n [mcTooltipDisabled]=\"true\"\n [value]=\"year\">\n {{ year.value }}\n </mc-option>\n </mc-select>\n</div>\n\n<div class=\"mc-calendar-header__button-group\">\n <button mc-button\n class=\"mc-button_transparent mc-calendar-header__previous-button\"\n [tabindex]=\"-1\"\n [disabled]=\"previousDisabled\"\n (click)=\"selectPreviousMonth()\">\n\n <i mc-icon=\"mc-angle-left-L_16\"></i>\n </button>\n\n <button mc-button\n class=\"mc-button_transparent\"\n [disabled]=\"currentDisabled\"\n [tabindex]=\"-1\"\n (click)=\"selectCurrentDate()\">\n\n <i mc-icon=\"mc-circle-8_16\"></i>\n </button>\n\n <button mc-button\n class=\"mc-button_transparent mc-calendar-header__next-button\"\n [tabindex]=\"-1\"\n [disabled]=\"nextDisabled\"\n (click)=\"selectNextMonth()\">\n\n <i mc-icon=\"mc-angle-right-L_16\"></i>\n </button>\n</div>\n", styles: [".mc-calendar-header{display:flex;flex-direction:row;justify-content:space-between;padding:var(--mc-datepicker-calendar-size-padding-top, 16px) var(--mc-datepicker-calendar-size-padding-horizontal, 8px) var(--mc-datepicker-calendar-size-padding-blocks, 12px) var(--mc-datepicker-calendar-size-padding-horizontal, 8px)}.mc-calendar-header__previous-button:after{border-left-width:var(--mc-datepicker-calendar-size-icon-border-width, 2px);transform:var(--mc-datepicker-calendar-size-icon-prev-icon-transform, translateX(2px) rotate(-45deg))}.mc-calendar-header__next-button:after{border-right-width:var(--mc-datepicker-calendar-size-icon-border-width, 2px);transform:var(--mc-datepicker-calendar-size-icon-nex-icon-transform, translateX(-2px) rotate(45deg))}.mc-calendar-header__select{width:auto!important}.mc-calendar-header__button-group,.mc-calendar-header__select-group{display:flex;flex-direction:row}.mc-calendar-select-panel{margin-top:2px;min-width:98%!important}.mc-calendar-select-panel .mc-select__content{max-height:384px;overflow-x:hidden;scrollbar-gutter:stable}.mc-calendar-select-panel .mc-select__content .mc-option{min-width:65px}\n"] }]
223
253
  }], ctorParameters: function () { return [{ type: i1$1.DateAdapter }]; }, propDecorators: { activeDate: [{
224
254
  type: Input
225
255
  }], maxDate: [{
@@ -1253,22 +1283,86 @@ class McDatepickerInput {
1253
1283
  }
1254
1284
  return [this.thirdDigit.value, this.thirdDigit.start, this.thirdDigit.end];
1255
1285
  }
1256
- incrementDate(dateVal, whatToIncrement) {
1257
- let year = this.adapter.getYear(dateVal);
1258
- let month = this.adapter.getMonth(dateVal);
1259
- let day = this.adapter.getDate(dateVal);
1286
+ isMaxMonth(date) {
1287
+ return this.adapter.getMonth(date) === this.getMaxMonth(date);
1288
+ }
1289
+ isMinMonth(date) {
1290
+ return this.adapter.getMonth(date) === this.getMinMonth(date);
1291
+ }
1292
+ isMaxYear(date) {
1293
+ return this.adapter.getYear(date) === this.getMaxYear();
1294
+ }
1295
+ isMinYear(date) {
1296
+ return this.adapter.getYear(date) === this.getMinYear();
1297
+ }
1298
+ getMaxDate(date) {
1299
+ if (this.datepicker.maxDate && this.isMaxYear(date) && this.isMaxMonth(date)) {
1300
+ return this.adapter.getDate(this.datepicker.maxDate);
1301
+ }
1302
+ return this.adapter.getNumDaysInMonth(date);
1303
+ }
1304
+ getMinDate(date) {
1305
+ if (this.datepicker.minDate && this.isMinYear(date) && this.isMinMonth(date)) {
1306
+ return this.adapter.getDate(this.datepicker.minDate);
1307
+ }
1308
+ return 1;
1309
+ }
1310
+ getMaxMonth(date) {
1311
+ if (this.datepicker.maxDate && this.isMaxYear(date)) {
1312
+ return this.adapter.getMonth(this.datepicker.maxDate);
1313
+ }
1314
+ // tslint:disable-next-line:no-magic-numbers
1315
+ return 11;
1316
+ }
1317
+ getMinMonth(date) {
1318
+ if (this.datepicker.minDate && this.isMinYear(date)) {
1319
+ return this.adapter.getMonth(this.datepicker.minDate);
1320
+ }
1321
+ return 0;
1322
+ }
1323
+ getMaxYear() {
1324
+ if (this.datepicker.maxDate) {
1325
+ return this.adapter.getYear(this.datepicker.maxDate);
1326
+ }
1327
+ return MAX_YEAR;
1328
+ }
1329
+ getMinYear() {
1330
+ if (this.datepicker.minDate) {
1331
+ return this.adapter.getYear(this.datepicker.minDate);
1332
+ }
1333
+ return 1;
1334
+ }
1335
+ incrementDate(date, whatToIncrement) {
1336
+ let year = this.adapter.getYear(date);
1337
+ let month = this.adapter.getMonth(date);
1338
+ let day = this.adapter.getDate(date);
1260
1339
  switch (whatToIncrement) {
1261
1340
  case DateParts.day:
1262
1341
  day++;
1263
- if (day > this.adapter.getNumDaysInMonth(dateVal)) {
1264
- day = 1;
1342
+ if (day > this.getMaxDate(date)) {
1343
+ if (this.isMaxYear(date) && this.isMaxMonth(date)) {
1344
+ day = this.getMaxDate(date);
1345
+ }
1346
+ else if (this.isMinYear(date) && this.isMinMonth(date)) {
1347
+ day = this.getMinDate(date);
1348
+ }
1349
+ else {
1350
+ day = 1;
1351
+ }
1265
1352
  }
1266
1353
  break;
1267
1354
  case DateParts.month:
1268
1355
  month++;
1269
- // tslint:disable-next-line:no-magic-numbers
1270
- if (month > 11) {
1271
- month = 0;
1356
+ if (month > this.getMaxMonth(date)) {
1357
+ if (this.isMaxYear(date)) {
1358
+ month = this.getMaxMonth(date);
1359
+ }
1360
+ else if (this.isMinYear(date)) {
1361
+ month = this.getMinMonth(date);
1362
+ }
1363
+ else {
1364
+ month = 0;
1365
+ }
1272
1366
  }
1273
1367
  const lastDay = this.getLastDayFor(year, month);
1274
1368
  if (day > lastDay) {
@@ -1277,8 +1371,8 @@ class McDatepickerInput {
1277
1371
  break;
1278
1372
  case DateParts.year:
1279
1373
  year++;
1280
- if (year > MAX_YEAR) {
1281
- year = 1;
1374
+ if (year > this.getMaxYear()) {
1375
+ year = this.getMaxYear();
1282
1376
  }
1283
1377
  break;
1284
1378
  default:
@@ -1288,22 +1382,38 @@ class McDatepickerInput {
1288
1382
  getLastDayFor(year, month) {
1289
1383
  return this.adapter.getNumDaysInMonth(this.createDate(year, month, 1));
1290
1384
  }
1291
- decrementDate(dateVal, whatToDecrement) {
1292
- let year = this.adapter.getYear(dateVal);
1293
- let month = this.adapter.getMonth(dateVal);
1294
- let day = this.adapter.getDate(dateVal);
1385
+ decrementDate(date, whatToDecrement) {
1386
+ let year = this.adapter.getYear(date);
1387
+ let month = this.adapter.getMonth(date);
1388
+ let day = this.adapter.getDate(date);
1295
1389
  switch (whatToDecrement) {
1296
1390
  case DateParts.day:
1297
1391
  day--;
1298
- if (day < 1) {
1299
- day = this.adapter.getNumDaysInMonth(dateVal);
1392
+ if (day < this.getMinDate(date)) {
1393
+ if (this.isMinYear(date) && this.isMinMonth(date)) {
1394
+ day = this.getMinDate(date);
1395
+ }
1396
+ else if (this.isMaxYear(date) && this.isMaxMonth(date)) {
1397
+ day = this.getMaxDate(date);
1398
+ }
1399
+ else {
1400
+ day = this.adapter.getNumDaysInMonth(date);
1401
+ }
1300
1402
  }
1301
1403
  break;
1302
1404
  case DateParts.month:
1303
1405
  month--;
1304
- if (month < 0) {
1305
- // tslint:disable-next-line:no-magic-numbers
1306
- month = 11;
1406
+ if (month < this.getMinMonth(date)) {
1407
+ if (year === this.getMinYear()) {
1408
+ month = this.getMinMonth(date);
1409
+ }
1410
+ else if (this.isMaxYear(date)) {
1411
+ month = this.getMaxMonth(date);
1412
+ }
1413
+ else {
1414
+ // tslint:disable-next-line:no-magic-numbers
1415
+ month = 11;
1416
+ }
1307
1417
  }
1308
1418
  const lastDay = this.getLastDayFor(year, month);
1309
1419
  if (day > lastDay) {
@@ -1312,8 +1422,8 @@ class McDatepickerInput {
1312
1422
  break;
1313
1423
  case DateParts.year:
1314
1424
  year--;
1315
- if (year < 1) {
1316
- year = MAX_YEAR;
1425
+ if (year < this.getMinYear()) {
1426
+ year = this.getMinYear();
1317
1427
  }
1318
1428
  break;
1319
1429
  default: