@skyux/datetime 5.1.2 → 5.5.0-alpha.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/README.md +6 -4
- package/bundles/skyux-datetime.umd.js +143 -141
- package/documentation.json +875 -228
- package/esm2015/index.js +28 -0
- package/esm2015/index.js.map +1 -0
- package/esm2015/lib/modules/date-pipe/date-format-utility.js +48 -0
- package/esm2015/lib/modules/date-pipe/date-format-utility.js.map +1 -0
- package/esm2015/lib/modules/date-pipe/date-pipe.module.js +21 -0
- package/esm2015/lib/modules/date-pipe/date-pipe.module.js.map +1 -0
- package/esm2015/lib/modules/date-pipe/date.pipe.js +65 -0
- package/esm2015/lib/modules/date-pipe/date.pipe.js.map +1 -0
- package/esm2015/lib/modules/date-pipe/fuzzy-date.pipe.js +47 -0
- package/esm2015/lib/modules/date-pipe/fuzzy-date.pipe.js.map +1 -0
- package/esm2015/lib/modules/date-range-picker/date-range-picker.component.js +464 -0
- package/esm2015/lib/modules/date-range-picker/date-range-picker.component.js.map +1 -0
- package/esm2015/lib/modules/date-range-picker/date-range-picker.module.js +47 -0
- package/esm2015/lib/modules/date-range-picker/date-range-picker.module.js.map +1 -0
- package/esm2015/lib/modules/date-range-picker/date-range.service.js +97 -0
- package/esm2015/lib/modules/date-range-picker/date-range.service.js.map +1 -0
- package/esm2015/lib/modules/date-range-picker/types/date-range-calculation.js +2 -0
- package/esm2015/lib/modules/date-range-picker/types/date-range-calculation.js.map +1 -0
- package/esm2015/lib/modules/date-range-picker/types/date-range-calculator-config.js +2 -0
- package/esm2015/lib/modules/date-range-picker/types/date-range-calculator-config.js.map +1 -0
- package/esm2015/lib/modules/date-range-picker/types/date-range-calculator-date-range-function.js +2 -0
- package/esm2015/lib/modules/date-range-picker/types/date-range-calculator-date-range-function.js.map +1 -0
- package/esm2015/lib/modules/date-range-picker/types/date-range-calculator-id.js +118 -0
- package/esm2015/lib/modules/date-range-picker/types/date-range-calculator-id.js.map +1 -0
- package/esm2015/lib/modules/date-range-picker/types/date-range-calculator-type.js +23 -0
- package/esm2015/lib/modules/date-range-picker/types/date-range-calculator-type.js.map +1 -0
- package/esm2015/lib/modules/date-range-picker/types/date-range-calculator-validate-function.js +2 -0
- package/esm2015/lib/modules/date-range-picker/types/date-range-calculator-validate-function.js.map +1 -0
- package/esm2015/lib/modules/date-range-picker/types/date-range-calculator.js +56 -0
- package/esm2015/lib/modules/date-range-picker/types/date-range-calculator.js.map +1 -0
- package/esm2015/lib/modules/date-range-picker/types/date-range-default-calculator-config.js +2 -0
- package/esm2015/lib/modules/date-range-picker/types/date-range-default-calculator-config.js.map +1 -0
- package/esm2015/lib/modules/date-range-picker/types/date-range-default-calculator-configs.js +147 -0
- package/esm2015/lib/modules/date-range-picker/types/date-range-default-calculator-configs.js.map +1 -0
- package/esm2015/lib/modules/date-range-picker/types/date-range-relative-value.js +252 -0
- package/esm2015/lib/modules/date-range-picker/types/date-range-relative-value.js.map +1 -0
- package/esm2015/lib/modules/date-range-picker/types/date-range.js +2 -0
- package/esm2015/lib/modules/date-range-picker/types/date-range.js.map +1 -0
- package/esm2015/lib/modules/datepicker/date-formatter.js +38 -0
- package/esm2015/lib/modules/datepicker/date-formatter.js.map +1 -0
- package/esm2015/lib/modules/datepicker/datepicker-adapter.service.js +33 -0
- package/esm2015/lib/modules/datepicker/datepicker-adapter.service.js.map +1 -0
- package/esm2015/lib/modules/datepicker/datepicker-calendar-change.js +2 -0
- package/esm2015/lib/modules/datepicker/datepicker-calendar-change.js.map +1 -0
- package/esm2015/lib/modules/datepicker/datepicker-calendar-inner.component.js +315 -0
- package/esm2015/lib/modules/datepicker/datepicker-calendar-inner.component.js.map +1 -0
- package/esm2015/lib/modules/datepicker/datepicker-calendar.component.js +109 -0
- package/esm2015/lib/modules/datepicker/datepicker-calendar.component.js.map +1 -0
- package/esm2015/lib/modules/datepicker/datepicker-config.service.js +21 -0
- package/esm2015/lib/modules/datepicker/datepicker-config.service.js.map +1 -0
- package/esm2015/lib/modules/datepicker/datepicker-custom-date.js +2 -0
- package/esm2015/lib/modules/datepicker/datepicker-custom-date.js.map +1 -0
- package/esm2015/lib/modules/datepicker/datepicker-date.js +2 -0
- package/esm2015/lib/modules/datepicker/datepicker-date.js.map +1 -0
- package/esm2015/lib/modules/datepicker/datepicker-input-fuzzy.directive.js +457 -0
- package/esm2015/lib/modules/datepicker/datepicker-input-fuzzy.directive.js.map +1 -0
- package/esm2015/lib/modules/datepicker/datepicker-input.directive.js +435 -0
- package/esm2015/lib/modules/datepicker/datepicker-input.directive.js.map +1 -0
- package/esm2015/lib/modules/datepicker/datepicker.component.js +333 -0
- package/esm2015/lib/modules/datepicker/datepicker.component.js.map +1 -0
- package/esm2015/lib/modules/datepicker/datepicker.module.js +95 -0
- package/esm2015/lib/modules/datepicker/datepicker.module.js.map +1 -0
- package/esm2015/lib/modules/datepicker/datepicker.service.js +21 -0
- package/esm2015/lib/modules/datepicker/datepicker.service.js.map +1 -0
- package/esm2015/lib/modules/datepicker/daypicker-button.component.js +26 -0
- package/esm2015/lib/modules/datepicker/daypicker-button.component.js.map +1 -0
- package/esm2015/lib/modules/datepicker/daypicker-cell.component.js +130 -0
- package/esm2015/lib/modules/datepicker/daypicker-cell.component.js.map +1 -0
- package/esm2015/lib/modules/datepicker/daypicker.component.js +215 -0
- package/esm2015/lib/modules/datepicker/daypicker.component.js.map +1 -0
- package/esm2015/lib/modules/datepicker/fuzzy-date.js +2 -0
- package/esm2015/lib/modules/datepicker/fuzzy-date.js.map +1 -0
- package/esm2015/lib/modules/datepicker/fuzzy-date.service.js +403 -0
- package/esm2015/lib/modules/datepicker/fuzzy-date.service.js.map +1 -0
- package/esm2015/lib/modules/datepicker/monthpicker.component.js +84 -0
- package/esm2015/lib/modules/datepicker/monthpicker.component.js.map +1 -0
- package/esm2015/lib/modules/datepicker/yearpicker.component.js +90 -0
- package/esm2015/lib/modules/datepicker/yearpicker.component.js.map +1 -0
- package/esm2015/lib/modules/shared/sky-datetime-resources.module.js +131 -0
- package/esm2015/lib/modules/shared/sky-datetime-resources.module.js.map +1 -0
- package/esm2015/lib/modules/timepicker/timepicker.component.js +367 -0
- package/esm2015/lib/modules/timepicker/timepicker.component.js.map +1 -0
- package/esm2015/lib/modules/timepicker/timepicker.directive.js +229 -0
- package/esm2015/lib/modules/timepicker/timepicker.directive.js.map +1 -0
- package/esm2015/lib/modules/timepicker/timepicker.interface.js +2 -0
- package/esm2015/lib/modules/timepicker/timepicker.interface.js.map +1 -0
- package/esm2015/lib/modules/timepicker/timepicker.module.js +46 -0
- package/esm2015/lib/modules/timepicker/timepicker.module.js.map +1 -0
- package/esm2015/skyux-datetime.js +2 -2
- package/esm2015/skyux-datetime.js.map +1 -0
- package/esm2015/testing/datepicker-fixture.js +1 -1
- package/esm2015/testing/datepicker-fixture.js.map +1 -0
- package/esm2015/testing/public-api.js +1 -1
- package/esm2015/testing/public-api.js.map +1 -0
- package/esm2015/testing/skyux-datetime-testing.js +1 -1
- package/esm2015/testing/skyux-datetime-testing.js.map +1 -0
- package/esm2015/testing/timepicker-fixture.js +1 -1
- package/esm2015/testing/timepicker-fixture.js.map +1 -0
- package/fesm2015/skyux-datetime-testing.js.map +1 -1
- package/fesm2015/skyux-datetime.js +415 -414
- package/fesm2015/skyux-datetime.js.map +1 -1
- package/index.d.ts +25 -0
- package/{modules → lib/modules}/date-pipe/date-format-utility.d.ts +0 -0
- package/{modules → lib/modules}/date-pipe/date-pipe.module.d.ts +0 -0
- package/{modules → lib/modules}/date-pipe/date.pipe.d.ts +0 -0
- package/{modules → lib/modules}/date-pipe/fuzzy-date.pipe.d.ts +0 -0
- package/{modules → lib/modules}/date-range-picker/date-range-picker.component.d.ts +1 -1
- package/{modules → lib/modules}/date-range-picker/date-range-picker.module.d.ts +0 -0
- package/{modules → lib/modules}/date-range-picker/date-range.service.d.ts +0 -0
- package/{modules → lib/modules}/date-range-picker/types/date-range-calculation.d.ts +0 -0
- package/{modules → lib/modules}/date-range-picker/types/date-range-calculator-config.d.ts +0 -0
- package/{modules → lib/modules}/date-range-picker/types/date-range-calculator-date-range-function.d.ts +0 -0
- package/{modules → lib/modules}/date-range-picker/types/date-range-calculator-id.d.ts +0 -0
- package/{modules → lib/modules}/date-range-picker/types/date-range-calculator-type.d.ts +0 -0
- package/{modules → lib/modules}/date-range-picker/types/date-range-calculator-validate-function.d.ts +0 -0
- package/{modules → lib/modules}/date-range-picker/types/date-range-calculator.d.ts +0 -0
- package/{modules → lib/modules}/date-range-picker/types/date-range-default-calculator-config.d.ts +0 -0
- package/{modules → lib/modules}/date-range-picker/types/date-range-default-calculator-configs.d.ts +0 -0
- package/{modules → lib/modules}/date-range-picker/types/date-range-relative-value.d.ts +0 -0
- package/{modules → lib/modules}/date-range-picker/types/date-range.d.ts +0 -0
- package/{modules → lib/modules}/datepicker/date-formatter.d.ts +0 -0
- package/{modules → lib/modules}/datepicker/datepicker-adapter.service.d.ts +0 -0
- package/{modules → lib/modules}/datepicker/datepicker-calendar-change.d.ts +0 -0
- package/{modules → lib/modules}/datepicker/datepicker-calendar-inner.component.d.ts +0 -0
- package/{modules → lib/modules}/datepicker/datepicker-calendar.component.d.ts +0 -0
- package/{modules → lib/modules}/datepicker/datepicker-config.service.d.ts +1 -1
- package/{modules → lib/modules}/datepicker/datepicker-custom-date.d.ts +0 -0
- package/{modules → lib/modules}/datepicker/datepicker-date.d.ts +0 -0
- package/{modules → lib/modules}/datepicker/datepicker-input-fuzzy.directive.d.ts +1 -1
- package/{modules → lib/modules}/datepicker/datepicker-input.directive.d.ts +1 -1
- package/{modules → lib/modules}/datepicker/datepicker.component.d.ts +1 -0
- package/{modules → lib/modules}/datepicker/datepicker.module.d.ts +0 -0
- package/{modules → lib/modules}/datepicker/datepicker.service.d.ts +0 -0
- package/{modules → lib/modules}/datepicker/daypicker-button.component.d.ts +0 -0
- package/{modules → lib/modules}/datepicker/daypicker-cell.component.d.ts +0 -0
- package/{modules → lib/modules}/datepicker/daypicker.component.d.ts +0 -0
- package/{modules → lib/modules}/datepicker/fuzzy-date.d.ts +0 -0
- package/{modules → lib/modules}/datepicker/fuzzy-date.service.d.ts +0 -0
- package/{modules → lib/modules}/datepicker/monthpicker.component.d.ts +0 -0
- package/{modules → lib/modules}/datepicker/yearpicker.component.d.ts +0 -0
- package/{modules → lib/modules}/shared/sky-datetime-resources.module.d.ts +0 -0
- package/{modules → lib/modules}/timepicker/timepicker.component.d.ts +0 -0
- package/{modules → lib/modules}/timepicker/timepicker.directive.d.ts +1 -1
- package/{modules → lib/modules}/timepicker/timepicker.interface.d.ts +0 -0
- package/{modules → lib/modules}/timepicker/timepicker.module.d.ts +0 -0
- package/package.json +10 -9
- package/skyux-datetime.d.ts +1 -1
- package/LICENSE +0 -21
- package/bundles/skyux-datetime-testing.umd.js.map +0 -1
- package/bundles/skyux-datetime.umd.js.map +0 -1
- package/esm2015/modules/date-pipe/date-format-utility.js +0 -48
- package/esm2015/modules/date-pipe/date-pipe.module.js +0 -21
- package/esm2015/modules/date-pipe/date.pipe.js +0 -64
- package/esm2015/modules/date-pipe/fuzzy-date.pipe.js +0 -46
- package/esm2015/modules/date-range-picker/date-range-picker.component.js +0 -460
- package/esm2015/modules/date-range-picker/date-range-picker.module.js +0 -47
- package/esm2015/modules/date-range-picker/date-range.service.js +0 -96
- package/esm2015/modules/date-range-picker/types/date-range-calculation.js +0 -2
- package/esm2015/modules/date-range-picker/types/date-range-calculator-config.js +0 -2
- package/esm2015/modules/date-range-picker/types/date-range-calculator-date-range-function.js +0 -2
- package/esm2015/modules/date-range-picker/types/date-range-calculator-id.js +0 -118
- package/esm2015/modules/date-range-picker/types/date-range-calculator-type.js +0 -23
- package/esm2015/modules/date-range-picker/types/date-range-calculator-validate-function.js +0 -2
- package/esm2015/modules/date-range-picker/types/date-range-calculator.js +0 -56
- package/esm2015/modules/date-range-picker/types/date-range-default-calculator-config.js +0 -2
- package/esm2015/modules/date-range-picker/types/date-range-default-calculator-configs.js +0 -147
- package/esm2015/modules/date-range-picker/types/date-range-relative-value.js +0 -252
- package/esm2015/modules/date-range-picker/types/date-range.js +0 -2
- package/esm2015/modules/datepicker/date-formatter.js +0 -38
- package/esm2015/modules/datepicker/datepicker-adapter.service.js +0 -33
- package/esm2015/modules/datepicker/datepicker-calendar-change.js +0 -2
- package/esm2015/modules/datepicker/datepicker-calendar-inner.component.js +0 -315
- package/esm2015/modules/datepicker/datepicker-calendar.component.js +0 -108
- package/esm2015/modules/datepicker/datepicker-config.service.js +0 -21
- package/esm2015/modules/datepicker/datepicker-custom-date.js +0 -2
- package/esm2015/modules/datepicker/datepicker-date.js +0 -2
- package/esm2015/modules/datepicker/datepicker-input-fuzzy.directive.js +0 -453
- package/esm2015/modules/datepicker/datepicker-input.directive.js +0 -432
- package/esm2015/modules/datepicker/datepicker.component.js +0 -330
- package/esm2015/modules/datepicker/datepicker.module.js +0 -95
- package/esm2015/modules/datepicker/datepicker.service.js +0 -21
- package/esm2015/modules/datepicker/daypicker-button.component.js +0 -25
- package/esm2015/modules/datepicker/daypicker-cell.component.js +0 -128
- package/esm2015/modules/datepicker/daypicker.component.js +0 -214
- package/esm2015/modules/datepicker/fuzzy-date.js +0 -2
- package/esm2015/modules/datepicker/fuzzy-date.service.js +0 -402
- package/esm2015/modules/datepicker/monthpicker.component.js +0 -83
- package/esm2015/modules/datepicker/yearpicker.component.js +0 -89
- package/esm2015/modules/shared/sky-datetime-resources.module.js +0 -131
- package/esm2015/modules/timepicker/timepicker.component.js +0 -365
- package/esm2015/modules/timepicker/timepicker.directive.js +0 -227
- package/esm2015/modules/timepicker/timepicker.interface.js +0 -2
- package/esm2015/modules/timepicker/timepicker.module.js +0 -46
- package/esm2015/public-api.js +0 -27
- package/public-api.d.ts +0 -24
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import { SkyDatepickerCalendarInnerComponent } from './datepicker-calendar-inner.component';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
import * as i1 from "./datepicker-calendar-inner.component";
|
|
5
|
+
import * as i2 from "@skyux/indicators";
|
|
6
|
+
import * as i3 from "@angular/common";
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export class SkyYearPickerComponent {
|
|
11
|
+
constructor(datepicker) {
|
|
12
|
+
this.rows = [];
|
|
13
|
+
this.datepicker = datepicker;
|
|
14
|
+
}
|
|
15
|
+
ngOnInit() {
|
|
16
|
+
this.datepicker.stepYear = { years: this.datepicker.yearRange };
|
|
17
|
+
this.datepicker.setRefreshViewHandler(() => {
|
|
18
|
+
this.refreshYearView();
|
|
19
|
+
}, 'year');
|
|
20
|
+
this.datepicker.setCompareHandler(this.compareYears, 'year');
|
|
21
|
+
this.datepicker.setKeydownHandler((key, event) => {
|
|
22
|
+
this.keydownYears(key, event);
|
|
23
|
+
}, 'year');
|
|
24
|
+
this.datepicker.refreshView();
|
|
25
|
+
}
|
|
26
|
+
getStartingYear(year) {
|
|
27
|
+
return (Math.floor((year - 1) / this.datepicker.yearRange) *
|
|
28
|
+
this.datepicker.yearRange +
|
|
29
|
+
1);
|
|
30
|
+
}
|
|
31
|
+
compareYears(date1, date2) {
|
|
32
|
+
return date1.getFullYear() - date2.getFullYear();
|
|
33
|
+
}
|
|
34
|
+
refreshYearView() {
|
|
35
|
+
let years = new Array(this.datepicker.yearRange);
|
|
36
|
+
let date;
|
|
37
|
+
let start = this.getStartingYear(this.datepicker.activeDate.getFullYear());
|
|
38
|
+
for (let i = 0; i < this.datepicker.yearRange; i++) {
|
|
39
|
+
date = new Date(this.datepicker.activeDate);
|
|
40
|
+
date.setFullYear(start + i, 0, 1);
|
|
41
|
+
years[i] = this.datepicker.createDateObject(date, this.datepicker.formatYear, false, this.datepicker.datepickerId + '-' + i);
|
|
42
|
+
}
|
|
43
|
+
this.title = [
|
|
44
|
+
years[0].label,
|
|
45
|
+
years[this.datepicker.yearRange - 1].label,
|
|
46
|
+
].join(' - ');
|
|
47
|
+
this.rows = this.datepicker.createCalendarRows(years, this.datepicker.yearColLimit);
|
|
48
|
+
}
|
|
49
|
+
keydownYears(key, event) {
|
|
50
|
+
let date = this.datepicker.activeDate.getFullYear();
|
|
51
|
+
/* istanbul ignore else */
|
|
52
|
+
/* sanity check */
|
|
53
|
+
if (key === 'left') {
|
|
54
|
+
date = date - 1;
|
|
55
|
+
}
|
|
56
|
+
else if (key === 'up') {
|
|
57
|
+
date = date - this.datepicker.yearColLimit;
|
|
58
|
+
}
|
|
59
|
+
else if (key === 'right') {
|
|
60
|
+
date = date + 1;
|
|
61
|
+
}
|
|
62
|
+
else if (key === 'down') {
|
|
63
|
+
date = date + this.datepicker.yearColLimit;
|
|
64
|
+
}
|
|
65
|
+
else if (key === 'pageup' || key === 'pagedown') {
|
|
66
|
+
date += (key === 'pageup' ? -1 : 1) * this.datepicker.yearRange;
|
|
67
|
+
}
|
|
68
|
+
else if (key === 'home') {
|
|
69
|
+
date = this.getStartingYear(this.datepicker.activeDate.getFullYear());
|
|
70
|
+
}
|
|
71
|
+
else if (key === 'end') {
|
|
72
|
+
date =
|
|
73
|
+
this.getStartingYear(this.datepicker.activeDate.getFullYear()) +
|
|
74
|
+
this.datepicker.yearRange -
|
|
75
|
+
1;
|
|
76
|
+
}
|
|
77
|
+
this.datepicker.activeDate.setFullYear(date);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
SkyYearPickerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyYearPickerComponent, deps: [{ token: i1.SkyDatepickerCalendarInnerComponent }], target: i0.ɵɵFactoryTarget.Component });
|
|
81
|
+
SkyYearPickerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkyYearPickerComponent, selector: "sky-yearpicker", ngImport: i0, template: "<table *ngIf=\"datepicker.datepickerMode === 'year'\" role=\"grid\">\n <thead>\n <tr>\n <th class=\"sky-datepicker-header-left\">\n <button\n type=\"button\"\n class=\"sky-btn sky-btn-default sky-btn-sm sky-datepicker-btn-previous\"\n (click)=\"datepicker.moveCalendar($event, -1)\"\n tabindex=\"-1\"\n >\n <sky-icon\n class=\"sky-datepicker-chevron-default\"\n icon=\"chevron-left\"\n ></sky-icon>\n <sky-icon\n class=\"sky-datepicker-chevron-modern\"\n icon=\"chevron-left\"\n iconType=\"skyux\"\n ></sky-icon>\n </button>\n </th>\n <th\n [attr.colspan]=\"\n datepicker.yearColLimit - 2 <= 0 ? 1 : datepicker.yearColLimit - 2\n \"\n >\n <button\n [id]=\"datepicker.datepickerId + '-title'\"\n role=\"heading\"\n type=\"button\"\n class=\"\n sky-btn sky-btn-default sky-btn-sm sky-datepicker-calendar-title\n \"\n (click)=\"datepicker.toggleModeCalendar($event)\"\n [disabled]=\"datepicker.datepickerMode === datepicker.maxMode\"\n [ngClass]=\"{\n 'sky-btn-disabled': datepicker.datepickerMode === datepicker.maxMode\n }\"\n tabindex=\"-1\"\n >\n <strong>{{ title }}</strong>\n </button>\n </th>\n <th class=\"sky-datepicker-header-right\">\n <button\n type=\"button\"\n class=\"sky-btn sky-btn-default sky-btn-sm sky-datepicker-btn-next\"\n (click)=\"datepicker.moveCalendar($event, 1)\"\n tabindex=\"-1\"\n >\n <sky-icon\n class=\"sky-datepicker-chevron-default\"\n icon=\"chevron-right\"\n ></sky-icon>\n <sky-icon\n class=\"sky-datepicker-chevron-modern\"\n icon=\"chevron-right\"\n iconType=\"skyux\"\n ></sky-icon>\n </button>\n </th>\n </tr>\n </thead>\n <tbody>\n <tr *ngFor=\"let row of rows\">\n <td *ngFor=\"let date of row\" class=\"sky-datepicker-row\" role=\"gridcell\">\n <button\n type=\"button\"\n class=\"sky-btn sky-btn-default sky-datepicker-btn-date\"\n [ngClass]=\"{\n 'sky-datepicker-btn-selected': date.selected,\n 'sky-btn-disabled': date.disabled,\n 'sky-btn-active': datepicker.isActive(date)\n }\"\n [disabled]=\"date.disabled\"\n (click)=\"datepicker.selectCalendar($event, date.date)\"\n tabindex=\"-1\"\n >\n <span [ngClass]=\"{ 'sky-datepicker-current': date.current }\">{{\n date.label\n }}</span>\n </button>\n </td>\n </tr>\n </tbody>\n</table>\n", styles: [":host-context(.sky-theme-modern) :host:focus{outline:none}.sky-theme-modern :host:focus{outline:none}\n"], components: [{ type: i2.λ4, selector: "sky-icon", inputs: ["icon", "iconType", "size", "fixedWidth", "variant"] }], directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
|
|
82
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyYearPickerComponent, decorators: [{
|
|
83
|
+
type: Component,
|
|
84
|
+
args: [{
|
|
85
|
+
selector: 'sky-yearpicker',
|
|
86
|
+
templateUrl: 'yearpicker.component.html',
|
|
87
|
+
styleUrls: ['./yearpicker.component.scss'],
|
|
88
|
+
}]
|
|
89
|
+
}], ctorParameters: function () { return [{ type: i1.SkyDatepickerCalendarInnerComponent }]; } });
|
|
90
|
+
//# sourceMappingURL=yearpicker.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"yearpicker.component.js","sourceRoot":"","sources":["../../../../../../../../libs/components/datetime/src/lib/modules/datepicker/yearpicker.component.ts","../../../../../../../../libs/components/datetime/src/lib/modules/datepicker/yearpicker.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAU,MAAM,eAAe,CAAC;AAElD,OAAO,EAAE,mCAAmC,EAAE,MAAM,uCAAuC,CAAC;;;;;AAI5F;;GAEG;AAMH,MAAM,OAAO,sBAAsB;IAOjC,YAAmB,UAA+C;QAJ3D,SAAI,GAAoC,EAAE,CAAC;QAKhD,IAAI,CAAC,UAAU,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CAAC,UAAU,CAAC,YAAY,CAAC;SAC5C;aAAM,IAAI,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,UAAU,EAAE;YACjD,IAAI,IAAI,CAAC,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC;SACjE;aAAM,IAAI,GAAG,KAAK,MAAM,EAAE;YACzB,IAAI,GAAG,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,CAAC;SACvE;aAAM,IAAI,GAAG,KAAK,KAAK,EAAE;YACxB,IAAI;gBACF,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC;oBAC9D,IAAI,CAAC,UAAU,CAAC,SAAS;oBACzB,CAAC,CAAC;SACL;QACD,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAC/C,CAAC;;oHA1FU,sBAAsB;wGAAtB,sBAAsB,sDCdnC,oyFAsFA;4FDxEa,sBAAsB;kBALlC,SAAS;mBAAC;oBACT,QAAQ,EAAE,gBAAgB;oBAC1B,WAAW,EAAE,2BAA2B;oBACxC,SAAS,EAAE,CAAC,6BAA6B,CAAC;iBAC3C","sourcesContent":["import { Component, OnInit } from '@angular/core';\n\nimport { SkyDatepickerCalendarInnerComponent } from './datepicker-calendar-inner.component';\n\nimport { SkyDatepickerDate } from './datepicker-date';\n\n/**\n * @internal\n */\n@Component({\n selector: 'sky-yearpicker',\n templateUrl: 'yearpicker.component.html',\n styleUrls: ['./yearpicker.component.scss'],\n})\nexport class SkyYearPickerComponent implements OnInit {\n public datepicker: SkyDatepickerCalendarInnerComponent;\n\n public rows: Array<Array<SkyDatepickerDate>> = [];\n\n public title: string;\n\n public constructor(datepicker: SkyDatepickerCalendarInnerComponent) {\n this.datepicker = datepicker;\n }\n\n public ngOnInit(): void {\n this.datepicker.stepYear = { years: this.datepicker.yearRange };\n\n this.datepicker.setRefreshViewHandler(() => {\n this.refreshYearView();\n }, 'year');\n\n this.datepicker.setCompareHandler(this.compareYears, 'year');\n\n this.datepicker.setKeydownHandler((key: string, event: KeyboardEvent) => {\n this.keydownYears(key, event);\n }, 'year');\n\n this.datepicker.refreshView();\n }\n\n protected getStartingYear(year: number): number {\n return (\n Math.floor((year - 1) / this.datepicker.yearRange) *\n this.datepicker.yearRange +\n 1\n );\n }\n\n private compareYears(date1: Date, date2: Date): number {\n return date1.getFullYear() - date2.getFullYear();\n }\n\n private refreshYearView() {\n let years: Array<SkyDatepickerDate> = new Array(this.datepicker.yearRange);\n let date: Date;\n let start = this.getStartingYear(this.datepicker.activeDate.getFullYear());\n\n for (let i = 0; i < this.datepicker.yearRange; i++) {\n date = new Date(this.datepicker.activeDate);\n date.setFullYear(start + i, 0, 1);\n\n years[i] = this.datepicker.createDateObject(\n date,\n this.datepicker.formatYear,\n false,\n this.datepicker.datepickerId + '-' + i\n );\n }\n\n this.title = [\n years[0].label,\n years[this.datepicker.yearRange - 1].label,\n ].join(' - ');\n this.rows = this.datepicker.createCalendarRows(\n years,\n this.datepicker.yearColLimit\n );\n }\n\n private keydownYears(key: string, event: KeyboardEvent) {\n let date = this.datepicker.activeDate.getFullYear();\n\n /* istanbul ignore else */\n /* sanity check */\n if (key === 'left') {\n date = date - 1;\n } else if (key === 'up') {\n date = date - this.datepicker.yearColLimit;\n } else if (key === 'right') {\n date = date + 1;\n } else if (key === 'down') {\n date = date + this.datepicker.yearColLimit;\n } else if (key === 'pageup' || key === 'pagedown') {\n date += (key === 'pageup' ? -1 : 1) * this.datepicker.yearRange;\n } else if (key === 'home') {\n date = this.getStartingYear(this.datepicker.activeDate.getFullYear());\n } else if (key === 'end') {\n date =\n this.getStartingYear(this.datepicker.activeDate.getFullYear()) +\n this.datepicker.yearRange -\n 1;\n }\n this.datepicker.activeDate.setFullYear(date);\n }\n}\n","<table *ngIf=\"datepicker.datepickerMode === 'year'\" role=\"grid\">\n <thead>\n <tr>\n <th class=\"sky-datepicker-header-left\">\n <button\n type=\"button\"\n class=\"sky-btn sky-btn-default sky-btn-sm sky-datepicker-btn-previous\"\n (click)=\"datepicker.moveCalendar($event, -1)\"\n tabindex=\"-1\"\n >\n <sky-icon\n class=\"sky-datepicker-chevron-default\"\n icon=\"chevron-left\"\n ></sky-icon>\n <sky-icon\n class=\"sky-datepicker-chevron-modern\"\n icon=\"chevron-left\"\n iconType=\"skyux\"\n ></sky-icon>\n </button>\n </th>\n <th\n [attr.colspan]=\"\n datepicker.yearColLimit - 2 <= 0 ? 1 : datepicker.yearColLimit - 2\n \"\n >\n <button\n [id]=\"datepicker.datepickerId + '-title'\"\n role=\"heading\"\n type=\"button\"\n class=\"\n sky-btn sky-btn-default sky-btn-sm sky-datepicker-calendar-title\n \"\n (click)=\"datepicker.toggleModeCalendar($event)\"\n [disabled]=\"datepicker.datepickerMode === datepicker.maxMode\"\n [ngClass]=\"{\n 'sky-btn-disabled': datepicker.datepickerMode === datepicker.maxMode\n }\"\n tabindex=\"-1\"\n >\n <strong>{{ title }}</strong>\n </button>\n </th>\n <th class=\"sky-datepicker-header-right\">\n <button\n type=\"button\"\n class=\"sky-btn sky-btn-default sky-btn-sm sky-datepicker-btn-next\"\n (click)=\"datepicker.moveCalendar($event, 1)\"\n tabindex=\"-1\"\n >\n <sky-icon\n class=\"sky-datepicker-chevron-default\"\n icon=\"chevron-right\"\n ></sky-icon>\n <sky-icon\n class=\"sky-datepicker-chevron-modern\"\n icon=\"chevron-right\"\n iconType=\"skyux\"\n ></sky-icon>\n </button>\n </th>\n </tr>\n </thead>\n <tbody>\n <tr *ngFor=\"let row of rows\">\n <td *ngFor=\"let date of row\" class=\"sky-datepicker-row\" role=\"gridcell\">\n <button\n type=\"button\"\n class=\"sky-btn sky-btn-default sky-datepicker-btn-date\"\n [ngClass]=\"{\n 'sky-datepicker-btn-selected': date.selected,\n 'sky-btn-disabled': date.disabled,\n 'sky-btn-active': datepicker.isActive(date)\n }\"\n [disabled]=\"date.disabled\"\n (click)=\"datepicker.selectCalendar($event, date.date)\"\n tabindex=\"-1\"\n >\n <span [ngClass]=\"{ 'sky-datepicker-current': date.current }\">{{\n date.label\n }}</span>\n </button>\n </td>\n </tr>\n </tbody>\n</table>\n"]}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NOTICE: DO NOT MODIFY THIS FILE!
|
|
3
|
+
* The contents of this file were automatically generated by
|
|
4
|
+
* the 'ng generate @skyux/i18n:lib-resources-module modules/shared/sky-datetime' schematic.
|
|
5
|
+
* To update this file, simply rerun the command.
|
|
6
|
+
*/
|
|
7
|
+
import { NgModule } from '@angular/core';
|
|
8
|
+
import { getLibStringForLocale, SkyI18nModule, SKY_LIB_RESOURCES_PROVIDERS, } from '@skyux/i18n';
|
|
9
|
+
import * as i0 from "@angular/core";
|
|
10
|
+
const RESOURCES = {
|
|
11
|
+
'EN-AU': {
|
|
12
|
+
skyux_date_range_picker_format_label_last_fiscal_year: {
|
|
13
|
+
message: 'Last financial year',
|
|
14
|
+
},
|
|
15
|
+
skyux_date_range_picker_format_label_this_fiscal_year: {
|
|
16
|
+
message: 'This financial year',
|
|
17
|
+
},
|
|
18
|
+
skyux_date_range_picker_format_label_next_fiscal_year: {
|
|
19
|
+
message: 'Next financial year',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
'EN-GB': {
|
|
23
|
+
skyux_date_range_picker_format_label_last_fiscal_year: {
|
|
24
|
+
message: 'Last financial year',
|
|
25
|
+
},
|
|
26
|
+
skyux_date_range_picker_format_label_this_fiscal_year: {
|
|
27
|
+
message: 'This financial year',
|
|
28
|
+
},
|
|
29
|
+
skyux_date_range_picker_format_label_next_fiscal_year: {
|
|
30
|
+
message: 'Next financial year',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
'EN-NZ': {
|
|
34
|
+
skyux_date_range_picker_format_label_last_fiscal_year: {
|
|
35
|
+
message: 'Last financial year',
|
|
36
|
+
},
|
|
37
|
+
skyux_date_range_picker_format_label_this_fiscal_year: {
|
|
38
|
+
message: 'This financial year',
|
|
39
|
+
},
|
|
40
|
+
skyux_date_range_picker_format_label_next_fiscal_year: {
|
|
41
|
+
message: 'Next financial year',
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
'EN-US': {
|
|
45
|
+
skyux_date_field_default_label: { message: 'Date' },
|
|
46
|
+
skyux_datepicker_trigger_button_label: { message: 'Select date' },
|
|
47
|
+
skyux_timepicker_button_label: { message: 'Choose time' },
|
|
48
|
+
skyux_timepicker_close: { message: 'Done' },
|
|
49
|
+
skyux_timepicker_input_default_label: { message: 'Time' },
|
|
50
|
+
skyux_date_range_picker_default_label: { message: 'Select a date range' },
|
|
51
|
+
skyux_date_range_picker_format_label_specific_range: {
|
|
52
|
+
message: 'Specific range',
|
|
53
|
+
},
|
|
54
|
+
skyux_date_range_picker_format_label_before: { message: 'Before' },
|
|
55
|
+
skyux_date_range_picker_format_label_after: { message: 'After' },
|
|
56
|
+
skyux_date_range_picker_format_label_any_time: { message: 'At any time' },
|
|
57
|
+
skyux_date_range_picker_format_label_yesterday: { message: 'Yesterday' },
|
|
58
|
+
skyux_date_range_picker_format_label_today: { message: 'Today' },
|
|
59
|
+
skyux_date_range_picker_format_label_tomorrow: { message: 'Tomorrow' },
|
|
60
|
+
skyux_date_range_picker_format_label_last_week: { message: 'Last week' },
|
|
61
|
+
skyux_date_range_picker_format_label_this_week: { message: 'This week' },
|
|
62
|
+
skyux_date_range_picker_format_label_next_week: { message: 'Next week' },
|
|
63
|
+
skyux_date_range_picker_format_label_last_month: { message: 'Last month' },
|
|
64
|
+
skyux_date_range_picker_format_label_this_month: { message: 'This month' },
|
|
65
|
+
skyux_date_range_picker_format_label_next_month: { message: 'Next month' },
|
|
66
|
+
skyux_date_range_picker_format_label_last_quarter: {
|
|
67
|
+
message: 'Last quarter',
|
|
68
|
+
},
|
|
69
|
+
skyux_date_range_picker_format_label_this_quarter: {
|
|
70
|
+
message: 'This quarter',
|
|
71
|
+
},
|
|
72
|
+
skyux_date_range_picker_format_label_next_quarter: {
|
|
73
|
+
message: 'Next quarter',
|
|
74
|
+
},
|
|
75
|
+
skyux_date_range_picker_format_label_last_calendar_year: {
|
|
76
|
+
message: 'Last calendar year',
|
|
77
|
+
},
|
|
78
|
+
skyux_date_range_picker_format_label_this_calendar_year: {
|
|
79
|
+
message: 'This calendar year',
|
|
80
|
+
},
|
|
81
|
+
skyux_date_range_picker_format_label_next_calendar_year: {
|
|
82
|
+
message: 'Next calendar year',
|
|
83
|
+
},
|
|
84
|
+
skyux_date_range_picker_format_label_last_fiscal_year: {
|
|
85
|
+
message: 'Last fiscal year',
|
|
86
|
+
},
|
|
87
|
+
skyux_date_range_picker_format_label_this_fiscal_year: {
|
|
88
|
+
message: 'This fiscal year',
|
|
89
|
+
},
|
|
90
|
+
skyux_date_range_picker_format_label_next_fiscal_year: {
|
|
91
|
+
message: 'Next fiscal year',
|
|
92
|
+
},
|
|
93
|
+
skyux_date_range_picker_start_date_label: { message: 'From date' },
|
|
94
|
+
skyux_date_range_picker_end_date_label: { message: 'To date' },
|
|
95
|
+
skyux_date_range_picker_before_date_label: { message: 'Before date' },
|
|
96
|
+
skyux_date_range_picker_after_date_label: { message: 'After date' },
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
export class SkyDatetimeResourcesProvider {
|
|
100
|
+
getString(localeInfo, name) {
|
|
101
|
+
return getLibStringForLocale(RESOURCES, localeInfo.locale, name);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Import into any component library module that needs to use resource strings.
|
|
106
|
+
*/
|
|
107
|
+
export class SkyDatetimeResourcesModule {
|
|
108
|
+
}
|
|
109
|
+
SkyDatetimeResourcesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyDatetimeResourcesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
110
|
+
SkyDatetimeResourcesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyDatetimeResourcesModule, exports: [SkyI18nModule] });
|
|
111
|
+
SkyDatetimeResourcesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyDatetimeResourcesModule, providers: [
|
|
112
|
+
{
|
|
113
|
+
provide: SKY_LIB_RESOURCES_PROVIDERS,
|
|
114
|
+
useClass: SkyDatetimeResourcesProvider,
|
|
115
|
+
multi: true,
|
|
116
|
+
},
|
|
117
|
+
], imports: [SkyI18nModule] });
|
|
118
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyDatetimeResourcesModule, decorators: [{
|
|
119
|
+
type: NgModule,
|
|
120
|
+
args: [{
|
|
121
|
+
exports: [SkyI18nModule],
|
|
122
|
+
providers: [
|
|
123
|
+
{
|
|
124
|
+
provide: SKY_LIB_RESOURCES_PROVIDERS,
|
|
125
|
+
useClass: SkyDatetimeResourcesProvider,
|
|
126
|
+
multi: true,
|
|
127
|
+
},
|
|
128
|
+
],
|
|
129
|
+
}]
|
|
130
|
+
}] });
|
|
131
|
+
//# sourceMappingURL=sky-datetime-resources.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sky-datetime-resources.module.js","sourceRoot":"","sources":["../../../../../../../../libs/components/datetime/src/lib/modules/shared/sky-datetime-resources.module.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EACL,qBAAqB,EAErB,aAAa,EAGb,2BAA2B,GAC5B,MAAM,aAAa,CAAC;;AAErB,MAAM,SAAS,GAA0C;IACvD,OAAO,EAAE;QACP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QACT;YACE,OAAO,EAAE,2BAA2B;YACpC,QAAQ,EAAE,4BAA4B;YACtC,KAAK,EAAE,IAAI;SACZ;KACF,YAPS,aAAa;4FASZ,0BAA0B;kBAVtC,QAAQ;mBAAC;oBACR,OAAO,EAAE,CAAC,aAAa,CAAC;oBACxB,SAAS,EAAE;wBACT;4BACE,OAAO,EAAE,2BAA2B;4BACpC,QAAQ,EAAE,4BAA4B;4BACtC,KAAK,EAAE,IAAI;yBACZ;qBACF;iBACF","sourcesContent":["/**\n * NOTICE: DO NOT MODIFY THIS FILE!\n * The contents of this file were automatically generated by\n * the 'ng generate @skyux/i18n:lib-resources-module modules/shared/sky-datetime' schematic.\n * To update this file, simply rerun the command.\n */\n\nimport { NgModule } from '@angular/core';\nimport {\n getLibStringForLocale,\n SkyAppLocaleInfo,\n SkyI18nModule,\n SkyLibResources,\n SkyLibResourcesProvider,\n SKY_LIB_RESOURCES_PROVIDERS,\n} from '@skyux/i18n';\n\nconst RESOURCES: { [locale: string]: SkyLibResources } = {\n 'EN-AU': {\n skyux_date_range_picker_format_label_last_fiscal_year: {\n message: 'Last financial year',\n },\n skyux_date_range_picker_format_label_this_fiscal_year: {\n message: 'This financial year',\n },\n skyux_date_range_picker_format_label_next_fiscal_year: {\n message: 'Next financial year',\n },\n },\n 'EN-GB': {\n skyux_date_range_picker_format_label_last_fiscal_year: {\n message: 'Last financial year',\n },\n skyux_date_range_picker_format_label_this_fiscal_year: {\n message: 'This financial year',\n },\n skyux_date_range_picker_format_label_next_fiscal_year: {\n message: 'Next financial year',\n },\n },\n 'EN-NZ': {\n skyux_date_range_picker_format_label_last_fiscal_year: {\n message: 'Last financial year',\n },\n skyux_date_range_picker_format_label_this_fiscal_year: {\n message: 'This financial year',\n },\n skyux_date_range_picker_format_label_next_fiscal_year: {\n message: 'Next financial year',\n },\n },\n 'EN-US': {\n skyux_date_field_default_label: { message: 'Date' },\n skyux_datepicker_trigger_button_label: { message: 'Select date' },\n skyux_timepicker_button_label: { message: 'Choose time' },\n skyux_timepicker_close: { message: 'Done' },\n skyux_timepicker_input_default_label: { message: 'Time' },\n skyux_date_range_picker_default_label: { message: 'Select a date range' },\n skyux_date_range_picker_format_label_specific_range: {\n message: 'Specific range',\n },\n skyux_date_range_picker_format_label_before: { message: 'Before' },\n skyux_date_range_picker_format_label_after: { message: 'After' },\n skyux_date_range_picker_format_label_any_time: { message: 'At any time' },\n skyux_date_range_picker_format_label_yesterday: { message: 'Yesterday' },\n skyux_date_range_picker_format_label_today: { message: 'Today' },\n skyux_date_range_picker_format_label_tomorrow: { message: 'Tomorrow' },\n skyux_date_range_picker_format_label_last_week: { message: 'Last week' },\n skyux_date_range_picker_format_label_this_week: { message: 'This week' },\n skyux_date_range_picker_format_label_next_week: { message: 'Next week' },\n skyux_date_range_picker_format_label_last_month: { message: 'Last month' },\n skyux_date_range_picker_format_label_this_month: { message: 'This month' },\n skyux_date_range_picker_format_label_next_month: { message: 'Next month' },\n skyux_date_range_picker_format_label_last_quarter: {\n message: 'Last quarter',\n },\n skyux_date_range_picker_format_label_this_quarter: {\n message: 'This quarter',\n },\n skyux_date_range_picker_format_label_next_quarter: {\n message: 'Next quarter',\n },\n skyux_date_range_picker_format_label_last_calendar_year: {\n message: 'Last calendar year',\n },\n skyux_date_range_picker_format_label_this_calendar_year: {\n message: 'This calendar year',\n },\n skyux_date_range_picker_format_label_next_calendar_year: {\n message: 'Next calendar year',\n },\n skyux_date_range_picker_format_label_last_fiscal_year: {\n message: 'Last fiscal year',\n },\n skyux_date_range_picker_format_label_this_fiscal_year: {\n message: 'This fiscal year',\n },\n skyux_date_range_picker_format_label_next_fiscal_year: {\n message: 'Next fiscal year',\n },\n skyux_date_range_picker_start_date_label: { message: 'From date' },\n skyux_date_range_picker_end_date_label: { message: 'To date' },\n skyux_date_range_picker_before_date_label: { message: 'Before date' },\n skyux_date_range_picker_after_date_label: { message: 'After date' },\n },\n};\n\nexport class SkyDatetimeResourcesProvider implements SkyLibResourcesProvider {\n public getString(localeInfo: SkyAppLocaleInfo, name: string): string {\n return getLibStringForLocale(RESOURCES, localeInfo.locale, name);\n }\n}\n\n/**\n * Import into any component library module that needs to use resource strings.\n */\n@NgModule({\n exports: [SkyI18nModule],\n providers: [\n {\n provide: SKY_LIB_RESOURCES_PROVIDERS,\n useClass: SkyDatetimeResourcesProvider,\n multi: true,\n },\n ],\n})\nexport class SkyDatetimeResourcesModule {}\n"]}
|
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, EventEmitter, Optional, Output, TemplateRef, ViewChild, ViewEncapsulation, } from '@angular/core';
|
|
2
|
+
import { SkyAffixAutoFitContext, SkyAffixService, SkyCoreAdapterService, SkyOverlayService, } from '@skyux/core';
|
|
3
|
+
import { SkyInputBoxHostService } from '@skyux/forms';
|
|
4
|
+
import { SkyThemeService } from '@skyux/theme';
|
|
5
|
+
import { fromEvent, Subject } from 'rxjs';
|
|
6
|
+
import { takeUntil } from 'rxjs/operators';
|
|
7
|
+
import moment from 'moment';
|
|
8
|
+
import * as i0 from "@angular/core";
|
|
9
|
+
import * as i1 from "@skyux/core";
|
|
10
|
+
import * as i2 from "@skyux/forms";
|
|
11
|
+
import * as i3 from "@skyux/theme";
|
|
12
|
+
import * as i4 from "@skyux/indicators";
|
|
13
|
+
import * as i5 from "@angular/common";
|
|
14
|
+
import * as i6 from "@skyux/i18n";
|
|
15
|
+
let nextId = 0;
|
|
16
|
+
/**
|
|
17
|
+
* Creates a SKY UX-themed replacement for the HTML `input` element with `type="time"`.
|
|
18
|
+
* The value that users select is driven through the `ngModel` attribute
|
|
19
|
+
* specified on the `input` element. You must wrap this component around an `input`
|
|
20
|
+
* with the `skyTimepickerInput` directive.
|
|
21
|
+
*/
|
|
22
|
+
export class SkyTimepickerComponent {
|
|
23
|
+
constructor(affixService, changeDetector, coreAdapter, overlayService, inputBoxHostService, themeSvc) {
|
|
24
|
+
this.affixService = affixService;
|
|
25
|
+
this.changeDetector = changeDetector;
|
|
26
|
+
this.coreAdapter = coreAdapter;
|
|
27
|
+
this.overlayService = overlayService;
|
|
28
|
+
this.inputBoxHostService = inputBoxHostService;
|
|
29
|
+
/**
|
|
30
|
+
* Fires when the value in the timepicker input changes.
|
|
31
|
+
*/
|
|
32
|
+
this.selectedTimeChanged = new EventEmitter();
|
|
33
|
+
this.is8601 = false;
|
|
34
|
+
this.timeFormat = 'hh';
|
|
35
|
+
this.ngUnsubscribe = new Subject();
|
|
36
|
+
const uniqueId = nextId++;
|
|
37
|
+
this.timepickerId = `sky-timepicker-${uniqueId}`;
|
|
38
|
+
this.triggerButtonId = `sky-timepicker-button-${uniqueId}`;
|
|
39
|
+
// Update icons when theme changes.
|
|
40
|
+
themeSvc === null || themeSvc === void 0 ? void 0 : themeSvc.settingsChange.pipe(takeUntil(this.ngUnsubscribe)).subscribe(() => {
|
|
41
|
+
this.changeDetector.markForCheck();
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
set disabled(value) {
|
|
45
|
+
this._disabled = value;
|
|
46
|
+
this.changeDetector.markForCheck();
|
|
47
|
+
}
|
|
48
|
+
get disabled() {
|
|
49
|
+
return this._disabled;
|
|
50
|
+
}
|
|
51
|
+
set selectedHour(setHour) {
|
|
52
|
+
let hour;
|
|
53
|
+
let hourOffset = 0;
|
|
54
|
+
if (this.selectedMeridies === 'AM' && setHour === 12) {
|
|
55
|
+
hourOffset = -12;
|
|
56
|
+
}
|
|
57
|
+
if (this.selectedMeridies === 'PM' && setHour !== 12) {
|
|
58
|
+
hourOffset = 12;
|
|
59
|
+
}
|
|
60
|
+
if (this.is8601) {
|
|
61
|
+
hourOffset = 0;
|
|
62
|
+
}
|
|
63
|
+
hour = moment({ hour: setHour }).add(hourOffset, 'hours').hour();
|
|
64
|
+
this.activeTime = moment({
|
|
65
|
+
hour: hour,
|
|
66
|
+
minute: moment(this.activeTime).get('minute') + 0,
|
|
67
|
+
}).toDate();
|
|
68
|
+
this.selectedTimeChanged.emit(this.selectedTime);
|
|
69
|
+
}
|
|
70
|
+
get selectedHour() {
|
|
71
|
+
if (!this.is8601) {
|
|
72
|
+
/* istanbul ignore next */
|
|
73
|
+
return parseInt(moment(this.activeTime).format('h'), 0) || 1;
|
|
74
|
+
}
|
|
75
|
+
/* istanbul ignore else */
|
|
76
|
+
if (this.is8601) {
|
|
77
|
+
return moment(this.activeTime).hour() + 0;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
set selectedMeridies(meridies) {
|
|
81
|
+
/* istanbul ignore else */
|
|
82
|
+
if (!this.is8601) {
|
|
83
|
+
if (meridies.trim() !== this.selectedMeridies) {
|
|
84
|
+
this.activeTime = moment(this.activeTime).add(12, 'hours').toDate();
|
|
85
|
+
this.selectedTimeChanged.emit(this.selectedTime);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
get selectedMeridies() {
|
|
90
|
+
if (this.activeTime) {
|
|
91
|
+
return moment(this.activeTime).format('A');
|
|
92
|
+
}
|
|
93
|
+
return '';
|
|
94
|
+
}
|
|
95
|
+
set selectedMinute(minute) {
|
|
96
|
+
this.activeTime = moment({
|
|
97
|
+
hour: moment(this.activeTime).get('hour') + 0,
|
|
98
|
+
minute: minute,
|
|
99
|
+
}).toDate();
|
|
100
|
+
this.selectedTimeChanged.emit(this.selectedTime);
|
|
101
|
+
}
|
|
102
|
+
get selectedMinute() {
|
|
103
|
+
return moment(this.activeTime).minute() + 0;
|
|
104
|
+
}
|
|
105
|
+
set selectedTime(newTime) {
|
|
106
|
+
if (typeof newTime !== 'undefined') {
|
|
107
|
+
/* sanity check */
|
|
108
|
+
/* istanbul ignore else */
|
|
109
|
+
if (newTime.local !== 'Invalid date') {
|
|
110
|
+
this.activeTime = newTime.iso8601;
|
|
111
|
+
this.changeDetector.markForCheck();
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
get selectedTime() {
|
|
116
|
+
const time = {
|
|
117
|
+
hour: moment(this.activeTime).hour(),
|
|
118
|
+
minute: moment(this.activeTime).minute(),
|
|
119
|
+
meridie: moment(this.activeTime).format('A'),
|
|
120
|
+
timezone: parseInt(moment(this.activeTime).format('Z'), 10),
|
|
121
|
+
iso8601: this.activeTime,
|
|
122
|
+
local: moment(this.activeTime).format(this.localeFormat),
|
|
123
|
+
customFormat: typeof this.returnFormat !== 'undefined'
|
|
124
|
+
? this.returnFormat
|
|
125
|
+
: this.localeFormat,
|
|
126
|
+
};
|
|
127
|
+
return time;
|
|
128
|
+
}
|
|
129
|
+
set timepickerRef(value) {
|
|
130
|
+
if (value) {
|
|
131
|
+
this._timepickerRef = value;
|
|
132
|
+
// Wait for the timepicker component to render before guaging dimensions.
|
|
133
|
+
setTimeout(() => {
|
|
134
|
+
this.destroyAffixer();
|
|
135
|
+
this.createAffixer();
|
|
136
|
+
setTimeout(() => {
|
|
137
|
+
this.coreAdapter.getFocusableChildrenAndApplyFocus(this.timepickerRef, '.sky-timepicker-content', false);
|
|
138
|
+
this.isVisible = true;
|
|
139
|
+
this.changeDetector.markForCheck();
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
get timepickerRef() {
|
|
145
|
+
return this._timepickerRef;
|
|
146
|
+
}
|
|
147
|
+
ngOnInit() {
|
|
148
|
+
this.setFormat(this.timeFormat);
|
|
149
|
+
this.addKeydownListner();
|
|
150
|
+
if (this.inputBoxHostService) {
|
|
151
|
+
this.inputBoxHostService.populate({
|
|
152
|
+
inputTemplate: this.inputTemplateRef,
|
|
153
|
+
buttonsTemplate: this.triggerButtonTemplateRef,
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
ngOnDestroy() {
|
|
158
|
+
this.ngUnsubscribe.next();
|
|
159
|
+
this.ngUnsubscribe.complete();
|
|
160
|
+
this.removePickerEventListeners();
|
|
161
|
+
this.destroyAffixer();
|
|
162
|
+
this.destroyOverlay();
|
|
163
|
+
}
|
|
164
|
+
setFormat(format) {
|
|
165
|
+
let h = 12;
|
|
166
|
+
let m = 12;
|
|
167
|
+
let minuteMultiplier = 5;
|
|
168
|
+
let localeFormat = 'h:mm A';
|
|
169
|
+
if (format === 'hh') {
|
|
170
|
+
h = 12;
|
|
171
|
+
m = 12;
|
|
172
|
+
minuteMultiplier = 5;
|
|
173
|
+
localeFormat = 'h:mm A';
|
|
174
|
+
this.is8601 = false;
|
|
175
|
+
}
|
|
176
|
+
if (format === 'HH') {
|
|
177
|
+
h = 24;
|
|
178
|
+
m = 4;
|
|
179
|
+
minuteMultiplier = 15;
|
|
180
|
+
localeFormat = 'HH:mm';
|
|
181
|
+
this.is8601 = true;
|
|
182
|
+
}
|
|
183
|
+
let data;
|
|
184
|
+
data = {
|
|
185
|
+
hours: Array.apply(undefined, Array(h)).map(function (x, i) {
|
|
186
|
+
if (format === 'hh') {
|
|
187
|
+
return ++i;
|
|
188
|
+
}
|
|
189
|
+
/* istanbul ignore else */
|
|
190
|
+
if (format === 'HH') {
|
|
191
|
+
return i;
|
|
192
|
+
}
|
|
193
|
+
/* istanbul ignore next */
|
|
194
|
+
/* sanity check */
|
|
195
|
+
return 0;
|
|
196
|
+
}),
|
|
197
|
+
minutes: Array.apply(undefined, Array(m)).map(function (x, i) {
|
|
198
|
+
return i * minuteMultiplier;
|
|
199
|
+
}),
|
|
200
|
+
localeFormat: localeFormat,
|
|
201
|
+
minuteMultiplier: minuteMultiplier,
|
|
202
|
+
};
|
|
203
|
+
this.hours = data.hours;
|
|
204
|
+
this.minutes = data.minutes;
|
|
205
|
+
this.localeFormat = data.localeFormat;
|
|
206
|
+
this.minuteMultiplier = data.minuteMultiplier;
|
|
207
|
+
}
|
|
208
|
+
onCloseButtonCick() {
|
|
209
|
+
this.closePicker();
|
|
210
|
+
}
|
|
211
|
+
setTime(event) {
|
|
212
|
+
/* istanbul ignore else */
|
|
213
|
+
if (typeof event !== 'undefined') {
|
|
214
|
+
/* istanbul ignore else */
|
|
215
|
+
if (event.type === 'click') {
|
|
216
|
+
event.stopPropagation();
|
|
217
|
+
if (event.target.name === 'hour') {
|
|
218
|
+
this.selectedHour = parseInt(event.target.innerHTML, 0);
|
|
219
|
+
}
|
|
220
|
+
if (event.target.name === 'minute') {
|
|
221
|
+
this.selectedMinute = parseInt(event.target.innerHTML, 0);
|
|
222
|
+
}
|
|
223
|
+
if (event.target.name === 'meridie') {
|
|
224
|
+
this.selectedMeridies = event.target.innerHTML;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
onTriggerButtonClick() {
|
|
230
|
+
this.openPicker();
|
|
231
|
+
}
|
|
232
|
+
closePicker() {
|
|
233
|
+
this.destroyAffixer();
|
|
234
|
+
this.destroyOverlay();
|
|
235
|
+
this.removePickerEventListeners();
|
|
236
|
+
this.triggerButtonRef.nativeElement.focus();
|
|
237
|
+
this.isOpen = false;
|
|
238
|
+
}
|
|
239
|
+
openPicker() {
|
|
240
|
+
this.isVisible = false;
|
|
241
|
+
this.changeDetector.markForCheck();
|
|
242
|
+
this.removePickerEventListeners();
|
|
243
|
+
this.timepickerUnsubscribe = new Subject();
|
|
244
|
+
this.destroyOverlay();
|
|
245
|
+
this.createOverlay();
|
|
246
|
+
this.isOpen = true;
|
|
247
|
+
this.changeDetector.markForCheck();
|
|
248
|
+
}
|
|
249
|
+
createAffixer() {
|
|
250
|
+
const affixer = this.affixService.createAffixer(this.timepickerRef);
|
|
251
|
+
// Hide timepicker when trigger button is scrolled off screen.
|
|
252
|
+
affixer.placementChange
|
|
253
|
+
.pipe(takeUntil(this.timepickerUnsubscribe))
|
|
254
|
+
.subscribe((change) => {
|
|
255
|
+
this.isVisible = change.placement !== null;
|
|
256
|
+
this.changeDetector.markForCheck();
|
|
257
|
+
});
|
|
258
|
+
affixer.affixTo(this.triggerButtonRef.nativeElement, {
|
|
259
|
+
autoFitContext: SkyAffixAutoFitContext.Viewport,
|
|
260
|
+
enableAutoFit: true,
|
|
261
|
+
horizontalAlignment: 'right',
|
|
262
|
+
isSticky: true,
|
|
263
|
+
placement: 'below',
|
|
264
|
+
});
|
|
265
|
+
this.affixer = affixer;
|
|
266
|
+
}
|
|
267
|
+
destroyAffixer() {
|
|
268
|
+
/*istanbul ignore else*/
|
|
269
|
+
if (this.affixer) {
|
|
270
|
+
this.affixer.destroy();
|
|
271
|
+
this.affixer = undefined;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
createOverlay() {
|
|
275
|
+
const overlay = this.overlayService.create({
|
|
276
|
+
enableClose: false,
|
|
277
|
+
enablePointerEvents: false,
|
|
278
|
+
});
|
|
279
|
+
overlay.backdropClick
|
|
280
|
+
.pipe(takeUntil(this.timepickerUnsubscribe))
|
|
281
|
+
.subscribe(() => {
|
|
282
|
+
/* istanbul ignore else */
|
|
283
|
+
if (this.isOpen) {
|
|
284
|
+
this.closePicker();
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
this.addKeydownListner();
|
|
288
|
+
overlay.attachTemplate(this.timepickerTemplateRef);
|
|
289
|
+
this.overlay = overlay;
|
|
290
|
+
}
|
|
291
|
+
destroyOverlay() {
|
|
292
|
+
/*istanbul ignore else*/
|
|
293
|
+
if (this.overlay) {
|
|
294
|
+
this.overlayService.close(this.overlay);
|
|
295
|
+
this.overlay = undefined;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
addKeydownListner() {
|
|
299
|
+
this.overlayKeydownListner = fromEvent(window.document, 'keydown')
|
|
300
|
+
.pipe(takeUntil(this.ngUnsubscribe))
|
|
301
|
+
.subscribe((event) => {
|
|
302
|
+
var _a;
|
|
303
|
+
const key = (_a = event.key) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
304
|
+
/* istanbul ignore else */
|
|
305
|
+
if (key === 'escape' && this.isOpen) {
|
|
306
|
+
this.closePicker();
|
|
307
|
+
}
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
removePickerEventListeners() {
|
|
311
|
+
var _a;
|
|
312
|
+
/* istanbul ignore else */
|
|
313
|
+
if (this.timepickerUnsubscribe) {
|
|
314
|
+
this.timepickerUnsubscribe.next();
|
|
315
|
+
this.timepickerUnsubscribe.complete();
|
|
316
|
+
this.timepickerUnsubscribe = undefined;
|
|
317
|
+
}
|
|
318
|
+
/* istanbul ignore next */
|
|
319
|
+
(_a = this.overlayKeydownListner) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
SkyTimepickerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyTimepickerComponent, deps: [{ token: i1.SkyAffixService }, { token: i0.ChangeDetectorRef }, { token: i1.SkyCoreAdapterService }, { token: i1.SkyOverlayService }, { token: i2.SkyInputBoxHostService, optional: true }, { token: i3.SkyThemeService, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
323
|
+
SkyTimepickerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkyTimepickerComponent, selector: "sky-timepicker", outputs: { selectedTimeChanged: "selectedTimeChanged" }, viewQueries: [{ propertyName: "timepickerRef", first: true, predicate: ["timepickerRef"], descendants: true, read: ElementRef }, { propertyName: "timepickerTemplateRef", first: true, predicate: ["timepickerTemplateRef"], descendants: true, read: TemplateRef }, { propertyName: "triggerButtonRef", first: true, predicate: ["triggerButtonRef"], descendants: true, read: ElementRef }, { propertyName: "inputTemplateRef", first: true, predicate: ["inputTemplateRef"], descendants: true, read: TemplateRef, static: true }, { propertyName: "triggerButtonTemplateRef", first: true, predicate: ["triggerButtonTemplateRef"], descendants: true, read: TemplateRef, static: true }], ngImport: i0, template: "<div class=\"sky-timepicker\">\n <ng-container *ngIf=\"!inputBoxHostService\">\n <div class=\"sky-input-group\">\n <ng-container *ngTemplateOutlet=\"inputTemplateRef\"></ng-container>\n <ng-container *ngTemplateOutlet=\"triggerButtonTemplateRef\"></ng-container>\n </div>\n </ng-container>\n</div>\n\n<ng-template #inputTemplateRef>\n <ng-content></ng-content>\n</ng-template>\n\n<ng-template #triggerButtonTemplateRef>\n <div class=\"sky-input-group-btn\">\n <button\n aria-haspopup=\"dialog\"\n class=\"sky-btn sky-btn-default sky-input-group-timepicker-btn\"\n type=\"button\"\n [attr.aria-controls]=\"isOpen ? timepickerId : null\"\n [attr.aria-expanded]=\"isOpen\"\n [attr.aria-label]=\"'skyux_timepicker_button_label' | skyLibResources\"\n [attr.id]=\"triggerButtonId\"\n [attr.title]=\"'skyux_timepicker_button_label' | skyLibResources\"\n [disabled]=\"disabled\"\n (click)=\"onTriggerButtonClick()\"\n #triggerButtonRef\n >\n <sky-icon *skyThemeIf=\"'default'\" icon=\"clock-o\" size=\"lg\"></sky-icon>\n <sky-icon\n *skyThemeIf=\"'modern'\"\n icon=\"clock\"\n size=\"lg\"\n iconType=\"skyux\"\n ></sky-icon>\n </button>\n </div>\n</ng-template>\n\n<ng-template #timepickerTemplateRef>\n <div\n class=\"sky-timepicker-container sky-shadow sky-box sky-elevation-4\"\n role=\"dialog\"\n [attr.aria-labelledby]=\"triggerButtonId\"\n [attr.id]=\"timepickerId\"\n [class.sky-timepicker-hidden]=\"!isVisible\"\n #timepickerRef\n >\n <div class=\"sky-timepicker-content\">\n <section\n class=\"sky-timepicker-column\"\n [ngClass]=\"{ 'sky-timepicker-24hour': is8601 }\"\n >\n <ol>\n <li *ngFor=\"let hour of hours\">\n <button\n name=\"hour\"\n type=\"button\"\n [ngClass]=\"{ 'sky-btn-active': selectedHour === hour }\"\n (click)=\"setTime($event)\"\n >\n {{ hour }}\n </button>\n </li>\n </ol>\n </section>\n <section class=\"sky-timepicker-column\">\n <ol>\n <li *ngFor=\"let minute of minutes\">\n <button\n name=\"minute\"\n type=\"button\"\n [ngClass]=\"{ 'sky-btn-active': selectedMinute === minute }\"\n (click)=\"setTime($event)\"\n >\n {{ '00'.substring(0, 2 - minute.toString().length) + minute }}\n </button>\n </li>\n </ol>\n </section>\n <section *ngIf=\"!is8601\" class=\"sky-timepicker-column\">\n <ol>\n <li>\n <button\n name=\"meridie\"\n type=\"button\"\n [ngClass]=\"{ 'sky-btn-active': selectedMeridies === 'AM' }\"\n (click)=\"setTime($event)\"\n >\n AM\n </button>\n </li>\n <li>\n <button\n name=\"meridie\"\n type=\"button\"\n [ngClass]=\"{ 'sky-btn-active': selectedMeridies === 'PM' }\"\n (click)=\"setTime($event)\"\n >\n PM\n </button>\n </li>\n </ol>\n </section>\n </div>\n <div class=\"sky-timepicker-footer\">\n <section class=\"sky-timepicker-column\">\n <button\n class=\"sky-btn sky-btn-primary\"\n type=\"button\"\n (click)=\"onCloseButtonCick()\"\n >\n {{ 'skyux_timepicker_close' | skyLibResources }}\n </button>\n </section>\n </div>\n </div>\n</ng-template>\n", styles: [".sky-timepicker-container{position:fixed;font-size:15px;padding:5px;background-color:#eeeeef;border-radius:5px}.sky-timepicker-container :last-child ol{display:flex;flex-direction:column;height:100%}.sky-timepicker-container :last-child ol li{border-bottom:1px solid #e2e3e4;flex:1}.sky-timepicker-column{margin:5px}.sky-timepicker-column ol{border-top:1px solid #e2e3e4;border-right:1px solid #e2e3e4;border-bottom:1px solid #e2e3e4;border-left:1px solid #e2e3e4;grid-column-gap:1px;column-gap:1px;columns:2;list-style-type:none;margin:0;padding:0}.sky-timepicker-column ol li{text-align:center;cursor:pointer;margin:0}.sky-timepicker-column ol li button{cursor:pointer}.sky-timepicker-column ol li button:focus{outline:thin dotted;outline:-webkit-focus-ring-color auto 5px;outline-offset:-2px}.sky-timepicker-column ol li button:hover{background-color:#eeeeef}.sky-timepicker-column ol li button:active{background-color:#e2e3e4}.sky-timepicker-column ol li button.sky-btn-active:hover{background-color:#c1e8fb}.sky-timepicker-column ol .sky-btn-active{background-color:#c1e8fb;box-shadow:inset 0 0 0 2px #00b4f1;border-radius:3px}.sky-timepicker-column.sky-timepicker-24hour ol{columns:4}.sky-timepicker-column.sky-timepicker-24hour ol li{border-bottom-width:0}.sky-timepicker-content{display:flex}.sky-timepicker-content button{background-color:#fff;border-width:0;padding:5px 15px;width:100%;height:100%}.sky-timepicker-footer{margin:0;padding:0 5px}.sky-timepicker-footer .sky-timepicker-column{margin-left:0;margin-right:0;width:100%}.sky-timepicker-hidden{visibility:hidden}.sky-timepicker-clock-icon-modern{display:none}.sky-theme-modern .sky-timepicker-clock-icon-default{display:none}.sky-theme-modern .sky-timepicker-clock-icon-modern{display:inline}.sky-theme-modern .sky-timepicker-container{background-color:#fff;border:solid 1px #cdcfd2;border-radius:6px;font-size:16px}.sky-theme-modern .sky-timepicker-container:focus-within{border:solid 2px #1870B8;padding:4px}.sky-theme-modern .sky-timepicker-container:last-child ol li{border-bottom:none}.sky-theme-modern .sky-timepicker-container .sky-timepicker-column ol .sky-btn-default{border-width:1px;border-color:transparent;padding:4px 6px;outline:none}.sky-theme-modern .sky-timepicker-container .sky-timepicker-column ol button:hover:not(.sky-btn-active){background-color:transparent}.sky-theme-modern .sky-timepicker-container .sky-timepicker-column ol .sky-btn-active,.sky-theme-modern .sky-timepicker-container .sky-timepicker-column ol button:hover{box-shadow:inset 0 0 0 1px #00b4f1;border-radius:6px}.sky-theme-modern .sky-timepicker-container .sky-timepicker-column ol button:active,.sky-theme-modern .sky-timepicker-container .sky-timepicker-column ol button:focus{outline:none;border-radius:6px;box-shadow:inset 0 0 0 2px #1870b8}.sky-theme-modern.sky-theme-mode-dark .sky-timepicker-container{color:#fbfcfe}.sky-theme-modern.sky-theme-mode-dark .sky-timepicker-container:not(:focus-within){border-color:#686c73}.sky-theme-modern.sky-theme-mode-dark .sky-timepicker-column ol{border-color:#686c73}.sky-theme-modern.sky-theme-mode-dark .sky-timepicker-column ol button{background-color:transparent;color:#fbfcfe}.sky-theme-modern.sky-theme-mode-dark .sky-timepicker-column ol .sky-btn-active{background-color:#009cd1}\n"], components: [{ type: i4.λ4, selector: "sky-icon", inputs: ["icon", "iconType", "size", "fixedWidth", "variant"] }], directives: [{ type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i3.λ3, selector: "[skyThemeIf]", inputs: ["skyThemeIf"] }, { type: i5.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "skyLibResources": i6.SkyLibResourcesPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
324
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyTimepickerComponent, decorators: [{
|
|
325
|
+
type: Component,
|
|
326
|
+
args: [{
|
|
327
|
+
selector: 'sky-timepicker',
|
|
328
|
+
templateUrl: './timepicker.component.html',
|
|
329
|
+
styleUrls: ['./timepicker.component.scss'],
|
|
330
|
+
encapsulation: ViewEncapsulation.None,
|
|
331
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
332
|
+
}]
|
|
333
|
+
}], ctorParameters: function () { return [{ type: i1.SkyAffixService }, { type: i0.ChangeDetectorRef }, { type: i1.SkyCoreAdapterService }, { type: i1.SkyOverlayService }, { type: i2.SkyInputBoxHostService, decorators: [{
|
|
334
|
+
type: Optional
|
|
335
|
+
}] }, { type: i3.SkyThemeService, decorators: [{
|
|
336
|
+
type: Optional
|
|
337
|
+
}] }]; }, propDecorators: { selectedTimeChanged: [{
|
|
338
|
+
type: Output
|
|
339
|
+
}], timepickerRef: [{
|
|
340
|
+
type: ViewChild,
|
|
341
|
+
args: ['timepickerRef', {
|
|
342
|
+
read: ElementRef,
|
|
343
|
+
}]
|
|
344
|
+
}], timepickerTemplateRef: [{
|
|
345
|
+
type: ViewChild,
|
|
346
|
+
args: ['timepickerTemplateRef', {
|
|
347
|
+
read: TemplateRef,
|
|
348
|
+
}]
|
|
349
|
+
}], triggerButtonRef: [{
|
|
350
|
+
type: ViewChild,
|
|
351
|
+
args: ['triggerButtonRef', {
|
|
352
|
+
read: ElementRef,
|
|
353
|
+
}]
|
|
354
|
+
}], inputTemplateRef: [{
|
|
355
|
+
type: ViewChild,
|
|
356
|
+
args: ['inputTemplateRef', {
|
|
357
|
+
read: TemplateRef,
|
|
358
|
+
static: true,
|
|
359
|
+
}]
|
|
360
|
+
}], triggerButtonTemplateRef: [{
|
|
361
|
+
type: ViewChild,
|
|
362
|
+
args: ['triggerButtonTemplateRef', {
|
|
363
|
+
read: TemplateRef,
|
|
364
|
+
static: true,
|
|
365
|
+
}]
|
|
366
|
+
}] } });
|
|
367
|
+
//# sourceMappingURL=timepicker.component.js.map
|