@ptsecurity/mosaic 15.9.3 → 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.
- package/datepicker/calendar-header.component.d.ts +11 -5
- package/datepicker/datepicker-input.directive.d.ts +10 -0
- package/esm2020/core/version.mjs +2 -2
- package/esm2020/datepicker/calendar-header.component.mjs +40 -10
- package/esm2020/datepicker/datepicker-input.directive.mjs +103 -23
- package/fesm2015/ptsecurity-mosaic-core.mjs +1 -1
- package/fesm2015/ptsecurity-mosaic-core.mjs.map +1 -1
- package/fesm2015/ptsecurity-mosaic-datepicker.mjs +141 -31
- package/fesm2015/ptsecurity-mosaic-datepicker.mjs.map +1 -1
- package/fesm2020/ptsecurity-mosaic-core.mjs +1 -1
- package/fesm2020/ptsecurity-mosaic-core.mjs.map +1 -1
- package/fesm2020/ptsecurity-mosaic-datepicker.mjs +141 -31
- package/fesm2020/ptsecurity-mosaic-datepicker.mjs.map +1 -1
- package/package.json +4 -4
@@ -123,8 +123,9 @@ class McCalendarHeader {
|
|
123
123
|
this.activeDateChange = new EventEmitter();
|
124
124
|
this.monthSelected = new EventEmitter();
|
125
125
|
this.yearSelected = new EventEmitter();
|
126
|
-
this.monthNames = this.adapter.getMonthNames('long')
|
127
|
-
|
126
|
+
this.monthNames = this.adapter.getMonthNames('long').map((name, i) => {
|
127
|
+
return { name, nameShort: this.adapter.getMonthNames('short')[i], value: i, disabled: false };
|
128
|
+
});
|
128
129
|
}
|
129
130
|
get activeDate() {
|
130
131
|
return this._activeDate;
|
@@ -132,6 +133,7 @@ class McCalendarHeader {
|
|
132
133
|
set activeDate(value) {
|
133
134
|
this._activeDate = value;
|
134
135
|
this.updateSelectedValues();
|
136
|
+
this.updateSelectionOptions();
|
135
137
|
}
|
136
138
|
get maxDate() {
|
137
139
|
return this._maxDate;
|
@@ -141,7 +143,7 @@ class McCalendarHeader {
|
|
141
143
|
return;
|
142
144
|
}
|
143
145
|
this._maxDate = value;
|
144
|
-
this.
|
146
|
+
this.updateYearsOptions();
|
145
147
|
}
|
146
148
|
get minDate() {
|
147
149
|
return this._minDate;
|
@@ -151,16 +153,20 @@ class McCalendarHeader {
|
|
151
153
|
return;
|
152
154
|
}
|
153
155
|
this._minDate = value;
|
154
|
-
this.
|
156
|
+
this.updateYearsOptions();
|
155
157
|
}
|
156
158
|
get previousDisabled() {
|
157
|
-
return this.compareDate(this.activeDate, this.minDate)
|
159
|
+
return this.compareDate(this.activeDate, this.minDate) <= 0;
|
160
|
+
}
|
161
|
+
get currentDisabled() {
|
162
|
+
const today = this.adapter.today();
|
163
|
+
return this.compareDate(today, this.minDate) < 0 || this.compareDate(today, this.maxDate) > 0;
|
158
164
|
}
|
159
165
|
get nextDisabled() {
|
160
166
|
return this.compareDate(this.activeDate, this.maxDate) >= 0;
|
161
167
|
}
|
162
168
|
ngAfterContentInit() {
|
163
|
-
this.
|
169
|
+
this.updateSelectionOptions();
|
164
170
|
this.updateSelectedValues();
|
165
171
|
}
|
166
172
|
/** Handles when a new month is selected. */
|
@@ -179,6 +185,7 @@ class McCalendarHeader {
|
|
179
185
|
this.activeDate = this.adapter.createDate(year, month, Math.min(this.adapter.getDate(this.activeDate), daysInMonth));
|
180
186
|
this.yearSelected.emit(this.activeDate);
|
181
187
|
this.activeDateChange.emit(this.activeDate);
|
188
|
+
this.updateMonthOptions();
|
182
189
|
}
|
183
190
|
selectCurrentDate() {
|
184
191
|
this.activeDate = this.adapter.today();
|
@@ -205,7 +212,11 @@ class McCalendarHeader {
|
|
205
212
|
this.selectedYear = this.years.find(({ name }) => name === year)
|
206
213
|
|| { name: year, value: this.adapter.getYearName(this.activeDate) };
|
207
214
|
}
|
208
|
-
|
215
|
+
updateSelectionOptions() {
|
216
|
+
this.updateYearsOptions();
|
217
|
+
this.updateMonthOptions();
|
218
|
+
}
|
219
|
+
updateYearsOptions() {
|
209
220
|
const minYear = this.adapter.getYear(this.minDate);
|
210
221
|
const maxYear = this.adapter.getYear(this.maxDate);
|
211
222
|
this.years = [];
|
@@ -213,14 +224,33 @@ class McCalendarHeader {
|
|
213
224
|
this.years.push({ name: key, value: this.adapter.getYearName(this.adapter.createDate(key)) });
|
214
225
|
}
|
215
226
|
}
|
227
|
+
updateMonthOptions() {
|
228
|
+
if (!this._activeDate) {
|
229
|
+
return;
|
230
|
+
}
|
231
|
+
const minYear = this.adapter.getYear(this.minDate);
|
232
|
+
const minMonth = this.adapter.getMonth(this.minDate);
|
233
|
+
const maxYear = this.adapter.getYear(this.maxDate);
|
234
|
+
const maxMonth = this.adapter.getMonth(this.maxDate);
|
235
|
+
const currentYear = this.adapter.getYear(this._activeDate);
|
236
|
+
if (currentYear === minYear && currentYear === maxYear) {
|
237
|
+
this.monthNames.forEach((month) => (month.disabled = month.value < minMonth || month.value > maxMonth));
|
238
|
+
}
|
239
|
+
else if (currentYear === minYear) {
|
240
|
+
this.monthNames.forEach((month) => (month.disabled = month.value < minMonth));
|
241
|
+
}
|
242
|
+
else if (currentYear === maxYear) {
|
243
|
+
this.monthNames.forEach((month) => (month.disabled = month.value > maxMonth));
|
244
|
+
}
|
245
|
+
}
|
216
246
|
}
|
217
247
|
/** @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 });
|
218
|
-
/** @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 });
|
248
|
+
/** @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 });
|
219
249
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: McCalendarHeader, decorators: [{
|
220
250
|
type: Component,
|
221
251
|
args: [{ selector: 'mc-calendar-header', exportAs: 'mcCalendarHeader', host: {
|
222
252
|
class: 'mc-calendar-header'
|
223
|
-
}, 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"] }]
|
253
|
+
}, 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"] }]
|
224
254
|
}], ctorParameters: function () { return [{ type: i1$1.DateAdapter }]; }, propDecorators: { activeDate: [{
|
225
255
|
type: Input
|
226
256
|
}], maxDate: [{
|
@@ -1651,22 +1681,86 @@ class McDatepickerInput {
|
|
1651
1681
|
}
|
1652
1682
|
return [this.thirdDigit.value, this.thirdDigit.start, this.thirdDigit.end];
|
1653
1683
|
}
|
1654
|
-
|
1655
|
-
|
1656
|
-
|
1657
|
-
|
1684
|
+
isMaxMonth(date) {
|
1685
|
+
return this.adapter.getMonth(date) === this.getMaxMonth(date);
|
1686
|
+
}
|
1687
|
+
isMinMonth(date) {
|
1688
|
+
return this.adapter.getMonth(date) === this.getMinMonth(date);
|
1689
|
+
}
|
1690
|
+
isMaxYear(date) {
|
1691
|
+
return this.adapter.getYear(date) === this.getMaxYear();
|
1692
|
+
}
|
1693
|
+
isMinYear(date) {
|
1694
|
+
return this.adapter.getYear(date) === this.getMinYear();
|
1695
|
+
}
|
1696
|
+
getMaxDate(date) {
|
1697
|
+
if (this.datepicker.maxDate && this.isMaxYear(date) && this.isMaxMonth(date)) {
|
1698
|
+
return this.adapter.getDate(this.datepicker.maxDate);
|
1699
|
+
}
|
1700
|
+
return this.adapter.getNumDaysInMonth(date);
|
1701
|
+
}
|
1702
|
+
getMinDate(date) {
|
1703
|
+
if (this.datepicker.minDate && this.isMinYear(date) && this.isMinMonth(date)) {
|
1704
|
+
return this.adapter.getDate(this.datepicker.minDate);
|
1705
|
+
}
|
1706
|
+
return 1;
|
1707
|
+
}
|
1708
|
+
getMaxMonth(date) {
|
1709
|
+
if (this.datepicker.maxDate && this.isMaxYear(date)) {
|
1710
|
+
return this.adapter.getMonth(this.datepicker.maxDate);
|
1711
|
+
}
|
1712
|
+
// tslint:disable-next-line:no-magic-numbers
|
1713
|
+
return 11;
|
1714
|
+
}
|
1715
|
+
getMinMonth(date) {
|
1716
|
+
if (this.datepicker.minDate && this.isMinYear(date)) {
|
1717
|
+
return this.adapter.getMonth(this.datepicker.minDate);
|
1718
|
+
}
|
1719
|
+
return 0;
|
1720
|
+
}
|
1721
|
+
getMaxYear() {
|
1722
|
+
if (this.datepicker.maxDate) {
|
1723
|
+
return this.adapter.getYear(this.datepicker.maxDate);
|
1724
|
+
}
|
1725
|
+
return MAX_YEAR;
|
1726
|
+
}
|
1727
|
+
getMinYear() {
|
1728
|
+
if (this.datepicker.minDate) {
|
1729
|
+
return this.adapter.getYear(this.datepicker.minDate);
|
1730
|
+
}
|
1731
|
+
return 1;
|
1732
|
+
}
|
1733
|
+
incrementDate(date, whatToIncrement) {
|
1734
|
+
let year = this.adapter.getYear(date);
|
1735
|
+
let month = this.adapter.getMonth(date);
|
1736
|
+
let day = this.adapter.getDate(date);
|
1658
1737
|
switch (whatToIncrement) {
|
1659
1738
|
case DateParts.day:
|
1660
1739
|
day++;
|
1661
|
-
if (day > this.
|
1662
|
-
|
1740
|
+
if (day > this.getMaxDate(date)) {
|
1741
|
+
if (this.isMaxYear(date) && this.isMaxMonth(date)) {
|
1742
|
+
day = this.getMaxDate(date);
|
1743
|
+
}
|
1744
|
+
else if (this.isMinYear(date) && this.isMinMonth(date)) {
|
1745
|
+
day = this.getMinDate(date);
|
1746
|
+
}
|
1747
|
+
else {
|
1748
|
+
day = 1;
|
1749
|
+
}
|
1663
1750
|
}
|
1664
1751
|
break;
|
1665
1752
|
case DateParts.month:
|
1666
1753
|
month++;
|
1667
|
-
|
1668
|
-
|
1669
|
-
|
1754
|
+
if (month > this.getMaxMonth(date)) {
|
1755
|
+
if (this.isMaxYear(date)) {
|
1756
|
+
month = this.getMaxMonth(date);
|
1757
|
+
}
|
1758
|
+
else if (this.isMinYear(date)) {
|
1759
|
+
month = this.getMinMonth(date);
|
1760
|
+
}
|
1761
|
+
else {
|
1762
|
+
month = 0;
|
1763
|
+
}
|
1670
1764
|
}
|
1671
1765
|
const lastDay = this.getLastDayFor(year, month);
|
1672
1766
|
if (day > lastDay) {
|
@@ -1675,8 +1769,8 @@ class McDatepickerInput {
|
|
1675
1769
|
break;
|
1676
1770
|
case DateParts.year:
|
1677
1771
|
year++;
|
1678
|
-
if (year >
|
1679
|
-
year =
|
1772
|
+
if (year > this.getMaxYear()) {
|
1773
|
+
year = this.getMaxYear();
|
1680
1774
|
}
|
1681
1775
|
break;
|
1682
1776
|
default:
|
@@ -1686,22 +1780,38 @@ class McDatepickerInput {
|
|
1686
1780
|
getLastDayFor(year, month) {
|
1687
1781
|
return this.adapter.getNumDaysInMonth(this.createDate(year, month, 1));
|
1688
1782
|
}
|
1689
|
-
decrementDate(
|
1690
|
-
let year = this.adapter.getYear(
|
1691
|
-
let month = this.adapter.getMonth(
|
1692
|
-
let day = this.adapter.getDate(
|
1783
|
+
decrementDate(date, whatToDecrement) {
|
1784
|
+
let year = this.adapter.getYear(date);
|
1785
|
+
let month = this.adapter.getMonth(date);
|
1786
|
+
let day = this.adapter.getDate(date);
|
1693
1787
|
switch (whatToDecrement) {
|
1694
1788
|
case DateParts.day:
|
1695
1789
|
day--;
|
1696
|
-
if (day <
|
1697
|
-
|
1790
|
+
if (day < this.getMinDate(date)) {
|
1791
|
+
if (this.isMinYear(date) && this.isMinMonth(date)) {
|
1792
|
+
day = this.getMinDate(date);
|
1793
|
+
}
|
1794
|
+
else if (this.isMaxYear(date) && this.isMaxMonth(date)) {
|
1795
|
+
day = this.getMaxDate(date);
|
1796
|
+
}
|
1797
|
+
else {
|
1798
|
+
day = this.adapter.getNumDaysInMonth(date);
|
1799
|
+
}
|
1698
1800
|
}
|
1699
1801
|
break;
|
1700
1802
|
case DateParts.month:
|
1701
1803
|
month--;
|
1702
|
-
if (month <
|
1703
|
-
|
1704
|
-
|
1804
|
+
if (month < this.getMinMonth(date)) {
|
1805
|
+
if (year === this.getMinYear()) {
|
1806
|
+
month = this.getMinMonth(date);
|
1807
|
+
}
|
1808
|
+
else if (this.isMaxYear(date)) {
|
1809
|
+
month = this.getMaxMonth(date);
|
1810
|
+
}
|
1811
|
+
else {
|
1812
|
+
// tslint:disable-next-line:no-magic-numbers
|
1813
|
+
month = 11;
|
1814
|
+
}
|
1705
1815
|
}
|
1706
1816
|
const lastDay = this.getLastDayFor(year, month);
|
1707
1817
|
if (day > lastDay) {
|
@@ -1710,8 +1820,8 @@ class McDatepickerInput {
|
|
1710
1820
|
break;
|
1711
1821
|
case DateParts.year:
|
1712
1822
|
year--;
|
1713
|
-
if (year <
|
1714
|
-
year =
|
1823
|
+
if (year < this.getMinYear()) {
|
1824
|
+
year = this.getMinYear();
|
1715
1825
|
}
|
1716
1826
|
break;
|
1717
1827
|
default:
|