@koobiq/components 17.0.3 → 17.1.0
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/badge/badge.component.scss +2 -2
- package/button/button.scss +2 -6
- package/button-toggle/button-toggle.scss +8 -6
- package/checkbox/checkbox.scss +9 -18
- package/code-block/code-block.scss +1 -4
- package/core/styles/common/_groups.scss +2 -2
- package/core/styles/common/_select.scss +23 -60
- package/core/styles/common/_tokens.scss +52 -0
- package/core/styles/theming/_scrollbar-theme.scss +8 -19
- package/datepicker/_datepicker-theme.scss +1 -0
- package/datepicker/calendar-header.component.d.ts +10 -6
- package/datepicker/calendar.scss +2 -3
- package/datepicker/datepicker-input.directive.d.ts +10 -0
- package/esm2022/button-toggle/button-toggle.component.mjs +2 -2
- package/esm2022/core/version.mjs +2 -2
- package/esm2022/datepicker/calendar-header.component.mjs +32 -9
- package/esm2022/datepicker/datepicker-input.directive.mjs +101 -21
- package/esm2022/file-upload/multiple-file-upload.component.mjs +2 -2
- package/esm2022/file-upload/single-file-upload.component.mjs +2 -2
- package/esm2022/navbar/vertical-navbar.component.mjs +8 -4
- package/esm2022/radio/radio.component.mjs +2 -2
- package/esm2022/toast/toast.component.mjs +7 -6
- package/esm2022/toast/toast.module.mjs +5 -1
- package/esm2022/toggle/toggle.component.mjs +3 -3
- package/fesm2022/koobiq-components-button-toggle.mjs +2 -2
- package/fesm2022/koobiq-components-button-toggle.mjs.map +1 -1
- package/fesm2022/koobiq-components-core.mjs +1 -1
- package/fesm2022/koobiq-components-core.mjs.map +1 -1
- package/fesm2022/koobiq-components-datepicker.mjs +131 -28
- package/fesm2022/koobiq-components-datepicker.mjs.map +1 -1
- package/fesm2022/koobiq-components-file-upload.mjs +4 -4
- package/fesm2022/koobiq-components-file-upload.mjs.map +1 -1
- package/fesm2022/koobiq-components-navbar.mjs +7 -3
- package/fesm2022/koobiq-components-navbar.mjs.map +1 -1
- package/fesm2022/koobiq-components-radio.mjs +2 -2
- package/fesm2022/koobiq-components-radio.mjs.map +1 -1
- package/fesm2022/koobiq-components-toast.mjs +8 -3
- package/fesm2022/koobiq-components-toast.mjs.map +1 -1
- package/fesm2022/koobiq-components-toggle.mjs +2 -2
- package/fesm2022/koobiq-components-toggle.mjs.map +1 -1
- package/file-upload/multiple-file-upload.component.scss +16 -33
- package/file-upload/single-file-upload.component.scss +8 -6
- package/form-field/form-field.scss +8 -14
- package/input/input.scss +4 -11
- package/navbar/vertical-navbar.component.d.ts +2 -1
- package/navbar/vertical-navbar.scss +9 -4
- package/package.json +4 -4
- package/prebuilt-themes/dark-theme.css +1 -1
- package/prebuilt-themes/light-theme.css +1 -1
- package/radio/radio.scss +9 -24
- package/schematics/ng-add/index.js +2 -2
- package/tabs/_tabs-common.scss +6 -14
- package/tags/tag-list.scss +2 -15
- package/toast/toast.module.d.ts +5 -4
- package/toggle/_toggle-theme.scss +5 -2
- package/toggle/toggle.scss +2 -16
- package/tooltip/tooltip.scss +1 -1
- package/tree/tree-option.scss +9 -20
|
@@ -119,6 +119,7 @@ class KbqCalendarHeader {
|
|
|
119
119
|
set activeDate(value) {
|
|
120
120
|
this._activeDate = value;
|
|
121
121
|
this.updateSelectedValues();
|
|
122
|
+
this.updateSelectionOptions();
|
|
122
123
|
}
|
|
123
124
|
get maxDate() {
|
|
124
125
|
return this._maxDate;
|
|
@@ -128,7 +129,7 @@ class KbqCalendarHeader {
|
|
|
128
129
|
return;
|
|
129
130
|
}
|
|
130
131
|
this._maxDate = value;
|
|
131
|
-
this.
|
|
132
|
+
this.updateSelectionOptions();
|
|
132
133
|
}
|
|
133
134
|
get minDate() {
|
|
134
135
|
return this._minDate;
|
|
@@ -138,10 +139,10 @@ class KbqCalendarHeader {
|
|
|
138
139
|
return;
|
|
139
140
|
}
|
|
140
141
|
this._minDate = value;
|
|
141
|
-
this.
|
|
142
|
+
this.updateSelectionOptions();
|
|
142
143
|
}
|
|
143
144
|
get previousDisabled() {
|
|
144
|
-
return this.compareDate(this.activeDate, this.minDate)
|
|
145
|
+
return this.compareDate(this.activeDate, this.minDate) <= 0;
|
|
145
146
|
}
|
|
146
147
|
get nextDisabled() {
|
|
147
148
|
return this.compareDate(this.activeDate, this.maxDate) >= 0;
|
|
@@ -156,11 +157,12 @@ class KbqCalendarHeader {
|
|
|
156
157
|
this.monthSelected = new EventEmitter();
|
|
157
158
|
this.yearSelected = new EventEmitter();
|
|
158
159
|
this.monthNames = this.adapter.getMonthNames('long').map((name, i) => {
|
|
159
|
-
return { name
|
|
160
|
+
return { name, nameShort: this.adapter.getMonthNames('short')[i], value: i, disabled: false };
|
|
160
161
|
});
|
|
161
162
|
}
|
|
162
163
|
ngAfterContentInit() {
|
|
163
|
-
this.
|
|
164
|
+
this.updateYearsOptions();
|
|
165
|
+
this.updateMonthOptions();
|
|
164
166
|
this.updateSelectedValues();
|
|
165
167
|
}
|
|
166
168
|
/** Handles when a new month is selected. */
|
|
@@ -179,6 +181,7 @@ class KbqCalendarHeader {
|
|
|
179
181
|
this.activeDate = this.adapter.createDate(year, month, Math.min(this.adapter.getDate(this.activeDate), daysInMonth));
|
|
180
182
|
this.yearSelected.emit(this.activeDate);
|
|
181
183
|
this.activeDateChange.emit(this.activeDate);
|
|
184
|
+
this.updateMonthOptions();
|
|
182
185
|
}
|
|
183
186
|
selectCurrentDate() {
|
|
184
187
|
this.activeDate = this.adapter.today();
|
|
@@ -207,7 +210,11 @@ class KbqCalendarHeader {
|
|
|
207
210
|
value: this.adapter.getYearName(this.activeDate)
|
|
208
211
|
};
|
|
209
212
|
}
|
|
210
|
-
|
|
213
|
+
updateSelectionOptions() {
|
|
214
|
+
this.updateYearsOptions();
|
|
215
|
+
this.updateMonthOptions();
|
|
216
|
+
}
|
|
217
|
+
updateYearsOptions() {
|
|
211
218
|
const minYear = this.adapter.getYear(this.minDate);
|
|
212
219
|
const maxYear = this.adapter.getYear(this.maxDate);
|
|
213
220
|
this.years = [];
|
|
@@ -215,14 +222,30 @@ class KbqCalendarHeader {
|
|
|
215
222
|
this.years.push({ name: key, value: this.adapter.getYearName(this.adapter.createDate(key)) });
|
|
216
223
|
}
|
|
217
224
|
}
|
|
225
|
+
updateMonthOptions() {
|
|
226
|
+
if (!this._activeDate) {
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
const minYear = this.adapter.getYear(this.minDate);
|
|
230
|
+
const minMonth = this.adapter.getMonth(this.minDate);
|
|
231
|
+
const maxYear = this.adapter.getYear(this.maxDate);
|
|
232
|
+
const maxMonth = this.adapter.getMonth(this.maxDate);
|
|
233
|
+
const currentYear = this.adapter.getYear(this._activeDate);
|
|
234
|
+
if (currentYear === minYear) {
|
|
235
|
+
this.monthNames.forEach((month) => (month.disabled = month.value < minMonth));
|
|
236
|
+
}
|
|
237
|
+
if (currentYear === maxYear) {
|
|
238
|
+
this.monthNames.forEach((month) => (month.disabled = month.value > maxMonth));
|
|
239
|
+
}
|
|
240
|
+
}
|
|
218
241
|
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: KbqCalendarHeader, deps: [{ token: i1$1.DateAdapter }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
219
|
-
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.2.0", type: KbqCalendarHeader, selector: "kbq-calendar-header", inputs: { activeDate: "activeDate", maxDate: "maxDate", minDate: "minDate" }, outputs: { activeDateChange: "activeDateChange", monthSelected: "monthSelected", yearSelected: "yearSelected" }, host: { classAttribute: "kbq-calendar-header" }, exportAs: ["kbqCalendarHeader"], ngImport: i0, template: "<div class=\"kbq-calendar-header__select-group\">\n <kbq-select\n #monthSelect=\"kbqSelect\"\n class=\"kbq-calendar-header__select\"\n [panelClass]=\"'kbq-calendar-select-panel'\"\n [value]=\"selectedMonth\"\n (selectionChange)=\"onMonthSelected($event.value)\"\n >\n <button\n kbq-button\n kbq-select-matcher\n class=\"layout-padding-right-xs\"\n [class.kbq-active]=\"monthSelect.panelOpen\"\n [color]=\"'contrast'\"\n [kbqStyle]=\"'transparent'\"\n [tabindex]=\"-1\"\n >\n {{ monthNames[selectedMonth].nameShort | titlecase }}\n\n <i\n kbq-icon=\"mc-angle-down-S_16\"\n class=\"layout-padding-left-3xs\"\n [color]=\"'contrast'\"\n ></i>\n </button>\n\n <kbq-option\n *ngFor=\"let month of monthNames\"\n [kbqTooltipDisabled]=\"true\"\n [value]=\"month.value\"\n >\n {{ month.name }}\n </kbq-option>\n </kbq-select>\n\n <kbq-select\n #yearSelect=\"kbqSelect\"\n [panelClass]=\"'kbq-calendar-select-panel'\"\n [value]=\"selectedYear\"\n (selectionChange)=\"onYearSelected($event.value.name)\"\n >\n <button\n kbq-button\n kbq-select-matcher\n class=\"layout-padding-right-xs\"\n [class.kbq-active]=\"yearSelect.panelOpen\"\n [color]=\"'contrast'\"\n [kbqStyle]=\"'transparent'\"\n [tabindex]=\"-1\"\n >\n {{ selectedYear.value }}\n\n <i\n kbq-icon=\"mc-angle-down-S_16\"\n class=\"layout-padding-left-3xs\"\n ></i>\n </button>\n\n <kbq-option\n *ngFor=\"let year of years\"\n [kbqTooltipDisabled]=\"true\"\n [value]=\"year\"\n >\n {{ year.value }}\n </kbq-option>\n </kbq-select>\n</div>\n\n<div class=\"kbq-calendar-header__button-group\">\n <button\n kbq-button\n class=\"kbq-calendar-header__previous-button\"\n [color]=\"'contrast'\"\n [disabled]=\"previousDisabled\"\n [kbqStyle]=\"'transparent'\"\n [tabindex]=\"-1\"\n (click)=\"selectPreviousMonth()\"\n >\n <i kbq-icon=\"mc-angle-left-L_16\"></i>\n </button>\n\n <button\n kbq-button\n [color]=\"'contrast'\"\n [kbqStyle]=\"'transparent'\"\n [tabindex]=\"-1\"\n (click)=\"selectCurrentDate()\"\n >\n <i kbq-icon=\"mc-circle-8_16\"></i>\n </button>\n\n <button\n kbq-button\n class=\"kbq-calendar-header__next-button\"\n [color]=\"'contrast'\"\n [disabled]=\"nextDisabled\"\n [kbqStyle]=\"'transparent'\"\n [tabindex]=\"-1\"\n (click)=\"selectNextMonth()\"\n >\n <i kbq-icon=\"mc-angle-right-L_16\"></i>\n </button>\n</div>\n", styles: [".kbq-calendar-header{display:flex;flex-direction:row;justify-content:space-between;padding-right:var(--kbq-datepicker-size-header-padding-horizontal, 4px);padding-left:var(--kbq-datepicker-size-header-padding-horizontal, 4px);margin-bottom:var(--kbq-datepicker-size-header-margin-bottom, 2px)}.kbq-calendar-header__select{width:auto!important}.kbq-calendar-header__button-group,.kbq-calendar-header__select-group{display:flex;flex-direction:row}.kbq-calendar-select-panel{margin-top:2px;min-width:98%!important}.kbq-calendar-select-panel .kbq-select__content{max-height:384px;overflow-x:hidden;scrollbar-gutter:auto}.kbq-calendar-select-panel .kbq-select__content .kbq-option{min-width:65px}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: i3.KbqButton, selector: "[kbq-button]", inputs: ["color", "tabIndex", "kbqStyle", "disabled"] }, { kind: "directive", type: i3.KbqButtonCssStyler, selector: "[kbq-button]" }, { kind: "directive", type: i4.KbqValidateDirective, selector: " input[kbqInput], input[kbqInputPassword], input[kbqTimepicker], input[kbqDatepicker], textarea[kbqTextarea], kbq-select, kbq-tree-select, kbq-tag-list ", exportAs: ["KbqValidate"] }, { kind: "component", type: i5.KbqSelect, selector: "kbq-select", inputs: ["disabled", "tabIndex", "hiddenItemsText", "panelClass", "backdropClass", "errorStateMatcher", "sortComparator", "hasBackdrop", "placeholder", "required", "multiple", "compareWith", "value", "id", "hiddenItemsTextFormatter"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["kbqSelect"] }, { kind: "directive", type: i5.KbqOptionTooltip, selector: "kbq-option" }, { kind: "component", type: i1$1.KbqOption, selector: "kbq-option", inputs: ["value", "showCheckbox", "disabled"], outputs: ["onSelectionChange"], exportAs: ["kbqOption"] }, { kind: "directive", type: i1$1.KbqSelectMatcher, selector: "kbq-select-matcher, [kbq-select-matcher]" }, { kind: "component", type: i6.KbqIcon, selector: "[kbq-icon]", inputs: ["color", "small", "autoColor"] }, { kind: "pipe", type: i1.TitleCasePipe, name: "titlecase" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
242
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.2.0", type: KbqCalendarHeader, selector: "kbq-calendar-header", inputs: { activeDate: "activeDate", maxDate: "maxDate", minDate: "minDate" }, outputs: { activeDateChange: "activeDateChange", monthSelected: "monthSelected", yearSelected: "yearSelected" }, host: { classAttribute: "kbq-calendar-header" }, exportAs: ["kbqCalendarHeader"], ngImport: i0, template: "<div class=\"kbq-calendar-header__select-group\">\n <kbq-select\n #monthSelect=\"kbqSelect\"\n class=\"kbq-calendar-header__select\"\n [panelClass]=\"'kbq-calendar-select-panel'\"\n [value]=\"selectedMonth\"\n (selectionChange)=\"onMonthSelected($event.value)\"\n >\n <button\n kbq-button\n kbq-select-matcher\n class=\"layout-padding-right-xs\"\n [class.kbq-active]=\"monthSelect.panelOpen\"\n [color]=\"'contrast'\"\n [kbqStyle]=\"'transparent'\"\n [tabindex]=\"-1\"\n >\n {{ monthNames[selectedMonth].nameShort | titlecase }}\n\n <i\n kbq-icon=\"mc-angle-down-S_16\"\n class=\"layout-padding-left-3xs\"\n [color]=\"'contrast'\"\n ></i>\n </button>\n\n <kbq-option\n *ngFor=\"let month of monthNames\"\n [disabled]=\"month.disabled\"\n [kbqTooltipDisabled]=\"true\"\n [value]=\"month.value\"\n >\n {{ month.name }}\n </kbq-option>\n </kbq-select>\n\n <kbq-select\n #yearSelect=\"kbqSelect\"\n [panelClass]=\"'kbq-calendar-select-panel'\"\n [value]=\"selectedYear\"\n (selectionChange)=\"onYearSelected($event.value.name)\"\n >\n <button\n kbq-button\n kbq-select-matcher\n class=\"layout-padding-right-xs\"\n [class.kbq-active]=\"yearSelect.panelOpen\"\n [color]=\"'contrast'\"\n [kbqStyle]=\"'transparent'\"\n [tabindex]=\"-1\"\n >\n {{ selectedYear.value }}\n\n <i\n kbq-icon=\"mc-angle-down-S_16\"\n class=\"layout-padding-left-3xs\"\n ></i>\n </button>\n\n <kbq-option\n *ngFor=\"let year of years\"\n [kbqTooltipDisabled]=\"true\"\n [value]=\"year\"\n >\n {{ year.value }}\n </kbq-option>\n </kbq-select>\n</div>\n\n<div class=\"kbq-calendar-header__button-group\">\n <button\n kbq-button\n class=\"kbq-calendar-header__previous-button\"\n [color]=\"'contrast'\"\n [disabled]=\"previousDisabled\"\n [kbqStyle]=\"'transparent'\"\n [tabindex]=\"-1\"\n (click)=\"selectPreviousMonth()\"\n >\n <i kbq-icon=\"mc-angle-left-L_16\"></i>\n </button>\n\n <button\n kbq-button\n [color]=\"'contrast'\"\n [kbqStyle]=\"'transparent'\"\n [tabindex]=\"-1\"\n (click)=\"selectCurrentDate()\"\n >\n <i kbq-icon=\"mc-circle-8_16\"></i>\n </button>\n\n <button\n kbq-button\n class=\"kbq-calendar-header__next-button\"\n [color]=\"'contrast'\"\n [disabled]=\"nextDisabled\"\n [kbqStyle]=\"'transparent'\"\n [tabindex]=\"-1\"\n (click)=\"selectNextMonth()\"\n >\n <i kbq-icon=\"mc-angle-right-L_16\"></i>\n </button>\n</div>\n", styles: [".kbq-calendar-header{display:flex;flex-direction:row;justify-content:space-between;padding-right:var(--kbq-datepicker-size-header-padding-horizontal, 4px);padding-left:var(--kbq-datepicker-size-header-padding-horizontal, 4px);margin-bottom:var(--kbq-datepicker-size-header-margin-bottom, 2px)}.kbq-calendar-header__select{width:auto!important}.kbq-calendar-header__button-group,.kbq-calendar-header__select-group{display:flex;flex-direction:row}.kbq-calendar-select-panel{margin-top:2px;min-width:98%!important}.kbq-calendar-select-panel .kbq-select__content{max-height:384px;overflow-x:hidden;scrollbar-gutter:auto}.kbq-calendar-select-panel .kbq-select__content .kbq-option{min-width:65px}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: i3.KbqButton, selector: "[kbq-button]", inputs: ["color", "tabIndex", "kbqStyle", "disabled"] }, { kind: "directive", type: i3.KbqButtonCssStyler, selector: "[kbq-button]" }, { kind: "directive", type: i4.KbqValidateDirective, selector: " input[kbqInput], input[kbqInputPassword], input[kbqTimepicker], input[kbqDatepicker], textarea[kbqTextarea], kbq-select, kbq-tree-select, kbq-tag-list ", exportAs: ["KbqValidate"] }, { kind: "component", type: i5.KbqSelect, selector: "kbq-select", inputs: ["disabled", "tabIndex", "hiddenItemsText", "panelClass", "backdropClass", "errorStateMatcher", "sortComparator", "hasBackdrop", "placeholder", "required", "multiple", "compareWith", "value", "id", "hiddenItemsTextFormatter"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["kbqSelect"] }, { kind: "directive", type: i5.KbqOptionTooltip, selector: "kbq-option" }, { kind: "component", type: i1$1.KbqOption, selector: "kbq-option", inputs: ["value", "showCheckbox", "disabled"], outputs: ["onSelectionChange"], exportAs: ["kbqOption"] }, { kind: "directive", type: i1$1.KbqSelectMatcher, selector: "kbq-select-matcher, [kbq-select-matcher]" }, { kind: "component", type: i6.KbqIcon, selector: "[kbq-icon]", inputs: ["color", "small", "autoColor"] }, { kind: "pipe", type: i1.TitleCasePipe, name: "titlecase" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
220
243
|
}
|
|
221
244
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: KbqCalendarHeader, decorators: [{
|
|
222
245
|
type: Component,
|
|
223
246
|
args: [{ selector: 'kbq-calendar-header', exportAs: 'kbqCalendarHeader', host: {
|
|
224
247
|
class: 'kbq-calendar-header'
|
|
225
|
-
}, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"kbq-calendar-header__select-group\">\n <kbq-select\n #monthSelect=\"kbqSelect\"\n class=\"kbq-calendar-header__select\"\n [panelClass]=\"'kbq-calendar-select-panel'\"\n [value]=\"selectedMonth\"\n (selectionChange)=\"onMonthSelected($event.value)\"\n >\n <button\n kbq-button\n kbq-select-matcher\n class=\"layout-padding-right-xs\"\n [class.kbq-active]=\"monthSelect.panelOpen\"\n [color]=\"'contrast'\"\n [kbqStyle]=\"'transparent'\"\n [tabindex]=\"-1\"\n >\n {{ monthNames[selectedMonth].nameShort | titlecase }}\n\n <i\n kbq-icon=\"mc-angle-down-S_16\"\n class=\"layout-padding-left-3xs\"\n [color]=\"'contrast'\"\n ></i>\n </button>\n\n <kbq-option\n *ngFor=\"let month of monthNames\"\n [kbqTooltipDisabled]=\"true\"\n [value]=\"month.value\"\n >\n {{ month.name }}\n </kbq-option>\n </kbq-select>\n\n <kbq-select\n #yearSelect=\"kbqSelect\"\n [panelClass]=\"'kbq-calendar-select-panel'\"\n [value]=\"selectedYear\"\n (selectionChange)=\"onYearSelected($event.value.name)\"\n >\n <button\n kbq-button\n kbq-select-matcher\n class=\"layout-padding-right-xs\"\n [class.kbq-active]=\"yearSelect.panelOpen\"\n [color]=\"'contrast'\"\n [kbqStyle]=\"'transparent'\"\n [tabindex]=\"-1\"\n >\n {{ selectedYear.value }}\n\n <i\n kbq-icon=\"mc-angle-down-S_16\"\n class=\"layout-padding-left-3xs\"\n ></i>\n </button>\n\n <kbq-option\n *ngFor=\"let year of years\"\n [kbqTooltipDisabled]=\"true\"\n [value]=\"year\"\n >\n {{ year.value }}\n </kbq-option>\n </kbq-select>\n</div>\n\n<div class=\"kbq-calendar-header__button-group\">\n <button\n kbq-button\n class=\"kbq-calendar-header__previous-button\"\n [color]=\"'contrast'\"\n [disabled]=\"previousDisabled\"\n [kbqStyle]=\"'transparent'\"\n [tabindex]=\"-1\"\n (click)=\"selectPreviousMonth()\"\n >\n <i kbq-icon=\"mc-angle-left-L_16\"></i>\n </button>\n\n <button\n kbq-button\n [color]=\"'contrast'\"\n [kbqStyle]=\"'transparent'\"\n [tabindex]=\"-1\"\n (click)=\"selectCurrentDate()\"\n >\n <i kbq-icon=\"mc-circle-8_16\"></i>\n </button>\n\n <button\n kbq-button\n class=\"kbq-calendar-header__next-button\"\n [color]=\"'contrast'\"\n [disabled]=\"nextDisabled\"\n [kbqStyle]=\"'transparent'\"\n [tabindex]=\"-1\"\n (click)=\"selectNextMonth()\"\n >\n <i kbq-icon=\"mc-angle-right-L_16\"></i>\n </button>\n</div>\n", styles: [".kbq-calendar-header{display:flex;flex-direction:row;justify-content:space-between;padding-right:var(--kbq-datepicker-size-header-padding-horizontal, 4px);padding-left:var(--kbq-datepicker-size-header-padding-horizontal, 4px);margin-bottom:var(--kbq-datepicker-size-header-margin-bottom, 2px)}.kbq-calendar-header__select{width:auto!important}.kbq-calendar-header__button-group,.kbq-calendar-header__select-group{display:flex;flex-direction:row}.kbq-calendar-select-panel{margin-top:2px;min-width:98%!important}.kbq-calendar-select-panel .kbq-select__content{max-height:384px;overflow-x:hidden;scrollbar-gutter:auto}.kbq-calendar-select-panel .kbq-select__content .kbq-option{min-width:65px}\n"] }]
|
|
248
|
+
}, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"kbq-calendar-header__select-group\">\n <kbq-select\n #monthSelect=\"kbqSelect\"\n class=\"kbq-calendar-header__select\"\n [panelClass]=\"'kbq-calendar-select-panel'\"\n [value]=\"selectedMonth\"\n (selectionChange)=\"onMonthSelected($event.value)\"\n >\n <button\n kbq-button\n kbq-select-matcher\n class=\"layout-padding-right-xs\"\n [class.kbq-active]=\"monthSelect.panelOpen\"\n [color]=\"'contrast'\"\n [kbqStyle]=\"'transparent'\"\n [tabindex]=\"-1\"\n >\n {{ monthNames[selectedMonth].nameShort | titlecase }}\n\n <i\n kbq-icon=\"mc-angle-down-S_16\"\n class=\"layout-padding-left-3xs\"\n [color]=\"'contrast'\"\n ></i>\n </button>\n\n <kbq-option\n *ngFor=\"let month of monthNames\"\n [disabled]=\"month.disabled\"\n [kbqTooltipDisabled]=\"true\"\n [value]=\"month.value\"\n >\n {{ month.name }}\n </kbq-option>\n </kbq-select>\n\n <kbq-select\n #yearSelect=\"kbqSelect\"\n [panelClass]=\"'kbq-calendar-select-panel'\"\n [value]=\"selectedYear\"\n (selectionChange)=\"onYearSelected($event.value.name)\"\n >\n <button\n kbq-button\n kbq-select-matcher\n class=\"layout-padding-right-xs\"\n [class.kbq-active]=\"yearSelect.panelOpen\"\n [color]=\"'contrast'\"\n [kbqStyle]=\"'transparent'\"\n [tabindex]=\"-1\"\n >\n {{ selectedYear.value }}\n\n <i\n kbq-icon=\"mc-angle-down-S_16\"\n class=\"layout-padding-left-3xs\"\n ></i>\n </button>\n\n <kbq-option\n *ngFor=\"let year of years\"\n [kbqTooltipDisabled]=\"true\"\n [value]=\"year\"\n >\n {{ year.value }}\n </kbq-option>\n </kbq-select>\n</div>\n\n<div class=\"kbq-calendar-header__button-group\">\n <button\n kbq-button\n class=\"kbq-calendar-header__previous-button\"\n [color]=\"'contrast'\"\n [disabled]=\"previousDisabled\"\n [kbqStyle]=\"'transparent'\"\n [tabindex]=\"-1\"\n (click)=\"selectPreviousMonth()\"\n >\n <i kbq-icon=\"mc-angle-left-L_16\"></i>\n </button>\n\n <button\n kbq-button\n [color]=\"'contrast'\"\n [kbqStyle]=\"'transparent'\"\n [tabindex]=\"-1\"\n (click)=\"selectCurrentDate()\"\n >\n <i kbq-icon=\"mc-circle-8_16\"></i>\n </button>\n\n <button\n kbq-button\n class=\"kbq-calendar-header__next-button\"\n [color]=\"'contrast'\"\n [disabled]=\"nextDisabled\"\n [kbqStyle]=\"'transparent'\"\n [tabindex]=\"-1\"\n (click)=\"selectNextMonth()\"\n >\n <i kbq-icon=\"mc-angle-right-L_16\"></i>\n </button>\n</div>\n", styles: [".kbq-calendar-header{display:flex;flex-direction:row;justify-content:space-between;padding-right:var(--kbq-datepicker-size-header-padding-horizontal, 4px);padding-left:var(--kbq-datepicker-size-header-padding-horizontal, 4px);margin-bottom:var(--kbq-datepicker-size-header-margin-bottom, 2px)}.kbq-calendar-header__select{width:auto!important}.kbq-calendar-header__button-group,.kbq-calendar-header__select-group{display:flex;flex-direction:row}.kbq-calendar-select-panel{margin-top:2px;min-width:98%!important}.kbq-calendar-select-panel .kbq-select__content{max-height:384px;overflow-x:hidden;scrollbar-gutter:auto}.kbq-calendar-select-panel .kbq-select__content .kbq-option{min-width:65px}\n"] }]
|
|
226
249
|
}], ctorParameters: () => [{ type: i1$1.DateAdapter }], propDecorators: { activeDate: [{
|
|
227
250
|
type: Input
|
|
228
251
|
}], maxDate: [{
|
|
@@ -1646,21 +1669,85 @@ class KbqDatepickerInput {
|
|
|
1646
1669
|
}
|
|
1647
1670
|
return [this.thirdDigit.value, this.thirdDigit.start, this.thirdDigit.end];
|
|
1648
1671
|
}
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1672
|
+
isMaxMonth(date) {
|
|
1673
|
+
return this.adapter.getMonth(date) === this.getMaxMonth(date);
|
|
1674
|
+
}
|
|
1675
|
+
isMinMonth(date) {
|
|
1676
|
+
return this.adapter.getMonth(date) === this.getMinMonth(date);
|
|
1677
|
+
}
|
|
1678
|
+
isMaxYear(date) {
|
|
1679
|
+
return this.adapter.getYear(date) === this.getMaxYear();
|
|
1680
|
+
}
|
|
1681
|
+
isMinYear(date) {
|
|
1682
|
+
return this.adapter.getYear(date) === this.getMinYear();
|
|
1683
|
+
}
|
|
1684
|
+
getMaxDate(date) {
|
|
1685
|
+
if (this.datepicker.maxDate && this.isMaxYear(date) && this.isMaxMonth(date)) {
|
|
1686
|
+
return this.adapter.getDate(this.datepicker.maxDate);
|
|
1687
|
+
}
|
|
1688
|
+
return this.adapter.getNumDaysInMonth(date);
|
|
1689
|
+
}
|
|
1690
|
+
getMinDate(date) {
|
|
1691
|
+
if (this.datepicker.minDate && this.isMinYear(date) && this.isMinMonth(date)) {
|
|
1692
|
+
return this.adapter.getDate(this.datepicker.minDate);
|
|
1693
|
+
}
|
|
1694
|
+
return 1;
|
|
1695
|
+
}
|
|
1696
|
+
getMaxMonth(date) {
|
|
1697
|
+
if (this.datepicker.maxDate && this.isMaxYear(date)) {
|
|
1698
|
+
return this.adapter.getMonth(this.datepicker.maxDate);
|
|
1699
|
+
}
|
|
1700
|
+
return 11;
|
|
1701
|
+
}
|
|
1702
|
+
getMinMonth(date) {
|
|
1703
|
+
if (this.datepicker.minDate && this.isMinYear(date)) {
|
|
1704
|
+
return this.adapter.getMonth(this.datepicker.minDate);
|
|
1705
|
+
}
|
|
1706
|
+
return 0;
|
|
1707
|
+
}
|
|
1708
|
+
getMaxYear() {
|
|
1709
|
+
if (this.datepicker.maxDate) {
|
|
1710
|
+
return this.adapter.getYear(this.datepicker.maxDate);
|
|
1711
|
+
}
|
|
1712
|
+
return MAX_YEAR;
|
|
1713
|
+
}
|
|
1714
|
+
getMinYear() {
|
|
1715
|
+
if (this.datepicker.minDate) {
|
|
1716
|
+
return this.adapter.getYear(this.datepicker.minDate);
|
|
1717
|
+
}
|
|
1718
|
+
return 1;
|
|
1719
|
+
}
|
|
1720
|
+
incrementDate(date, whatToIncrement) {
|
|
1721
|
+
let year = this.adapter.getYear(date);
|
|
1722
|
+
let month = this.adapter.getMonth(date);
|
|
1723
|
+
let day = this.adapter.getDate(date);
|
|
1653
1724
|
switch (whatToIncrement) {
|
|
1654
1725
|
case DateParts.day:
|
|
1655
1726
|
day++;
|
|
1656
|
-
if (day > this.
|
|
1657
|
-
|
|
1727
|
+
if (day > this.getMaxDate(date)) {
|
|
1728
|
+
if (this.isMaxYear(date) && this.isMaxMonth(date)) {
|
|
1729
|
+
day = this.getMaxDate(date);
|
|
1730
|
+
}
|
|
1731
|
+
else if (this.isMinYear(date) && this.isMinMonth(date)) {
|
|
1732
|
+
day = this.getMinDate(date);
|
|
1733
|
+
}
|
|
1734
|
+
else {
|
|
1735
|
+
day = 1;
|
|
1736
|
+
}
|
|
1658
1737
|
}
|
|
1659
1738
|
break;
|
|
1660
1739
|
case DateParts.month: {
|
|
1661
1740
|
month++;
|
|
1662
|
-
if (month >
|
|
1663
|
-
|
|
1741
|
+
if (month > this.getMaxMonth(date)) {
|
|
1742
|
+
if (this.isMaxYear(date)) {
|
|
1743
|
+
month = this.getMaxMonth(date);
|
|
1744
|
+
}
|
|
1745
|
+
else if (this.isMinYear(date)) {
|
|
1746
|
+
month = this.getMinMonth(date);
|
|
1747
|
+
}
|
|
1748
|
+
else {
|
|
1749
|
+
month = 0;
|
|
1750
|
+
}
|
|
1664
1751
|
}
|
|
1665
1752
|
const lastDay = this.getLastDayFor(year, month);
|
|
1666
1753
|
if (day > lastDay) {
|
|
@@ -1670,8 +1757,8 @@ class KbqDatepickerInput {
|
|
|
1670
1757
|
}
|
|
1671
1758
|
case DateParts.year:
|
|
1672
1759
|
year++;
|
|
1673
|
-
if (year >
|
|
1674
|
-
year =
|
|
1760
|
+
if (year > this.getMaxYear()) {
|
|
1761
|
+
year = this.getMaxYear();
|
|
1675
1762
|
}
|
|
1676
1763
|
break;
|
|
1677
1764
|
default:
|
|
@@ -1681,21 +1768,37 @@ class KbqDatepickerInput {
|
|
|
1681
1768
|
getLastDayFor(year, month) {
|
|
1682
1769
|
return this.adapter.getNumDaysInMonth(this.createDate(year, month, 1));
|
|
1683
1770
|
}
|
|
1684
|
-
decrementDate(
|
|
1685
|
-
let year = this.adapter.getYear(
|
|
1686
|
-
let month = this.adapter.getMonth(
|
|
1687
|
-
let day = this.adapter.getDate(
|
|
1771
|
+
decrementDate(date, whatToDecrement) {
|
|
1772
|
+
let year = this.adapter.getYear(date);
|
|
1773
|
+
let month = this.adapter.getMonth(date);
|
|
1774
|
+
let day = this.adapter.getDate(date);
|
|
1688
1775
|
switch (whatToDecrement) {
|
|
1689
1776
|
case DateParts.day:
|
|
1690
1777
|
day--;
|
|
1691
|
-
if (day <
|
|
1692
|
-
|
|
1778
|
+
if (day < this.getMinDate(date)) {
|
|
1779
|
+
if (this.isMinYear(date) && this.isMinMonth(date)) {
|
|
1780
|
+
day = this.getMinDate(date);
|
|
1781
|
+
}
|
|
1782
|
+
else if (this.isMaxYear(date) && this.isMaxMonth(date)) {
|
|
1783
|
+
day = this.getMaxDate(date);
|
|
1784
|
+
}
|
|
1785
|
+
else {
|
|
1786
|
+
day = this.adapter.getNumDaysInMonth(date);
|
|
1787
|
+
}
|
|
1693
1788
|
}
|
|
1694
1789
|
break;
|
|
1695
1790
|
case DateParts.month: {
|
|
1696
1791
|
month--;
|
|
1697
|
-
if (month <
|
|
1698
|
-
|
|
1792
|
+
if (month < this.getMinMonth(date)) {
|
|
1793
|
+
if (year === this.getMinYear()) {
|
|
1794
|
+
month = this.getMinMonth(date);
|
|
1795
|
+
}
|
|
1796
|
+
else if (this.isMaxYear(date)) {
|
|
1797
|
+
month = this.getMaxMonth(date);
|
|
1798
|
+
}
|
|
1799
|
+
else {
|
|
1800
|
+
month = 11;
|
|
1801
|
+
}
|
|
1699
1802
|
}
|
|
1700
1803
|
const lastDay = this.getLastDayFor(year, month);
|
|
1701
1804
|
if (day > lastDay) {
|
|
@@ -1705,8 +1808,8 @@ class KbqDatepickerInput {
|
|
|
1705
1808
|
}
|
|
1706
1809
|
case DateParts.year:
|
|
1707
1810
|
year--;
|
|
1708
|
-
if (year <
|
|
1709
|
-
year =
|
|
1811
|
+
if (year < this.getMinYear()) {
|
|
1812
|
+
year = this.getMinYear();
|
|
1710
1813
|
}
|
|
1711
1814
|
break;
|
|
1712
1815
|
default:
|