@skyux/datetime 5.1.3 → 5.5.0-beta.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.
Files changed (198) hide show
  1. package/README.md +6 -4
  2. package/bundles/skyux-datetime.umd.js +85 -84
  3. package/documentation.json +412 -49
  4. package/esm2015/index.js +28 -0
  5. package/esm2015/index.js.map +1 -0
  6. package/esm2015/lib/modules/date-pipe/date-format-utility.js +48 -0
  7. package/esm2015/lib/modules/date-pipe/date-format-utility.js.map +1 -0
  8. package/esm2015/lib/modules/date-pipe/date-pipe.module.js +21 -0
  9. package/esm2015/lib/modules/date-pipe/date-pipe.module.js.map +1 -0
  10. package/esm2015/lib/modules/date-pipe/date.pipe.js +65 -0
  11. package/esm2015/lib/modules/date-pipe/date.pipe.js.map +1 -0
  12. package/esm2015/lib/modules/date-pipe/fuzzy-date.pipe.js +47 -0
  13. package/esm2015/lib/modules/date-pipe/fuzzy-date.pipe.js.map +1 -0
  14. package/esm2015/lib/modules/date-range-picker/date-range-picker.component.js +464 -0
  15. package/esm2015/lib/modules/date-range-picker/date-range-picker.component.js.map +1 -0
  16. package/esm2015/lib/modules/date-range-picker/date-range-picker.module.js +47 -0
  17. package/esm2015/lib/modules/date-range-picker/date-range-picker.module.js.map +1 -0
  18. package/esm2015/lib/modules/date-range-picker/date-range.service.js +97 -0
  19. package/esm2015/lib/modules/date-range-picker/date-range.service.js.map +1 -0
  20. package/esm2015/lib/modules/date-range-picker/types/date-range-calculation.js +2 -0
  21. package/esm2015/lib/modules/date-range-picker/types/date-range-calculation.js.map +1 -0
  22. package/esm2015/lib/modules/date-range-picker/types/date-range-calculator-config.js +2 -0
  23. package/esm2015/lib/modules/date-range-picker/types/date-range-calculator-config.js.map +1 -0
  24. package/esm2015/lib/modules/date-range-picker/types/date-range-calculator-date-range-function.js +2 -0
  25. package/esm2015/lib/modules/date-range-picker/types/date-range-calculator-date-range-function.js.map +1 -0
  26. package/esm2015/lib/modules/date-range-picker/types/date-range-calculator-id.js +118 -0
  27. package/esm2015/lib/modules/date-range-picker/types/date-range-calculator-id.js.map +1 -0
  28. package/esm2015/lib/modules/date-range-picker/types/date-range-calculator-type.js +23 -0
  29. package/esm2015/lib/modules/date-range-picker/types/date-range-calculator-type.js.map +1 -0
  30. package/esm2015/lib/modules/date-range-picker/types/date-range-calculator-validate-function.js +2 -0
  31. package/esm2015/lib/modules/date-range-picker/types/date-range-calculator-validate-function.js.map +1 -0
  32. package/esm2015/lib/modules/date-range-picker/types/date-range-calculator.js +56 -0
  33. package/esm2015/lib/modules/date-range-picker/types/date-range-calculator.js.map +1 -0
  34. package/esm2015/lib/modules/date-range-picker/types/date-range-default-calculator-config.js +2 -0
  35. package/esm2015/lib/modules/date-range-picker/types/date-range-default-calculator-config.js.map +1 -0
  36. package/esm2015/lib/modules/date-range-picker/types/date-range-default-calculator-configs.js +147 -0
  37. package/esm2015/lib/modules/date-range-picker/types/date-range-default-calculator-configs.js.map +1 -0
  38. package/esm2015/lib/modules/date-range-picker/types/date-range-relative-value.js +252 -0
  39. package/esm2015/lib/modules/date-range-picker/types/date-range-relative-value.js.map +1 -0
  40. package/esm2015/lib/modules/date-range-picker/types/date-range.js +2 -0
  41. package/esm2015/lib/modules/date-range-picker/types/date-range.js.map +1 -0
  42. package/esm2015/lib/modules/datepicker/date-formatter.js +38 -0
  43. package/esm2015/lib/modules/datepicker/date-formatter.js.map +1 -0
  44. package/esm2015/lib/modules/datepicker/datepicker-adapter.service.js +33 -0
  45. package/esm2015/lib/modules/datepicker/datepicker-adapter.service.js.map +1 -0
  46. package/esm2015/lib/modules/datepicker/datepicker-calendar-change.js +2 -0
  47. package/esm2015/lib/modules/datepicker/datepicker-calendar-change.js.map +1 -0
  48. package/esm2015/lib/modules/datepicker/datepicker-calendar-inner.component.js +315 -0
  49. package/esm2015/lib/modules/datepicker/datepicker-calendar-inner.component.js.map +1 -0
  50. package/esm2015/lib/modules/datepicker/datepicker-calendar.component.js +109 -0
  51. package/esm2015/lib/modules/datepicker/datepicker-calendar.component.js.map +1 -0
  52. package/esm2015/lib/modules/datepicker/datepicker-config.service.js +21 -0
  53. package/esm2015/lib/modules/datepicker/datepicker-config.service.js.map +1 -0
  54. package/esm2015/lib/modules/datepicker/datepicker-custom-date.js +2 -0
  55. package/esm2015/lib/modules/datepicker/datepicker-custom-date.js.map +1 -0
  56. package/esm2015/lib/modules/datepicker/datepicker-date.js +2 -0
  57. package/esm2015/lib/modules/datepicker/datepicker-date.js.map +1 -0
  58. package/esm2015/lib/modules/datepicker/datepicker-input-fuzzy.directive.js +457 -0
  59. package/esm2015/lib/modules/datepicker/datepicker-input-fuzzy.directive.js.map +1 -0
  60. package/esm2015/lib/modules/datepicker/datepicker-input.directive.js +435 -0
  61. package/esm2015/lib/modules/datepicker/datepicker-input.directive.js.map +1 -0
  62. package/esm2015/lib/modules/datepicker/datepicker.component.js +333 -0
  63. package/esm2015/lib/modules/datepicker/datepicker.component.js.map +1 -0
  64. package/esm2015/lib/modules/datepicker/datepicker.module.js +95 -0
  65. package/esm2015/lib/modules/datepicker/datepicker.module.js.map +1 -0
  66. package/esm2015/lib/modules/datepicker/datepicker.service.js +21 -0
  67. package/esm2015/lib/modules/datepicker/datepicker.service.js.map +1 -0
  68. package/esm2015/lib/modules/datepicker/daypicker-button.component.js +26 -0
  69. package/esm2015/lib/modules/datepicker/daypicker-button.component.js.map +1 -0
  70. package/esm2015/lib/modules/datepicker/daypicker-cell.component.js +130 -0
  71. package/esm2015/lib/modules/datepicker/daypicker-cell.component.js.map +1 -0
  72. package/esm2015/lib/modules/datepicker/daypicker.component.js +215 -0
  73. package/esm2015/lib/modules/datepicker/daypicker.component.js.map +1 -0
  74. package/esm2015/lib/modules/datepicker/fuzzy-date.js +2 -0
  75. package/esm2015/lib/modules/datepicker/fuzzy-date.js.map +1 -0
  76. package/esm2015/lib/modules/datepicker/fuzzy-date.service.js +403 -0
  77. package/esm2015/lib/modules/datepicker/fuzzy-date.service.js.map +1 -0
  78. package/esm2015/lib/modules/datepicker/monthpicker.component.js +84 -0
  79. package/esm2015/lib/modules/datepicker/monthpicker.component.js.map +1 -0
  80. package/esm2015/lib/modules/datepicker/yearpicker.component.js +90 -0
  81. package/esm2015/lib/modules/datepicker/yearpicker.component.js.map +1 -0
  82. package/esm2015/lib/modules/shared/sky-datetime-resources.module.js +131 -0
  83. package/esm2015/lib/modules/shared/sky-datetime-resources.module.js.map +1 -0
  84. package/esm2015/lib/modules/timepicker/timepicker.component.js +367 -0
  85. package/esm2015/lib/modules/timepicker/timepicker.component.js.map +1 -0
  86. package/esm2015/lib/modules/timepicker/timepicker.directive.js +229 -0
  87. package/esm2015/lib/modules/timepicker/timepicker.directive.js.map +1 -0
  88. package/esm2015/lib/modules/timepicker/timepicker.interface.js +2 -0
  89. package/esm2015/lib/modules/timepicker/timepicker.interface.js.map +1 -0
  90. package/esm2015/lib/modules/timepicker/timepicker.module.js +46 -0
  91. package/esm2015/lib/modules/timepicker/timepicker.module.js.map +1 -0
  92. package/esm2015/skyux-datetime.js +2 -2
  93. package/esm2015/skyux-datetime.js.map +1 -0
  94. package/esm2015/testing/datepicker-fixture.js +1 -1
  95. package/esm2015/testing/datepicker-fixture.js.map +1 -0
  96. package/esm2015/testing/public-api.js +1 -1
  97. package/esm2015/testing/public-api.js.map +1 -0
  98. package/esm2015/testing/skyux-datetime-testing.js +1 -1
  99. package/esm2015/testing/skyux-datetime-testing.js.map +1 -0
  100. package/esm2015/testing/timepicker-fixture.js +1 -1
  101. package/esm2015/testing/timepicker-fixture.js.map +1 -0
  102. package/fesm2015/skyux-datetime-testing.js.map +1 -1
  103. package/fesm2015/skyux-datetime.js +305 -304
  104. package/fesm2015/skyux-datetime.js.map +1 -1
  105. package/index.d.ts +25 -0
  106. package/{modules → lib/modules}/date-pipe/date-format-utility.d.ts +0 -0
  107. package/{modules → lib/modules}/date-pipe/date-pipe.module.d.ts +0 -0
  108. package/{modules → lib/modules}/date-pipe/date.pipe.d.ts +0 -0
  109. package/{modules → lib/modules}/date-pipe/fuzzy-date.pipe.d.ts +0 -0
  110. package/{modules → lib/modules}/date-range-picker/date-range-picker.component.d.ts +1 -1
  111. package/{modules → lib/modules}/date-range-picker/date-range-picker.module.d.ts +0 -0
  112. package/{modules → lib/modules}/date-range-picker/date-range.service.d.ts +0 -0
  113. package/{modules → lib/modules}/date-range-picker/types/date-range-calculation.d.ts +0 -0
  114. package/{modules → lib/modules}/date-range-picker/types/date-range-calculator-config.d.ts +0 -0
  115. package/{modules → lib/modules}/date-range-picker/types/date-range-calculator-date-range-function.d.ts +0 -0
  116. package/{modules → lib/modules}/date-range-picker/types/date-range-calculator-id.d.ts +0 -0
  117. package/{modules → lib/modules}/date-range-picker/types/date-range-calculator-type.d.ts +0 -0
  118. package/{modules → lib/modules}/date-range-picker/types/date-range-calculator-validate-function.d.ts +0 -0
  119. package/{modules → lib/modules}/date-range-picker/types/date-range-calculator.d.ts +0 -0
  120. package/{modules → lib/modules}/date-range-picker/types/date-range-default-calculator-config.d.ts +0 -0
  121. package/{modules → lib/modules}/date-range-picker/types/date-range-default-calculator-configs.d.ts +0 -0
  122. package/{modules → lib/modules}/date-range-picker/types/date-range-relative-value.d.ts +0 -0
  123. package/{modules → lib/modules}/date-range-picker/types/date-range.d.ts +0 -0
  124. package/{modules → lib/modules}/datepicker/date-formatter.d.ts +0 -0
  125. package/{modules → lib/modules}/datepicker/datepicker-adapter.service.d.ts +0 -0
  126. package/{modules → lib/modules}/datepicker/datepicker-calendar-change.d.ts +0 -0
  127. package/{modules → lib/modules}/datepicker/datepicker-calendar-inner.component.d.ts +0 -0
  128. package/{modules → lib/modules}/datepicker/datepicker-calendar.component.d.ts +0 -0
  129. package/{modules → lib/modules}/datepicker/datepicker-config.service.d.ts +1 -1
  130. package/{modules → lib/modules}/datepicker/datepicker-custom-date.d.ts +0 -0
  131. package/{modules → lib/modules}/datepicker/datepicker-date.d.ts +0 -0
  132. package/{modules → lib/modules}/datepicker/datepicker-input-fuzzy.directive.d.ts +1 -1
  133. package/{modules → lib/modules}/datepicker/datepicker-input.directive.d.ts +1 -1
  134. package/{modules → lib/modules}/datepicker/datepicker.component.d.ts +1 -0
  135. package/{modules → lib/modules}/datepicker/datepicker.module.d.ts +0 -0
  136. package/{modules → lib/modules}/datepicker/datepicker.service.d.ts +0 -0
  137. package/{modules → lib/modules}/datepicker/daypicker-button.component.d.ts +0 -0
  138. package/{modules → lib/modules}/datepicker/daypicker-cell.component.d.ts +0 -0
  139. package/{modules → lib/modules}/datepicker/daypicker.component.d.ts +0 -0
  140. package/{modules → lib/modules}/datepicker/fuzzy-date.d.ts +0 -0
  141. package/{modules → lib/modules}/datepicker/fuzzy-date.service.d.ts +0 -0
  142. package/{modules → lib/modules}/datepicker/monthpicker.component.d.ts +0 -0
  143. package/{modules → lib/modules}/datepicker/yearpicker.component.d.ts +0 -0
  144. package/{modules → lib/modules}/shared/sky-datetime-resources.module.d.ts +0 -0
  145. package/{modules → lib/modules}/timepicker/timepicker.component.d.ts +0 -0
  146. package/{modules → lib/modules}/timepicker/timepicker.directive.d.ts +1 -1
  147. package/{modules → lib/modules}/timepicker/timepicker.interface.d.ts +0 -0
  148. package/{modules → lib/modules}/timepicker/timepicker.module.d.ts +0 -0
  149. package/package.json +24 -9
  150. package/skyux-datetime.d.ts +1 -1
  151. package/LICENSE +0 -21
  152. package/bundles/skyux-datetime-testing.umd.js.map +0 -1
  153. package/bundles/skyux-datetime.umd.js.map +0 -1
  154. package/esm2015/modules/date-pipe/date-format-utility.js +0 -48
  155. package/esm2015/modules/date-pipe/date-pipe.module.js +0 -21
  156. package/esm2015/modules/date-pipe/date.pipe.js +0 -64
  157. package/esm2015/modules/date-pipe/fuzzy-date.pipe.js +0 -46
  158. package/esm2015/modules/date-range-picker/date-range-picker.component.js +0 -460
  159. package/esm2015/modules/date-range-picker/date-range-picker.module.js +0 -47
  160. package/esm2015/modules/date-range-picker/date-range.service.js +0 -96
  161. package/esm2015/modules/date-range-picker/types/date-range-calculation.js +0 -2
  162. package/esm2015/modules/date-range-picker/types/date-range-calculator-config.js +0 -2
  163. package/esm2015/modules/date-range-picker/types/date-range-calculator-date-range-function.js +0 -2
  164. package/esm2015/modules/date-range-picker/types/date-range-calculator-id.js +0 -118
  165. package/esm2015/modules/date-range-picker/types/date-range-calculator-type.js +0 -23
  166. package/esm2015/modules/date-range-picker/types/date-range-calculator-validate-function.js +0 -2
  167. package/esm2015/modules/date-range-picker/types/date-range-calculator.js +0 -56
  168. package/esm2015/modules/date-range-picker/types/date-range-default-calculator-config.js +0 -2
  169. package/esm2015/modules/date-range-picker/types/date-range-default-calculator-configs.js +0 -147
  170. package/esm2015/modules/date-range-picker/types/date-range-relative-value.js +0 -252
  171. package/esm2015/modules/date-range-picker/types/date-range.js +0 -2
  172. package/esm2015/modules/datepicker/date-formatter.js +0 -38
  173. package/esm2015/modules/datepicker/datepicker-adapter.service.js +0 -33
  174. package/esm2015/modules/datepicker/datepicker-calendar-change.js +0 -2
  175. package/esm2015/modules/datepicker/datepicker-calendar-inner.component.js +0 -315
  176. package/esm2015/modules/datepicker/datepicker-calendar.component.js +0 -108
  177. package/esm2015/modules/datepicker/datepicker-config.service.js +0 -21
  178. package/esm2015/modules/datepicker/datepicker-custom-date.js +0 -2
  179. package/esm2015/modules/datepicker/datepicker-date.js +0 -2
  180. package/esm2015/modules/datepicker/datepicker-input-fuzzy.directive.js +0 -453
  181. package/esm2015/modules/datepicker/datepicker-input.directive.js +0 -432
  182. package/esm2015/modules/datepicker/datepicker.component.js +0 -330
  183. package/esm2015/modules/datepicker/datepicker.module.js +0 -95
  184. package/esm2015/modules/datepicker/datepicker.service.js +0 -21
  185. package/esm2015/modules/datepicker/daypicker-button.component.js +0 -25
  186. package/esm2015/modules/datepicker/daypicker-cell.component.js +0 -128
  187. package/esm2015/modules/datepicker/daypicker.component.js +0 -214
  188. package/esm2015/modules/datepicker/fuzzy-date.js +0 -2
  189. package/esm2015/modules/datepicker/fuzzy-date.service.js +0 -402
  190. package/esm2015/modules/datepicker/monthpicker.component.js +0 -83
  191. package/esm2015/modules/datepicker/yearpicker.component.js +0 -89
  192. package/esm2015/modules/shared/sky-datetime-resources.module.js +0 -131
  193. package/esm2015/modules/timepicker/timepicker.component.js +0 -365
  194. package/esm2015/modules/timepicker/timepicker.directive.js +0 -227
  195. package/esm2015/modules/timepicker/timepicker.interface.js +0 -2
  196. package/esm2015/modules/timepicker/timepicker.module.js +0 -46
  197. package/esm2015/public-api.js +0 -28
  198. package/public-api.d.ts +0 -25
@@ -0,0 +1,315 @@
1
+ import { Component, EventEmitter, Input, Output, ViewEncapsulation, } from '@angular/core';
2
+ import { Subject } from 'rxjs';
3
+ import { SkyDateFormatter } from './date-formatter';
4
+ import * as i0 from "@angular/core";
5
+ import * as i1 from "@angular/common";
6
+ let nextDatepickerId = 0;
7
+ /**
8
+ * @internal
9
+ */
10
+ export class SkyDatepickerCalendarInnerComponent {
11
+ constructor() {
12
+ this.selectedDateChange = new EventEmitter(undefined);
13
+ this.calendarModeChange = new EventEmitter();
14
+ this.minMode = 'day';
15
+ this.maxMode = 'year';
16
+ this.monthColLimit = 3;
17
+ this.yearColLimit = 5;
18
+ this.datepickerMode = 'day';
19
+ this.yearRange = 20;
20
+ this.formatDay = 'DD';
21
+ this.formatMonth = 'MMMM';
22
+ this.formatYear = 'YYYY';
23
+ this.formatDayHeader = 'dd';
24
+ this.formatDayTitle = 'MMMM YYYY';
25
+ this.formatMonthTitle = 'YYYY';
26
+ this.datepickerId = `sky-datepicker-${++nextDatepickerId}`;
27
+ this.stepDay = {};
28
+ this.stepMonth = {};
29
+ this.stepYear = {};
30
+ this.modes = ['day', 'month', 'year'];
31
+ this.dateFormatter = new SkyDateFormatter();
32
+ this.keys = {
33
+ 13: 'enter',
34
+ 32: 'space',
35
+ 33: 'pageup',
36
+ 34: 'pagedown',
37
+ 35: 'end',
38
+ 36: 'home',
39
+ 37: 'left',
40
+ 38: 'up',
41
+ 39: 'right',
42
+ 40: 'down',
43
+ };
44
+ this.ngUnsubscribe = new Subject();
45
+ }
46
+ set selectedDate(value) {
47
+ if (this.dateFormatter.dateIsValid(value)) {
48
+ this._selectedDate = value;
49
+ this.activeDate = value;
50
+ }
51
+ }
52
+ get selectedDate() {
53
+ return this._selectedDate;
54
+ }
55
+ ngOnInit() {
56
+ if (this.selectedDate) {
57
+ this.activeDate = new Date(this.selectedDate);
58
+ }
59
+ else {
60
+ this.activeDate = new Date();
61
+ }
62
+ }
63
+ ngOnChanges(changes) {
64
+ this.refreshView();
65
+ }
66
+ ngOnDestroy() {
67
+ this.ngUnsubscribe.next();
68
+ this.ngUnsubscribe.complete();
69
+ }
70
+ setCompareHandler(handler, type) {
71
+ if (type === 'day') {
72
+ this.compareHandlerDay = handler;
73
+ }
74
+ if (type === 'month') {
75
+ this.compareHandlerMonth = handler;
76
+ }
77
+ if (type === 'year') {
78
+ this.compareHandlerYear = handler;
79
+ }
80
+ }
81
+ compare(date1, date2) {
82
+ if (date1 === undefined || date2 === undefined) {
83
+ return undefined;
84
+ }
85
+ if (this.datepickerMode === 'day' && this.compareHandlerDay) {
86
+ return this.compareHandlerDay(date1, date2);
87
+ }
88
+ if (this.datepickerMode === 'month' && this.compareHandlerMonth) {
89
+ return this.compareHandlerMonth(date1, date2);
90
+ }
91
+ /* istanbul ignore else */
92
+ /* sanity check */
93
+ if (this.datepickerMode === 'year' && this.compareHandlerYear) {
94
+ return this.compareHandlerYear(date1, date2);
95
+ }
96
+ }
97
+ setRefreshViewHandler(handler, type) {
98
+ if (type === 'day') {
99
+ this.refreshViewHandlerDay = handler;
100
+ }
101
+ if (type === 'month') {
102
+ this.refreshViewHandlerMonth = handler;
103
+ }
104
+ if (type === 'year') {
105
+ this.refreshViewHandlerYear = handler;
106
+ }
107
+ }
108
+ refreshView() {
109
+ if (this.datepickerMode === 'day' && this.refreshViewHandlerDay) {
110
+ this.refreshViewHandlerDay();
111
+ }
112
+ if (this.datepickerMode === 'month' && this.refreshViewHandlerMonth) {
113
+ this.refreshViewHandlerMonth();
114
+ }
115
+ if (this.datepickerMode === 'year' && this.refreshViewHandlerYear) {
116
+ this.refreshViewHandlerYear();
117
+ }
118
+ }
119
+ setKeydownHandler(handler, type) {
120
+ if (type === 'day') {
121
+ this.handleKeydownDay = handler;
122
+ }
123
+ if (type === 'month') {
124
+ this.handleKeydownMonth = handler;
125
+ }
126
+ if (type === 'year') {
127
+ this.handleKeydownYear = handler;
128
+ }
129
+ }
130
+ handleKeydown(key, event) {
131
+ if (this.datepickerMode === 'day' && this.handleKeydownDay) {
132
+ this.handleKeydownDay(key, event);
133
+ }
134
+ if (this.datepickerMode === 'month' && this.handleKeydownMonth) {
135
+ this.handleKeydownMonth(key, event);
136
+ }
137
+ if (this.datepickerMode === 'year' && this.handleKeydownYear) {
138
+ this.handleKeydownYear(key, event);
139
+ }
140
+ }
141
+ dateFilter(date, format) {
142
+ return this.dateFormatter.format(date, format);
143
+ }
144
+ isActive(dateObject) {
145
+ if (this.compare(dateObject.date, this.activeDate) === 0) {
146
+ this.activeDateId = dateObject.uid;
147
+ return true;
148
+ }
149
+ return false;
150
+ }
151
+ onKeydown(event) {
152
+ let key = this.keys[event.which];
153
+ if (!key || event.shiftKey || event.altKey) {
154
+ return;
155
+ }
156
+ event.preventDefault();
157
+ event.stopPropagation();
158
+ if (key === 'enter' || key === 'space') {
159
+ if (this.isDisabled(this.activeDate)) {
160
+ return;
161
+ }
162
+ this.select(this.activeDate);
163
+ }
164
+ else if (event.ctrlKey && (key === 'up' || key === 'down')) {
165
+ this.toggleMode(key === 'up' ? 1 : -1);
166
+ }
167
+ else {
168
+ this.handleKeydown(key, event);
169
+ this.refreshView();
170
+ }
171
+ }
172
+ createDateObject(date, format, isSecondary, id) {
173
+ const customDateMatch = this.getCustomDate(date);
174
+ let dateObject = {
175
+ date: new Date(date.getFullYear(), date.getMonth(), date.getDate()),
176
+ label: this.dateFilter(date, format),
177
+ selected: this.compare(date, this.selectedDate) === 0,
178
+ disabled: this.isDisabled(date),
179
+ current: this.compare(date, new Date()) === 0,
180
+ secondary: isSecondary,
181
+ uid: id,
182
+ keyDate: customDateMatch ? customDateMatch.keyDate : undefined,
183
+ keyDateText: customDateMatch ? customDateMatch.keyDateText : [],
184
+ };
185
+ return dateObject;
186
+ }
187
+ createCalendarRows(dates, size) {
188
+ let rows = [];
189
+ while (dates.length > 0) {
190
+ rows.push(dates.splice(0, size));
191
+ }
192
+ return rows;
193
+ }
194
+ /*
195
+ This is ensures that no strangeness happens when converting a date to local time.
196
+ */
197
+ fixTimeZone(date) {
198
+ let newDate = new Date(date);
199
+ newDate.setFullYear(date.getFullYear(), date.getMonth(), date.getDate());
200
+ return newDate;
201
+ }
202
+ selectCalendar(event, date, closePicker = false) {
203
+ if (!closePicker) {
204
+ event.preventDefault();
205
+ event.stopPropagation();
206
+ }
207
+ this.select(date);
208
+ }
209
+ select(date, isManual = true) {
210
+ this.activeDate = new Date(date.getFullYear(), date.getMonth(), date.getDate());
211
+ /*
212
+ Only actually select date if in minmode (day picker mode).
213
+ Otherwise, just change the active view for the datepicker.
214
+ */
215
+ if (this.datepickerMode === this.minMode) {
216
+ this.selectedDate = new Date(this.activeDate);
217
+ if (isManual) {
218
+ this.selectedDateChange.emit(this.selectedDate);
219
+ }
220
+ }
221
+ else {
222
+ this.datepickerMode =
223
+ this.modes[this.modes.indexOf(this.datepickerMode) - 1];
224
+ this.calendarModeChange.emit(this.datepickerMode);
225
+ }
226
+ this.refreshView();
227
+ }
228
+ moveCalendar(event, direction) {
229
+ event.preventDefault();
230
+ event.stopPropagation();
231
+ this.move(direction);
232
+ }
233
+ move(direction) {
234
+ let expectedStep;
235
+ if (this.datepickerMode === 'day') {
236
+ expectedStep = this.stepDay;
237
+ }
238
+ if (this.datepickerMode === 'month') {
239
+ expectedStep = this.stepMonth;
240
+ }
241
+ if (this.datepickerMode === 'year') {
242
+ expectedStep = this.stepYear;
243
+ }
244
+ /* istanbul ignore else */
245
+ /* sanity check */
246
+ if (expectedStep) {
247
+ let year = this.activeDate.getFullYear() + direction * (expectedStep.years || 0);
248
+ let month = this.activeDate.getMonth() + direction * (expectedStep.months || 0);
249
+ this.activeDate = new Date(year, month, 1);
250
+ this.refreshView();
251
+ }
252
+ }
253
+ toggleModeCalendar(event) {
254
+ event.preventDefault();
255
+ event.stopPropagation();
256
+ this.toggleMode(1);
257
+ }
258
+ toggleMode(direction) {
259
+ /*istanbul ignore next */
260
+ direction = direction || 1;
261
+ /* istanbul ignore else */
262
+ /* sanity check */
263
+ if (!(direction === 1 && this.datepickerMode === this.maxMode) &&
264
+ !(this.datepickerMode === this.minMode && direction === -1)) {
265
+ this.datepickerMode =
266
+ this.modes[this.modes.indexOf(this.datepickerMode) + direction];
267
+ this.calendarModeChange.emit(this.datepickerMode);
268
+ this.refreshView();
269
+ }
270
+ }
271
+ /**
272
+ * Date is disabled if it meets any of these criteria:
273
+ * 1. Date falls outside the min or max dates set by the SkyDatepickerConfigService.
274
+ * 2. Date is marked as disabled in the customDates array.
275
+ */
276
+ isDisabled(date) {
277
+ const customDate = this.getCustomDate(date);
278
+ return ((this.minDate && this.compare(date, this.minDate) < 0) ||
279
+ (this.maxDate && this.compare(date, this.maxDate) > 0) ||
280
+ (customDate && customDate.disabled));
281
+ }
282
+ getCustomDate(date) {
283
+ if (this.customDates) {
284
+ return this.customDates.find((customDate) => {
285
+ return customDate.date.getTime() === date.getTime();
286
+ });
287
+ }
288
+ }
289
+ }
290
+ SkyDatepickerCalendarInnerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyDatepickerCalendarInnerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
291
+ SkyDatepickerCalendarInnerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkyDatepickerCalendarInnerComponent, selector: "sky-datepicker-inner", inputs: { customDates: "customDates", startingDay: "startingDay", minDate: "minDate", maxDate: "maxDate", selectedDate: "selectedDate" }, outputs: { selectedDateChange: "selectedDateChange", calendarModeChange: "calendarModeChange" }, usesOnChanges: true, ngImport: i0, template: "<div\n *ngIf=\"datepickerMode\"\n class=\"sky-datepicker-calendar-inner\"\n (keydown)=\"onKeydown($event)\"\n>\n <ng-content></ng-content>\n</div>\n", styles: [".sky-datepicker-calendar-inner{border-radius:5px;background-color:#fff;border-top:1px solid #e2e3e4;border-bottom:1px solid #e2e3e4;border-left:1px solid #e2e3e4;border-right:1px solid #e2e3e4}.sky-datepicker-calendar-inner .sky-btn-default{border-color:transparent;border:2px solid #ffffff}.sky-datepicker-calendar-inner .sky-btn-default:hover{border-color:#eeeeef}.sky-datepicker-calendar-inner .sky-datepicker-center{text-align:center}.sky-datepicker-calendar-inner .sky-datepicker-btn-selected,.sky-datepicker-calendar-inner .sky-btn-default.sky-datepicker-btn-selected:hover{background-color:#c1e8fb;border:2px solid #00b4f1}.sky-datepicker-calendar-inner .sky-btn.sky-btn-active{box-shadow:none}.sky-datepicker-calendar-inner .sky-datepicker-secondary{color:#686c73}.sky-datepicker-calendar-inner .sky-datepicker-btn-date{min-width:100%}.sky-datepicker-calendar-inner .sky-datepicker-calendar-title{width:100%}.sky-datepicker-calendar-inner .sky-datepicker-chevron-modern{display:none}.sky-datepicker-calendar-inner .sky-datepicker-header-left{text-align:left}.sky-datepicker-calendar-inner .sky-datepicker-header-right{text-align:right}.sky-theme-modern .sky-datepicker-calendar-inner{border:none;box-shadow:inset 0 0 0 1px #d2d2d2;border-radius:6px;padding:5px 10px}.sky-theme-modern .sky-datepicker-calendar-inner:focus-within{border:none;box-shadow:inset 0 0 0 2px #1870b8,0 1px 3px #0000004d}.sky-theme-modern .sky-datepicker-calendar-inner .sky-btn-default{border:none;box-shadow:inset 0 0 0 1px transparent;padding:5px 7px}.sky-theme-modern .sky-datepicker-calendar-inner .sky-btn-active,.sky-theme-modern .sky-datepicker-calendar-inner .sky-btn-default:hover{border:none;box-shadow:inset 0 0 0 1px #1870b8}.sky-theme-modern .sky-btn-sm.sky-datepicker-btn-date{height:30px;min-width:0;padding:0;width:30px}.sky-theme-modern .sky-datepicker-chevron-default{display:none}.sky-theme-modern .sky-datepicker-chevron-modern{display:inline;font-size:16px}.sky-theme-modern.sky-theme-mode-dark .sky-datepicker-calendar-inner{background-color:transparent}.sky-theme-modern.sky-theme-mode-dark .sky-datepicker-calendar-inner:not(:focus-within){border:none;box-shadow:inset 0 0 0 1px #686c73}.sky-theme-modern.sky-theme-mode-dark .sky-datepicker-calendar-inner .sky-datepicker-btn-selected{background-color:#009cd1}\n"], directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], encapsulation: i0.ViewEncapsulation.None });
292
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyDatepickerCalendarInnerComponent, decorators: [{
293
+ type: Component,
294
+ args: [{
295
+ selector: 'sky-datepicker-inner',
296
+ templateUrl: './datepicker-calendar-inner.component.html',
297
+ styleUrls: ['./datepicker-calendar-inner.component.scss'],
298
+ encapsulation: ViewEncapsulation.None,
299
+ }]
300
+ }], propDecorators: { customDates: [{
301
+ type: Input
302
+ }], startingDay: [{
303
+ type: Input
304
+ }], minDate: [{
305
+ type: Input
306
+ }], maxDate: [{
307
+ type: Input
308
+ }], selectedDate: [{
309
+ type: Input
310
+ }], selectedDateChange: [{
311
+ type: Output
312
+ }], calendarModeChange: [{
313
+ type: Output
314
+ }] } });
315
+ //# sourceMappingURL=datepicker-calendar-inner.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"datepicker-calendar-inner.component.js","sourceRoot":"","sources":["../../../../../../../../libs/components/datetime/src/lib/modules/datepicker/datepicker-calendar-inner.component.ts","../../../../../../../../libs/components/datetime/src/lib/modules/datepicker/datepicker-calendar-inner.component.html"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,YAAY,EACZ,KAAK,EAIL,MAAM,EAEN,iBAAiB,GACl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AC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YACtD,CAAC,UAAU,IAAI,UAAU,CAAC,QAAQ,CAAC,CACpC,CAAC;IACJ,CAAC;IACO,aAAa,CAAC,IAAU;QAC9B,IAAI,IAAI,CAAC,WAAW,EAAE;YACpB,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,UAAmC,EAAE,EAAE;gBACnE,OAAO,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,IAAI,CAAC,OAAO,EAAE,CAAC;YACtD,CAAC,CAAC,CAAC;SACJ;IACH,CAAC;;iIArYU,mCAAmC;qHAAnC,mCAAmC,4TC7BhD,0JAOA;4FDsBa,mCAAmC;kBAN/C,SAAS;mBAAC;oBACT,QAAQ,EAAE,sBAAsB;oBAChC,WAAW,EAAE,4CAA4C;oBACzD,SAAS,EAAE,CAAC,4CAA4C,CAAC;oBACzD,aAAa,EAAE,iBAAiB,CAAC,IAAI;iBACtC;8BAKQ,WAAW;sBADjB,KAAK;gBAIC,WAAW;sBADjB,KAAK;gBAIC,OAAO;sBADb,KAAK;gBAIC,OAAO;sBADb,KAAK;gBAIK,YAAY;sBADtB,KAAK;gBAaC,kBAAkB;sBADxB,MAAM;gBAMA,kBAAkB;sBADxB,MAAM","sourcesContent":["import {\n Component,\n EventEmitter,\n Input,\n OnChanges,\n OnDestroy,\n OnInit,\n Output,\n SimpleChanges,\n ViewEncapsulation,\n} from '@angular/core';\nimport { SkyDatepickerCustomDate } from './datepicker-custom-date';\nimport { Subject } from 'rxjs';\n\nimport { SkyDateFormatter } from './date-formatter';\n\nimport { SkyDatepickerDate } from './datepicker-date';\n\nlet nextDatepickerId = 0;\n\n/**\n * @internal\n */\n@Component({\n selector: 'sky-datepicker-inner',\n templateUrl: './datepicker-calendar-inner.component.html',\n styleUrls: ['./datepicker-calendar-inner.component.scss'],\n encapsulation: ViewEncapsulation.None,\n})\nexport class SkyDatepickerCalendarInnerComponent\n implements OnDestroy, OnInit, OnChanges\n{\n @Input()\n public customDates: SkyDatepickerCustomDate[];\n\n @Input()\n public startingDay: number;\n\n @Input()\n public minDate: Date;\n\n @Input()\n public maxDate: Date;\n\n @Input()\n public set selectedDate(value: Date) {\n if (this.dateFormatter.dateIsValid(value)) {\n this._selectedDate = value;\n this.activeDate = value;\n }\n }\n\n public get selectedDate(): Date {\n return this._selectedDate;\n }\n\n @Output()\n public selectedDateChange: EventEmitter<Date> = new EventEmitter<Date>(\n undefined\n );\n\n @Output()\n public calendarModeChange: EventEmitter<string> = new EventEmitter<string>();\n\n public activeDate: Date;\n public activeDateId: string;\n\n public minMode: string = 'day';\n public maxMode: string = 'year';\n public monthColLimit: number = 3;\n public yearColLimit: number = 5;\n public datepickerMode: string = 'day';\n public yearRange: number = 20;\n\n public formatDay: string = 'DD';\n public formatMonth: string = 'MMMM';\n public formatYear: string = 'YYYY';\n public formatDayHeader: string = 'dd';\n public formatDayTitle: string = 'MMMM YYYY';\n public formatMonthTitle: string = 'YYYY';\n\n public datepickerId: string = `sky-datepicker-${++nextDatepickerId}`;\n\n public stepDay: any = {};\n public stepMonth: any = {};\n public stepYear: any = {};\n\n protected modes: string[] = ['day', 'month', 'year'];\n protected dateFormatter: SkyDateFormatter = new SkyDateFormatter();\n\n public refreshViewHandlerDay: Function;\n public compareHandlerDay: Function;\n public refreshViewHandlerMonth: Function;\n public compareHandlerMonth: Function;\n public refreshViewHandlerYear: Function;\n public compareHandlerYear: Function;\n\n public handleKeydownDay: Function;\n public handleKeydownMonth: Function;\n public handleKeydownYear: Function;\n\n public keys: any = {\n 13: 'enter',\n 32: 'space',\n 33: 'pageup',\n 34: 'pagedown',\n 35: 'end',\n 36: 'home',\n 37: 'left',\n 38: 'up',\n 39: 'right',\n 40: 'down',\n };\n\n private ngUnsubscribe = new Subject();\n\n private _selectedDate: Date;\n\n public ngOnInit(): void {\n if (this.selectedDate) {\n this.activeDate = new Date(this.selectedDate);\n } else {\n this.activeDate = new Date();\n }\n }\n\n public ngOnChanges(changes: SimpleChanges): void {\n this.refreshView();\n }\n\n public ngOnDestroy(): void {\n this.ngUnsubscribe.next();\n this.ngUnsubscribe.complete();\n }\n\n public setCompareHandler(handler: Function, type: string): void {\n if (type === 'day') {\n this.compareHandlerDay = handler;\n }\n\n if (type === 'month') {\n this.compareHandlerMonth = handler;\n }\n\n if (type === 'year') {\n this.compareHandlerYear = handler;\n }\n }\n\n public compare(date1: Date, date2: Date) {\n if (date1 === undefined || date2 === undefined) {\n return undefined;\n }\n\n if (this.datepickerMode === 'day' && this.compareHandlerDay) {\n return this.compareHandlerDay(date1, date2);\n }\n\n if (this.datepickerMode === 'month' && this.compareHandlerMonth) {\n return this.compareHandlerMonth(date1, date2);\n }\n\n /* istanbul ignore else */\n /* sanity check */\n if (this.datepickerMode === 'year' && this.compareHandlerYear) {\n return this.compareHandlerYear(date1, date2);\n }\n }\n\n public setRefreshViewHandler(handler: Function, type: string): void {\n if (type === 'day') {\n this.refreshViewHandlerDay = handler;\n }\n\n if (type === 'month') {\n this.refreshViewHandlerMonth = handler;\n }\n\n if (type === 'year') {\n this.refreshViewHandlerYear = handler;\n }\n }\n\n public refreshView(): void {\n if (this.datepickerMode === 'day' && this.refreshViewHandlerDay) {\n this.refreshViewHandlerDay();\n }\n\n if (this.datepickerMode === 'month' && this.refreshViewHandlerMonth) {\n this.refreshViewHandlerMonth();\n }\n\n if (this.datepickerMode === 'year' && this.refreshViewHandlerYear) {\n this.refreshViewHandlerYear();\n }\n }\n\n public setKeydownHandler(handler: Function, type: string) {\n if (type === 'day') {\n this.handleKeydownDay = handler;\n }\n\n if (type === 'month') {\n this.handleKeydownMonth = handler;\n }\n\n if (type === 'year') {\n this.handleKeydownYear = handler;\n }\n }\n\n public handleKeydown(key: string, event: KeyboardEvent): void {\n if (this.datepickerMode === 'day' && this.handleKeydownDay) {\n this.handleKeydownDay(key, event);\n }\n\n if (this.datepickerMode === 'month' && this.handleKeydownMonth) {\n this.handleKeydownMonth(key, event);\n }\n\n if (this.datepickerMode === 'year' && this.handleKeydownYear) {\n this.handleKeydownYear(key, event);\n }\n }\n\n public dateFilter(date: Date, format: string): string {\n return this.dateFormatter.format(date, format);\n }\n\n public isActive(dateObject: any): boolean {\n if (this.compare(dateObject.date, this.activeDate) === 0) {\n this.activeDateId = dateObject.uid;\n return true;\n }\n\n return false;\n }\n\n public onKeydown(event: KeyboardEvent) {\n let key = this.keys[event.which];\n\n if (!key || event.shiftKey || event.altKey) {\n return;\n }\n\n event.preventDefault();\n event.stopPropagation();\n\n if (key === 'enter' || key === 'space') {\n if (this.isDisabled(this.activeDate)) {\n return;\n }\n this.select(this.activeDate);\n } else if (event.ctrlKey && (key === 'up' || key === 'down')) {\n this.toggleMode(key === 'up' ? 1 : -1);\n } else {\n this.handleKeydown(key, event);\n this.refreshView();\n }\n }\n\n public createDateObject(\n date: Date,\n format: string,\n isSecondary: boolean,\n id: string\n ): SkyDatepickerDate {\n const customDateMatch = this.getCustomDate(date);\n\n let dateObject: SkyDatepickerDate = {\n date: new Date(date.getFullYear(), date.getMonth(), date.getDate()),\n label: this.dateFilter(date, format),\n selected: this.compare(date, this.selectedDate) === 0,\n disabled: this.isDisabled(date),\n current: this.compare(date, new Date()) === 0,\n secondary: isSecondary,\n uid: id,\n keyDate: customDateMatch ? customDateMatch.keyDate : undefined,\n keyDateText: customDateMatch ? customDateMatch.keyDateText : [],\n };\n\n return dateObject;\n }\n\n public createCalendarRows(\n dates: Array<SkyDatepickerDate>,\n size: number\n ): Array<Array<SkyDatepickerDate>> {\n let rows: Array<Array<SkyDatepickerDate>> = [];\n while (dates.length > 0) {\n rows.push(dates.splice(0, size));\n }\n return rows;\n }\n\n /*\n This is ensures that no strangeness happens when converting a date to local time.\n */\n public fixTimeZone(date: Date): Date {\n let newDate = new Date(date);\n newDate.setFullYear(date.getFullYear(), date.getMonth(), date.getDate());\n\n return newDate;\n }\n\n public selectCalendar(\n event: Event,\n date: Date,\n closePicker: boolean = false\n ) {\n if (!closePicker) {\n event.preventDefault();\n event.stopPropagation();\n }\n this.select(date);\n }\n\n public select(date: Date, isManual: boolean = true): void {\n this.activeDate = new Date(\n date.getFullYear(),\n date.getMonth(),\n date.getDate()\n );\n\n /*\n Only actually select date if in minmode (day picker mode).\n Otherwise, just change the active view for the datepicker.\n */\n if (this.datepickerMode === this.minMode) {\n this.selectedDate = new Date(this.activeDate);\n if (isManual) {\n this.selectedDateChange.emit(this.selectedDate);\n }\n } else {\n this.datepickerMode =\n this.modes[this.modes.indexOf(this.datepickerMode) - 1];\n this.calendarModeChange.emit(this.datepickerMode);\n }\n\n this.refreshView();\n }\n\n public moveCalendar(event: Event, direction: number) {\n event.preventDefault();\n event.stopPropagation();\n this.move(direction);\n }\n\n public move(direction: number): void {\n let expectedStep: any;\n if (this.datepickerMode === 'day') {\n expectedStep = this.stepDay;\n }\n\n if (this.datepickerMode === 'month') {\n expectedStep = this.stepMonth;\n }\n\n if (this.datepickerMode === 'year') {\n expectedStep = this.stepYear;\n }\n\n /* istanbul ignore else */\n /* sanity check */\n if (expectedStep) {\n let year =\n this.activeDate.getFullYear() + direction * (expectedStep.years || 0);\n let month =\n this.activeDate.getMonth() + direction * (expectedStep.months || 0);\n\n this.activeDate = new Date(year, month, 1);\n\n this.refreshView();\n }\n }\n\n public toggleModeCalendar(event: Event) {\n event.preventDefault();\n event.stopPropagation();\n this.toggleMode(1);\n }\n\n public toggleMode(direction: number): void {\n /*istanbul ignore next */\n direction = direction || 1;\n\n /* istanbul ignore else */\n /* sanity check */\n if (\n !(direction === 1 && this.datepickerMode === this.maxMode) &&\n !(this.datepickerMode === this.minMode && direction === -1)\n ) {\n this.datepickerMode =\n this.modes[this.modes.indexOf(this.datepickerMode) + direction];\n this.calendarModeChange.emit(this.datepickerMode);\n this.refreshView();\n }\n }\n\n /**\n * Date is disabled if it meets any of these criteria:\n * 1. Date falls outside the min or max dates set by the SkyDatepickerConfigService.\n * 2. Date is marked as disabled in the customDates array.\n */\n protected isDisabled(date: Date): boolean {\n const customDate = this.getCustomDate(date);\n return (\n (this.minDate && this.compare(date, this.minDate) < 0) ||\n (this.maxDate && this.compare(date, this.maxDate) > 0) ||\n (customDate && customDate.disabled)\n );\n }\n private getCustomDate(date: Date): SkyDatepickerCustomDate | undefined {\n if (this.customDates) {\n return this.customDates.find((customDate: SkyDatepickerCustomDate) => {\n return customDate.date.getTime() === date.getTime();\n });\n }\n }\n}\n","<div\n *ngIf=\"datepickerMode\"\n class=\"sky-datepicker-calendar-inner\"\n (keydown)=\"onKeydown($event)\"\n>\n <ng-content></ng-content>\n</div>\n"]}
@@ -0,0 +1,109 @@
1
+ import { Component, ElementRef, EventEmitter, Input, Output, ViewChild, } from '@angular/core';
2
+ import { SkyDatepickerAdapterService } from './datepicker-adapter.service';
3
+ import { SkyDatepickerCalendarInnerComponent } from './datepicker-calendar-inner.component';
4
+ import { SkyDatepickerConfigService } from './datepicker-config.service';
5
+ import { SkyDateFormatter } from './date-formatter';
6
+ import * as i0 from "@angular/core";
7
+ import * as i1 from "./datepicker-adapter.service";
8
+ import * as i2 from "./datepicker-config.service";
9
+ import * as i3 from "./datepicker-calendar-inner.component";
10
+ import * as i4 from "./daypicker.component";
11
+ import * as i5 from "./monthpicker.component";
12
+ import * as i6 from "./yearpicker.component";
13
+ /**
14
+ * @internal
15
+ */
16
+ export class SkyDatepickerCalendarComponent {
17
+ constructor(adapter, config, elementRef) {
18
+ this.adapter = adapter;
19
+ this.config = config;
20
+ this.elementRef = elementRef;
21
+ this.calendarDateRangeChange = new EventEmitter();
22
+ this.calendarModeChange = new EventEmitter();
23
+ this.selectedDateChange = new EventEmitter(undefined);
24
+ this._now = new Date();
25
+ this.formatter = new SkyDateFormatter();
26
+ this.configureOptions();
27
+ }
28
+ /** starting day of the week from 0-6 (0=Sunday, ..., 6=Saturday) */
29
+ set startingDay(start) {
30
+ this._startingDay = start;
31
+ }
32
+ get startingDay() {
33
+ return this._startingDay || 0;
34
+ }
35
+ /**
36
+ * @internal
37
+ * Indicates if the calendar element's visiblity property is 'visible'.
38
+ */
39
+ get isVisible() {
40
+ return this.adapter.elementIsVisible();
41
+ }
42
+ ngAfterViewInit() {
43
+ this.adapter.init(this.elementRef);
44
+ }
45
+ configureOptions() {
46
+ Object.assign(this, this.config);
47
+ }
48
+ onCalendarDateRangeChange(event) {
49
+ this.calendarDateRangeChange.next(event);
50
+ }
51
+ onCalendarModeChange(event) {
52
+ this.calendarModeChange.emit(event);
53
+ }
54
+ onSelectedDateChange(event) {
55
+ this.selectedDateChange.emit(event);
56
+ }
57
+ writeValue(value) {
58
+ if (value !== undefined &&
59
+ this.formatter.dateIsValid(value) &&
60
+ this.selectedDate !== undefined &&
61
+ this._datepicker.compareHandlerDay(value, this.selectedDate) === 0) {
62
+ return;
63
+ }
64
+ if (this.formatter.dateIsValid(value)) {
65
+ this.selectedDate = value;
66
+ this._datepicker.select(value, false);
67
+ }
68
+ else {
69
+ this.selectedDate = new Date();
70
+ this._datepicker.select(new Date(), false);
71
+ }
72
+ }
73
+ }
74
+ SkyDatepickerCalendarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyDatepickerCalendarComponent, deps: [{ token: i1.SkyDatepickerAdapterService }, { token: i2.SkyDatepickerConfigService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
75
+ SkyDatepickerCalendarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkyDatepickerCalendarComponent, selector: "sky-datepicker-calendar", inputs: { customDates: "customDates", isDaypickerWaiting: "isDaypickerWaiting", minDate: "minDate", maxDate: "maxDate", selectedDate: "selectedDate", startingDay: "startingDay" }, outputs: { calendarDateRangeChange: "calendarDateRangeChange", calendarModeChange: "calendarModeChange", selectedDateChange: "selectedDateChange" }, providers: [SkyDatepickerAdapterService], viewQueries: [{ propertyName: "_datepicker", first: true, predicate: SkyDatepickerCalendarInnerComponent, descendants: true, read: SkyDatepickerCalendarInnerComponent, static: true }], ngImport: i0, template: "<div class=\"sky-datepicker-calendar\">\n <sky-datepicker-inner\n [customDates]=\"customDates\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n [selectedDate]=\"selectedDate\"\n [startingDay]=\"startingDay\"\n (calendarModeChange)=\"onCalendarModeChange($event)\"\n (selectedDateChange)=\"onSelectedDateChange($event)\"\n >\n <sky-daypicker\n tabindex=\"0\"\n [customDates]=\"customDates\"\n [isWaiting]=\"isDaypickerWaiting\"\n (calendarDateRangeChange)=\"onCalendarDateRangeChange($event)\"\n ></sky-daypicker>\n <sky-monthpicker tabindex=\"0\"></sky-monthpicker>\n <sky-yearpicker tabindex=\"0\"></sky-yearpicker>\n </sky-datepicker-inner>\n</div>\n", styles: [".sky-datepicker-calendar{display:block}\n"], components: [{ type: i3.SkyDatepickerCalendarInnerComponent, selector: "sky-datepicker-inner", inputs: ["customDates", "startingDay", "minDate", "maxDate", "selectedDate"], outputs: ["selectedDateChange", "calendarModeChange"] }, { type: i4.SkyDayPickerComponent, selector: "sky-daypicker", inputs: ["customDates", "isWaiting"], outputs: ["calendarDateRangeChange"] }, { type: i5.SkyMonthPickerComponent, selector: "sky-monthpicker" }, { type: i6.SkyYearPickerComponent, selector: "sky-yearpicker" }] });
76
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyDatepickerCalendarComponent, decorators: [{
77
+ type: Component,
78
+ args: [{
79
+ selector: 'sky-datepicker-calendar',
80
+ templateUrl: './datepicker-calendar.component.html',
81
+ styleUrls: ['./datepicker-calendar.component.scss'],
82
+ providers: [SkyDatepickerAdapterService],
83
+ }]
84
+ }], ctorParameters: function () { return [{ type: i1.SkyDatepickerAdapterService }, { type: i2.SkyDatepickerConfigService }, { type: i0.ElementRef }]; }, propDecorators: { customDates: [{
85
+ type: Input
86
+ }], isDaypickerWaiting: [{
87
+ type: Input
88
+ }], minDate: [{
89
+ type: Input
90
+ }], maxDate: [{
91
+ type: Input
92
+ }], selectedDate: [{
93
+ type: Input
94
+ }], startingDay: [{
95
+ type: Input
96
+ }], calendarDateRangeChange: [{
97
+ type: Output
98
+ }], calendarModeChange: [{
99
+ type: Output
100
+ }], selectedDateChange: [{
101
+ type: Output
102
+ }], _datepicker: [{
103
+ type: ViewChild,
104
+ args: [SkyDatepickerCalendarInnerComponent, {
105
+ read: SkyDatepickerCalendarInnerComponent,
106
+ static: true,
107
+ }]
108
+ }] } });
109
+ //# sourceMappingURL=datepicker-calendar.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"datepicker-calendar.component.js","sourceRoot":"","sources":["../../../../../../../../libs/components/datetime/src/lib/modules/datepicker/datepicker-calendar.component.ts","../../../../../../../../libs/components/datetime/src/lib/modules/datepicker/datepicker-calendar.component.html"],"names":[],"mappings":"AAAA,OAAO,EAEL,SAAS,EACT,UAAU,EACV,YAAY,EACZ,KAAK,EACL,MAAM,EACN,SAAS,GACV,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC;AAE3E,OAAO,EAAE,mCAAmC,EAAE,MAAM,uCAAuC,CAAC;AAE5F,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AAEzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;;;;;;;;AAIpD;;GAEG;AAOH,MAAM,OAAO,8BAA8B;IA0DzC,YACU,OAAoC,EACpC,MAAkC,EAClC,UAAsB;QAFtB,YAAO,GAAP,OAAO,CAA6B;QACpC,WAAM,GAAN,MAAM,CAA4B;QAClC,eAAU,GAAV,UAAU,CAAY;QAjCzB,4BAAuB,GAA8C,IAAI,YAAY,EAA+B,CAAC;QAGrH,uBAAkB,GAAyB,IAAI,YAAY,EAAU,CAAC;QAGtE,uBAAkB,GAAuB,IAAI,YAAY,CAC9D,SAAS,CACV,CAAC;QAgBQ,SAAI,GAAS,IAAI,IAAI,EAAE,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AAG,KAAK,CAAC;YAC1B,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;SACvC;aAAM;YACL,IAAI,CAAC,YAAY,GAAG,IAAI,IAAI,EAAE,CAAC;YAC/B,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE,EAAE,KAAK,CAAC,CAAC;SAC5C;IACH,CAAC;;4HAvGU,8BAA8B;gHAA9B,8BAA8B,2XAF9B,CAAC,2BAA2B,CAAC,uEAgD7B,mCAAmC,2BACtC,mCAAmC,2CC5E7C,wsBAoBA;4FDSa,8BAA8B;kBAN1C,SAAS;mBAAC;oBACT,QAAQ,EAAE,yBAAyB;oBACnC,WAAW,EAAE,sCAAsC;oBACnD,SAAS,EAAE,CAAC,sCAAsC,CAAC;oBACnD,SAAS,EAAE,CAAC,2BAA2B,CAAC;iBACzC;oLAGQ,WAAW;sBADjB,KAAK;gBAIC,kBAAkB;sBADxB,KAAK;gBAIC,OAAO;sBADb,KAAK;gBAIC,OAAO;sBADb,KAAK;gBAKC,YAAY;sBADlB,KAAK;gBAKK,WAAW;sBADrB,KAAK;gBAUC,uBAAuB;sBAD7B,MAAM;gBAIA,kBAAkB;sBADxB,MAAM;gBAIA,kBAAkB;sBADxB,MAAM;gBAiBA,WAAW;sBAJjB,SAAS;uBAAC,mCAAmC,EAAE;wBAC9C,IAAI,EAAE,mCAAmC;wBACzC,MAAM,EAAE,IAAI;qBACb","sourcesContent":["import {\n AfterViewInit,\n Component,\n ElementRef,\n EventEmitter,\n Input,\n Output,\n ViewChild,\n} from '@angular/core';\n\nimport { SkyDatepickerAdapterService } from './datepicker-adapter.service';\n\nimport { SkyDatepickerCalendarInnerComponent } from './datepicker-calendar-inner.component';\n\nimport { SkyDatepickerConfigService } from './datepicker-config.service';\n\nimport { SkyDateFormatter } from './date-formatter';\nimport { SkyDatepickerCustomDate } from './datepicker-custom-date';\nimport { SkyDatepickerCalendarChange } from './datepicker-calendar-change';\n\n/**\n * @internal\n */\n@Component({\n selector: 'sky-datepicker-calendar',\n templateUrl: './datepicker-calendar.component.html',\n styleUrls: ['./datepicker-calendar.component.scss'],\n providers: [SkyDatepickerAdapterService],\n})\nexport class SkyDatepickerCalendarComponent implements AfterViewInit {\n @Input()\n public customDates: SkyDatepickerCustomDate[];\n\n @Input()\n public isDaypickerWaiting: boolean;\n\n @Input()\n public minDate: Date;\n\n @Input()\n public maxDate: Date;\n\n /** currently selected date */\n @Input()\n public selectedDate: Date;\n\n /** starting day of the week from 0-6 (0=Sunday, ..., 6=Saturday) */\n @Input()\n public set startingDay(start: number) {\n this._startingDay = start;\n }\n\n public get startingDay() {\n return this._startingDay || 0;\n }\n\n @Output()\n public calendarDateRangeChange: EventEmitter<SkyDatepickerCalendarChange> = new EventEmitter<SkyDatepickerCalendarChange>();\n\n @Output()\n public calendarModeChange: EventEmitter<string> = new EventEmitter<string>();\n\n @Output()\n public selectedDateChange: EventEmitter<Date> = new EventEmitter<Date>(\n undefined\n );\n\n /**\n * @internal\n * Indicates if the calendar element's visiblity property is 'visible'.\n */\n public get isVisible(): boolean {\n return this.adapter.elementIsVisible();\n }\n\n @ViewChild(SkyDatepickerCalendarInnerComponent, {\n read: SkyDatepickerCalendarInnerComponent,\n static: true,\n })\n public _datepicker: SkyDatepickerCalendarInnerComponent;\n\n protected _now: Date = new Date();\n\n private formatter = new SkyDateFormatter();\n\n private _startingDay: number;\n\n public constructor(\n private adapter: SkyDatepickerAdapterService,\n private config: SkyDatepickerConfigService,\n private elementRef: ElementRef\n ) {\n this.configureOptions();\n }\n\n public ngAfterViewInit(): void {\n this.adapter.init(this.elementRef);\n }\n\n public configureOptions(): void {\n Object.assign(this, this.config);\n }\n\n public onCalendarDateRangeChange(event: SkyDatepickerCalendarChange): void {\n this.calendarDateRangeChange.next(event);\n }\n\n public onCalendarModeChange(event: string): void {\n this.calendarModeChange.emit(event);\n }\n\n public onSelectedDateChange(event: Date): void {\n this.selectedDateChange.emit(event);\n }\n\n public writeValue(value: Date): void {\n if (\n value !== undefined &&\n this.formatter.dateIsValid(value) &&\n this.selectedDate !== undefined &&\n this._datepicker.compareHandlerDay(value, this.selectedDate) === 0\n ) {\n return;\n }\n\n if (this.formatter.dateIsValid(value)) {\n this.selectedDate = value;\n this._datepicker.select(value, false);\n } else {\n this.selectedDate = new Date();\n this._datepicker.select(new Date(), false);\n }\n }\n}\n","<div class=\"sky-datepicker-calendar\">\n <sky-datepicker-inner\n [customDates]=\"customDates\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n [selectedDate]=\"selectedDate\"\n [startingDay]=\"startingDay\"\n (calendarModeChange)=\"onCalendarModeChange($event)\"\n (selectedDateChange)=\"onSelectedDateChange($event)\"\n >\n <sky-daypicker\n tabindex=\"0\"\n [customDates]=\"customDates\"\n [isWaiting]=\"isDaypickerWaiting\"\n (calendarDateRangeChange)=\"onCalendarDateRangeChange($event)\"\n ></sky-daypicker>\n <sky-monthpicker tabindex=\"0\"></sky-monthpicker>\n <sky-yearpicker tabindex=\"0\"></sky-yearpicker>\n </sky-datepicker-inner>\n</div>\n"]}
@@ -0,0 +1,21 @@
1
+ import { Injectable } from '@angular/core';
2
+ import * as i0 from "@angular/core";
3
+ export class SkyDatepickerConfigService {
4
+ constructor() {
5
+ /**
6
+ * Specifies the starting day of the week in the calendar,
7
+ * where `0` sets the starting day to Sunday.
8
+ * @default 0
9
+ */
10
+ this.startingDay = 0;
11
+ }
12
+ }
13
+ SkyDatepickerConfigService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyDatepickerConfigService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
14
+ SkyDatepickerConfigService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyDatepickerConfigService, providedIn: 'root' });
15
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyDatepickerConfigService, decorators: [{
16
+ type: Injectable,
17
+ args: [{
18
+ providedIn: 'root',
19
+ }]
20
+ }] });
21
+ //# sourceMappingURL=datepicker-config.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"datepicker-config.service.js","sourceRoot":"","sources":["../../../../../../../../libs/components/datetime/src/lib/modules/datepicker/datepicker-config.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;;AAK3C,MAAM,OAAO,0BAA0B;IAHvC;QAoBE;;;;WAIG;QACI,gBAAW,GAAG,CAAC,CAAC;KACxB;;wHAvBY,0BAA0B;4HAA1B,0BAA0B,cAFzB,MAAM;4FAEP,0BAA0B;kBAHtC,UAAU;mBAAC;oBACV,UAAU,EAAE,MAAM;iBACnB","sourcesContent":["import { Injectable } from '@angular/core';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class SkyDatepickerConfigService {\n /**\n * Specifies the date format for the input.\n * @default \"MM/DD/YYYY\"\n */\n public dateFormat: string;\n\n /**\n * Specifies the latest selectable date that is available in the calendar.\n */\n public maxDate: Date;\n\n /**\n * Specifies the earliest selectable date that is available in the calendar.\n */\n public minDate: Date;\n\n /**\n * Specifies the starting day of the week in the calendar,\n * where `0` sets the starting day to Sunday.\n * @default 0\n */\n public startingDay = 0;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=datepicker-custom-date.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"datepicker-custom-date.js","sourceRoot":"","sources":["../../../../../../../../libs/components/datetime/src/lib/modules/datepicker/datepicker-custom-date.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * The configuration for a custom date.\n */\nexport interface SkyDatepickerCustomDate {\n /**\n * The date to customize.\n */\n date: Date;\n\n /**\n * Indicates whether to disable the date.\n */\n disabled?: boolean;\n\n /**\n * Indicates whether to display the date as a key date in the calendar.\n */\n keyDate?: boolean;\n\n /**\n * Displays a popup of the provided text when hovering over the key date in the calendar.\n */\n keyDateText?: Array<string>;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=datepicker-date.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"datepicker-date.js","sourceRoot":"","sources":["../../../../../../../../libs/components/datetime/src/lib/modules/datepicker/datepicker-date.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * @internal\n */\nexport interface SkyDatepickerDate {\n date: Date;\n label: string;\n selected: boolean;\n disabled: boolean;\n current: boolean;\n secondary: boolean;\n uid: string;\n keyDate?: boolean;\n keyDateText?: Array<string>;\n}\n"]}