@skyux/datetime 5.1.4 → 5.5.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 +80 -80
  3. package/documentation.json +379 -22
  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 +301 -301
  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 +0 -0
  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 +0 -0
  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 +0 -0
  133. package/{modules → lib/modules}/datepicker/datepicker-input.directive.d.ts +0 -0
  134. package/{modules → lib/modules}/datepicker/datepicker.component.d.ts +0 -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 +0 -0
  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 -10
  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 -331
  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,464 @@
1
+ import { ChangeDetectionStrategy, ChangeDetectorRef, Component, forwardRef, Input, Optional, } from '@angular/core';
2
+ import { FormBuilder, FormControl, NG_VALIDATORS, NG_VALUE_ACCESSOR, } from '@angular/forms';
3
+ import { SkyAppWindowRef } from '@skyux/core';
4
+ import { SkyAppLocaleProvider } from '@skyux/i18n';
5
+ import { SkyThemeService } from '@skyux/theme';
6
+ import { combineLatest, Subject } from 'rxjs';
7
+ import { distinctUntilChanged, first, takeUntil } from 'rxjs/operators';
8
+ import { SkyDateFormatter } from '../datepicker/date-formatter';
9
+ import { SkyDateRangeCalculatorId } from './types/date-range-calculator-id';
10
+ import { SkyDateRangeCalculatorType } from './types/date-range-calculator-type';
11
+ import { SkyDateRangeService } from './date-range.service';
12
+ import * as i0 from "@angular/core";
13
+ import * as i1 from "./date-range.service";
14
+ import * as i2 from "@angular/forms";
15
+ import * as i3 from "@skyux/i18n";
16
+ import * as i4 from "@skyux/core";
17
+ import * as i5 from "@skyux/theme";
18
+ import * as i6 from "@skyux/forms";
19
+ import * as i7 from "../datepicker/datepicker.component";
20
+ import * as i8 from "@angular/common";
21
+ import * as i9 from "../datepicker/datepicker-input.directive";
22
+ /* tslint:disable:no-forward-ref no-use-before-declare */
23
+ const SKY_DATE_RANGE_PICKER_VALUE_ACCESSOR = {
24
+ provide: NG_VALUE_ACCESSOR,
25
+ useExisting: forwardRef(() => SkyDateRangePickerComponent),
26
+ multi: true,
27
+ };
28
+ const SKY_DATE_RANGE_PICKER_VALIDATOR = {
29
+ provide: NG_VALIDATORS,
30
+ useExisting: forwardRef(() => SkyDateRangePickerComponent),
31
+ multi: true,
32
+ };
33
+ /* tslint:enable */
34
+ let uniqueId = 0;
35
+ /**
36
+ * Acts as a form control with a form model of type `SkyDateRangeCalculation`.
37
+ * @example
38
+ * ```
39
+ * <sky-date-range-picker
40
+ * formControlName="myPicker"
41
+ * >
42
+ * </sky-date-range-picker>
43
+ * ```
44
+ */
45
+ export class SkyDateRangePickerComponent {
46
+ constructor(changeDetector, dateRangeService, formBuilder, localeProvider, windowRef, themeSvc) {
47
+ this.changeDetector = changeDetector;
48
+ this.dateRangeService = dateRangeService;
49
+ this.formBuilder = formBuilder;
50
+ this.localeProvider = localeProvider;
51
+ this.windowRef = windowRef;
52
+ /**
53
+ * Indicates whether to require users to specify a start date.
54
+ * @default false
55
+ */
56
+ this.startDateRequired = false;
57
+ /**
58
+ * Indicates whether to require users to specify a end date.
59
+ * @default false
60
+ */
61
+ this.endDateRequired = false;
62
+ this.dateRangePickerId = `sky-date-range-picker-${uniqueId++}`;
63
+ this.isReady = false;
64
+ this.showEndDatePicker = false;
65
+ this.showStartDatePicker = false;
66
+ this.ngUnsubscribe = new Subject();
67
+ this._disabled = false;
68
+ /* istanbul ignore next */
69
+ this.onChange = (_) => { };
70
+ /* istanbul ignore next */
71
+ this.onTouched = () => { };
72
+ /* istanbul ignore next */
73
+ this.onValidatorChange = () => { };
74
+ this.localeProvider
75
+ .getLocaleInfo()
76
+ .pipe(takeUntil(this.ngUnsubscribe))
77
+ .subscribe((localeInfo) => {
78
+ SkyDateFormatter.setLocale(localeInfo.locale);
79
+ this.preferredShortDateFormat =
80
+ SkyDateFormatter.getPreferredShortDateFormat();
81
+ });
82
+ // Update icons when theme changes.
83
+ /* istanbul ignore next */
84
+ themeSvc === null || themeSvc === void 0 ? void 0 : themeSvc.settingsChange.pipe(takeUntil(this.ngUnsubscribe)).subscribe(() => {
85
+ this.changeDetector.markForCheck();
86
+ });
87
+ }
88
+ /**
89
+ * Specifies IDs for the date range options to include in the picker's dropdown.
90
+ * The options specify calculator objects that return two `Date` objects to represent date ranges.
91
+ * By default, this property includes all `SkyDateRangeCalculatorId` values.
92
+ */
93
+ set calculatorIds(value) {
94
+ this._calculatorIds = value;
95
+ }
96
+ get calculatorIds() {
97
+ return (this._calculatorIds || [
98
+ SkyDateRangeCalculatorId.AnyTime,
99
+ SkyDateRangeCalculatorId.Before,
100
+ SkyDateRangeCalculatorId.After,
101
+ SkyDateRangeCalculatorId.SpecificRange,
102
+ SkyDateRangeCalculatorId.Yesterday,
103
+ SkyDateRangeCalculatorId.Today,
104
+ SkyDateRangeCalculatorId.Tomorrow,
105
+ SkyDateRangeCalculatorId.LastWeek,
106
+ SkyDateRangeCalculatorId.ThisWeek,
107
+ SkyDateRangeCalculatorId.NextWeek,
108
+ SkyDateRangeCalculatorId.LastMonth,
109
+ SkyDateRangeCalculatorId.ThisMonth,
110
+ SkyDateRangeCalculatorId.NextMonth,
111
+ SkyDateRangeCalculatorId.LastQuarter,
112
+ SkyDateRangeCalculatorId.ThisQuarter,
113
+ SkyDateRangeCalculatorId.NextQuarter,
114
+ SkyDateRangeCalculatorId.LastCalendarYear,
115
+ SkyDateRangeCalculatorId.ThisCalendarYear,
116
+ SkyDateRangeCalculatorId.NextCalendarYear,
117
+ SkyDateRangeCalculatorId.LastFiscalYear,
118
+ SkyDateRangeCalculatorId.ThisFiscalYear,
119
+ SkyDateRangeCalculatorId.NextFiscalYear,
120
+ ]);
121
+ }
122
+ /**
123
+ * Specifies a date format for
124
+ * [the `sky-datepicker` components](https://developer.blackbaud.com/skyux/components/datepicker)
125
+ * that make up the date range picker. The text input is a composite component of
126
+ * up to two `sky-datepicker` components.
127
+ * @default "MM/DD/YYYY"
128
+ */
129
+ set dateFormat(value) {
130
+ this._dateFormat = value;
131
+ }
132
+ get dateFormat() {
133
+ return this._dateFormat || this.preferredShortDateFormat;
134
+ }
135
+ /**
136
+ * Indicates whether to disable the date range picker.
137
+ * @default false
138
+ */
139
+ set disabled(value) {
140
+ this._disabled = value;
141
+ if (this.formGroup) {
142
+ if (this._disabled) {
143
+ this.formGroup.disable();
144
+ }
145
+ else {
146
+ this.formGroup.enable();
147
+ }
148
+ }
149
+ this.changeDetector.markForCheck();
150
+ }
151
+ get disabled() {
152
+ return this._disabled;
153
+ }
154
+ get startDateLabelResourceKey() {
155
+ if (this.selectedCalculator.type === SkyDateRangeCalculatorType.Range) {
156
+ return 'skyux_date_range_picker_start_date_label';
157
+ }
158
+ return 'skyux_date_range_picker_after_date_label';
159
+ }
160
+ get endDateLabelResourceKey() {
161
+ if (this.selectedCalculator.type === SkyDateRangeCalculatorType.Range) {
162
+ return 'skyux_date_range_picker_end_date_label';
163
+ }
164
+ return 'skyux_date_range_picker_before_date_label';
165
+ }
166
+ get selectedCalculator() {
167
+ return this.getCalculatorById(this.value.calculatorId);
168
+ }
169
+ get calculatorIdControl() {
170
+ return this.formGroup.get('calculatorId');
171
+ }
172
+ get defaultCalculator() {
173
+ return this.calculators[0];
174
+ }
175
+ get defaultValue() {
176
+ return this.defaultCalculator.getValue();
177
+ }
178
+ get endDateControl() {
179
+ return this.formGroup.get('endDate');
180
+ }
181
+ get startDateControl() {
182
+ return this.formGroup.get('startDate');
183
+ }
184
+ get value() {
185
+ if (this._value && this._value.calculatorId !== undefined) {
186
+ return this._value;
187
+ }
188
+ return this.defaultValue;
189
+ }
190
+ ngOnInit() {
191
+ this.createForm();
192
+ this.updateCalculators().then(() => {
193
+ this.addEventListeners();
194
+ this.isReady = true;
195
+ this.resetFormGroupValue();
196
+ this.showRelevantFormFields();
197
+ // Fill in any unprovided values after the calculators have been initialized.
198
+ // For example, if the control is initialized with only the `calculatorId`,
199
+ // allow the calculator to fill in the missing start and end dates.
200
+ const { startDate, endDate } = this.value;
201
+ const defaultValue = this.selectedCalculator.getValue(startDate, endDate);
202
+ const newValue = Object.assign({}, defaultValue, this.value);
203
+ this.setValue(newValue, false);
204
+ // This is needed to address a bug in Angular 4.
205
+ // When a control value is set intially, its value is not represented on the view.
206
+ // See: https://github.com/angular/angular/issues/13792
207
+ /* istanbul ignore else */
208
+ if (this.control) {
209
+ this.control.setValue(this.value, {
210
+ emitEvent: false,
211
+ });
212
+ }
213
+ });
214
+ }
215
+ ngOnChanges(changes) {
216
+ if (changes.calculatorIds && changes.calculatorIds.firstChange === false) {
217
+ this.updateCalculators().then(() => {
218
+ const id = this.calculatorIdControl.value;
219
+ // Maintain the currently selected values if the calculators change after
220
+ // a value has been chosen.
221
+ const found = this.calculators.find((calculator) => {
222
+ return calculator.calculatorId === id;
223
+ });
224
+ /* istanbul ignore else */
225
+ if (!found) {
226
+ const newValue = this.defaultCalculator.getValue();
227
+ this.setValue(newValue);
228
+ this.resetFormGroupValue(newValue);
229
+ this.showRelevantFormFields();
230
+ }
231
+ });
232
+ }
233
+ }
234
+ ngOnDestroy() {
235
+ this.ngUnsubscribe.next();
236
+ this.ngUnsubscribe.complete();
237
+ }
238
+ onFieldBlur() {
239
+ this.onTouched();
240
+ }
241
+ writeValue(value) {
242
+ // Only update the underlying controls when the calculators are ready.
243
+ const notifyChange = false;
244
+ // (We still need to save the initial value set by the consumer's form, however.)
245
+ this.setValue(value, notifyChange);
246
+ if (this.isReady) {
247
+ // When the control's value is set to `null`,
248
+ // set it to the default value.
249
+ if (!value) {
250
+ this.onChange(this.defaultValue);
251
+ }
252
+ this.resetFormGroupValue();
253
+ this.showRelevantFormFields();
254
+ }
255
+ }
256
+ validate(control) {
257
+ if (!this.control) {
258
+ this.control = control;
259
+ }
260
+ if (!this.isReady) {
261
+ return;
262
+ }
263
+ const value = control.value;
264
+ const idControl = this.calculatorIdControl;
265
+ const result = this.selectedCalculator.validate(value);
266
+ let errors;
267
+ if (result) {
268
+ errors = {
269
+ skyDateRange: {
270
+ calculatorId: idControl.value,
271
+ errors: result,
272
+ },
273
+ };
274
+ }
275
+ else {
276
+ errors = this.startDateControl.errors || this.endDateControl.errors;
277
+ }
278
+ if (!errors) {
279
+ // Clear any errors on the calculator select.
280
+ // tslint:disable-next-line:no-null-keyword
281
+ idControl.setErrors(null);
282
+ return;
283
+ }
284
+ idControl.setErrors(errors);
285
+ idControl.markAsTouched();
286
+ idControl.markAsDirty();
287
+ // Need to mark the control as touched for the error messages to appear.
288
+ this.control.markAsTouched();
289
+ // Notify the view to display any errors.
290
+ this.changeDetector.markForCheck();
291
+ return errors;
292
+ }
293
+ registerOnChange(fn) {
294
+ this.onChange = fn;
295
+ }
296
+ registerOnTouched(fn) {
297
+ this.onTouched = fn;
298
+ }
299
+ registerOnValidatorChange(fn) {
300
+ this.onValidatorChange = fn;
301
+ }
302
+ setDisabledState(disabled) {
303
+ this.disabled = disabled;
304
+ }
305
+ setValue(value, notifyChange = true) {
306
+ const isNewValue = !this.dateRangesEqual(this._value, value);
307
+ if (isNewValue) {
308
+ this._value = value;
309
+ if (notifyChange) {
310
+ this.onChange(this.value);
311
+ }
312
+ }
313
+ }
314
+ patchValue(value) {
315
+ const newValue = Object.assign({}, this.value, value);
316
+ this.setValue(newValue);
317
+ }
318
+ createForm() {
319
+ this.formGroup = this.formBuilder.group({
320
+ calculatorId: new FormControl(),
321
+ startDate: new FormControl(),
322
+ endDate: new FormControl(),
323
+ });
324
+ if (this.disabled) {
325
+ this.formGroup.disable();
326
+ }
327
+ }
328
+ showRelevantFormFields() {
329
+ const calculator = this.selectedCalculator;
330
+ let showEndDatePicker = false;
331
+ let showStartDatePicker = false;
332
+ switch (calculator.type) {
333
+ case SkyDateRangeCalculatorType.Before:
334
+ showEndDatePicker = true;
335
+ break;
336
+ case SkyDateRangeCalculatorType.After:
337
+ showStartDatePicker = true;
338
+ break;
339
+ case SkyDateRangeCalculatorType.Range:
340
+ showEndDatePicker = true;
341
+ showStartDatePicker = true;
342
+ break;
343
+ default:
344
+ break;
345
+ }
346
+ this.showEndDatePicker = showEndDatePicker;
347
+ this.showStartDatePicker = showStartDatePicker;
348
+ this.changeDetector.markForCheck();
349
+ }
350
+ resetFormGroupValue(value) {
351
+ // Do not emit a value change event on the underlying form group
352
+ // because we're already watching for changes that are triggered by the end user.
353
+ // For example, if we change the value of the form group internally, we don't want the event
354
+ // listeners to be triggered, as those are reserved for user interactions.
355
+ // (See the event listeners listed below.)
356
+ this.formGroup.reset(value || this.value, {
357
+ emitEvent: false,
358
+ });
359
+ }
360
+ addEventListeners() {
361
+ // Detect errors from the date pickers
362
+ // when control is initialized with a value.
363
+ combineLatest([
364
+ this.startDateControl.statusChanges,
365
+ this.endDateControl.statusChanges,
366
+ ])
367
+ .pipe(first())
368
+ .subscribe((status) => {
369
+ if (status.indexOf('INVALID') > -1) {
370
+ // Wait for initial validation to complete.
371
+ this.windowRef.nativeWindow.setTimeout(() => {
372
+ this.onValidatorChange();
373
+ });
374
+ }
375
+ });
376
+ // Watch for selected calculator change.
377
+ this.calculatorIdControl.valueChanges
378
+ .pipe(takeUntil(this.ngUnsubscribe))
379
+ .subscribe((value) => {
380
+ const id = parseInt(value, 10);
381
+ // if the component is disabled during form creation, null is passed
382
+ // as the value of the calculator id control
383
+ // only handle the value changes if the calculator id is a number
384
+ /* istanbul ignore else */
385
+ if (!isNaN(id)) {
386
+ const calculator = this.getCalculatorById(id);
387
+ const newValue = calculator.getValue();
388
+ this.setValue(newValue);
389
+ this.resetFormGroupValue(newValue);
390
+ this.showRelevantFormFields();
391
+ }
392
+ });
393
+ // Watch for start date value changes.
394
+ this.startDateControl.valueChanges
395
+ .pipe(distinctUntilChanged(), takeUntil(this.ngUnsubscribe))
396
+ .subscribe((startDate) => {
397
+ this.patchValue({ startDate });
398
+ });
399
+ // Watch for end date value changes.
400
+ this.endDateControl.valueChanges
401
+ .pipe(distinctUntilChanged(), takeUntil(this.ngUnsubscribe))
402
+ .subscribe((endDate) => {
403
+ this.patchValue({ endDate });
404
+ });
405
+ // Detect errors from the date inputs and update ng- classes on picker.
406
+ combineLatest([
407
+ this.startDateControl.statusChanges,
408
+ this.endDateControl.statusChanges,
409
+ ])
410
+ .pipe(takeUntil(this.ngUnsubscribe))
411
+ .subscribe(() => {
412
+ this.changeDetector.markForCheck();
413
+ });
414
+ }
415
+ updateCalculators() {
416
+ return this.dateRangeService
417
+ .getCalculators(this.calculatorIds)
418
+ .then((calculators) => {
419
+ this.calculators = calculators;
420
+ this.changeDetector.markForCheck();
421
+ });
422
+ }
423
+ getCalculatorById(id) {
424
+ return this.calculators.find((calculator) => {
425
+ return calculator.calculatorId === id;
426
+ });
427
+ }
428
+ dateRangesEqual(rangeA, rangeB) {
429
+ return JSON.stringify(rangeA) === JSON.stringify(rangeB);
430
+ }
431
+ }
432
+ SkyDateRangePickerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyDateRangePickerComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i1.SkyDateRangeService }, { token: i2.FormBuilder }, { token: i3.SkyAppLocaleProvider }, { token: i4.SkyAppWindowRef }, { token: i5.SkyThemeService, optional: true }], target: i0.ɵɵFactoryTarget.Component });
433
+ SkyDateRangePickerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkyDateRangePickerComponent, selector: "sky-date-range-picker", inputs: { calculatorIds: "calculatorIds", dateFormat: "dateFormat", disabled: "disabled", label: "label", startDateRequired: "startDateRequired", endDateRequired: "endDateRequired" }, providers: [
434
+ SKY_DATE_RANGE_PICKER_VALUE_ACCESSOR,
435
+ SKY_DATE_RANGE_PICKER_VALIDATOR,
436
+ ], usesOnChanges: true, ngImport: i0, template: "<div *ngIf=\"isReady\" class=\"sky-date-range-picker\" [formGroup]=\"formGroup\">\n <div class=\"sky-date-range-picker-form-group\">\n <sky-input-box>\n <label\n class=\"sky-control-label\"\n [attr.for]=\"dateRangePickerId + '-select-calculator'\"\n >\n {{ label || 'skyux_date_range_picker_default_label' | skyLibResources }}\n </label>\n <select\n class=\"sky-form-control\"\n formControlName=\"calculatorId\"\n [attr.id]=\"dateRangePickerId + '-select-calculator'\"\n (blur)=\"onFieldBlur()\"\n >\n <option\n *ngFor=\"let calculator of calculators\"\n [value]=\"calculator.calculatorId\"\n >\n {{ calculator.shortDescription }}\n </option>\n </select>\n </sky-input-box>\n </div>\n\n <div class=\"sky-date-range-picker-form-group\" [hidden]=\"!showStartDatePicker\">\n <sky-input-box>\n <label\n class=\"sky-control-label\"\n [attr.for]=\"dateRangePickerId + '-start-date'\"\n [ngClass]=\"{ 'sky-control-label-required': startDateRequired }\"\n >\n {{ startDateLabelResourceKey | skyLibResources }}\n </label>\n\n <sky-datepicker>\n <input\n formControlName=\"startDate\"\n [attr.aria-label]=\"startDateLabelResourceKey | skyLibResources\"\n [attr.id]=\"dateRangePickerId + '-start-date'\"\n [attr.placeholder]=\"dateFormat\"\n [required]=\"startDateRequired\"\n [dateFormat]=\"dateFormat\"\n (blur)=\"onFieldBlur()\"\n skyDatepickerInput\n />\n </sky-datepicker>\n </sky-input-box>\n </div>\n\n <div class=\"sky-date-range-picker-form-group\" [hidden]=\"!showEndDatePicker\">\n <sky-input-box>\n <label\n class=\"sky-control-label\"\n [attr.for]=\"dateRangePickerId + '-end-date'\"\n [ngClass]=\"{ 'sky-control-label-required': endDateRequired }\"\n >\n {{ endDateLabelResourceKey | skyLibResources }}\n </label>\n\n <sky-datepicker>\n <input\n formControlName=\"endDate\"\n skyDatepickerInput\n [attr.aria-label]=\"endDateLabelResourceKey | skyLibResources\"\n [attr.id]=\"dateRangePickerId + '-end-date'\"\n [attr.placeholder]=\"dateFormat\"\n [dateFormat]=\"dateFormat\"\n [required]=\"endDateRequired\"\n (blur)=\"onFieldBlur()\"\n />\n </sky-datepicker>\n </sky-input-box>\n </div>\n</div>\n", styles: [".sky-date-range-picker{display:flex;margin-left:-5px;margin-right:-5px}.sky-date-range-picker-form-group{padding-left:5px;padding-right:5px}.sky-date-range-picker-form-group:last-child{margin-bottom:0}:host .sky-date-range-picker{flex-direction:column}:host .sky-date-range-picker-form-group{flex-basis:100%}:host-context(.sky-responsive-container-xs) .sky-date-range-picker,:host-context(.sky-responsive-container-sm) .sky-date-range-picker,:host-context(.sky-responsive-container-md) .sky-date-range-picker,:host-context(.sky-responsive-container-lg) .sky-date-range-picker{flex-direction:column}:host-context(.sky-responsive-container-xs) .sky-date-range-picker-form-group,:host-context(.sky-responsive-container-sm) .sky-date-range-picker-form-group,:host-context(.sky-responsive-container-md) .sky-date-range-picker-form-group,:host-context(.sky-responsive-container-lg) .sky-date-range-picker-form-group{flex-basis:100%}@media (min-width: 768px){:host .sky-date-range-picker{flex-direction:initial}:host .sky-date-range-picker-form-group{flex-basis:calc(100% / 3);margin-bottom:0}}:host-context(.sky-responsive-container-sm) .sky-date-range-picker,:host-context(.sky-responsive-container-md) .sky-date-range-picker,:host-context(.sky-responsive-container-lg) .sky-date-range-picker{flex-direction:initial}:host-context(.sky-responsive-container-sm) .sky-date-range-picker-form-group,:host-context(.sky-responsive-container-md) .sky-date-range-picker-form-group,:host-context(.sky-responsive-container-lg) .sky-date-range-picker-form-group{flex-basis:calc(100% / 3);margin-bottom:0}:host-context(.sky-theme-modern) .sky-date-range-picker-form-group{padding:0;margin:0 0 20px}@media (min-width: 768px){:host-context(.sky-theme-modern) .sky-date-range-picker-form-group{margin:0 20px 0 0}}.sky-theme-modern .sky-date-range-picker-form-group{padding:0;margin:0 0 20px}@media (min-width: 768px){.sky-theme-modern .sky-date-range-picker-form-group{margin:0 20px 0 0}}:host-context(.sky-theme-modern .sky-responsive-container-xs) .sky-date-range-picker-form-group{margin:0 0 20px}:host-context(.sky-theme-modern .sky-responsive-container-sm) .sky-date-range-picker-form-group,:host-context(.sky-theme-modern .sky-responsive-container-md) .sky-date-range-picker-form-group,:host-context(.sky-theme-modern .sky-responsive-container-lg) .sky-date-range-picker-form-group{margin:0 20px 0 0}\n"], components: [{ type: i6.λ10, selector: "sky-input-box", inputs: ["hasErrors", "disabled"] }, { type: i7.SkyDatepickerComponent, selector: "sky-datepicker", inputs: ["pickerClass"], outputs: ["calendarDateRangeChange"] }], directives: [{ type: i8.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i2.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2.FormControlName, selector: "[formControlName]", inputs: ["disabled", "formControlName", "ngModel"], outputs: ["ngModelChange"] }, { type: i8.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { type: i2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { type: i8.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i9.SkyDatepickerInputDirective, selector: "[skyDatepickerInput]", inputs: ["dateFormat", "disabled", "maxDate", "minDate", "skyDatepickerInput", "skyDatepickerNoValidate", "startingDay", "strict"] }, { type: i2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }], pipes: { "skyLibResources": i3.SkyLibResourcesPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
437
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyDateRangePickerComponent, decorators: [{
438
+ type: Component,
439
+ args: [{
440
+ selector: 'sky-date-range-picker',
441
+ templateUrl: './date-range-picker.component.html',
442
+ styleUrls: ['./date-range-picker.component.scss'],
443
+ providers: [
444
+ SKY_DATE_RANGE_PICKER_VALUE_ACCESSOR,
445
+ SKY_DATE_RANGE_PICKER_VALIDATOR,
446
+ ],
447
+ changeDetection: ChangeDetectionStrategy.OnPush,
448
+ }]
449
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i1.SkyDateRangeService }, { type: i2.FormBuilder }, { type: i3.SkyAppLocaleProvider }, { type: i4.SkyAppWindowRef }, { type: i5.SkyThemeService, decorators: [{
450
+ type: Optional
451
+ }] }]; }, propDecorators: { calculatorIds: [{
452
+ type: Input
453
+ }], dateFormat: [{
454
+ type: Input
455
+ }], disabled: [{
456
+ type: Input
457
+ }], label: [{
458
+ type: Input
459
+ }], startDateRequired: [{
460
+ type: Input
461
+ }], endDateRequired: [{
462
+ type: Input
463
+ }] } });
464
+ //# sourceMappingURL=date-range-picker.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date-range-picker.component.js","sourceRoot":"","sources":["../../../../../../../../libs/components/datetime/src/lib/modules/date-range-picker/date-range-picker.component.ts","../../../../../../../../libs/components/datetime/src/lib/modules/date-range-picker/date-range-picker.component.html"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,SAAS,EACT,UAAU,EACV,KAAK,EAIL,QAAQ,GAET,MAAM,eAAe,CAAC;AAEvB,OAAO,EAGL,WAAW,EACX,WAAW,EAEX,aAAa,EACb,iBAAiB,GAGlB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,MAAM,C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AS,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAC3D,CAAC;;yHA5eU,2BAA2B;6GAA3B,2BAA2B,wOAN3B;QACT,oCAAoC;QACpC,+BAA+B;KAChC,+CChFH,m+EA2EA;4FDQa,2BAA2B;kBAVvC,SAAS;mBAAC;oBACT,QAAQ,EAAE,uBAAuB;oBACjC,WAAW,EAAE,oCAAoC;oBACjD,SAAS,EAAE,CAAC,oCAAoC,CAAC;oBACjD,SAAS,EAAE;wBACT,oCAAoC;wBACpC,+BAA+B;qBAChC;oBACD,eAAe,EAAE,uBAAuB,CAAC,MAAM;iBAChD;;0BA8KI,QAAQ;4CApKA,aAAa;sBADvB,KAAK;gBA0CK,UAAU;sBADpB,KAAK;gBAcK,QAAQ;sBADlB,KAAK;gBAwBC,KAAK;sBADX,KAAK;gBAQC,iBAAiB;sBADvB,KAAK;gBAQC,eAAe;sBADrB,KAAK","sourcesContent":["import {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n forwardRef,\n Input,\n OnChanges,\n OnDestroy,\n OnInit,\n Optional,\n SimpleChanges,\n} from '@angular/core';\n\nimport {\n AbstractControl,\n ControlValueAccessor,\n FormBuilder,\n FormControl,\n FormGroup,\n NG_VALIDATORS,\n NG_VALUE_ACCESSOR,\n ValidationErrors,\n Validator,\n} from '@angular/forms';\n\nimport { SkyAppWindowRef } from '@skyux/core';\n\nimport { SkyAppLocaleProvider } from '@skyux/i18n';\n\nimport { SkyThemeService } from '@skyux/theme';\n\nimport { combineLatest, Subject } from 'rxjs';\n\nimport { distinctUntilChanged, first, takeUntil } from 'rxjs/operators';\n\nimport { SkyDateFormatter } from '../datepicker/date-formatter';\n\nimport { SkyDateRangeCalculation } from './types/date-range-calculation';\n\nimport { SkyDateRangeCalculatorId } from './types/date-range-calculator-id';\n\nimport { SkyDateRangeCalculatorType } from './types/date-range-calculator-type';\n\nimport { SkyDateRangeCalculator } from './types/date-range-calculator';\n\nimport { SkyDateRangeService } from './date-range.service';\n\n/* tslint:disable:no-forward-ref no-use-before-declare */\nconst SKY_DATE_RANGE_PICKER_VALUE_ACCESSOR = {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => SkyDateRangePickerComponent),\n multi: true,\n};\n\nconst SKY_DATE_RANGE_PICKER_VALIDATOR = {\n provide: NG_VALIDATORS,\n useExisting: forwardRef(() => SkyDateRangePickerComponent),\n multi: true,\n};\n/* tslint:enable */\n\nlet uniqueId = 0;\n\n/**\n * Acts as a form control with a form model of type `SkyDateRangeCalculation`.\n * @example\n * ```\n * <sky-date-range-picker\n * formControlName=\"myPicker\"\n * >\n * </sky-date-range-picker>\n * ```\n */\n@Component({\n selector: 'sky-date-range-picker',\n templateUrl: './date-range-picker.component.html',\n styleUrls: ['./date-range-picker.component.scss'],\n providers: [\n SKY_DATE_RANGE_PICKER_VALUE_ACCESSOR,\n SKY_DATE_RANGE_PICKER_VALIDATOR,\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class SkyDateRangePickerComponent\n implements OnInit, OnChanges, OnDestroy, ControlValueAccessor, Validator\n{\n /**\n * Specifies IDs for the date range options to include in the picker's dropdown.\n * The options specify calculator objects that return two `Date` objects to represent date ranges.\n * By default, this property includes all `SkyDateRangeCalculatorId` values.\n */\n @Input()\n public set calculatorIds(value: SkyDateRangeCalculatorId[]) {\n this._calculatorIds = value;\n }\n\n public get calculatorIds(): SkyDateRangeCalculatorId[] {\n return (\n this._calculatorIds || [\n SkyDateRangeCalculatorId.AnyTime,\n SkyDateRangeCalculatorId.Before,\n SkyDateRangeCalculatorId.After,\n SkyDateRangeCalculatorId.SpecificRange,\n SkyDateRangeCalculatorId.Yesterday,\n SkyDateRangeCalculatorId.Today,\n SkyDateRangeCalculatorId.Tomorrow,\n SkyDateRangeCalculatorId.LastWeek,\n SkyDateRangeCalculatorId.ThisWeek,\n SkyDateRangeCalculatorId.NextWeek,\n SkyDateRangeCalculatorId.LastMonth,\n SkyDateRangeCalculatorId.ThisMonth,\n SkyDateRangeCalculatorId.NextMonth,\n SkyDateRangeCalculatorId.LastQuarter,\n SkyDateRangeCalculatorId.ThisQuarter,\n SkyDateRangeCalculatorId.NextQuarter,\n SkyDateRangeCalculatorId.LastCalendarYear,\n SkyDateRangeCalculatorId.ThisCalendarYear,\n SkyDateRangeCalculatorId.NextCalendarYear,\n SkyDateRangeCalculatorId.LastFiscalYear,\n SkyDateRangeCalculatorId.ThisFiscalYear,\n SkyDateRangeCalculatorId.NextFiscalYear,\n ]\n );\n }\n\n /**\n * Specifies a date format for\n * [the `sky-datepicker` components](https://developer.blackbaud.com/skyux/components/datepicker)\n * that make up the date range picker. The text input is a composite component of\n * up to two `sky-datepicker` components.\n * @default \"MM/DD/YYYY\"\n */\n @Input()\n public set dateFormat(value: string) {\n this._dateFormat = value;\n }\n\n public get dateFormat(): string {\n return this._dateFormat || this.preferredShortDateFormat;\n }\n\n /**\n * Indicates whether to disable the date range picker.\n * @default false\n */\n @Input()\n public set disabled(value: boolean) {\n this._disabled = value;\n\n if (this.formGroup) {\n if (this._disabled) {\n this.formGroup.disable();\n } else {\n this.formGroup.enable();\n }\n }\n\n this.changeDetector.markForCheck();\n }\n\n public get disabled(): boolean {\n return this._disabled;\n }\n\n /**\n * Specifies a label for the date range picker.\n * @required\n */\n @Input()\n public label: string;\n\n /**\n * Indicates whether to require users to specify a start date.\n * @default false\n */\n @Input()\n public startDateRequired: boolean = false;\n\n /**\n * Indicates whether to require users to specify a end date.\n * @default false\n */\n @Input()\n public endDateRequired: boolean = false;\n\n public get startDateLabelResourceKey(): string {\n if (this.selectedCalculator.type === SkyDateRangeCalculatorType.Range) {\n return 'skyux_date_range_picker_start_date_label';\n }\n\n return 'skyux_date_range_picker_after_date_label';\n }\n\n public get endDateLabelResourceKey(): string {\n if (this.selectedCalculator.type === SkyDateRangeCalculatorType.Range) {\n return 'skyux_date_range_picker_end_date_label';\n }\n\n return 'skyux_date_range_picker_before_date_label';\n }\n\n public get selectedCalculator(): SkyDateRangeCalculator {\n return this.getCalculatorById(this.value.calculatorId);\n }\n\n public readonly dateRangePickerId = `sky-date-range-picker-${uniqueId++}`;\n\n public calculators: SkyDateRangeCalculator[];\n public formGroup: FormGroup;\n public isReady = false;\n public showEndDatePicker = false;\n public showStartDatePicker = false;\n\n private get calculatorIdControl(): AbstractControl {\n return this.formGroup.get('calculatorId');\n }\n\n private get defaultCalculator(): SkyDateRangeCalculator {\n return this.calculators[0];\n }\n\n private get defaultValue(): SkyDateRangeCalculation {\n return this.defaultCalculator.getValue();\n }\n\n private get endDateControl(): AbstractControl {\n return this.formGroup.get('endDate');\n }\n\n private get startDateControl(): AbstractControl {\n return this.formGroup.get('startDate');\n }\n\n private get value(): SkyDateRangeCalculation {\n if (this._value && this._value.calculatorId !== undefined) {\n return this._value;\n }\n\n return this.defaultValue;\n }\n\n private control: AbstractControl;\n private preferredShortDateFormat: string;\n private ngUnsubscribe = new Subject<void>();\n\n private _calculatorIds: SkyDateRangeCalculatorId[];\n private _dateFormat: string;\n private _disabled = false;\n private _value: SkyDateRangeCalculation;\n\n constructor(\n private changeDetector: ChangeDetectorRef,\n private dateRangeService: SkyDateRangeService,\n private formBuilder: FormBuilder,\n private localeProvider: SkyAppLocaleProvider,\n private windowRef: SkyAppWindowRef,\n @Optional() themeSvc?: SkyThemeService\n ) {\n this.localeProvider\n .getLocaleInfo()\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe((localeInfo) => {\n SkyDateFormatter.setLocale(localeInfo.locale);\n this.preferredShortDateFormat =\n SkyDateFormatter.getPreferredShortDateFormat();\n });\n\n // Update icons when theme changes.\n /* istanbul ignore next */\n themeSvc?.settingsChange\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe(() => {\n this.changeDetector.markForCheck();\n });\n }\n\n public ngOnInit(): void {\n this.createForm();\n\n this.updateCalculators().then(() => {\n this.addEventListeners();\n\n this.isReady = true;\n\n this.resetFormGroupValue();\n this.showRelevantFormFields();\n\n // Fill in any unprovided values after the calculators have been initialized.\n // For example, if the control is initialized with only the `calculatorId`,\n // allow the calculator to fill in the missing start and end dates.\n const { startDate, endDate } = this.value;\n const defaultValue = this.selectedCalculator.getValue(startDate, endDate);\n const newValue = Object.assign({}, defaultValue, this.value);\n\n this.setValue(newValue, false);\n\n // This is needed to address a bug in Angular 4.\n // When a control value is set intially, its value is not represented on the view.\n // See: https://github.com/angular/angular/issues/13792\n /* istanbul ignore else */\n if (this.control) {\n this.control.setValue(this.value, {\n emitEvent: false,\n });\n }\n });\n }\n\n public ngOnChanges(changes: SimpleChanges): void {\n if (changes.calculatorIds && changes.calculatorIds.firstChange === false) {\n this.updateCalculators().then(() => {\n const id = this.calculatorIdControl.value;\n\n // Maintain the currently selected values if the calculators change after\n // a value has been chosen.\n const found = this.calculators.find((calculator) => {\n return calculator.calculatorId === id;\n });\n\n /* istanbul ignore else */\n if (!found) {\n const newValue = this.defaultCalculator.getValue();\n this.setValue(newValue);\n this.resetFormGroupValue(newValue);\n this.showRelevantFormFields();\n }\n });\n }\n }\n\n public ngOnDestroy(): void {\n this.ngUnsubscribe.next();\n this.ngUnsubscribe.complete();\n }\n\n public onFieldBlur(): void {\n this.onTouched();\n }\n\n public writeValue(value: SkyDateRangeCalculation): void {\n // Only update the underlying controls when the calculators are ready.\n const notifyChange = false;\n\n // (We still need to save the initial value set by the consumer's form, however.)\n this.setValue(value, notifyChange);\n\n if (this.isReady) {\n // When the control's value is set to `null`,\n // set it to the default value.\n if (!value) {\n this.onChange(this.defaultValue);\n }\n\n this.resetFormGroupValue();\n this.showRelevantFormFields();\n }\n }\n\n public validate(control: AbstractControl): ValidationErrors {\n if (!this.control) {\n this.control = control;\n }\n\n if (!this.isReady) {\n return;\n }\n\n const value = control.value;\n const idControl = this.calculatorIdControl;\n const result = this.selectedCalculator.validate(value);\n\n let errors: ValidationErrors;\n\n if (result) {\n errors = {\n skyDateRange: {\n calculatorId: idControl.value,\n errors: result,\n },\n };\n } else {\n errors = this.startDateControl.errors || this.endDateControl.errors;\n }\n\n if (!errors) {\n // Clear any errors on the calculator select.\n // tslint:disable-next-line:no-null-keyword\n idControl.setErrors(null);\n return;\n }\n\n idControl.setErrors(errors);\n idControl.markAsTouched();\n idControl.markAsDirty();\n\n // Need to mark the control as touched for the error messages to appear.\n this.control.markAsTouched();\n\n // Notify the view to display any errors.\n this.changeDetector.markForCheck();\n\n return errors;\n }\n\n public registerOnChange(\n fn: (value: SkyDateRangeCalculation) => SkyDateRangeCalculation\n ): void {\n this.onChange = fn;\n }\n\n public registerOnTouched(fn: () => SkyDateRangeCalculation): void {\n this.onTouched = fn;\n }\n\n public registerOnValidatorChange(fn: () => void): void {\n this.onValidatorChange = fn;\n }\n\n public setDisabledState(disabled: boolean): void {\n this.disabled = disabled;\n }\n\n private setValue(value: SkyDateRangeCalculation, notifyChange = true): void {\n const isNewValue = !this.dateRangesEqual(this._value, value);\n\n if (isNewValue) {\n this._value = value;\n\n if (notifyChange) {\n this.onChange(this.value);\n }\n }\n }\n\n private patchValue(value: any): void {\n const newValue = Object.assign({}, this.value, value);\n\n this.setValue(newValue);\n }\n\n private createForm(): void {\n this.formGroup = this.formBuilder.group({\n calculatorId: new FormControl(),\n startDate: new FormControl(),\n endDate: new FormControl(),\n });\n\n if (this.disabled) {\n this.formGroup.disable();\n }\n }\n\n private showRelevantFormFields(): void {\n const calculator = this.selectedCalculator;\n\n let showEndDatePicker = false;\n let showStartDatePicker = false;\n\n switch (calculator.type) {\n case SkyDateRangeCalculatorType.Before:\n showEndDatePicker = true;\n break;\n\n case SkyDateRangeCalculatorType.After:\n showStartDatePicker = true;\n break;\n\n case SkyDateRangeCalculatorType.Range:\n showEndDatePicker = true;\n showStartDatePicker = true;\n break;\n\n default:\n break;\n }\n\n this.showEndDatePicker = showEndDatePicker;\n this.showStartDatePicker = showStartDatePicker;\n this.changeDetector.markForCheck();\n }\n\n private resetFormGroupValue(value?: SkyDateRangeCalculation): void {\n // Do not emit a value change event on the underlying form group\n // because we're already watching for changes that are triggered by the end user.\n // For example, if we change the value of the form group internally, we don't want the event\n // listeners to be triggered, as those are reserved for user interactions.\n // (See the event listeners listed below.)\n this.formGroup.reset(value || this.value, {\n emitEvent: false,\n });\n }\n\n private addEventListeners(): void {\n // Detect errors from the date pickers\n // when control is initialized with a value.\n combineLatest([\n this.startDateControl.statusChanges,\n this.endDateControl.statusChanges,\n ])\n .pipe(first())\n .subscribe((status: string[]) => {\n if (status.indexOf('INVALID') > -1) {\n // Wait for initial validation to complete.\n this.windowRef.nativeWindow.setTimeout(() => {\n this.onValidatorChange();\n });\n }\n });\n\n // Watch for selected calculator change.\n this.calculatorIdControl.valueChanges\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe((value) => {\n const id = parseInt(value, 10);\n // if the component is disabled during form creation, null is passed\n // as the value of the calculator id control\n // only handle the value changes if the calculator id is a number\n /* istanbul ignore else */\n if (!isNaN(id)) {\n const calculator = this.getCalculatorById(id);\n const newValue = calculator.getValue();\n\n this.setValue(newValue);\n this.resetFormGroupValue(newValue);\n this.showRelevantFormFields();\n }\n });\n\n // Watch for start date value changes.\n this.startDateControl.valueChanges\n .pipe(distinctUntilChanged(), takeUntil(this.ngUnsubscribe))\n .subscribe((startDate) => {\n this.patchValue({ startDate });\n });\n\n // Watch for end date value changes.\n this.endDateControl.valueChanges\n .pipe(distinctUntilChanged(), takeUntil(this.ngUnsubscribe))\n .subscribe((endDate) => {\n this.patchValue({ endDate });\n });\n\n // Detect errors from the date inputs and update ng- classes on picker.\n combineLatest([\n this.startDateControl.statusChanges,\n this.endDateControl.statusChanges,\n ])\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe(() => {\n this.changeDetector.markForCheck();\n });\n }\n\n private updateCalculators(): Promise<void> {\n return this.dateRangeService\n .getCalculators(this.calculatorIds)\n .then((calculators) => {\n this.calculators = calculators;\n this.changeDetector.markForCheck();\n });\n }\n\n private getCalculatorById(\n id: SkyDateRangeCalculatorId\n ): SkyDateRangeCalculator {\n return this.calculators.find((calculator) => {\n return calculator.calculatorId === id;\n });\n }\n\n private dateRangesEqual(\n rangeA: SkyDateRangeCalculation,\n rangeB: SkyDateRangeCalculation\n ): boolean {\n return JSON.stringify(rangeA) === JSON.stringify(rangeB);\n }\n\n /* istanbul ignore next */\n private onChange = (_: SkyDateRangeCalculation) => {};\n /* istanbul ignore next */\n private onTouched = () => {};\n /* istanbul ignore next */\n private onValidatorChange = () => {};\n}\n","<div *ngIf=\"isReady\" class=\"sky-date-range-picker\" [formGroup]=\"formGroup\">\n <div class=\"sky-date-range-picker-form-group\">\n <sky-input-box>\n <label\n class=\"sky-control-label\"\n [attr.for]=\"dateRangePickerId + '-select-calculator'\"\n >\n {{ label || 'skyux_date_range_picker_default_label' | skyLibResources }}\n </label>\n <select\n class=\"sky-form-control\"\n formControlName=\"calculatorId\"\n [attr.id]=\"dateRangePickerId + '-select-calculator'\"\n (blur)=\"onFieldBlur()\"\n >\n <option\n *ngFor=\"let calculator of calculators\"\n [value]=\"calculator.calculatorId\"\n >\n {{ calculator.shortDescription }}\n </option>\n </select>\n </sky-input-box>\n </div>\n\n <div class=\"sky-date-range-picker-form-group\" [hidden]=\"!showStartDatePicker\">\n <sky-input-box>\n <label\n class=\"sky-control-label\"\n [attr.for]=\"dateRangePickerId + '-start-date'\"\n [ngClass]=\"{ 'sky-control-label-required': startDateRequired }\"\n >\n {{ startDateLabelResourceKey | skyLibResources }}\n </label>\n\n <sky-datepicker>\n <input\n formControlName=\"startDate\"\n [attr.aria-label]=\"startDateLabelResourceKey | skyLibResources\"\n [attr.id]=\"dateRangePickerId + '-start-date'\"\n [attr.placeholder]=\"dateFormat\"\n [required]=\"startDateRequired\"\n [dateFormat]=\"dateFormat\"\n (blur)=\"onFieldBlur()\"\n skyDatepickerInput\n />\n </sky-datepicker>\n </sky-input-box>\n </div>\n\n <div class=\"sky-date-range-picker-form-group\" [hidden]=\"!showEndDatePicker\">\n <sky-input-box>\n <label\n class=\"sky-control-label\"\n [attr.for]=\"dateRangePickerId + '-end-date'\"\n [ngClass]=\"{ 'sky-control-label-required': endDateRequired }\"\n >\n {{ endDateLabelResourceKey | skyLibResources }}\n </label>\n\n <sky-datepicker>\n <input\n formControlName=\"endDate\"\n skyDatepickerInput\n [attr.aria-label]=\"endDateLabelResourceKey | skyLibResources\"\n [attr.id]=\"dateRangePickerId + '-end-date'\"\n [attr.placeholder]=\"dateFormat\"\n [dateFormat]=\"dateFormat\"\n [required]=\"endDateRequired\"\n (blur)=\"onFieldBlur()\"\n />\n </sky-datepicker>\n </sky-input-box>\n </div>\n</div>\n"]}
@@ -0,0 +1,47 @@
1
+ import { CommonModule } from '@angular/common';
2
+ import { NgModule } from '@angular/core';
3
+ import { FormsModule, ReactiveFormsModule } from '@angular/forms';
4
+ import { SkyInputBoxModule } from '@skyux/forms';
5
+ import { SkyI18nModule } from '@skyux/i18n';
6
+ import { SkyDatepickerModule } from '../datepicker/datepicker.module';
7
+ import { SkyDatetimeResourcesModule } from '../shared/sky-datetime-resources.module';
8
+ import { SkyDateRangePickerComponent } from './date-range-picker.component';
9
+ import { SkyDateRangeService } from './date-range.service';
10
+ import * as i0 from "@angular/core";
11
+ export class SkyDateRangePickerModule {
12
+ }
13
+ SkyDateRangePickerModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyDateRangePickerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
14
+ SkyDateRangePickerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyDateRangePickerModule, declarations: [SkyDateRangePickerComponent], imports: [CommonModule,
15
+ FormsModule,
16
+ ReactiveFormsModule,
17
+ SkyI18nModule,
18
+ SkyDatepickerModule,
19
+ SkyDatetimeResourcesModule,
20
+ SkyInputBoxModule], exports: [SkyDateRangePickerComponent] });
21
+ SkyDateRangePickerModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyDateRangePickerModule, providers: [SkyDateRangeService], imports: [[
22
+ CommonModule,
23
+ FormsModule,
24
+ ReactiveFormsModule,
25
+ SkyI18nModule,
26
+ SkyDatepickerModule,
27
+ SkyDatetimeResourcesModule,
28
+ SkyInputBoxModule,
29
+ ]] });
30
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyDateRangePickerModule, decorators: [{
31
+ type: NgModule,
32
+ args: [{
33
+ declarations: [SkyDateRangePickerComponent],
34
+ imports: [
35
+ CommonModule,
36
+ FormsModule,
37
+ ReactiveFormsModule,
38
+ SkyI18nModule,
39
+ SkyDatepickerModule,
40
+ SkyDatetimeResourcesModule,
41
+ SkyInputBoxModule,
42
+ ],
43
+ exports: [SkyDateRangePickerComponent],
44
+ providers: [SkyDateRangeService],
45
+ }]
46
+ }] });
47
+ //# sourceMappingURL=date-range-picker.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date-range-picker.module.js","sourceRoot":"","sources":["../../../../../../../../libs/components/datetime/src/lib/modules/date-range-picker/date-range-picker.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAElE,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtE,OAAO,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AAErF,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAE5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;;AAgB3D,MAAM,OAAO,wBAAwB;;sHAAxB,wBAAwB;uHAAxB,wBAAwB,iBAbpB,2BAA2B,aAExC,YAAY;QACZ,WAAW;QACX,mBAAmB;QACnB,aAAa;QACb,mBAAmB;QACnB,0BAA0B;QAC1B,iBAAiB,aAET,2BAA2B;uHAG1B,wBAAwB,aAFxB,CAAC,mBAAmB,CAAC,YAVvB;YACP,YAAY;YACZ,WAAW;YACX,mBAAmB;YACnB,aAAa;YACb,mBAAmB;YACnB,0BAA0B;YAC1B,iBAAiB;SAClB;4FAIU,wBAAwB;kBAdpC,QAAQ;mBAAC;oBACR,YAAY,EAAE,CAAC,2BAA2B,CAAC;oBAC3C,OAAO,EAAE;wBACP,YAAY;wBACZ,WAAW;wBACX,mBAAmB;wBACnB,aAAa;wBACb,mBAAmB;wBACnB,0BAA0B;wBAC1B,iBAAiB;qBAClB;oBACD,OAAO,EAAE,CAAC,2BAA2B,CAAC;oBACtC,SAAS,EAAE,CAAC,mBAAmB,CAAC;iBACjC","sourcesContent":["import { CommonModule } from '@angular/common';\n\nimport { NgModule } from '@angular/core';\n\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\n\nimport { SkyInputBoxModule } from '@skyux/forms';\n\nimport { SkyI18nModule } from '@skyux/i18n';\n\nimport { SkyDatepickerModule } from '../datepicker/datepicker.module';\n\nimport { SkyDatetimeResourcesModule } from '../shared/sky-datetime-resources.module';\n\nimport { SkyDateRangePickerComponent } from './date-range-picker.component';\n\nimport { SkyDateRangeService } from './date-range.service';\n\n@NgModule({\n declarations: [SkyDateRangePickerComponent],\n imports: [\n CommonModule,\n FormsModule,\n ReactiveFormsModule,\n SkyI18nModule,\n SkyDatepickerModule,\n SkyDatetimeResourcesModule,\n SkyInputBoxModule,\n ],\n exports: [SkyDateRangePickerComponent],\n providers: [SkyDateRangeService],\n})\nexport class SkyDateRangePickerModule {}\n"]}